@sveltejs/kit 1.0.0-next.330 → 1.0.0-next.333

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.
@@ -1266,7 +1266,9 @@ async function render_response({
1266
1266
 
1267
1267
  const init_service_worker = `
1268
1268
  if ('serviceWorker' in navigator) {
1269
- navigator.serviceWorker.register('${options.service_worker}');
1269
+ addEventListener('load', () => {
1270
+ navigator.serviceWorker.register('${options.service_worker}');
1271
+ });
1270
1272
  }
1271
1273
  `;
1272
1274
 
@@ -439,7 +439,8 @@ async function dev({ cwd, port, host, https, config }) {
439
439
  path__default.resolve(cwd, 'node_modules'),
440
440
  path__default.resolve(vite.searchForWorkspaceRoot(cwd), 'node_modules')
441
441
  ])
442
- ]
442
+ ],
443
+ port: 3000
443
444
  },
444
445
  strictPort: true
445
446
  }
@@ -1200,7 +1200,6 @@ async function prerender({ config, entries, files, log }) {
1200
1200
  const dest = `${config.kit.outDir}/output/prerendered/${category}/${file}`;
1201
1201
 
1202
1202
  if (written.has(file)) return;
1203
- written.add(file);
1204
1203
 
1205
1204
  if (response_type === REDIRECT) {
1206
1205
  const location = response.headers.get('location');
@@ -1221,6 +1220,8 @@ async function prerender({ config, entries, files, log }) {
1221
1220
  `<meta http-equiv="refresh" content=${escape_html_attr(`0;url=${location}`)}>`
1222
1221
  );
1223
1222
 
1223
+ written.add(file);
1224
+
1224
1225
  if (!prerendered.redirects.has(decoded)) {
1225
1226
  prerendered.redirects.set(decoded, {
1226
1227
  status: response.status,
@@ -1242,6 +1243,7 @@ async function prerender({ config, entries, files, log }) {
1242
1243
 
1243
1244
  log.info(`${response.status} ${decoded}`);
1244
1245
  writeFileSync(dest, body);
1246
+ written.add(file);
1245
1247
 
1246
1248
  if (is_html) {
1247
1249
  prerendered.pages.set(decoded, {
@@ -15632,6 +15632,7 @@ async function watch(config, cwd = process.cwd()) {
15632
15632
  let timeout;
15633
15633
 
15634
15634
  const watcher = chokidar.watch(lib, { ignoreInitial: true });
15635
+ const ready = new Promise((resolve) => watcher.on('ready', resolve));
15635
15636
 
15636
15637
  watcher.on('all', async (type, path) => {
15637
15638
  const file = analyze(config, relative(lib, path));
@@ -15699,6 +15700,7 @@ async function watch(config, cwd = process.cwd()) {
15699
15700
 
15700
15701
  return {
15701
15702
  watcher,
15703
+ ready,
15702
15704
  settled: () =>
15703
15705
  new Promise((fulfil, reject) => {
15704
15706
  fulfillers.push(fulfil);
package/dist/cli.js CHANGED
@@ -870,7 +870,7 @@ async function launch(port, https, base) {
870
870
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
871
871
  }
872
872
 
873
- const prog = sade('svelte-kit').version('1.0.0-next.330');
873
+ const prog = sade('svelte-kit').version('1.0.0-next.333');
874
874
 
875
875
  prog
876
876
  .command('dev')
@@ -1049,7 +1049,7 @@ async function check_port(port) {
1049
1049
  function welcome({ port, host, https, open, base, loose, allow, cwd }) {
1050
1050
  if (open) launch(port, https, base);
1051
1051
 
1052
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.330'}\n`));
1052
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.333'}\n`));
1053
1053
 
1054
1054
  const protocol = https ? 'https:' : 'http:';
1055
1055
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.330",
3
+ "version": "1.0.0-next.333",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "types": "types/index.d.ts",
79
79
  "engines": {
80
- "node": ">=14.13"
80
+ "node": ">=16"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "rollup -c && node scripts/cp.js src/runtime/components assets/components && npm run types",
@@ -27,7 +27,11 @@ export interface AdapterEntry {
27
27
  }
28
28
 
29
29
  export type BodyValidator<T> = {
30
- [P in keyof T]: T[P] extends JSONValue ? BodyValidator<T[P]> : never;
30
+ [P in keyof T]: T[P] extends { [k: string]: infer V }
31
+ ? BodyValidator<V> // recurse when T[P] is an object
32
+ : T[P] extends BigInt | Function | Symbol
33
+ ? never
34
+ : T[P];
31
35
  };
32
36
 
33
37
  // Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts