@sveltejs/kit 1.0.0-next.278 → 1.0.0-next.281
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 +12 -12
- package/assets/server/index.js +93 -98
- package/dist/chunks/amp_hook.js +1 -1
- package/dist/chunks/index.js +9 -9
- package/dist/chunks/index2.js +6 -6
- package/dist/chunks/index3.js +18 -18
- package/dist/chunks/index4.js +2 -2
- package/dist/chunks/index5.js +54 -59
- package/dist/chunks/index6.js +9 -9
- package/dist/chunks/index7.js +3 -3
- package/dist/cli.js +6 -6
- package/dist/hooks.js +4 -4
- package/dist/node.js +1 -1
- package/package.json +4 -3
- package/types/{ambient-modules.d.ts → ambient.d.ts} +0 -0
- package/types/index.d.ts +388 -21
- package/types/internal.d.ts +257 -145
- package/types/app.d.ts +0 -35
- package/types/config.d.ts +0 -200
- package/types/csp.d.ts +0 -115
- package/types/endpoint.d.ts +0 -39
- package/types/helper.d.ts +0 -23
- package/types/hooks.d.ts +0 -37
- package/types/page.d.ts +0 -33
package/dist/chunks/index3.js
CHANGED
|
@@ -16,8 +16,8 @@ import 'os';
|
|
|
16
16
|
* @param {{
|
|
17
17
|
* cwd: string;
|
|
18
18
|
* assets_base: string;
|
|
19
|
-
* config: import('types
|
|
20
|
-
* manifest_data: import('types
|
|
19
|
+
* config: import('types').ValidatedConfig
|
|
20
|
+
* manifest_data: import('types').ManifestData
|
|
21
21
|
* output_dir: string;
|
|
22
22
|
* service_worker_entry_file: string | null;
|
|
23
23
|
* }} options
|
|
@@ -135,8 +135,8 @@ function find_deps(file, manifest, js, css) {
|
|
|
135
135
|
* @param {{
|
|
136
136
|
* cwd: string;
|
|
137
137
|
* assets_base: string;
|
|
138
|
-
* config: import('types
|
|
139
|
-
* manifest_data: import('types
|
|
138
|
+
* config: import('types').ValidatedConfig
|
|
139
|
+
* manifest_data: import('types').ManifestData
|
|
140
140
|
* output_dir: string;
|
|
141
141
|
* client_entry_file: string;
|
|
142
142
|
* service_worker_entry_file: string | null;
|
|
@@ -256,13 +256,13 @@ async function build_client({
|
|
|
256
256
|
/**
|
|
257
257
|
* @param {{
|
|
258
258
|
* hooks: string;
|
|
259
|
-
* config: import('types
|
|
259
|
+
* config: import('types').ValidatedConfig;
|
|
260
260
|
* has_service_worker: boolean;
|
|
261
261
|
* template: string;
|
|
262
262
|
* }} opts
|
|
263
263
|
* @returns
|
|
264
264
|
*/
|
|
265
|
-
const
|
|
265
|
+
const server_template = ({ config, hooks, has_service_worker, template }) => `
|
|
266
266
|
import root from '__GENERATED__/root.svelte';
|
|
267
267
|
import { respond } from '${runtime}/server/index.js';
|
|
268
268
|
import { set_paths, assets, base } from '${runtime}/paths.js';
|
|
@@ -299,7 +299,7 @@ export function override(settings) {
|
|
|
299
299
|
read = settings.read;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
export class
|
|
302
|
+
export class Server {
|
|
303
303
|
constructor(manifest) {
|
|
304
304
|
const hooks = get_hooks(user_hooks);
|
|
305
305
|
|
|
@@ -339,7 +339,7 @@ export class App {
|
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
respond(request, options = {}) {
|
|
343
343
|
if (!(request instanceof Request)) {
|
|
344
344
|
throw new Error('The first argument to app.render must be a Request object. See https://github.com/sveltejs/kit/pull/3384 for details');
|
|
345
345
|
}
|
|
@@ -353,8 +353,8 @@ export class App {
|
|
|
353
353
|
* @param {{
|
|
354
354
|
* cwd: string;
|
|
355
355
|
* assets_base: string;
|
|
356
|
-
* config: import('types
|
|
357
|
-
* manifest_data: import('types
|
|
356
|
+
* config: import('types').ValidatedConfig
|
|
357
|
+
* manifest_data: import('types').ManifestData
|
|
358
358
|
* build_dir: string;
|
|
359
359
|
* output_dir: string;
|
|
360
360
|
* service_worker_entry_file: string | null;
|
|
@@ -383,7 +383,7 @@ async function build_server(
|
|
|
383
383
|
|
|
384
384
|
/** @type {Record<string, string>} */
|
|
385
385
|
const input = {
|
|
386
|
-
|
|
386
|
+
index: `${build_dir}/index.js`
|
|
387
387
|
};
|
|
388
388
|
|
|
389
389
|
// add entry points for every endpoint...
|
|
@@ -416,8 +416,8 @@ async function build_server(
|
|
|
416
416
|
};
|
|
417
417
|
|
|
418
418
|
fs__default.writeFileSync(
|
|
419
|
-
input.
|
|
420
|
-
|
|
419
|
+
input.index,
|
|
420
|
+
server_template({
|
|
421
421
|
config,
|
|
422
422
|
hooks: app_relative(hooks_file),
|
|
423
423
|
has_service_worker: service_worker_register && !!service_worker_entry_file,
|
|
@@ -551,7 +551,7 @@ const method_names = {
|
|
|
551
551
|
*
|
|
552
552
|
* @param {string} cwd
|
|
553
553
|
* @param {import('rollup').OutputChunk[]} output
|
|
554
|
-
* @param {import('types
|
|
554
|
+
* @param {import('types').ManifestData} manifest_data
|
|
555
555
|
*/
|
|
556
556
|
function get_methods(cwd, output, manifest_data) {
|
|
557
557
|
/** @type {Record<string, string[]>} */
|
|
@@ -562,14 +562,14 @@ function get_methods(cwd, output, manifest_data) {
|
|
|
562
562
|
lookup[id] = chunk.exports;
|
|
563
563
|
});
|
|
564
564
|
|
|
565
|
-
/** @type {Record<string, import('types
|
|
565
|
+
/** @type {Record<string, import('types').HttpMethod[]>} */
|
|
566
566
|
const methods = {};
|
|
567
567
|
manifest_data.routes.forEach((route) => {
|
|
568
568
|
const file = route.type === 'endpoint' ? route.file : route.shadow;
|
|
569
569
|
|
|
570
570
|
if (file && lookup[file]) {
|
|
571
571
|
methods[file] = lookup[file]
|
|
572
|
-
.map((x) => /** @type {import('types
|
|
572
|
+
.map((x) => /** @type {import('types').HttpMethod} */ (method_names[x]))
|
|
573
573
|
.filter(Boolean);
|
|
574
574
|
}
|
|
575
575
|
});
|
|
@@ -578,8 +578,8 @@ function get_methods(cwd, output, manifest_data) {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
/**
|
|
581
|
-
* @param {import('types
|
|
582
|
-
* @returns {Promise<import('types
|
|
581
|
+
* @param {import('types').ValidatedConfig} config
|
|
582
|
+
* @returns {Promise<import('types').BuildData>}
|
|
583
583
|
*/
|
|
584
584
|
async function build(config) {
|
|
585
585
|
const cwd = process.cwd(); // TODO is this necessary?
|
package/dist/chunks/index4.js
CHANGED
|
@@ -2,9 +2,9 @@ import { s } from './misc.js';
|
|
|
2
2
|
import { g as get_mime_lookup } from '../cli.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @param {import('
|
|
5
|
+
* @param {import('types').BuildData} build_data;
|
|
6
6
|
* @param {string} relative_path;
|
|
7
|
-
* @param {import('
|
|
7
|
+
* @param {import('types').RouteData[]} routes;
|
|
8
8
|
* @param {'esm' | 'cjs'} format
|
|
9
9
|
*/
|
|
10
10
|
function generate_manifest(
|
package/dist/chunks/index5.js
CHANGED
|
@@ -358,61 +358,56 @@ new RegExp(
|
|
|
358
358
|
);
|
|
359
359
|
|
|
360
360
|
/**
|
|
361
|
-
*
|
|
362
|
-
* @
|
|
363
|
-
* @
|
|
364
|
-
* @returns {string}
|
|
361
|
+
* When inside a double-quoted attribute value, only `&` and `"` hold special meaning.
|
|
362
|
+
* @see https://html.spec.whatwg.org/multipage/parsing.html#attribute-value-(double-quoted)-state
|
|
363
|
+
* @type {Record<string, string>}
|
|
365
364
|
*/
|
|
366
|
-
function escape(str, dict, unicode_encoder) {
|
|
367
|
-
let result = '';
|
|
368
|
-
|
|
369
|
-
for (let i = 0; i < str.length; i += 1) {
|
|
370
|
-
const char = str.charAt(i);
|
|
371
|
-
const code = char.charCodeAt(0);
|
|
372
|
-
|
|
373
|
-
if (char in dict) {
|
|
374
|
-
result += dict[char];
|
|
375
|
-
} else if (code >= 0xd800 && code <= 0xdfff) {
|
|
376
|
-
const next = str.charCodeAt(i + 1);
|
|
377
|
-
|
|
378
|
-
// If this is the beginning of a [high, low] surrogate pair,
|
|
379
|
-
// add the next two characters, otherwise escape
|
|
380
|
-
if (code <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {
|
|
381
|
-
result += char + str[++i];
|
|
382
|
-
} else {
|
|
383
|
-
result += unicode_encoder(code);
|
|
384
|
-
}
|
|
385
|
-
} else {
|
|
386
|
-
result += char;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return result;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/** @type {Record<string, string>} */
|
|
394
365
|
const escape_html_attr_dict = {
|
|
395
|
-
'
|
|
396
|
-
'>': '>',
|
|
366
|
+
'&': '&',
|
|
397
367
|
'"': '"'
|
|
398
368
|
};
|
|
399
369
|
|
|
370
|
+
const escape_html_attr_regex = new RegExp(
|
|
371
|
+
// special characters
|
|
372
|
+
`[${Object.keys(escape_html_attr_dict).join('')}]|` +
|
|
373
|
+
// high surrogate without paired low surrogate
|
|
374
|
+
'[\\ud800-\\udbff](?![\\udc00-\\udfff])|' +
|
|
375
|
+
// a valid surrogate pair, the only match with 2 code units
|
|
376
|
+
// we match it so that we can match unpaired low surrogates in the same pass
|
|
377
|
+
// TODO: use lookbehind assertions once they are widely supported: (?<![\ud800-udbff])[\udc00-\udfff]
|
|
378
|
+
'[\\ud800-\\udbff][\\udc00-\\udfff]|' +
|
|
379
|
+
// unpaired low surrogate (see previous match)
|
|
380
|
+
'[\\udc00-\\udfff]',
|
|
381
|
+
'g'
|
|
382
|
+
);
|
|
383
|
+
|
|
400
384
|
/**
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
385
|
+
* Formats a string to be used as an attribute's value in raw HTML.
|
|
386
|
+
*
|
|
387
|
+
* It escapes unpaired surrogates (which are allowed in js strings but invalid in HTML), escapes
|
|
388
|
+
* characters that are special in attributes, and surrounds the whole string in double-quotes.
|
|
404
389
|
*
|
|
405
390
|
* @param {string} str
|
|
406
|
-
* @returns string
|
|
391
|
+
* @returns {string} Escaped string surrounded by double-quotes.
|
|
392
|
+
* @example const html = `<tag data-value=${escape_html_attr('value')}>...</tag>`;
|
|
407
393
|
*/
|
|
408
394
|
function escape_html_attr(str) {
|
|
409
|
-
|
|
395
|
+
const escaped_str = str.replace(escape_html_attr_regex, (match) => {
|
|
396
|
+
if (match.length === 2) {
|
|
397
|
+
// valid surrogate pair
|
|
398
|
+
return match;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return escape_html_attr_dict[match] ?? `&#${match.charCodeAt(0)};`;
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
return `"${escaped_str}"`;
|
|
410
405
|
}
|
|
411
406
|
|
|
412
407
|
/**
|
|
413
|
-
* @typedef {import('types
|
|
414
|
-
* @typedef {import('types
|
|
415
|
-
* @typedef {import('types
|
|
408
|
+
* @typedef {import('types').PrerenderErrorHandler} PrerenderErrorHandler
|
|
409
|
+
* @typedef {import('types').PrerenderOnErrorValue} OnError
|
|
410
|
+
* @typedef {import('types').Logger} Logger
|
|
416
411
|
*/
|
|
417
412
|
|
|
418
413
|
/** @type {(details: Parameters<PrerenderErrorHandler>[0] ) => string} */
|
|
@@ -444,14 +439,14 @@ const REDIRECT = 3;
|
|
|
444
439
|
* cwd: string;
|
|
445
440
|
* out: string;
|
|
446
441
|
* log: Logger;
|
|
447
|
-
* config: import('types
|
|
448
|
-
* build_data: import('types
|
|
442
|
+
* config: import('types').ValidatedConfig;
|
|
443
|
+
* build_data: import('types').BuildData;
|
|
449
444
|
* fallback?: string;
|
|
450
445
|
* all: boolean; // disregard `export const prerender = true`
|
|
451
446
|
* }} opts
|
|
452
447
|
*/
|
|
453
448
|
async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
454
|
-
/** @type {import('types
|
|
449
|
+
/** @type {import('types').Prerendered} */
|
|
455
450
|
const prerendered = {
|
|
456
451
|
pages: new Map(),
|
|
457
452
|
assets: new Map(),
|
|
@@ -467,8 +462,8 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
467
462
|
|
|
468
463
|
const server_root = resolve$1(cwd, `${SVELTE_KIT}/output`);
|
|
469
464
|
|
|
470
|
-
/** @type {import('types
|
|
471
|
-
const {
|
|
465
|
+
/** @type {import('types').ServerModule} */
|
|
466
|
+
const { Server, override } = await import(pathToFileURL(`${server_root}/server/index.js`).href);
|
|
472
467
|
const { manifest } = await import(pathToFileURL(`${server_root}/server/manifest.js`).href);
|
|
473
468
|
|
|
474
469
|
override({
|
|
@@ -477,7 +472,7 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
477
472
|
read: (file) => readFileSync(join(config.kit.files.assets, file))
|
|
478
473
|
});
|
|
479
474
|
|
|
480
|
-
const
|
|
475
|
+
const server = new Server(manifest);
|
|
481
476
|
|
|
482
477
|
const error = normalise_error_handler(log, config.kit.prerender.onError);
|
|
483
478
|
|
|
@@ -542,10 +537,10 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
542
537
|
return;
|
|
543
538
|
}
|
|
544
539
|
|
|
545
|
-
/** @type {Map<string, import('types
|
|
540
|
+
/** @type {Map<string, import('types').PrerenderDependency>} */
|
|
546
541
|
const dependencies = new Map();
|
|
547
542
|
|
|
548
|
-
const response = await
|
|
543
|
+
const response = await server.respond(new Request(`http://sveltekit-prerender${encoded}`), {
|
|
549
544
|
prerender: {
|
|
550
545
|
all,
|
|
551
546
|
dependencies
|
|
@@ -680,7 +675,7 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
680
675
|
}
|
|
681
676
|
|
|
682
677
|
if (fallback) {
|
|
683
|
-
const rendered = await
|
|
678
|
+
const rendered = await server.respond(new Request('http://sveltekit-prerender/[fallback]'), {
|
|
684
679
|
prerender: {
|
|
685
680
|
fallback,
|
|
686
681
|
all: false,
|
|
@@ -699,11 +694,11 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
699
694
|
/**
|
|
700
695
|
* @param {{
|
|
701
696
|
* cwd: string;
|
|
702
|
-
* config: import('types
|
|
703
|
-
* build_data: import('types
|
|
704
|
-
* log: import('types
|
|
697
|
+
* config: import('types').ValidatedConfig;
|
|
698
|
+
* build_data: import('types').BuildData;
|
|
699
|
+
* log: import('types').Logger;
|
|
705
700
|
* }} opts
|
|
706
|
-
* @returns {import('types
|
|
701
|
+
* @returns {import('types').Builder}
|
|
707
702
|
*/
|
|
708
703
|
function create_builder({ cwd, config, build_data, log }) {
|
|
709
704
|
/** @type {Set<string>} */
|
|
@@ -711,7 +706,7 @@ function create_builder({ cwd, config, build_data, log }) {
|
|
|
711
706
|
|
|
712
707
|
let generated_manifest = false;
|
|
713
708
|
|
|
714
|
-
/** @param {import('types
|
|
709
|
+
/** @param {import('types').RouteData} route */
|
|
715
710
|
function not_prerendered(route) {
|
|
716
711
|
if (!prerendered_paths) return true;
|
|
717
712
|
|
|
@@ -736,7 +731,7 @@ function create_builder({ cwd, config, build_data, log }) {
|
|
|
736
731
|
|
|
737
732
|
const { routes } = build_data.manifest_data;
|
|
738
733
|
|
|
739
|
-
/** @type {import('types
|
|
734
|
+
/** @type {import('types').RouteDefinition[]} */
|
|
740
735
|
const facades = routes.map((route) => ({
|
|
741
736
|
type: route.type,
|
|
742
737
|
segments: route.segments,
|
|
@@ -867,8 +862,8 @@ function create_builder({ cwd, config, build_data, log }) {
|
|
|
867
862
|
}
|
|
868
863
|
|
|
869
864
|
/**
|
|
870
|
-
* @param {import('types
|
|
871
|
-
* @param {import('types
|
|
865
|
+
* @param {import('types').ValidatedConfig} config
|
|
866
|
+
* @param {import('types').BuildData} build_data
|
|
872
867
|
* @param {{ cwd?: string, verbose: boolean }} opts
|
|
873
868
|
*/
|
|
874
869
|
async function adapt(config, build_data, { cwd = process.cwd(), verbose }) {
|
package/dist/chunks/index6.js
CHANGED
|
@@ -31,7 +31,7 @@ const mutable = (dir) =>
|
|
|
31
31
|
* @param {{
|
|
32
32
|
* port: number;
|
|
33
33
|
* host?: string;
|
|
34
|
-
* config: import('types
|
|
34
|
+
* config: import('types').ValidatedConfig;
|
|
35
35
|
* https?: boolean;
|
|
36
36
|
* cwd?: string;
|
|
37
37
|
* }} opts
|
|
@@ -45,11 +45,11 @@ async function preview({
|
|
|
45
45
|
}) {
|
|
46
46
|
__fetch_polyfill();
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const index_file = resolve(cwd, `${SVELTE_KIT}/output/server/index.js`);
|
|
49
49
|
const manifest_file = resolve(cwd, `${SVELTE_KIT}/output/server/manifest.js`);
|
|
50
50
|
|
|
51
|
-
/** @type {import('types
|
|
52
|
-
const {
|
|
51
|
+
/** @type {import('types').ServerModule} */
|
|
52
|
+
const { Server, override } = await import(pathToFileURL(index_file).href);
|
|
53
53
|
|
|
54
54
|
const { manifest } = await import(pathToFileURL(manifest_file).href);
|
|
55
55
|
|
|
@@ -78,12 +78,12 @@ async function preview({
|
|
|
78
78
|
read: (file) => fs__default.readFileSync(join(config.kit.files.assets, file))
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
const
|
|
81
|
+
const server = new Server(manifest);
|
|
82
82
|
|
|
83
83
|
/** @type {import('vite').UserConfig} */
|
|
84
84
|
const vite_config = (config.kit.vite && (await config.kit.vite())) || {};
|
|
85
85
|
|
|
86
|
-
const
|
|
86
|
+
const http_server = await get_server(use_https, vite_config, (req, res) => {
|
|
87
87
|
if (req.url == null) {
|
|
88
88
|
throw new Error('Invalid request url');
|
|
89
89
|
}
|
|
@@ -105,7 +105,7 @@ async function preview({
|
|
|
105
105
|
return res.end(err.reason || 'Invalid request body');
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
setResponse(res, await
|
|
108
|
+
setResponse(res, await server.respond(request));
|
|
109
109
|
} else {
|
|
110
110
|
res.statusCode = 404;
|
|
111
111
|
res.end('Not found');
|
|
@@ -132,9 +132,9 @@ async function preview({
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
await
|
|
135
|
+
await http_server.listen(port, host || '0.0.0.0');
|
|
136
136
|
|
|
137
|
-
return Promise.resolve(
|
|
137
|
+
return Promise.resolve(http_server);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
package/dist/chunks/index7.js
CHANGED
|
@@ -15250,7 +15250,7 @@ async function preprocess(source, preprocessor, options) {
|
|
|
15250
15250
|
const essential_files = ['README', 'LICENSE', 'CHANGELOG', '.gitignore', '.npmignore'];
|
|
15251
15251
|
|
|
15252
15252
|
/**
|
|
15253
|
-
* @param {import('types
|
|
15253
|
+
* @param {import('types').ValidatedConfig} config
|
|
15254
15254
|
* @param {string} cwd
|
|
15255
15255
|
*/
|
|
15256
15256
|
async function make_package(config, cwd = process.cwd()) {
|
|
@@ -15429,7 +15429,7 @@ async function make_package(config, cwd = process.cwd()) {
|
|
|
15429
15429
|
*
|
|
15430
15430
|
* @param {string} file Relative to the lib root
|
|
15431
15431
|
* @param {string} content
|
|
15432
|
-
* @param {import('types
|
|
15432
|
+
* @param {import('types').ValidatedConfig} config
|
|
15433
15433
|
* @returns {string}
|
|
15434
15434
|
*/
|
|
15435
15435
|
function resolve_$lib_alias(file, content, config) {
|
|
@@ -15548,7 +15548,7 @@ function write(file, contents) {
|
|
|
15548
15548
|
}
|
|
15549
15549
|
|
|
15550
15550
|
/**
|
|
15551
|
-
* @param {import('types
|
|
15551
|
+
* @param {import('types').ValidatedConfig} config
|
|
15552
15552
|
*/
|
|
15553
15553
|
async function emit_dts(config) {
|
|
15554
15554
|
const require = createRequire(import.meta.url);
|
package/dist/cli.js
CHANGED
|
@@ -362,7 +362,7 @@ function noop() {}
|
|
|
362
362
|
|
|
363
363
|
/** @param {{ verbose: boolean }} opts */
|
|
364
364
|
function logger({ verbose }) {
|
|
365
|
-
/** @type {import('types
|
|
365
|
+
/** @type {import('types').Logger} */
|
|
366
366
|
const log = (msg) => console.log(msg.replace(/^/gm, ' '));
|
|
367
367
|
|
|
368
368
|
/** @param {string} msg */
|
|
@@ -881,7 +881,7 @@ function error(fn) {
|
|
|
881
881
|
|
|
882
882
|
/**
|
|
883
883
|
* @param {string} cwd
|
|
884
|
-
* @param {import('types
|
|
884
|
+
* @param {import('types').ValidatedConfig} config
|
|
885
885
|
*/
|
|
886
886
|
function load_template(cwd, config) {
|
|
887
887
|
const { template } = config.kit.files;
|
|
@@ -926,8 +926,8 @@ async function load_config({ cwd = process.cwd() } = {}) {
|
|
|
926
926
|
}
|
|
927
927
|
|
|
928
928
|
/**
|
|
929
|
-
* @param {import('types
|
|
930
|
-
* @returns {import('types
|
|
929
|
+
* @param {import('types').Config} config
|
|
930
|
+
* @returns {import('types').ValidatedConfig}
|
|
931
931
|
*/
|
|
932
932
|
function validate_config(config) {
|
|
933
933
|
if (typeof config !== 'object') {
|
|
@@ -998,7 +998,7 @@ async function launch(port, https) {
|
|
|
998
998
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
999
999
|
}
|
|
1000
1000
|
|
|
1001
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
1001
|
+
const prog = sade('svelte-kit').version('1.0.0-next.281');
|
|
1002
1002
|
|
|
1003
1003
|
prog
|
|
1004
1004
|
.command('dev')
|
|
@@ -1156,7 +1156,7 @@ async function check_port(port) {
|
|
|
1156
1156
|
function welcome({ port, host, https, open, loose, allow, cwd }) {
|
|
1157
1157
|
if (open) launch(port, https);
|
|
1158
1158
|
|
|
1159
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1159
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.281'}\n`));
|
|
1160
1160
|
|
|
1161
1161
|
const protocol = https ? 'https:' : 'http:';
|
|
1162
1162
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/dist/hooks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {...import('types
|
|
3
|
-
* @returns {import('types
|
|
2
|
+
* @param {...import('types').Handle} handlers
|
|
3
|
+
* @returns {import('types').Handle}
|
|
4
4
|
*/
|
|
5
5
|
function sequence(...handlers) {
|
|
6
6
|
const length = handlers.length;
|
|
@@ -11,8 +11,8 @@ function sequence(...handlers) {
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @param {number} i
|
|
14
|
-
* @param {import('types
|
|
15
|
-
* @returns {import('types
|
|
14
|
+
* @param {import('types').RequestEvent} event
|
|
15
|
+
* @returns {import('types').MaybePromise<Response>}
|
|
16
16
|
*/
|
|
17
17
|
function apply_handle(i, event) {
|
|
18
18
|
const handle = handlers[i];
|
package/dist/node.js
CHANGED
|
@@ -71,7 +71,7 @@ async function getRequest(base, req) {
|
|
|
71
71
|
|
|
72
72
|
/** @type {import('@sveltejs/kit/node').SetResponse} */
|
|
73
73
|
async function setResponse(res, response) {
|
|
74
|
-
/** @type {import('
|
|
74
|
+
/** @type {import('types').ResponseHeaders} */
|
|
75
75
|
const headers = Object.fromEntries(response.headers);
|
|
76
76
|
|
|
77
77
|
if (response.headers.has('set-cookie')) {
|
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.281",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"node": ">=14.13"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
|
-
"build": "rollup -c && node scripts/cp.js src/runtime/components assets/components",
|
|
79
|
+
"build": "rollup -c && node scripts/cp.js src/runtime/components assets/components && npm run types",
|
|
80
80
|
"dev": "rollup -cw",
|
|
81
81
|
"lint": "eslint --ignore-path .gitignore --ignore-pattern \"src/packaging/test/**\" \"{src,test}/**/*.{ts,mjs,js,svelte}\" && npm run check-format",
|
|
82
82
|
"check": "tsc && svelte-check --ignore test/prerendering,src/packaging/test",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"test:integration:amp": "cd test/apps/amp && pnpm test",
|
|
93
93
|
"test:integration:basics": "cd test/apps/basics && pnpm test",
|
|
94
94
|
"test:integration:options": "cd test/apps/options && pnpm test",
|
|
95
|
-
"test:integration:options-2": "cd test/apps/options-2 && pnpm test"
|
|
95
|
+
"test:integration:options-2": "cd test/apps/options-2 && pnpm test",
|
|
96
|
+
"types": "node scripts/extract-types.js"
|
|
96
97
|
}
|
|
97
98
|
}
|
|
File without changes
|