Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix term cases #7553

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you want to use break point and explore code execution you can use the ["Run

2. Click on the "Run and Debug" icon in the activity bar of the editor.

3. Click on the "Javascript Debug Terminal" button.
3. Click on the "JavaScript Debug Terminal" button.

4. It will open a terminal, then go to `packages/playground/xxx` and run `pnpm run dev`.

Expand Down Expand Up @@ -229,7 +229,7 @@ The english docs are embedded in the main Vite repo, to allow contributors to wo
1. In order to get all doc files, you first need to clone this repo in your personal account.
2. Keep all the files in `docs/` and remove everything else.

- You should setup your translation site based on all the files in `docs/` folder as a Vitepress project.
- You should setup your translation site based on all the files in `docs/` folder as a VitePress project.
(that said, `package.json` is need).

- Refresh git history by removing `.git` and then `git init`
Expand All @@ -238,7 +238,7 @@ The english docs are embedded in the main Vite repo, to allow contributors to wo

- During this stage, you may be translating documents and synchronizing updates at the same time, but don't worry about that, it's very common in translation contribution.

4. Push your commits to your Github repo. you can setup a netlify preview as well.
5. Use [Ryu-cho](https://github.com/vuejs-translations/ryu-cho) tool to setup a Github Action, automatically track English docs update later.
4. Push your commits to your GitHub repo. you can setup a netlify preview as well.
5. Use [Ryu-cho](https://github.com/vuejs-translations/ryu-cho) tool to setup a GitHub Action, automatically track English docs update later.

We recommend talking with others in Vite Land so you find more contributors for your language to share the maintenance work. Once the translation is done, communicate it to the Vite team so the repo can be moved to the official vitejs org in GitHub.
2 changes: 1 addition & 1 deletion docs/blog/announcing-vite2.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The [programmatic API](https://vitejs.dev/guide/api-javascript.html) has also be

### esbuild Powered Dep Pre-Bundling

Since Vite is a native ESM dev server, it pre-bundles dependencies to reduce the number browser requests and handle CommonJS to ESM conversion. Previously Vite did this using Rollup, and in 2.0 it now uses `esbuild` which results in 10-100x faster dependency pre-bundling. As a reference, cold-booting a test app with heavy dependencies like React Material UI previously took 28 seconds on an M1-powered Macbook Pro and now takes ~1.5 seconds. Expect similar improvements if you are switching from a traditional bundler based setup.
Since Vite is a native ESM dev server, it pre-bundles dependencies to reduce the number browser requests and handle CommonJS to ESM conversion. Previously Vite did this using Rollup, and in 2.0 it now uses `esbuild` which results in 10-100x faster dependency pre-bundling. As a reference, cold-booting a test app with heavy dependencies like React Material UI previously took 28 seconds on an M1-powered MacBook Pro and now takes ~1.5 seconds. Expect similar improvements if you are switching from a traditional bundler based setup.

### First-class CSS Support

Expand Down
10 changes: 5 additions & 5 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export default defineConfig(({ command, mode }) => {

- **Type:** `ESBuildOptions | false`

`ESBuildOptions` extends [ESbuild's own transform options](https://esbuild.github.io/api/#transform-api). The most common use case is customizing JSX:
`ESBuildOptions` extends [esbuild's own transform options](https://esbuild.github.io/api/#transform-api). The most common use case is customizing JSX:

```js
export default defineConfig({
Expand All @@ -368,9 +368,9 @@ export default defineConfig(({ command, mode }) => {
})
```

By default, ESBuild is applied to `ts`, `jsx` and `tsx` files. You can customize this with `esbuild.include` and `esbuild.exclude`, which can be a regex, a [picomatch](https://github.com/micromatch/picomatch#globbing-features) pattern, or an array of either.
By default, esbuild is applied to `ts`, `jsx` and `tsx` files. You can customize this with `esbuild.include` and `esbuild.exclude`, which can be a regex, a [picomatch](https://github.com/micromatch/picomatch#globbing-features) pattern, or an array of either.

In addition, you can also use `esbuild.jsxInject` to automatically inject JSX helper imports for every file transformed by ESBuild:
In addition, you can also use `esbuild.jsxInject` to automatically inject JSX helper imports for every file transformed by esbuild:

```js
export default defineConfig({
Expand All @@ -380,7 +380,7 @@ export default defineConfig(({ command, mode }) => {
})
```

Set to `false` to disable ESbuild transforms.
Set to `false` to disable esbuild transforms.

### assetsInclude

Expand Down Expand Up @@ -849,7 +849,7 @@ export default defineConfig({
- **Type:** `boolean | 'terser' | 'esbuild'`
- **Default:** `'esbuild'`

Set to `false` to disable minification, or specify the minifier to use. The default is [Esbuild](https://github.com/evanw/esbuild) which is 20 ~ 40x faster than terser and only 1 ~ 2% worse compression. [Benchmarks](https://github.com/privatenumber/minification-benchmarks)
Set to `false` to disable minification, or specify the minifier to use. The default is [esbuild](https://github.com/evanw/esbuild) which is 20 ~ 40x faster than terser and only 1 ~ 2% worse compression. [Benchmarks](https://github.com/privatenumber/minification-benchmarks)

Note the `build.minify` option is not available when using the `'es'` format in lib mode.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/api-javascript.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# JavaScript API

Vite's JavaScript APIs are fully typed, and it's recommended to use TypeScript or enable JS type checking in VSCode to leverage the intellisense and validation.
Vite's JavaScript APIs are fully typed, and it's recommended to use TypeScript or enable JS type checking in VS Code to leverage the intellisense and validation.

## `createServer`

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/static-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Vercel CLI

### Vercel for Git

1. Push your code to your git repository (GitHub, GitLab, BitBucket).
1. Push your code to your git repository (GitHub, GitLab, Bitbucket).
2. [Import your Vite project](https://vercel.com/new) into Vercel.
3. Vercel will detect that you are using Vite and will enable the correct settings for your deployment.
4. Your application is deployed! (e.g. [vite-vue-template.vercel.app](https://vite-vue-template.vercel.app/))
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Vite improves the dev server start time by first dividing the modules in an appl

- **Dependencies** are mostly plain JavaScript that do not change often during development. Some large dependencies (e.g. component libraries with hundreds of modules) are also quite expensive to process. Dependencies may also be shipped in various module formats (e.g. ESM or CommonJS).

Vite [pre-bundles dependencies](./dep-pre-bundling) using [esbuild](https://esbuild.github.io/). Esbuild is written in Go and pre-bundles dependencies 10-100x faster than JavaScript-based bundlers.
Vite [pre-bundles dependencies](./dep-pre-bundling) using [esbuild](https://esbuild.github.io/). esbuild is written in Go and pre-bundles dependencies 10-100x faster than JavaScript-based bundlers.

- **Source code** often contains non-plain JavaScript that needs transforming (e.g. JSX, CSS or Vue/Svelte components), and will be edited very often. Also, not all source code needs to be loaded at the same time (e.g. with route-based code-splitting).

Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-svelte-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This template should help get you started developing with Svelte and TypeScript

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).

## Need an official Svelte framework?

Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-svelte/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This template should help get you started developing with Svelte in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).

## Need an official Svelte framework?

Expand Down
10 changes: 5 additions & 5 deletions packages/create-vite/template-vue-ts/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Vue 3 + Typescript + Vite
# Vue 3 + TypeScript + Vite

This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

## Recommended IDE Setup

- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)

## Type Support For `.vue` Imports in TS

Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:

1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.

You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const count = ref(0)

<p>
Recommended IDE setup:
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
<a href="https://code.visualstudio.com/" target="_blank">VS Code</a>
+
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This template should help get you started developing with Vue 3 in Vite. The tem

## Recommended IDE Setup

- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const count = ref(0)

<p>
Recommended IDE setup:
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
<a href="https://code.visualstudio.com/" target="_blank">VS Code</a>
+
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/css/__tests__/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ test('PostCSS dir-dependency', async () => {
}
})

test('Url separation', async () => {
test('URL separation', async () => {
const urlSeparated = await page.$('.url-separated')
const baseUrl = 'url(images/dog.webp)'
const cases = new Array(5)
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/css/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h1>CSS</h1>
</p>

<p class="url-separated">
Url separation preservation: should have valid background-image
URL separation preservation: should have valid background-image
</p>

<p class="inlined">Inlined import - this should NOT be red.</p>
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/html/__tests__/html.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ if (!isBuild) {
await editFile('invalid.html', (content) => {
return content.replace('<div Bad', '<div> Good')
})
const content = await page.waitForSelector('text=Good Html')
const content = await page.waitForSelector('text=Good HTML')
expect(content).toBeTruthy()
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/html/invalid.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div Bad Html</div>
<div Bad HTML</div>
8 changes: 4 additions & 4 deletions packages/playground/worker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ <h2 class="format-iife">format iife:</h2>
</div>

<p>
new Worker(new Url('./url-worker.js', import.meta.url), { type: 'module' })
new Worker(new URL('./url-worker.js', import.meta.url), { type: 'module' })
<span class="classname">.worker-import-meta-url</span>
</p>
<code class="worker-import-meta-url"></code>

<p>
new SharedWorker(new Url('./url-shared-worker.js', import.meta.url), { type:
new SharedWorker(new URL('./url-shared-worker.js', import.meta.url), { type:
'module' })
<span class="classname">.shared-worker-import-meta-url</span>
</p>
Expand All @@ -46,13 +46,13 @@ <h2 class="format-iife">format iife:</h2>
<code class="nested-worker"></code>

<p>
new Worker(new Url('./classic-worker.js', import.meta.url))
new Worker(new URL('./classic-worker.js', import.meta.url))
<span class="classname">.classic-worker</span>
</p>
<code class="classic-worker"></code>

<p>
new SharedWorker(new Url('./classic-shared-worker.js', import.meta.url), {
new SharedWorker(new URL('./classic-shared-worker.js', import.meta.url), {
type: 'classic' })
<span class="classname">.classic-shared-worker</span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ react({
})
```

This option does not enable _code transformation_. That is handled by ESBuild.
This option does not enable _code transformation_. That is handled by esbuild.

**Note:** TypeScript syntax is handled automatically.

Expand Down
2 changes: 1 addition & 1 deletion packages/vite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ See [2.9.0-beta.0 changelog](https://github.com/vitejs/vite/blob/v2.9.0-beta.0/p

### Default preview port

New default port for `vite preview` is 4173 (avoid conflicts in MacOS that took over the 5000 port)
New default port for `vite preview` is 4173 (avoid conflicts in macOS that took over the 5000 port)

### Workers using standard syntax

Expand Down
20 changes: 10 additions & 10 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
checkPublicFile
} from './asset'
import MagicString from 'magic-string'
import type * as Postcss from 'postcss'
import type * as PostCSS from 'postcss'
import type Sass from 'sass'
// We need to disable check of extraneous import which is buggy for stylus,
// and causes the CI tests fail, see: https://github.com/vitejs/vite/pull/2860
Expand All @@ -59,8 +59,8 @@ export interface CSSOptions {
preprocessorOptions?: Record<string, any>
postcss?:
| string
| (Postcss.ProcessOptions & {
plugins?: Postcss.Plugin[]
| (PostCSS.ProcessOptions & {
plugins?: PostCSS.Plugin[]
})
/**
* Enables css sourcemaps during dev
Expand Down Expand Up @@ -617,7 +617,7 @@ async function compileCSS(
): Promise<{
code: string
map?: SourceMapInput
ast?: Postcss.Result
ast?: PostCSS.Result
modules?: Record<string, string>
deps?: Set<string>
}> {
Expand Down Expand Up @@ -735,7 +735,7 @@ async function compileCSS(
postcssPlugins.push(
UrlRewritePostcssPlugin({
replacer: urlReplacer
}) as Postcss.Plugin
}) as PostCSS.Plugin
)

if (isModule) {
Expand Down Expand Up @@ -911,8 +911,8 @@ function combineSourcemapsIfExists(
}

interface PostCSSConfigResult {
options: Postcss.ProcessOptions
plugins: Postcss.Plugin[]
options: PostCSS.ProcessOptions
plugins: PostCSS.Plugin[]
}

async function resolvePostcssConfig(
Expand Down Expand Up @@ -961,7 +961,7 @@ export const cssUrlRE =
export const importCssRE = /@import ('[^']+\.css'|"[^"]+\.css"|[^'")]+\.css)/
const cssImageSetRE = /image-set\(([^)]+)\)/

const UrlRewritePostcssPlugin: Postcss.PluginCreator<{
const UrlRewritePostcssPlugin: PostCSS.PluginCreator<{
replacer: CssUrlReplacer
}> = (opts) => {
if (!opts) {
Expand Down Expand Up @@ -1094,11 +1094,11 @@ async function hoistAtImports(css: string) {
return (await postcss.default([AtImportHoistPlugin]).process(css)).css
}

const AtImportHoistPlugin: Postcss.PluginCreator<any> = () => {
const AtImportHoistPlugin: PostCSS.PluginCreator<any> = () => {
return {
postcssPlugin: 'vite-hoist-at-imports',
Once(root) {
const imports: Postcss.AtRule[] = []
const imports: PostCSS.AtRule[] = []
root.walkAtRules((rule) => {
if (rule.name === 'import') {
// record in reverse so that can simply prepend to preserve order
Expand Down