@sveltejs/kit 1.0.0-next.306 → 1.0.0-next.307
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 +1 -1
- package/assets/server/index.js +40 -32
- package/dist/chunks/misc.js +1 -1
- package/dist/chunks/sync.js +3 -1
- package/dist/cli.js +2 -3
- package/package.json +1 -1
- package/types/index.d.ts +3 -3
package/assets/client/start.js
CHANGED
|
@@ -269,7 +269,7 @@ function parse_route_id(id) {
|
|
|
269
269
|
? /^\/$/
|
|
270
270
|
: new RegExp(
|
|
271
271
|
`^${decodeURIComponent(id)
|
|
272
|
-
.split(/(?:@
|
|
272
|
+
.split(/(?:@[a-zA-Z0-9_-]+)?(?:\/|$)/)
|
|
273
273
|
.map((segment, i, segments) => {
|
|
274
274
|
// special case — /[...rest]/ could contain zero segments
|
|
275
275
|
const match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
package/assets/server/index.js
CHANGED
|
@@ -2081,38 +2081,46 @@ async function respond_with_error({
|
|
|
2081
2081
|
resolve_opts
|
|
2082
2082
|
}) {
|
|
2083
2083
|
try {
|
|
2084
|
-
const
|
|
2085
|
-
|
|
2084
|
+
const branch = [];
|
|
2085
|
+
let stuff = {};
|
|
2086
|
+
|
|
2087
|
+
if (resolve_opts.ssr) {
|
|
2088
|
+
const default_layout = await options.manifest._.nodes[0](); // 0 is always the root layout
|
|
2089
|
+
const default_error = await options.manifest._.nodes[1](); // 1 is always the root error
|
|
2090
|
+
|
|
2091
|
+
const layout_loaded = /** @type {Loaded} */ (
|
|
2092
|
+
await load_node({
|
|
2093
|
+
event,
|
|
2094
|
+
options,
|
|
2095
|
+
state,
|
|
2096
|
+
route: null,
|
|
2097
|
+
node: default_layout,
|
|
2098
|
+
$session,
|
|
2099
|
+
stuff: {},
|
|
2100
|
+
is_error: false,
|
|
2101
|
+
is_leaf: false
|
|
2102
|
+
})
|
|
2103
|
+
);
|
|
2086
2104
|
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2105
|
+
const error_loaded = /** @type {Loaded} */ (
|
|
2106
|
+
await load_node({
|
|
2107
|
+
event,
|
|
2108
|
+
options,
|
|
2109
|
+
state,
|
|
2110
|
+
route: null,
|
|
2111
|
+
node: default_error,
|
|
2112
|
+
$session,
|
|
2113
|
+
stuff: layout_loaded ? layout_loaded.stuff : {},
|
|
2114
|
+
is_error: true,
|
|
2115
|
+
is_leaf: false,
|
|
2116
|
+
status,
|
|
2117
|
+
error
|
|
2118
|
+
})
|
|
2119
|
+
);
|
|
2100
2120
|
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
options,
|
|
2105
|
-
state,
|
|
2106
|
-
route: null,
|
|
2107
|
-
node: default_error,
|
|
2108
|
-
$session,
|
|
2109
|
-
stuff: layout_loaded ? layout_loaded.stuff : {},
|
|
2110
|
-
is_error: true,
|
|
2111
|
-
is_leaf: false,
|
|
2112
|
-
status,
|
|
2113
|
-
error
|
|
2114
|
-
})
|
|
2115
|
-
);
|
|
2121
|
+
branch.push(layout_loaded, error_loaded);
|
|
2122
|
+
stuff = error_loaded.stuff;
|
|
2123
|
+
}
|
|
2116
2124
|
|
|
2117
2125
|
return await render_response({
|
|
2118
2126
|
options,
|
|
@@ -2122,10 +2130,10 @@ async function respond_with_error({
|
|
|
2122
2130
|
hydrate: options.hydrate,
|
|
2123
2131
|
router: options.router
|
|
2124
2132
|
},
|
|
2125
|
-
stuff
|
|
2133
|
+
stuff,
|
|
2126
2134
|
status,
|
|
2127
2135
|
error,
|
|
2128
|
-
branch
|
|
2136
|
+
branch,
|
|
2129
2137
|
event,
|
|
2130
2138
|
resolve_opts
|
|
2131
2139
|
});
|
package/dist/chunks/misc.js
CHANGED
|
@@ -17,7 +17,7 @@ function parse_route_id(id) {
|
|
|
17
17
|
? /^\/$/
|
|
18
18
|
: new RegExp(
|
|
19
19
|
`^${decodeURIComponent(id)
|
|
20
|
-
.split(/(?:@
|
|
20
|
+
.split(/(?:@[a-zA-Z0-9_-]+)?(?:\/|$)/)
|
|
21
21
|
.map((segment, i, segments) => {
|
|
22
22
|
// special case — /[...rest]/ could contain zero segments
|
|
23
23
|
const match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
package/dist/chunks/sync.js
CHANGED
|
@@ -195,7 +195,9 @@ function create_manifest_data({
|
|
|
195
195
|
const extension = valid_extensions.find((ext) => file.endsWith(ext));
|
|
196
196
|
if (!extension) return;
|
|
197
197
|
|
|
198
|
-
const id = file
|
|
198
|
+
const id = file
|
|
199
|
+
.slice(0, -extension.length)
|
|
200
|
+
.replace(/(?:^|\/)index((?:@[a-zA-Z0-9_-]+)?(?:\.[a-z]+)?)?$/, '$1');
|
|
199
201
|
const project_relative = `${routes_base}/${file}`;
|
|
200
202
|
|
|
201
203
|
const segments = id.split('/');
|
package/dist/cli.js
CHANGED
|
@@ -870,7 +870,7 @@ async function launch(port, https, base) {
|
|
|
870
870
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
873
|
+
const prog = sade('svelte-kit').version('1.0.0-next.307');
|
|
874
874
|
|
|
875
875
|
prog
|
|
876
876
|
.command('dev')
|
|
@@ -981,7 +981,6 @@ prog
|
|
|
981
981
|
prog
|
|
982
982
|
.command('package')
|
|
983
983
|
.describe('Create a package')
|
|
984
|
-
.option('-d, --dir', 'Destination directory', 'package')
|
|
985
984
|
.action(async () => {
|
|
986
985
|
try {
|
|
987
986
|
const config = await load_config();
|
|
@@ -1050,7 +1049,7 @@ async function check_port(port) {
|
|
|
1050
1049
|
function welcome({ port, host, https, open, base, loose, allow, cwd }) {
|
|
1051
1050
|
if (open) launch(port, https, base);
|
|
1052
1051
|
|
|
1053
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1052
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.307'}\n`));
|
|
1054
1053
|
|
|
1055
1054
|
const protocol = https ? 'https:' : 'http:';
|
|
1056
1055
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -223,14 +223,14 @@ export interface RequestHandler<
|
|
|
223
223
|
Params extends Record<string, string> = Record<string, string>,
|
|
224
224
|
Output extends ResponseBody = ResponseBody
|
|
225
225
|
> {
|
|
226
|
-
(event: RequestEvent<Params>): RequestHandlerOutput<Output
|
|
226
|
+
(event: RequestEvent<Params>): MaybePromise<RequestHandlerOutput<Output>>;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
export
|
|
229
|
+
export interface RequestHandlerOutput<Output extends ResponseBody = ResponseBody> {
|
|
230
230
|
status?: number;
|
|
231
231
|
headers?: Headers | Partial<ResponseHeaders>;
|
|
232
232
|
body?: Output;
|
|
233
|
-
}
|
|
233
|
+
}
|
|
234
234
|
|
|
235
235
|
export type ResponseBody = JSONValue | Uint8Array | ReadableStream | import('stream').Readable;
|
|
236
236
|
|