--- /dev/null
+---
+'@sveltejs/kit': patch
+---
+
+fix: put forking behind `experimental.forkPreloads`
experimental: {
tracing: { server: false },
instrumentation: { server: false },
- remoteFunctions: false
+ remoteFunctions: false,
+ forkPreloads: false
},
files: {
src: join(prefix, 'src'),
}, /^config\.kit\.experimental\.tracing\.server should be true or false, if specified$/);
});
+test('errors on invalid forkPreloads values', () => {
+ assert.throws(() => {
+ validate_config({
+ kit: {
+ experimental: {
+ // @ts-expect-error - given value expected to throw
+ forkPreloads: 'true'
+ }
+ }
+ });
+ }, /^config\.kit\.experimental\.forkPreloads should be true or false, if specified$/);
+
+ assert.throws(() => {
+ validate_config({
+ kit: {
+ experimental: {
+ // @ts-expect-error - given value expected to throw
+ forkPreloads: 1
+ }
+ }
+ });
+ }, /^config\.kit\.experimental\.forkPreloads should be true or false, if specified$/);
+});
+
test('uses src prefix for other kit.files options', async () => {
const cwd = join(__dirname, 'fixtures/custom-src');
instrumentation: object({
server: boolean(false)
}),
- remoteFunctions: boolean(false)
+ remoteFunctions: boolean(false),
+ forkPreloads: boolean(false)
}),
files: object({
* @default false
*/
remoteFunctions?: boolean;
+
+ /**
+ * Whether to enable the experimental forked preloading feature using Svelte's fork API.
+ * @default false
+ */
+ forkPreloads?: boolean;
};
/**
* Where to find various files within your project.
__SVELTEKIT_APP_DIR__: s(kit.appDir),
__SVELTEKIT_EMBEDDED__: s(kit.embedded),
__SVELTEKIT_EXPERIMENTAL__REMOTE_FUNCTIONS__: s(kit.experimental.remoteFunctions),
+ __SVELTEKIT_FORK_PRELOADS__: s(kit.experimental.forkPreloads),
__SVELTEKIT_PATHS_ASSETS__: s(kit.paths.assets),
__SVELTEKIT_PATHS_BASE__: s(kit.paths.base),
__SVELTEKIT_PATHS_RELATIVE__: s(kit.paths.relative),
fork: null
};
- if (svelte.fork) {
+ if (__SVELTEKIT_FORK_PRELOADS__ && svelte.fork) {
const lc = load_cache;
lc.fork = lc.promise.then((result) => {
update(result.props.page);
});
} catch {
- // if it errors, it's because the experimental flag isn't enabled
+ // if it errors, it's because the experimental flag isn't enabled in Svelte
}
}
const __SVELTEKIT_SERVER_TRACING_ENABLED__: boolean;
/** true if corresponding config option is set to true */
const __SVELTEKIT_EXPERIMENTAL__REMOTE_FUNCTIONS__: boolean;
+ /** True if `config.kit.experimental.forkPreloads` is `true` */
+ const __SVELTEKIT_FORK_PRELOADS__: boolean;
/** True if `config.kit.router.resolution === 'client'` */
const __SVELTEKIT_CLIENT_ROUTING__: boolean;
/** True if `config.kit.router.type === 'hash'` */
* @default false
*/
remoteFunctions?: boolean;
+
+ /**
+ * Whether to enable the experimental forked preloading feature using Svelte's fork API.
+ * @default false
+ */
+ forkPreloads?: boolean;
};
/**
* Where to find various files within your project.