Upgrade Vite to 3.2 (#5212)

This commit is contained in:
Bjorn Lu 2022-10-28 22:03:07 +08:00 committed by GitHub
parent 0b12414315
commit a609a8937f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 75 additions and 49 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Upgrade Vite to 3.2

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Allow importing public files in SSR

View file

@ -146,7 +146,7 @@
"recast": "^0.20.5",
"rehype": "^12.0.1",
"resolve": "^1.22.0",
"rollup": "~2.78.0",
"rollup": "^2.79.1",
"semver": "^7.3.7",
"shiki": "^0.11.1",
"sirv": "^2.0.2",
@ -158,7 +158,7 @@
"typescript": "*",
"unist-util-visit": "^4.1.0",
"vfile": "^5.3.2",
"vite": "~3.1.3",
"vite": "~3.2.1",
"vitefu": "^0.1.0",
"yargs-parser": "^21.0.1",
"zod": "^3.17.3"

View file

@ -124,6 +124,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
emptyOutDir: false,
manifest: false,
outDir: fileURLToPath(out),
copyPublicDir: !ssr,
rollupOptions: {
...viteConfig.build?.rollupOptions,
input: [],
@ -138,7 +139,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
ssr: true,
// improve build performance
minify: false,
polyfillModulePreload: false,
modulePreload: { polyfill: false },
reportCompressedSize: false,
},
plugins: [
@ -154,7 +155,6 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
settings.config.output === 'server' && vitePluginSSR(internals, settings.adapter!),
vitePluginAnalyzer(internals),
],
publicDir: ssr ? false : viteConfig.publicDir,
envPrefix: 'PUBLIC_',
base: settings.config.base,
};

View file

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 36 36">
<path fill="#000" d="M22.25 4h-8.5a1 1 0 0 0-.96.73l-5.54 19.4a.5.5 0 0 0 .62.62l5.05-1.44a2 2 0 0 0 1.38-1.4l3.22-11.66a.5.5 0 0 1 .96 0l3.22 11.67a2 2 0 0 0 1.38 1.39l5.05 1.44a.5.5 0 0 0 .62-.62l-5.54-19.4a1 1 0 0 0-.96-.73Z"/>
<path fill="url(#gradient)" d="M18 28a7.63 7.63 0 0 1-5-2c-1.4 2.1-.35 4.35.6 5.55.14.17.41.07.47-.15.44-1.8 2.93-1.22 2.93.6 0 2.28.87 3.4 1.72 3.81.34.16.59-.2.49-.56-.31-1.05-.29-2.46 1.29-3.25 3-1.5 3.17-4.83 2.5-6-.67.67-2.6 2-5 2Z"/>
<defs>
<linearGradient id="gradient" x1="16" x2="16" y1="32" y2="24" gradientUnits="userSpaceOnUse">
<stop stop-color="#000"/>
<stop offset="1" stop-color="#000" stop-opacity="0"/>
</linearGradient>
</defs>
<style>
@media (prefers-color-scheme:dark){:root{filter:invert(100%)}}
</style>
</svg>

After

Width:  |  Height:  |  Size: 873 B

View file

@ -0,0 +1,3 @@
<template>
<img id="vue-img" src="/favicon.svg" alt="logo" />
</template>

View file

@ -1,5 +1,6 @@
---
import Counter from '../components/Counter.vue'
import Img from '../components/Img.vue'
---
<html lang="en">
<head>
@ -28,6 +29,7 @@ import Counter from '../components/Counter.vue'
<!-- Test that two client:visibles have unique uids -->
<Counter start="100" client:visible>SSR Rendered, client:visible</Counter>
<Counter start="1000" client:visible>SSR Rendered, client:visible</Counter>
<Img />
</main>
</body>
</html>

View file

@ -39,6 +39,9 @@ describe('Vue component', () => {
// test 5: components with identical render output and props have been deduplicated
const uniqueRootUIDs = $('astro-island').map((i, el) => $(el).attr('uid'));
expect(new Set(uniqueRootUIDs).size).to.equal(5);
// test 6: import public files work
expect($('#vue-img')).to.be.ok;
});
});

View file

@ -70,7 +70,7 @@
"formdata-polyfill": "^4.0.10",
"magic-string": "^0.25.9",
"mocha": "^9.2.2",
"rollup": "^2.75.6",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2",
"tslib": "^2.4.0",
"typescript": "~4.7.3",

View file

@ -439,7 +439,7 @@ importers:
rehype-toc: ^3.0.2
remark-code-titles: ^0.1.2
resolve: ^1.22.0
rollup: ~2.78.0
rollup: ^2.79.1
sass: ^1.52.2
semver: ^7.3.7
shiki: ^0.11.1
@ -454,7 +454,7 @@ importers:
unified: ^10.1.2
unist-util-visit: ^4.1.0
vfile: ^5.3.2
vite: ~3.1.3
vite: ~3.2.1
vitefu: ^0.1.0
yargs-parser: ^21.0.1
zod: ^3.17.3
@ -505,7 +505,7 @@ importers:
recast: 0.20.5
rehype: 12.0.1
resolve: 1.22.1
rollup: 2.78.1
rollup: 2.79.1
semver: 7.3.8
shiki: 0.11.1
sirv: 2.0.2
@ -517,8 +517,8 @@ importers:
typescript: 4.8.4
unist-util-visit: 4.1.1
vfile: 5.3.5
vite: 3.1.8_sass@1.55.0
vitefu: 0.1.0_vite@3.1.8
vite: 3.2.1_sass@1.55.0
vitefu: 0.1.0_vite@3.2.1
yargs-parser: 21.1.1
zod: 3.19.1
devDependencies:
@ -3449,7 +3449,7 @@ importers:
magic-string: ^0.25.9
mocha: ^9.2.2
node-fetch: ^3.2.5
rollup: ^2.75.6
rollup: ^2.79.1
rollup-plugin-terser: ^7.0.2
tslib: ^2.4.0
typescript: ~4.7.3
@ -16463,14 +16463,6 @@ packages:
dependencies:
estree-walker: 0.6.1
/rollup/2.78.1:
resolution: {integrity: sha512-VeeCgtGi4P+o9hIg+xz4qQpRl6R401LWEXBmxYKOV4zlF82lyhgh2hTZnheFUbANE8l2A41F458iwj2vEYaXJg==}
engines: {node: '>=10.0.0'}
hasBin: true
optionalDependencies:
fsevents: 2.3.2
dev: false
/rollup/2.79.1:
resolution: {integrity: sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==}
engines: {node: '>=10.0.0'}
@ -17956,34 +17948,6 @@ packages:
- supports-color
dev: false
/vite/3.1.8_sass@1.55.0:
resolution: {integrity: sha512-m7jJe3nufUbuOfotkntGFupinL/fmuTNuQmiVE7cH2IZMuf4UbfbGYMUT3jVWgGYuRVLY9j8NnrRqgw5rr5QTg==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:
less: '*'
sass: '*'
stylus: '*'
terser: ^5.4.0
peerDependenciesMeta:
less:
optional: true
sass:
optional: true
stylus:
optional: true
terser:
optional: true
dependencies:
esbuild: 0.15.12
postcss: 8.4.18
resolve: 1.22.1
rollup: 2.78.1
sass: 1.55.0
optionalDependencies:
fsevents: 2.3.2
dev: false
/vite/3.2.0:
resolution: {integrity: sha512-Ovj7+cqIdM1I0LPCk2CWxzgADXMix3NLXpUT6g7P7zg/a9grk/TaC3qn9YMg7w7M0POIVCBOp1aBANJW+RH7oA==}
engines: {node: ^14.18.0 || >=16.0.0}
@ -18013,7 +17977,38 @@ packages:
optionalDependencies:
fsevents: 2.3.2
/vitefu/0.1.0_vite@3.1.8:
/vite/3.2.1_sass@1.55.0:
resolution: {integrity: sha512-ADtMkfHuWq4tskJsri2n2FZkORO8ZyhI+zIz7zTrDAgDEtct1jdxOg3YsZBfHhKjmMoWLOSCr+64qrEDGo/DbQ==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:
less: '*'
sass: '*'
stylus: '*'
sugarss: '*'
terser: ^5.4.0
peerDependenciesMeta:
less:
optional: true
sass:
optional: true
stylus:
optional: true
sugarss:
optional: true
terser:
optional: true
dependencies:
esbuild: 0.15.12
postcss: 8.4.18
resolve: 1.22.1
rollup: 2.79.1
sass: 1.55.0
optionalDependencies:
fsevents: 2.3.2
dev: false
/vitefu/0.1.0_vite@3.2.1:
resolution: {integrity: sha512-5MQSHP9yr0HIve8q4XNb7QXfO1P4tzZDZP99qH0FM5ClcwYddeGXRDQ4TQYRUeXLjZ+vLecirHtGNpwFFUF7sw==}
peerDependencies:
vite: ^3.0.0
@ -18022,7 +18017,7 @@ packages:
optional: true
dependencies:
import-meta-resolve: 2.1.0
vite: 3.1.8_sass@1.55.0
vite: 3.2.1_sass@1.55.0
dev: false
/vitest/0.20.3: