@sveltejs/kit 1.0.0-next.4 → 1.0.0-next.401
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/assets/app/env.js +13 -0
- package/assets/app/navigation.js +24 -0
- package/assets/app/paths.js +1 -0
- package/assets/app/stores.js +97 -0
- package/assets/client/singletons.js +13 -0
- package/assets/client/start.js +1845 -0
- package/assets/components/error.svelte +19 -3
- package/assets/env/dynamic/private.js +1 -0
- package/assets/env/dynamic/public.js +1 -0
- package/assets/env-private.js +9 -0
- package/assets/env-public.js +9 -0
- package/assets/env.js +8 -0
- package/assets/paths.js +13 -0
- package/assets/server/index.js +3579 -0
- package/dist/chunks/error.js +12 -0
- package/dist/chunks/filesystem.js +110 -0
- package/dist/chunks/index.js +675 -0
- package/dist/chunks/index2.js +15745 -0
- package/dist/chunks/index3.js +218 -0
- package/dist/chunks/multipart-parser.js +458 -0
- package/dist/chunks/sync.js +1368 -0
- package/dist/chunks/utils.js +66 -0
- package/dist/chunks/write_tsconfig.js +273 -0
- package/dist/cli.js +91 -101
- package/dist/hooks.js +28 -0
- package/dist/node/polyfills.js +17778 -0
- package/dist/node.js +348 -0
- package/dist/prerender.js +788 -0
- package/dist/vite.js +2520 -0
- package/package.json +98 -52
- package/svelte-kit.js +11 -0
- package/types/ambient.d.ts +375 -0
- package/types/index.d.ts +298 -0
- package/types/internal.d.ts +335 -0
- package/types/private.d.ts +235 -0
- package/CHANGELOG.md +0 -171
- package/assets/runtime/app/navigation.js +0 -47
- package/assets/runtime/app/navigation.js.map +0 -1
- package/assets/runtime/app/stores.js +0 -78
- package/assets/runtime/app/stores.js.map +0 -1
- package/assets/runtime/internal/singletons.js +0 -10
- package/assets/runtime/internal/singletons.js.map +0 -1
- package/assets/runtime/internal/start.js +0 -517
- package/assets/runtime/internal/start.js.map +0 -1
- package/dist/api.js +0 -40
- package/dist/api.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/create_app.js +0 -550
- package/dist/create_app.js.map +0 -1
- package/dist/index.js +0 -8331
- package/dist/index.js.map +0 -1
- package/dist/index2.js +0 -509
- package/dist/index2.js.map +0 -1
- package/dist/index3.js +0 -63
- package/dist/index3.js.map +0 -1
- package/dist/index4.js +0 -466
- package/dist/index4.js.map +0 -1
- package/dist/index5.js +0 -276
- package/dist/index5.js.map +0 -1
- package/dist/package.js +0 -235
- package/dist/package.js.map +0 -1
- package/dist/renderer.js +0 -2397
- package/dist/renderer.js.map +0 -1
- package/dist/standard.js +0 -101
- package/dist/standard.js.map +0 -1
- package/dist/utils.js +0 -58
- package/dist/utils.js.map +0 -1
- package/svelte-kit +0 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {unknown} err
|
|
3
|
+
* @return {Error}
|
|
4
|
+
*/
|
|
5
|
+
function coalesce_to_error(err) {
|
|
6
|
+
return err instanceof Error ||
|
|
7
|
+
(err && /** @type {any} */ (err).name && /** @type {any} */ (err).message)
|
|
8
|
+
? /** @type {Error} */ (err)
|
|
9
|
+
: new Error(JSON.stringify(err));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { coalesce_to_error as c };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import fs__default from 'fs';
|
|
2
|
+
import path__default from 'path';
|
|
3
|
+
|
|
4
|
+
/** @param {string} dir */
|
|
5
|
+
function mkdirp(dir) {
|
|
6
|
+
try {
|
|
7
|
+
fs__default.mkdirSync(dir, { recursive: true });
|
|
8
|
+
} catch (/** @type {any} */ e) {
|
|
9
|
+
if (e.code === 'EEXIST') return;
|
|
10
|
+
throw e;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** @param {string} path */
|
|
15
|
+
function rimraf(path) {
|
|
16
|
+
fs__default.rmSync(path, { force: true, recursive: true });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} source
|
|
21
|
+
* @param {string} target
|
|
22
|
+
* @param {{
|
|
23
|
+
* filter?: (basename: string) => boolean;
|
|
24
|
+
* replace?: Record<string, string>;
|
|
25
|
+
* }} opts
|
|
26
|
+
*/
|
|
27
|
+
function copy(source, target, opts = {}) {
|
|
28
|
+
if (!fs__default.existsSync(source)) return [];
|
|
29
|
+
|
|
30
|
+
/** @type {string[]} */
|
|
31
|
+
const files = [];
|
|
32
|
+
|
|
33
|
+
const prefix = posixify(target) + '/';
|
|
34
|
+
|
|
35
|
+
const regex = opts.replace
|
|
36
|
+
? new RegExp(`\\b(${Object.keys(opts.replace).join('|')})\\b`, 'g')
|
|
37
|
+
: null;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} from
|
|
41
|
+
* @param {string} to
|
|
42
|
+
*/
|
|
43
|
+
function go(from, to) {
|
|
44
|
+
if (opts.filter && !opts.filter(path__default.basename(from))) return;
|
|
45
|
+
|
|
46
|
+
const stats = fs__default.statSync(from);
|
|
47
|
+
|
|
48
|
+
if (stats.isDirectory()) {
|
|
49
|
+
fs__default.readdirSync(from).forEach((file) => {
|
|
50
|
+
go(path__default.join(from, file), path__default.join(to, file));
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
mkdirp(path__default.dirname(to));
|
|
54
|
+
|
|
55
|
+
if (opts.replace) {
|
|
56
|
+
const data = fs__default.readFileSync(from, 'utf-8');
|
|
57
|
+
fs__default.writeFileSync(
|
|
58
|
+
to,
|
|
59
|
+
data.replace(
|
|
60
|
+
/** @type {RegExp} */ (regex),
|
|
61
|
+
(_match, key) => /** @type {Record<string, string>} */ (opts.replace)[key]
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
} else {
|
|
65
|
+
fs__default.copyFileSync(from, to);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
files.push(to === target ? posixify(path__default.basename(to)) : posixify(to).replace(prefix, ''));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
go(source, target);
|
|
73
|
+
|
|
74
|
+
return files;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get a list of all files in a directory
|
|
79
|
+
* @param {string} cwd - the directory to walk
|
|
80
|
+
* @param {boolean} [dirs] - whether to include directories in the result
|
|
81
|
+
*/
|
|
82
|
+
function walk(cwd, dirs = false) {
|
|
83
|
+
/** @type {string[]} */
|
|
84
|
+
const all_files = [];
|
|
85
|
+
|
|
86
|
+
/** @param {string} dir */
|
|
87
|
+
function walk_dir(dir) {
|
|
88
|
+
const files = fs__default.readdirSync(path__default.join(cwd, dir));
|
|
89
|
+
|
|
90
|
+
for (const file of files) {
|
|
91
|
+
const joined = path__default.join(dir, file);
|
|
92
|
+
const stats = fs__default.statSync(path__default.join(cwd, joined));
|
|
93
|
+
if (stats.isDirectory()) {
|
|
94
|
+
if (dirs) all_files.push(joined);
|
|
95
|
+
walk_dir(joined);
|
|
96
|
+
} else {
|
|
97
|
+
all_files.push(joined);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return walk_dir(''), all_files;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** @param {string} str */
|
|
106
|
+
function posixify(str) {
|
|
107
|
+
return str.replace(/\\/g, '/');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { copy as c, mkdirp as m, posixify as p, rimraf as r, walk as w };
|