@vitejs/plugin-legacy 1.6.2 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/index.d.ts +1 -1
- package/index.js +17 -20
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
## [1.7.1](https://github.com/vitejs/vite/compare/plugin-legacy@1.7.0...plugin-legacy@1.7.1) (2022-02-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update all non-major dependencies ([#6782](https://github.com/vitejs/vite/issues/6782)) ([e38be3e](https://github.com/vitejs/vite/commit/e38be3e6ca7bf79319d5d7188e1d347b1d6091ef))
|
|
7
|
+
* **plugin-legacy:** require Vite 2.8.0 ([#6272](https://github.com/vitejs/vite/issues/6272)) ([#6869](https://github.com/vitejs/vite/issues/6869)) ([997b8f1](https://github.com/vitejs/vite/commit/997b8f11cb156cc374ae991875a09534b5489a93))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# [1.7.0](https://github.com/vitejs/vite/compare/plugin-legacy@1.6.4...plugin-legacy@1.7.0) (2022-02-09)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* don't force terser on non-legacy (fix [#6266](https://github.com/vitejs/vite/issues/6266)) ([#6272](https://github.com/vitejs/vite/issues/6272)) ([1da104e](https://github.com/vitejs/vite/commit/1da104e8597e2965313e8cd582d032bca551e4ee))
|
|
17
|
+
* **legacy:** fix conflict with the modern build on css emitting ([#6584](https://github.com/vitejs/vite/issues/6584)) ([f48255e](https://github.com/vitejs/vite/commit/f48255e6e0058e973b949fb4a2372974f0480e11)), closes [#3296](https://github.com/vitejs/vite/issues/3296) [#3317](https://github.com/vitejs/vite/issues/3317) [/github.com/vitejs/vite/commit/6bce1081991501f3779bff1a81e5dd1e63e5d38e#diff-2cfbd4f4d8c32727cd8e1a561cffbde0b384a3ce0789340440e144f9d64c10f6R262-R263](https://github.com//github.com/vitejs/vite/commit/6bce1081991501f3779bff1a81e5dd1e63e5d38e/issues/diff-2cfbd4f4d8c32727cd8e1a561cffbde0b384a3ce0789340440e144f9d64c10f6R262-R263)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [1.6.4](https://github.com/vitejs/vite/compare/plugin-legacy@1.6.3...plugin-legacy@1.6.4) (2021-12-07)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [1.6.3](https://github.com/vitejs/vite/compare/plugin-legacy@1.6.2...plugin-legacy@1.6.3) (2021-11-22)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **build:** resolve `rollupOptions.input` paths ([#5601](https://github.com/vitejs/vite/issues/5601)) ([5b6b016](https://github.com/vitejs/vite/commit/5b6b01693720290e8998b2613f0dcb2d699ee84f))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
1
34
|
## [1.6.2](https://github.com/vitejs/vite/compare/plugin-legacy@1.6.1...plugin-legacy@1.6.2) (2021-10-11)
|
|
2
35
|
|
|
3
36
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -37,8 +37,9 @@ function viteLegacyPlugin(options = {}) {
|
|
|
37
37
|
const genLegacy = options.renderLegacyChunks !== false
|
|
38
38
|
const genDynamicFallback = genLegacy
|
|
39
39
|
|
|
40
|
-
const
|
|
41
|
-
const isDebug =
|
|
40
|
+
const debugFlags = (process.env.DEBUG || '').split(',')
|
|
41
|
+
const isDebug =
|
|
42
|
+
debugFlags.includes('vite:*') || debugFlags.includes('vite:legacy')
|
|
42
43
|
|
|
43
44
|
const facadeToLegacyChunkMap = new Map()
|
|
44
45
|
const facadeToLegacyPolyfillMap = new Map()
|
|
@@ -105,23 +106,6 @@ function viteLegacyPlugin(options = {}) {
|
|
|
105
106
|
name: 'vite:legacy-generate-polyfill-chunk',
|
|
106
107
|
apply: 'build',
|
|
107
108
|
|
|
108
|
-
config() {
|
|
109
|
-
return {
|
|
110
|
-
build: {
|
|
111
|
-
minify: 'terser'
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
configResolved(config) {
|
|
117
|
-
if (!config.build.ssr && genLegacy && config.build.minify === 'esbuild') {
|
|
118
|
-
throw new Error(
|
|
119
|
-
`Can't use esbuild as the minifier when targeting legacy browsers ` +
|
|
120
|
-
`because esbuild minification is not legacy safe.`
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
|
|
125
109
|
async generateBundle(opts, bundle) {
|
|
126
110
|
if (config.build.ssr) {
|
|
127
111
|
return
|
|
@@ -297,6 +281,19 @@ function viteLegacyPlugin(options = {}) {
|
|
|
297
281
|
// legacy-unsafe code - e.g. rewriting object properties into shorthands
|
|
298
282
|
opts.__vite_skip_esbuild__ = true
|
|
299
283
|
|
|
284
|
+
// @ts-ignore force terser for legacy chunks. This only takes effect if
|
|
285
|
+
// minification isn't disabled, because that leaves out the terser plugin
|
|
286
|
+
// entirely.
|
|
287
|
+
opts.__vite_force_terser__ = true
|
|
288
|
+
|
|
289
|
+
// @ts-ignore
|
|
290
|
+
// In the `generateBundle` hook,
|
|
291
|
+
// we'll delete the assets from the legacy bundle to avoid emitting duplicate assets.
|
|
292
|
+
// But that's still a waste of computing resource.
|
|
293
|
+
// So we add this flag to avoid emitting the asset in the first place whenever possible.
|
|
294
|
+
opts.__vite_skip_asset_emit__ = true
|
|
295
|
+
|
|
296
|
+
// @ts-ignore avoid emitting assets for legacy bundle
|
|
300
297
|
const needPolyfills =
|
|
301
298
|
options.polyfills !== false && !Array.isArray(options.polyfills)
|
|
302
299
|
|
|
@@ -596,7 +593,7 @@ async function buildPolyfillChunk(
|
|
|
596
593
|
bundle[polyfillChunk.name] = polyfillChunk
|
|
597
594
|
}
|
|
598
595
|
|
|
599
|
-
const polyfillId = '
|
|
596
|
+
const polyfillId = '\0vite/legacy-polyfills'
|
|
600
597
|
|
|
601
598
|
/**
|
|
602
599
|
* @param {Set<string>} imports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/plugin-legacy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Evan You",
|
|
6
6
|
"files": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"types": "index.d.ts",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . --lerna-package plugin-legacy",
|
|
14
|
-
"release": "node ../../scripts/release.
|
|
14
|
+
"release": "ts-node ../../scripts/release.ts --skipBuild"
|
|
15
15
|
},
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=12.0.0"
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/standalone": "^7.
|
|
30
|
-
"core-js": "^3.
|
|
29
|
+
"@babel/standalone": "^7.17.2",
|
|
30
|
+
"core-js": "^3.21.0",
|
|
31
31
|
"magic-string": "^0.25.7",
|
|
32
32
|
"regenerator-runtime": "^0.13.9",
|
|
33
|
-
"systemjs": "^6.
|
|
33
|
+
"systemjs": "^6.12.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"vite": "^2.
|
|
36
|
+
"vite": "^2.8.0"
|
|
37
37
|
}
|
|
38
38
|
}
|