@sveltejs/kit 1.0.0-next.32 → 1.0.0-next.322
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 +20 -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 +1687 -0
- package/assets/components/error.svelte +18 -2
- package/assets/env.js +8 -0
- package/assets/paths.js +13 -0
- package/assets/server/index.js +3413 -0
- package/dist/chunks/amp_hook.js +56 -0
- package/dist/chunks/cert.js +28154 -0
- package/dist/chunks/constants.js +663 -0
- package/dist/chunks/filesystem.js +110 -0
- package/dist/chunks/index.js +514 -0
- package/dist/chunks/index2.js +1334 -0
- package/dist/chunks/index3.js +118 -0
- package/dist/chunks/index4.js +182 -0
- package/dist/chunks/index5.js +240 -0
- package/dist/chunks/index6.js +15737 -0
- package/dist/chunks/index7.js +4207 -0
- package/dist/chunks/misc.js +78 -0
- package/dist/chunks/multipart-parser.js +449 -0
- package/dist/chunks/sync.js +978 -0
- package/dist/chunks/url.js +138 -0
- package/dist/cli.js +1024 -65
- package/dist/hooks.js +28 -0
- package/dist/install-fetch.js +6518 -0
- package/dist/node.js +94 -0
- package/package.json +95 -62
- package/svelte-kit.js +0 -1
- package/types/ambient.d.ts +298 -0
- package/types/index.d.ts +278 -0
- package/types/internal.d.ts +320 -0
- package/types/private.d.ts +242 -0
- package/CHANGELOG.md +0 -350
- package/assets/runtime/app/navigation.js +0 -23
- package/assets/runtime/app/navigation.js.map +0 -1
- package/assets/runtime/app/paths.js +0 -2
- package/assets/runtime/app/paths.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 -15
- package/assets/runtime/internal/singletons.js.map +0 -1
- package/assets/runtime/internal/start.js +0 -591
- 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 -32
- package/dist/api.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/create_app.js +0 -577
- package/dist/create_app.js.map +0 -1
- package/dist/index.js +0 -329
- package/dist/index.js.map +0 -1
- package/dist/index2.js +0 -14363
- package/dist/index2.js.map +0 -1
- package/dist/index3.js +0 -544
- package/dist/index3.js.map +0 -1
- package/dist/index4.js +0 -71
- package/dist/index4.js.map +0 -1
- package/dist/index5.js +0 -465
- package/dist/index5.js.map +0 -1
- package/dist/index6.js +0 -727
- package/dist/index6.js.map +0 -1
- package/dist/renderer.js +0 -2413
- package/dist/renderer.js.map +0 -1
- package/dist/standard.js +0 -100
- package/dist/standard.js.map +0 -1
- package/dist/utils.js +0 -57
- package/dist/utils.js.map +0 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Takes zero or more objects and returns a new object that has all the values
|
|
3
|
+
* deeply merged together. None of the original objects will be mutated at any
|
|
4
|
+
* level, and the returned object will have no references to the original
|
|
5
|
+
* objects at any depth. If there's a conflict the last one wins, except for
|
|
6
|
+
* arrays which will be combined.
|
|
7
|
+
* @param {...Object} objects
|
|
8
|
+
* @returns {[Record<string, any>, string[]]} a 2-tuple with the merged object,
|
|
9
|
+
* and a list of merge conflicts if there were any, in dotted notation
|
|
10
|
+
*/
|
|
11
|
+
function deep_merge(...objects) {
|
|
12
|
+
const result = {};
|
|
13
|
+
/** @type {string[]} */
|
|
14
|
+
const conflicts = [];
|
|
15
|
+
objects.forEach((o) => merge_into(result, o, conflicts));
|
|
16
|
+
return [result, conflicts];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* normalize kit.vite.resolve.alias as an array
|
|
21
|
+
* @param {import('vite').AliasOptions} o
|
|
22
|
+
* @returns {import('vite').Alias[]}
|
|
23
|
+
*/
|
|
24
|
+
function normalize_alias(o) {
|
|
25
|
+
if (Array.isArray(o)) return o;
|
|
26
|
+
return Object.entries(o).map(([find, replacement]) => ({ find, replacement }));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Merges b into a, recursively, mutating a.
|
|
31
|
+
* @param {Record<string, any>} a
|
|
32
|
+
* @param {Record<string, any>} b
|
|
33
|
+
* @param {string[]} conflicts array to accumulate conflicts in
|
|
34
|
+
* @param {string[]} path array of property names representing the current
|
|
35
|
+
* location in the tree
|
|
36
|
+
*/
|
|
37
|
+
function merge_into(a, b, conflicts = [], path = []) {
|
|
38
|
+
/**
|
|
39
|
+
* Checks for "plain old Javascript object", typically made as an object
|
|
40
|
+
* literal. Excludes Arrays and built-in types like Buffer.
|
|
41
|
+
* @param {any} x
|
|
42
|
+
*/
|
|
43
|
+
const is_plain_object = (x) => typeof x === 'object' && x.constructor === Object;
|
|
44
|
+
|
|
45
|
+
for (const prop in b) {
|
|
46
|
+
// normalize alias objects to array
|
|
47
|
+
if (prop === 'alias' && path[path.length - 1] === 'resolve') {
|
|
48
|
+
if (a[prop]) a[prop] = normalize_alias(a[prop]);
|
|
49
|
+
if (b[prop]) b[prop] = normalize_alias(b[prop]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (is_plain_object(b[prop])) {
|
|
53
|
+
if (!is_plain_object(a[prop])) {
|
|
54
|
+
if (a[prop] !== undefined) {
|
|
55
|
+
conflicts.push([...path, prop].join('.'));
|
|
56
|
+
}
|
|
57
|
+
a[prop] = {};
|
|
58
|
+
}
|
|
59
|
+
merge_into(a[prop], b[prop], conflicts, [...path, prop]);
|
|
60
|
+
} else if (Array.isArray(b[prop])) {
|
|
61
|
+
if (!Array.isArray(a[prop])) {
|
|
62
|
+
if (a[prop] !== undefined) {
|
|
63
|
+
conflicts.push([...path, prop].join('.'));
|
|
64
|
+
}
|
|
65
|
+
a[prop] = [];
|
|
66
|
+
}
|
|
67
|
+
a[prop].push(...b[prop]);
|
|
68
|
+
} else {
|
|
69
|
+
// Since we're inside a for/in loop which loops over enumerable
|
|
70
|
+
// properties only, we want parity here and to check if 'a' has
|
|
71
|
+
// enumerable-only property 'prop'. Using 'hasOwnProperty' to
|
|
72
|
+
// exclude inherited properties is close enough. It is possible
|
|
73
|
+
// that someone uses Object.defineProperty to create a direct,
|
|
74
|
+
// non-enumerable property but let's not worry about that.
|
|
75
|
+
if (Object.prototype.hasOwnProperty.call(a, prop)) {
|
|
76
|
+
conflicts.push([...path, prop].join('.'));
|
|
77
|
+
}
|
|
78
|
+
a[prop] = b[prop];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const absolute = /^([a-z]+:)?\/?\//;
|
|
84
|
+
const scheme = /^[a-z]+:/;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @param {string} base
|
|
88
|
+
* @param {string} path
|
|
89
|
+
*/
|
|
90
|
+
function resolve(base, path) {
|
|
91
|
+
if (scheme.test(path)) return path;
|
|
92
|
+
|
|
93
|
+
const base_match = absolute.exec(base);
|
|
94
|
+
const path_match = absolute.exec(path);
|
|
95
|
+
|
|
96
|
+
if (!base_match) {
|
|
97
|
+
throw new Error(`bad base path: "${base}"`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const baseparts = path_match ? [] : base.slice(base_match[0].length).split('/');
|
|
101
|
+
const pathparts = path_match ? path.slice(path_match[0].length).split('/') : path.split('/');
|
|
102
|
+
|
|
103
|
+
baseparts.pop();
|
|
104
|
+
|
|
105
|
+
for (let i = 0; i < pathparts.length; i += 1) {
|
|
106
|
+
const part = pathparts[i];
|
|
107
|
+
if (part === '.') continue;
|
|
108
|
+
else if (part === '..') baseparts.pop();
|
|
109
|
+
else baseparts.push(part);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const prefix = (path_match && path_match[0]) || (base_match && base_match[0]) || '';
|
|
113
|
+
|
|
114
|
+
return `${prefix}${baseparts.join('/')}`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** @param {string} path */
|
|
118
|
+
function is_root_relative(path) {
|
|
119
|
+
return path[0] === '/' && path[1] !== '/';
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @param {string} path
|
|
124
|
+
* @param {import('types').TrailingSlash} trailing_slash
|
|
125
|
+
*/
|
|
126
|
+
function normalize_path(path, trailing_slash) {
|
|
127
|
+
if (path === '/' || trailing_slash === 'ignore') return path;
|
|
128
|
+
|
|
129
|
+
if (trailing_slash === 'never') {
|
|
130
|
+
return path.endsWith('/') ? path.slice(0, -1) : path;
|
|
131
|
+
} else if (trailing_slash === 'always' && !path.endsWith('/')) {
|
|
132
|
+
return path + '/';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return path;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { deep_merge as d, is_root_relative as i, normalize_path as n, resolve as r };
|