Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
kherock committed Nov 16, 2022
2 parents 320fc96 + 18c71dc commit 7572621
Show file tree
Hide file tree
Showing 246 changed files with 3,332 additions and 3,217 deletions.
9 changes: 6 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ module.exports = defineConfig({
extends: [
'eslint:recommended',
'plugin:node/recommended',
'plugin:@typescript-eslint/recommended'
'plugin:@typescript-eslint/recommended',
'plugin:regexp/recommended'
],
plugins: ['import'],
plugins: ['import', 'regexp'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
Expand Down Expand Up @@ -97,7 +98,9 @@ module.exports = defineConfig({
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
allowSeparatedGroups: false
}
]
],

'regexp/no-contradiction-with-assertion': 'error'
},
overrides: [
{
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
uses: pnpm/action-setup@v2.2.4

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v3
Expand Down Expand Up @@ -97,6 +97,7 @@ jobs:
run: pnpm run test-docs

lint:
if: github.repository == 'vitejs/vite'
timeout-minutes: 10
runs-on: ubuntu-latest
name: "Lint: node-16, ubuntu-latest"
Expand All @@ -106,7 +107,7 @@ jobs:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
uses: pnpm/action-setup@v2.2.4

- name: Set node version to 16
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ecosystem-ci-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
trigger:
runs-on: ubuntu-latest
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/ecosystem-ci run')
if: github.repository == 'vitejs/vite' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/ecosystem-ci run')
steps:
- uses: actions/github-script@v6
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
close-issues:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
steps:
- name: need reproduction
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/issue-labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
reply-labeled:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
steps:
- name: contribution welcome
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lock-closed-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ permissions:

jobs:
action:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
uses: pnpm/action-setup@v2.2.4

- name: Set node version to 16.x
uses: actions/setup-node@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

jobs:
release:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ on:

jobs:
main:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
name: Semantic Pull Request
steps:
- name: Validate PR title
uses: amannn/action-semantic-pull-request@v4
uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ hoist-pattern[]=pug
hoist-pattern[]=source-map-support
hoist-pattern[]=ts-node
strict-peer-dependencies=false
shell-emulator=true
shell-emulator=true
auto-install-peers=false
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To use breakpoints and explore code execution, you can use the ["Run and Debug"]

2. Click the "Run and Debug" icon in the activity bar of the editor, which opens the [_Run and Debug view_](https://code.visualstudio.com/docs/editor/debugging#_run-and-debug-view).

3. Click the "JavaScript Debug Termimal" button in the _Run and Debug view_, which opens a terminal in VS Code.
3. Click the "JavaScript Debug Terminal" button in the _Run and Debug view_, which opens a terminal in VS Code.

4. From that terminal, go to `playground/xxx`, and run `pnpm run dev`.

Expand Down Expand Up @@ -170,9 +170,9 @@ You can set the `DEBUG` environment variable to turn on debugging logs (e.g. `DE

- Make sure tests pass!

- Commit messages must follow the [commit message convention](./.github/commit-convention.md) so that changelogs can be automatically generated. Commit messages are automatically validated before commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [yorkie](https://github.com/yyx990803/yorkie)).
- Commit messages must follow the [commit message convention](./.github/commit-convention.md) so that changelogs can be automatically generated. Commit messages are automatically validated before commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)).

- No need to worry about code style as long as you have installed the dev dependencies. Modified files are automatically formatted with Prettier on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [yorkie](https://github.com/yyx990803/yorkie)).
- No need to worry about code style as long as you have installed the dev dependencies. Modified files are automatically formatted with Prettier on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)).

## Maintenance Guidelines

Expand Down
11 changes: 10 additions & 1 deletion docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,16 @@ export default defineConfig({
['meta', { property: 'og:description', content: ogDescription }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
['meta', { name: 'twitter:site', content: '@vite_js' }],
['meta', { name: 'theme-color', content: '#646cff' }]
['meta', { name: 'theme-color', content: '#646cff' }],
[
'script',
{
src: 'https://cdn.usefathom.com/script.js',
'data-site': 'CBDFBSLI',
'data-spa': 'auto',
defer: ''
}
]
],

vue: {
Expand Down
8 changes: 8 additions & 0 deletions docs/config/build-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ Set to `false` to disable writing the bundle to disk. This is mostly used in [pr
By default, Vite will empty the `outDir` on build if it is inside project root. It will emit a warning if `outDir` is outside of root to avoid accidentally removing important files. You can explicitly set this option to suppress the warning. This is also available via command line as `--emptyOutDir`.
## build.copyPublicDir
- **Experimental**
- **Type:** `boolean`
- **Default:** `true`
By default, Vite will copy files from the `publicDir` into the `outDir` on build. Set to `false` to disable this.
## build.reportCompressedSize
- **Type:** `boolean`
Expand Down
16 changes: 9 additions & 7 deletions docs/config/server-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export default defineConfig({

- **Type:** `Record<string, string | ProxyOptions>`

Configure custom proxy rules for the dev server. Expects an object of `{ key: options }` pairs. If the key starts with `^`, it will be interpreted as a `RegExp`. The `configure` option can be used to access the proxy instance.
Configure custom proxy rules for the dev server. Expects an object of `{ key: options }` pairs. Any requests that request path starts with that key will be proxied to that specified target. If the key starts with `^`, it will be interpreted as a `RegExp`. The `configure` option can be used to access the proxy instance.

Note that if you are using non-relative [`base`](/config/shared-options.md#base), you must prefix each key with that `base`.

Uses [`http-proxy`](https://github.com/http-party/node-http-proxy). Full options [here](https://github.com/http-party/node-http-proxy#options).

Expand All @@ -89,15 +91,15 @@ In some cases, you might also want to configure the underlying dev server (e.g.
export default defineConfig({
server: {
proxy: {
// string shorthand
// string shorthand: http://localhost:5173/foo -> http://localhost:4567/foo
'/foo': 'http://localhost:4567',
// with options
// with options: http://localhost:5173/api/bar-> http://jsonplaceholder.typicode.com/bar
'/api': {
target: 'http://jsonplaceholder.typicode.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
// with RegEx
// with RegEx: http://localhost:5173/fallback/ -> http://jsonplaceholder.typicode.com/
'^/fallback/.*': {
target: 'http://jsonplaceholder.typicode.com',
changeOrigin: true,
Expand All @@ -111,9 +113,9 @@ export default defineConfig({
// proxy will be an instance of 'http-proxy'
}
},
// Proxying websockets or socket.io
// Proxying websockets or socket.io: ws://localhost:5173/socket.io -> ws://localhost:5174/socket.io
'/socket.io': {
target: 'ws://localhost:5173',
target: 'ws://localhost:5174',
ws: true
}
}
Expand Down Expand Up @@ -240,7 +242,7 @@ createServer()

- **Type:** `string | undefined`

Prepend this folder to http requests, for use when proxying vite as a subfolder. Should start and end with the `/` character.
Prepend this folder to http requests, for use when proxying vite as a subfolder. Should start with the `/` character.

## server.fs.strict

Expand Down
1 change: 1 addition & 0 deletions docs/guide/api-hmr.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Listen to an HMR event.
The following HMR events are dispatched by Vite automatically:
- `'vite:beforeUpdate'` when an update is about to be applied (e.g. a module will be replaced)
- `'vite:afterUpdate'` when an update has just been applied (e.g. a module has been replaced)
- `'vite:beforeFullReload'` when a full reload is about to occur
- `'vite:beforePrune'` when modules that are no longer needed are about to be pruned
- `'vite:invalidate'` when a module is invalidated with `import.meta.hot.invalidate()`
Expand Down
5 changes: 5 additions & 0 deletions docs/guide/api-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ interface ViteDevServer {
* Fix ssr error stacktrace.
*/
ssrFixStacktrace(e: Error): void
/**
* Triggers HMR for a module in the module graph. You can use the `server.moduleGraph`
* API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
*/
reloadModule(module: ModuleNode): Promise<void>
/**
* Start the server.
*/
Expand Down
11 changes: 11 additions & 0 deletions docs/guide/env-and-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ console.log(import.meta.env.VITE_SOME_KEY) // 123
console.log(import.meta.env.DB_PASSWORD) // undefined
```
Also, Vite uses [dotenv-expand](https://github.com/motdotla/dotenv-expand) to expand variables out of the box. To learn more about the syntax, check out [their docs](https://github.com/motdotla/dotenv-expand#what-rules-does-the-expansion-engine-follow).
Note that if you want to use `$` inside your environment value, you have to escape it with `\`.
```
KEY=123
NEW_KEY1=test$foo # test
NEW_KEY2=test\$foo # test$foo
NEW_KEY3=test$KEY # test123
```
If you want to customize the env variables prefix, see the [envPrefix](/config/shared-options.html#envprefix) option.
:::warning SECURITY NOTES
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ Vite is pre-configured to support CSS `@import` inlining via `postcss-import`. V

If the project contains valid PostCSS config (any format supported by [postcss-load-config](https://github.com/postcss/postcss-load-config), e.g. `postcss.config.js`), it will be automatically applied to all imported CSS.

Note that CSS minification will run after PostCSS and will use [`build.cssTarget`](/config/build-options.md#build-csstarget) option.

### CSS Modules

Any CSS file ending with `.module.css` is considered a [CSS modules file](https://github.com/css-modules/css-modules). Importing such a file will return the corresponding module object:
Expand Down
7 changes: 7 additions & 0 deletions docs/guide/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ To solve this:
$ sudo sysctl fs.inotify.max_user_watches=524288
```

If the above steps don't work, you can try adding `DefaultLimitNOFILE=65536` as an un-commented config to the following files:

- /etc/systemd/system.conf
- /etc/systemd/user.conf

Note that these settings persist but a **restart is required**.

### 431 Request Header Fields Too Large

When the server / WebSocket server receives a large HTTP header, the request will be dropped and the following warning will be shown.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Ensuring optimal output and behavioral consistency between the dev server and th

## Why Not Bundle with esbuild?

While `esbuild` is blazing fast and is already a very capable bundler for libraries, some of the important features needed for bundling _applications_ are still work in progress - in particular code-splitting and CSS handling. For the time being, Rollup is more mature and flexible in these regards. That said, we won't rule out the possibility of using `esbuild` for production builds when it stabilizes these features in the future.
While `esbuild` is extremely fast and is already a very capable bundler for libraries, some of the important features needed for bundling _applications_ are still work in progress - in particular code-splitting and CSS handling. For the time being, Rollup is more mature and flexible in these regards. That said, we won't rule out the possibility of using `esbuild` for production builds when it stabilizes these features in the future.

## How is Vite Different from X?

Expand Down
3 changes: 1 addition & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[build.environment]
NODE_VERSION = "16"
NPM_FLAGS = "--version" # prevent Netlify npm install
[build]
publish = "docs/.vitepress/dist"
command = "npx pnpm i --store=node_modules/.pnpm-store --frozen-lockfile && npm run ci-docs"
command = "pnpm ci-docs"
ignore = "./scripts/docs-check.sh"
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"ci-docs": "run-s build docs-build"
},
"devDependencies": {
"@babel/types": "^7.19.3",
"@microsoft/api-extractor": "^7.32.0",
"@babel/types": "^7.20.2",
"@microsoft/api-extractor": "^7.33.6",
"@rollup/plugin-typescript": "^8.5.0",
"@types/babel__core": "^7.1.19",
"@types/babel__core": "^7.1.20",
"@types/babel__standalone": "^7.1.4",
"@types/convert-source-map": "^1.5.2",
"@types/cross-spawn": "^6.0.2",
Expand All @@ -55,42 +55,43 @@
"@types/prompts": "^2.4.1",
"@types/resolve": "^1.20.2",
"@types/sass": "~1.43.1",
"@types/semver": "^7.3.12",
"@types/semver": "^7.3.13",
"@types/stylus": "^0.48.38",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"conventional-changelog-cli": "^2.2.2",
"esbuild": "^0.14.47",
"eslint": "^8.25.0",
"eslint-define-config": "^1.7.0",
"esbuild": "^0.15.9",
"eslint": "^8.27.0",
"eslint-define-config": "^1.12.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-regexp": "^1.10.0",
"execa": "^6.1.0",
"fast-glob": "^3.2.12",
"fs-extra": "^10.1.0",
"lint-staged": "^13.0.3",
"minimist": "^1.2.6",
"minimist": "^1.2.7",
"npm-run-all": "^4.1.5",
"picocolors": "^1.0.0",
"playwright-chromium": "^1.27.0",
"pnpm": "^7.13.3",
"playwright-chromium": "^1.27.1",
"pnpm": "^7.15.0",
"prettier": "2.7.1",
"prompts": "^2.4.2",
"resolve": "^1.22.1",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"rollup-plugin-license": "^2.8.1",
"rollup": "~3.3.0",
"rollup-plugin-license": "^2.9.1",
"semver": "^7.3.8",
"simple-git-hooks": "^2.8.0",
"tslib": "^2.4.0",
"tsx": "^3.10.1",
"simple-git-hooks": "^2.8.1",
"tslib": "^2.4.1",
"tsx": "^3.12.1",
"typescript": "^4.6.4",
"unbuild": "^0.8.11",
"unbuild": "^0.9.4",
"vite": "workspace:*",
"vitepress": "^1.0.0-alpha.19",
"vitest": "^0.24.0",
"vue": "^3.2.40"
"vitepress": "^1.0.0-alpha.28",
"vitest": "^0.25.1",
"vue": "^3.2.45"
},
"simple-git-hooks": {
"pre-commit": "pnpm exec lint-staged --concurrent false",
Expand All @@ -110,7 +111,7 @@
"eslint --cache --fix"
]
},
"packageManager": "pnpm@7.13.3",
"packageManager": "pnpm@7.15.0",
"pnpm": {
"overrides": {
"vite": "workspace:*",
Expand Down

0 comments on commit 7572621

Please sign in to comment.