diff options
author | 2023-01-04 02:24:49 +0800 | |
---|---|---|
committer | 2023-01-03 13:24:49 -0500 | |
commit | f6cf92b48317a19a3840ad781b77d6d3cae143bb (patch) | |
tree | c22d07726672c36ba35a69285c1ad98e8d62e28c /packages/integrations | |
parent | 5007bc78815ce81e91c9b1482c1b84e1214de4b0 (diff) | |
download | astro-f6cf92b48317a19a3840ad781b77d6d3cae143bb.tar.gz astro-f6cf92b48317a19a3840ad781b77d6d3cae143bb.tar.zst astro-f6cf92b48317a19a3840ad781b77d6d3cae143bb.zip |
Upgrade to Vite 4 (#5685)
* Upgrade Vite 4
* Simplify Svelte preprocess setup
* Upgrade rollup
* Fix tests
* Fix wrong changeset target
* Fix error tests
* Set NODE_ENV default
Diffstat (limited to 'packages/integrations')
-rw-r--r-- | packages/integrations/image/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/mdx/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/netlify/package.json | 2 | ||||
-rw-r--r-- | packages/integrations/svelte/package.json | 10 | ||||
-rw-r--r-- | packages/integrations/svelte/src/index.ts | 28 | ||||
-rw-r--r-- | packages/integrations/vue/package.json | 6 |
6 files changed, 16 insertions, 34 deletions
diff --git a/packages/integrations/image/package.json b/packages/integrations/image/package.json index ceb01bb4a..b57b80001 100644 --- a/packages/integrations/image/package.json +++ b/packages/integrations/image/package.json @@ -62,7 +62,7 @@ "mocha": "^9.2.2", "rollup-plugin-copy": "^3.4.0", "sharp": "^0.31.0", - "vite": "^3.0.0" + "vite": "^4.0.3" }, "peerDependencies": { "sharp": ">=0.31.0" diff --git a/packages/integrations/mdx/package.json b/packages/integrations/mdx/package.json index 351d1ddb4..820b61775 100644 --- a/packages/integrations/mdx/package.json +++ b/packages/integrations/mdx/package.json @@ -68,7 +68,7 @@ "remark-rehype": "^10.1.0", "remark-shiki-twoslash": "^3.1.0", "remark-toc": "^8.0.1", - "vite": "^3.0.0" + "vite": "^4.0.3" }, "engines": { "node": "^14.18.0 || >=16.12.0" diff --git a/packages/integrations/netlify/package.json b/packages/integrations/netlify/package.json index eec8cdd5a..f73102fea 100644 --- a/packages/integrations/netlify/package.json +++ b/packages/integrations/netlify/package.json @@ -46,6 +46,6 @@ "chai": "^4.3.6", "cheerio": "^1.0.0-rc.11", "mocha": "^9.2.2", - "vite": "^3.0.0" + "vite": "^4.0.3" } } diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json index a4ad25e54..fdde735ef 100644 --- a/packages/integrations/svelte/package.json +++ b/packages/integrations/svelte/package.json @@ -33,19 +33,17 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "@sveltejs/vite-plugin-svelte": "^1.0.1", - "postcss-load-config": "^3.1.4", - "svelte-preprocess": "^4.10.7", + "@sveltejs/vite-plugin-svelte": "^2.0.2", "svelte2tsx": "^0.5.11" }, "devDependencies": { "astro": "workspace:*", "astro-scripts": "workspace:*", - "svelte": "^3.48.0", - "vite": "^3.0.0" + "svelte": "^3.54.0", + "vite": "^4.0.3" }, "peerDependencies": { - "svelte": "^3.46.4" + "svelte": "^3.54.0" }, "engines": { "node": "^14.18.0 || >=16.12.0" diff --git a/packages/integrations/svelte/src/index.ts b/packages/integrations/svelte/src/index.ts index f162437c0..6bf5bcc4e 100644 --- a/packages/integrations/svelte/src/index.ts +++ b/packages/integrations/svelte/src/index.ts @@ -1,7 +1,6 @@ import type { Options } from '@sveltejs/vite-plugin-svelte'; -import { svelte } from '@sveltejs/vite-plugin-svelte'; -import type { AstroConfig, AstroIntegration, AstroRenderer } from 'astro'; -import preprocess from 'svelte-preprocess'; +import { svelte, vitePreprocess } from '@sveltejs/vite-plugin-svelte'; +import type { AstroIntegration, AstroRenderer } from 'astro'; import type { UserConfig } from 'vite'; function getRenderer(): AstroRenderer { @@ -15,27 +14,13 @@ function getRenderer(): AstroRenderer { type ViteConfigurationArgs = { isDev: boolean; options?: Options | OptionsCallback; - postcssConfig: AstroConfig['style']['postcss']; }; -function getViteConfiguration({ - options, - postcssConfig, - isDev, -}: ViteConfigurationArgs): UserConfig { +function getViteConfiguration({ options, isDev }: ViteConfigurationArgs): UserConfig { const defaultOptions: Partial<Options> = { emitCss: true, compilerOptions: { dev: isDev, hydratable: true }, - preprocess: [ - preprocess({ - less: true, - postcss: postcssConfig, - sass: { renderSync: true }, - scss: { renderSync: true }, - stylus: true, - typescript: true, - }), - ], + preprocess: [vitePreprocess()], }; // Disable hot mode during the build @@ -65,7 +50,7 @@ function getViteConfiguration({ return { optimizeDeps: { - include: ['@astrojs/svelte/client.js', 'svelte', 'svelte/internal'], + include: ['@astrojs/svelte/client.js'], exclude: ['@astrojs/svelte/server.js'], }, plugins: [svelte(resolvedOptions)], @@ -78,13 +63,12 @@ export default function (options?: Options | OptionsCallback): AstroIntegration name: '@astrojs/svelte', hooks: { // Anything that gets returned here is merged into Astro Config - 'astro:config:setup': ({ command, updateConfig, addRenderer, config }) => { + 'astro:config:setup': ({ command, updateConfig, addRenderer }) => { addRenderer(getRenderer()); updateConfig({ vite: getViteConfiguration({ options, isDev: command === 'dev', - postcssConfig: config.style.postcss, }), }); }, diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json index 1f1cbe3dc..2df134a8f 100644 --- a/packages/integrations/vue/package.json +++ b/packages/integrations/vue/package.json @@ -34,8 +34,8 @@ "test": "mocha --timeout 20000" }, "dependencies": { - "@vitejs/plugin-vue": "^3.0.0", - "@vitejs/plugin-vue-jsx": "^2.0.1", + "@vitejs/plugin-vue": "^4.0.0", + "@vitejs/plugin-vue-jsx": "^3.0.0", "@vue/babel-plugin-jsx": "^1.1.1", "@vue/compiler-sfc": "^3.2.39" }, @@ -46,7 +46,7 @@ "chai": "^4.3.6", "linkedom": "^0.14.17", "mocha": "^9.2.2", - "vite": "^3.0.0", + "vite": "^4.0.3", "vue": "^3.2.37" }, "peerDependencies": { |