@sveltejs/kit 1.8.5 → 1.8.6
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/package.json +1 -1
- package/src/exports/vite/index.js +24 -20
- package/types/index.d.ts +2 -2
package/package.json
CHANGED
|
@@ -218,6 +218,21 @@ function kit({ svelte_config }) {
|
|
|
218
218
|
|
|
219
219
|
const generated = path.posix.join(kit.outDir, 'generated');
|
|
220
220
|
|
|
221
|
+
// This ensures that esm-env is inlined into the server output with the
|
|
222
|
+
// export conditions resolved correctly through Vite. This prevents adapters
|
|
223
|
+
// that bundle later on from resolving the export conditions incorrectly
|
|
224
|
+
// and for example include browser-only code in the server output
|
|
225
|
+
// because they for example use esbuild.build with `platform: 'browser'`
|
|
226
|
+
const noExternal = ['esm-env'];
|
|
227
|
+
|
|
228
|
+
// Vitest bypasses Vite when loading external modules, so we bundle
|
|
229
|
+
// when it is detected to keep our virtual modules working.
|
|
230
|
+
// See https://github.com/sveltejs/kit/pull/9172
|
|
231
|
+
// and https://vitest.dev/config/#deps-registernodeloader
|
|
232
|
+
if (process.env.TEST) {
|
|
233
|
+
noExternal.push('@sveltejs/kit');
|
|
234
|
+
}
|
|
235
|
+
|
|
221
236
|
// dev and preview config can be shared
|
|
222
237
|
/** @type {import('vite').UserConfig} */
|
|
223
238
|
const new_config = {
|
|
@@ -252,6 +267,9 @@ function kit({ svelte_config }) {
|
|
|
252
267
|
'$app',
|
|
253
268
|
'$env'
|
|
254
269
|
]
|
|
270
|
+
},
|
|
271
|
+
ssr: {
|
|
272
|
+
noExternal
|
|
255
273
|
}
|
|
256
274
|
};
|
|
257
275
|
|
|
@@ -267,19 +285,6 @@ function kit({ svelte_config }) {
|
|
|
267
285
|
__SVELTEKIT_EMBEDDED__: kit.embedded ? 'true' : 'false'
|
|
268
286
|
};
|
|
269
287
|
|
|
270
|
-
new_config.ssr = {
|
|
271
|
-
noExternal: [
|
|
272
|
-
// TODO document why this is necessary
|
|
273
|
-
'@sveltejs/kit',
|
|
274
|
-
// This ensures that esm-env is inlined into the server output with the
|
|
275
|
-
// export conditions resolved correctly through Vite. This prevents adapters
|
|
276
|
-
// that bundle later on to resolve the export conditions incorrectly
|
|
277
|
-
// and for example include browser-only code in the server output
|
|
278
|
-
// because they for example use esbuild.build with `platform: 'browser'`
|
|
279
|
-
'esm-env'
|
|
280
|
-
]
|
|
281
|
-
};
|
|
282
|
-
|
|
283
288
|
if (!secondary_build_started) {
|
|
284
289
|
manifest_data = (await sync.all(svelte_config, config_env.mode)).manifest_data;
|
|
285
290
|
}
|
|
@@ -290,13 +295,12 @@ function kit({ svelte_config }) {
|
|
|
290
295
|
__SVELTEKIT_EMBEDDED__: kit.embedded ? 'true' : 'false'
|
|
291
296
|
};
|
|
292
297
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
};
|
|
298
|
+
// These Kit dependencies are packaged as CommonJS, which means they must always be externalized.
|
|
299
|
+
// Without this, the tests will still pass but `pnpm dev` will fail in projects that link `@sveltejs/kit`.
|
|
300
|
+
/** @type {NonNullable<import('vite').UserConfig['ssr']>} */ (new_config.ssr).external = [
|
|
301
|
+
'cookie',
|
|
302
|
+
'set-cookie-parser'
|
|
303
|
+
];
|
|
300
304
|
}
|
|
301
305
|
|
|
302
306
|
warn_overridden_config(config, new_config);
|
package/types/index.d.ts
CHANGED
|
@@ -539,7 +539,7 @@ export interface KitConfig {
|
|
|
539
539
|
* Client-side navigation can be buggy if you deploy a new version of your app while people are using it. If the code for the new page is already loaded, it may have stale content; if it isn't, the app's route manifest may point to a JavaScript file that no longer exists.
|
|
540
540
|
* SvelteKit helps you solve this problem through version management.
|
|
541
541
|
* If SvelteKit encounters an error while loading the page and detects that a new version has been deployed (using the `name` specified here, which defaults to a timestamp of the build) it will fall back to traditional full-page navigation.
|
|
542
|
-
* Not all navigations will result in an error though, for example if the JavaScript for the next page is already loaded. If you still want to force a full-page navigation in these cases, use techniques such as setting the `
|
|
542
|
+
* Not all navigations will result in an error though, for example if the JavaScript for the next page is already loaded. If you still want to force a full-page navigation in these cases, use techniques such as setting the `pollInterval` and then using `beforeNavigate`:
|
|
543
543
|
* ```html
|
|
544
544
|
* /// +layout.svelte
|
|
545
545
|
* <script>
|
|
@@ -558,7 +558,7 @@ export interface KitConfig {
|
|
|
558
558
|
*/
|
|
559
559
|
version?: {
|
|
560
560
|
/**
|
|
561
|
-
* The current app version string. If specified, this must be deterministic (e.g. a commit ref rather than `Math.random()` or Date.now().toString()`), otherwise defaults to a timestamp of the build
|
|
561
|
+
* The current app version string. If specified, this must be deterministic (e.g. a commit ref rather than `Math.random()` or `Date.now().toString()`), otherwise defaults to a timestamp of the build
|
|
562
562
|
*/
|
|
563
563
|
name?: string;
|
|
564
564
|
/**
|