Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Dec 4, 2023
2 parents 88ed4c4 + fa79767 commit c96ab2e
Show file tree
Hide file tree
Showing 54 changed files with 901 additions and 784 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@25ef3926d147cd02fc7e931c1ef50772bbb0d25d # v40.1.1
uses: tj-actions/changed-files@1c938490c880156b746568a518594309cfb3f66b # v40.2.1
with:
files: |
docs/**
Expand Down
14 changes: 12 additions & 2 deletions docs/guide/env-and-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ DB_PASSWORD=foobar
Only `VITE_SOME_KEY` will be exposed as `import.meta.env.VITE_SOME_KEY` to your client source code, but `DB_PASSWORD` will not.

```js
console.log(import.meta.env.VITE_SOME_KEY) // 123
console.log(import.meta.env.VITE_SOME_KEY) // "123"
console.log(import.meta.env.DB_PASSWORD) // undefined
```
:::tip Env parsing
As shown above, `VITE_SOME_KEY` is a number but returns a string when parsed. The same would also happen for boolean env variables. Make sure to convert to the desired type when using it in your code.
:::
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 `\`.
Expand All @@ -74,7 +79,7 @@ If you want to customize the env variables prefix, see the [envPrefix](/config/s
By default, Vite provides type definitions for `import.meta.env` in [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts). While you can define more custom env variables in `.env.[mode]` files, you may want to get TypeScript IntelliSense for user-defined env variables that are prefixed with `VITE_`.
To achieve this, you can create an `env.d.ts` in `src` directory, then augment `ImportMetaEnv` like this:
To achieve this, you can create an `vite-env.d.ts` in `src` directory, then augment `ImportMetaEnv` like this:
```typescript
/// <reference types="vite/client" />
Expand All @@ -97,6 +102,11 @@ If your code relies on types from browser environments such as [DOM](https://git
}
```
:::warning Imports will break type augmentation
If the `ImportMetaEnv` augmentation does not work, make sure you do not have any `import` statements in `vite-env.d.ts`. See the [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/2/modules.html#how-javascript-modules-are-defined) for more information.
:::
## HTML Env Replacement
Vite also supports replacing env variables in HTML files. Any properties in `import.meta.env` can be used in HTML files with a special `%ENV_NAME%` syntax:
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ci-docs": "run-s build docs-build"
},
"devDependencies": {
"@babel/types": "^7.23.4",
"@babel/types": "^7.23.5",
"@eslint-types/import": "^2.29.0-1",
"@eslint-types/typescript-eslint": "^6.12.0",
"@rollup/plugin-typescript": "^11.1.5",
Expand All @@ -56,35 +56,35 @@
"@types/json-stable-stringify": "^1.0.36",
"@types/less": "^3.0.6",
"@types/micromatch": "^4.0.6",
"@types/node": "^20.10.0",
"@types/node": "^20.10.3",
"@types/picomatch": "^2.3.3",
"@types/semver": "^7.5.6",
"@types/sass": "~1.43.1",
"@types/stylus": "^0.48.42",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"@vitejs/release-scripts": "^1.3.1",
"conventional-changelog-cli": "^4.1.0",
"eslint": "^8.54.0",
"eslint": "^8.55.0",
"eslint-define-config": "^2.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-regexp": "^2.1.1",
"eslint-plugin-regexp": "^2.1.2",
"execa": "^8.0.1",
"feed": "^4.2.2",
"fs-extra": "^11.1.1",
"lint-staged": "^15.1.0",
"fs-extra": "^11.2.0",
"lint-staged": "^15.2.0",
"npm-run-all2": "^6.1.1",
"picocolors": "^1.0.0",
"playwright-chromium": "^1.40.0",
"playwright-chromium": "^1.40.1",
"prettier": "3.1.0",
"rimraf": "^5.0.5",
"rollup": "^4.2.0",
"semver": "^7.5.4",
"simple-git-hooks": "^2.9.0",
"tslib": "^2.6.2",
"tsx": "^4.6.1",
"tsx": "^4.6.2",
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"vite": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-lit-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.2"
"vite": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"lit": "^3.1.0"
},
"devDependencies": {
"vite": "^5.0.2"
"vite": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-preact-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"devDependencies": {
"@preact/preset-vite": "^2.7.0",
"typescript": "^5.2.2",
"vite": "^5.0.2"
"vite": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
},
"devDependencies": {
"@preact/preset-vite": "^2.7.0",
"vite": "^5.0.2"
"vite": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-qwik-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.2"
"vite": "^5.0.4"
},
"dependencies": {
"@builder.io/qwik": "^1.2.19"
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.2"
"vite": "^5.0.4"
},
"dependencies": {
"@builder.io/qwik": "^1.2.19"
Expand Down
12 changes: 6 additions & 6 deletions packages/create-vite/template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.38",
"@types/react": "^18.2.41",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"@vitejs/plugin-react": "^4.2.0",
"eslint": "^8.54.0",
"eslint": "^8.55.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.4",
"eslint-plugin-react-refresh": "^0.4.5",
"typescript": "^5.2.2",
"vite": "^5.0.2"
"vite": "^5.0.4"
}
}
8 changes: 4 additions & 4 deletions packages/create-vite/template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.38",
"@types/react": "^18.2.41",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.0",
"eslint": "^8.54.0",
"eslint": "^8.55.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.4",
"vite": "^5.0.2"
"eslint-plugin-react-refresh": "^0.4.5",
"vite": "^5.0.4"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-solid-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"preview": "vite preview"
},
"dependencies": {
"solid-js": "^1.8.6"
"solid-js": "^1.8.7"
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.2",
"vite": "^5.0.4",
"vite-plugin-solid": "^2.7.2"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"preview": "vite preview"
},
"dependencies": {
"solid-js": "^1.8.6"
"solid-js": "^1.8.7"
},
"devDependencies": {
"vite": "^5.0.2",
"vite": "^5.0.4",
"vite-plugin-solid": "^2.7.2"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-svelte-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@tsconfig/svelte": "^5.0.2",
"svelte": "^4.2.7",
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^5.0.2"
"vite": "^5.0.4"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"svelte": "^4.2.7",
"vite": "^5.0.2"
"svelte": "^4.2.8",
"vite": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vanilla-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"devDependencies": {
"typescript": "^5.2.2",
"vite": "^5.0.2"
"vite": "^5.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"preview": "vite preview"
},
"devDependencies": {
"vite": "^5.0.2"
"vite": "^5.0.4"
}
}
6 changes: 3 additions & 3 deletions packages/create-vite/template-vue-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"vue": "^3.3.9"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.5.0",
"@vitejs/plugin-vue": "^4.5.1",
"typescript": "^5.2.2",
"vite": "^5.0.2",
"vue-tsc": "^1.8.22"
"vite": "^5.0.4",
"vue-tsc": "^1.8.24"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"vue": "^3.3.9"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.5.0",
"vite": "^5.0.2"
"@vitejs/plugin-vue": "^4.5.1",
"vite": "^5.0.4"
}
}
6 changes: 3 additions & 3 deletions packages/plugin-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
"funding": "https://github.com/vitejs/vite?sponsor=1",
"dependencies": {
"@babel/core": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"browserslist": "^4.22.1",
"@babel/core": "^7.23.5",
"@babel/preset-env": "^7.23.5",
"browserslist": "^4.22.2",
"core-js": "^3.33.3",
"magic-string": "^0.30.5",
"regenerator-runtime": "^0.14.0",
Expand Down
20 changes: 20 additions & 0 deletions packages/vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## <small>5.0.5 (2023-12-04)</small>

* fix: emit `vite:preloadError` for chunks without deps (#15203) ([d8001c5](https://github.com/vitejs/vite/commit/d8001c5)), closes [#15203](https://github.com/vitejs/vite/issues/15203)
* fix: esbuild glob import resolve error (#15140) ([676804d](https://github.com/vitejs/vite/commit/676804d)), closes [#15140](https://github.com/vitejs/vite/issues/15140)
* fix: json error with position (#15225) ([14be75f](https://github.com/vitejs/vite/commit/14be75f)), closes [#15225](https://github.com/vitejs/vite/issues/15225)
* fix: proxy html path should be encoded (#15223) ([5b85040](https://github.com/vitejs/vite/commit/5b85040)), closes [#15223](https://github.com/vitejs/vite/issues/15223)
* fix(deps): update all non-major dependencies (#15233) ([ad3adda](https://github.com/vitejs/vite/commit/ad3adda)), closes [#15233](https://github.com/vitejs/vite/issues/15233)
* fix(hmr): don't consider CSS dep as a circular dep (#15229) ([5f2cdec](https://github.com/vitejs/vite/commit/5f2cdec)), closes [#15229](https://github.com/vitejs/vite/issues/15229)
* feat: add '*.mov' to client.d.ts (#15189) ([d93a211](https://github.com/vitejs/vite/commit/d93a211)), closes [#15189](https://github.com/vitejs/vite/issues/15189)
* feat(server): allow disabling built-in shortcuts (#15218) ([7fd7c6c](https://github.com/vitejs/vite/commit/7fd7c6c)), closes [#15218](https://github.com/vitejs/vite/issues/15218)
* chore: replace 'some' with 'includes' in resolveEnvPrefix (#15220) ([ee12f30](https://github.com/vitejs/vite/commit/ee12f30)), closes [#15220](https://github.com/vitejs/vite/issues/15220)
* chore: update the website url for homepage in package.json (#15181) ([282bd8f](https://github.com/vitejs/vite/commit/282bd8f)), closes [#15181](https://github.com/vitejs/vite/issues/15181)
* chore: update vitest to 1.0.0-beta.6 (#15194) ([2fce647](https://github.com/vitejs/vite/commit/2fce647)), closes [#15194](https://github.com/vitejs/vite/issues/15194)
* refactor: make HMR agnostic to environment (#15179) ([0571b7c](https://github.com/vitejs/vite/commit/0571b7c)), closes [#15179](https://github.com/vitejs/vite/issues/15179)
* refactor: use dedicated regex methods (#15228) ([0348137](https://github.com/vitejs/vite/commit/0348137)), closes [#15228](https://github.com/vitejs/vite/issues/15228)
* perf: remove debug only prettifyUrl call (#15204) ([73e971f](https://github.com/vitejs/vite/commit/73e971f)), closes [#15204](https://github.com/vitejs/vite/issues/15204)
* perf: skip computing sourceRoot in injectSourcesContent (#15207) ([1df1fd1](https://github.com/vitejs/vite/commit/1df1fd1)), closes [#15207](https://github.com/vitejs/vite/issues/15207)



## <small>5.0.4 (2023-11-29)</small>

* fix: bindCLIShortcuts to proper server (#15162) ([67ac572](https://github.com/vitejs/vite/commit/67ac572)), closes [#15162](https://github.com/vitejs/vite/issues/15162)
Expand Down
22 changes: 22 additions & 0 deletions packages/vite/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,28 @@ License: MIT
By: Rich Harris
Repository: rollup/plugins

> The MIT License (MIT)
>
> Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
---------------------------------------

## acorn
Expand Down
5 changes: 4 additions & 1 deletion packages/vite/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ declare module '*.aac' {
const src: string
export default src
}

declare module '*.opus' {
const src: string
export default src
}
declare module '*.mov' {
const src: string
export default src
}

// fonts
declare module '*.woff' {
Expand Down
10 changes: 5 additions & 5 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vite",
"version": "5.0.4",
"version": "5.0.5",
"type": "module",
"license": "MIT",
"author": "Evan You",
Expand Down Expand Up @@ -75,23 +75,23 @@
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
"dependencies": {
"esbuild": "^0.19.3",
"postcss": "^8.4.31",
"postcss": "^8.4.32",
"rollup": "^4.2.0"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
},
"devDependencies": {
"@ampproject/remapping": "^2.2.1",
"@babel/parser": "^7.23.4",
"@babel/parser": "^7.23.5",
"@jridgewell/trace-mapping": "^0.3.20",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-dynamic-import-vars": "^2.1.1",
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-typescript": "^11.1.5",
"@rollup/pluginutils": "^5.0.5",
"@rollup/pluginutils": "^5.1.0",
"@types/escape-html": "^1.0.4",
"@types/pnpapi": "^0.0.5",
"acorn": "^8.11.2",
Expand Down
Loading

0 comments on commit c96ab2e

Please sign in to comment.