@sveltejs/kit 1.0.0-next.28 → 1.0.0-next.282

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.
Files changed (79) hide show
  1. package/README.md +12 -9
  2. package/assets/app/env.js +20 -0
  3. package/assets/app/navigation.js +79 -0
  4. package/assets/app/paths.js +1 -0
  5. package/assets/app/stores.js +97 -0
  6. package/assets/chunks/utils.js +13 -0
  7. package/assets/client/singletons.js +21 -0
  8. package/assets/client/start.js +1561 -0
  9. package/assets/components/error.svelte +18 -2
  10. package/assets/env.js +8 -0
  11. package/assets/paths.js +13 -0
  12. package/assets/server/index.js +2759 -0
  13. package/dist/chunks/amp_hook.js +56 -0
  14. package/dist/chunks/build.js +658 -0
  15. package/dist/chunks/cert.js +28154 -0
  16. package/dist/chunks/index.js +473 -0
  17. package/dist/chunks/index2.js +836 -0
  18. package/dist/chunks/index3.js +643 -0
  19. package/dist/chunks/index4.js +120 -0
  20. package/dist/chunks/index5.js +881 -0
  21. package/dist/chunks/index6.js +170 -0
  22. package/dist/chunks/index7.js +15584 -0
  23. package/dist/chunks/index8.js +4207 -0
  24. package/dist/chunks/misc.js +3 -0
  25. package/dist/chunks/multipart-parser.js +449 -0
  26. package/dist/cli.js +1132 -86
  27. package/dist/hooks.js +28 -0
  28. package/dist/install-fetch.js +6518 -0
  29. package/dist/node.js +95 -0
  30. package/package.json +97 -54
  31. package/svelte-kit.js +2 -0
  32. package/types/ambient.d.ts +208 -0
  33. package/types/index.d.ts +391 -0
  34. package/types/internal.d.ts +372 -0
  35. package/CHANGELOG.md +0 -326
  36. package/assets/runtime/app/navigation.js +0 -23
  37. package/assets/runtime/app/navigation.js.map +0 -1
  38. package/assets/runtime/app/paths.js +0 -2
  39. package/assets/runtime/app/paths.js.map +0 -1
  40. package/assets/runtime/app/stores.js +0 -78
  41. package/assets/runtime/app/stores.js.map +0 -1
  42. package/assets/runtime/internal/singletons.js +0 -15
  43. package/assets/runtime/internal/singletons.js.map +0 -1
  44. package/assets/runtime/internal/start.js +0 -591
  45. package/assets/runtime/internal/start.js.map +0 -1
  46. package/assets/runtime/utils-85ebcc60.js +0 -18
  47. package/assets/runtime/utils-85ebcc60.js.map +0 -1
  48. package/dist/api.js +0 -44
  49. package/dist/api.js.map +0 -1
  50. package/dist/build.js +0 -246
  51. package/dist/build.js.map +0 -1
  52. package/dist/cli.js.map +0 -1
  53. package/dist/colors.js +0 -37
  54. package/dist/colors.js.map +0 -1
  55. package/dist/create_app.js +0 -580
  56. package/dist/create_app.js.map +0 -1
  57. package/dist/index.js +0 -368
  58. package/dist/index.js.map +0 -1
  59. package/dist/index2.js +0 -12035
  60. package/dist/index2.js.map +0 -1
  61. package/dist/index3.js +0 -549
  62. package/dist/index3.js.map +0 -1
  63. package/dist/index4.js +0 -74
  64. package/dist/index4.js.map +0 -1
  65. package/dist/index5.js +0 -464
  66. package/dist/index5.js.map +0 -1
  67. package/dist/index6.js +0 -735
  68. package/dist/index6.js.map +0 -1
  69. package/dist/logging.js +0 -43
  70. package/dist/logging.js.map +0 -1
  71. package/dist/package.js +0 -432
  72. package/dist/package.js.map +0 -1
  73. package/dist/renderer.js +0 -2425
  74. package/dist/renderer.js.map +0 -1
  75. package/dist/standard.js +0 -101
  76. package/dist/standard.js.map +0 -1
  77. package/dist/utils.js +0 -58
  78. package/dist/utils.js.map +0 -1
  79. package/svelte-kit +0 -3
package/dist/cli.js CHANGED
@@ -1,92 +1,1041 @@
1
- 'use strict';
2
-
3
- var sade = require('sade');
4
- var index = require('./index.js');
5
- require('path');
6
- require('module');
7
- require('url');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- function _interopNamespace(e) {
12
- if (e && e.__esModule) return e;
13
- var n = Object.create(null);
14
- if (e) {
15
- Object.keys(e).forEach(function (k) {
16
- if (k !== 'default') {
17
- var d = Object.getOwnPropertyDescriptor(e, k);
18
- Object.defineProperty(n, k, d.get ? d : {
19
- enumerable: true,
20
- get: function () {
21
- return e[k];
22
- }
23
- });
24
- }
25
- });
1
+ import sade from 'sade';
2
+ import path__default, { join, relative } from 'path';
3
+ import { exec as exec$1 } from 'child_process';
4
+ import { createConnection, createServer } from 'net';
5
+ import fs__default from 'fs';
6
+ import * as url from 'url';
7
+ import { fileURLToPath } from 'url';
8
+ import { networkInterfaces, release } from 'os';
9
+
10
+ let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
11
+ if (typeof process !== 'undefined') {
12
+ ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env);
13
+ isTTY = process.stdout && process.stdout.isTTY;
14
+ }
15
+
16
+ const $ = {
17
+ enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
18
+ FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
19
+ ),
20
+
21
+ // modifiers
22
+ reset: init(0, 0),
23
+ bold: init(1, 22),
24
+ dim: init(2, 22),
25
+ italic: init(3, 23),
26
+ underline: init(4, 24),
27
+ inverse: init(7, 27),
28
+ hidden: init(8, 28),
29
+ strikethrough: init(9, 29),
30
+
31
+ // colors
32
+ black: init(30, 39),
33
+ red: init(31, 39),
34
+ green: init(32, 39),
35
+ yellow: init(33, 39),
36
+ blue: init(34, 39),
37
+ magenta: init(35, 39),
38
+ cyan: init(36, 39),
39
+ white: init(37, 39),
40
+ gray: init(90, 39),
41
+ grey: init(90, 39),
42
+
43
+ // background colors
44
+ bgBlack: init(40, 49),
45
+ bgRed: init(41, 49),
46
+ bgGreen: init(42, 49),
47
+ bgYellow: init(43, 49),
48
+ bgBlue: init(44, 49),
49
+ bgMagenta: init(45, 49),
50
+ bgCyan: init(46, 49),
51
+ bgWhite: init(47, 49)
52
+ };
53
+
54
+ function run(arr, str) {
55
+ let i=0, tmp, beg='', end='';
56
+ for (; i < arr.length; i++) {
57
+ tmp = arr[i];
58
+ beg += tmp.open;
59
+ end += tmp.close;
60
+ if (!!~str.indexOf(tmp.close)) {
61
+ str = str.replace(tmp.rgx, tmp.close + tmp.open);
62
+ }
26
63
  }
27
- n['default'] = e;
28
- return Object.freeze(n);
64
+ return beg + str + end;
65
+ }
66
+
67
+ function chain(has, keys) {
68
+ let ctx = { has, keys };
69
+
70
+ ctx.reset = $.reset.bind(ctx);
71
+ ctx.bold = $.bold.bind(ctx);
72
+ ctx.dim = $.dim.bind(ctx);
73
+ ctx.italic = $.italic.bind(ctx);
74
+ ctx.underline = $.underline.bind(ctx);
75
+ ctx.inverse = $.inverse.bind(ctx);
76
+ ctx.hidden = $.hidden.bind(ctx);
77
+ ctx.strikethrough = $.strikethrough.bind(ctx);
78
+
79
+ ctx.black = $.black.bind(ctx);
80
+ ctx.red = $.red.bind(ctx);
81
+ ctx.green = $.green.bind(ctx);
82
+ ctx.yellow = $.yellow.bind(ctx);
83
+ ctx.blue = $.blue.bind(ctx);
84
+ ctx.magenta = $.magenta.bind(ctx);
85
+ ctx.cyan = $.cyan.bind(ctx);
86
+ ctx.white = $.white.bind(ctx);
87
+ ctx.gray = $.gray.bind(ctx);
88
+ ctx.grey = $.grey.bind(ctx);
89
+
90
+ ctx.bgBlack = $.bgBlack.bind(ctx);
91
+ ctx.bgRed = $.bgRed.bind(ctx);
92
+ ctx.bgGreen = $.bgGreen.bind(ctx);
93
+ ctx.bgYellow = $.bgYellow.bind(ctx);
94
+ ctx.bgBlue = $.bgBlue.bind(ctx);
95
+ ctx.bgMagenta = $.bgMagenta.bind(ctx);
96
+ ctx.bgCyan = $.bgCyan.bind(ctx);
97
+ ctx.bgWhite = $.bgWhite.bind(ctx);
98
+
99
+ return ctx;
29
100
  }
30
101
 
31
- var sade__default = /*#__PURE__*/_interopDefaultLegacy(sade);
102
+ function init(open, close) {
103
+ let blk = {
104
+ open: `\x1b[${open}m`,
105
+ close: `\x1b[${close}m`,
106
+ rgx: new RegExp(`\\x1b\\[${close}m`, 'g')
107
+ };
108
+ return function (txt) {
109
+ if (this !== void 0 && this.has !== void 0) {
110
+ !!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk));
111
+ return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';
112
+ }
113
+ return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';
114
+ };
115
+ }
32
116
 
33
- var version = "1.0.0-next.28";
117
+ function exec(cmd) {
118
+ return new Promise((fulfil, reject) => {
119
+ exec$1(cmd, (error, stdout, stderr) => {
120
+ if (error) return reject(error);
121
+ fulfil({ stdout, stderr });
122
+ });
123
+ });
124
+ }
34
125
 
35
- function get_config() {
126
+ async function blame(port) {
36
127
  try {
37
- return index.load_config();
128
+ const { stdout } = await exec(`lsof -i :${port} -sTCP:LISTEN -Fp`);
129
+
130
+ if (!stdout) return null;
131
+ const pid = parseInt(stdout.slice(1), 10);
132
+ if (isNaN(pid)) throw new Error(`Invalid stdout ${stdout}`);
133
+
134
+ return pid;
38
135
  } catch (error) {
39
- let message = error.message;
136
+ return null;
137
+ }
138
+ }
139
+
140
+ let promise;
141
+
142
+ function weird() {
143
+ if (!promise) {
144
+ promise = get_weird(9000);
145
+ }
146
+ return promise;
147
+ }
148
+
149
+ function get_weird(port) {
150
+ return new Promise(fulfil => {
151
+ const server = createServer();
152
+
153
+ server.unref();
154
+
155
+ server.on('error', () => {
156
+ fulfil(get_weird(port + 1));
157
+ });
158
+
159
+ server.listen({ port }, () => {
160
+ const server2 = createServer();
161
+
162
+ server2.unref();
163
+
164
+ server2.on('error', () => {
165
+ server.close(() => {
166
+ fulfil(false);
167
+ });
168
+ });
40
169
 
41
- if (error.code === 'ENOENT') {
42
- message = 'Missing svelte.config.js';
43
- } else if (error.name === 'SyntaxError') {
44
- message = 'Malformed svelte.config.js';
170
+ server2.listen({ port }, () => {
171
+ server2.close(() => {
172
+ server.close(() => {
173
+ fulfil(true);
174
+ });
175
+ });
176
+ });
177
+ });
178
+ });
179
+ }
180
+
181
+ function check(port) {
182
+ return weird().then(weird => {
183
+ if (weird) {
184
+ return check_weird(port);
45
185
  }
46
186
 
47
- console.error(index.$.bold().red(message));
48
- console.error(index.$.grey(error.stack));
49
- process.exit(1);
187
+ return new Promise(fulfil => {
188
+ const server = createServer();
189
+
190
+ server.unref();
191
+
192
+ server.on('error', () => {
193
+ fulfil(false);
194
+ });
195
+
196
+ server.listen({ port }, () => {
197
+ server.close(() => {
198
+ fulfil(true);
199
+ });
200
+ });
201
+ });
202
+ });
203
+ }
204
+
205
+ function check_weird(port) {
206
+ return new Promise(fulfil => {
207
+ const client = createConnection({ port }, () => {
208
+ client.end();
209
+ fulfil(false);
210
+ })
211
+ .on('error', () => {
212
+ fulfil(true);
213
+ });
214
+ });
215
+ }
216
+
217
+ /** @param {string} dir */
218
+ function mkdirp(dir) {
219
+ try {
220
+ fs__default.mkdirSync(dir, { recursive: true });
221
+ } catch (/** @type {any} */ e) {
222
+ if (e.code === 'EEXIST') return;
223
+ throw e;
50
224
  }
51
225
  }
52
226
 
53
- function handle_error(error) {
54
- console.log(index.$.bold().red(`> ${error.message}`));
55
- console.log(index.$.gray(error.stack));
227
+ /** @param {string} path */
228
+ function rimraf(path) {
229
+ (fs__default.rmSync || fs__default.rmdirSync)(path, { recursive: true, force: true });
230
+ }
231
+
232
+ /**
233
+ * @param {string} source
234
+ * @param {string} target
235
+ * @param {{
236
+ * filter?: (basename: string) => boolean;
237
+ * replace?: Record<string, string>;
238
+ * }} opts
239
+ */
240
+ function copy(source, target, opts = {}) {
241
+ if (!fs__default.existsSync(source)) return [];
242
+
243
+ /** @type {string[]} */
244
+ const files = [];
245
+
246
+ const prefix = posixify(target) + '/';
247
+
248
+ const regex = opts.replace
249
+ ? new RegExp(`\\b(${Object.keys(opts.replace).join('|')})\\b`, 'g')
250
+ : null;
251
+
252
+ /**
253
+ * @param {string} from
254
+ * @param {string} to
255
+ */
256
+ function go(from, to) {
257
+ if (opts.filter && !opts.filter(path__default.basename(from))) return;
258
+
259
+ const stats = fs__default.statSync(from);
260
+
261
+ if (stats.isDirectory()) {
262
+ fs__default.readdirSync(from).forEach((file) => {
263
+ go(path__default.join(from, file), path__default.join(to, file));
264
+ });
265
+ } else {
266
+ mkdirp(path__default.dirname(to));
267
+
268
+ if (opts.replace) {
269
+ const data = fs__default.readFileSync(from, 'utf-8');
270
+ fs__default.writeFileSync(
271
+ to,
272
+ data.replace(
273
+ /** @type {RegExp} */ (regex),
274
+ (match, key) => /** @type {Record<string, string>} */ (opts.replace)[key]
275
+ )
276
+ );
277
+ } else {
278
+ fs__default.copyFileSync(from, to);
279
+ }
280
+
281
+ files.push(to === target ? posixify(path__default.basename(to)) : posixify(to).replace(prefix, ''));
282
+ }
283
+ }
284
+
285
+ go(source, target);
286
+
287
+ return files;
288
+ }
289
+
290
+ /**
291
+ * Get a list of all files in a directory
292
+ * @param {string} cwd - the directory to walk
293
+ * @param {boolean} [dirs] - whether to include directories in the result
294
+ */
295
+ function walk(cwd, dirs = false) {
296
+ /** @type {string[]} */
297
+ const all_files = [];
298
+
299
+ /** @param {string} dir */
300
+ function walk_dir(dir) {
301
+ const files = fs__default.readdirSync(path__default.join(cwd, dir));
302
+
303
+ for (const file of files) {
304
+ const joined = path__default.join(dir, file);
305
+ const stats = fs__default.statSync(path__default.join(cwd, joined));
306
+ if (stats.isDirectory()) {
307
+ if (dirs) all_files.push(joined);
308
+ walk_dir(joined);
309
+ } else {
310
+ all_files.push(joined);
311
+ }
312
+ }
313
+ }
314
+
315
+ return walk_dir(''), all_files;
316
+ }
317
+
318
+ /** @param {string} str */
319
+ function posixify(str) {
320
+ return str.replace(/\\/g, '/');
321
+ }
322
+
323
+ const SVELTE_KIT = '.svelte-kit';
324
+
325
+ // in `svelte-kit dev` and `svelte-kit preview`, we use a fake
326
+ // asset path so that we can serve local assets while still
327
+ // verifying that requests are correctly prefixed
328
+ const SVELTE_KIT_ASSETS = '/_svelte_kit_assets';
329
+
330
+ const __filename = fileURLToPath(import.meta.url);
331
+ const __dirname = path__default.dirname(__filename);
332
+
333
+ const runtime = posixify_path(path__default.resolve(`${SVELTE_KIT}/runtime`))
334
+ ;
335
+
336
+ /** @param {string} str */
337
+ function posixify_path(str) {
338
+ const parsed = path__default.parse(str);
339
+ return `/${parsed.dir.slice(parsed.root.length).split(path__default.sep).join('/')}/${parsed.base}`;
340
+ }
341
+
342
+ /** @param {string} dest */
343
+ function copy_assets(dest) {
344
+ {
345
+ let prefix = '..';
346
+ do {
347
+ // we jump through these hoops so that this function
348
+ // works whether or not it's been bundled
349
+ const resolved = path__default.resolve(__dirname, `${prefix}/assets`);
350
+
351
+ if (fs__default.existsSync(resolved)) {
352
+ copy(resolved, dest);
353
+ return;
354
+ }
355
+
356
+ prefix = `../${prefix}`;
357
+ } while (true); // eslint-disable-line
358
+ }
359
+ }
360
+
361
+ function noop() {}
362
+
363
+ /** @param {{ verbose: boolean }} opts */
364
+ function logger({ verbose }) {
365
+ /** @type {import('types').Logger} */
366
+ const log = (msg) => console.log(msg.replace(/^/gm, ' '));
367
+
368
+ /** @param {string} msg */
369
+ const err = (msg) => console.error(msg.replace(/^/gm, ' '));
370
+
371
+ log.success = (msg) => log($.green(`✔ ${msg}`));
372
+ log.error = (msg) => err($.bold().red(msg));
373
+ log.warn = (msg) => log($.bold().yellow(msg));
374
+
375
+ log.minor = verbose ? (msg) => log($.grey(msg)) : noop;
376
+ log.info = verbose ? log : noop;
377
+
378
+ return log;
379
+ }
380
+
381
+ /**
382
+ * Given an entry point like [cwd]/src/hooks, returns a filename like [cwd]/src/hooks.js or [cwd]/src/hooks/index.js
383
+ * @param {string} entry
384
+ * @returns {string|null}
385
+ */
386
+ function resolve_entry(entry) {
387
+ if (fs__default.existsSync(entry)) {
388
+ const stats = fs__default.statSync(entry);
389
+ if (stats.isDirectory()) {
390
+ return resolve_entry(path__default.join(entry, 'index'));
391
+ }
392
+
393
+ return entry;
394
+ } else {
395
+ const dir = path__default.dirname(entry);
396
+
397
+ if (fs__default.existsSync(dir)) {
398
+ const base = path__default.basename(entry);
399
+ const files = fs__default.readdirSync(dir);
400
+
401
+ const found = files.find((file) => file.replace(/\.[^.]+$/, '') === base);
402
+
403
+ if (found) return path__default.join(dir, found);
404
+ }
405
+ }
406
+
407
+ return null;
408
+ }
409
+
410
+ /** @param {import('./create_app/index.js').ManifestData} manifest_data */
411
+ function get_mime_lookup(manifest_data) {
412
+ /** @type {Record<string, string>} */
413
+ const mime = {};
414
+
415
+ manifest_data.assets.forEach((asset) => {
416
+ if (asset.type) {
417
+ const ext = path__default.extname(asset.file);
418
+ mime[ext] = asset.type;
419
+ }
420
+ });
421
+
422
+ return mime;
423
+ }
424
+
425
+ /** @param {import('@sveltejs/kit').ValidatedConfig} config */
426
+ function get_aliases(config) {
427
+ const alias = {
428
+ __GENERATED__: path__default.posix.resolve(`${SVELTE_KIT}/generated`),
429
+ $app: `${runtime}/app`,
430
+ $lib: config.kit.files.lib
431
+ };
432
+
433
+ return alias;
434
+ }
435
+
436
+ /** @typedef {import('./types').Validator} Validator */
437
+
438
+ /** @type {Validator} */
439
+ const options = object(
440
+ {
441
+ extensions: validate(['.svelte'], (input, keypath) => {
442
+ if (!Array.isArray(input) || !input.every((page) => typeof page === 'string')) {
443
+ throw new Error(`${keypath} must be an array of strings`);
444
+ }
445
+
446
+ input.forEach((extension) => {
447
+ if (extension[0] !== '.') {
448
+ throw new Error(`Each member of ${keypath} must start with '.' — saw '${extension}'`);
449
+ }
450
+
451
+ if (!/^(\.[a-z0-9]+)+$/i.test(extension)) {
452
+ throw new Error(`File extensions must be alphanumeric — saw '${extension}'`);
453
+ }
454
+ });
455
+
456
+ return input;
457
+ }),
458
+
459
+ kit: object({
460
+ adapter: validate(null, (input, keypath) => {
461
+ if (typeof input !== 'object' || !input.adapt) {
462
+ let message = `${keypath} should be an object with an "adapt" method`;
463
+
464
+ if (Array.isArray(input) || typeof input === 'string') {
465
+ // for the early adapter adopters
466
+ message += ', rather than the name of an adapter';
467
+ }
468
+
469
+ throw new Error(`${message}. See https://kit.svelte.dev/docs/adapters`);
470
+ }
471
+
472
+ return input;
473
+ }),
474
+
475
+ amp: boolean(false),
476
+
477
+ appDir: validate('_app', (input, keypath) => {
478
+ assert_string(input, keypath);
479
+
480
+ if (input) {
481
+ if (input.startsWith('/') || input.endsWith('/')) {
482
+ throw new Error(
483
+ "config.kit.appDir cannot start or end with '/'. See https://kit.svelte.dev/docs/configuration"
484
+ );
485
+ }
486
+ } else {
487
+ throw new Error(`${keypath} cannot be empty`);
488
+ }
489
+
490
+ return input;
491
+ }),
492
+
493
+ browser: object({
494
+ hydrate: boolean(true),
495
+ router: boolean(true)
496
+ }),
497
+
498
+ csp: object({
499
+ mode: list(['auto', 'hash', 'nonce']),
500
+ directives: object({
501
+ 'child-src': string_array(),
502
+ 'default-src': string_array(),
503
+ 'frame-src': string_array(),
504
+ 'worker-src': string_array(),
505
+ 'connect-src': string_array(),
506
+ 'font-src': string_array(),
507
+ 'img-src': string_array(),
508
+ 'manifest-src': string_array(),
509
+ 'media-src': string_array(),
510
+ 'object-src': string_array(),
511
+ 'prefetch-src': string_array(),
512
+ 'script-src': string_array(),
513
+ 'script-src-elem': string_array(),
514
+ 'script-src-attr': string_array(),
515
+ 'style-src': string_array(),
516
+ 'style-src-elem': string_array(),
517
+ 'style-src-attr': string_array(),
518
+ 'base-uri': string_array(),
519
+ sandbox: string_array(),
520
+ 'form-action': string_array(),
521
+ 'frame-ancestors': string_array(),
522
+ 'navigate-to': string_array(),
523
+ 'report-uri': string_array(),
524
+ 'report-to': string_array(),
525
+ 'require-trusted-types-for': string_array(),
526
+ 'trusted-types': string_array(),
527
+ 'upgrade-insecure-requests': boolean(false),
528
+ 'require-sri-for': string_array(),
529
+ 'block-all-mixed-content': boolean(false),
530
+ 'plugin-types': string_array(),
531
+ referrer: string_array()
532
+ })
533
+ }),
534
+
535
+ files: object({
536
+ assets: string('static'),
537
+ hooks: string(join('src', 'hooks')),
538
+ lib: string(join('src', 'lib')),
539
+ routes: string(join('src', 'routes')),
540
+ serviceWorker: string(join('src', 'service-worker')),
541
+ template: string(join('src', 'app.html'))
542
+ }),
543
+
544
+ floc: boolean(false),
545
+
546
+ // TODO: remove this for the 1.0 release
547
+ headers: error(
548
+ (keypath) =>
549
+ `${keypath} has been removed. See https://github.com/sveltejs/kit/pull/3384 for details`
550
+ ),
551
+
552
+ // TODO: remove this for the 1.0 release
553
+ host: error(
554
+ (keypath) =>
555
+ `${keypath} has been removed. See https://github.com/sveltejs/kit/pull/3384 for details`
556
+ ),
557
+
558
+ // TODO remove for 1.0
559
+ hydrate: error((keypath) => `${keypath} has been moved to config.kit.browser.hydrate`),
560
+
561
+ inlineStyleThreshold: number(0),
562
+
563
+ methodOverride: object({
564
+ parameter: string('_method'),
565
+ allowed: validate([], (input, keypath) => {
566
+ if (!Array.isArray(input) || !input.every((method) => typeof method === 'string')) {
567
+ throw new Error(`${keypath} must be an array of strings`);
568
+ }
569
+
570
+ if (input.map((i) => i.toUpperCase()).includes('GET')) {
571
+ throw new Error(`${keypath} cannot contain "GET"`);
572
+ }
573
+
574
+ return input;
575
+ })
576
+ }),
577
+
578
+ package: object({
579
+ dir: string('package'),
580
+ // excludes all .d.ts and filename starting with _
581
+ exports: fun((filepath) => !/^_|\/_|\.d\.ts$/.test(filepath)),
582
+ files: fun(() => true),
583
+ emitTypes: boolean(true)
584
+ }),
585
+
586
+ paths: object({
587
+ base: validate('', (input, keypath) => {
588
+ assert_string(input, keypath);
589
+
590
+ if (input !== '' && (input.endsWith('/') || !input.startsWith('/'))) {
591
+ throw new Error(
592
+ `${keypath} option must be a root-relative path that starts but doesn't end with '/'. See https://kit.svelte.dev/docs/configuration#paths`
593
+ );
594
+ }
595
+
596
+ return input;
597
+ }),
598
+ assets: validate('', (input, keypath) => {
599
+ assert_string(input, keypath);
600
+
601
+ if (input) {
602
+ if (!/^[a-z]+:\/\//.test(input)) {
603
+ throw new Error(
604
+ `${keypath} option must be an absolute path, if specified. See https://kit.svelte.dev/docs/configuration#paths`
605
+ );
606
+ }
607
+
608
+ if (input.endsWith('/')) {
609
+ throw new Error(
610
+ `${keypath} option must not end with '/'. See https://kit.svelte.dev/docs/configuration#paths`
611
+ );
612
+ }
613
+ }
614
+
615
+ return input;
616
+ })
617
+ }),
618
+
619
+ prerender: object({
620
+ concurrency: number(1),
621
+ crawl: boolean(true),
622
+ createIndexFiles: error(
623
+ (keypath) =>
624
+ `${keypath} has been removed — it is now controlled by the trailingSlash option. See https://kit.svelte.dev/docs/configuration#trailingslash`
625
+ ),
626
+ enabled: boolean(true),
627
+ entries: validate(['*'], (input, keypath) => {
628
+ if (!Array.isArray(input) || !input.every((page) => typeof page === 'string')) {
629
+ throw new Error(`${keypath} must be an array of strings`);
630
+ }
631
+
632
+ input.forEach((page) => {
633
+ if (page !== '*' && page[0] !== '/') {
634
+ throw new Error(
635
+ `Each member of ${keypath} must be either '*' or an absolute path beginning with '/' — saw '${page}'`
636
+ );
637
+ }
638
+ });
639
+
640
+ return input;
641
+ }),
642
+
643
+ // TODO: remove this for the 1.0 release
644
+ force: validate(undefined, (input, keypath) => {
645
+ if (typeof input !== undefined) {
646
+ const newSetting = input ? 'continue' : 'fail';
647
+ const needsSetting = newSetting === 'continue';
648
+ throw new Error(
649
+ `${keypath} has been removed in favor of \`onError\`. In your case, set \`onError\` to "${newSetting}"${
650
+ needsSetting ? '' : ' (or leave it undefined)'
651
+ } to get the same behavior as you would with \`force: ${JSON.stringify(input)}\``
652
+ );
653
+ }
654
+ }),
655
+
656
+ onError: validate('fail', (input, keypath) => {
657
+ if (typeof input === 'function') return input;
658
+ if (['continue', 'fail'].includes(input)) return input;
659
+ throw new Error(
660
+ `${keypath} should be either a custom function or one of "continue" or "fail"`
661
+ );
662
+ }),
663
+
664
+ // TODO: remove this for the 1.0 release
665
+ pages: error((keypath) => `${keypath} has been renamed to \`entries\`.`)
666
+ }),
667
+
668
+ // TODO: remove this for the 1.0 release
669
+ protocol: error(
670
+ (keypath) =>
671
+ `${keypath} has been removed. See https://github.com/sveltejs/kit/pull/3384 for details`
672
+ ),
673
+
674
+ // TODO remove for 1.0
675
+ router: error((keypath) => `${keypath} has been moved to config.kit.browser.router`),
676
+
677
+ routes: fun((filepath) => !/(?:(?:^_|\/_)|(?:^\.|\/\.)(?!well-known))/.test(filepath)),
678
+
679
+ serviceWorker: object({
680
+ register: boolean(true),
681
+ files: fun((filename) => !/\.DS_Store/.test(filename))
682
+ }),
683
+
684
+ // TODO remove this for 1.0
685
+ ssr: error(
686
+ (keypath) =>
687
+ `${keypath} has been removed — use the handle hook instead: https://kit.svelte.dev/docs/hooks#handle'`
688
+ ),
689
+
690
+ // TODO remove this for 1.0
691
+ target: error((keypath) => `${keypath} is no longer required, and should be removed`),
692
+
693
+ trailingSlash: list(['never', 'always', 'ignore']),
694
+
695
+ version: object({
696
+ name: string(Date.now().toString()),
697
+ pollInterval: number(0)
698
+ }),
699
+
700
+ vite: validate(
701
+ () => ({}),
702
+ (input, keypath) => {
703
+ if (typeof input === 'object') {
704
+ const config = input;
705
+ input = () => config;
706
+ }
707
+
708
+ if (typeof input !== 'function') {
709
+ throw new Error(
710
+ `${keypath} must be a Vite config object (https://vitejs.dev/config) or a function that returns one`
711
+ );
712
+ }
713
+
714
+ return input;
715
+ }
716
+ )
717
+ })
718
+ },
719
+ true
720
+ );
721
+
722
+ /**
723
+ * @param {Record<string, Validator>} children
724
+ * @param {boolean} [allow_unknown]
725
+ * @returns {Validator}
726
+ */
727
+ function object(children, allow_unknown = false) {
728
+ return (input, keypath) => {
729
+ /** @type {Record<string, any>} */
730
+ const output = {};
731
+
732
+ if ((input && typeof input !== 'object') || Array.isArray(input)) {
733
+ throw new Error(`${keypath} should be an object`);
734
+ }
735
+
736
+ for (const key in input) {
737
+ if (!(key in children)) {
738
+ if (allow_unknown) {
739
+ output[key] = input[key];
740
+ } else {
741
+ let message = `Unexpected option ${keypath}.${key}`;
742
+
743
+ // special case
744
+ if (keypath === 'config.kit' && key in options) {
745
+ message += ` (did you mean config.${key}?)`;
746
+ }
747
+
748
+ throw new Error(message);
749
+ }
750
+ }
751
+ }
752
+
753
+ for (const key in children) {
754
+ const validator = children[key];
755
+ output[key] = validator(input && input[key], `${keypath}.${key}`);
756
+ }
757
+
758
+ return output;
759
+ };
760
+ }
761
+
762
+ /**
763
+ * @param {any} fallback
764
+ * @param {(value: any, keypath: string) => any} fn
765
+ * @returns {Validator}
766
+ */
767
+ function validate(fallback, fn) {
768
+ return (input, keypath) => {
769
+ return input === undefined ? fallback : fn(input, keypath);
770
+ };
771
+ }
772
+
773
+ /**
774
+ * @param {string | null} fallback
775
+ * @param {boolean} allow_empty
776
+ * @returns {Validator}
777
+ */
778
+ function string(fallback, allow_empty = true) {
779
+ return validate(fallback, (input, keypath) => {
780
+ assert_string(input, keypath);
781
+
782
+ if (!allow_empty && input === '') {
783
+ throw new Error(`${keypath} cannot be empty`);
784
+ }
785
+
786
+ return input;
787
+ });
788
+ }
789
+
790
+ /**
791
+ * @param {string[] | undefined} [fallback]
792
+ * @returns {Validator}
793
+ */
794
+ function string_array(fallback) {
795
+ return validate(fallback, (input, keypath) => {
796
+ if (input === undefined) return input;
797
+
798
+ if (!Array.isArray(input) || input.some((value) => typeof value !== 'string')) {
799
+ throw new Error(`${keypath} must be an array of strings, if specified`);
800
+ }
801
+
802
+ return input;
803
+ });
804
+ }
805
+
806
+ /**
807
+ * @param {number} fallback
808
+ * @returns {Validator}
809
+ */
810
+ function number(fallback) {
811
+ return validate(fallback, (input, keypath) => {
812
+ if (typeof input !== 'number') {
813
+ throw new Error(`${keypath} should be a number, if specified`);
814
+ }
815
+ return input;
816
+ });
817
+ }
818
+
819
+ /**
820
+ * @param {boolean} fallback
821
+ * @returns {Validator}
822
+ */
823
+ function boolean(fallback) {
824
+ return validate(fallback, (input, keypath) => {
825
+ if (typeof input !== 'boolean') {
826
+ throw new Error(`${keypath} should be true or false, if specified`);
827
+ }
828
+ return input;
829
+ });
830
+ }
831
+
832
+ /**
833
+ * @param {string[]} options
834
+ * @returns {Validator}
835
+ */
836
+ function list(options, fallback = options[0]) {
837
+ return validate(fallback, (input, keypath) => {
838
+ if (!options.includes(input)) {
839
+ // prettier-ignore
840
+ const msg = options.length > 2
841
+ ? `${keypath} should be one of ${options.slice(0, -1).map(input => `"${input}"`).join(', ')} or "${options[options.length - 1]}"`
842
+ : `${keypath} should be either "${options[0]}" or "${options[1]}"`;
843
+
844
+ throw new Error(msg);
845
+ }
846
+ return input;
847
+ });
848
+ }
849
+
850
+ /**
851
+ * @param {(filename: string) => boolean} fallback
852
+ * @returns {Validator}
853
+ */
854
+ function fun(fallback) {
855
+ return validate(fallback, (input, keypath) => {
856
+ if (typeof input !== 'function') {
857
+ throw new Error(`${keypath} should be a function, if specified`);
858
+ }
859
+ return input;
860
+ });
861
+ }
862
+
863
+ /**
864
+ * @param {string} input
865
+ * @param {string} keypath
866
+ */
867
+ function assert_string(input, keypath) {
868
+ if (typeof input !== 'string') {
869
+ throw new Error(`${keypath} should be a string, if specified`);
870
+ }
871
+ }
872
+
873
+ /** @param {(keypath?: string) => string} fn */
874
+ function error(fn) {
875
+ return validate(undefined, (input, keypath) => {
876
+ if (input !== undefined) {
877
+ throw new Error(fn(keypath));
878
+ }
879
+ });
880
+ }
881
+
882
+ /**
883
+ * @param {string} cwd
884
+ * @param {import('types').ValidatedConfig} config
885
+ */
886
+ function load_template(cwd, config) {
887
+ const { template } = config.kit.files;
888
+ const relative = path__default.relative(cwd, template);
889
+
890
+ if (fs__default.existsSync(template)) {
891
+ const contents = fs__default.readFileSync(template, 'utf8');
892
+ const expected_tags = ['%svelte.head%', '%svelte.body%'];
893
+ expected_tags.forEach((tag) => {
894
+ if (contents.indexOf(tag) === -1) {
895
+ throw new Error(`${relative} is missing ${tag}`);
896
+ }
897
+ });
898
+ } else {
899
+ throw new Error(`${relative} does not exist`);
900
+ }
901
+
902
+ return fs__default.readFileSync(template, 'utf-8');
903
+ }
904
+
905
+ async function load_config({ cwd = process.cwd() } = {}) {
906
+ const config_file = path__default.join(cwd, 'svelte.config.js');
907
+
908
+ if (!fs__default.existsSync(config_file)) {
909
+ throw new Error(
910
+ 'You need to create a svelte.config.js file. See https://kit.svelte.dev/docs/configuration'
911
+ );
912
+ }
913
+
914
+ const config = await import(url.pathToFileURL(config_file).href);
915
+
916
+ const validated = validate_config(config.default);
917
+
918
+ validated.kit.files.assets = path__default.resolve(cwd, validated.kit.files.assets);
919
+ validated.kit.files.hooks = path__default.resolve(cwd, validated.kit.files.hooks);
920
+ validated.kit.files.lib = path__default.resolve(cwd, validated.kit.files.lib);
921
+ validated.kit.files.routes = path__default.resolve(cwd, validated.kit.files.routes);
922
+ validated.kit.files.serviceWorker = path__default.resolve(cwd, validated.kit.files.serviceWorker);
923
+ validated.kit.files.template = path__default.resolve(cwd, validated.kit.files.template);
924
+
925
+ return validated;
926
+ }
927
+
928
+ /**
929
+ * @param {import('types').Config} config
930
+ * @returns {import('types').ValidatedConfig}
931
+ */
932
+ function validate_config(config) {
933
+ if (typeof config !== 'object') {
934
+ throw new Error(
935
+ 'svelte.config.js must have a configuration object as its default export. See https://kit.svelte.dev/docs/configuration'
936
+ );
937
+ }
938
+
939
+ return options(config, 'config');
940
+ }
941
+
942
+ /**
943
+ * @param {string[]} conflicts - array of conflicts in dotted notation
944
+ * @param {string=} pathPrefix - prepended in front of the path
945
+ * @param {string=} scope - used to prefix the whole error message
946
+ */
947
+ function print_config_conflicts(conflicts, pathPrefix = '', scope) {
948
+ const prefix = scope ? scope + ': ' : '';
949
+ const log = logger({ verbose: false });
950
+ conflicts.forEach((conflict) => {
951
+ log.error(
952
+ `${prefix}The value for ${pathPrefix}${conflict} specified in svelte.config.js has been ignored. This option is controlled by SvelteKit.`
953
+ );
954
+ });
955
+ }
956
+
957
+ /**
958
+ * @param {unknown} err
959
+ * @return {Error}
960
+ */
961
+ function coalesce_to_error(err) {
962
+ return err instanceof Error ||
963
+ (err && /** @type {any} */ (err).name && /** @type {any} */ (err).message)
964
+ ? /** @type {Error} */ (err)
965
+ : new Error(JSON.stringify(err));
966
+ }
967
+
968
+ /** @param {unknown} e */
969
+ function handle_error(e) {
970
+ const error = coalesce_to_error(e);
971
+
972
+ if (error.name === 'SyntaxError') throw error;
973
+
974
+ console.error($.bold().red(`> ${error.message}`));
975
+ if (error.stack) {
976
+ console.error($.gray(error.stack.split('\n').slice(1).join('\n')));
977
+ }
978
+
56
979
  process.exit(1);
57
980
  }
58
981
 
59
- async function launch(port) {
60
- const { exec } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('child_process')); });
61
- exec(`${process.platform == 'win32' ? 'start' : 'open'} http://localhost:${port}`);
982
+ /**
983
+ * @param {number} port
984
+ * @param {boolean} https
985
+ */
986
+ async function launch(port, https) {
987
+ const { exec } = await import('child_process');
988
+ let cmd = 'open';
989
+ if (process.platform == 'win32') {
990
+ cmd = 'start';
991
+ } else if (process.platform == 'linux') {
992
+ if (/microsoft/i.test(release())) {
993
+ cmd = 'cmd.exe /c start';
994
+ } else {
995
+ cmd = 'xdg-open';
996
+ }
997
+ }
998
+ exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
62
999
  }
63
1000
 
64
- const prog = sade__default['default']('svelte').version(version);
1001
+ const prog = sade('svelte-kit').version('1.0.0-next.282');
65
1002
 
66
1003
  prog
67
1004
  .command('dev')
68
1005
  .describe('Start a development server')
69
- .option('-p, --port', 'Port', 3000)
70
- .option('-o, --open', 'Open a browser tab', false)
71
- .action(async ({ port, open }) => {
72
- process.env.NODE_ENV = 'development';
73
- const config = get_config();
1006
+ .option('-p, --port', 'Port')
1007
+ .option('-o, --open', 'Open a browser tab')
1008
+ .option('--host', 'Host (only use this on trusted networks)')
1009
+ .option('--https', 'Use self-signed HTTPS certificate')
1010
+ .option('-H', 'no longer supported, use --https instead') // TODO remove for 1.0
1011
+ .action(async ({ port, host, https, open, H }) => {
1012
+ try {
1013
+ if (H) throw new Error('-H is no longer supported — use --https instead');
74
1014
 
75
- const { dev } = await Promise.resolve().then(function () { return require('./index2.js'); });
1015
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development';
1016
+ const config = await load_config();
76
1017
 
77
- try {
78
- const watcher = await dev({ port, config });
1018
+ const { dev } = await import('./chunks/index.js');
79
1019
 
80
- watcher.on('stdout', (data) => {
81
- process.stdout.write(data);
82
- });
1020
+ const cwd = process.cwd();
83
1021
 
84
- watcher.on('stderr', (data) => {
85
- process.stderr.write(data);
1022
+ const { address_info, server_config } = await dev({
1023
+ cwd,
1024
+ port,
1025
+ host,
1026
+ https,
1027
+ config
86
1028
  });
87
1029
 
88
- console.log(index.$.bold().cyan(`> Listening on http://localhost:${watcher.port}`));
89
- if (open) launch(watcher.port);
1030
+ welcome({
1031
+ port: address_info.port,
1032
+ host: address_info.address,
1033
+ https: !!(https || server_config.https),
1034
+ open: open || !!server_config.open,
1035
+ loose: server_config.fs.strict === false,
1036
+ allow: server_config.fs.allow,
1037
+ cwd
1038
+ });
90
1039
  } catch (error) {
91
1040
  handle_error(error);
92
1041
  }
@@ -95,56 +1044,153 @@ prog
95
1044
  prog
96
1045
  .command('build')
97
1046
  .describe('Create a production build of your app')
98
- .action(async () => {
99
- process.env.NODE_ENV = 'production';
100
- const config = get_config();
1047
+ .option('--verbose', 'Log more stuff', false)
1048
+ .action(async ({ verbose }) => {
1049
+ try {
1050
+ process.env.NODE_ENV = process.env.NODE_ENV || 'production';
1051
+ const config = await load_config();
101
1052
 
102
- const { build } = await Promise.resolve().then(function () { return require('./index3.js'); });
1053
+ const { build } = await import('./chunks/index3.js');
1054
+ const build_data = await build(config);
103
1055
 
104
- try {
105
- await build(config);
1056
+ console.log(
1057
+ `\nRun ${$.bold().cyan('npm run preview')} to preview your production build locally.`
1058
+ );
1059
+
1060
+ if (config.kit.adapter) {
1061
+ const { adapt } = await import('./chunks/index5.js');
1062
+ await adapt(config, build_data, { verbose });
1063
+
1064
+ // this is necessary to close any open db connections, etc
1065
+ process.exit(0);
1066
+ }
1067
+
1068
+ console.log($.bold().yellow('\nNo adapter specified'));
1069
+
1070
+ // prettier-ignore
1071
+ console.log(
1072
+ `See ${$.bold().cyan('https://kit.svelte.dev/docs/adapters')} to learn how to configure your app to run on the platform of your choosing`
1073
+ );
106
1074
  } catch (error) {
107
1075
  handle_error(error);
108
1076
  }
109
1077
  });
110
1078
 
111
1079
  prog
112
- .command('start')
1080
+ .command('preview')
113
1081
  .describe('Serve an already-built app')
114
1082
  .option('-p, --port', 'Port', 3000)
115
1083
  .option('-o, --open', 'Open a browser tab', false)
116
- .action(async ({ port, open }) => {
117
- process.env.NODE_ENV = 'production';
118
- const config = get_config();
1084
+ .option('--host', 'Host (only use this on trusted networks)', 'localhost')
1085
+ .option('--https', 'Use self-signed HTTPS certificate', false)
1086
+ .option('-H', 'no longer supported, use --https instead') // TODO remove for 1.0
1087
+ .action(async ({ port, host, https, open, H }) => {
1088
+ try {
1089
+ if (H) throw new Error('-H is no longer supported — use --https instead');
119
1090
 
120
- const { start } = await Promise.resolve().then(function () { return require('./index4.js'); });
1091
+ await check_port(port);
121
1092
 
122
- try {
123
- await start({ port, config });
1093
+ process.env.NODE_ENV = process.env.NODE_ENV || 'production';
1094
+ const config = await load_config();
1095
+
1096
+ const { preview } = await import('./chunks/index6.js');
124
1097
 
125
- console.log(index.$.bold().cyan(`> Listening on http://localhost:${port}`));
126
- if (open) if (open) launch(port);
1098
+ await preview({ port, host, config, https });
1099
+
1100
+ welcome({ port, host, https, open });
127
1101
  } catch (error) {
128
1102
  handle_error(error);
129
1103
  }
130
1104
  });
131
1105
 
132
1106
  prog
133
- .command('adapt')
134
- .describe('Customise your production build for different platforms')
135
- .option('--verbose', 'Log more stuff', false)
136
- .action(async ({ verbose }) => {
137
- process.env.NODE_ENV = 'production';
138
- const config = get_config();
1107
+ .command('package')
1108
+ .describe('Create a package')
1109
+ .option('-d, --dir', 'Destination directory', 'package')
1110
+ .action(async () => {
1111
+ try {
1112
+ const config = await load_config();
139
1113
 
140
- const { adapt } = await Promise.resolve().then(function () { return require('./index6.js'); });
1114
+ const { make_package } = await import('./chunks/index7.js');
141
1115
 
142
- try {
143
- await adapt(config, { verbose });
1116
+ await make_package(config);
144
1117
  } catch (error) {
145
1118
  handle_error(error);
146
1119
  }
147
1120
  });
148
1121
 
149
1122
  prog.parse(process.argv, { unknown: (arg) => `Unknown option: ${arg}` });
150
- //# sourceMappingURL=cli.js.map
1123
+
1124
+ /** @param {number} port */
1125
+ async function check_port(port) {
1126
+ if (await check(port)) {
1127
+ return;
1128
+ }
1129
+ console.error($.bold().red(`Port ${port} is occupied`));
1130
+ const n = await blame(port);
1131
+ if (n) {
1132
+ // prettier-ignore
1133
+ console.error(
1134
+ `Terminate process ${$.bold(n)} or specify a different port with ${$.bold('--port')}\n`
1135
+ );
1136
+ } else {
1137
+ // prettier-ignore
1138
+ console.error(
1139
+ `Terminate the process occupying the port or specify a different port with ${$.bold('--port')}\n`
1140
+ );
1141
+ }
1142
+ process.exit(1);
1143
+ }
1144
+
1145
+ /**
1146
+ * @param {{
1147
+ * open: boolean;
1148
+ * host: string;
1149
+ * https: boolean;
1150
+ * port: number;
1151
+ * loose?: boolean;
1152
+ * allow?: string[];
1153
+ * cwd?: string;
1154
+ * }} param0
1155
+ */
1156
+ function welcome({ port, host, https, open, loose, allow, cwd }) {
1157
+ if (open) launch(port, https);
1158
+
1159
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.282'}\n`));
1160
+
1161
+ const protocol = https ? 'https:' : 'http:';
1162
+ const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
1163
+
1164
+ Object.values(networkInterfaces()).forEach((interfaces) => {
1165
+ if (!interfaces) return;
1166
+ interfaces.forEach((details) => {
1167
+ if (details.family !== 'IPv4') return;
1168
+
1169
+ // prettier-ignore
1170
+ if (details.internal) {
1171
+ console.log(` ${$.gray('local: ')} ${protocol}//${$.bold(`localhost:${port}`)}`);
1172
+ } else {
1173
+ if (details.mac === '00:00:00:00:00:00') return;
1174
+
1175
+ if (exposed) {
1176
+ console.log(` ${$.gray('network:')} ${protocol}//${$.bold(`${details.address}:${port}`)}`);
1177
+ if (loose) {
1178
+ console.log(`\n ${$.yellow('Serving with vite.server.fs.strict: false. Note that all files on your machine will be accessible to anyone on your network.')}`);
1179
+ } else if (allow?.length && cwd) {
1180
+ console.log(`\n ${$.yellow('Note that all files in the following directories will be accessible to anyone on your network: ' + allow.map(a => relative(cwd, a)).join(', '))}`);
1181
+ }
1182
+ } else {
1183
+ console.log(` ${$.gray('network: not exposed')}`);
1184
+ }
1185
+ }
1186
+ });
1187
+ });
1188
+
1189
+ if (!exposed) {
1190
+ console.log('\n Use --host to expose server to other devices on this network');
1191
+ }
1192
+
1193
+ console.log('\n');
1194
+ }
1195
+
1196
+ export { $, SVELTE_KIT_ASSETS as S, resolve_entry as a, SVELTE_KIT as b, coalesce_to_error as c, copy_assets as d, get_aliases as e, posixify as f, get_mime_lookup as g, rimraf as h, copy as i, logger as j, load_template as l, mkdirp as m, print_config_conflicts as p, runtime as r, walk as w };