@sveltejs/kit 1.0.0-next.445 → 1.0.0-next.448

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 (68) hide show
  1. package/package.json +7 -9
  2. package/src/{core/constants.js → constants.js} +2 -0
  3. package/src/core/env.js +1 -1
  4. package/src/core/sync/write_ambient.js +1 -1
  5. package/src/core/sync/write_client_manifest.js +17 -20
  6. package/src/exports/vite/dev/index.js +1 -1
  7. package/src/exports/vite/preview/index.js +1 -1
  8. package/src/runtime/client/ambient.d.ts +8 -2
  9. package/src/runtime/client/client.js +71 -56
  10. package/src/runtime/client/parse.js +17 -4
  11. package/src/runtime/client/start.js +2 -0
  12. package/src/runtime/client/types.d.ts +2 -0
  13. package/src/runtime/server/data/index.js +146 -0
  14. package/src/runtime/server/index.js +20 -143
  15. package/src/runtime/server/page/index.js +17 -12
  16. package/src/runtime/server/page/load_data.js +1 -45
  17. package/src/runtime/server/page/render.js +29 -11
  18. package/src/runtime/server/page/respond_with_error.js +0 -1
  19. package/src/runtime/server/utils.js +21 -0
  20. package/types/internal.d.ts +0 -1
  21. package/src/core/sync/write_types/test/layout/+layout.js +0 -5
  22. package/src/core/sync/write_types/test/layout/+layout.server.js +0 -5
  23. package/src/core/sync/write_types/test/layout/+layout.svelte +0 -0
  24. package/src/core/sync/write_types/test/layout/+page.js +0 -5
  25. package/src/core/sync/write_types/test/layout/+page.server.js +0 -5
  26. package/src/core/sync/write_types/test/layout/+page.svelte +0 -0
  27. package/src/core/sync/write_types/test/layout/_expected/$types.d.ts +0 -67
  28. package/src/core/sync/write_types/test/layout-advanced/(main)/+layout.server.js +0 -5
  29. package/src/core/sync/write_types/test/layout-advanced/(main)/+layout.svelte +0 -0
  30. package/src/core/sync/write_types/test/layout-advanced/(main)/+page.js +0 -5
  31. package/src/core/sync/write_types/test/layout-advanced/(main)/+page@.svelte +0 -0
  32. package/src/core/sync/write_types/test/layout-advanced/(main)/sub/+page.js +0 -5
  33. package/src/core/sync/write_types/test/layout-advanced/(main)/sub/+page.svelte +0 -0
  34. package/src/core/sync/write_types/test/layout-advanced/+layout.js +0 -5
  35. package/src/core/sync/write_types/test/layout-advanced/+layout.svelte +0 -0
  36. package/src/core/sync/write_types/test/layout-advanced/_expected/$types.d.ts +0 -32
  37. package/src/core/sync/write_types/test/layout-advanced/_expected/(main)/$types.d.ts +0 -42
  38. package/src/core/sync/write_types/test/layout-advanced/_expected/(main)/sub/$types.d.ts +0 -33
  39. package/src/core/sync/write_types/test/simple-page-server-and-shared/+page.js +0 -5
  40. package/src/core/sync/write_types/test/simple-page-server-and-shared/+page.server.js +0 -5
  41. package/src/core/sync/write_types/test/simple-page-server-and-shared/+page.svelte +0 -0
  42. package/src/core/sync/write_types/test/simple-page-server-and-shared/_expected/$types.d.ts +0 -44
  43. package/src/core/sync/write_types/test/simple-page-server-only/+page.server.js +0 -5
  44. package/src/core/sync/write_types/test/simple-page-server-only/+page.svelte +0 -0
  45. package/src/core/sync/write_types/test/simple-page-server-only/_expected/$types.d.ts +0 -30
  46. package/src/core/sync/write_types/test/simple-page-shared-only/+page.js +0 -5
  47. package/src/core/sync/write_types/test/simple-page-shared-only/+page.svelte +0 -0
  48. package/src/core/sync/write_types/test/simple-page-shared-only/_expected/$types.d.ts +0 -33
  49. package/src/core/sync/write_types/test/slugs/+layout.js +0 -1
  50. package/src/core/sync/write_types/test/slugs/+layout.svelte +0 -1
  51. package/src/core/sync/write_types/test/slugs/[...rest]/+page.js +0 -3
  52. package/src/core/sync/write_types/test/slugs/[...rest]/+page.svelte +0 -0
  53. package/src/core/sync/write_types/test/slugs/[slug]/+page.js +0 -3
  54. package/src/core/sync/write_types/test/slugs/[slug]/+page.svelte +0 -0
  55. package/src/core/sync/write_types/test/slugs/_expected/$types.d.ts +0 -32
  56. package/src/core/sync/write_types/test/slugs/_expected/[...rest]/$types.d.ts +0 -29
  57. package/src/core/sync/write_types/test/slugs/_expected/[slug]/$types.d.ts +0 -29
  58. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/+layout.js +0 -1
  59. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/+layout.svelte +0 -1
  60. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/_expected/$types.d.ts +0 -30
  61. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/_expected/nested/$types.d.ts +0 -32
  62. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/_expected/nested/[...rest]/$types.d.ts +0 -37
  63. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/_expected/nested/[slug]/$types.d.ts +0 -17
  64. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/+layout.js +0 -1
  65. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/+layout.svelte +0 -1
  66. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/[...rest]/+page.js +0 -3
  67. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/[...rest]/+page.svelte +0 -0
  68. package/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/[slug]/+page@.svelte +0 -0
@@ -2,20 +2,16 @@ import { render_endpoint } from './endpoint.js';
2
2
  import { render_page } from './page/index.js';
3
3
  import { render_response } from './page/render.js';
4
4
  import { respond_with_error } from './page/respond_with_error.js';
5
- import { coalesce_to_error, normalize_error } from '../../utils/error.js';
6
- import { serialize_error, GENERIC_ERROR, error_to_pojo } from './utils.js';
5
+ import { coalesce_to_error } from '../../utils/error.js';
6
+ import { serialize_error, GENERIC_ERROR } from './utils.js';
7
7
  import { decode_params, disable_search, normalize_path } from '../../utils/url.js';
8
8
  import { exec } from '../../utils/routing.js';
9
9
  import { negotiate } from '../../utils/http.js';
10
- import { HttpError, Redirect } from '../control.js';
11
- import { load_server_data } from './page/load_data.js';
12
- import { json } from '../../exports/index.js';
13
- import { once } from '../../utils/functions.js';
10
+ import { render_data } from './data/index.js';
11
+ import { DATA_SUFFIX } from '../../constants.js';
14
12
 
15
13
  /* global __SVELTEKIT_ADAPTER_NAME__ */
16
14
 
17
- const DATA_SUFFIX = '/__data.json';
18
-
19
15
  /** @param {{ html: string }} opts */
20
16
  const default_transform = ({ html }) => html;
21
17
 
@@ -69,12 +65,7 @@ export async function respond(request, options, state) {
69
65
  }
70
66
 
71
67
  const is_data_request = decoded.endsWith(DATA_SUFFIX);
72
-
73
- if (is_data_request) {
74
- const data_suffix_length = DATA_SUFFIX.length - (options.trailing_slash === 'always' ? 1 : 0);
75
- decoded = decoded.slice(0, -data_suffix_length) || '/';
76
- url = new URL(url.origin + url.pathname.slice(0, -data_suffix_length) + url.search);
77
- }
68
+ if (is_data_request) decoded = decoded.slice(0, -DATA_SUFFIX.length);
78
69
 
79
70
  if (!state.prerendering?.fallback) {
80
71
  const matchers = await options.manifest._.matchers();
@@ -92,26 +83,19 @@ export async function respond(request, options, state) {
92
83
  }
93
84
  }
94
85
 
95
- if (route) {
96
- if (route.page) {
97
- const normalized = normalize_path(url.pathname, options.trailing_slash);
98
-
99
- if (normalized !== url.pathname && !state.prerendering?.fallback) {
100
- return new Response(undefined, {
101
- status: 301,
102
- headers: {
103
- 'x-sveltekit-normalize': '1',
104
- location:
105
- // ensure paths starting with '//' are not treated as protocol-relative
106
- (normalized.startsWith('//') ? url.origin + normalized : normalized) +
107
- (url.search === '?' ? '' : url.search)
108
- }
109
- });
110
- }
111
- } else if (is_data_request) {
112
- // requesting /__data.json should fail for a standalone endpoint
86
+ if (route?.page && !is_data_request) {
87
+ const normalized = normalize_path(url.pathname, options.trailing_slash);
88
+
89
+ if (normalized !== url.pathname && !state.prerendering?.fallback) {
113
90
  return new Response(undefined, {
114
- status: 404
91
+ status: 301,
92
+ headers: {
93
+ 'x-sveltekit-normalize': '1',
94
+ location:
95
+ // ensure paths starting with '//' are not treated as protocol-relative
96
+ (normalized.startsWith('//') ? url.origin + normalized : normalized) +
97
+ (url.search === '?' ? '' : url.search)
98
+ }
115
99
  });
116
100
  }
117
101
  }
@@ -250,116 +234,9 @@ export async function respond(request, options, state) {
250
234
  if (route) {
251
235
  /** @type {Response} */
252
236
  let response;
253
- if (is_data_request && route.page) {
254
- try {
255
- const node_ids = [...route.page.layouts, route.page.leaf];
256
-
257
- const invalidated =
258
- request.headers.get('x-sveltekit-invalidated')?.split(',').map(Boolean) ??
259
- node_ids.map(() => true);
260
-
261
- let aborted = false;
262
-
263
- const functions = node_ids.map((n, i) => {
264
- return once(async () => {
265
- try {
266
- if (aborted) {
267
- return /** @type {import('types').ServerDataSkippedNode} */ ({
268
- type: 'skip'
269
- });
270
- }
271
-
272
- // == because it could be undefined (in dev) or null (in build, because of JSON.stringify)
273
- const node = n == undefined ? n : await options.manifest._.nodes[n]();
274
- return load_server_data({
275
- dev: options.dev,
276
- event,
277
- state,
278
- node,
279
- parent: async () => {
280
- /** @type {Record<string, any>} */
281
- const data = {};
282
- for (let j = 0; j < i; j += 1) {
283
- const parent = /** @type {import('types').ServerDataNode | null} */ (
284
- await functions[j]()
285
- );
286
-
287
- if (parent) {
288
- Object.assign(data, parent.data);
289
- }
290
- }
291
- return data;
292
- }
293
- });
294
- } catch (e) {
295
- aborted = true;
296
- throw e;
297
- }
298
- });
299
- });
300
237
 
301
- const promises = functions.map(async (fn, i) => {
302
- if (!invalidated[i]) {
303
- return /** @type {import('types').ServerDataSkippedNode} */ ({
304
- type: 'skip'
305
- });
306
- }
307
-
308
- return fn();
309
- });
310
-
311
- let length = promises.length;
312
- const nodes = await Promise.all(
313
- promises.map((p, i) =>
314
- p.catch((e) => {
315
- const error = normalize_error(e);
316
-
317
- if (error instanceof Redirect) {
318
- throw error;
319
- }
320
-
321
- // Math.min because array isn't guaranteed to resolve in order
322
- length = Math.min(length, i + 1);
323
-
324
- if (error instanceof HttpError) {
325
- return /** @type {import('types').ServerErrorNode} */ ({
326
- type: 'error',
327
- httperror: { ...error }
328
- });
329
- }
330
-
331
- options.handle_error(error, event);
332
-
333
- return /** @type {import('types').ServerErrorNode} */ ({
334
- type: 'error',
335
- error: error_to_pojo(error, options.get_stack)
336
- });
337
- })
338
- )
339
- );
340
-
341
- /** @type {import('types').ServerData} */
342
- const server_data = {
343
- type: 'data',
344
- nodes: nodes.slice(0, length)
345
- };
346
-
347
- response = json(server_data);
348
- } catch (e) {
349
- const error = normalize_error(e);
350
-
351
- if (error instanceof Redirect) {
352
- /** @type {import('types').ServerData} */
353
- const server_data = {
354
- type: 'redirect',
355
- location: error.location
356
- };
357
-
358
- response = json(server_data);
359
- } else {
360
- response = json(error_to_pojo(error, options.get_stack), { status: 500 });
361
- }
362
- }
238
+ if (is_data_request) {
239
+ response = await render_data(event, route, options, state);
363
240
  } else if (route.page) {
364
241
  response = await render_page(event, route, route.page, options, state, resolve_opts);
365
242
  } else if (route.endpoint) {
@@ -371,7 +248,7 @@ export async function respond(request, options, state) {
371
248
  }
372
249
 
373
250
  if (!is_data_request) {
374
- // we only want to set cookies on __data.json requests, we don't
251
+ // we only want to set cookies on __data.js requests, we don't
375
252
  // want to cache stuff erroneously etc
376
253
  for (const key in headers) {
377
254
  const value = headers[key];
@@ -1,3 +1,4 @@
1
+ import { devalue } from 'devalue';
1
2
  import { negotiate } from '../../../utils/http.js';
2
3
  import { render_response } from './render.js';
3
4
  import { respond_with_error } from './respond_with_error.js';
@@ -8,6 +9,7 @@ import { error, json } from '../../../exports/index.js';
8
9
  import { compact } from '../../../utils/array.js';
9
10
  import { normalize_error } from '../../../utils/error.js';
10
11
  import { load_data, load_server_data } from './load_data.js';
12
+ import { DATA_SUFFIX } from '../../../constants.js';
11
13
 
12
14
  /**
13
15
  * @typedef {import('./types.js').Loaded} Loaded
@@ -102,7 +104,7 @@ export async function render_page(event, route, page, options, state, resolve_op
102
104
  }
103
105
 
104
106
  const should_prerender_data = nodes.some((node) => node?.server);
105
- const data_pathname = `${event.url.pathname.replace(/\/$/, '')}/__data.json`;
107
+ const data_pathname = event.url.pathname.replace(/\/$/, '') + DATA_SUFFIX;
106
108
 
107
109
  // it's crucial that we do this before returning the non-SSR response, otherwise
108
110
  // SvelteKit will erroneously believe that the path has been prerendered,
@@ -166,7 +168,6 @@ export async function render_page(event, route, page, options, state, resolve_op
166
168
  }
167
169
 
168
170
  return await load_server_data({
169
- dev: options.dev,
170
171
  event,
171
172
  state,
172
173
  node,
@@ -231,12 +232,14 @@ export async function render_page(event, route, page, options, state, resolve_op
231
232
 
232
233
  if (error instanceof Redirect) {
233
234
  if (state.prerendering && should_prerender_data) {
235
+ const body = `window.__sveltekit_data = ${JSON.stringify({
236
+ type: 'redirect',
237
+ location: error.location
238
+ })}`;
239
+
234
240
  state.prerendering.dependencies.set(data_pathname, {
235
- response: new Response(undefined),
236
- body: JSON.stringify({
237
- type: 'redirect',
238
- location: error.location
239
- })
241
+ response: new Response(body),
242
+ body
240
243
  });
241
244
  }
242
245
 
@@ -294,12 +297,14 @@ export async function render_page(event, route, page, options, state, resolve_op
294
297
  }
295
298
 
296
299
  if (state.prerendering && should_prerender_data) {
300
+ const body = `window.__sveltekit_data = ${devalue({
301
+ type: 'data',
302
+ nodes: branch.map((branch_node) => branch_node?.server_data)
303
+ })}`;
304
+
297
305
  state.prerendering.dependencies.set(data_pathname, {
298
- response: new Response(undefined),
299
- body: JSON.stringify({
300
- type: 'data',
301
- nodes: branch.map((branch_node) => branch_node?.server_data)
302
- })
306
+ response: new Response(body),
307
+ body
303
308
  });
304
309
  }
305
310
 
@@ -3,7 +3,6 @@ import { disable_search, make_trackable } from '../../../utils/url.js';
3
3
  /**
4
4
  * Calls the user's `load` function.
5
5
  * @param {{
6
- * dev: boolean;
7
6
  * event: import('types').RequestEvent;
8
7
  * state: import('types').SSRState;
9
8
  * node: import('types').SSRNode | undefined;
@@ -11,7 +10,7 @@ import { disable_search, make_trackable } from '../../../utils/url.js';
11
10
  * }} opts
12
11
  * @returns {Promise<import('types').ServerDataNode | null>}
13
12
  */
14
- export async function load_server_data({ dev, event, state, node, parent }) {
13
+ export async function load_server_data({ event, state, node, parent }) {
15
14
  if (!node?.server) return null;
16
15
 
17
16
  const uses = {
@@ -53,10 +52,6 @@ export async function load_server_data({ dev, event, state, node, parent }) {
53
52
 
54
53
  const data = result ? await unwrap_promises(result) : null;
55
54
 
56
- if (dev) {
57
- check_serializability(data, /** @type {string} */ (node.server_id), 'data');
58
- }
59
-
60
55
  return {
61
56
  type: 'data',
62
57
  data,
@@ -127,42 +122,3 @@ async function unwrap_promises(object) {
127
122
 
128
123
  return unwrapped;
129
124
  }
130
-
131
- /**
132
- * Check that the data can safely be serialized to JSON
133
- * @param {any} value
134
- * @param {string} id
135
- * @param {string} path
136
- */
137
- function check_serializability(value, id, path) {
138
- const type = typeof value;
139
-
140
- if (type === 'string' || type === 'boolean' || type === 'number' || type === 'undefined') {
141
- // primitives are fine
142
- return;
143
- }
144
-
145
- if (type === 'object') {
146
- // nulls are fine...
147
- if (!value) return;
148
-
149
- // ...so are plain arrays...
150
- if (Array.isArray(value)) {
151
- value.forEach((child, i) => {
152
- check_serializability(child, id, `${path}[${i}]`);
153
- });
154
- return;
155
- }
156
-
157
- // ...and objects
158
- const tag = Object.prototype.toString.call(value);
159
- if (tag === '[object Object]') {
160
- for (const key in value) {
161
- check_serializability(value[key], id, `${path}.${key}`);
162
- }
163
- return;
164
- }
165
- }
166
-
167
- throw new Error(`${path} returned from 'load' in ${id} cannot be serialized as JSON`);
168
- }
@@ -1,4 +1,4 @@
1
- import devalue from 'devalue';
1
+ import { devalue } from 'devalue';
2
2
  import { readable, writable } from 'svelte/store';
3
3
  import * as cookie from 'cookie';
4
4
  import { hash } from '../../hash.js';
@@ -174,6 +174,31 @@ export async function render_response({
174
174
  /** @param {string} path */
175
175
  const prefixed = (path) => (path.startsWith('/') ? path : `${assets}/${path}`);
176
176
 
177
+ const serialized = { data: '', errors: 'null' };
178
+
179
+ try {
180
+ serialized.data = devalue(branch.map(({ server_data }) => server_data));
181
+ } catch (e) {
182
+ // If we're here, the data could not be serialized with devalue
183
+ // TODO if we wanted to get super fancy we could track down the origin of the `load`
184
+ // function, but it would mean passing more stuff around than we currently do
185
+ const error = /** @type {any} */ (e);
186
+ const match = /\[(\d+)\]\.data\.(.+)/.exec(error.path);
187
+ if (match) throw new Error(`${error.message} (data.${match[2]})`);
188
+ throw error;
189
+ }
190
+
191
+ if (validation_errors) {
192
+ try {
193
+ serialized.errors = devalue(validation_errors);
194
+ } catch (e) {
195
+ // If we're here, the data could not be serialized with devalue
196
+ const error = /** @type {any} */ (e);
197
+ if (error.path) throw new Error(`${error.message} (errors.${error.path})`);
198
+ throw error;
199
+ }
200
+ }
201
+
177
202
  // prettier-ignore
178
203
  const init_app = `
179
204
  import { set_public_env, start } from ${s(prefixed(entry.file))};
@@ -191,7 +216,9 @@ export async function render_response({
191
216
  error: ${error && serialize_error(error, e => e.stack)},
192
217
  node_ids: [${branch.map(({ node }) => node.index).join(', ')}],
193
218
  params: ${devalue(event.params)},
194
- routeId: ${s(event.routeId)}
219
+ routeId: ${s(event.routeId)},
220
+ data: ${serialized.data},
221
+ errors: ${serialized.errors}
195
222
  }` : 'null'}
196
223
  });
197
224
  `;
@@ -272,15 +299,6 @@ export async function render_response({
272
299
  );
273
300
  }
274
301
 
275
- if (branch.some((node) => node.server_data)) {
276
- serialized_data.push(
277
- render_json_payload_script(
278
- { type: 'server_data' },
279
- branch.map(({ server_data }) => server_data)
280
- )
281
- );
282
- }
283
-
284
302
  if (validation_errors) {
285
303
  serialized_data.push(
286
304
  render_json_payload_script({ type: 'validation_errors' }, validation_errors)
@@ -35,7 +35,6 @@ export async function respond_with_error({ event, options, state, status, error,
35
35
  const default_layout = await options.manifest._.nodes[0](); // 0 is always the root layout
36
36
 
37
37
  const server_data_promise = load_server_data({
38
- dev: options.dev,
39
38
  event,
40
39
  state,
41
40
  node: default_layout,
@@ -1,3 +1,4 @@
1
+ import { devalue } from 'devalue';
1
2
  import { HttpError } from '../control.js';
2
3
 
3
4
  /** @param {any} body */
@@ -114,3 +115,23 @@ export function allowed_methods(mod) {
114
115
 
115
116
  return allowed;
116
117
  }
118
+
119
+ /** @param {any} data */
120
+ export function data_response(data) {
121
+ try {
122
+ return new Response(`window.__sveltekit_data = ${devalue(data)}`, {
123
+ headers: {
124
+ 'content-type': 'application/javascript'
125
+ }
126
+ });
127
+ } catch (e) {
128
+ const error = /** @type {any} */ (e);
129
+ const match = /\[(\d+)\]\.data\.(.+)/.exec(error.path);
130
+ const message = match ? `${error.message} (data.${match[2]})` : error.message;
131
+ return new Response(`throw new Error(${JSON.stringify(message)})`, {
132
+ headers: {
133
+ 'content-type': 'application/javascript'
134
+ }
135
+ });
136
+ }
137
+ }
@@ -133,7 +133,6 @@ export interface PageNode {
133
133
 
134
134
  export type PayloadScriptAttributes =
135
135
  | { type: 'data'; url: string; body?: string }
136
- | { type: 'server_data' }
137
136
  | { type: 'validation_errors' };
138
137
 
139
138
  export interface PrerenderDependency {
@@ -1,5 +0,0 @@
1
- export function load() {
2
- return {
3
- shared: 'shared'
4
- };
5
- }
@@ -1,5 +0,0 @@
1
- export function load() {
2
- return {
3
- server: 'server'
4
- };
5
- }
@@ -1,5 +0,0 @@
1
- export function load() {
2
- return {
3
- pageShared: 'pageShared'
4
- };
5
- }
@@ -1,5 +0,0 @@
1
- export function load() {
2
- return {
3
- pageServer: 'pageServer'
4
- };
5
- }
@@ -1,67 +0,0 @@
1
- import type * as Kit from '@sveltejs/kit';
2
-
3
- type RouteParams = {};
4
- type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
- export type RequiredKeys<T> = {
6
- [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
- }[keyof T];
8
- type OutputDataShape<T> = MaybeWithVoid<
9
- Omit<App.PageData, RequiredKeys<T>> &
10
- Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
- Record<string, any>
12
- >;
13
- type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
- type PageServerParentData = EnsureParentData<LayoutServerData>;
15
- type PageParentData = EnsureParentData<LayoutData>;
16
- type LayoutParams = RouteParams & {};
17
- type LayoutServerParentData = EnsureParentData<{}>;
18
- type LayoutParentData = EnsureParentData<{}>;
19
-
20
- export type PageServerLoad<
21
- OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
22
- | (Partial<App.PageData> & Record<string, any>)
23
- | void
24
- > = Kit.ServerLoad<RouteParams, PageServerParentData, OutputData>;
25
- export type PageServerLoadEvent = Parameters<PageServerLoad>[0];
26
- export type Errors = null;
27
- export type PageServerData = Kit.AwaitedProperties<
28
- Awaited<ReturnType<typeof import('../../../../../../../../+page.server.js').load>>
29
- >;
30
- export type PageLoad<
31
- OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
32
- > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
33
- export type PageLoadEvent = Parameters<PageLoad>[0];
34
- export type PageData = Omit<
35
- PageParentData,
36
- keyof Kit.AwaitedProperties<
37
- Awaited<ReturnType<typeof import('../../../../../../../../+page.js').load>>
38
- >
39
- > &
40
- Kit.AwaitedProperties<
41
- Awaited<ReturnType<typeof import('../../../../../../../../+page.js').load>>
42
- >;
43
- export type Action = Kit.Action<RouteParams>;
44
- export type LayoutServerLoad<
45
- OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
46
- | (Partial<App.PageData> & Record<string, any>)
47
- | void
48
- > = Kit.ServerLoad<LayoutParams, LayoutServerParentData, OutputData>;
49
- export type LayoutServerLoadEvent = Parameters<LayoutServerLoad>[0];
50
- export type LayoutServerData = Kit.AwaitedProperties<
51
- Awaited<ReturnType<typeof import('../../../../../../../../+layout.server.js').load>>
52
- >;
53
- export type LayoutLoad<
54
- OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
55
- | (Partial<App.PageData> & Record<string, any>)
56
- | void
57
- > = Kit.Load<LayoutParams, LayoutServerData, LayoutParentData, OutputData>;
58
- export type LayoutLoadEvent = Parameters<LayoutLoad>[0];
59
- export type LayoutData = Omit<
60
- LayoutParentData,
61
- keyof Kit.AwaitedProperties<
62
- Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
63
- >
64
- > &
65
- Kit.AwaitedProperties<
66
- Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
67
- >;
@@ -1,5 +0,0 @@
1
- export function load() {
2
- return {
3
- main: 'main'
4
- };
5
- }
@@ -1,5 +0,0 @@
1
- export function load() {
2
- return {
3
- page: 'page'
4
- };
5
- }
@@ -1,5 +0,0 @@
1
- export function load() {
2
- return {
3
- sub: 'sub'
4
- };
5
- }
@@ -1,5 +0,0 @@
1
- export function load() {
2
- return {
3
- root: 'root'
4
- };
5
- }
@@ -1,32 +0,0 @@
1
- import type * as Kit from '@sveltejs/kit';
2
-
3
- type RouteParams = {};
4
- type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
- export type RequiredKeys<T> = {
6
- [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
- }[keyof T];
8
- type OutputDataShape<T> = MaybeWithVoid<
9
- Omit<App.PageData, RequiredKeys<T>> &
10
- Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
- Record<string, any>
12
- >;
13
- type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
- type LayoutParams = RouteParams & {};
15
- type LayoutParentData = EnsureParentData<{}>;
16
-
17
- export type LayoutServerData = null;
18
- export type LayoutLoad<
19
- OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
20
- | (Partial<App.PageData> & Record<string, any>)
21
- | void
22
- > = Kit.Load<LayoutParams, LayoutServerData, LayoutParentData, OutputData>;
23
- export type LayoutLoadEvent = Parameters<LayoutLoad>[0];
24
- export type LayoutData = Omit<
25
- LayoutParentData,
26
- keyof Kit.AwaitedProperties<
27
- Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
28
- >
29
- > &
30
- Kit.AwaitedProperties<
31
- Awaited<ReturnType<typeof import('../../../../../../../../+layout.js').load>>
32
- >;
@@ -1,42 +0,0 @@
1
- import type * as Kit from '@sveltejs/kit';
2
-
3
- type RouteParams = {};
4
- type MaybeWithVoid<T> = {} extends T ? T | void : T;
5
- export type RequiredKeys<T> = {
6
- [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K;
7
- }[keyof T];
8
- type OutputDataShape<T> = MaybeWithVoid<
9
- Omit<App.PageData, RequiredKeys<T>> &
10
- Partial<Pick<App.PageData, keyof T & keyof App.PageData>> &
11
- Record<string, any>
12
- >;
13
- type EnsureParentData<T> = NonNullable<T> extends never ? {} : T;
14
- type PageParentData = EnsureParentData<import('../$types.js').LayoutData>;
15
- type LayoutParams = RouteParams & {};
16
- type LayoutServerParentData = EnsureParentData<import('../$types.js').LayoutServerData>;
17
- type LayoutParentData = EnsureParentData<import('../$types.js').LayoutData>;
18
-
19
- export type PageServerData = null;
20
- export type PageLoad<
21
- OutputData extends OutputDataShape<PageParentData> = OutputDataShape<PageParentData>
22
- > = Kit.Load<RouteParams, PageServerData, PageParentData, OutputData>;
23
- export type PageLoadEvent = Parameters<PageLoad>[0];
24
- export type PageData = Omit<
25
- PageParentData,
26
- keyof Kit.AwaitedProperties<
27
- Awaited<ReturnType<typeof import('../../../../../../../../../(main)/+page.js').load>>
28
- >
29
- > &
30
- Kit.AwaitedProperties<
31
- Awaited<ReturnType<typeof import('../../../../../../../../../(main)/+page.js').load>>
32
- >;
33
- export type LayoutServerLoad<
34
- OutputData extends (Partial<App.PageData> & Record<string, any>) | void =
35
- | (Partial<App.PageData> & Record<string, any>)
36
- | void
37
- > = Kit.ServerLoad<LayoutParams, LayoutServerParentData, OutputData>;
38
- export type LayoutServerLoadEvent = Parameters<LayoutServerLoad>[0];
39
- export type LayoutServerData = Kit.AwaitedProperties<
40
- Awaited<ReturnType<typeof import('../../../../../../../../../(main)/+layout.server.js').load>>
41
- >;
42
- export type LayoutData = Omit<LayoutParentData, keyof LayoutServerData> & LayoutServerData;