@sveltejs/kit
Advanced tools
Comparing version
{ | ||
"name": "@sveltejs/kit", | ||
"version": "2.21.5", | ||
"version": "2.22.0", | ||
"description": "SvelteKit is the fastest way to build Svelte apps", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
"@playwright/test": "^1.51.1", | ||
"@sveltejs/vite-plugin-svelte": "^5.0.1", | ||
"@sveltejs/vite-plugin-svelte": "^6.0.0-next.0", | ||
"@types/connect": "^3.4.38", | ||
@@ -47,9 +47,9 @@ "@types/node": "^18.19.48", | ||
"typescript": "^5.3.3", | ||
"vite": "^6.2.7", | ||
"vite": "^6.3.5", | ||
"vitest": "^3.2.3" | ||
}, | ||
"peerDependencies": { | ||
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0", | ||
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0 || ^6.0.0-next.0", | ||
"svelte": "^4.0.0 || ^5.0.0-next.0", | ||
"vite": "^5.0.3 || ^6.0.0" | ||
"vite": "^5.0.3 || ^6.0.0 || ^7.0.0-beta.0" | ||
}, | ||
@@ -56,0 +56,0 @@ "bin": { |
@@ -17,7 +17,7 @@ import fs from 'node:fs'; | ||
* @param {import('vite').Rollup.OutputBundle | null} server_bundle | ||
* @param {import('vite').Rollup.RollupOutput['output'] | null} client_bundle | ||
* @param {import('vite').Rollup.RollupOutput['output'] | null} client_chunks | ||
* @param {import('types').RecursiveRequired<import('types').ValidatedConfig['kit']['output']>} output_config | ||
* @param {Map<string, { page_options: Record<string, any> | null, children: string[] }>} static_exports | ||
*/ | ||
export async function build_server_nodes(out, kit, manifest_data, server_manifest, client_manifest, server_bundle, client_bundle, output_config, static_exports) { | ||
export async function build_server_nodes(out, kit, manifest_data, server_manifest, client_manifest, server_bundle, client_chunks, output_config, static_exports) { | ||
mkdirp(`${out}/server/nodes`); | ||
@@ -29,8 +29,6 @@ mkdirp(`${out}/server/stylesheets`); | ||
if (server_bundle && client_bundle && kit.inlineStyleThreshold > 0) { | ||
const client = get_stylesheets(client_bundle); | ||
if (server_bundle && client_chunks && kit.inlineStyleThreshold > 0) { | ||
const client = get_stylesheets(client_chunks); | ||
const server = get_stylesheets(Object.values(server_bundle)); | ||
const server_chunks = Object.values(server_bundle); | ||
const server = get_stylesheets(server_chunks); | ||
// map server stylesheet name to the client stylesheet name | ||
@@ -37,0 +35,0 @@ for (const [id, client_stylesheet] of client.stylesheets_used) { |
@@ -106,3 +106,4 @@ import fs from 'node:fs'; | ||
// .mjs so that esbuild doesn't incorrectly inject `export` https://github.com/vitejs/vite/issues/15379 | ||
entryFileNames: 'service-worker.mjs', | ||
// @ts-expect-error `vite.rolldownVersion` only exists in `rolldown-vite` | ||
entryFileNames: `service-worker.${vite.rolldownVersion ? 'js' : 'mjs'}`, | ||
assetFileNames: `${kit.appDir}/immutable/assets/[name].[hash][extname]`, | ||
@@ -133,3 +134,6 @@ inlineDynamicImports: true | ||
// rename .mjs to .js to avoid incorrect MIME types with ancient webservers | ||
fs.renameSync(`${out}/client/service-worker.mjs`, `${out}/client/service-worker.js`); | ||
// @ts-expect-error `vite.rolldownVersion` only exists in `rolldown-vite` | ||
if (!vite.rolldownVersion) { | ||
fs.renameSync(`${out}/client/service-worker.mjs`, `${out}/client/service-worker.js`); | ||
} | ||
} |
@@ -185,2 +185,3 @@ import fs from 'node:fs'; | ||
async function kit({ svelte_config }) { | ||
/** @type {import('vite')} */ | ||
const vite = await import_peer('vite'); | ||
@@ -698,3 +699,2 @@ | ||
sourcemapIgnoreList, | ||
manualChunks: split ? undefined : () => 'bundle', | ||
inlineDynamicImports: false | ||
@@ -705,3 +705,6 @@ }, | ||
if ( | ||
warning.code === 'MISSING_EXPORT' && | ||
// @ts-expect-error `vite.rolldownVersion` only exists in `rolldown-vite` | ||
(vite.rolldownVersion | ||
? warning.code === 'IMPORT_IS_UNDEFINED' | ||
: warning.code === 'MISSING_EXPORT') && | ||
warning.id === `${kit.outDir}/generated/client-optimized/app.js` | ||
@@ -731,3 +734,21 @@ ) { | ||
} | ||
// TODO: enabling `experimental.enableNativePlugin` causes styles to not be applied | ||
// see https://github.com/vitejs/rolldown-vite/issues/213 | ||
// experimental: { | ||
// enableNativePlugin: true | ||
// } | ||
}; | ||
if (!split && new_config.build?.rollupOptions?.output) { | ||
const output_options = /** @type {import('vite').Rollup.OutputOptions} */ ( | ||
new_config.build.rollupOptions.output | ||
); | ||
// @ts-expect-error `vite.rolldownVersion` only exists in `rolldown-vite` | ||
if (vite.rolldownVersion) { | ||
output_options.inlineDynamicImports = true; | ||
} else { | ||
/** @type {import('rollup').OutputOptions} */ (output_options).manualChunks = () => | ||
'bundle'; | ||
} | ||
} | ||
} else { | ||
@@ -745,2 +766,7 @@ new_config = { | ||
publicDir: kit.files.assets | ||
// TODO: enabling `experimental.enableNativePlugin` causes styles to not be applied | ||
// see https://github.com/vitejs/rolldown-vite/issues/213 | ||
// experimental: { | ||
// enableNativePlugin: true | ||
// } | ||
}; | ||
@@ -787,3 +813,4 @@ } | ||
return { | ||
code: code.replace(/__SVELTEKIT_TRACK__\('(.+?)'\)/g, (_, label) => { | ||
// Rolldown changes our single quotes to double quotes so we need it in the regex too | ||
code: code.replace(/__SVELTEKIT_TRACK__\(['"](.+?)['"]\)/g, (_, label) => { | ||
(tracked_features[chunk.name + '.js'] ??= []).push(label); | ||
@@ -969,3 +996,3 @@ // put extra whitespace at the end of the comment to preserve the source size and avoid interfering with source maps | ||
if (svelte_config.kit.output.bundleStrategy === 'inline') { | ||
const style = /** @type {import('rollup').OutputAsset} */ ( | ||
const style = /** @type {import('vite').Rollup.OutputAsset} */ ( | ||
client_chunks.find( | ||
@@ -1045,3 +1072,3 @@ (chunk) => | ||
...vite_config.build, | ||
minify: initial_config.build?.minify ?? 'esbuild' | ||
minify: initial_config.build?.minify ?? true | ||
} | ||
@@ -1048,0 +1075,0 @@ }, |
// generated during release, do not modify | ||
/** @type {string} */ | ||
export const VERSION = '2.21.5'; | ||
export const VERSION = '2.22.0'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
839065
0.19%23997
0.13%