@sveltejs/kit 1.0.0-next.528 → 1.0.0-next.529

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.528",
3
+ "version": "1.0.0-next.529",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -13,31 +13,31 @@
13
13
  "@sveltejs/vite-plugin-svelte": "^1.1.0",
14
14
  "@types/cookie": "^0.5.1",
15
15
  "cookie": "^0.5.0",
16
- "devalue": "^4.0.0",
17
- "kleur": "^4.1.4",
18
- "magic-string": "^0.26.2",
16
+ "devalue": "^4.0.1",
17
+ "kleur": "^4.1.5",
18
+ "magic-string": "^0.26.7",
19
19
  "mime": "^3.0.0",
20
20
  "sade": "^1.8.1",
21
- "set-cookie-parser": "^2.4.8",
21
+ "set-cookie-parser": "^2.5.1",
22
22
  "sirv": "^2.0.2",
23
23
  "tiny-glob": "^0.2.9",
24
24
  "undici": "5.12.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@playwright/test": "^1.25.0",
27
+ "@playwright/test": "1.25.0",
28
28
  "@types/connect": "^3.4.35",
29
29
  "@types/marked": "^4.0.7",
30
- "@types/mime": "^3.0.0",
31
- "@types/node": "^16.11.36",
30
+ "@types/mime": "^3.0.1",
31
+ "@types/node": "^16.11.68",
32
32
  "@types/sade": "^1.7.4",
33
33
  "@types/set-cookie-parser": "^2.4.2",
34
34
  "marked": "^4.1.1",
35
- "rollup": "^2.78.1",
36
- "svelte": "^3.48.0",
37
- "svelte-preprocess": "^4.10.6",
38
- "typescript": "^4.8.2",
39
- "uvu": "^0.5.3",
40
- "vite": "^3.1.1"
35
+ "rollup": "^2.79.1",
36
+ "svelte": "^3.52.0",
37
+ "svelte-preprocess": "^4.10.7",
38
+ "typescript": "^4.8.4",
39
+ "uvu": "^0.5.6",
40
+ "vite": "^3.2.1"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "svelte": "^3.44.0",
@@ -215,6 +215,11 @@ function update_types(config, routes, route, to_delete = new Set()) {
215
215
  );
216
216
  // null & {} == null, we need to prevent that in some situations
217
217
  declarations.push(`type EnsureDefined<T> = T extends null | undefined ? {} : T;`);
218
+ // Takes a union type and returns a union type where each type also has all properties
219
+ // of all possible types (typed as undefined), making accessing them more ergonomic
220
+ declarations.push(
221
+ `type OptionalUnion<U extends Record<string, any>, A extends keyof U = U extends U ? keyof U : never> = U extends unknown ? { [P in Exclude<A, keyof U>]?: never } & U : never;`
222
+ );
218
223
  }
219
224
 
220
225
  if (route.leaf) {
@@ -402,7 +407,7 @@ function process_node(node, outdir, is_page, proxies, all_pages_have_load = true
402
407
  proxy
403
408
  );
404
409
 
405
- data = `Expand<Omit<${parent_type}, keyof ${type}> & EnsureDefined<${type}>>`;
410
+ data = `Expand<Omit<${parent_type}, keyof ${type}> & OptionalUnion<EnsureDefined<${type}>>>`;
406
411
 
407
412
  const output_data_shape =
408
413
  !is_page && all_pages_have_load
@@ -438,7 +443,7 @@ function process_node(node, outdir, is_page, proxies, all_pages_have_load = true
438
443
  ? `./proxy${replace_ext_with_js(path.basename(file_path))}`
439
444
  : path_to_original(outdir, file_path);
440
445
  const type = `Kit.AwaitedProperties<Awaited<ReturnType<typeof import('${from}').load>>>`;
441
- return expand ? `Expand<${type}>` : type;
446
+ return expand ? `Expand<OptionalUnion<EnsureDefined<${type}>>>` : type;
442
447
  } else {
443
448
  return fallback;
444
449
  }
@@ -63,7 +63,7 @@ export async function respond(request, options, state) {
63
63
  }
64
64
 
65
65
  const is_data_request = has_data_suffix(decoded);
66
- if (is_data_request) decoded = strip_data_suffix(decoded);
66
+ if (is_data_request) decoded = strip_data_suffix(decoded) || '/';
67
67
 
68
68
  if (!state.prerendering?.fallback) {
69
69
  const matchers = await options.manifest._.matchers();