Skip to content

Commit

Permalink
feat(preload): update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ygj6 committed Jul 8, 2021
2 parents 6cb6d18 + d377aae commit 3deee5d
Show file tree
Hide file tree
Showing 71 changed files with 4,371 additions and 234 deletions.
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ body:
id: logs
attributes:
label: Logs
description: "Optional if provided reproduction. Please try not to insert an image but copy paste the log text.
description: |
Optional if provided reproduction. Please try not to insert an image but copy paste the log text.
1. Run `vite` or `vite build` with the `--debug` flag.
2. Provide the error log here."
1. Run `vite` or `vite build` with the `--debug` flag.
2. Provide the error log here.
render: shell
- type: checkboxes
id: checkboxes
Expand Down
7 changes: 2 additions & 5 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"extends": [
"config:base",
"schedule:weekly",
"group:allNonMajor"
],
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"],
"labels": ["dependencies"],
"ignorePaths": [
"packages/playground/**",
"packages/create-app/template-*/**",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
node_version: 14
fail-fast: false

name: 'Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:

lint:
runs-on: ubuntu-latest
name: 'Lint: node-14, ubuntu-latest'
name: "Lint: node-14, ubuntu-latest"
steps:
- uses: actions/checkout@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Issue Close Require

on:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
close-issues:
Expand All @@ -11,7 +11,7 @@ jobs:
- name: need reproduction
uses: actions-cool/issues-helper@v2.2.1
with:
actions: 'close-issues'
actions: "close-issues"
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need reproduction'
labels: "need reproduction"
inactive-day: 3
12 changes: 6 additions & 6 deletions .github/workflows/issue-labeled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ jobs:
if: github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v2.2.1
with:
actions: 'create-comment, remove-labels'
actions: "create-comment, remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
labels: 'pending triage, need reproduction'
labels: "pending triage, need reproduction"

- name: remove pending
if: github.event.label.name == 'enhancement' || github.event.label.name == 'bug' || (contains(github.event.label.name, 'pending triage') == false && startsWith(github.event.label.name, 'bug:') == true)
uses: actions-cool/issues-helper@v2.2.1
with:
actions: 'remove-labels'
actions: "remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'pending triage'
labels: "pending triage"

- name: need reproduction
if: github.event.label.name == 'need reproduction'
uses: actions-cool/issues-helper@v2.2.1
with:
actions: 'create-comment, remove-labels'
actions: "create-comment, remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Please provide a online reproduction by [codesandbox](https://codesandbox.io/) or a minimal GitHub repository. Issues labeled by `need reproduction` will be closed if no activities in 3 days.
labels: 'pending triage'
labels: "pending triage"
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ packages/vite/dist/
packages/plugin-vue/dist/
packages/*/CHANGELOG.md
LICENSE.md
.prettierrc
.prettierignore
yarn.lock
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

22 changes: 22 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "none",
"overrides": [
{
"files": ["*.json5"],
"options": {
"singleQuote": false,
"quoteProps": "preserve"
}
},
{
"files": ["*.yml"],
"options": {
"singleQuote": false
}
}
]
}
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/sponsors.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
/* special cases */
#sponsor-mux {
padding: 5px 0;
}
}
6 changes: 6 additions & 0 deletions docs/.vitepress/theme/sponsors.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@
"name": "Mux",
"href": "https://mux.com",
"src": "/mux.svg"
},
{
"id": "plaid",
"name": "Plaid Inc.",
"href": "https://plaid.co.jp/",
"src": "/plaid.svg"
}
]
24 changes: 12 additions & 12 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
}
```

Note Vite supports using ES modules syntax in the config file even if the project is not using native Node ESM via `type: "module"`. In this case the config file is auto pre-processed before load.
Note Vite supports using ES modules syntax in the config file even if the project is not using native Node ESM via `type: "module"`. In this case, the config file is auto pre-processed before load.

You can also explicitly specify a config file to use with the `--config` CLI option (resolved relative to `cwd`):

Expand All @@ -38,7 +38,7 @@ const config = {
export default config
```

Alternatively you can use the `defineConfig` helper which should provide intellisense without the need for jsdoc annotations:
Alternatively, you can use the `defineConfig` helper which should provide intellisense without the need for jsdoc annotations:

```js
import { defineConfig } from 'vite'
Expand Down Expand Up @@ -88,7 +88,7 @@ export default async ({ command, mode }) => {
- **Type:** `string`
- **Default:** `process.cwd()`

Project root directory (where `index.html` is located). Can be an absolute path, or a path relative from the location of the config file itself.
Project root directory (where `index.html` is located). Can be an absolute path, or a path relative to the location of the config file itself.

See [Project Root](/guide/#index-html-and-project-root) for more details.

Expand Down Expand Up @@ -124,7 +124,7 @@ export default async ({ command, mode }) => {

- Replacements are performed only when the match is surrounded by word boundaries (`\b`).

Because it's implemented as straightforward text replacements without any syntax analyzation, we recommend using `define` for CONSTANTS only.
Because it's implemented as straightforward text replacements without any syntax analysis, we recommend using `define` for CONSTANTS only.

For example, `process.env.FOO` and `__APP_VERSION__` are good fits. But `process` or `global` should not be put into this option. Variables can be shimmed or polyfilled instead.

Expand All @@ -136,19 +136,21 @@ export default async ({ command, mode }) => {

### publicDir

- **Type:** `string`
- **Type:** `string | false`
- **Default:** `"public"`

Directory to serve as plain static assets. Files in this directory are served at `/` during dev and copied to the root of `outDir` during build, and are always served or copied as-is without transform. The value can be either an absolute file system path or a path relative to project root.

Defining `publicDir` as `false` disables this feature.

See [The `public` Directory](/guide/assets#the-public-directory) for more details.

### cacheDir

- **Type:** `string`
- **Default:** `"node_modules/.vite"`

Directory to save cache files. Files in this directory are pre-bundled deps or some other cache files that generated by vite, which can improve the performance. You can use `--force` flag or manually delete the directory to regenerate the cache files. The value can be either an absolute file system path or a path relative to project root.
Directory to save cache files. Files in this directory are pre-bundled deps or some other cache files generated by vite, which can improve the performance. You can use `--force` flag or manually delete the directory to regenerate the cache files. The value can be either an absolute file system path or a path relative to project root.

### resolve.alias

Expand Down Expand Up @@ -282,7 +284,7 @@ export default async ({ command, mode }) => {
}
```

By default, ESBuild is applied to `ts`, `jsx` and `tsx` files. You can customize this with `esbuild.include` and `esbuild.exclude`, both of which expects type of `string | RegExp | (string | RegExp)[]`.
By default, ESBuild is applied to `ts`, `jsx` and `tsx` files. You can customize this with `esbuild.include` and `esbuild.exclude`, both of which expect type of `string | RegExp | (string | RegExp)[]`.

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

Expand Down Expand Up @@ -516,9 +518,7 @@ createServer()
server: {
fs: {
// Allow serving files from one level up to the project root
allow: [
'..'
]
allow: ['..']
}
}
}
Expand Down Expand Up @@ -639,14 +639,14 @@ createServer()
- **Default:** `false`
- **Related:** [Backend Integration](/guide/backend-integration)

When set to `true`, the build will also generate a `manifest.json` file that contains mapping of non-hashed asset filenames to their hashed versions, which can then be used by a server framework to render the correct asset links.
When set to `true`, the build will also generate a `manifest.json` file that contains a mapping of non-hashed asset filenames to their hashed versions, which can then be used by a server framework to render the correct asset links.

### build.minify

- **Type:** `boolean | 'terser' | 'esbuild'`
- **Default:** `'terser'`

Set to `false` to disable minification, or specify the minifier to use. The default is [Terser](https://github.com/terser/terser) which is slower but produces smaller bundles in most cases. Esbuild minification is significantly faster, but will result in slightly larger bundles.
Set to `false` to disable minification, or specify the minifier to use. The default is [Terser](https://github.com/terser/terser) which is slower but produces smaller bundles in most cases. Esbuild minification is significantly faster but will result in slightly larger bundles.

### build.terserOptions

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/api-hmr.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ For now, calling `import.meta.hot.invalidate()` simply reloads the page.
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:beforeFullReload'` when a full reload is about to occur
- `'vite:beforePrune'` when modules that are no longer needed are about to be pruned
- `'vite:error'` when an error occurs (e.g. syntax error)
Custom HMR events can also be sent from plugins. See [handleHotUpdate](./api-plugin#handlehotupdate) for more details.
2 changes: 1 addition & 1 deletion docs/guide/api-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Vite plugins can also provide hooks that serve Vite-specific purposes. These hoo
### `config`

- **Type:** `(config: UserConfig, env: { mode: string, command: string }) => UserConfig | null | void`
- **Kind:** `sync`, `sequential`
- **Kind:** `async`, `sequential`

Modify Vite config before it's resolved. The hook receives the raw user config (CLI options merged with config file) and the current config env which exposes the `mode` and `command` being used. It can return a partial config object that will be deeply merged into existing config, or directly mutate the config (if the default merging cannot achieve the desired result).

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Note that:
- The glob patterns are treated like import specifiers: they must be either relative (start with `./`) or absolute (start with `/`, resolved relative to project root).
- The glob matching is done via `fast-glob` - check out its documentation for [supported glob patterns](https://github.com/mrmlnc/fast-glob#pattern-syntax).

## Web Assembly
## WebAssembly

Pre-compiled `.wasm` files can be directly imported - the default export will be an initialization function that returns a Promise of the exports object of the wasm instance:

Expand Down
8 changes: 4 additions & 4 deletions docs/guide/static-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ You can quickly deploy your Vite app with Microsoft Azure [Static Web Apps](http

- An Azure account and a subscription key. You can create a [free Azure account here](https://azure.microsoft.com/free).
- Your app code pushed to [GitHub](https://github.com).
- The [SWA Extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) in [Visual Studio Code](https://code.visualstudio.com).
- The [SWA Extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) in [Visual Studio Code](https://code.visualstudio.com).

Install the extension in VS Code and navigate to your app root. Open the Static Web Apps extension, sign in to Azure, and click the '+' sign to create a new Static Web App. You will be prompted to designate which subscription key to use.
Install the extension in VS Code and navigate to your app root. Open the Static Web Apps extension, sign in to Azure, and click the '+' sign to create a new Static Web App. You will be prompted to designate which subscription key to use.

Follow the wizard started by the extension to give your app a name, choose a framework preset, and designate the app root (usually `/`) and built file location `/dist`. The wizard will run and will create a GitHub action in your repo in a `.github` folder.
Follow the wizard started by the extension to give your app a name, choose a framework preset, and designate the app root (usually `/`) and built file location `/dist`. The wizard will run and will create a GitHub action in your repo in a `.github` folder.

The action will work to deploy your app (watch its progress in your repo's Actions tab) and, when successfully completed, you can view your app in the address provided in the extension's progress window by clicking the 'Browse Website' button that appears when the GitHub action has run.
The action will work to deploy your app (watch its progress in your repo's Actions tab) and, when successfully completed, you can view your app in the address provided in the extension's progress window by clicking the 'Browse Website' button that appears when the GitHub action has run.
1 change: 1 addition & 0 deletions docs/public/plaid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"node": ">=12.0.0"
},
"scripts": {
"format": "prettier --write .",
"lint": "eslint --ext .js,.ts packages/*/src/**",
"test": "run-s test-serve test-build",
"test-serve": "jest",
Expand All @@ -25,7 +26,7 @@
"ci-docs": "run-s build-vite build-plugin-vue build-docs"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.16.1",
"@microsoft/api-extractor": "^7.17.1",
"@types/fs-extra": "^9.0.11",
"@types/jest": "^26.0.23",
"@types/node": "^15.12.2",
Expand All @@ -35,8 +36,8 @@
"chalk": "^4.1.1",
"conventional-changelog-cli": "^2.1.1",
"cross-env": "^7.0.3",
"eslint": "^7.29.0",
"eslint-define-config": "^1.0.8",
"eslint": "^7.30.0",
"eslint-define-config": "^1.0.9",
"eslint-plugin-node": "^11.1.0",
"execa": "^5.1.1",
"fs-extra": "^10.0.0",
Expand All @@ -53,8 +54,8 @@
"sirv": "^1.0.12",
"ts-jest": "^27.0.3",
"ts-node": "^10.0.0",
"typescript": "^4.3.4",
"vitepress": "^0.15.5",
"typescript": "^4.3.5",
"vitepress": "^0.15.6",
"yorkie": "^2.0.0"
},
"gitHooks": {
Expand Down
9 changes: 9 additions & 0 deletions packages/create-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [2.4.5](https://github.com/vitejs/vite/compare/create-app@2.4.4...create-app@2.4.5) (2021-07-05)


### Bug Fixes

* **deps:** update all non-major dependencies ([#3878](https://github.com/vitejs/vite/issues/3878)) ([a66a805](https://github.com/vitejs/vite/commit/a66a8053e9520d20bcf95fce870570c5195bcc91))



## [2.4.4](https://github.com/vitejs/vite/compare/create-app@2.4.3...create-app@2.4.4) (2021-06-22)


Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vitejs/create-app",
"version": "2.4.4",
"version": "2.4.5",
"license": "MIT",
"author": "Evan You",
"bin": {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-app/template-lit-element-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lit-element": "^2.4.0"
},
"devDependencies": {
"vite": "^2.3.8",
"vite": "^2.4.0",
"typescript": "^4.3.2"
}
}
}
4 changes: 2 additions & 2 deletions packages/create-app/template-lit-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"lit-element": "^2.4.0"
},
"devDependencies": {
"vite": "^2.3.8"
"vite": "^2.4.0"
}
}
}
4 changes: 2 additions & 2 deletions packages/create-app/template-preact-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"devDependencies": {
"@preact/preset-vite": "^2.0.0",
"typescript": "^4.3.2",
"vite": "^2.3.8"
"vite": "^2.4.0"
}
}
}
Loading

0 comments on commit 3deee5d

Please sign in to comment.