@sveltejs/kit 1.0.0-next.21 → 1.0.0-next.213
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/components/error.svelte +19 -3
- package/assets/kit.js +1912 -0
- package/assets/runtime/app/env.js +20 -0
- package/assets/runtime/app/navigation.js +45 -13
- package/assets/runtime/app/paths.js +1 -2
- package/assets/runtime/app/stores.js +16 -10
- package/assets/runtime/chunks/utils.js +13 -0
- package/assets/runtime/env.js +8 -0
- package/assets/runtime/internal/singletons.js +5 -11
- package/assets/runtime/internal/start.js +981 -355
- package/assets/runtime/paths.js +13 -0
- package/dist/chunks/cert.js +29255 -0
- package/dist/chunks/constants.js +8 -0
- package/dist/chunks/error.js +21 -0
- package/dist/chunks/index.js +4648 -0
- package/dist/chunks/index2.js +815 -0
- package/dist/chunks/index3.js +637 -0
- package/dist/chunks/index4.js +109 -0
- package/dist/chunks/index5.js +628 -0
- package/dist/chunks/index6.js +827 -0
- package/dist/chunks/index7.js +15575 -0
- package/dist/chunks/misc.js +3 -0
- package/dist/chunks/multipart-parser.js +449 -0
- package/dist/chunks/url.js +62 -0
- package/dist/cli.js +1004 -72
- package/dist/hooks.js +28 -0
- package/dist/install-fetch.js +6514 -0
- package/dist/node.js +51 -0
- package/dist/ssr.js +1842 -0
- package/package.json +89 -54
- package/svelte-kit.js +2 -0
- package/types/ambient-modules.d.ts +185 -0
- package/types/app.d.ts +45 -0
- package/types/config.d.ts +163 -0
- package/types/endpoint.d.ts +18 -0
- package/types/helper.d.ts +41 -0
- package/types/hooks.d.ts +48 -0
- package/types/index.d.ts +17 -0
- package/types/internal.d.ts +231 -0
- package/types/page.d.ts +71 -0
- package/CHANGELOG.md +0 -282
- package/assets/runtime/app/navigation.js.map +0 -1
- package/assets/runtime/app/paths.js.map +0 -1
- package/assets/runtime/app/stores.js.map +0 -1
- package/assets/runtime/internal/singletons.js.map +0 -1
- package/assets/runtime/internal/start.js.map +0 -1
- package/assets/runtime/utils-85ebcc60.js +0 -18
- package/assets/runtime/utils-85ebcc60.js.map +0 -1
- package/dist/api.js +0 -44
- package/dist/api.js.map +0 -1
- package/dist/build.js +0 -246
- package/dist/build.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/colors.js +0 -37
- package/dist/colors.js.map +0 -1
- package/dist/create_app.js +0 -578
- package/dist/create_app.js.map +0 -1
- package/dist/index.js +0 -12042
- package/dist/index.js.map +0 -1
- package/dist/index2.js +0 -544
- package/dist/index2.js.map +0 -1
- package/dist/index3.js +0 -71
- 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 -729
- package/dist/index5.js.map +0 -1
- package/dist/index6.js +0 -713
- package/dist/index6.js.map +0 -1
- package/dist/logging.js +0 -43
- package/dist/logging.js.map +0 -1
- package/dist/package.js +0 -432
- package/dist/package.js.map +0 -1
- package/dist/renderer.js +0 -2391
- 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 -54
- package/dist/utils.js.map +0 -1
- package/svelte-kit +0 -3
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { s } from './misc.js';
|
|
2
|
+
import { g as get_mime_lookup } from '../cli.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {import('../../../types/internal').BuildData} build_data;
|
|
6
|
+
* @param {string} relative_path;
|
|
7
|
+
* @param {import('../../../types/internal').RouteData[]} routes;
|
|
8
|
+
* @param {'esm' | 'cjs'} format
|
|
9
|
+
*/
|
|
10
|
+
function generate_manifest(
|
|
11
|
+
build_data,
|
|
12
|
+
relative_path,
|
|
13
|
+
routes = build_data.manifest_data.routes,
|
|
14
|
+
format = 'esm'
|
|
15
|
+
) {
|
|
16
|
+
const bundled_nodes = new Map();
|
|
17
|
+
|
|
18
|
+
// 0 and 1 are special, they correspond to the root layout and root error nodes
|
|
19
|
+
bundled_nodes.set(build_data.manifest_data.components[0], {
|
|
20
|
+
path: `${relative_path}/nodes/0.js`,
|
|
21
|
+
index: 0
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
bundled_nodes.set(build_data.manifest_data.components[1], {
|
|
25
|
+
path: `${relative_path}/nodes/1.js`,
|
|
26
|
+
index: 1
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
routes.forEach((route) => {
|
|
30
|
+
if (route.type === 'page') {
|
|
31
|
+
[...route.a, ...route.b].forEach((component) => {
|
|
32
|
+
if (component && !bundled_nodes.has(component)) {
|
|
33
|
+
const i = build_data.manifest_data.components.indexOf(component);
|
|
34
|
+
|
|
35
|
+
bundled_nodes.set(component, {
|
|
36
|
+
path: `${relative_path}/nodes/${i}.js`,
|
|
37
|
+
index: bundled_nodes.size
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/** @type {(path: string) => string} */
|
|
45
|
+
const importer =
|
|
46
|
+
format === 'esm'
|
|
47
|
+
? (path) => `() => import('${path}')`
|
|
48
|
+
: (path) => `() => Promise.resolve().then(() => require('${path}'))`;
|
|
49
|
+
|
|
50
|
+
// prettier-ignore
|
|
51
|
+
return `{
|
|
52
|
+
appDir: ${s(build_data.app_dir)},
|
|
53
|
+
assets: new Set(${s(build_data.manifest_data.assets.map(asset => asset.file))}),
|
|
54
|
+
_: {
|
|
55
|
+
mime: ${s(get_mime_lookup(build_data.manifest_data))},
|
|
56
|
+
entry: ${s(build_data.client.entry)},
|
|
57
|
+
nodes: [
|
|
58
|
+
${Array.from(bundled_nodes.values()).map(node => importer(node.path)).join(',\n\t\t\t\t')}
|
|
59
|
+
],
|
|
60
|
+
routes: [
|
|
61
|
+
${routes.map(route => {
|
|
62
|
+
if (route.type === 'page') {
|
|
63
|
+
return `{
|
|
64
|
+
type: 'page',
|
|
65
|
+
pattern: ${route.pattern},
|
|
66
|
+
params: ${get_params(route.params)},
|
|
67
|
+
path: ${route.path ? s(route.path) : null},
|
|
68
|
+
a: ${s(route.a.map(component => component && bundled_nodes.get(component).index))},
|
|
69
|
+
b: ${s(route.b.map(component => component && bundled_nodes.get(component).index))}
|
|
70
|
+
}`.replace(/^\t\t/gm, '');
|
|
71
|
+
} else {
|
|
72
|
+
if (!build_data.server.vite_manifest[route.file]) {
|
|
73
|
+
// this is necessary in cases where a .css file snuck in —
|
|
74
|
+
// perhaps it would be better to disallow these (and others?)
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return `{
|
|
79
|
+
type: 'endpoint',
|
|
80
|
+
pattern: ${route.pattern},
|
|
81
|
+
params: ${get_params(route.params)},
|
|
82
|
+
load: ${importer(`${relative_path}/${build_data.server.vite_manifest[route.file].file}`)}
|
|
83
|
+
}`.replace(/^\t\t/gm, '');
|
|
84
|
+
}
|
|
85
|
+
}).filter(Boolean).join(',\n\t\t\t\t')}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}`.replace(/^\t/gm, '');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** @param {string[]} array */
|
|
92
|
+
function get_params(array) {
|
|
93
|
+
// given an array of params like `['x', 'y', 'z']` for
|
|
94
|
+
// src/routes/[x]/[y]/[z]/svelte, create a function
|
|
95
|
+
// that turns a RexExpMatchArray into ({ x, y, z })
|
|
96
|
+
return array.length
|
|
97
|
+
? '(m) => ({ ' +
|
|
98
|
+
array
|
|
99
|
+
.map((param, i) => {
|
|
100
|
+
return param.startsWith('...')
|
|
101
|
+
? `${param.slice(3)}: m[${i + 1}] || ''`
|
|
102
|
+
: `${param}: m[${i + 1}]`;
|
|
103
|
+
})
|
|
104
|
+
.join(', ') +
|
|
105
|
+
'})'
|
|
106
|
+
: 'null';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { generate_manifest as g };
|