@sveltejs/kit 1.0.0-next.29 → 1.0.0-next.290

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