@sveltejs/kit 1.0.0-next.403 → 1.0.0-next.407

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 (99) hide show
  1. package/package.json +24 -25
  2. package/{dist → src}/cli.js +19 -18
  3. package/{dist/chunks/index3.js → src/core/adapt/builder.js} +52 -63
  4. package/src/core/adapt/index.js +19 -0
  5. package/src/core/config/index.js +86 -0
  6. package/{dist/chunks/index.js → src/core/config/options.js} +7 -194
  7. package/src/core/config/types.d.ts +1 -0
  8. package/src/core/constants.js +3 -0
  9. package/src/core/generate_manifest/index.js +99 -0
  10. package/src/core/prerender/crawl.js +194 -0
  11. package/src/core/prerender/prerender.js +378 -0
  12. package/src/core/prerender/queue.js +80 -0
  13. package/src/core/sync/create_manifest_data/index.js +492 -0
  14. package/src/core/sync/create_manifest_data/types.d.ts +40 -0
  15. package/src/core/sync/sync.js +59 -0
  16. package/src/core/sync/utils.js +97 -0
  17. package/src/core/sync/write_ambient.js +87 -0
  18. package/src/core/sync/write_client_manifest.js +82 -0
  19. package/src/core/sync/write_matchers.js +25 -0
  20. package/src/core/sync/write_root.js +88 -0
  21. package/{dist/chunks → src/core/sync}/write_tsconfig.js +24 -108
  22. package/src/core/sync/write_types.js +738 -0
  23. package/src/core/utils.js +58 -0
  24. package/{dist → src}/hooks.js +1 -3
  25. package/src/index/index.js +45 -0
  26. package/src/index/private.js +33 -0
  27. package/src/node/index.js +145 -0
  28. package/src/node/polyfills.js +40 -0
  29. package/src/packaging/index.js +218 -0
  30. package/src/packaging/types.d.ts +8 -0
  31. package/src/packaging/typescript.js +150 -0
  32. package/src/packaging/utils.js +143 -0
  33. package/{assets → src/runtime}/app/env.js +3 -5
  34. package/src/runtime/app/navigation.js +22 -0
  35. package/src/runtime/app/paths.js +1 -0
  36. package/{assets → src/runtime}/app/stores.js +6 -9
  37. package/src/runtime/client/ambient.d.ts +17 -0
  38. package/{assets/client/start.js → src/runtime/client/client.js} +302 -878
  39. package/src/runtime/client/fetcher.js +60 -0
  40. package/src/runtime/client/parse.js +36 -0
  41. package/{assets → src/runtime}/client/singletons.js +2 -4
  42. package/src/runtime/client/start.js +48 -0
  43. package/src/runtime/client/types.d.ts +106 -0
  44. package/src/runtime/client/utils.js +113 -0
  45. package/src/runtime/components/error.svelte +16 -0
  46. package/{assets → src/runtime}/components/layout.svelte +0 -0
  47. package/{assets → src/runtime}/env/dynamic/private.js +0 -0
  48. package/{assets → src/runtime}/env/dynamic/public.js +0 -0
  49. package/{assets → src/runtime}/env-private.js +2 -4
  50. package/{assets → src/runtime}/env-public.js +2 -4
  51. package/src/runtime/env.js +6 -0
  52. package/src/runtime/hash.js +16 -0
  53. package/{assets → src/runtime}/paths.js +3 -5
  54. package/src/runtime/server/endpoint.js +42 -0
  55. package/src/runtime/server/index.js +434 -0
  56. package/src/runtime/server/page/cookie.js +25 -0
  57. package/src/runtime/server/page/crypto.js +239 -0
  58. package/src/runtime/server/page/csp.js +249 -0
  59. package/src/runtime/server/page/fetch.js +265 -0
  60. package/src/runtime/server/page/index.js +418 -0
  61. package/src/runtime/server/page/load_data.js +94 -0
  62. package/src/runtime/server/page/render.js +357 -0
  63. package/src/runtime/server/page/respond_with_error.js +105 -0
  64. package/src/runtime/server/page/types.d.ts +44 -0
  65. package/src/runtime/server/utils.js +116 -0
  66. package/src/utils/error.js +22 -0
  67. package/src/utils/escape.js +104 -0
  68. package/{dist/chunks → src/utils}/filesystem.js +22 -24
  69. package/src/utils/http.js +55 -0
  70. package/src/utils/misc.js +1 -0
  71. package/src/utils/routing.js +107 -0
  72. package/src/utils/url.js +97 -0
  73. package/src/vite/build/build_server.js +335 -0
  74. package/src/vite/build/build_service_worker.js +90 -0
  75. package/src/vite/build/utils.js +153 -0
  76. package/src/vite/dev/index.js +565 -0
  77. package/src/vite/index.js +540 -0
  78. package/src/vite/preview/index.js +186 -0
  79. package/src/vite/types.d.ts +3 -0
  80. package/src/vite/utils.js +335 -0
  81. package/svelte-kit.js +1 -10
  82. package/types/ambient.d.ts +5 -12
  83. package/types/index.d.ts +91 -44
  84. package/types/internal.d.ts +50 -72
  85. package/types/private.d.ts +2 -1
  86. package/assets/app/navigation.js +0 -24
  87. package/assets/app/paths.js +0 -1
  88. package/assets/components/error.svelte +0 -29
  89. package/assets/env.js +0 -8
  90. package/assets/server/index.js +0 -3579
  91. package/dist/chunks/error.js +0 -12
  92. package/dist/chunks/index2.js +0 -15745
  93. package/dist/chunks/multipart-parser.js +0 -458
  94. package/dist/chunks/sync.js +0 -1366
  95. package/dist/chunks/utils.js +0 -66
  96. package/dist/node/polyfills.js +0 -17928
  97. package/dist/node.js +0 -348
  98. package/dist/prerender.js +0 -788
  99. package/dist/vite.js +0 -2520
@@ -0,0 +1,97 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { mkdirp } from '../../utils/filesystem.js';
4
+
5
+ /** @type {Map<string, string>} */
6
+ const previous_contents = new Map();
7
+
8
+ /**
9
+ * @param {string} file
10
+ * @param {string} code
11
+ */
12
+ export function write_if_changed(file, code) {
13
+ if (code !== previous_contents.get(file)) {
14
+ write(file, code);
15
+ }
16
+ }
17
+
18
+ /**
19
+ * @param {string} file
20
+ * @param {string} code
21
+ */
22
+ export function write(file, code) {
23
+ previous_contents.set(file, code);
24
+ mkdirp(path.dirname(file));
25
+ fs.writeFileSync(file, code);
26
+ }
27
+
28
+ /**
29
+ * @param {(file: string) => boolean} should_remove
30
+ */
31
+ export function remove_from_previous(should_remove) {
32
+ for (const key of previous_contents.keys()) {
33
+ if (should_remove(key)) {
34
+ previous_contents.delete(key);
35
+ }
36
+ }
37
+ }
38
+
39
+ /** @param {string} str */
40
+ export function trim(str) {
41
+ const indentation = /** @type {RegExpExecArray} */ (/\n?(\s*)/.exec(str))[1];
42
+ const pattern = new RegExp(`^${indentation}`, 'gm');
43
+ return str.replace(pattern, '').trim();
44
+ }
45
+
46
+ export const reserved = new Set([
47
+ 'do',
48
+ 'if',
49
+ 'in',
50
+ 'for',
51
+ 'let',
52
+ 'new',
53
+ 'try',
54
+ 'var',
55
+ 'case',
56
+ 'else',
57
+ 'enum',
58
+ 'eval',
59
+ 'null',
60
+ 'this',
61
+ 'true',
62
+ 'void',
63
+ 'with',
64
+ 'await',
65
+ 'break',
66
+ 'catch',
67
+ 'class',
68
+ 'const',
69
+ 'false',
70
+ 'super',
71
+ 'throw',
72
+ 'while',
73
+ 'yield',
74
+ 'delete',
75
+ 'export',
76
+ 'import',
77
+ 'public',
78
+ 'return',
79
+ 'static',
80
+ 'switch',
81
+ 'typeof',
82
+ 'default',
83
+ 'extends',
84
+ 'finally',
85
+ 'package',
86
+ 'private',
87
+ 'continue',
88
+ 'debugger',
89
+ 'function',
90
+ 'arguments',
91
+ 'interface',
92
+ 'protected',
93
+ 'implements',
94
+ 'instanceof'
95
+ ]);
96
+
97
+ export const valid_identifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
@@ -0,0 +1,87 @@
1
+ import path from 'path';
2
+ import colors from 'kleur';
3
+ import { get_env } from '../../vite/utils.js';
4
+ import { write_if_changed, reserved, valid_identifier } from './utils.js';
5
+
6
+ const autogen_comment = '// this file is generated — do not edit it\n';
7
+ const types_reference = '/// <reference types="@sveltejs/kit" />\n\n';
8
+
9
+ /**
10
+ * Writes ambient declarations including types reference to @sveltejs/kit,
11
+ * and the existing environment variables in process.env to
12
+ * $env/static/private and $env/static/public
13
+ * @param {import('types').ValidatedKitConfig} config
14
+ * @param {string} mode The Vite mode
15
+ */
16
+ export function write_ambient(config, mode) {
17
+ const env = get_env(mode, config.env.publicPrefix);
18
+
19
+ // TODO when testing src, `$app` points at `src/runtime/app`... will
20
+ // probably need to fiddle with aliases
21
+ write_if_changed(
22
+ path.join(config.outDir, 'runtime/env/static/public.js'),
23
+ create_env_module('$env/static/public', env.public)
24
+ );
25
+
26
+ write_if_changed(
27
+ path.join(config.outDir, 'runtime/env/static/private.js'),
28
+ create_env_module('$env/static/private', env.private)
29
+ );
30
+
31
+ write_if_changed(
32
+ path.join(config.outDir, 'ambient.d.ts'),
33
+ autogen_comment +
34
+ types_reference +
35
+ create_env_types('$env/static/public', env.public) +
36
+ '\n\n' +
37
+ create_env_types('$env/static/private', env.private)
38
+ );
39
+ }
40
+
41
+ /**
42
+ * @param {string} id
43
+ * @param {Record<string, string>} env
44
+ * @returns {string}
45
+ */
46
+ function create_env_module(id, env) {
47
+ /** @type {string[]} */
48
+ const declarations = [];
49
+
50
+ for (const key in env) {
51
+ const warning = !valid_identifier.test(key)
52
+ ? 'not a valid identifier'
53
+ : reserved.has(key)
54
+ ? 'a reserved word'
55
+ : null;
56
+
57
+ if (warning) {
58
+ console.error(
59
+ colors
60
+ .bold()
61
+ .yellow(`Omitting environment variable "${key}" from ${id} as it is ${warning}`)
62
+ );
63
+ continue;
64
+ }
65
+
66
+ const comment = `/** @type {import('${id}').${key}} */`;
67
+ const declaration = `export const ${key} = ${JSON.stringify(env[key])};`;
68
+
69
+ declarations.push(`${comment}\n${declaration}`);
70
+ }
71
+
72
+ return autogen_comment + declarations.join('\n\n');
73
+ }
74
+
75
+ /**
76
+ * @param {string} id
77
+ * @param {Record<string, string>} env
78
+ * @returns {string}
79
+ */
80
+ function create_env_types(id, env) {
81
+ const declarations = Object.keys(env)
82
+ .filter((k) => valid_identifier.test(k))
83
+ .map((k) => `\texport const ${k}: string;`)
84
+ .join('\n');
85
+
86
+ return `declare module '${id}' {\n${declarations}\n}`;
87
+ }
@@ -0,0 +1,82 @@
1
+ import { relative } from 'path';
2
+ import { s } from '../../utils/misc.js';
3
+ import { trim, write_if_changed } from './utils.js';
4
+
5
+ /**
6
+ * Writes the client manifest to disk. The manifest is used to power the router. It contains the
7
+ * list of routes and corresponding Svelte components (i.e. pages and layouts).
8
+ * @param {import('types').ManifestData} manifest_data
9
+ * @param {string} output
10
+ */
11
+ export function write_client_manifest(manifest_data, output) {
12
+ /** @type {Map<import('types').PageNode, number>} */
13
+ const node_indexes = new Map();
14
+
15
+ /**
16
+ * Creates a module that exports a `CSRPageNode`
17
+ * @param {import('types').PageNode} node
18
+ */
19
+ function generate_node(node) {
20
+ const declarations = [];
21
+
22
+ if (node.shared) {
23
+ declarations.push(
24
+ `import * as shared from ${s(relative(`${output}/nodes`, node.shared))};`,
25
+ `export { shared };`
26
+ );
27
+ }
28
+
29
+ if (node.component) {
30
+ declarations.push(
31
+ `export { default as component } from ${s(relative(`${output}/nodes`, node.component))};`
32
+ );
33
+ }
34
+
35
+ if (node.server) {
36
+ declarations.push(`export const server = true;`);
37
+ }
38
+
39
+ return declarations.join('\n');
40
+ }
41
+
42
+ const nodes = manifest_data.nodes
43
+ .map((node, i) => {
44
+ node_indexes.set(node, i);
45
+ write_if_changed(`${output}/nodes/${i}.js`, generate_node(node));
46
+ return `() => import('./nodes/${i}')`;
47
+ })
48
+ .join(',\n\t');
49
+
50
+ const dictionary = `{
51
+ ${manifest_data.routes
52
+ .map((route) => {
53
+ if (route.type === 'page') {
54
+ const errors = route.errors.map((node) => (node ? node_indexes.get(node) : '')).join(',');
55
+ const layouts = route.layouts
56
+ .map((node) => (node ? node_indexes.get(node) : ''))
57
+ .join(',');
58
+ const leaf = route.leaf ? node_indexes.get(route.leaf) : '';
59
+
60
+ const uses_server_data = [...route.layouts, route.leaf].some((node) => node?.server);
61
+ const suffix = uses_server_data ? ', 1' : '';
62
+
63
+ return `${s(route.id)}: [[${errors}], [${layouts}], ${leaf}${suffix}]`;
64
+ }
65
+ })
66
+ .filter(Boolean)
67
+ .join(',\n\t\t')}
68
+ }`.replace(/^\t/gm, '');
69
+
70
+ write_if_changed(
71
+ `${output}/client-manifest.js`,
72
+ trim(`
73
+ export { matchers } from './client-matchers.js';
74
+
75
+ export const nodes = [
76
+ ${nodes}
77
+ ];
78
+
79
+ export const dictionary = ${dictionary};
80
+ `)
81
+ );
82
+ }
@@ -0,0 +1,25 @@
1
+ import path from 'path';
2
+ import { s } from '../../utils/misc.js';
3
+ import { write_if_changed } from './utils.js';
4
+
5
+ /**
6
+ * @param {import('types').ManifestData} manifest_data
7
+ * @param {string} output
8
+ */
9
+ export function write_matchers(manifest_data, output) {
10
+ const imports = [];
11
+ const matchers = [];
12
+
13
+ for (const key in manifest_data.matchers) {
14
+ const src = manifest_data.matchers[key];
15
+
16
+ imports.push(`import { match as ${key} } from ${s(path.relative(output, src))};`);
17
+ matchers.push(key);
18
+ }
19
+
20
+ const module = imports.length
21
+ ? `${imports.join('\n')}\n\nexport const matchers = { ${matchers.join(', ')} };`
22
+ : 'export const matchers = {};';
23
+
24
+ write_if_changed(`${output}/client-matchers.js`, module);
25
+ }
@@ -0,0 +1,88 @@
1
+ import { trim, write_if_changed } from './utils.js';
2
+
3
+ /**
4
+ * @param {import('types').ManifestData} manifest_data
5
+ * @param {string} output
6
+ */
7
+ export function write_root(manifest_data, output) {
8
+ // TODO remove default layout altogether
9
+
10
+ const max_depth = Math.max(
11
+ ...manifest_data.routes.map((route) =>
12
+ route.type === 'page' ? route.layouts.filter(Boolean).length + 1 : 0
13
+ ),
14
+ 1
15
+ );
16
+
17
+ const levels = [];
18
+ for (let i = 0; i <= max_depth; i += 1) {
19
+ levels.push(i);
20
+ }
21
+
22
+ let l = max_depth;
23
+
24
+ let pyramid = `<svelte:component this={components[${l}]} data={data_${l}}/>`;
25
+
26
+ while (l--) {
27
+ pyramid = `
28
+ {#if components[${l + 1}]}
29
+ <svelte:component this={components[${l}]} data={data_${l}}>
30
+ ${pyramid.replace(/\n/g, '\n\t\t\t\t\t')}
31
+ </svelte:component>
32
+ {:else}
33
+ <svelte:component this={components[${l}]} data={data_${l}} {errors} />
34
+ {/if}
35
+ `
36
+ .replace(/^\t\t\t/gm, '')
37
+ .trim();
38
+ }
39
+
40
+ write_if_changed(
41
+ `${output}/root.svelte`,
42
+ trim(`
43
+ <!-- This file is generated by @sveltejs/kit — do not edit it! -->
44
+ <script>
45
+ import { setContext, afterUpdate, onMount } from 'svelte';
46
+
47
+ // stores
48
+ export let stores;
49
+ export let page;
50
+
51
+ export let components;
52
+ ${levels.map((l) => `export let data_${l} = null;`).join('\n\t\t\t\t')}
53
+ export let errors;
54
+
55
+ setContext('__svelte__', stores);
56
+
57
+ $: stores.page.set(page);
58
+ afterUpdate(stores.page.notify);
59
+
60
+ let mounted = false;
61
+ let navigated = false;
62
+ let title = null;
63
+
64
+ onMount(() => {
65
+ const unsubscribe = stores.page.subscribe(() => {
66
+ if (mounted) {
67
+ navigated = true;
68
+ title = document.title || 'untitled page';
69
+ }
70
+ });
71
+
72
+ mounted = true;
73
+ return unsubscribe;
74
+ });
75
+ </script>
76
+
77
+ ${pyramid.replace(/\n/g, '\n\t\t\t')}
78
+
79
+ {#if mounted}
80
+ <div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px">
81
+ {#if navigated}
82
+ {title}
83
+ {/if}
84
+ </div>
85
+ {/if}
86
+ `)
87
+ );
88
+ }
@@ -1,98 +1,16 @@
1
- import fs__default from 'fs';
2
- import path__default from 'path';
3
- import { $ } from './index.js';
4
- import { m as mkdirp, p as posixify } from './filesystem.js';
5
-
6
- /** @type {Map<string, string>} */
7
- const previous_contents = new Map();
8
-
9
- /**
10
- * @param {string} file
11
- * @param {string} code
12
- */
13
- function write_if_changed(file, code) {
14
- if (code !== previous_contents.get(file)) {
15
- write(file, code);
16
- }
17
- }
18
-
19
- /**
20
- * @param {string} file
21
- * @param {string} code
22
- */
23
- function write(file, code) {
24
- previous_contents.set(file, code);
25
- mkdirp(path__default.dirname(file));
26
- fs__default.writeFileSync(file, code);
27
- }
28
-
29
- /** @param {string} str */
30
- function trim(str) {
31
- const indentation = /** @type {RegExpExecArray} */ (/\n?(\s*)/.exec(str))[1];
32
- const pattern = new RegExp(`^${indentation}`, 'gm');
33
- return str.replace(pattern, '').trim();
34
- }
35
-
36
- const reserved = new Set([
37
- 'do',
38
- 'if',
39
- 'in',
40
- 'for',
41
- 'let',
42
- 'new',
43
- 'try',
44
- 'var',
45
- 'case',
46
- 'else',
47
- 'enum',
48
- 'eval',
49
- 'null',
50
- 'this',
51
- 'true',
52
- 'void',
53
- 'with',
54
- 'await',
55
- 'break',
56
- 'catch',
57
- 'class',
58
- 'const',
59
- 'false',
60
- 'super',
61
- 'throw',
62
- 'while',
63
- 'yield',
64
- 'delete',
65
- 'export',
66
- 'import',
67
- 'public',
68
- 'return',
69
- 'static',
70
- 'switch',
71
- 'typeof',
72
- 'default',
73
- 'extends',
74
- 'finally',
75
- 'package',
76
- 'private',
77
- 'continue',
78
- 'debugger',
79
- 'function',
80
- 'arguments',
81
- 'interface',
82
- 'protected',
83
- 'implements',
84
- 'instanceof'
85
- ]);
86
-
87
- const valid_identifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import colors from 'kleur';
4
+ import { posixify } from '../../utils/filesystem.js';
5
+ import { write_if_changed } from './utils.js';
88
6
 
89
7
  /**
90
8
  * @param {string} cwd
91
9
  * @param {string} file
92
10
  */
93
11
  function maybe_file(cwd, file) {
94
- const resolved = path__default.resolve(cwd, file);
95
- if (fs__default.existsSync(resolved)) {
12
+ const resolved = path.resolve(cwd, file);
13
+ if (fs.existsSync(resolved)) {
96
14
  return resolved;
97
15
  }
98
16
  }
@@ -101,7 +19,7 @@ function maybe_file(cwd, file) {
101
19
  * @param {string} file
102
20
  */
103
21
  function project_relative(file) {
104
- return posixify(path__default.relative('.', file));
22
+ return posixify(path.relative('.', file));
105
23
  }
106
24
 
107
25
  /**
@@ -119,18 +37,18 @@ function remove_trailing_slashstar(file) {
119
37
  * Writes the tsconfig that the user's tsconfig inherits from.
120
38
  * @param {import('types').ValidatedKitConfig} config
121
39
  */
122
- function write_tsconfig(config, cwd = process.cwd()) {
123
- const out = path__default.join(config.outDir, 'tsconfig.json');
40
+ export function write_tsconfig(config, cwd = process.cwd()) {
41
+ const out = path.join(config.outDir, 'tsconfig.json');
124
42
  const user_file = maybe_file(cwd, 'tsconfig.json') || maybe_file(cwd, 'jsconfig.json');
125
43
 
126
44
  if (user_file) validate(config, cwd, out, user_file);
127
45
 
128
46
  /** @param {string} file */
129
- const config_relative = (file) => posixify(path__default.relative(config.outDir, file));
47
+ const config_relative = (file) => posixify(path.relative(config.outDir, file));
130
48
 
131
49
  const include = ['ambient.d.ts'];
132
50
  for (const dir of [config.files.routes, config.files.lib]) {
133
- const relative = project_relative(path__default.dirname(dir));
51
+ const relative = project_relative(path.dirname(dir));
134
52
  include.push(config_relative(`${relative}/**/*.js`));
135
53
  include.push(config_relative(`${relative}/**/*.ts`));
136
54
  include.push(config_relative(`${relative}/**/*.svelte`));
@@ -180,44 +98,44 @@ function write_tsconfig(config, cwd = process.cwd()) {
180
98
  */
181
99
  function validate(config, cwd, out, user_file) {
182
100
  // we have to eval the file, since it's not parseable as JSON (contains comments)
183
- const user_tsconfig_json = fs__default.readFileSync(user_file, 'utf-8');
101
+ const user_tsconfig_json = fs.readFileSync(user_file, 'utf-8');
184
102
  const user_tsconfig = (0, eval)(`(${user_tsconfig_json})`);
185
103
 
186
104
  // we need to check that the user's tsconfig extends the framework config
187
105
  const extend = user_tsconfig.extends;
188
- const extends_framework_config = extend && path__default.resolve(cwd, extend) === out;
106
+ const extends_framework_config = extend && path.resolve(cwd, extend) === out;
189
107
 
190
- const kind = path__default.basename(user_file);
108
+ const kind = path.basename(user_file);
191
109
 
192
110
  if (extends_framework_config) {
193
111
  const { paths: user_paths } = user_tsconfig.compilerOptions || {};
194
112
 
195
- if (user_paths && fs__default.existsSync(config.files.lib)) {
113
+ if (user_paths && fs.existsSync(config.files.lib)) {
196
114
  /** @type {string[]} */
197
115
  const lib = user_paths['$lib'] || [];
198
116
  /** @type {string[]} */
199
117
  const lib_ = user_paths['$lib/*'] || [];
200
118
 
201
119
  const missing_lib_paths =
202
- !lib.some((relative) => path__default.resolve(cwd, relative) === config.files.lib) ||
203
- !lib_.some((relative) => path__default.resolve(cwd, relative) === path__default.join(config.files.lib, '/*'));
120
+ !lib.some((relative) => path.resolve(cwd, relative) === config.files.lib) ||
121
+ !lib_.some((relative) => path.resolve(cwd, relative) === path.join(config.files.lib, '/*'));
204
122
 
205
123
  if (missing_lib_paths) {
206
124
  console.warn(
207
- $
125
+ colors
208
126
  .bold()
209
127
  .yellow(`Your compilerOptions.paths in ${kind} should include the following:`)
210
128
  );
211
- const relative = posixify(path__default.relative('.', config.files.lib));
129
+ const relative = posixify(path.relative('.', config.files.lib));
212
130
  console.warn(`{\n "$lib":["${relative}"],\n "$lib/*":["${relative}/*"]\n}`);
213
131
  }
214
132
  }
215
133
  } else {
216
- let relative = posixify(path__default.relative('.', out));
134
+ let relative = posixify(path.relative('.', out));
217
135
  if (!relative.startsWith('./')) relative = './' + relative;
218
136
 
219
137
  console.warn(
220
- $.bold().yellow(`Your ${kind} should extend the configuration generated by SvelteKit:`)
138
+ colors.bold().yellow(`Your ${kind} should extend the configuration generated by SvelteKit:`)
221
139
  );
222
140
  console.warn(`{\n "extends": "${relative}"\n}`);
223
141
  }
@@ -234,11 +152,11 @@ const value_regex = /^(.*?)((\/\*)|(\.\w+))?$/;
234
152
  *
235
153
  * @param {import('types').ValidatedKitConfig} config
236
154
  */
237
- function get_tsconfig_paths(config) {
155
+ export function get_tsconfig_paths(config) {
238
156
  const alias = {
239
157
  ...config.alias
240
158
  };
241
- if (fs__default.existsSync(project_relative(config.files.lib))) {
159
+ if (fs.existsSync(project_relative(config.files.lib))) {
242
160
  alias['$lib'] = project_relative(config.files.lib);
243
161
  }
244
162
 
@@ -269,5 +187,3 @@ function get_tsconfig_paths(config) {
269
187
 
270
188
  return paths;
271
189
  }
272
-
273
- export { write as a, write_tsconfig as b, reserved as r, trim as t, valid_identifier as v, write_if_changed as w };