@sveltejs/kit 1.0.0-next.218 → 1.0.0-next.219
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/kit.js +56 -42
- package/dist/chunks/index6.js +14 -14
- package/dist/cli.js +2 -2
- package/dist/ssr.js +56 -42
- package/package.json +2 -2
package/assets/kit.js
CHANGED
|
@@ -1222,53 +1222,53 @@ async function load_node({
|
|
|
1222
1222
|
* }} opts
|
|
1223
1223
|
*/
|
|
1224
1224
|
async function respond_with_error({ request, options, state, $session, status, error }) {
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
/** @type {Record<string, string>} */
|
|
1229
|
-
const params = {}; // error page has no params
|
|
1225
|
+
try {
|
|
1226
|
+
const default_layout = await options.manifest._.nodes[0](); // 0 is always the root layout
|
|
1227
|
+
const default_error = await options.manifest._.nodes[1](); // 1 is always the root error
|
|
1230
1228
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
await load_node({
|
|
1234
|
-
request,
|
|
1235
|
-
options,
|
|
1236
|
-
state,
|
|
1237
|
-
route: null,
|
|
1238
|
-
url: request.url, // TODO this is redundant, no?
|
|
1239
|
-
params,
|
|
1240
|
-
node: default_layout,
|
|
1241
|
-
$session,
|
|
1242
|
-
stuff: {},
|
|
1243
|
-
prerender_enabled: is_prerender_enabled(options, default_error, state),
|
|
1244
|
-
is_leaf: false,
|
|
1245
|
-
is_error: false
|
|
1246
|
-
})
|
|
1247
|
-
);
|
|
1229
|
+
/** @type {Record<string, string>} */
|
|
1230
|
+
const params = {}; // error page has no params
|
|
1248
1231
|
|
|
1249
|
-
|
|
1250
|
-
loaded
|
|
1251
|
-
/** @type {Loaded} */ (
|
|
1232
|
+
// error pages don't fall through, so we know it's not undefined
|
|
1233
|
+
const loaded = /** @type {Loaded} */ (
|
|
1252
1234
|
await load_node({
|
|
1253
1235
|
request,
|
|
1254
1236
|
options,
|
|
1255
1237
|
state,
|
|
1256
1238
|
route: null,
|
|
1257
|
-
url: request.url,
|
|
1239
|
+
url: request.url, // TODO this is redundant, no?
|
|
1258
1240
|
params,
|
|
1259
|
-
node:
|
|
1241
|
+
node: default_layout,
|
|
1260
1242
|
$session,
|
|
1261
|
-
stuff:
|
|
1243
|
+
stuff: {},
|
|
1262
1244
|
prerender_enabled: is_prerender_enabled(options, default_error, state),
|
|
1263
1245
|
is_leaf: false,
|
|
1264
|
-
is_error:
|
|
1265
|
-
status,
|
|
1266
|
-
error
|
|
1246
|
+
is_error: false
|
|
1267
1247
|
})
|
|
1268
|
-
)
|
|
1269
|
-
|
|
1248
|
+
);
|
|
1249
|
+
|
|
1250
|
+
const branch = [
|
|
1251
|
+
loaded,
|
|
1252
|
+
/** @type {Loaded} */ (
|
|
1253
|
+
await load_node({
|
|
1254
|
+
request,
|
|
1255
|
+
options,
|
|
1256
|
+
state,
|
|
1257
|
+
route: null,
|
|
1258
|
+
url: request.url,
|
|
1259
|
+
params,
|
|
1260
|
+
node: default_error,
|
|
1261
|
+
$session,
|
|
1262
|
+
stuff: loaded ? loaded.stuff : {},
|
|
1263
|
+
prerender_enabled: is_prerender_enabled(options, default_error, state),
|
|
1264
|
+
is_leaf: false,
|
|
1265
|
+
is_error: true,
|
|
1266
|
+
status,
|
|
1267
|
+
error
|
|
1268
|
+
})
|
|
1269
|
+
)
|
|
1270
|
+
];
|
|
1270
1271
|
|
|
1271
|
-
try {
|
|
1272
1272
|
return await render_response({
|
|
1273
1273
|
options,
|
|
1274
1274
|
$session,
|
|
@@ -1905,16 +1905,30 @@ async function respond(incoming, options, state = {}) {
|
|
|
1905
1905
|
}
|
|
1906
1906
|
}
|
|
1907
1907
|
});
|
|
1908
|
-
} catch (/** @type {unknown} */
|
|
1909
|
-
const
|
|
1908
|
+
} catch (/** @type {unknown} */ e) {
|
|
1909
|
+
const error = coalesce_to_error(e);
|
|
1910
|
+
|
|
1911
|
+
options.handle_error(error, request);
|
|
1910
1912
|
|
|
1911
|
-
|
|
1913
|
+
try {
|
|
1914
|
+
const $session = await options.hooks.getSession(request);
|
|
1915
|
+
return await respond_with_error({
|
|
1916
|
+
request,
|
|
1917
|
+
options,
|
|
1918
|
+
state,
|
|
1919
|
+
$session,
|
|
1920
|
+
status: 500,
|
|
1921
|
+
error
|
|
1922
|
+
});
|
|
1923
|
+
} catch (/** @type {unknown} */ e) {
|
|
1924
|
+
const error = coalesce_to_error(e);
|
|
1912
1925
|
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1926
|
+
return {
|
|
1927
|
+
status: 500,
|
|
1928
|
+
headers: {},
|
|
1929
|
+
body: options.dev ? error.stack : error.message
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1918
1932
|
}
|
|
1919
1933
|
}
|
|
1920
1934
|
|
package/dist/chunks/index6.js
CHANGED
|
@@ -16,6 +16,19 @@ import 'node:util';
|
|
|
16
16
|
import 'node:url';
|
|
17
17
|
import 'net';
|
|
18
18
|
|
|
19
|
+
function totalist(dir, callback, pre='') {
|
|
20
|
+
dir = resolve('.', dir);
|
|
21
|
+
let arr = readdirSync(dir);
|
|
22
|
+
let i=0, abs, stats;
|
|
23
|
+
for (; i < arr.length; i++) {
|
|
24
|
+
abs = join(dir, arr[i]);
|
|
25
|
+
stats = statSync(abs);
|
|
26
|
+
stats.isDirectory()
|
|
27
|
+
? totalist(abs, callback, join(pre, arr[i]))
|
|
28
|
+
: callback(join(pre, arr[i]), abs, stats);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
/**
|
|
20
33
|
* @typedef ParsedURL
|
|
21
34
|
* @type {import('.').ParsedURL}
|
|
@@ -55,19 +68,6 @@ function parse(req) {
|
|
|
55
68
|
return req._parsedUrl = { pathname, search, query, raw };
|
|
56
69
|
}
|
|
57
70
|
|
|
58
|
-
function list(dir, callback, pre='') {
|
|
59
|
-
dir = resolve('.', dir);
|
|
60
|
-
let arr = readdirSync(dir);
|
|
61
|
-
let i=0, abs, stats;
|
|
62
|
-
for (; i < arr.length; i++) {
|
|
63
|
-
abs = join(dir, arr[i]);
|
|
64
|
-
stats = statSync(abs);
|
|
65
|
-
stats.isDirectory()
|
|
66
|
-
? list(abs, callback, join(pre, arr[i]))
|
|
67
|
-
: callback(join(pre, arr[i]), abs, stats);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
71
|
const mimes = {
|
|
72
72
|
"ez": "application/andrew-inset",
|
|
73
73
|
"aw": "application/applixware",
|
|
@@ -625,7 +625,7 @@ function sirv (dir, opts={}) {
|
|
|
625
625
|
else if (cc && opts.maxAge === 0) cc += ',must-revalidate';
|
|
626
626
|
|
|
627
627
|
if (!opts.dev) {
|
|
628
|
-
|
|
628
|
+
totalist(dir, (name, abs, stats) => {
|
|
629
629
|
if (/\.well-known[\\+\/]/.test(name)) ; // keep
|
|
630
630
|
else if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name)) return;
|
|
631
631
|
|
package/dist/cli.js
CHANGED
|
@@ -846,7 +846,7 @@ async function launch(port, https) {
|
|
|
846
846
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
849
|
+
const prog = sade('svelte-kit').version('1.0.0-next.219');
|
|
850
850
|
|
|
851
851
|
prog
|
|
852
852
|
.command('dev')
|
|
@@ -998,7 +998,7 @@ async function check_port(port) {
|
|
|
998
998
|
function welcome({ port, host, https, open, loose, allow, cwd }) {
|
|
999
999
|
if (open) launch(port, https);
|
|
1000
1000
|
|
|
1001
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1001
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.219'}\n`));
|
|
1002
1002
|
|
|
1003
1003
|
const protocol = https ? 'https:' : 'http:';
|
|
1004
1004
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/dist/ssr.js
CHANGED
|
@@ -1152,53 +1152,53 @@ async function load_node({
|
|
|
1152
1152
|
* }} opts
|
|
1153
1153
|
*/
|
|
1154
1154
|
async function respond_with_error({ request, options, state, $session, status, error }) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
/** @type {Record<string, string>} */
|
|
1159
|
-
const params = {}; // error page has no params
|
|
1155
|
+
try {
|
|
1156
|
+
const default_layout = await options.manifest._.nodes[0](); // 0 is always the root layout
|
|
1157
|
+
const default_error = await options.manifest._.nodes[1](); // 1 is always the root error
|
|
1160
1158
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
await load_node({
|
|
1164
|
-
request,
|
|
1165
|
-
options,
|
|
1166
|
-
state,
|
|
1167
|
-
route: null,
|
|
1168
|
-
url: request.url, // TODO this is redundant, no?
|
|
1169
|
-
params,
|
|
1170
|
-
node: default_layout,
|
|
1171
|
-
$session,
|
|
1172
|
-
stuff: {},
|
|
1173
|
-
prerender_enabled: is_prerender_enabled(options, default_error, state),
|
|
1174
|
-
is_leaf: false,
|
|
1175
|
-
is_error: false
|
|
1176
|
-
})
|
|
1177
|
-
);
|
|
1159
|
+
/** @type {Record<string, string>} */
|
|
1160
|
+
const params = {}; // error page has no params
|
|
1178
1161
|
|
|
1179
|
-
|
|
1180
|
-
loaded
|
|
1181
|
-
/** @type {Loaded} */ (
|
|
1162
|
+
// error pages don't fall through, so we know it's not undefined
|
|
1163
|
+
const loaded = /** @type {Loaded} */ (
|
|
1182
1164
|
await load_node({
|
|
1183
1165
|
request,
|
|
1184
1166
|
options,
|
|
1185
1167
|
state,
|
|
1186
1168
|
route: null,
|
|
1187
|
-
url: request.url,
|
|
1169
|
+
url: request.url, // TODO this is redundant, no?
|
|
1188
1170
|
params,
|
|
1189
|
-
node:
|
|
1171
|
+
node: default_layout,
|
|
1190
1172
|
$session,
|
|
1191
|
-
stuff:
|
|
1173
|
+
stuff: {},
|
|
1192
1174
|
prerender_enabled: is_prerender_enabled(options, default_error, state),
|
|
1193
1175
|
is_leaf: false,
|
|
1194
|
-
is_error:
|
|
1195
|
-
status,
|
|
1196
|
-
error
|
|
1176
|
+
is_error: false
|
|
1197
1177
|
})
|
|
1198
|
-
)
|
|
1199
|
-
|
|
1178
|
+
);
|
|
1179
|
+
|
|
1180
|
+
const branch = [
|
|
1181
|
+
loaded,
|
|
1182
|
+
/** @type {Loaded} */ (
|
|
1183
|
+
await load_node({
|
|
1184
|
+
request,
|
|
1185
|
+
options,
|
|
1186
|
+
state,
|
|
1187
|
+
route: null,
|
|
1188
|
+
url: request.url,
|
|
1189
|
+
params,
|
|
1190
|
+
node: default_error,
|
|
1191
|
+
$session,
|
|
1192
|
+
stuff: loaded ? loaded.stuff : {},
|
|
1193
|
+
prerender_enabled: is_prerender_enabled(options, default_error, state),
|
|
1194
|
+
is_leaf: false,
|
|
1195
|
+
is_error: true,
|
|
1196
|
+
status,
|
|
1197
|
+
error
|
|
1198
|
+
})
|
|
1199
|
+
)
|
|
1200
|
+
];
|
|
1200
1201
|
|
|
1201
|
-
try {
|
|
1202
1202
|
return await render_response({
|
|
1203
1203
|
options,
|
|
1204
1204
|
$session,
|
|
@@ -1835,16 +1835,30 @@ async function respond(incoming, options, state = {}) {
|
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
});
|
|
1838
|
-
} catch (/** @type {unknown} */
|
|
1839
|
-
const
|
|
1838
|
+
} catch (/** @type {unknown} */ e) {
|
|
1839
|
+
const error = coalesce_to_error(e);
|
|
1840
|
+
|
|
1841
|
+
options.handle_error(error, request);
|
|
1840
1842
|
|
|
1841
|
-
|
|
1843
|
+
try {
|
|
1844
|
+
const $session = await options.hooks.getSession(request);
|
|
1845
|
+
return await respond_with_error({
|
|
1846
|
+
request,
|
|
1847
|
+
options,
|
|
1848
|
+
state,
|
|
1849
|
+
$session,
|
|
1850
|
+
status: 500,
|
|
1851
|
+
error
|
|
1852
|
+
});
|
|
1853
|
+
} catch (/** @type {unknown} */ e) {
|
|
1854
|
+
const error = coalesce_to_error(e);
|
|
1842
1855
|
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1856
|
+
return {
|
|
1857
|
+
status: 500,
|
|
1858
|
+
headers: {},
|
|
1859
|
+
body: options.dev ? error.stack : error.message
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1848
1862
|
}
|
|
1849
1863
|
}
|
|
1850
1864
|
|
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.219",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"port-authority": "^1.1.2",
|
|
37
37
|
"rollup": "^2.60.2",
|
|
38
38
|
"selfsigned": "^1.10.11",
|
|
39
|
-
"sirv": "^
|
|
39
|
+
"sirv": "^2.0.0",
|
|
40
40
|
"svelte": "^3.44.2",
|
|
41
41
|
"svelte-check": "^2.2.10",
|
|
42
42
|
"svelte-preprocess": "^4.9.8",
|