@sveltejs/kit 1.0.0-next.277 → 1.0.0-next.280
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 +92 -97
- 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 +56 -66
- 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
|
@@ -160,8 +160,6 @@ const TAG_OPEN = /[a-zA-Z]/;
|
|
|
160
160
|
const TAG_CHAR = /[a-zA-Z0-9]/;
|
|
161
161
|
const ATTRIBUTE_NAME = /[^\t\n\f />"'=]/;
|
|
162
162
|
|
|
163
|
-
const EXTERNAL = /\bexternal\b/;
|
|
164
|
-
|
|
165
163
|
const WHITESPACE = /[\s\n\r]/;
|
|
166
164
|
|
|
167
165
|
/** @param {string} html */
|
|
@@ -240,7 +238,6 @@ function crawl(html) {
|
|
|
240
238
|
}
|
|
241
239
|
}
|
|
242
240
|
|
|
243
|
-
let rel = '';
|
|
244
241
|
let href = '';
|
|
245
242
|
|
|
246
243
|
while (i < html.length) {
|
|
@@ -301,9 +298,7 @@ function crawl(html) {
|
|
|
301
298
|
i -= 1;
|
|
302
299
|
}
|
|
303
300
|
|
|
304
|
-
if (name === '
|
|
305
|
-
rel = value;
|
|
306
|
-
} else if (name === 'href') {
|
|
301
|
+
if (name === 'href') {
|
|
307
302
|
href = value;
|
|
308
303
|
} else if (name === 'src') {
|
|
309
304
|
hrefs.push(value);
|
|
@@ -335,7 +330,7 @@ function crawl(html) {
|
|
|
335
330
|
i += 1;
|
|
336
331
|
}
|
|
337
332
|
|
|
338
|
-
if (href
|
|
333
|
+
if (href) {
|
|
339
334
|
hrefs.push(href);
|
|
340
335
|
}
|
|
341
336
|
}
|
|
@@ -363,61 +358,56 @@ new RegExp(
|
|
|
363
358
|
);
|
|
364
359
|
|
|
365
360
|
/**
|
|
366
|
-
*
|
|
367
|
-
* @
|
|
368
|
-
* @
|
|
369
|
-
* @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>}
|
|
370
364
|
*/
|
|
371
|
-
function escape(str, dict, unicode_encoder) {
|
|
372
|
-
let result = '';
|
|
373
|
-
|
|
374
|
-
for (let i = 0; i < str.length; i += 1) {
|
|
375
|
-
const char = str.charAt(i);
|
|
376
|
-
const code = char.charCodeAt(0);
|
|
377
|
-
|
|
378
|
-
if (char in dict) {
|
|
379
|
-
result += dict[char];
|
|
380
|
-
} else if (code >= 0xd800 && code <= 0xdfff) {
|
|
381
|
-
const next = str.charCodeAt(i + 1);
|
|
382
|
-
|
|
383
|
-
// If this is the beginning of a [high, low] surrogate pair,
|
|
384
|
-
// add the next two characters, otherwise escape
|
|
385
|
-
if (code <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {
|
|
386
|
-
result += char + str[++i];
|
|
387
|
-
} else {
|
|
388
|
-
result += unicode_encoder(code);
|
|
389
|
-
}
|
|
390
|
-
} else {
|
|
391
|
-
result += char;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return result;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/** @type {Record<string, string>} */
|
|
399
365
|
const escape_html_attr_dict = {
|
|
400
|
-
'
|
|
401
|
-
'>': '>',
|
|
366
|
+
'&': '&',
|
|
402
367
|
'"': '"'
|
|
403
368
|
};
|
|
404
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
|
+
|
|
405
384
|
/**
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
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.
|
|
409
389
|
*
|
|
410
390
|
* @param {string} str
|
|
411
|
-
* @returns string
|
|
391
|
+
* @returns {string} Escaped string surrounded by double-quotes.
|
|
392
|
+
* @example const html = `<tag data-value=${escape_html_attr('value')}>...</tag>`;
|
|
412
393
|
*/
|
|
413
394
|
function escape_html_attr(str) {
|
|
414
|
-
|
|
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}"`;
|
|
415
405
|
}
|
|
416
406
|
|
|
417
407
|
/**
|
|
418
|
-
* @typedef {import('types
|
|
419
|
-
* @typedef {import('types
|
|
420
|
-
* @typedef {import('types
|
|
408
|
+
* @typedef {import('types').PrerenderErrorHandler} PrerenderErrorHandler
|
|
409
|
+
* @typedef {import('types').PrerenderOnErrorValue} OnError
|
|
410
|
+
* @typedef {import('types').Logger} Logger
|
|
421
411
|
*/
|
|
422
412
|
|
|
423
413
|
/** @type {(details: Parameters<PrerenderErrorHandler>[0] ) => string} */
|
|
@@ -449,14 +439,14 @@ const REDIRECT = 3;
|
|
|
449
439
|
* cwd: string;
|
|
450
440
|
* out: string;
|
|
451
441
|
* log: Logger;
|
|
452
|
-
* config: import('types
|
|
453
|
-
* build_data: import('types
|
|
442
|
+
* config: import('types').ValidatedConfig;
|
|
443
|
+
* build_data: import('types').BuildData;
|
|
454
444
|
* fallback?: string;
|
|
455
445
|
* all: boolean; // disregard `export const prerender = true`
|
|
456
446
|
* }} opts
|
|
457
447
|
*/
|
|
458
448
|
async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
459
|
-
/** @type {import('types
|
|
449
|
+
/** @type {import('types').Prerendered} */
|
|
460
450
|
const prerendered = {
|
|
461
451
|
pages: new Map(),
|
|
462
452
|
assets: new Map(),
|
|
@@ -472,8 +462,8 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
472
462
|
|
|
473
463
|
const server_root = resolve$1(cwd, `${SVELTE_KIT}/output`);
|
|
474
464
|
|
|
475
|
-
/** @type {import('types
|
|
476
|
-
const {
|
|
465
|
+
/** @type {import('types').ServerModule} */
|
|
466
|
+
const { Server, override } = await import(pathToFileURL(`${server_root}/server/index.js`).href);
|
|
477
467
|
const { manifest } = await import(pathToFileURL(`${server_root}/server/manifest.js`).href);
|
|
478
468
|
|
|
479
469
|
override({
|
|
@@ -482,7 +472,7 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
482
472
|
read: (file) => readFileSync(join(config.kit.files.assets, file))
|
|
483
473
|
});
|
|
484
474
|
|
|
485
|
-
const
|
|
475
|
+
const server = new Server(manifest);
|
|
486
476
|
|
|
487
477
|
const error = normalise_error_handler(log, config.kit.prerender.onError);
|
|
488
478
|
|
|
@@ -547,10 +537,10 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
547
537
|
return;
|
|
548
538
|
}
|
|
549
539
|
|
|
550
|
-
/** @type {Map<string, import('types
|
|
540
|
+
/** @type {Map<string, import('types').PrerenderDependency>} */
|
|
551
541
|
const dependencies = new Map();
|
|
552
542
|
|
|
553
|
-
const response = await
|
|
543
|
+
const response = await server.respond(new Request(`http://sveltekit-prerender${encoded}`), {
|
|
554
544
|
prerender: {
|
|
555
545
|
all,
|
|
556
546
|
dependencies
|
|
@@ -685,7 +675,7 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
685
675
|
}
|
|
686
676
|
|
|
687
677
|
if (fallback) {
|
|
688
|
-
const rendered = await
|
|
678
|
+
const rendered = await server.respond(new Request('http://sveltekit-prerender/[fallback]'), {
|
|
689
679
|
prerender: {
|
|
690
680
|
fallback,
|
|
691
681
|
all: false,
|
|
@@ -704,11 +694,11 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
|
|
|
704
694
|
/**
|
|
705
695
|
* @param {{
|
|
706
696
|
* cwd: string;
|
|
707
|
-
* config: import('types
|
|
708
|
-
* build_data: import('types
|
|
709
|
-
* log: import('types
|
|
697
|
+
* config: import('types').ValidatedConfig;
|
|
698
|
+
* build_data: import('types').BuildData;
|
|
699
|
+
* log: import('types').Logger;
|
|
710
700
|
* }} opts
|
|
711
|
-
* @returns {import('types
|
|
701
|
+
* @returns {import('types').Builder}
|
|
712
702
|
*/
|
|
713
703
|
function create_builder({ cwd, config, build_data, log }) {
|
|
714
704
|
/** @type {Set<string>} */
|
|
@@ -716,7 +706,7 @@ function create_builder({ cwd, config, build_data, log }) {
|
|
|
716
706
|
|
|
717
707
|
let generated_manifest = false;
|
|
718
708
|
|
|
719
|
-
/** @param {import('types
|
|
709
|
+
/** @param {import('types').RouteData} route */
|
|
720
710
|
function not_prerendered(route) {
|
|
721
711
|
if (!prerendered_paths) return true;
|
|
722
712
|
|
|
@@ -741,7 +731,7 @@ function create_builder({ cwd, config, build_data, log }) {
|
|
|
741
731
|
|
|
742
732
|
const { routes } = build_data.manifest_data;
|
|
743
733
|
|
|
744
|
-
/** @type {import('types
|
|
734
|
+
/** @type {import('types').RouteDefinition[]} */
|
|
745
735
|
const facades = routes.map((route) => ({
|
|
746
736
|
type: route.type,
|
|
747
737
|
segments: route.segments,
|
|
@@ -872,8 +862,8 @@ function create_builder({ cwd, config, build_data, log }) {
|
|
|
872
862
|
}
|
|
873
863
|
|
|
874
864
|
/**
|
|
875
|
-
* @param {import('types
|
|
876
|
-
* @param {import('types
|
|
865
|
+
* @param {import('types').ValidatedConfig} config
|
|
866
|
+
* @param {import('types').BuildData} build_data
|
|
877
867
|
* @param {{ cwd?: string, verbose: boolean }} opts
|
|
878
868
|
*/
|
|
879
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.280');
|
|
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.280'}\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.280",
|
|
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
|