@sveltejs/kit 3.0.0-next.2 → 3.0.0-next.20
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 +58 -36
- package/src/cli.js +14 -11
- package/src/constants.js +6 -1
- package/src/core/adapt/builder.js +54 -60
- package/src/core/adapt/index.js +2 -5
- package/src/core/config/index.js +141 -76
- package/src/core/config/options.js +260 -260
- package/src/core/config/types.d.ts +1 -1
- package/src/core/env.js +143 -13
- package/src/core/generate_manifest/index.js +18 -15
- package/src/core/postbuild/analyse.js +7 -19
- package/src/core/postbuild/crawl.js +22 -6
- package/src/core/postbuild/entities.js +8 -2
- package/src/core/postbuild/fallback.js +4 -2
- package/src/core/postbuild/prerender.js +193 -69
- package/src/core/postbuild/queue.js +2 -1
- package/src/core/sync/create_manifest_data/conflict.js +1 -1
- package/src/core/sync/create_manifest_data/index.js +72 -52
- package/src/core/sync/sync.js +35 -26
- package/src/core/sync/ts.js +1 -1
- package/src/core/sync/utils.js +22 -2
- package/src/core/sync/{write_non_ambient.js → write_app_types.js} +105 -56
- package/src/core/sync/write_client_manifest.js +13 -28
- package/src/core/sync/write_env.js +7 -5
- package/src/core/sync/write_server.js +25 -33
- package/src/core/sync/write_tsconfig/index.js +274 -0
- package/src/core/sync/write_tsconfig/test-app/package.json +7 -0
- package/src/core/sync/write_tsconfig/utils.js +77 -0
- package/src/core/sync/write_tsconfig/validate.js +128 -0
- package/src/core/sync/write_types/index.js +119 -116
- package/src/core/utils.js +30 -5
- package/src/exports/env/index.js +77 -0
- package/src/exports/env/public.d.ts +55 -0
- package/src/exports/hooks/index.js +3 -9
- package/src/exports/hooks/public.d.ts +194 -0
- package/src/exports/hooks/sequence.js +9 -6
- package/src/exports/index.js +53 -20
- package/src/exports/internal/client.js +5 -0
- package/src/exports/internal/env.js +8 -5
- package/src/exports/internal/index.js +1 -90
- package/src/exports/internal/{event.js → server/event.js} +1 -2
- package/src/exports/internal/server/index.js +37 -0
- package/src/exports/internal/server/telemetry.js +95 -0
- package/src/exports/internal/shared.js +90 -0
- package/src/exports/node/index.js +64 -22
- package/src/exports/params/index.js +70 -0
- package/src/exports/params/public.d.ts +63 -0
- package/src/exports/public.d.ts +219 -1118
- package/src/exports/url.js +86 -0
- package/src/exports/vite/build/build_server.js +53 -64
- package/src/exports/vite/build/remote.js +24 -19
- package/src/exports/vite/build/utils.js +0 -8
- package/src/exports/vite/dev/index.js +199 -125
- package/src/exports/vite/index.js +1514 -833
- package/src/exports/vite/module_ids.js +2 -2
- package/src/exports/vite/preview/index.js +32 -24
- package/src/exports/vite/utils.js +83 -45
- package/src/pathname.js +55 -0
- package/src/runner.js +15 -0
- package/src/runtime/app/env/internal.js +4 -4
- package/src/runtime/app/env/types.d.ts +1 -1
- package/src/runtime/app/environment/index.js +3 -3
- package/src/runtime/app/{forms.js → forms/index.js} +73 -42
- package/src/runtime/app/forms/public.d.ts +2 -0
- package/src/runtime/app/forms/types.d.ts +56 -0
- package/src/runtime/app/internal/transport.js +53 -0
- package/src/runtime/app/manifest/index.js +1 -0
- package/src/runtime/app/{navigation.js → navigation/index.js} +2 -1
- package/src/runtime/app/navigation/public.d.ts +237 -0
- package/src/runtime/app/paths/client.js +37 -37
- package/src/runtime/app/paths/index.js +1 -1
- package/src/runtime/app/paths/internal/client.js +34 -2
- package/src/runtime/app/paths/internal/server.js +6 -23
- package/src/runtime/app/paths/internal.d.ts +3 -0
- package/src/runtime/app/paths/public.d.ts +1 -29
- package/src/runtime/app/paths/server.js +36 -17
- package/src/runtime/app/paths/types.d.ts +11 -19
- package/src/runtime/app/server/index.js +2 -2
- package/src/runtime/app/server/public.d.ts +519 -0
- package/src/runtime/app/server/remote/command.js +13 -11
- package/src/runtime/app/server/remote/form.js +61 -39
- package/src/runtime/app/server/remote/prerender.js +45 -45
- package/src/runtime/app/server/remote/query.js +106 -108
- package/src/runtime/app/server/remote/requested.js +27 -19
- package/src/runtime/app/server/remote/shared.js +75 -75
- package/src/runtime/app/service-worker/index.js +24 -0
- package/src/runtime/app/state/client.js +4 -2
- package/src/runtime/app/state/index.js +7 -5
- package/src/runtime/app/state/public.d.ts +72 -0
- package/src/runtime/app/state/server.js +3 -0
- package/src/runtime/app/stores.js +15 -78
- package/src/runtime/client/bundle.js +1 -1
- package/src/runtime/client/client-entry.js +3 -0
- package/src/runtime/client/client.js +1336 -648
- package/src/runtime/client/constants.js +3 -6
- package/src/runtime/client/entry.js +24 -3
- package/src/runtime/client/fetcher.js +25 -25
- package/src/runtime/client/ndjson.js +1 -1
- package/src/runtime/client/parse.js +1 -1
- package/src/runtime/client/payload.js +17 -0
- package/src/runtime/client/remote-functions/cache.svelte.js +3 -1
- package/src/runtime/client/remote-functions/command.svelte.js +37 -61
- package/src/runtime/client/remote-functions/form.svelte.js +267 -178
- package/src/runtime/client/remote-functions/prerender.svelte.js +32 -11
- package/src/runtime/client/remote-functions/query/index.js +10 -17
- package/src/runtime/client/remote-functions/query/instance.svelte.js +64 -18
- package/src/runtime/client/remote-functions/query/proxy.js +5 -5
- package/src/runtime/client/remote-functions/query-batch.svelte.js +61 -70
- package/src/runtime/client/remote-functions/query-live/index.js +1 -1
- package/src/runtime/client/remote-functions/query-live/instance.svelte.js +63 -21
- package/src/runtime/client/remote-functions/query-live/iterator.js +15 -12
- package/src/runtime/client/remote-functions/query-live/proxy.js +2 -12
- package/src/runtime/client/remote-functions/shared.svelte.js +90 -65
- package/src/runtime/client/snapshots.js +147 -0
- package/src/runtime/client/state.svelte.js +94 -55
- package/src/runtime/client/stream.js +3 -2
- package/src/runtime/client/types.d.ts +13 -9
- package/src/runtime/client/utils.js +22 -110
- package/src/runtime/components/root.svelte +56 -0
- package/src/runtime/env/dynamic/private.js +7 -0
- package/src/runtime/env/dynamic/public.js +7 -0
- package/src/runtime/env/static/private.js +6 -0
- package/src/runtime/env/static/public.js +6 -0
- package/src/runtime/form-utils.js +172 -61
- package/src/runtime/pathname.js +20 -32
- package/src/runtime/props.svelte.js +72 -0
- package/src/runtime/server/constants.js +0 -3
- package/src/runtime/server/cookie.js +70 -53
- package/src/runtime/server/csrf.js +65 -0
- package/src/runtime/server/data/index.js +48 -52
- package/src/runtime/server/dev.js +22 -0
- package/src/runtime/server/endpoint.js +3 -4
- package/src/runtime/server/env_module.js +0 -5
- package/src/runtime/server/errors.js +160 -0
- package/src/runtime/server/fetch.js +31 -38
- package/src/runtime/server/index.js +90 -64
- package/src/runtime/server/internal.js +71 -0
- package/src/runtime/server/page/actions.js +84 -64
- package/src/runtime/server/page/crypto.js +2 -2
- package/src/runtime/server/page/csp.js +88 -104
- package/src/runtime/server/page/data_serializer.js +22 -23
- package/src/runtime/server/page/index.js +35 -53
- package/src/runtime/server/page/load_data.js +47 -54
- package/src/runtime/server/page/render.js +172 -238
- package/src/runtime/server/page/respond_with_error.js +16 -30
- package/src/runtime/server/page/serialize_data.js +2 -13
- package/src/runtime/server/page/server_routing.js +85 -26
- package/src/runtime/server/remote-functions.js +639 -0
- package/src/runtime/server/respond.js +188 -129
- package/src/runtime/server/sourcemaps.js +183 -0
- package/src/runtime/server/state.js +53 -0
- package/src/runtime/server/utils.js +12 -154
- package/src/runtime/shared.js +20 -40
- package/src/runtime/utils.js +3 -0
- package/src/types/ambient-private.d.ts +11 -1
- package/src/types/ambient.d.ts +87 -36
- package/src/types/global-private.d.ts +25 -25
- package/src/types/internal.d.ts +160 -150
- package/src/types/private.d.ts +41 -1
- package/src/utils/error.js +28 -4
- package/src/utils/escape.js +9 -25
- package/src/utils/features.js +1 -1
- package/src/utils/filesystem.js +1 -23
- package/src/utils/fork.js +7 -2
- package/src/utils/hash.js +21 -0
- package/src/utils/http.js +8 -7
- package/src/utils/import.js +9 -2
- package/src/utils/imports.js +83 -0
- package/src/utils/mime.js +9 -0
- package/src/utils/page_nodes.js +6 -7
- package/src/utils/params.js +67 -0
- package/src/utils/regex.js +9 -0
- package/src/utils/routing.js +145 -73
- package/src/utils/shared-iterator.js +5 -0
- package/src/utils/streaming.js +14 -4
- package/src/utils/url.js +33 -2
- package/src/version.js +1 -1
- package/types/index.d.ts +2291 -2135
- package/types/index.d.ts.map +116 -108
- package/src/core/sync/write_ambient.js +0 -18
- package/src/core/sync/write_root.js +0 -148
- package/src/core/sync/write_tsconfig.js +0 -250
- package/src/exports/internal/server.js +0 -22
- package/src/exports/node/polyfills.js +0 -30
- package/src/runtime/server/app.js +0 -9
- package/src/runtime/server/remote.js +0 -457
- package/src/runtime/shared-server.js +0 -7
- package/src/runtime/telemetry/otel.js +0 -21
- package/src/runtime/telemetry/record_span.js +0 -65
- package/src/types/synthetic/$lib.md +0 -5
- /package/src/exports/internal/{remote-functions.js → server/remote-functions.js} +0 -0
- /package/src/{runtime/telemetry/noop.js → telemetry.js} +0 -0
package/src/core/config/index.js
CHANGED
|
@@ -1,13 +1,78 @@
|
|
|
1
|
-
/** @import { Config } from '@sveltejs/kit' */
|
|
1
|
+
/** @import { Config, KitConfig } from '@sveltejs/kit' */
|
|
2
|
+
/** @import { Options, SvelteConfig } from '@sveltejs/vite-plugin-svelte' */
|
|
2
3
|
/** @import { ValidatedConfig } from 'types' */
|
|
3
4
|
/** @import { ResolvedConfig } from 'vite' */
|
|
4
5
|
import fs from 'node:fs';
|
|
5
6
|
import path from 'node:path';
|
|
6
7
|
import process from 'node:process';
|
|
7
8
|
import * as url from 'node:url';
|
|
8
|
-
import
|
|
9
|
+
import { styleText } from 'node:util';
|
|
10
|
+
import {
|
|
11
|
+
validate_kit_options,
|
|
12
|
+
kit_options,
|
|
13
|
+
kit_experimental_options,
|
|
14
|
+
validate_svelte_options
|
|
15
|
+
} from './options.js';
|
|
9
16
|
import { resolve_entry } from '../../utils/filesystem.js';
|
|
10
17
|
import { import_peer } from '../../utils/import.js';
|
|
18
|
+
import { stackless } from '../../utils/error.js';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Splits the config passed to the `sveltekit` Vite plugin into the options that
|
|
22
|
+
* SvelteKit processes itself and the options that are forwarded to
|
|
23
|
+
* `vite-plugin-svelte`. SvelteKit makes no assumptions about which options
|
|
24
|
+
* `vite-plugin-svelte` accepts — it plucks out its own options and passes
|
|
25
|
+
* everything else along (`vite-plugin-svelte` does its own validation).
|
|
26
|
+
* @param {KitConfig & Omit<Options, 'onwarn'> & Pick<SvelteConfig, 'vitePlugin'>} config
|
|
27
|
+
* @returns {{ svelte_config: Config, vite_plugin_svelte_config: Record<string, any> }}
|
|
28
|
+
*/
|
|
29
|
+
export function split_config(config) {
|
|
30
|
+
const { extensions, compilerOptions, vitePlugin, preprocess, ...rest } = config;
|
|
31
|
+
|
|
32
|
+
/** @type {KitConfig} */
|
|
33
|
+
const kit = {};
|
|
34
|
+
|
|
35
|
+
/** @type {Record<string, any>} */
|
|
36
|
+
const vite_plugin_svelte_config = {};
|
|
37
|
+
|
|
38
|
+
for (const key in rest) {
|
|
39
|
+
if (key === 'experimental') {
|
|
40
|
+
// `experimental` is a namespace that both SvelteKit and vite-plugin-svelte
|
|
41
|
+
// use, so pluck out the flags SvelteKit recognises and pass the rest along
|
|
42
|
+
const experimental = /** @type {Record<string, any>} */ (rest[key]) ?? {};
|
|
43
|
+
|
|
44
|
+
/** @type {Record<string, any>} */
|
|
45
|
+
const kit_experimental = {};
|
|
46
|
+
/** @type {Record<string, any>} */
|
|
47
|
+
const vps_experimental = {};
|
|
48
|
+
|
|
49
|
+
for (const flag in experimental) {
|
|
50
|
+
if (kit_experimental_options.includes(flag)) {
|
|
51
|
+
kit_experimental[flag] = experimental[flag];
|
|
52
|
+
} else {
|
|
53
|
+
vps_experimental[flag] = experimental[flag];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (Object.keys(kit_experimental).length > 0) {
|
|
58
|
+
kit.experimental = kit_experimental;
|
|
59
|
+
}
|
|
60
|
+
if (Object.keys(vps_experimental).length > 0) {
|
|
61
|
+
vite_plugin_svelte_config.experimental = vps_experimental;
|
|
62
|
+
}
|
|
63
|
+
} else if (kit_options.includes(key)) {
|
|
64
|
+
// @ts-expect-error - we've verified this is one of SvelteKit's own options
|
|
65
|
+
kit[key] = rest[key];
|
|
66
|
+
} else {
|
|
67
|
+
vite_plugin_svelte_config[key] = /** @type {Record<string, any>} */ (rest)[key];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
svelte_config: { extensions, compilerOptions, vitePlugin, preprocess, kit },
|
|
73
|
+
vite_plugin_svelte_config
|
|
74
|
+
};
|
|
75
|
+
}
|
|
11
76
|
|
|
12
77
|
/**
|
|
13
78
|
* Loads the template (src/app.html by default) and validates that it has the
|
|
@@ -55,13 +120,12 @@ export function load_error_page(config) {
|
|
|
55
120
|
|
|
56
121
|
/**
|
|
57
122
|
* @param {string} [config]
|
|
123
|
+
* @param {typeof import('vite')} [vite]
|
|
58
124
|
*/
|
|
59
|
-
export async function load_vite_config(config) {
|
|
60
|
-
|
|
61
|
-
await import_peer('vite', process.cwd())
|
|
62
|
-
);
|
|
125
|
+
export async function load_vite_config(config, vite) {
|
|
126
|
+
vite ??= /** @type {typeof import('vite')} */ (await import_peer('vite', process.cwd()));
|
|
63
127
|
|
|
64
|
-
return resolveConfig({ configFile: config }, 'build', process.env.MODE ?? 'production');
|
|
128
|
+
return vite.resolveConfig({ configFile: config }, 'build', process.env.MODE ?? 'production');
|
|
65
129
|
}
|
|
66
130
|
|
|
67
131
|
/**
|
|
@@ -70,98 +134,99 @@ export async function load_vite_config(config) {
|
|
|
70
134
|
*/
|
|
71
135
|
export function extract_svelte_config(vite_config) {
|
|
72
136
|
const plugin = vite_config.plugins.find((p) => p.name === 'vite-plugin-sveltekit-setup');
|
|
73
|
-
return plugin?.api.options ?? process_config({});
|
|
137
|
+
return plugin?.api.options ?? process_config(validate_config({}), vite_config.root);
|
|
74
138
|
}
|
|
75
139
|
|
|
76
140
|
/**
|
|
77
|
-
* @param {
|
|
141
|
+
* @param {ValidatedConfig} config
|
|
142
|
+
* @param {string} cwd
|
|
78
143
|
* @returns {ValidatedConfig}
|
|
79
144
|
*/
|
|
80
|
-
export function process_config(config,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
145
|
+
export function process_config(config, cwd) {
|
|
146
|
+
if (
|
|
147
|
+
config.kit.csp?.directives?.['require-trusted-types-for']?.includes('script') &&
|
|
148
|
+
config.kit.serviceWorker.register &&
|
|
149
|
+
resolve_entry(path.resolve(cwd, config.kit.files.serviceWorker)) &&
|
|
150
|
+
!config.kit.csp?.directives?.['trusted-types']?.includes('sveltekit-trusted-url')
|
|
151
|
+
) {
|
|
152
|
+
throw new Error(
|
|
153
|
+
"The `csp.directives['trusted-types']` option must include 'sveltekit-trusted-url' when `serviceWorker.register` is true"
|
|
154
|
+
);
|
|
155
|
+
}
|
|
85
156
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
157
|
+
config.kit.outDir = path.resolve(cwd, config.kit.outDir);
|
|
158
|
+
config.kit.env.dir = path.resolve(cwd, config.kit.env.dir);
|
|
159
|
+
|
|
160
|
+
for (const key in config.kit.files) {
|
|
161
|
+
if (key === 'hooks') {
|
|
162
|
+
config.kit.files.hooks.client = path.resolve(cwd, config.kit.files.hooks.client);
|
|
163
|
+
config.kit.files.hooks.server = path.resolve(cwd, config.kit.files.hooks.server);
|
|
164
|
+
config.kit.files.hooks.universal = path.resolve(cwd, config.kit.files.hooks.universal);
|
|
165
|
+
} else if (key !== 'lib' /* TODO remove when we remove the `lib` option altogether */) {
|
|
166
|
+
// @ts-expect-error
|
|
167
|
+
config.kit.files[key] = path.resolve(cwd, config.kit.files[key]);
|
|
98
168
|
}
|
|
99
|
-
|
|
100
|
-
return validated;
|
|
101
|
-
} catch (e) {
|
|
102
|
-
const error = /** @type {Error} */ (e);
|
|
103
|
-
|
|
104
|
-
// redact the stack trace — it's not helpful to users
|
|
105
|
-
error.stack = `Error loading ${source}: ${error.message}\n`;
|
|
106
|
-
throw error;
|
|
107
169
|
}
|
|
170
|
+
|
|
171
|
+
return config;
|
|
108
172
|
}
|
|
109
173
|
|
|
110
174
|
/**
|
|
111
175
|
* @param {Config} config
|
|
112
|
-
* @param {string} [cwd]
|
|
113
176
|
* @returns {ValidatedConfig}
|
|
114
177
|
*/
|
|
115
|
-
export function validate_config(config
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
'The Svelte config file must have a configuration object as its default export. See https://svelte.dev/docs/kit/configuration'
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/** @type {ValidatedConfig} */
|
|
123
|
-
const validated = options(config, 'config');
|
|
124
|
-
const files = validated.kit.files;
|
|
125
|
-
|
|
126
|
-
files.hooks.client ??= path.join(files.src, 'hooks.client');
|
|
127
|
-
files.hooks.server ??= path.join(files.src, 'hooks.server');
|
|
128
|
-
files.hooks.universal ??= path.join(files.src, 'hooks');
|
|
129
|
-
files.lib ??= path.join(files.src, 'lib');
|
|
130
|
-
files.params ??= path.join(files.src, 'params');
|
|
131
|
-
files.routes ??= path.join(files.src, 'routes');
|
|
132
|
-
files.serviceWorker ??= path.join(files.src, 'service-worker');
|
|
133
|
-
files.appTemplate ??= path.join(files.src, 'app.html');
|
|
134
|
-
files.errorTemplate ??= path.join(files.src, 'error.html');
|
|
135
|
-
|
|
136
|
-
if (validated.kit.router.resolution === 'server') {
|
|
137
|
-
if (validated.kit.router.type === 'hash') {
|
|
138
|
-
throw new Error(
|
|
139
|
-
"The `router.resolution` option cannot be 'server' if `router.type` is 'hash'"
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
if (validated.kit.output.bundleStrategy !== 'split') {
|
|
178
|
+
export function validate_config(config) {
|
|
179
|
+
try {
|
|
180
|
+
if (typeof config !== 'object') {
|
|
143
181
|
throw new Error(
|
|
144
|
-
|
|
182
|
+
'The SvelteKit options from the Vite config must be an object. See https://svelte.dev/docs/kit/configuration'
|
|
145
183
|
);
|
|
146
184
|
}
|
|
147
|
-
}
|
|
148
185
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
186
|
+
const validated = /** @type {ValidatedConfig} */ ({
|
|
187
|
+
...validate_svelte_options(config, 'config'),
|
|
188
|
+
kit: validate_kit_options(config.kit, 'config')
|
|
189
|
+
});
|
|
190
|
+
const files = validated.kit.files;
|
|
191
|
+
|
|
192
|
+
files.hooks.client ??= path.join(files.src, 'hooks.client');
|
|
193
|
+
files.hooks.server ??= path.join(files.src, 'hooks.server');
|
|
194
|
+
files.hooks.universal ??= path.join(files.src, 'hooks');
|
|
195
|
+
files.params ??= path.join(files.src, 'params');
|
|
196
|
+
files.routes ??= path.join(files.src, 'routes');
|
|
197
|
+
files.serviceWorker ??= path.join(files.src, 'service-worker');
|
|
198
|
+
files.appTemplate ??= path.join(files.src, 'app.html');
|
|
199
|
+
files.errorTemplate ??= path.join(files.src, 'error.html');
|
|
200
|
+
|
|
201
|
+
if (validated.kit.router.resolution === 'server') {
|
|
202
|
+
if (validated.kit.router.type === 'hash') {
|
|
203
|
+
throw new Error(
|
|
204
|
+
"The `router.resolution` option cannot be 'server' if `router.type` is 'hash'"
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
if (validated.kit.output.bundleStrategy !== 'split') {
|
|
208
|
+
throw new Error(
|
|
209
|
+
"The `router.resolution` option cannot be 'server' if `output.bundleStrategy` is 'inline' or 'single'"
|
|
210
|
+
);
|
|
211
|
+
}
|
|
154
212
|
}
|
|
213
|
+
|
|
155
214
|
if (
|
|
156
|
-
validated.kit.
|
|
157
|
-
|
|
158
|
-
!validated.kit.csp?.directives?.['trusted-types']?.includes('sveltekit-trusted-url')
|
|
215
|
+
validated.kit.csp?.directives?.['require-trusted-types-for']?.includes('script') &&
|
|
216
|
+
!validated.kit.csp?.directives?.['trusted-types']?.includes('svelte-trusted-html')
|
|
159
217
|
) {
|
|
160
218
|
throw new Error(
|
|
161
|
-
"The `csp.directives['trusted-types']` option must include '
|
|
219
|
+
"The `csp.directives['trusted-types']` option must include 'svelte-trusted-html'"
|
|
162
220
|
);
|
|
163
221
|
}
|
|
164
|
-
}
|
|
165
222
|
|
|
166
|
-
|
|
223
|
+
return validated;
|
|
224
|
+
} catch (e) {
|
|
225
|
+
const error = /** @type {Error} */ (e);
|
|
226
|
+
|
|
227
|
+
// Print a nicer version of the error to the console
|
|
228
|
+
console.log(styleText(['bold', 'red'], `\n${error.message}\n`));
|
|
229
|
+
|
|
230
|
+
throw stackless('Failed to load SvelteKit options from Vite config');
|
|
231
|
+
}
|
|
167
232
|
}
|