@sveltejs/kit 2.50.0 → 2.50.2
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/package.json +3 -3
- package/src/core/generate_manifest/find_server_assets.js +4 -1
- package/src/core/postbuild/crawl.js +3 -3
- package/src/exports/public.d.ts +15 -2
- package/src/exports/vite/build/build_server.js +116 -80
- package/src/exports/vite/index.js +10 -2
- package/src/runtime/app/environment/index.js +1 -5
- package/src/runtime/app/server/remote/command.js +3 -1
- package/src/runtime/app/server/remote/form.js +1 -2
- package/src/runtime/app/server/remote/prerender.js +1 -1
- package/src/runtime/app/server/remote/query.js +39 -18
- package/src/runtime/app/server/remote/shared.js +4 -5
- package/src/runtime/client/client.js +6 -5
- package/src/runtime/server/page/csp.js +12 -6
- package/src/runtime/server/page/render.js +8 -1
- package/src/runtime/server/remote.js +4 -15
- package/src/types/internal.d.ts +5 -3
- package/src/types/private.d.ts +2 -0
- package/src/utils/css.js +210 -0
- package/src/utils/routing.js +6 -2
- package/src/version.js +1 -1
- package/types/index.d.ts +18 -2
- package/types/index.d.ts.map +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/kit",
|
|
3
|
-
"version": "2.50.
|
|
3
|
+
"version": "2.50.2",
|
|
4
4
|
"description": "SvelteKit is the fastest way to build Svelte apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"magic-string": "^0.30.5",
|
|
30
30
|
"mrmime": "^2.0.0",
|
|
31
31
|
"sade": "^1.8.1",
|
|
32
|
-
"set-cookie-parser": "^
|
|
32
|
+
"set-cookie-parser": "^3.0.0",
|
|
33
33
|
"sirv": "^3.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/set-cookie-parser": "^2.4.7",
|
|
42
42
|
"dts-buddy": "^0.6.2",
|
|
43
43
|
"rollup": "^4.14.2",
|
|
44
|
-
"svelte": "^5.
|
|
44
|
+
"svelte": "^5.48.4",
|
|
45
45
|
"svelte-preprocess": "^6.0.0",
|
|
46
46
|
"typescript": "^5.3.3",
|
|
47
47
|
"vite": "^6.3.5",
|
|
@@ -13,7 +13,6 @@ export function find_server_assets(build_data, routes) {
|
|
|
13
13
|
*/
|
|
14
14
|
const used_nodes = new Set([0, 1]);
|
|
15
15
|
|
|
16
|
-
// TODO add hooks.server.js asset imports
|
|
17
16
|
/** @type {Set<string>} */
|
|
18
17
|
const server_assets = new Set();
|
|
19
18
|
|
|
@@ -49,5 +48,9 @@ export function find_server_assets(build_data, routes) {
|
|
|
49
48
|
add_assets(build_data.manifest_data.hooks.server);
|
|
50
49
|
}
|
|
51
50
|
|
|
51
|
+
if (build_data.manifest_data.hooks.universal) {
|
|
52
|
+
add_assets(build_data.manifest_data.hooks.universal);
|
|
53
|
+
}
|
|
54
|
+
|
|
52
55
|
return Array.from(server_assets);
|
|
53
56
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolve } from '../../utils/url.js';
|
|
1
|
+
import { resolve, decode_uri } from '../../utils/url.js';
|
|
2
2
|
import { decode } from './entities.js';
|
|
3
3
|
|
|
4
4
|
const DOCTYPE = 'DOCTYPE';
|
|
@@ -193,11 +193,11 @@ export function crawl(html, base) {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
if (id) {
|
|
196
|
-
ids.push(id);
|
|
196
|
+
ids.push(decode_uri(id));
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
if (name && tag === 'A') {
|
|
200
|
-
ids.push(name);
|
|
200
|
+
ids.push(decode_uri(name));
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
if (src) {
|
package/src/exports/public.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
PrerenderUnseenRoutesHandlerValue,
|
|
16
16
|
PrerenderOption,
|
|
17
17
|
RequestOptions,
|
|
18
|
-
RouteSegment
|
|
18
|
+
RouteSegment,
|
|
19
|
+
IsAny
|
|
19
20
|
} from '../types/private.js';
|
|
20
21
|
import { BuildData, SSRNodeLoader, SSRRoute, ValidatedConfig } from 'types';
|
|
21
22
|
import { SvelteConfig } from '@sveltejs/vite-plugin-svelte';
|
|
@@ -1953,6 +1954,18 @@ type UnknownField<Value> = RemoteFormFieldMethods<Value> & {
|
|
|
1953
1954
|
[key: string | number]: UnknownField<any>;
|
|
1954
1955
|
};
|
|
1955
1956
|
|
|
1957
|
+
type RemoteFormFieldsRoot<Input extends RemoteFormInput | void> =
|
|
1958
|
+
IsAny<Input> extends true
|
|
1959
|
+
? RecursiveFormFields
|
|
1960
|
+
: Input extends void
|
|
1961
|
+
? {
|
|
1962
|
+
/** Validation issues, if any */
|
|
1963
|
+
issues(): RemoteFormIssue[] | undefined;
|
|
1964
|
+
/** Validation issues belonging to this or any of the fields that belong to it, if any */
|
|
1965
|
+
allIssues(): RemoteFormIssue[] | undefined;
|
|
1966
|
+
}
|
|
1967
|
+
: RemoteFormFields<Input>;
|
|
1968
|
+
|
|
1956
1969
|
/**
|
|
1957
1970
|
* Recursive type to build form fields structure with proxy access
|
|
1958
1971
|
*/
|
|
@@ -2077,7 +2090,7 @@ export type RemoteForm<Input extends RemoteFormInput | void, Output> = {
|
|
|
2077
2090
|
/** The number of pending submissions */
|
|
2078
2091
|
get pending(): number;
|
|
2079
2092
|
/** Access form fields using object notation */
|
|
2080
|
-
fields:
|
|
2093
|
+
fields: RemoteFormFieldsRoot<Input>;
|
|
2081
2094
|
};
|
|
2082
2095
|
|
|
2083
2096
|
/**
|
|
@@ -5,14 +5,43 @@ import { s } from '../../../utils/misc.js';
|
|
|
5
5
|
import { normalizePath } from 'vite';
|
|
6
6
|
import { basename, join } from 'node:path';
|
|
7
7
|
import { create_node_analyser } from '../static_analysis/index.js';
|
|
8
|
+
import { fix_css_urls } from '../../../utils/css.js';
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Regenerate server nodes after acquiring client manifest
|
|
12
|
+
* @overload
|
|
13
|
+
* @param {string} out
|
|
14
|
+
* @param {import('types').ValidatedKitConfig} kit
|
|
15
|
+
* @param {import('types').ManifestData} manifest_data
|
|
16
|
+
* @param {import('vite').Manifest} server_manifest
|
|
17
|
+
* @param {import('vite').Manifest} client_manifest
|
|
18
|
+
* @param {string} assets_path
|
|
19
|
+
* @param {import('vite').Rollup.RollupOutput['output']} client_chunks
|
|
20
|
+
* @param {import('types').RecursiveRequired<import('types').ValidatedConfig['kit']['output']>} output_config
|
|
21
|
+
* @param {Map<string, { page_options: Record<string, any> | null, children: string[] }>} static_exports
|
|
22
|
+
* @returns {Promise<void>}
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Build server nodes without client manifest for analysis phase
|
|
26
|
+
* @overload
|
|
27
|
+
* @param {string} out
|
|
28
|
+
* @param {import('types').ValidatedKitConfig} kit
|
|
29
|
+
* @param {import('types').ManifestData} manifest_data
|
|
30
|
+
* @param {import('vite').Manifest} server_manifest
|
|
31
|
+
* @param {null} client_manifest
|
|
32
|
+
* @param {null} assets_path
|
|
33
|
+
* @param {null} client_chunks
|
|
34
|
+
* @param {import('types').RecursiveRequired<import('types').ValidatedConfig['kit']['output']>} output_config
|
|
35
|
+
* @param {Map<string, { page_options: Record<string, any> | null, children: string[] }>} static_exports
|
|
36
|
+
* @returns {Promise<void>}
|
|
37
|
+
*/
|
|
9
38
|
/**
|
|
10
39
|
* @param {string} out
|
|
11
40
|
* @param {import('types').ValidatedKitConfig} kit
|
|
12
41
|
* @param {import('types').ManifestData} manifest_data
|
|
13
42
|
* @param {import('vite').Manifest} server_manifest
|
|
14
43
|
* @param {import('vite').Manifest | null} client_manifest
|
|
15
|
-
* @param {
|
|
44
|
+
* @param {string | null} assets_path
|
|
16
45
|
* @param {import('vite').Rollup.RollupOutput['output'] | null} client_chunks
|
|
17
46
|
* @param {import('types').RecursiveRequired<import('types').ValidatedConfig['kit']['output']>} output_config
|
|
18
47
|
* @param {Map<string, { page_options: Record<string, any> | null, children: string[] }>} static_exports
|
|
@@ -23,7 +52,7 @@ export async function build_server_nodes(
|
|
|
23
52
|
manifest_data,
|
|
24
53
|
server_manifest,
|
|
25
54
|
client_manifest,
|
|
26
|
-
|
|
55
|
+
assets_path,
|
|
27
56
|
client_chunks,
|
|
28
57
|
output_config,
|
|
29
58
|
static_exports
|
|
@@ -31,38 +60,59 @@ export async function build_server_nodes(
|
|
|
31
60
|
mkdirp(`${out}/server/nodes`);
|
|
32
61
|
mkdirp(`${out}/server/stylesheets`);
|
|
33
62
|
|
|
34
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Stylesheet names and their contents which are below the inline threshold
|
|
65
|
+
* @type {Map<string, string>}
|
|
66
|
+
*/
|
|
35
67
|
const stylesheets_to_inline = new Map();
|
|
36
68
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
69
|
+
/**
|
|
70
|
+
* For CSS inlining, we either store a string or a function that returns the
|
|
71
|
+
* styles with the correct relative URLs
|
|
72
|
+
* @type {(css: string, eager_assets: Set<string>) => string}
|
|
73
|
+
*/
|
|
74
|
+
let prepare_css_for_inlining = (css) => s(css);
|
|
40
75
|
|
|
41
|
-
|
|
42
|
-
for (const
|
|
43
|
-
|
|
44
|
-
if (!server_stylesheet) {
|
|
76
|
+
if (client_chunks && kit.inlineStyleThreshold > 0 && output_config.bundleStrategy === 'split') {
|
|
77
|
+
for (const chunk of client_chunks) {
|
|
78
|
+
if (chunk.type !== 'asset' || !chunk.fileName.endsWith('.css')) {
|
|
45
79
|
continue;
|
|
46
80
|
}
|
|
47
|
-
client_stylesheet.forEach((file, i) => {
|
|
48
|
-
stylesheets_to_inline.set(file, server_stylesheet[i]);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
81
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
stylesheets_to_inline.delete(fileName);
|
|
82
|
+
const source = chunk.source.toString();
|
|
83
|
+
if (source.length < kit.inlineStyleThreshold) {
|
|
84
|
+
stylesheets_to_inline.set(chunk.fileName, source);
|
|
56
85
|
}
|
|
57
86
|
}
|
|
58
87
|
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
88
|
+
// If the client CSS has URL references to assets, we need to adjust the
|
|
89
|
+
// relative path so that they are correct when inlined into the document.
|
|
90
|
+
// Although `paths.assets` is static, we need to pass in a fake path
|
|
91
|
+
// `/_svelte_kit_assets` at runtime when running `vite preview`
|
|
92
|
+
if (kit.paths.assets || kit.paths.relative) {
|
|
93
|
+
const static_assets = new Set(
|
|
94
|
+
manifest_data.assets.map((asset) => decodeURIComponent(asset.file))
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const segments = /** @type {string} */ (assets_path).split('/');
|
|
98
|
+
const static_asset_prefix = segments.map(() => '..').join('/') + '/';
|
|
99
|
+
|
|
100
|
+
prepare_css_for_inlining = (css, eager_assets) => {
|
|
101
|
+
const transformed_css = fix_css_urls({
|
|
102
|
+
css,
|
|
103
|
+
vite_assets: eager_assets,
|
|
104
|
+
static_assets,
|
|
105
|
+
paths_assets: '${assets}',
|
|
106
|
+
base: '${base}',
|
|
107
|
+
static_asset_prefix
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// only convert to a function if we have adjusted any URLs
|
|
111
|
+
if (css !== transformed_css) {
|
|
112
|
+
return `function css(assets, base) { return \`${s(transformed_css).slice(1, -1)}\`; }`;
|
|
113
|
+
}
|
|
114
|
+
return s(css);
|
|
115
|
+
};
|
|
66
116
|
}
|
|
67
117
|
}
|
|
68
118
|
|
|
@@ -96,6 +146,9 @@ export async function build_server_nodes(
|
|
|
96
146
|
/** @type {string[]} */
|
|
97
147
|
let fonts = [];
|
|
98
148
|
|
|
149
|
+
/** @type {Set<string>} */
|
|
150
|
+
let eager_assets = new Set();
|
|
151
|
+
|
|
99
152
|
if (node.component && client_manifest) {
|
|
100
153
|
exports.push(
|
|
101
154
|
'let component_cache;',
|
|
@@ -135,7 +188,7 @@ export async function build_server_nodes(
|
|
|
135
188
|
const entry_path = `${normalizePath(kit.outDir)}/generated/client-optimized/nodes/${i}.js`;
|
|
136
189
|
const entry = find_deps(client_manifest, entry_path, true);
|
|
137
190
|
|
|
138
|
-
//
|
|
191
|
+
// Eagerly load client stylesheets and fonts imported by the SSR-ed page to avoid FOUC.
|
|
139
192
|
// However, if it is not used during SSR (not present in the server manifest),
|
|
140
193
|
// then it can be lazily loaded in the browser.
|
|
141
194
|
|
|
@@ -153,8 +206,6 @@ export async function build_server_nodes(
|
|
|
153
206
|
|
|
154
207
|
/** @type {Set<string>} */
|
|
155
208
|
const eager_css = new Set();
|
|
156
|
-
/** @type {Set<string>} */
|
|
157
|
-
const eager_assets = new Set();
|
|
158
209
|
|
|
159
210
|
entry.stylesheet_map.forEach((value, filepath) => {
|
|
160
211
|
// pages and layouts are renamed to node indexes when optimised for the client
|
|
@@ -180,27 +231,46 @@ export async function build_server_nodes(
|
|
|
180
231
|
`export const fonts = ${s(fonts)};`
|
|
181
232
|
);
|
|
182
233
|
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Assets that have been processed by Vite (decoded and with the asset path stripped)
|
|
236
|
+
* @type {Set<string>}
|
|
237
|
+
*/
|
|
238
|
+
let vite_assets = new Set();
|
|
239
|
+
|
|
240
|
+
// Keep track of Vite asset filenames so that we avoid touching unrelated ones
|
|
241
|
+
// when adjusting the inlined CSS
|
|
242
|
+
if (stylesheets_to_inline.size && assets_path && eager_assets.size) {
|
|
243
|
+
vite_assets = new Set(
|
|
244
|
+
Array.from(eager_assets).map((asset) => {
|
|
245
|
+
return decodeURIComponent(asset.replace(`${assets_path}/`, ''));
|
|
246
|
+
})
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (stylesheets_to_inline.size) {
|
|
251
|
+
/** @type {string[]} */
|
|
252
|
+
const inline_styles = [];
|
|
253
|
+
|
|
254
|
+
stylesheets.forEach((file, i) => {
|
|
255
|
+
if (stylesheets_to_inline.has(file)) {
|
|
256
|
+
const filename = basename(file);
|
|
257
|
+
const dest = `${out}/server/stylesheets/${filename}.js`;
|
|
258
|
+
|
|
259
|
+
let css = /** @type {string} */ (stylesheets_to_inline.get(file));
|
|
260
|
+
|
|
261
|
+
fs.writeFileSync(
|
|
262
|
+
dest,
|
|
263
|
+
`// ${filename}\nexport default ${prepare_css_for_inlining(css, vite_assets)};`
|
|
264
|
+
);
|
|
265
|
+
const name = `stylesheet_${i}`;
|
|
266
|
+
imports.push(`import ${name} from '../stylesheets/${filename}.js';`);
|
|
267
|
+
inline_styles.push(`\t${s(file)}: ${name}`);
|
|
193
268
|
}
|
|
194
|
-
|
|
269
|
+
});
|
|
195
270
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
inline_styles.push(`\t${s(file)}: ${name}`);
|
|
271
|
+
if (inline_styles.length > 0) {
|
|
272
|
+
exports.push(`export const inline_styles = () => ({\n${inline_styles.join(',\n')}\n});`);
|
|
199
273
|
}
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
if (inline_styles.length > 0) {
|
|
203
|
-
exports.push(`export const inline_styles = () => ({\n${inline_styles.join(',\n')}\n});`);
|
|
204
274
|
}
|
|
205
275
|
|
|
206
276
|
fs.writeFileSync(
|
|
@@ -209,37 +279,3 @@ export async function build_server_nodes(
|
|
|
209
279
|
);
|
|
210
280
|
}
|
|
211
281
|
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* @param {(import('vite').Rollup.OutputAsset | import('vite').Rollup.OutputChunk)[]} chunks
|
|
215
|
-
*/
|
|
216
|
-
function get_stylesheets(chunks) {
|
|
217
|
-
/**
|
|
218
|
-
* A map of module IDs and the stylesheets they use.
|
|
219
|
-
* @type {Map<string, string[]>}
|
|
220
|
-
*/
|
|
221
|
-
const stylesheets_used = new Map();
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* A map of stylesheet names and their content.
|
|
225
|
-
* @type {Map<string, string>}
|
|
226
|
-
*/
|
|
227
|
-
const stylesheet_content = new Map();
|
|
228
|
-
|
|
229
|
-
for (const chunk of chunks) {
|
|
230
|
-
if (chunk.type === 'asset') {
|
|
231
|
-
if (chunk.fileName.endsWith('.css')) {
|
|
232
|
-
stylesheet_content.set(chunk.fileName, chunk.source.toString());
|
|
233
|
-
}
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (chunk.viteMetadata?.importedCss.size) {
|
|
238
|
-
const css = Array.from(chunk.viteMetadata.importedCss);
|
|
239
|
-
for (const id of chunk.moduleIds) {
|
|
240
|
-
stylesheets_used.set(id, css);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return { stylesheets_used, stylesheet_content };
|
|
245
|
-
}
|
|
@@ -848,6 +848,14 @@ async function kit({ svelte_config }) {
|
|
|
848
848
|
input[name] = path.resolve(file);
|
|
849
849
|
});
|
|
850
850
|
|
|
851
|
+
// ...and the hooks files
|
|
852
|
+
if (manifest_data.hooks.server) {
|
|
853
|
+
input['entries/hooks.server'] = path.resolve(manifest_data.hooks.server);
|
|
854
|
+
}
|
|
855
|
+
if (manifest_data.hooks.universal) {
|
|
856
|
+
input['entries/hooks.universal'] = path.resolve(manifest_data.hooks.universal);
|
|
857
|
+
}
|
|
858
|
+
|
|
851
859
|
// ...and the server instrumentation file
|
|
852
860
|
const server_instrumentation = resolve_entry(
|
|
853
861
|
path.join(kit.files.src, 'instrumentation.server')
|
|
@@ -1023,7 +1031,7 @@ async function kit({ svelte_config }) {
|
|
|
1023
1031
|
*/
|
|
1024
1032
|
writeBundle: {
|
|
1025
1033
|
sequential: true,
|
|
1026
|
-
async handler(_options
|
|
1034
|
+
async handler(_options) {
|
|
1027
1035
|
if (secondary_build_started) return; // only run this once
|
|
1028
1036
|
|
|
1029
1037
|
const verbose = vite_config.logLevel === 'info';
|
|
@@ -1263,7 +1271,7 @@ async function kit({ svelte_config }) {
|
|
|
1263
1271
|
manifest_data,
|
|
1264
1272
|
server_manifest,
|
|
1265
1273
|
client_manifest,
|
|
1266
|
-
|
|
1274
|
+
assets_path,
|
|
1267
1275
|
client_chunks,
|
|
1268
1276
|
svelte_config.kit.output,
|
|
1269
1277
|
static_exports
|
|
@@ -78,7 +78,9 @@ export function command(validate_or_fn, maybe_fn) {
|
|
|
78
78
|
|
|
79
79
|
state.refreshes ??= {};
|
|
80
80
|
|
|
81
|
-
const promise = Promise.resolve(
|
|
81
|
+
const promise = Promise.resolve(
|
|
82
|
+
run_remote_function(event, state, true, () => validate(arg), fn)
|
|
83
|
+
);
|
|
82
84
|
|
|
83
85
|
// @ts-expect-error
|
|
84
86
|
promise.updates = () => {
|
|
@@ -131,7 +131,7 @@ export function prerender(validate_or_fn, fn_or_options, maybe_options) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
const promise = get_response(__, arg, state, () =>
|
|
134
|
-
run_remote_function(event, state, false,
|
|
134
|
+
run_remote_function(event, state, false, () => validate(arg), fn)
|
|
135
135
|
);
|
|
136
136
|
|
|
137
137
|
if (state.prerendering) {
|
|
@@ -5,6 +5,8 @@ import { get_request_store } from '@sveltejs/kit/internal/server';
|
|
|
5
5
|
import { create_remote_key, stringify_remote_arg } from '../../../shared.js';
|
|
6
6
|
import { prerendering } from '__sveltekit/environment';
|
|
7
7
|
import { create_validator, get_cache, get_response, run_remote_function } from './shared.js';
|
|
8
|
+
import { handle_error_and_jsonify } from '../../../server/utils.js';
|
|
9
|
+
import { HttpError, SvelteKitError } from '@sveltejs/kit/internal';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
@@ -73,7 +75,7 @@ export function query(validate_or_fn, maybe_fn) {
|
|
|
73
75
|
const { event, state } = get_request_store();
|
|
74
76
|
|
|
75
77
|
const get_remote_function_result = () =>
|
|
76
|
-
run_remote_function(event, state, false,
|
|
78
|
+
run_remote_function(event, state, false, () => validate(arg), fn);
|
|
77
79
|
|
|
78
80
|
/** @type {Promise<any> & Partial<RemoteQuery<any>>} */
|
|
79
81
|
const promise = get_response(__, arg, state, get_remote_function_result);
|
|
@@ -137,7 +139,7 @@ export function query(validate_or_fn, maybe_fn) {
|
|
|
137
139
|
*/
|
|
138
140
|
/*@__NO_SIDE_EFFECTS__*/
|
|
139
141
|
function batch(validate_or_fn, maybe_fn) {
|
|
140
|
-
/** @type {(args?: Input[]) => (arg: Input, idx: number) => Output} */
|
|
142
|
+
/** @type {(args?: Input[]) => MaybePromise<(arg: Input, idx: number) => Output>} */
|
|
141
143
|
const fn = maybe_fn ?? validate_or_fn;
|
|
142
144
|
|
|
143
145
|
/** @type {(arg?: any) => MaybePromise<Input>} */
|
|
@@ -148,16 +150,34 @@ function batch(validate_or_fn, maybe_fn) {
|
|
|
148
150
|
type: 'query_batch',
|
|
149
151
|
id: '',
|
|
150
152
|
name: '',
|
|
151
|
-
run: (args) => {
|
|
153
|
+
run: async (args, options) => {
|
|
152
154
|
const { event, state } = get_request_store();
|
|
153
155
|
|
|
154
156
|
return run_remote_function(
|
|
155
157
|
event,
|
|
156
158
|
state,
|
|
157
159
|
false,
|
|
158
|
-
args,
|
|
159
|
-
(
|
|
160
|
-
|
|
160
|
+
async () => Promise.all(args.map(validate)),
|
|
161
|
+
async (/** @type {any[]} */ input) => {
|
|
162
|
+
const get_result = await fn(input);
|
|
163
|
+
|
|
164
|
+
return Promise.all(
|
|
165
|
+
input.map(async (arg, i) => {
|
|
166
|
+
try {
|
|
167
|
+
return { type: 'result', data: get_result(arg, i) };
|
|
168
|
+
} catch (error) {
|
|
169
|
+
return {
|
|
170
|
+
type: 'error',
|
|
171
|
+
error: await handle_error_and_jsonify(event, state, options, error),
|
|
172
|
+
status:
|
|
173
|
+
error instanceof HttpError || error instanceof SvelteKitError
|
|
174
|
+
? error.status
|
|
175
|
+
: 500
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
);
|
|
180
|
+
}
|
|
161
181
|
);
|
|
162
182
|
}
|
|
163
183
|
};
|
|
@@ -190,22 +210,23 @@ function batch(validate_or_fn, maybe_fn) {
|
|
|
190
210
|
batching = { args: [], resolvers: [] };
|
|
191
211
|
|
|
192
212
|
try {
|
|
193
|
-
|
|
213
|
+
return await run_remote_function(
|
|
194
214
|
event,
|
|
195
215
|
state,
|
|
196
216
|
false,
|
|
197
|
-
batched.args,
|
|
198
|
-
(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
217
|
+
async () => Promise.all(batched.args.map(validate)),
|
|
218
|
+
async (input) => {
|
|
219
|
+
const get_result = await fn(input);
|
|
220
|
+
|
|
221
|
+
for (let i = 0; i < batched.resolvers.length; i++) {
|
|
222
|
+
try {
|
|
223
|
+
batched.resolvers[i].resolve(get_result(input[i], i));
|
|
224
|
+
} catch (error) {
|
|
225
|
+
batched.resolvers[i].reject(error);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
207
228
|
}
|
|
208
|
-
|
|
229
|
+
);
|
|
209
230
|
} catch (error) {
|
|
210
231
|
for (const resolver of batched.resolvers) {
|
|
211
232
|
resolver.reject(error);
|
|
@@ -97,11 +97,10 @@ export function parse_remote_response(data, transport) {
|
|
|
97
97
|
* @param {RequestEvent} event
|
|
98
98
|
* @param {RequestState} state
|
|
99
99
|
* @param {boolean} allow_cookies
|
|
100
|
-
* @param {any}
|
|
101
|
-
* @param {(arg: any) => any} validate
|
|
100
|
+
* @param {() => any} get_input
|
|
102
101
|
* @param {(arg?: any) => T} fn
|
|
103
102
|
*/
|
|
104
|
-
export async function run_remote_function(event, state, allow_cookies,
|
|
103
|
+
export async function run_remote_function(event, state, allow_cookies, get_input, fn) {
|
|
105
104
|
/** @type {RequestStore} */
|
|
106
105
|
const store = {
|
|
107
106
|
event: {
|
|
@@ -142,8 +141,8 @@ export async function run_remote_function(event, state, allow_cookies, arg, vali
|
|
|
142
141
|
};
|
|
143
142
|
|
|
144
143
|
// In two parts, each with_event, so that runtimes without async local storage can still get the event at the start of the function
|
|
145
|
-
const
|
|
146
|
-
return with_request_store(store, () => fn(
|
|
144
|
+
const input = await with_request_store(store, get_input);
|
|
145
|
+
return with_request_store(store, () => fn(input));
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
/**
|
|
@@ -1860,8 +1860,8 @@ if (import.meta.hot) {
|
|
|
1860
1860
|
function setup_preload() {
|
|
1861
1861
|
/** @type {NodeJS.Timeout} */
|
|
1862
1862
|
let mousemove_timeout;
|
|
1863
|
-
/** @type {Element} */
|
|
1864
|
-
let current_a;
|
|
1863
|
+
/** @type {{ element: Element | SVGAElement | undefined; href: string | SVGAnimatedString | undefined }} */
|
|
1864
|
+
let current_a = { element: undefined, href: undefined };
|
|
1865
1865
|
/** @type {PreloadDataPriority} */
|
|
1866
1866
|
let current_priority;
|
|
1867
1867
|
|
|
@@ -1903,7 +1903,8 @@ function setup_preload() {
|
|
|
1903
1903
|
const a = find_anchor(element, container);
|
|
1904
1904
|
|
|
1905
1905
|
// we don't want to preload data again if the user has already hovered/tapped
|
|
1906
|
-
const interacted =
|
|
1906
|
+
const interacted =
|
|
1907
|
+
a === current_a.element && a?.href === current_a.href && priority >= current_priority;
|
|
1907
1908
|
if (!a || interacted) return;
|
|
1908
1909
|
|
|
1909
1910
|
const { url, external, download } = get_link_info(a, base, app.hash);
|
|
@@ -1916,7 +1917,7 @@ function setup_preload() {
|
|
|
1916
1917
|
if (options.reload || same_url) return;
|
|
1917
1918
|
|
|
1918
1919
|
if (priority <= options.preload_data) {
|
|
1919
|
-
current_a = a;
|
|
1920
|
+
current_a = { element: a, href: a.href };
|
|
1920
1921
|
// we don't want to preload data again on tap if we've already preloaded it on hover
|
|
1921
1922
|
current_priority = PRELOAD_PRIORITIES.tap;
|
|
1922
1923
|
|
|
@@ -1938,7 +1939,7 @@ function setup_preload() {
|
|
|
1938
1939
|
void _preload_data(intent);
|
|
1939
1940
|
}
|
|
1940
1941
|
} else if (priority <= options.preload_code) {
|
|
1941
|
-
current_a = a;
|
|
1942
|
+
current_a = { element: a, href: a.href };
|
|
1942
1943
|
current_priority = priority;
|
|
1943
1944
|
void _preload_code(/** @type {URL} */ (url));
|
|
1944
1945
|
}
|
|
@@ -138,14 +138,20 @@ class BaseProvider {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
|
|
141
|
-
const
|
|
141
|
+
const style_needs_csp = (directive) =>
|
|
142
142
|
!!directive && !directive.some((value) => value === 'unsafe-inline');
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
/** @param {(import('types').Csp.Source | import('types').Csp.ActionSource)[] | undefined} directive */
|
|
145
|
+
const script_needs_csp = (directive) =>
|
|
146
|
+
!!directive &&
|
|
147
|
+
(!directive.some((value) => value === 'unsafe-inline') ||
|
|
148
|
+
directive.some((value) => value === 'strict-dynamic'));
|
|
149
|
+
|
|
150
|
+
this.#script_src_needs_csp = script_needs_csp(effective_script_src);
|
|
151
|
+
this.#script_src_elem_needs_csp = script_needs_csp(script_src_elem);
|
|
152
|
+
this.#style_src_needs_csp = style_needs_csp(effective_style_src);
|
|
153
|
+
this.#style_src_attr_needs_csp = style_needs_csp(style_src_attr);
|
|
154
|
+
this.#style_src_elem_needs_csp = style_needs_csp(style_src_elem);
|
|
149
155
|
|
|
150
156
|
this.#script_needs_csp = this.#script_src_needs_csp || this.#script_src_elem_needs_csp;
|
|
151
157
|
this.#style_needs_csp =
|
|
@@ -245,7 +245,14 @@ export async function render_response({
|
|
|
245
245
|
for (const url of node.fonts) fonts.add(url);
|
|
246
246
|
|
|
247
247
|
if (node.inline_styles && !client.inline) {
|
|
248
|
-
Object.entries(await node.inline_styles()).forEach(([
|
|
248
|
+
Object.entries(await node.inline_styles()).forEach(([filename, css]) => {
|
|
249
|
+
if (typeof css === 'string') {
|
|
250
|
+
inline_styles.set(filename, css);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
inline_styles.set(filename, css(`${assets}/${paths.app_dir}/immutable/assets`, assets));
|
|
255
|
+
});
|
|
249
256
|
}
|
|
250
257
|
}
|
|
251
258
|
} else {
|
|
@@ -73,23 +73,12 @@ async function handle_remote_call_internal(event, state, options, manifest, id)
|
|
|
73
73
|
/** @type {{ payloads: string[] }} */
|
|
74
74
|
const { payloads } = await event.request.json();
|
|
75
75
|
|
|
76
|
-
const args =
|
|
77
|
-
|
|
78
|
-
const results = await Promise.all(
|
|
79
|
-
args.map(async (arg, i) => {
|
|
80
|
-
try {
|
|
81
|
-
return { type: 'result', data: get_result(arg, i) };
|
|
82
|
-
} catch (error) {
|
|
83
|
-
return {
|
|
84
|
-
type: 'error',
|
|
85
|
-
error: await handle_error_and_jsonify(event, state, options, error),
|
|
86
|
-
status:
|
|
87
|
-
error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
})
|
|
76
|
+
const args = await Promise.all(
|
|
77
|
+
payloads.map((payload) => parse_remote_arg(payload, transport))
|
|
91
78
|
);
|
|
92
79
|
|
|
80
|
+
const results = await with_request_store({ event, state }, () => info.run(args, options));
|
|
81
|
+
|
|
93
82
|
return json(
|
|
94
83
|
/** @type {RemoteFunctionResponse} */ ({
|
|
95
84
|
type: 'result',
|
package/src/types/internal.d.ts
CHANGED
|
@@ -431,7 +431,9 @@ export interface SSRNode {
|
|
|
431
431
|
server_id?: string;
|
|
432
432
|
|
|
433
433
|
/** inlined styles */
|
|
434
|
-
inline_styles?(): MaybePromise<
|
|
434
|
+
inline_styles?(): MaybePromise<
|
|
435
|
+
Record<string, string | ((assets: string, base: string) => string)>
|
|
436
|
+
>;
|
|
435
437
|
/** Svelte component */
|
|
436
438
|
component?: SSRComponentLoader;
|
|
437
439
|
/** +page.js or +layout.js */
|
|
@@ -570,8 +572,8 @@ export type RemoteInfo =
|
|
|
570
572
|
type: 'query_batch';
|
|
571
573
|
id: string;
|
|
572
574
|
name: string;
|
|
573
|
-
/** Direct access to the function
|
|
574
|
-
run: (args: any[]
|
|
575
|
+
/** Direct access to the function, for remote functions called from the client */
|
|
576
|
+
run: (args: any[], options: SSROptions) => Promise<any[]>;
|
|
575
577
|
}
|
|
576
578
|
| {
|
|
577
579
|
type: 'form';
|
package/src/types/private.d.ts
CHANGED
package/src/utils/css.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import MagicString from 'magic-string';
|
|
2
|
+
import * as svelte from 'svelte/compiler';
|
|
3
|
+
|
|
4
|
+
/** @typedef {ReturnType<typeof import('svelte/compiler').parseCss>['children']} StyleSheetChildren */
|
|
5
|
+
|
|
6
|
+
/** @typedef {{ property: string; value: string; start: number; end: number; type: 'Declaration' }} Declaration */
|
|
7
|
+
|
|
8
|
+
const parse = svelte.parseCss
|
|
9
|
+
? svelte.parseCss
|
|
10
|
+
: /** @param {string} css */
|
|
11
|
+
(css) => {
|
|
12
|
+
return /** @type {{ css: { children: StyleSheetChildren } }} */ (
|
|
13
|
+
svelte.parse(`<style>${css}</style>`)
|
|
14
|
+
).css;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const SKIP_PARSING_REGEX = /url\(/i;
|
|
18
|
+
|
|
19
|
+
/** Capture a single url(...) so we can process them one at a time */
|
|
20
|
+
const URL_FUNCTION_REGEX = /url\(\s*.*?\)/gi;
|
|
21
|
+
|
|
22
|
+
/** Captures the value inside a CSS url(...) */
|
|
23
|
+
const URL_PARAMETER_REGEX = /url\(\s*(['"]?)(.*?)\1\s*\)/i;
|
|
24
|
+
|
|
25
|
+
/** Splits the URL if there's a query string or hash fragment */
|
|
26
|
+
const HASH_OR_QUERY_REGEX = /[#?]/;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Assets handled by Vite that are referenced in the stylesheet always start
|
|
30
|
+
* with this prefix because Vite emits them into the same directory as the CSS file
|
|
31
|
+
*/
|
|
32
|
+
const VITE_ASSET_PREFIX = './';
|
|
33
|
+
|
|
34
|
+
const AST_OFFSET = '<style>'.length;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* We need to fix the asset URLs in the CSS before we inline them into a document
|
|
38
|
+
* because they are now relative to the document instead of the CSS file.
|
|
39
|
+
* @param {{
|
|
40
|
+
* css: string;
|
|
41
|
+
* vite_assets: Set<string>;
|
|
42
|
+
* static_assets: Set<string>;
|
|
43
|
+
* paths_assets: string;
|
|
44
|
+
* base: string;
|
|
45
|
+
* static_asset_prefix: string;
|
|
46
|
+
* }} opts
|
|
47
|
+
* @returns {string}
|
|
48
|
+
*/
|
|
49
|
+
export function fix_css_urls({
|
|
50
|
+
css,
|
|
51
|
+
vite_assets,
|
|
52
|
+
static_assets,
|
|
53
|
+
paths_assets,
|
|
54
|
+
base,
|
|
55
|
+
static_asset_prefix
|
|
56
|
+
}) {
|
|
57
|
+
// skip parsing if there are no url(...) occurrences
|
|
58
|
+
if (!SKIP_PARSING_REGEX.test(css)) {
|
|
59
|
+
return css;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// safe guard in case of trailing slashes (but this should never happen)
|
|
63
|
+
if (paths_assets.endsWith('/')) {
|
|
64
|
+
paths_assets = paths_assets.slice(0, -1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (base.endsWith('/')) {
|
|
68
|
+
base = base.slice(0, -1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const s = new MagicString(css);
|
|
72
|
+
|
|
73
|
+
const parsed = parse(css);
|
|
74
|
+
|
|
75
|
+
for (const child of parsed.children) {
|
|
76
|
+
find_declarations(child, (declaration) => {
|
|
77
|
+
if (!SKIP_PARSING_REGEX.test) return;
|
|
78
|
+
|
|
79
|
+
const cleaned = tippex_comments_and_strings(declaration.value);
|
|
80
|
+
|
|
81
|
+
/** @type {string} */
|
|
82
|
+
let new_value = declaration.value;
|
|
83
|
+
|
|
84
|
+
/** @type {RegExpExecArray | null} */
|
|
85
|
+
let url_function_found;
|
|
86
|
+
URL_FUNCTION_REGEX.lastIndex = 0;
|
|
87
|
+
while ((url_function_found = URL_FUNCTION_REGEX.exec(cleaned))) {
|
|
88
|
+
const [url_function] = url_function_found;
|
|
89
|
+
|
|
90
|
+
// After finding a legitimate url(...), we want to operate on the original
|
|
91
|
+
// that may have a string inside it
|
|
92
|
+
const original_url_function = declaration.value.slice(
|
|
93
|
+
url_function_found.index,
|
|
94
|
+
url_function_found.index + url_function.length
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const url_parameter_found = URL_PARAMETER_REGEX.exec(original_url_function);
|
|
98
|
+
if (!url_parameter_found) continue;
|
|
99
|
+
|
|
100
|
+
const [, , url] = url_parameter_found;
|
|
101
|
+
const [url_without_hash_or_query] = url.split(HASH_OR_QUERY_REGEX);
|
|
102
|
+
|
|
103
|
+
/** @type {string | undefined} */
|
|
104
|
+
let new_prefix;
|
|
105
|
+
|
|
106
|
+
// Check if it's an asset processed by Vite...
|
|
107
|
+
let current_prefix = url_without_hash_or_query.slice(0, VITE_ASSET_PREFIX.length);
|
|
108
|
+
let filename = url_without_hash_or_query.slice(VITE_ASSET_PREFIX.length);
|
|
109
|
+
const decoded = decodeURIComponent(filename);
|
|
110
|
+
|
|
111
|
+
if (current_prefix === VITE_ASSET_PREFIX && vite_assets.has(decoded)) {
|
|
112
|
+
new_prefix = paths_assets;
|
|
113
|
+
} else {
|
|
114
|
+
// ...or if it's from the static directory
|
|
115
|
+
current_prefix = url_without_hash_or_query.slice(0, static_asset_prefix.length);
|
|
116
|
+
filename = url_without_hash_or_query.slice(static_asset_prefix.length);
|
|
117
|
+
const decoded = decodeURIComponent(filename);
|
|
118
|
+
|
|
119
|
+
if (current_prefix === static_asset_prefix && static_assets.has(decoded)) {
|
|
120
|
+
new_prefix = base;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!new_prefix) continue;
|
|
125
|
+
|
|
126
|
+
new_value = new_value.replace(`${current_prefix}${filename}`, `${new_prefix}/${filename}`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (declaration.value === new_value) return;
|
|
130
|
+
|
|
131
|
+
if (!svelte.parseCss) {
|
|
132
|
+
declaration.start = declaration.start - AST_OFFSET;
|
|
133
|
+
declaration.end = declaration.end - AST_OFFSET;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
s.update(declaration.start, declaration.end, `${declaration.property}: ${new_value}`);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return s.toString();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @param {StyleSheetChildren[0]} rule
|
|
145
|
+
* @param {(declaration: Declaration) => void} callback
|
|
146
|
+
*/
|
|
147
|
+
function find_declarations(rule, callback) {
|
|
148
|
+
// Vite already inlines relative @import rules, so we don't need to handle them here
|
|
149
|
+
if (!rule.block) return;
|
|
150
|
+
|
|
151
|
+
for (const child of rule.block.children) {
|
|
152
|
+
if (child.type !== 'Declaration') {
|
|
153
|
+
find_declarations(child, callback);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
callback(child);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Replaces comment and string contents with whitespace.
|
|
162
|
+
* @param {string} value
|
|
163
|
+
* @returns {string}
|
|
164
|
+
*/
|
|
165
|
+
export function tippex_comments_and_strings(value) {
|
|
166
|
+
let new_value = '';
|
|
167
|
+
let escaped = false;
|
|
168
|
+
let in_comment = false;
|
|
169
|
+
|
|
170
|
+
/** @type {null | '"' | "'"} */
|
|
171
|
+
let quote_mark = null;
|
|
172
|
+
|
|
173
|
+
let i = 0;
|
|
174
|
+
while (i < value.length) {
|
|
175
|
+
const char = value[i];
|
|
176
|
+
|
|
177
|
+
if (in_comment) {
|
|
178
|
+
if (char === '*' && value[i + 1] === '/') {
|
|
179
|
+
in_comment = false;
|
|
180
|
+
new_value += char;
|
|
181
|
+
} else {
|
|
182
|
+
new_value += ' ';
|
|
183
|
+
}
|
|
184
|
+
} else if (!quote_mark && char === '/' && value[i + 1] === '*') {
|
|
185
|
+
in_comment = true;
|
|
186
|
+
new_value += '/*';
|
|
187
|
+
i++; // skip the '*' since we already added it
|
|
188
|
+
} else if (escaped) {
|
|
189
|
+
new_value += ' ';
|
|
190
|
+
escaped = false;
|
|
191
|
+
} else if (quote_mark && char === '\\') {
|
|
192
|
+
escaped = true;
|
|
193
|
+
new_value += ' ';
|
|
194
|
+
} else if (char === quote_mark) {
|
|
195
|
+
quote_mark = null;
|
|
196
|
+
new_value += char;
|
|
197
|
+
} else if (quote_mark) {
|
|
198
|
+
new_value += ' ';
|
|
199
|
+
} else if (quote_mark === null && (char === '"' || char === "'")) {
|
|
200
|
+
quote_mark = char;
|
|
201
|
+
new_value += char;
|
|
202
|
+
} else {
|
|
203
|
+
new_value += char;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
i++;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return new_value;
|
|
210
|
+
}
|
package/src/utils/routing.js
CHANGED
|
@@ -162,8 +162,12 @@ export function exec(match, params, matchers) {
|
|
|
162
162
|
|
|
163
163
|
// if `value` is undefined, it means this is an optional or rest parameter
|
|
164
164
|
if (value === undefined) {
|
|
165
|
-
if (param.rest)
|
|
166
|
-
|
|
165
|
+
if (param.rest) {
|
|
166
|
+
// We need to allow the matcher to run so that it can decide if this optional rest param should be allowed to match
|
|
167
|
+
value = '';
|
|
168
|
+
} else {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
167
171
|
}
|
|
168
172
|
|
|
169
173
|
if (!param.matcher || matchers[param.matcher](value)) {
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1929,6 +1929,18 @@ declare module '@sveltejs/kit' {
|
|
|
1929
1929
|
[key: string | number]: UnknownField<any>;
|
|
1930
1930
|
};
|
|
1931
1931
|
|
|
1932
|
+
type RemoteFormFieldsRoot<Input extends RemoteFormInput | void> =
|
|
1933
|
+
IsAny<Input> extends true
|
|
1934
|
+
? RecursiveFormFields
|
|
1935
|
+
: Input extends void
|
|
1936
|
+
? {
|
|
1937
|
+
/** Validation issues, if any */
|
|
1938
|
+
issues(): RemoteFormIssue[] | undefined;
|
|
1939
|
+
/** Validation issues belonging to this or any of the fields that belong to it, if any */
|
|
1940
|
+
allIssues(): RemoteFormIssue[] | undefined;
|
|
1941
|
+
}
|
|
1942
|
+
: RemoteFormFields<Input>;
|
|
1943
|
+
|
|
1932
1944
|
/**
|
|
1933
1945
|
* Recursive type to build form fields structure with proxy access
|
|
1934
1946
|
*/
|
|
@@ -2053,7 +2065,7 @@ declare module '@sveltejs/kit' {
|
|
|
2053
2065
|
/** The number of pending submissions */
|
|
2054
2066
|
get pending(): number;
|
|
2055
2067
|
/** Access form fields using object notation */
|
|
2056
|
-
fields:
|
|
2068
|
+
fields: RemoteFormFieldsRoot<Input>;
|
|
2057
2069
|
};
|
|
2058
2070
|
|
|
2059
2071
|
/**
|
|
@@ -2371,6 +2383,8 @@ declare module '@sveltejs/kit' {
|
|
|
2371
2383
|
}
|
|
2372
2384
|
|
|
2373
2385
|
type TrailingSlash = 'never' | 'always' | 'ignore';
|
|
2386
|
+
|
|
2387
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
2374
2388
|
interface Asset {
|
|
2375
2389
|
file: string;
|
|
2376
2390
|
size: number;
|
|
@@ -2546,7 +2560,9 @@ declare module '@sveltejs/kit' {
|
|
|
2546
2560
|
server_id?: string;
|
|
2547
2561
|
|
|
2548
2562
|
/** inlined styles */
|
|
2549
|
-
inline_styles?(): MaybePromise<
|
|
2563
|
+
inline_styles?(): MaybePromise<
|
|
2564
|
+
Record<string, string | ((assets: string, base: string) => string)>
|
|
2565
|
+
>;
|
|
2550
2566
|
/** Svelte component */
|
|
2551
2567
|
component?: SSRComponentLoader;
|
|
2552
2568
|
/** +page.js or +layout.js */
|
package/types/index.d.ts.map
CHANGED
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"RemoteFormField",
|
|
69
69
|
"RemoteFormFieldContainer",
|
|
70
70
|
"UnknownField",
|
|
71
|
+
"RemoteFormFieldsRoot",
|
|
71
72
|
"RemoteFormFields",
|
|
72
73
|
"RecursiveFormFields",
|
|
73
74
|
"MaybeArray",
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
"RequestOptions",
|
|
103
104
|
"RouteSegment",
|
|
104
105
|
"TrailingSlash",
|
|
106
|
+
"IsAny",
|
|
105
107
|
"Asset",
|
|
106
108
|
"BuildData",
|
|
107
109
|
"ManifestData",
|
|
@@ -215,6 +217,6 @@
|
|
|
215
217
|
null,
|
|
216
218
|
null
|
|
217
219
|
],
|
|
218
|
-
"mappings": ";;;;;;;;
|
|
220
|
+
"mappings": ";;;;;;;;MAgCKA,IAAIA;;;;;kBAKQC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;MAQrBC,aAAaA;;;;;OAKJC,YAAYA;;kBAETC,aAAaA;;;;;;MAMzBC,qBAAqBA;;;;;;;;;;;kBAWTC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8IPC,MAAMA;;;;;;;;;;;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