@sveltejs/kit 1.0.0-next.338 → 1.0.0-next.340
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/assets/client/start.js +65 -35
- package/assets/server/index.js +27 -34
- package/dist/chunks/index.js +11 -8
- package/dist/chunks/index2.js +12 -11
- package/dist/chunks/index6.js +22 -16
- package/dist/chunks/sync.js +101 -97
- package/dist/chunks/write_tsconfig.js +14 -6
- package/dist/cli.js +32 -3
- package/package.json +2 -17
- package/types/ambient.d.ts +1 -1
- package/types/index.d.ts +4 -3
- package/types/internal.d.ts +6 -4
package/assets/client/start.js
CHANGED
|
@@ -64,19 +64,13 @@ function normalize(loaded) {
|
|
|
64
64
|
|
|
65
65
|
if (loaded.redirect) {
|
|
66
66
|
if (!loaded.status || Math.floor(loaded.status / 100) !== 3) {
|
|
67
|
-
|
|
68
|
-
status
|
|
69
|
-
|
|
70
|
-
'"redirect" property returned from load() must be accompanied by a 3xx status code'
|
|
71
|
-
)
|
|
72
|
-
};
|
|
67
|
+
throw new Error(
|
|
68
|
+
'"redirect" property returned from load() must be accompanied by a 3xx status code'
|
|
69
|
+
);
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
if (typeof loaded.redirect !== 'string') {
|
|
76
|
-
|
|
77
|
-
status: 500,
|
|
78
|
-
error: new Error('"redirect" property returned from load() must be a string')
|
|
79
|
-
};
|
|
73
|
+
throw new Error('"redirect" property returned from load() must be a string');
|
|
80
74
|
}
|
|
81
75
|
}
|
|
82
76
|
|
|
@@ -85,10 +79,7 @@ function normalize(loaded) {
|
|
|
85
79
|
!Array.isArray(loaded.dependencies) ||
|
|
86
80
|
loaded.dependencies.some((dep) => typeof dep !== 'string')
|
|
87
81
|
) {
|
|
88
|
-
|
|
89
|
-
status: 500,
|
|
90
|
-
error: new Error('"dependencies" property returned from load() must be of type string[]')
|
|
91
|
-
};
|
|
82
|
+
throw new Error('"dependencies" property returned from load() must be of type string[]');
|
|
92
83
|
}
|
|
93
84
|
}
|
|
94
85
|
|
|
@@ -616,8 +607,9 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
616
607
|
* @param {string[]} redirect_chain
|
|
617
608
|
* @param {boolean} no_cache
|
|
618
609
|
* @param {{hash?: string, scroll: { x: number, y: number } | null, keepfocus: boolean, details: { replaceState: boolean, state: any } | null}} [opts]
|
|
610
|
+
* @param {() => void} [callback]
|
|
619
611
|
*/
|
|
620
|
-
async function update(url, redirect_chain, no_cache, opts) {
|
|
612
|
+
async function update(url, redirect_chain, no_cache, opts, callback) {
|
|
621
613
|
const intent = get_navigation_intent(url);
|
|
622
614
|
|
|
623
615
|
const current_token = (token = {});
|
|
@@ -744,7 +736,6 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
744
736
|
load_cache.promise = null;
|
|
745
737
|
load_cache.id = null;
|
|
746
738
|
autoscroll = true;
|
|
747
|
-
updating = false;
|
|
748
739
|
|
|
749
740
|
if (navigation_result.props.page) {
|
|
750
741
|
page = navigation_result.props.page;
|
|
@@ -753,7 +744,9 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
753
744
|
const leaf_node = navigation_result.state.branch[navigation_result.state.branch.length - 1];
|
|
754
745
|
router_enabled = leaf_node?.module.router !== false;
|
|
755
746
|
|
|
756
|
-
|
|
747
|
+
if (callback) callback();
|
|
748
|
+
|
|
749
|
+
updating = false;
|
|
757
750
|
}
|
|
758
751
|
|
|
759
752
|
/** @param {import('./types').NavigationResult} result */
|
|
@@ -771,12 +764,12 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
771
764
|
hydrate: true
|
|
772
765
|
});
|
|
773
766
|
|
|
774
|
-
started = true;
|
|
775
|
-
|
|
776
767
|
if (router_enabled) {
|
|
777
768
|
const navigation = { from: null, to: new URL(location.href) };
|
|
778
769
|
callbacks.after_navigate.forEach((fn) => fn(navigation));
|
|
779
770
|
}
|
|
771
|
+
|
|
772
|
+
started = true;
|
|
780
773
|
}
|
|
781
774
|
|
|
782
775
|
/**
|
|
@@ -934,7 +927,7 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
934
927
|
const session = $session;
|
|
935
928
|
|
|
936
929
|
if (module.load) {
|
|
937
|
-
/** @type {import('types').
|
|
930
|
+
/** @type {import('types').LoadEvent} */
|
|
938
931
|
const load_input = {
|
|
939
932
|
routeId,
|
|
940
933
|
params: uses_params,
|
|
@@ -962,11 +955,44 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
962
955
|
node.uses.stuff = true;
|
|
963
956
|
return { ...stuff };
|
|
964
957
|
},
|
|
965
|
-
fetch(resource,
|
|
966
|
-
|
|
967
|
-
|
|
958
|
+
async fetch(resource, init) {
|
|
959
|
+
let requested;
|
|
960
|
+
|
|
961
|
+
if (typeof resource === 'string') {
|
|
962
|
+
requested = resource;
|
|
963
|
+
} else {
|
|
964
|
+
requested = resource.url;
|
|
965
|
+
|
|
966
|
+
// we're not allowed to modify the received `Request` object, so in order
|
|
967
|
+
// to fixup relative urls we create a new equivalent `init` object instead
|
|
968
|
+
init = {
|
|
969
|
+
// the request body must be consumed in memory until browsers
|
|
970
|
+
// implement streaming request bodies and/or the body getter
|
|
971
|
+
body:
|
|
972
|
+
resource.method === 'GET' || resource.method === 'HEAD'
|
|
973
|
+
? undefined
|
|
974
|
+
: await resource.blob(),
|
|
975
|
+
cache: resource.cache,
|
|
976
|
+
credentials: resource.credentials,
|
|
977
|
+
headers: resource.headers,
|
|
978
|
+
integrity: resource.integrity,
|
|
979
|
+
keepalive: resource.keepalive,
|
|
980
|
+
method: resource.method,
|
|
981
|
+
mode: resource.mode,
|
|
982
|
+
redirect: resource.redirect,
|
|
983
|
+
referrer: resource.referrer,
|
|
984
|
+
referrerPolicy: resource.referrerPolicy,
|
|
985
|
+
signal: resource.signal,
|
|
986
|
+
...init
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// we must fixup relative urls so they are resolved from the target page
|
|
991
|
+
const normalized = new URL(requested, url).href;
|
|
992
|
+
add_dependency(normalized);
|
|
968
993
|
|
|
969
|
-
|
|
994
|
+
// prerendered pages may be served from any origin, so `initial_fetch` urls shouldn't be normalized
|
|
995
|
+
return started ? fetch$1(normalized, init) : initial_fetch(requested, init);
|
|
970
996
|
},
|
|
971
997
|
status: status ?? null,
|
|
972
998
|
error: error ?? null
|
|
@@ -1329,18 +1355,22 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
1329
1355
|
});
|
|
1330
1356
|
}
|
|
1331
1357
|
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1358
|
+
await update(
|
|
1359
|
+
normalized,
|
|
1360
|
+
redirect_chain,
|
|
1361
|
+
false,
|
|
1362
|
+
{
|
|
1363
|
+
scroll,
|
|
1364
|
+
keepfocus,
|
|
1365
|
+
details
|
|
1366
|
+
},
|
|
1367
|
+
() => {
|
|
1368
|
+
const navigation = { from, to: normalized };
|
|
1369
|
+
callbacks.after_navigate.forEach((fn) => fn(navigation));
|
|
1341
1370
|
|
|
1342
|
-
|
|
1343
|
-
|
|
1371
|
+
stores.navigating.set(null);
|
|
1372
|
+
}
|
|
1373
|
+
);
|
|
1344
1374
|
}
|
|
1345
1375
|
|
|
1346
1376
|
/**
|
package/assets/server/index.js
CHANGED
|
@@ -1124,13 +1124,13 @@ async function render_response({
|
|
|
1124
1124
|
resolve_opts,
|
|
1125
1125
|
stuff
|
|
1126
1126
|
}) {
|
|
1127
|
-
if (state.
|
|
1127
|
+
if (state.prerendering) {
|
|
1128
1128
|
if (options.csp.mode === 'nonce') {
|
|
1129
1129
|
throw new Error('Cannot use prerendering if config.kit.csp.mode === "nonce"');
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
1132
|
if (options.template_contains_nonce) {
|
|
1133
|
-
throw new Error('Cannot use prerendering if page template contains %
|
|
1133
|
+
throw new Error('Cannot use prerendering if page template contains %sveltekit.nonce%');
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
1136
|
|
|
@@ -1192,7 +1192,7 @@ async function render_response({
|
|
|
1192
1192
|
routeId: event.routeId,
|
|
1193
1193
|
status,
|
|
1194
1194
|
stuff,
|
|
1195
|
-
url: state.
|
|
1195
|
+
url: state.prerendering ? create_prerendering_url_proxy(event.url) : event.url
|
|
1196
1196
|
},
|
|
1197
1197
|
components: branch.map(({ node }) => node.module.default)
|
|
1198
1198
|
};
|
|
@@ -1232,7 +1232,7 @@ async function render_response({
|
|
|
1232
1232
|
await csp_ready;
|
|
1233
1233
|
const csp = new Csp(options.csp, {
|
|
1234
1234
|
dev: options.dev,
|
|
1235
|
-
prerender: !!state.
|
|
1235
|
+
prerender: !!state.prerendering,
|
|
1236
1236
|
needs_nonce: options.template_contains_nonce
|
|
1237
1237
|
});
|
|
1238
1238
|
|
|
@@ -1341,7 +1341,7 @@ async function render_response({
|
|
|
1341
1341
|
<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ''}>${init_service_worker}</script>`;
|
|
1342
1342
|
}
|
|
1343
1343
|
|
|
1344
|
-
if (state.
|
|
1344
|
+
if (state.prerendering) {
|
|
1345
1345
|
const http_equiv = [];
|
|
1346
1346
|
|
|
1347
1347
|
const csp_headers = csp.get_meta();
|
|
@@ -1379,7 +1379,7 @@ async function render_response({
|
|
|
1379
1379
|
headers.set('permissions-policy', 'interest-cohort=()');
|
|
1380
1380
|
}
|
|
1381
1381
|
|
|
1382
|
-
if (!state.
|
|
1382
|
+
if (!state.prerendering) {
|
|
1383
1383
|
const csp_header = csp.get_header();
|
|
1384
1384
|
if (csp_header) {
|
|
1385
1385
|
headers.set('content-security-policy', csp_header);
|
|
@@ -1941,19 +1941,13 @@ function normalize(loaded) {
|
|
|
1941
1941
|
|
|
1942
1942
|
if (loaded.redirect) {
|
|
1943
1943
|
if (!loaded.status || Math.floor(loaded.status / 100) !== 3) {
|
|
1944
|
-
|
|
1945
|
-
status
|
|
1946
|
-
|
|
1947
|
-
'"redirect" property returned from load() must be accompanied by a 3xx status code'
|
|
1948
|
-
)
|
|
1949
|
-
};
|
|
1944
|
+
throw new Error(
|
|
1945
|
+
'"redirect" property returned from load() must be accompanied by a 3xx status code'
|
|
1946
|
+
);
|
|
1950
1947
|
}
|
|
1951
1948
|
|
|
1952
1949
|
if (typeof loaded.redirect !== 'string') {
|
|
1953
|
-
|
|
1954
|
-
status: 500,
|
|
1955
|
-
error: new Error('"redirect" property returned from load() must be a string')
|
|
1956
|
-
};
|
|
1950
|
+
throw new Error('"redirect" property returned from load() must be a string');
|
|
1957
1951
|
}
|
|
1958
1952
|
}
|
|
1959
1953
|
|
|
@@ -1962,10 +1956,7 @@ function normalize(loaded) {
|
|
|
1962
1956
|
!Array.isArray(loaded.dependencies) ||
|
|
1963
1957
|
loaded.dependencies.some((dep) => typeof dep !== 'string')
|
|
1964
1958
|
) {
|
|
1965
|
-
|
|
1966
|
-
status: 500,
|
|
1967
|
-
error: new Error('"dependencies" property returned from load() must be of type string[]')
|
|
1968
|
-
};
|
|
1959
|
+
throw new Error('"dependencies" property returned from load() must be of type string[]');
|
|
1969
1960
|
}
|
|
1970
1961
|
}
|
|
1971
1962
|
|
|
@@ -2105,13 +2096,15 @@ async function load_node({
|
|
|
2105
2096
|
/** @type {import('types').LoadOutput} */
|
|
2106
2097
|
let loaded;
|
|
2107
2098
|
|
|
2099
|
+
const should_prerender = node.module.prerender ?? options.prerender.default;
|
|
2100
|
+
|
|
2108
2101
|
/** @type {import('types').ShadowData} */
|
|
2109
2102
|
const shadow = is_leaf
|
|
2110
2103
|
? await load_shadow_data(
|
|
2111
2104
|
/** @type {import('types').SSRPage} */ (route),
|
|
2112
2105
|
event,
|
|
2113
2106
|
options,
|
|
2114
|
-
|
|
2107
|
+
should_prerender
|
|
2115
2108
|
)
|
|
2116
2109
|
: {};
|
|
2117
2110
|
|
|
@@ -2132,9 +2125,9 @@ async function load_node({
|
|
|
2132
2125
|
redirect: shadow.redirect
|
|
2133
2126
|
};
|
|
2134
2127
|
} else if (module.load) {
|
|
2135
|
-
/** @type {import('types').
|
|
2128
|
+
/** @type {import('types').LoadEvent} */
|
|
2136
2129
|
const load_input = {
|
|
2137
|
-
url: state.
|
|
2130
|
+
url: state.prerendering ? create_prerendering_url_proxy(event.url) : event.url,
|
|
2138
2131
|
params: event.params,
|
|
2139
2132
|
props: shadow.body || {},
|
|
2140
2133
|
routeId: event.routeId,
|
|
@@ -2270,9 +2263,9 @@ async function load_node({
|
|
|
2270
2263
|
}
|
|
2271
2264
|
);
|
|
2272
2265
|
|
|
2273
|
-
if (state.
|
|
2266
|
+
if (state.prerendering) {
|
|
2274
2267
|
dependency = { response, body: null };
|
|
2275
|
-
state.
|
|
2268
|
+
state.prerendering.dependencies.set(resolved, dependency);
|
|
2276
2269
|
}
|
|
2277
2270
|
} else {
|
|
2278
2271
|
// external
|
|
@@ -2416,7 +2409,7 @@ async function load_node({
|
|
|
2416
2409
|
}
|
|
2417
2410
|
|
|
2418
2411
|
// generate __data.json files when prerendering
|
|
2419
|
-
if (shadow.body && state.
|
|
2412
|
+
if (shadow.body && state.prerendering) {
|
|
2420
2413
|
const pathname = `${event.url.pathname.replace(/\/$/, '')}/__data.json`;
|
|
2421
2414
|
|
|
2422
2415
|
const dependency = {
|
|
@@ -2424,7 +2417,7 @@ async function load_node({
|
|
|
2424
2417
|
body: JSON.stringify(shadow.body)
|
|
2425
2418
|
};
|
|
2426
2419
|
|
|
2427
|
-
state.
|
|
2420
|
+
state.prerendering.dependencies.set(pathname, dependency);
|
|
2428
2421
|
}
|
|
2429
2422
|
|
|
2430
2423
|
return {
|
|
@@ -2749,11 +2742,11 @@ async function respond$1(opts) {
|
|
|
2749
2742
|
|
|
2750
2743
|
let page_config = get_page_config(leaf, options);
|
|
2751
2744
|
|
|
2752
|
-
if (state.
|
|
2745
|
+
if (state.prerendering) {
|
|
2753
2746
|
// if the page isn't marked as prerenderable (or is explicitly
|
|
2754
2747
|
// marked NOT prerenderable, if `prerender.default` is `true`),
|
|
2755
2748
|
// then bail out at this point
|
|
2756
|
-
const should_prerender = leaf.prerender ??
|
|
2749
|
+
const should_prerender = leaf.prerender ?? options.prerender.default;
|
|
2757
2750
|
if (!should_prerender) {
|
|
2758
2751
|
return new Response(undefined, {
|
|
2759
2752
|
status: 204
|
|
@@ -3114,7 +3107,7 @@ async function respond(request, options, state) {
|
|
|
3114
3107
|
/** @type {Record<string, string>} */
|
|
3115
3108
|
let params = {};
|
|
3116
3109
|
|
|
3117
|
-
if (options.paths.base && !state.
|
|
3110
|
+
if (options.paths.base && !state.prerendering?.fallback) {
|
|
3118
3111
|
if (!decoded.startsWith(options.paths.base)) {
|
|
3119
3112
|
return new Response(undefined, { status: 404 });
|
|
3120
3113
|
}
|
|
@@ -3128,7 +3121,7 @@ async function respond(request, options, state) {
|
|
|
3128
3121
|
url = new URL(url.origin + url.pathname.slice(0, -DATA_SUFFIX.length) + url.search);
|
|
3129
3122
|
}
|
|
3130
3123
|
|
|
3131
|
-
if (!state.
|
|
3124
|
+
if (!state.prerendering?.fallback) {
|
|
3132
3125
|
const matchers = await options.manifest._.matchers();
|
|
3133
3126
|
|
|
3134
3127
|
for (const candidate of options.manifest._.routes) {
|
|
@@ -3147,7 +3140,7 @@ async function respond(request, options, state) {
|
|
|
3147
3140
|
if (route?.type === 'page') {
|
|
3148
3141
|
const normalized = normalize_path(url.pathname, options.trailing_slash);
|
|
3149
3142
|
|
|
3150
|
-
if (normalized !== url.pathname && !state.
|
|
3143
|
+
if (normalized !== url.pathname && !state.prerendering?.fallback) {
|
|
3151
3144
|
return new Response(undefined, {
|
|
3152
3145
|
status: 301,
|
|
3153
3146
|
headers: {
|
|
@@ -3238,7 +3231,7 @@ async function respond(request, options, state) {
|
|
|
3238
3231
|
};
|
|
3239
3232
|
}
|
|
3240
3233
|
|
|
3241
|
-
if (state.
|
|
3234
|
+
if (state.prerendering?.fallback) {
|
|
3242
3235
|
return await render_response({
|
|
3243
3236
|
event,
|
|
3244
3237
|
options,
|
|
@@ -3340,7 +3333,7 @@ async function respond(request, options, state) {
|
|
|
3340
3333
|
});
|
|
3341
3334
|
}
|
|
3342
3335
|
|
|
3343
|
-
if (state.
|
|
3336
|
+
if (state.prerendering) {
|
|
3344
3337
|
return new Response('not found', { status: 404 });
|
|
3345
3338
|
}
|
|
3346
3339
|
|
package/dist/chunks/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path__default from 'path';
|
|
2
2
|
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
3
|
-
import vite from 'vite';
|
|
3
|
+
import * as vite from 'vite';
|
|
4
4
|
import { d as deep_merge } from './object.js';
|
|
5
5
|
import { g as get_runtime_path, r as resolve_entry, $, l as load_template, c as coalesce_to_error, a as get_mime_lookup, b as get_aliases, p as print_config_conflicts } from '../cli.js';
|
|
6
6
|
import fs__default from 'fs';
|
|
@@ -328,21 +328,24 @@ async function create_plugin(config, cwd) {
|
|
|
328
328
|
assets
|
|
329
329
|
},
|
|
330
330
|
prefix: '',
|
|
331
|
-
prerender:
|
|
331
|
+
prerender: {
|
|
332
|
+
default: config.kit.prerender.default,
|
|
333
|
+
enabled: config.kit.prerender.enabled
|
|
334
|
+
},
|
|
332
335
|
read: (file) => fs__default.readFileSync(path__default.join(config.kit.files.assets, file)),
|
|
333
336
|
root,
|
|
334
337
|
router: config.kit.browser.router,
|
|
335
338
|
template: ({ head, body, assets, nonce }) => {
|
|
336
339
|
return (
|
|
337
340
|
template
|
|
338
|
-
.replace(/%
|
|
339
|
-
.replace(/%
|
|
340
|
-
// head and body must be replaced last, in case someone tries to sneak in %
|
|
341
|
-
.replace('%
|
|
342
|
-
.replace('%
|
|
341
|
+
.replace(/%sveltekit\.assets%/g, assets)
|
|
342
|
+
.replace(/%sveltekit\.nonce%/g, nonce)
|
|
343
|
+
// head and body must be replaced last, in case someone tries to sneak in %sveltekit.assets% etc
|
|
344
|
+
.replace('%sveltekit.head%', () => head)
|
|
345
|
+
.replace('%sveltekit.body%', () => body)
|
|
343
346
|
);
|
|
344
347
|
},
|
|
345
|
-
template_contains_nonce: template.includes('%
|
|
348
|
+
template_contains_nonce: template.includes('%sveltekit.nonce%'),
|
|
346
349
|
trailing_slash: config.kit.trailingSlash
|
|
347
350
|
},
|
|
348
351
|
{
|
package/dist/chunks/index2.js
CHANGED
|
@@ -4,7 +4,7 @@ import { p as posixify, m as mkdirp, r as rimraf } from './filesystem.js';
|
|
|
4
4
|
import { all } from './sync.js';
|
|
5
5
|
import { p as print_config_conflicts, b as get_aliases, r as resolve_entry, g as get_runtime_path, l as load_template } from '../cli.js';
|
|
6
6
|
import { g as generate_manifest } from './index3.js';
|
|
7
|
-
import vite from 'vite';
|
|
7
|
+
import * as vite from 'vite';
|
|
8
8
|
import { s } from './misc.js';
|
|
9
9
|
import { d as deep_merge } from './object.js';
|
|
10
10
|
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
@@ -342,10 +342,10 @@ import { set_paths, assets, base } from '${runtime}/paths.js';
|
|
|
342
342
|
import { set_prerendering } from '${runtime}/env.js';
|
|
343
343
|
|
|
344
344
|
const template = ({ head, body, assets, nonce }) => ${s(template)
|
|
345
|
-
.replace('%
|
|
346
|
-
.replace('%
|
|
347
|
-
.replace(/%
|
|
348
|
-
.replace(/%
|
|
345
|
+
.replace('%sveltekit.head%', '" + head + "')
|
|
346
|
+
.replace('%sveltekit.body%', '" + body + "')
|
|
347
|
+
.replace(/%sveltekit\.assets%/g, '" + assets + "')
|
|
348
|
+
.replace(/%sveltekit\.nonce%/g, '" + nonce + "')};
|
|
349
349
|
|
|
350
350
|
let read = null;
|
|
351
351
|
|
|
@@ -388,13 +388,16 @@ export class Server {
|
|
|
388
388
|
method_override: ${s(config.kit.methodOverride)},
|
|
389
389
|
paths: { base, assets },
|
|
390
390
|
prefix: assets + '/${config.kit.appDir}/',
|
|
391
|
-
prerender:
|
|
391
|
+
prerender: {
|
|
392
|
+
default: ${config.kit.prerender.default},
|
|
393
|
+
enabled: ${config.kit.prerender.enabled}
|
|
394
|
+
},
|
|
392
395
|
read,
|
|
393
396
|
root,
|
|
394
397
|
service_worker: ${has_service_worker ? "base + '/service-worker.js'" : 'null'},
|
|
395
398
|
router: ${s(config.kit.browser.router)},
|
|
396
399
|
template,
|
|
397
|
-
template_contains_nonce: ${template.includes('%
|
|
400
|
+
template_contains_nonce: ${template.includes('%sveltekit.nonce%')},
|
|
398
401
|
trailing_slash: ${s(config.kit.trailingSlash)}
|
|
399
402
|
};
|
|
400
403
|
}
|
|
@@ -1137,8 +1140,7 @@ async function prerender({ config, entries, files, log }) {
|
|
|
1137
1140
|
|
|
1138
1141
|
const response = await server.respond(new Request(`http://sveltekit-prerender${encoded}`), {
|
|
1139
1142
|
getClientAddress,
|
|
1140
|
-
|
|
1141
|
-
default: config.kit.prerender.default,
|
|
1143
|
+
prerendering: {
|
|
1142
1144
|
dependencies
|
|
1143
1145
|
}
|
|
1144
1146
|
});
|
|
@@ -1274,9 +1276,8 @@ async function prerender({ config, entries, files, log }) {
|
|
|
1274
1276
|
|
|
1275
1277
|
const rendered = await server.respond(new Request('http://sveltekit-prerender/[fallback]'), {
|
|
1276
1278
|
getClientAddress,
|
|
1277
|
-
|
|
1279
|
+
prerendering: {
|
|
1278
1280
|
fallback: true,
|
|
1279
|
-
default: false,
|
|
1280
1281
|
dependencies: new Map()
|
|
1281
1282
|
}
|
|
1282
1283
|
});
|
package/dist/chunks/index6.js
CHANGED
|
@@ -5950,14 +5950,14 @@ const flatten_properties = (array, target) => {
|
|
|
5950
5950
|
* @param {any[]} nodes
|
|
5951
5951
|
* @param {any[]} target
|
|
5952
5952
|
*/
|
|
5953
|
-
const flatten = (nodes, target) => {
|
|
5953
|
+
const flatten$1 = (nodes, target) => {
|
|
5954
5954
|
for (let i = 0; i < nodes.length; i += 1) {
|
|
5955
5955
|
const node = nodes[i];
|
|
5956
5956
|
|
|
5957
5957
|
if (node === EMPTY) continue;
|
|
5958
5958
|
|
|
5959
5959
|
if (Array.isArray(node)) {
|
|
5960
|
-
flatten(node, target);
|
|
5960
|
+
flatten$1(node, target);
|
|
5961
5961
|
continue;
|
|
5962
5962
|
}
|
|
5963
5963
|
|
|
@@ -6076,7 +6076,7 @@ const inject = (raw, node, values, comments) => {
|
|
|
6076
6076
|
}
|
|
6077
6077
|
|
|
6078
6078
|
if (node.type === 'ArrayExpression' || node.type === 'ArrayPattern') {
|
|
6079
|
-
node.elements = flatten(node.elements, []);
|
|
6079
|
+
node.elements = flatten$1(node.elements, []);
|
|
6080
6080
|
}
|
|
6081
6081
|
|
|
6082
6082
|
if (
|
|
@@ -6084,18 +6084,18 @@ const inject = (raw, node, values, comments) => {
|
|
|
6084
6084
|
node.type === 'FunctionDeclaration' ||
|
|
6085
6085
|
node.type === 'ArrowFunctionExpression'
|
|
6086
6086
|
) {
|
|
6087
|
-
node.params = flatten(node.params, []);
|
|
6087
|
+
node.params = flatten$1(node.params, []);
|
|
6088
6088
|
}
|
|
6089
6089
|
|
|
6090
6090
|
if (node.type === 'CallExpression' || node.type === 'NewExpression') {
|
|
6091
|
-
node.arguments = flatten(node.arguments, []);
|
|
6091
|
+
node.arguments = flatten$1(node.arguments, []);
|
|
6092
6092
|
}
|
|
6093
6093
|
|
|
6094
6094
|
if (
|
|
6095
6095
|
node.type === 'ImportDeclaration' ||
|
|
6096
6096
|
node.type === 'ExportNamedDeclaration'
|
|
6097
6097
|
) {
|
|
6098
|
-
node.specifiers = flatten(node.specifiers, []);
|
|
6098
|
+
node.specifiers = flatten$1(node.specifiers, []);
|
|
6099
6099
|
}
|
|
6100
6100
|
|
|
6101
6101
|
if (node.type === 'ForStatement') {
|
|
@@ -13813,7 +13813,7 @@ const meta_tags = new Map([
|
|
|
13813
13813
|
['svelte:window', 'Window'],
|
|
13814
13814
|
['svelte:body', 'Body']
|
|
13815
13815
|
]);
|
|
13816
|
-
Array.from(meta_tags.keys()).concat('svelte:self', 'svelte:component', 'svelte:fragment');
|
|
13816
|
+
Array.from(meta_tags.keys()).concat('svelte:self', 'svelte:component', 'svelte:fragment', 'svelte:element');
|
|
13817
13817
|
|
|
13818
13818
|
function getLocator(source, options) {
|
|
13819
13819
|
if (options === void 0) { options = {}; }
|
|
@@ -13850,6 +13850,19 @@ function getLocator(source, options) {
|
|
|
13850
13850
|
return locate;
|
|
13851
13851
|
}
|
|
13852
13852
|
|
|
13853
|
+
/**
|
|
13854
|
+
* Pushes all `items` into `array` using `push`, therefore mutating the array.
|
|
13855
|
+
* We do this for memory and perf reasons, and because `array.push(...items)` would
|
|
13856
|
+
* run into a "max call stack size exceeded" error with too many items (~65k).
|
|
13857
|
+
* @param array
|
|
13858
|
+
* @param items
|
|
13859
|
+
*/
|
|
13860
|
+
function push_array$1(array, items) {
|
|
13861
|
+
for (let i = 0; i < items.length; i++) {
|
|
13862
|
+
array.push(items[i]);
|
|
13863
|
+
}
|
|
13864
|
+
}
|
|
13865
|
+
|
|
13853
13866
|
x `true`;
|
|
13854
13867
|
x `false`;
|
|
13855
13868
|
|
|
@@ -14744,13 +14757,6 @@ function merge_tables(this_table, other_table) {
|
|
|
14744
14757
|
}
|
|
14745
14758
|
return [new_table, idx_map, val_changed, idx_changed];
|
|
14746
14759
|
}
|
|
14747
|
-
function pushArray(_this, other) {
|
|
14748
|
-
// We use push to mutate in place for memory and perf reasons
|
|
14749
|
-
// We use the for loop instead of _this.push(...other) to avoid the JS engine's function argument limit (65,535 in JavascriptCore)
|
|
14750
|
-
for (let i = 0; i < other.length; i++) {
|
|
14751
|
-
_this.push(other[i]);
|
|
14752
|
-
}
|
|
14753
|
-
}
|
|
14754
14760
|
class MappedCode {
|
|
14755
14761
|
constructor(string = '', map = null) {
|
|
14756
14762
|
this.string = string;
|
|
@@ -14838,9 +14844,9 @@ class MappedCode {
|
|
|
14838
14844
|
}
|
|
14839
14845
|
}
|
|
14840
14846
|
// combine last line + first line
|
|
14841
|
-
|
|
14847
|
+
push_array$1(m1.mappings[m1.mappings.length - 1], m2.mappings.shift());
|
|
14842
14848
|
// append other lines
|
|
14843
|
-
|
|
14849
|
+
push_array$1(m1.mappings, m2.mappings);
|
|
14844
14850
|
return this;
|
|
14845
14851
|
}
|
|
14846
14852
|
static from_processed(string, map) {
|
package/dist/chunks/sync.js
CHANGED
|
@@ -193,118 +193,120 @@ function create_manifest_data({
|
|
|
193
193
|
const routes_base = posixify(path__default.relative(cwd, config.kit.files.routes));
|
|
194
194
|
const valid_extensions = [...config.extensions, ...config.kit.endpointExtensions];
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
if (fs__default.existsSync(config.kit.files.routes)) {
|
|
197
|
+
list_files(config.kit.files.routes).forEach((file) => {
|
|
198
|
+
const extension = valid_extensions.find((ext) => file.endsWith(ext));
|
|
199
|
+
if (!extension) return;
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
const id = file
|
|
202
|
+
.slice(0, -extension.length)
|
|
203
|
+
.replace(/(?:^|\/)index((?:@[a-zA-Z0-9_-]+)?(?:\.[a-z]+)?)?$/, '$1');
|
|
204
|
+
const project_relative = `${routes_base}/${file}`;
|
|
204
205
|
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
const segments = id.split('/');
|
|
207
|
+
const name = /** @type {string} */ (segments.pop());
|
|
207
208
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
if (name === '__layout.reset') {
|
|
210
|
+
throw new Error(
|
|
211
|
+
'__layout.reset has been removed in favour of named layouts: https://kit.svelte.dev/docs/layouts#named-layouts'
|
|
212
|
+
);
|
|
213
|
+
}
|
|
213
214
|
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
if (name === '__error' || layout_pattern.test(name)) {
|
|
216
|
+
const dir = segments.join('/');
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
218
|
+
if (!tree.has(dir)) {
|
|
219
|
+
tree.set(dir, {
|
|
220
|
+
error: undefined,
|
|
221
|
+
layouts: {}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
223
224
|
|
|
224
|
-
|
|
225
|
+
const group = /** @type {Node} */ (tree.get(dir));
|
|
225
226
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
if (name === '__error') {
|
|
228
|
+
group.error = project_relative;
|
|
229
|
+
} else {
|
|
230
|
+
const match = /** @type {RegExpMatchArray} */ (layout_pattern.exec(name));
|
|
230
231
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
if (match[1] === DEFAULT) {
|
|
233
|
+
throw new Error(`${project_relative} cannot use reserved "${DEFAULT}" name`);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const layout_id = match[1] || DEFAULT;
|
|
234
237
|
|
|
235
|
-
|
|
238
|
+
const defined = group.layouts[layout_id];
|
|
239
|
+
if (defined && defined !== default_layout) {
|
|
240
|
+
throw new Error(
|
|
241
|
+
`Duplicate layout ${project_relative} already defined at ${defined.file}`
|
|
242
|
+
);
|
|
243
|
+
}
|
|
236
244
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
);
|
|
245
|
+
group.layouts[layout_id] = {
|
|
246
|
+
file: project_relative,
|
|
247
|
+
name
|
|
248
|
+
};
|
|
242
249
|
}
|
|
243
250
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
return;
|
|
252
|
+
} else if (dunder_pattern.test(file)) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
`Files and directories prefixed with __ are reserved (saw ${project_relative})`
|
|
255
|
+
);
|
|
248
256
|
}
|
|
249
257
|
|
|
250
|
-
return;
|
|
251
|
-
} else if (dunder_pattern.test(file)) {
|
|
252
|
-
throw new Error(
|
|
253
|
-
`Files and directories prefixed with __ are reserved (saw ${project_relative})`
|
|
254
|
-
);
|
|
255
|
-
}
|
|
258
|
+
if (!config.kit.routes(file)) return;
|
|
256
259
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
throw new Error(`Invalid route ${project_relative} — parameters must be separated`);
|
|
261
|
-
}
|
|
260
|
+
if (/\]\[/.test(id)) {
|
|
261
|
+
throw new Error(`Invalid route ${project_relative} — parameters must be separated`);
|
|
262
|
+
}
|
|
262
263
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
if (count_occurrences('[', id) !== count_occurrences(']', id)) {
|
|
265
|
+
throw new Error(`Invalid route ${project_relative} — brackets are unbalanced`);
|
|
266
|
+
}
|
|
266
267
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
268
|
+
if (!units.has(id)) {
|
|
269
|
+
units.set(id, {
|
|
270
|
+
id,
|
|
271
|
+
pattern: parse_route_id(id).pattern,
|
|
272
|
+
segments: id
|
|
273
|
+
.split('/')
|
|
274
|
+
.filter(Boolean)
|
|
275
|
+
.map((segment) => {
|
|
276
|
+
/** @type {Part[]} */
|
|
277
|
+
const parts = [];
|
|
278
|
+
segment.split(/\[(.+?)\]/).map((content, i) => {
|
|
279
|
+
const dynamic = !!(i % 2);
|
|
280
|
+
|
|
281
|
+
if (!content) return;
|
|
282
|
+
|
|
283
|
+
parts.push({
|
|
284
|
+
content,
|
|
285
|
+
dynamic,
|
|
286
|
+
rest: dynamic && content.startsWith('...'),
|
|
287
|
+
type: (dynamic && content.split('=')[1]) || null
|
|
288
|
+
});
|
|
287
289
|
});
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
}
|
|
290
|
+
return parts;
|
|
291
|
+
}),
|
|
292
|
+
page: undefined,
|
|
293
|
+
endpoint: undefined
|
|
294
|
+
});
|
|
295
|
+
}
|
|
295
296
|
|
|
296
|
-
|
|
297
|
+
const unit = /** @type {Unit} */ (units.get(id));
|
|
297
298
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
299
|
+
if (config.extensions.find((ext) => file.endsWith(ext))) {
|
|
300
|
+
const { layouts, errors } = trace(project_relative, file, tree, config.extensions);
|
|
301
|
+
unit.page = {
|
|
302
|
+
a: layouts.concat(project_relative),
|
|
303
|
+
b: errors
|
|
304
|
+
};
|
|
305
|
+
} else {
|
|
306
|
+
unit.endpoint = project_relative;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
308
310
|
|
|
309
311
|
/** @type {string[]} */
|
|
310
312
|
const components = [];
|
|
@@ -533,8 +535,8 @@ function count_occurrences(needle, haystack) {
|
|
|
533
535
|
* @param {string[]} [files]
|
|
534
536
|
*/
|
|
535
537
|
function list_files(dir, path = '', files = []) {
|
|
536
|
-
fs__default.readdirSync(dir
|
|
537
|
-
.sort((
|
|
538
|
+
fs__default.readdirSync(dir)
|
|
539
|
+
.sort((a, b) => {
|
|
538
540
|
// sort each directory in (__layout, __error, everything else) order
|
|
539
541
|
// so that we can trace layouts/errors immediately
|
|
540
542
|
|
|
@@ -551,10 +553,12 @@ function list_files(dir, path = '', files = []) {
|
|
|
551
553
|
return a < b ? -1 : 1;
|
|
552
554
|
})
|
|
553
555
|
.forEach((file) => {
|
|
554
|
-
const
|
|
556
|
+
const full = `${dir}/${file}`;
|
|
557
|
+
const stats = fs__default.statSync(full);
|
|
558
|
+
const joined = path ? `${path}/${file}` : file;
|
|
555
559
|
|
|
556
|
-
if (
|
|
557
|
-
list_files(
|
|
560
|
+
if (stats.isDirectory()) {
|
|
561
|
+
list_files(full, joined, files);
|
|
558
562
|
} else {
|
|
559
563
|
files.push(joined);
|
|
560
564
|
}
|
|
@@ -55,6 +55,19 @@ function write_tsconfig(config, cwd = process.cwd()) {
|
|
|
55
55
|
include.push(config_relative(`${dir}/**/*.svelte`));
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
/** @type {Record<string, string[]>} */
|
|
59
|
+
const paths = {};
|
|
60
|
+
const alias = {
|
|
61
|
+
$lib: project_relative(config.kit.files.lib),
|
|
62
|
+
...config.kit.alias
|
|
63
|
+
};
|
|
64
|
+
for (const [key, value] of Object.entries(alias)) {
|
|
65
|
+
if (fs__default.existsSync(project_relative(value))) {
|
|
66
|
+
paths[key] = [project_relative(value)];
|
|
67
|
+
paths[key + '/*'] = [project_relative(value) + '/*'];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
58
71
|
write_if_changed(
|
|
59
72
|
out,
|
|
60
73
|
JSON.stringify(
|
|
@@ -62,12 +75,7 @@ function write_tsconfig(config, cwd = process.cwd()) {
|
|
|
62
75
|
compilerOptions: {
|
|
63
76
|
// generated options
|
|
64
77
|
baseUrl: config_relative('.'),
|
|
65
|
-
paths
|
|
66
|
-
? {
|
|
67
|
-
$lib: [project_relative(config.kit.files.lib)],
|
|
68
|
-
'$lib/*': [project_relative(config.kit.files.lib + '/*')]
|
|
69
|
-
}
|
|
70
|
-
: {},
|
|
78
|
+
paths,
|
|
71
79
|
rootDirs: [config_relative('.'), './types'],
|
|
72
80
|
|
|
73
81
|
// essential options
|
package/dist/cli.js
CHANGED
|
@@ -290,12 +290,20 @@ function get_mime_lookup(manifest_data) {
|
|
|
290
290
|
|
|
291
291
|
/** @param {import('types').ValidatedConfig} config */
|
|
292
292
|
function get_aliases(config) {
|
|
293
|
+
/** @type {Record<string, string>} */
|
|
293
294
|
const alias = {
|
|
294
295
|
__GENERATED__: path__default.posix.join(config.kit.outDir, 'generated'),
|
|
295
296
|
$app: `${get_runtime_path(config)}/app`,
|
|
297
|
+
|
|
298
|
+
// For now, we handle `$lib` specially here rather than make it a default value for
|
|
299
|
+
// `config.kit.alias` since it has special meaning for packaging, etc.
|
|
296
300
|
$lib: config.kit.files.lib
|
|
297
301
|
};
|
|
298
302
|
|
|
303
|
+
for (const [key, value] of Object.entries(config.kit.alias)) {
|
|
304
|
+
alias[key] = path__default.resolve(value);
|
|
305
|
+
}
|
|
306
|
+
|
|
299
307
|
return alias;
|
|
300
308
|
}
|
|
301
309
|
|
|
@@ -338,6 +346,18 @@ const options = object(
|
|
|
338
346
|
return input;
|
|
339
347
|
}),
|
|
340
348
|
|
|
349
|
+
alias: validate({}, (input, keypath) => {
|
|
350
|
+
if (typeof input !== 'object') {
|
|
351
|
+
throw new Error(`${keypath} should be an object`);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
for (const key in input) {
|
|
355
|
+
assert_string(input[key], `${keypath}.${key}`);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return input;
|
|
359
|
+
}),
|
|
360
|
+
|
|
341
361
|
// TODO: remove this for the 1.0 release
|
|
342
362
|
amp: error(
|
|
343
363
|
(keypath) =>
|
|
@@ -765,7 +785,16 @@ function load_template(cwd, config) {
|
|
|
765
785
|
|
|
766
786
|
if (fs__default.existsSync(template)) {
|
|
767
787
|
const contents = fs__default.readFileSync(template, 'utf8');
|
|
768
|
-
|
|
788
|
+
|
|
789
|
+
// TODO remove this for 1.0
|
|
790
|
+
const match = /%svelte\.([a-z]+)%/.exec(contents);
|
|
791
|
+
if (match) {
|
|
792
|
+
throw new Error(
|
|
793
|
+
`%svelte.${match[1]}% in ${relative} should be replaced with %sveltekit.${match[1]}%`
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
const expected_tags = ['%sveltekit.head%', '%sveltekit.body%'];
|
|
769
798
|
expected_tags.forEach((tag) => {
|
|
770
799
|
if (contents.indexOf(tag) === -1) {
|
|
771
800
|
throw new Error(`${relative} is missing ${tag}`);
|
|
@@ -875,7 +904,7 @@ async function launch(port, https, base) {
|
|
|
875
904
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
|
|
876
905
|
}
|
|
877
906
|
|
|
878
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
907
|
+
const prog = sade('svelte-kit').version('1.0.0-next.340');
|
|
879
908
|
|
|
880
909
|
prog
|
|
881
910
|
.command('dev')
|
|
@@ -1097,7 +1126,7 @@ async function check_port(port) {
|
|
|
1097
1126
|
function welcome({ port, host, https, open, base, loose, allow, cwd }) {
|
|
1098
1127
|
if (open) launch(port, https, base);
|
|
1099
1128
|
|
|
1100
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1129
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.340'}\n`));
|
|
1101
1130
|
|
|
1102
1131
|
const protocol = https ? 'https:' : 'http:';
|
|
1103
1132
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/kit",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.340",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -16,36 +16,21 @@
|
|
|
16
16
|
"vite": "^2.9.9"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@playwright/test": "^1.21.0",
|
|
20
|
-
"@rollup/plugin-replace": "^4.0.0",
|
|
21
19
|
"@types/connect": "^3.4.35",
|
|
22
20
|
"@types/cookie": "^0.5.0",
|
|
23
21
|
"@types/marked": "^4.0.1",
|
|
24
22
|
"@types/mime": "^2.0.3",
|
|
25
|
-
"@types/node": "^16.11.11",
|
|
26
23
|
"@types/sade": "^1.7.3",
|
|
27
24
|
"@types/set-cookie-parser": "^2.4.2",
|
|
28
25
|
"cookie": "^0.5.0",
|
|
29
|
-
"cross-env": "^7.0.3",
|
|
30
26
|
"devalue": "^2.0.1",
|
|
31
|
-
"eslint": "^8.3.0",
|
|
32
27
|
"kleur": "^4.1.4",
|
|
33
28
|
"locate-character": "^2.0.5",
|
|
34
|
-
"marked": "^4.0.5",
|
|
35
29
|
"mime": "^3.0.0",
|
|
36
30
|
"node-fetch": "^3.1.0",
|
|
37
|
-
"port-authority": "^1.1.2",
|
|
38
|
-
"rollup": "^2.60.2",
|
|
39
31
|
"selfsigned": "^2.0.0",
|
|
40
32
|
"set-cookie-parser": "^2.4.8",
|
|
41
|
-
"
|
|
42
|
-
"svelte": "^3.44.2",
|
|
43
|
-
"svelte-check": "^2.5.0",
|
|
44
|
-
"svelte-preprocess": "^4.9.8",
|
|
45
|
-
"svelte2tsx": "~0.5.0",
|
|
46
|
-
"tiny-glob": "^0.2.9",
|
|
47
|
-
"typescript": "^4.6.4",
|
|
48
|
-
"uvu": "^0.5.2"
|
|
33
|
+
"svelte": "^3.48.0"
|
|
49
34
|
},
|
|
50
35
|
"peerDependencies": {
|
|
51
36
|
"svelte": "^3.44.0"
|
package/types/ambient.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ declare module '$app/env' {
|
|
|
88
88
|
*/
|
|
89
89
|
declare module '$app/navigation' {
|
|
90
90
|
/**
|
|
91
|
-
* If called when the page is being updated following a navigation (in `onMount` or an action, for example), this disables SvelteKit's built-in scroll handling.
|
|
91
|
+
* If called when the page is being updated following a navigation (in `onMount` or `afterNavigate` or an action, for example), this disables SvelteKit's built-in scroll handling.
|
|
92
92
|
* This is generally discouraged, since it breaks user expectations.
|
|
93
93
|
*/
|
|
94
94
|
export function disableScrollHandling(): void;
|
package/types/index.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export interface Config {
|
|
|
93
93
|
extensions?: string[];
|
|
94
94
|
kit?: {
|
|
95
95
|
adapter?: Adapter;
|
|
96
|
+
alias?: Record<string, string>;
|
|
96
97
|
appDir?: string;
|
|
97
98
|
browser?: {
|
|
98
99
|
hydrate?: boolean;
|
|
@@ -172,7 +173,7 @@ export interface HandleError {
|
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
/**
|
|
175
|
-
* The `(
|
|
176
|
+
* The `(event: LoadEvent) => LoadOutput` `load` function exported from `<script context="module">` in a page or layout.
|
|
176
177
|
*
|
|
177
178
|
* Note that you can use [generated types](/docs/types#generated-types) instead of manually specifying the Params generic argument.
|
|
178
179
|
*/
|
|
@@ -181,10 +182,10 @@ export interface Load<
|
|
|
181
182
|
InputProps extends Record<string, any> = Record<string, any>,
|
|
182
183
|
OutputProps extends Record<string, any> = InputProps
|
|
183
184
|
> {
|
|
184
|
-
(
|
|
185
|
+
(event: LoadEvent<Params, InputProps>): MaybePromise<LoadOutput<OutputProps>>;
|
|
185
186
|
}
|
|
186
187
|
|
|
187
|
-
export interface
|
|
188
|
+
export interface LoadEvent<
|
|
188
189
|
Params extends Record<string, string> = Record<string, string>,
|
|
189
190
|
Props extends Record<string, any> = Record<string, any>
|
|
190
191
|
> {
|
package/types/internal.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export class InternalServer extends Server {
|
|
|
94
94
|
respond(
|
|
95
95
|
request: Request,
|
|
96
96
|
options: RequestOptions & {
|
|
97
|
-
|
|
97
|
+
prerendering?: PrerenderOptions;
|
|
98
98
|
}
|
|
99
99
|
): Promise<Response>;
|
|
100
100
|
}
|
|
@@ -147,7 +147,6 @@ export interface PrerenderDependency {
|
|
|
147
147
|
|
|
148
148
|
export interface PrerenderOptions {
|
|
149
149
|
fallback?: boolean;
|
|
150
|
-
default: boolean;
|
|
151
150
|
dependencies: Map<string, PrerenderDependency>;
|
|
152
151
|
}
|
|
153
152
|
|
|
@@ -254,7 +253,10 @@ export interface SSROptions {
|
|
|
254
253
|
assets: string;
|
|
255
254
|
};
|
|
256
255
|
prefix: string;
|
|
257
|
-
prerender:
|
|
256
|
+
prerender: {
|
|
257
|
+
default: boolean;
|
|
258
|
+
enabled: boolean;
|
|
259
|
+
};
|
|
258
260
|
read(file: string): Buffer;
|
|
259
261
|
root: SSRComponent['default'];
|
|
260
262
|
router: boolean;
|
|
@@ -308,7 +310,7 @@ export interface SSRState {
|
|
|
308
310
|
getClientAddress: () => string;
|
|
309
311
|
initiator?: SSRPage | null;
|
|
310
312
|
platform?: any;
|
|
311
|
-
|
|
313
|
+
prerendering?: PrerenderOptions;
|
|
312
314
|
}
|
|
313
315
|
|
|
314
316
|
export type StrictBody = string | Uint8Array;
|