@sveltejs/kit 1.0.0-next.50 → 1.0.0-next.500

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 (125) hide show
  1. package/README.md +12 -9
  2. package/package.json +94 -67
  3. package/postinstall.js +38 -0
  4. package/scripts/special-types/$env+dynamic+private.md +10 -0
  5. package/scripts/special-types/$env+dynamic+public.md +8 -0
  6. package/scripts/special-types/$env+static+private.md +19 -0
  7. package/scripts/special-types/$env+static+public.md +7 -0
  8. package/scripts/special-types/$lib.md +5 -0
  9. package/src/cli.js +108 -0
  10. package/src/constants.js +7 -0
  11. package/src/core/adapt/builder.js +206 -0
  12. package/src/core/adapt/index.js +31 -0
  13. package/src/core/config/default-error.html +56 -0
  14. package/src/core/config/index.js +110 -0
  15. package/src/core/config/options.js +504 -0
  16. package/src/core/config/types.d.ts +1 -0
  17. package/src/core/env.js +121 -0
  18. package/src/core/generate_manifest/index.js +93 -0
  19. package/src/core/prerender/crawl.js +198 -0
  20. package/src/core/prerender/entities.js +2252 -0
  21. package/src/core/prerender/prerender.js +431 -0
  22. package/src/core/prerender/queue.js +80 -0
  23. package/src/core/sync/create_manifest_data/index.js +488 -0
  24. package/src/core/sync/create_manifest_data/types.d.ts +37 -0
  25. package/src/core/sync/sync.js +70 -0
  26. package/src/core/sync/utils.js +33 -0
  27. package/src/core/sync/write_ambient.js +53 -0
  28. package/src/core/sync/write_client_manifest.js +106 -0
  29. package/src/core/sync/write_matchers.js +25 -0
  30. package/src/core/sync/write_root.js +91 -0
  31. package/src/core/sync/write_tsconfig.js +195 -0
  32. package/src/core/sync/write_types/index.js +678 -0
  33. package/src/core/utils.js +70 -0
  34. package/src/exports/hooks/index.js +1 -0
  35. package/src/exports/hooks/sequence.js +44 -0
  36. package/src/exports/index.js +45 -0
  37. package/src/exports/node/index.js +173 -0
  38. package/src/exports/node/polyfills.js +41 -0
  39. package/src/exports/vite/build/build_server.js +378 -0
  40. package/src/exports/vite/build/build_service_worker.js +90 -0
  41. package/src/exports/vite/build/utils.js +180 -0
  42. package/src/exports/vite/dev/index.js +577 -0
  43. package/src/exports/vite/graph_analysis/index.js +277 -0
  44. package/src/exports/vite/graph_analysis/types.d.ts +5 -0
  45. package/src/exports/vite/graph_analysis/utils.js +30 -0
  46. package/src/exports/vite/index.js +598 -0
  47. package/src/exports/vite/preview/index.js +189 -0
  48. package/src/exports/vite/types.d.ts +3 -0
  49. package/src/exports/vite/utils.js +157 -0
  50. package/src/runtime/app/env.js +1 -0
  51. package/src/runtime/app/environment.js +11 -0
  52. package/src/runtime/app/forms.js +114 -0
  53. package/src/runtime/app/navigation.js +23 -0
  54. package/src/runtime/app/paths.js +1 -0
  55. package/src/runtime/app/stores.js +102 -0
  56. package/src/runtime/client/ambient.d.ts +26 -0
  57. package/src/runtime/client/client.js +1583 -0
  58. package/src/runtime/client/fetcher.js +107 -0
  59. package/src/runtime/client/parse.js +60 -0
  60. package/src/runtime/client/singletons.js +21 -0
  61. package/src/runtime/client/start.js +37 -0
  62. package/src/runtime/client/types.d.ts +84 -0
  63. package/src/runtime/client/utils.js +159 -0
  64. package/src/runtime/components/error.svelte +16 -0
  65. package/{assets → src/runtime}/components/layout.svelte +0 -0
  66. package/src/runtime/control.js +98 -0
  67. package/src/runtime/env/dynamic/private.js +1 -0
  68. package/src/runtime/env/dynamic/public.js +1 -0
  69. package/src/runtime/env-private.js +6 -0
  70. package/src/runtime/env-public.js +6 -0
  71. package/src/runtime/env.js +6 -0
  72. package/src/runtime/hash.js +16 -0
  73. package/src/runtime/paths.js +11 -0
  74. package/src/runtime/server/cookie.js +127 -0
  75. package/src/runtime/server/data/index.js +136 -0
  76. package/src/runtime/server/endpoint.js +90 -0
  77. package/src/runtime/server/index.js +340 -0
  78. package/src/runtime/server/page/actions.js +243 -0
  79. package/src/runtime/server/page/crypto.js +239 -0
  80. package/src/runtime/server/page/csp.js +250 -0
  81. package/src/runtime/server/page/fetch.js +301 -0
  82. package/src/runtime/server/page/index.js +304 -0
  83. package/src/runtime/server/page/load_data.js +124 -0
  84. package/src/runtime/server/page/render.js +342 -0
  85. package/src/runtime/server/page/respond_with_error.js +104 -0
  86. package/src/runtime/server/page/serialize_data.js +87 -0
  87. package/src/runtime/server/page/types.d.ts +41 -0
  88. package/src/runtime/server/utils.js +179 -0
  89. package/src/utils/array.js +9 -0
  90. package/src/utils/error.js +22 -0
  91. package/src/utils/escape.js +46 -0
  92. package/src/utils/filesystem.js +137 -0
  93. package/src/utils/functions.js +16 -0
  94. package/src/utils/http.js +55 -0
  95. package/src/utils/misc.js +1 -0
  96. package/src/utils/routing.js +117 -0
  97. package/src/utils/unit_test.js +11 -0
  98. package/src/utils/url.js +142 -0
  99. package/svelte-kit.js +1 -1
  100. package/types/ambient.d.ts +426 -0
  101. package/types/index.d.ts +444 -0
  102. package/types/internal.d.ts +378 -0
  103. package/types/private.d.ts +224 -0
  104. package/CHANGELOG.md +0 -484
  105. package/assets/components/error.svelte +0 -13
  106. package/assets/runtime/app/env.js +0 -5
  107. package/assets/runtime/app/navigation.js +0 -44
  108. package/assets/runtime/app/paths.js +0 -1
  109. package/assets/runtime/app/stores.js +0 -93
  110. package/assets/runtime/chunks/utils.js +0 -22
  111. package/assets/runtime/internal/singletons.js +0 -23
  112. package/assets/runtime/internal/start.js +0 -779
  113. package/assets/runtime/paths.js +0 -12
  114. package/dist/chunks/index.js +0 -3516
  115. package/dist/chunks/index2.js +0 -587
  116. package/dist/chunks/index3.js +0 -246
  117. package/dist/chunks/index4.js +0 -528
  118. package/dist/chunks/index5.js +0 -763
  119. package/dist/chunks/index6.js +0 -322
  120. package/dist/chunks/standard.js +0 -99
  121. package/dist/chunks/utils.js +0 -83
  122. package/dist/cli.js +0 -550
  123. package/dist/ssr.js +0 -2588
  124. package/types.d.ts +0 -89
  125. package/types.internal.d.ts +0 -191
package/dist/cli.js DELETED
@@ -1,550 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import sade from 'sade';
3
- import { pathToFileURL, resolve as resolve$1 } from 'url';
4
- import path from 'path';
5
-
6
- let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
7
- if (typeof process !== 'undefined') {
8
- ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env);
9
- isTTY = process.stdout && process.stdout.isTTY;
10
- }
11
-
12
- const $ = {
13
- enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
14
- FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
15
- ),
16
-
17
- // modifiers
18
- reset: init(0, 0),
19
- bold: init(1, 22),
20
- dim: init(2, 22),
21
- italic: init(3, 23),
22
- underline: init(4, 24),
23
- inverse: init(7, 27),
24
- hidden: init(8, 28),
25
- strikethrough: init(9, 29),
26
-
27
- // colors
28
- black: init(30, 39),
29
- red: init(31, 39),
30
- green: init(32, 39),
31
- yellow: init(33, 39),
32
- blue: init(34, 39),
33
- magenta: init(35, 39),
34
- cyan: init(36, 39),
35
- white: init(37, 39),
36
- gray: init(90, 39),
37
- grey: init(90, 39),
38
-
39
- // background colors
40
- bgBlack: init(40, 49),
41
- bgRed: init(41, 49),
42
- bgGreen: init(42, 49),
43
- bgYellow: init(43, 49),
44
- bgBlue: init(44, 49),
45
- bgMagenta: init(45, 49),
46
- bgCyan: init(46, 49),
47
- bgWhite: init(47, 49)
48
- };
49
-
50
- function run(arr, str) {
51
- let i=0, tmp, beg='', end='';
52
- for (; i < arr.length; i++) {
53
- tmp = arr[i];
54
- beg += tmp.open;
55
- end += tmp.close;
56
- if (!!~str.indexOf(tmp.close)) {
57
- str = str.replace(tmp.rgx, tmp.close + tmp.open);
58
- }
59
- }
60
- return beg + str + end;
61
- }
62
-
63
- function chain(has, keys) {
64
- let ctx = { has, keys };
65
-
66
- ctx.reset = $.reset.bind(ctx);
67
- ctx.bold = $.bold.bind(ctx);
68
- ctx.dim = $.dim.bind(ctx);
69
- ctx.italic = $.italic.bind(ctx);
70
- ctx.underline = $.underline.bind(ctx);
71
- ctx.inverse = $.inverse.bind(ctx);
72
- ctx.hidden = $.hidden.bind(ctx);
73
- ctx.strikethrough = $.strikethrough.bind(ctx);
74
-
75
- ctx.black = $.black.bind(ctx);
76
- ctx.red = $.red.bind(ctx);
77
- ctx.green = $.green.bind(ctx);
78
- ctx.yellow = $.yellow.bind(ctx);
79
- ctx.blue = $.blue.bind(ctx);
80
- ctx.magenta = $.magenta.bind(ctx);
81
- ctx.cyan = $.cyan.bind(ctx);
82
- ctx.white = $.white.bind(ctx);
83
- ctx.gray = $.gray.bind(ctx);
84
- ctx.grey = $.grey.bind(ctx);
85
-
86
- ctx.bgBlack = $.bgBlack.bind(ctx);
87
- ctx.bgRed = $.bgRed.bind(ctx);
88
- ctx.bgGreen = $.bgGreen.bind(ctx);
89
- ctx.bgYellow = $.bgYellow.bind(ctx);
90
- ctx.bgBlue = $.bgBlue.bind(ctx);
91
- ctx.bgMagenta = $.bgMagenta.bind(ctx);
92
- ctx.bgCyan = $.bgCyan.bind(ctx);
93
- ctx.bgWhite = $.bgWhite.bind(ctx);
94
-
95
- return ctx;
96
- }
97
-
98
- function init(open, close) {
99
- let blk = {
100
- open: `\x1b[${open}m`,
101
- close: `\x1b[${close}m`,
102
- rgx: new RegExp(`\\x1b\\[${close}m`, 'g')
103
- };
104
- return function (txt) {
105
- if (this !== void 0 && this.has !== void 0) {
106
- !!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk));
107
- return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';
108
- }
109
- return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';
110
- };
111
- }
112
-
113
- const noop = () => {};
114
-
115
- /** @typedef {import('./types').ConfigDefinition} ConfigDefinition */
116
-
117
- /** @type {Record<string, ConfigDefinition>} */
118
- const options = {
119
- compilerOptions: {
120
- type: 'leaf',
121
- default: null,
122
- validate: noop
123
- },
124
-
125
- extensions: {
126
- type: 'leaf',
127
- default: ['.svelte'],
128
- validate: (option, keypath) => {
129
- if (!Array.isArray(option) || !option.every((page) => typeof page === 'string')) {
130
- throw new Error(`${keypath} must be an array of strings`);
131
- }
132
-
133
- option.forEach((extension) => {
134
- if (extension[0] !== '.') {
135
- throw new Error(`Each member of ${keypath} must start with '.' — saw '${extension}'`);
136
- }
137
-
138
- if (!/^(\.[a-z0-9]+)+$/i.test(extension)) {
139
- throw new Error(`File extensions must be alphanumeric — saw '${extension}'`);
140
- }
141
- });
142
-
143
- return option;
144
- }
145
- },
146
-
147
- kit: {
148
- type: 'branch',
149
- children: {
150
- adapter: {
151
- type: 'leaf',
152
- default: [null],
153
- validate: (option, keypath) => {
154
- // support both `adapter: 'foo'` and `adapter: ['foo', opts]`
155
- if (!Array.isArray(option)) {
156
- option = [option];
157
- }
158
-
159
- // TODO allow inline functions
160
- assert_is_string(option[0], keypath);
161
-
162
- return option;
163
- }
164
- },
165
-
166
- amp: expect_boolean(false),
167
-
168
- appDir: expect_string('_app', false),
169
-
170
- files: {
171
- type: 'branch',
172
- children: {
173
- assets: expect_string('static'),
174
- lib: expect_string('src/lib'),
175
- routes: expect_string('src/routes'),
176
- serviceWorker: expect_string('src/service-worker'),
177
- setup: expect_string('src/setup'),
178
- template: expect_string('src/app.html')
179
- }
180
- },
181
-
182
- host: expect_string(null),
183
-
184
- hostHeader: expect_string(null),
185
-
186
- paths: {
187
- type: 'branch',
188
- children: {
189
- base: expect_string(''),
190
- assets: expect_string('')
191
- }
192
- },
193
-
194
- prerender: {
195
- type: 'branch',
196
- children: {
197
- crawl: expect_boolean(true),
198
- enabled: expect_boolean(true),
199
- force: expect_boolean(false),
200
- pages: {
201
- type: 'leaf',
202
- default: ['*'],
203
- validate: (option, keypath) => {
204
- if (!Array.isArray(option) || !option.every((page) => typeof page === 'string')) {
205
- throw new Error(`${keypath} must be an array of strings`);
206
- }
207
-
208
- option.forEach((page) => {
209
- if (page !== '*' && page[0] !== '/') {
210
- throw new Error(
211
- `Each member of ${keypath} must be either '*' or an absolute path beginning with '/' — saw '${page}'`
212
- );
213
- }
214
- });
215
-
216
- return option;
217
- }
218
- }
219
- }
220
- },
221
-
222
- target: expect_string(null)
223
- }
224
- },
225
-
226
- preprocess: {
227
- type: 'leaf',
228
- default: null,
229
- validate: noop
230
- }
231
- };
232
-
233
- /**
234
- * @param {string} string
235
- * @param {boolean} allow_empty
236
- * @returns {ConfigDefinition}
237
- */
238
- function expect_string(string, allow_empty = true) {
239
- return {
240
- type: 'leaf',
241
- default: string,
242
- validate: (option, keypath) => {
243
- assert_is_string(option, keypath);
244
- if (!allow_empty && option === '') {
245
- throw new Error(`${keypath} cannot be empty`);
246
- }
247
- return option;
248
- }
249
- };
250
- }
251
-
252
- /**
253
- * @param {boolean} boolean
254
- * @returns {ConfigDefinition}
255
- */
256
- function expect_boolean(boolean) {
257
- return {
258
- type: 'leaf',
259
- default: boolean,
260
- validate: (option, keypath) => {
261
- if (typeof option !== 'boolean') {
262
- throw new Error(`${keypath} should be true or false, if specified`);
263
- }
264
- return option;
265
- }
266
- };
267
- }
268
-
269
- /**
270
- * @param {any} option
271
- * @param {string} keypath
272
- */
273
- function assert_is_string(option, keypath) {
274
- if (typeof option !== 'string') {
275
- throw new Error(`${keypath} should be a string, if specified`);
276
- }
277
- }
278
-
279
- /** @typedef {import('./types').ConfigDefinition} ConfigDefinition */
280
-
281
- /**
282
- * @param {Record<string, ConfigDefinition>} definition
283
- * @param {any} option
284
- * @param {string} keypath
285
- * @returns {any}
286
- */
287
- function validate(definition, option, keypath) {
288
- for (const key in option) {
289
- if (!(key in definition)) {
290
- let message = `Unexpected option ${keypath}.${key}`;
291
-
292
- if (keypath === 'config' && key in options.kit) {
293
- message += ` (did you mean config.kit.${key}?)`;
294
- } else if (keypath === 'config.kit' && key in options) {
295
- message += ` (did you mean config.${key}?)`;
296
- }
297
-
298
- throw new Error(message);
299
- }
300
- }
301
-
302
- /** @type {Record<string, any>} */
303
- const merged = {};
304
-
305
- for (const key in definition) {
306
- const expected = definition[key];
307
- const actual = option[key];
308
-
309
- const child_keypath = `${keypath}.${key}`;
310
-
311
- if (key in option) {
312
- if (expected.type === 'branch') {
313
- if (actual && (typeof actual !== 'object' || Array.isArray(actual))) {
314
- throw new Error(`${keypath}.${key} should be an object`);
315
- }
316
-
317
- merged[key] = validate(expected.children, actual, child_keypath);
318
- } else {
319
- merged[key] = expected.validate(actual, child_keypath);
320
- }
321
- } else {
322
- merged[key] =
323
- expected.type === 'branch'
324
- ? validate(expected.children, {}, child_keypath)
325
- : expected.default;
326
- }
327
- }
328
-
329
- return merged;
330
- }
331
-
332
- /**
333
- * @param {string} from
334
- * @param {string} to
335
- */
336
- function resolve(from, to) {
337
- // the `/.` is weird, but allows `${assets}/images/blah.jpg` to work
338
- // when `assets` is empty
339
- return remove_trailing_slash(resolve$1(add_trailing_slash(from), to)) || '/.';
340
- }
341
-
342
- /**
343
- * @param {string} str
344
- */
345
- function add_trailing_slash(str) {
346
- return str.endsWith('/') ? str : `${str}/`;
347
- }
348
-
349
- /**
350
- * @param {string} str
351
- */
352
- function remove_trailing_slash(str) {
353
- return str.endsWith('/') ? str.slice(0, -1) : str;
354
- }
355
-
356
- async function load_config({ cwd = process.cwd() } = {}) {
357
- const config_file = path.join(cwd, 'svelte.config.cjs');
358
- const config = await import(pathToFileURL(config_file).href);
359
- const validated = validate_config(config.default);
360
-
361
- validated.kit.files.assets = path.resolve(cwd, validated.kit.files.assets);
362
- validated.kit.files.lib = path.resolve(cwd, validated.kit.files.lib);
363
- validated.kit.files.routes = path.resolve(cwd, validated.kit.files.routes);
364
- validated.kit.files.serviceWorker = path.resolve(cwd, validated.kit.files.serviceWorker);
365
- validated.kit.files.setup = path.resolve(cwd, validated.kit.files.setup);
366
- validated.kit.files.template = path.resolve(cwd, validated.kit.files.template);
367
-
368
- // TODO check all the `files` exist when the config is loaded?
369
- // TODO check that `target` is present in the provided template
370
-
371
- return validated;
372
- }
373
-
374
- /**
375
- * @param {import('../../../../types.internal').Config} config
376
- * @returns {import('../../../types.internal.js').ValidatedConfig}
377
- */
378
- function validate_config(config) {
379
- /** @type {import('../../../types.internal.js').ValidatedConfig} */
380
- const validated = validate(options, config, 'config');
381
-
382
- // resolve paths
383
- const { paths } = validated.kit;
384
-
385
- if (paths.base !== '' && !paths.base.startsWith('/')) {
386
- throw new Error('config.kit.paths.base must be a root-relative path');
387
- }
388
-
389
- paths.assets = resolve(paths.base, paths.assets);
390
-
391
- return validated;
392
- }
393
-
394
- async function get_config() {
395
- // TODO this is temporary, for the benefit of early adopters
396
- if (existsSync('snowpack.config.js') || existsSync('snowpack.config.cjs')) {
397
- // prettier-ignore
398
- console.error($.bold().red(
399
- 'SvelteKit now uses https://vitejs.dev. Please replace snowpack.config.js with vite.config.js:'
400
- ));
401
-
402
- // prettier-ignore
403
- console.error(`
404
- // Consult https://vitejs.dev/config/ to learn about these options
405
- import { join } from 'path';
406
- import { readFileSync } from 'fs';
407
- import { cwd } from 'process';
408
-
409
- const pkg = JSON.parse(readFileSync(join(cwd(), 'package.json')));
410
-
411
- /** @type {import('vite').UserConfig} */
412
- export default {
413
- ssr: {
414
- noExternal: Object.keys(pkg.dependencies || {})
415
- }
416
- };
417
-
418
- `.replace(/^\t{3}/gm, '').replace(/\t/gm, ' ').trim());
419
- }
420
-
421
- try {
422
- return await load_config();
423
- } catch (error) {
424
- let message = error.message;
425
-
426
- if (error.code === 'MODULE_NOT_FOUND') {
427
- if (existsSync('svelte.config.js')) {
428
- // TODO this is temporary, for the benefit of early adopters
429
- message =
430
- 'You must rename svelte.config.js to svelte.config.cjs, and snowpack.config.js to snowpack.config.cjs';
431
- } else {
432
- message = 'Missing svelte.config.cjs';
433
- }
434
- } else if (error.name === 'SyntaxError') {
435
- message = 'Malformed svelte.config.cjs';
436
- }
437
-
438
- console.error($.bold().red(message));
439
- console.error($.grey(error.stack));
440
- process.exit(1);
441
- }
442
- }
443
-
444
- /** @param {Error} error */
445
- function handle_error(error) {
446
- console.log($.bold().red(`> ${error.message}`));
447
- console.log($.gray(error.stack));
448
- process.exit(1);
449
- }
450
-
451
- /** @param {number} port */
452
- async function launch(port) {
453
- const { exec } = await import('child_process');
454
- exec(`${process.platform == 'win32' ? 'start' : 'open'} http://localhost:${port}`);
455
- }
456
-
457
- const prog = sade('svelte-kit').version('1.0.0-next.50');
458
-
459
- prog
460
- .command('dev')
461
- .describe('Start a development server')
462
- .option('-p, --port', 'Port', 3000)
463
- .option('-o, --open', 'Open a browser tab', false)
464
- .action(async ({ port, open }) => {
465
- process.env.NODE_ENV = 'development';
466
- const config = await get_config();
467
-
468
- const { dev } = await import('./chunks/index.js');
469
-
470
- try {
471
- const watcher = await dev({ port, config });
472
-
473
- watcher.on('stdout', (data) => {
474
- process.stdout.write(data);
475
- });
476
-
477
- watcher.on('stderr', (data) => {
478
- process.stderr.write(data);
479
- });
480
-
481
- console.log($.bold().cyan(`> Listening on http://localhost:${watcher.port}`));
482
- if (open) launch(watcher.port);
483
- } catch (error) {
484
- handle_error(error);
485
- }
486
- });
487
-
488
- prog
489
- .command('build')
490
- .describe('Create a production build of your app')
491
- .option('--verbose', 'Log more stuff', false)
492
- .action(async ({ verbose }) => {
493
- process.env.NODE_ENV = 'production';
494
- const config = await get_config();
495
-
496
- try {
497
- const { build } = await import('./chunks/index4.js');
498
- await build(config);
499
-
500
- console.log(`\nRun ${$.bold().cyan('npm start')} to try your app locally.`);
501
-
502
- if (config.kit.adapter[0]) {
503
- const { adapt } = await import('./chunks/index5.js');
504
- await adapt(config, { verbose });
505
- } else {
506
- console.log($.bold().yellow('\nNo adapter specified'));
507
-
508
- // prettier-ignore
509
- console.log(
510
- `See ${$.bold().cyan('https://kit.svelte.dev/docs#adapters')} to learn how to configure your app to run on the platform of your choosing`
511
- );
512
- }
513
- } catch (error) {
514
- handle_error(error);
515
- }
516
- });
517
-
518
- prog
519
- .command('start')
520
- .describe('Serve an already-built app')
521
- .option('-p, --port', 'Port', 3000)
522
- .option('-o, --open', 'Open a browser tab', false)
523
- .action(async ({ port, open }) => {
524
- process.env.NODE_ENV = 'production';
525
- const config = await get_config();
526
-
527
- const { start } = await import('./chunks/index6.js');
528
-
529
- try {
530
- await start({ port, config });
531
-
532
- console.log($.bold().cyan(`> Listening on http://localhost:${port}`));
533
- if (open) if (open) launch(port);
534
- } catch (error) {
535
- handle_error(error);
536
- }
537
- });
538
-
539
- // For the benefit of early-adopters. Can later be removed
540
- prog
541
- .command('adapt')
542
- .describe('Customise your production build for different platforms')
543
- .option('--verbose', 'Log more stuff', false)
544
- .action(async () => {
545
- console.log('"svelte-kit build" will now run the adapter');
546
- });
547
-
548
- prog.parse(process.argv, { unknown: (arg) => `Unknown option: ${arg}` });
549
-
550
- export { $ };