Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Nov 29, 2022
2 parents cfcd7e9 + 3090564 commit 37e6c96
Show file tree
Hide file tree
Showing 42 changed files with 606 additions and 527 deletions.
2 changes: 1 addition & 1 deletion docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The production bundle assumes support for modern JavaScript. By default, Vite ta

- Chrome >=87
- Firefox >=78
- Safari >=13
- Safari >=14
- Edge >=88

You can specify custom targets via the [`build.target` config option](/config/build-options.md#build-target), where the lowest target is `es2015`.
Expand Down
5 changes: 3 additions & 2 deletions docs/guide/dep-pre-bundling.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ Both `include` and `exclude` can be used to deal with this. If the dependency is

Vite caches the pre-bundled dependencies in `node_modules/.vite`. It determines whether it needs to re-run the pre-bundling step based on a few sources:

- The `dependencies` list in your `package.json`.
- Package manager lockfiles, e.g. `package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml`.
- Package manager lockfile content, e.g. `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` or `bun.lockb`.
- Patches folder modification time.
- Relevant fields in your `vite.config.js`, if present.
- `NODE_ENV` value.

The pre-bundling step will only need to be re-run when one of the above has changed.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Our scripts in `package.json` will look like this:
"scripts": {
"dev": "node server",
"build:client": "vite build --outDir dist/client",
"build:server": "vite build --outDir dist/server --ssr src/entry-server.js "
"build:server": "vite build --outDir dist/server --ssr src/entry-server.js"
}
}
```
Expand Down
27 changes: 16 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"ci-docs": "run-s build docs-build"
},
"devDependencies": {
"@babel/types": "^7.20.2",
"@babel/types": "^7.20.5",
"@microsoft/api-extractor": "^7.33.6",
"@rollup/plugin-typescript": "^9.0.2",
"@rollup/plugin-typescript": "^10.0.1",
"@types/babel__core": "^7.1.20",
"@types/babel__standalone": "^7.1.4",
"@types/convert-source-map": "^1.5.2",
Expand All @@ -58,25 +58,25 @@
"@types/semver": "^7.3.13",
"@types/stylus": "^0.48.38",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"conventional-changelog-cli": "^2.2.2",
"esbuild": "^0.15.9",
"eslint": "^8.28.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",
"eslint-plugin-regexp": "^1.11.0",
"execa": "^6.1.0",
"fast-glob": "^3.2.12",
"fs-extra": "^10.1.0",
"lint-staged": "^13.0.3",
"lint-staged": "^13.0.4",
"minimist": "^1.2.7",
"npm-run-all": "^4.1.5",
"picocolors": "^1.0.0",
"playwright-chromium": "^1.28.0",
"pnpm": "^7.17.0",
"prettier": "2.7.1",
"playwright-chromium": "^1.28.1",
"pnpm": "^7.17.1",
"prettier": "2.8.0",
"prompts": "^2.4.2",
"resolve": "^1.22.1",
"rimraf": "^3.0.2",
Expand All @@ -90,7 +90,7 @@
"unbuild": "^0.9.4",
"vite": "workspace:*",
"vitepress": "^1.0.0-alpha.29",
"vitest": "^0.25.2",
"vitest": "^0.25.3",
"vue": "^3.2.45"
},
"simple-git-hooks": {
Expand All @@ -111,7 +111,7 @@
"eslint --cache --fix"
]
},
"packageManager": "pnpm@7.17.0",
"packageManager": "pnpm@7.17.1",
"pnpm": {
"overrides": {
"vite": "workspace:*",
Expand All @@ -122,6 +122,11 @@
"peerDependencies": {
"postcss": "*"
}
},
"acorn-walk": {
"peerDependencies": {
"acorn": "*"
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-svelte-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.2.0",
"@sveltejs/vite-plugin-svelte": "^1.3.1",
"@tsconfig/svelte": "^3.0.0",
"svelte": "^3.53.1",
"svelte-check": "^2.9.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.2.0",
"@sveltejs/vite-plugin-svelte": "^1.3.1",
"svelte": "^3.53.1",
"vite": "^3.2.4"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
"dependencies": {
"@babel/standalone": "^7.20.4",
"@babel/standalone": "^7.20.6",
"core-js": "^3.26.1",
"magic-string": "^0.26.7",
"regenerator-runtime": "^0.13.11",
Expand All @@ -46,7 +46,7 @@
"vite": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.20.5",
"picocolors": "^1.0.0",
"vite": "workspace:*"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-react#readme",
"dependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.20.5",
"@babel/plugin-transform-react-jsx": "^7.19.0",
"@babel/plugin-transform-react-jsx-development": "^7.18.6",
"@babel/plugin-transform-react-jsx-self": "^7.18.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue-jsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-vue-jsx#readme",
"dependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.20.5",
"@babel/plugin-transform-typescript": "^7.20.2",
"@vue/babel-plugin-jsx": "^1.1.1"
},
Expand Down
29 changes: 29 additions & 0 deletions packages/vite/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,35 @@ Repository: https://github.com/acornjs/acorn.git
---------------------------------------

## acorn-walk
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Repository: https://github.com/acornjs/acorn.git

> MIT License
>
> Copyright (C) 2012-2020 by various contributors (see AUTHORS)
>
> 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.
---------------------------------------

## ansi-regex
License: MIT
By: Sindre Sorhus
Expand Down
24 changes: 24 additions & 0 deletions packages/vite/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,58 @@ declare module '*.module.sss' {

// CSS
declare module '*.css' {
/**
* @deprecated Use `import style from './style.css?inline'` instead.
*/
const css: string
export default css
}
declare module '*.scss' {
/**
* @deprecated Use `import style from './style.scss?inline'` instead.
*/
const css: string
export default css
}
declare module '*.sass' {
/**
* @deprecated Use `import style from './style.sass?inline'` instead.
*/
const css: string
export default css
}
declare module '*.less' {
/**
* @deprecated Use `import style from './style.less?inline'` instead.
*/
const css: string
export default css
}
declare module '*.styl' {
/**
* @deprecated Use `import style from './style.styl?inline'` instead.
*/
const css: string
export default css
}
declare module '*.stylus' {
/**
* @deprecated Use `import style from './style.stylus?inline'` instead.
*/
const css: string
export default css
}
declare module '*.pcss' {
/**
* @deprecated Use `import style from './style.pcss?inline'` instead.
*/
const css: string
export default css
}
declare module '*.sss' {
/**
* @deprecated Use `import style from './style.sss?inline'` instead.
*/
const css: string
export default css
}
Expand Down
11 changes: 6 additions & 5 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,18 @@
},
"devDependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/parser": "^7.20.3",
"@babel/types": "^7.20.2",
"@babel/parser": "^7.20.5",
"@babel/types": "^7.20.5",
"@jridgewell/trace-mapping": "^0.3.17",
"@rollup/plugin-alias": "^4.0.2",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-dynamic-import-vars": "^2.0.1",
"@rollup/plugin-json": "^5.0.1",
"@rollup/plugin-json": "^5.0.2",
"@rollup/plugin-node-resolve": "15.0.1",
"@rollup/plugin-typescript": "^9.0.2",
"@rollup/plugin-typescript": "^10.0.1",
"@rollup/pluginutils": "^5.0.2",
"acorn": "^8.8.1",
"acorn-walk": "^8.2.0",
"cac": "^6.7.14",
"chokidar": "^3.5.3",
"connect": "^3.7.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.a {
color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.b {
color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.b {
color: red;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { transformGlobImport } from '../../../plugins/importMetaGlob'
import { transformWithEsbuild } from '../../../plugins/esbuild'
import type { Logger } from '../../../logger'
import { createLogger } from '../../../logger'

const __dirname = resolve(fileURLToPath(import.meta.url), '..')

describe('fixture', async () => {
const resolveId = (id: string) => id
const root = resolve(__dirname, '..')
const logger = createLogger()

it('transform', async () => {
const id = resolve(__dirname, './fixture-a/index.ts')
Expand All @@ -18,7 +21,9 @@ describe('fixture', async () => {
).code

expect(
(await transformGlobImport(code, id, root, resolveId))?.s.toString()
(
await transformGlobImport(code, id, root, resolveId, logger)
)?.s.toString()
).toMatchSnapshot()
})

Expand All @@ -30,7 +35,13 @@ describe('fixture', async () => {
].join('\n')
expect(
(
await transformGlobImport(code, 'virtual:module', root, resolveId)
await transformGlobImport(
code,
'virtual:module',
root,
resolveId,
logger
)
)?.s.toString()
).toMatchSnapshot()

Expand All @@ -39,7 +50,8 @@ describe('fixture', async () => {
"import.meta.glob('./modules/*.ts')",
'virtual:module',
root,
resolveId
resolveId,
logger
)
expect('no error').toBe('should throw an error')
} catch (err) {
Expand All @@ -56,7 +68,48 @@ describe('fixture', async () => {
).code

expect(
(await transformGlobImport(code, id, root, resolveId, true))?.s.toString()
(
await transformGlobImport(code, id, root, resolveId, logger, true)
)?.s.toString()
).toMatchSnapshot()
})

it('warn when glob css without ?inline', async () => {
const logs: string[] = []
const logger = {
warn(msg: string) {
logs.push(msg)
}
} as Logger

await transformGlobImport(
"import.meta.glob('./fixture-c/*.css', { query: '?inline' })",
fileURLToPath(import.meta.url),
root,
resolveId,
logger
)
expect(logs).toHaveLength(0)

await transformGlobImport(
"import.meta.glob('./fixture-c/*.module.css')",
fileURLToPath(import.meta.url),
root,
resolveId,
logger
)
expect(logs).toHaveLength(0)

await transformGlobImport(
"import.meta.glob('./fixture-c/*.css')",
fileURLToPath(import.meta.url),
root,
resolveId,
logger
)
expect(logs).toHaveLength(1)
expect(logs[0]).to.include(
'Globbing CSS files without the ?inline query is deprecated'
)
})
})

0 comments on commit 37e6c96

Please sign in to comment.