@sveltejs/kit 1.0.0-next.301 → 1.0.0-next.302

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.
@@ -1021,7 +1021,7 @@ function create_client({ target, session, base, trailing_slash }) {
1021
1021
  // @ts-expect-error
1022
1022
  if (node.loaded.fallthrough) {
1023
1023
  throw new Error(
1024
- 'fallthrough is no longer supported. Use matchers instead: https://kit.svelte.dev/docs/routing#advanced-routing-validation'
1024
+ 'fallthrough is no longer supported. Use matchers instead: https://kit.svelte.dev/docs/routing#advanced-routing-matching'
1025
1025
  );
1026
1026
  }
1027
1027
 
@@ -2541,7 +2541,10 @@ async function respond(request, options, state) {
2541
2541
  return new Response(undefined, {
2542
2542
  status: 301,
2543
2543
  headers: {
2544
- location: normalized + (url.search === '?' ? '' : url.search)
2544
+ location:
2545
+ // ensure paths starting with '//' are not treated as protocol-relative
2546
+ (normalized.startsWith('//') ? url.origin + normalized : normalized) +
2547
+ (url.search === '?' ? '' : url.search)
2545
2548
  }
2546
2549
  });
2547
2550
  }
@@ -328,7 +328,7 @@ function create_manifest_data({
328
328
  matchers[type] = path__default.join(params_base, file);
329
329
  } else {
330
330
  throw new Error(
331
- `Validator names must match /^[a-zA-Z_][a-zA-Z0-9_]*$/ — "${file}" is invalid`
331
+ `Matcher names must match /^[a-zA-Z_][a-zA-Z0-9_]*$/ — "${file}" is invalid`
332
332
  );
333
333
  }
334
334
  }
@@ -579,6 +579,28 @@ function write_manifest(manifest_data, base, output) {
579
579
  );
580
580
  }
581
581
 
582
+ /**
583
+ * @param {import('types').ManifestData} manifest_data
584
+ * @param {string} output
585
+ */
586
+ function write_matchers(manifest_data, output) {
587
+ const imports = [];
588
+ const matchers = [];
589
+
590
+ for (const key in manifest_data.matchers) {
591
+ const src = manifest_data.matchers[key];
592
+
593
+ imports.push(`import { match as ${key} } from ${s(path__default.relative(output, src))};`);
594
+ matchers.push(key);
595
+ }
596
+
597
+ const module = imports.length
598
+ ? `${imports.join('\n')}\n\nexport const matchers = { ${matchers.join(', ')} };`
599
+ : 'export const matchers = {};';
600
+
601
+ write_if_changed(`${output}/client-matchers.js`, module);
602
+ }
603
+
582
604
  /**
583
605
  * @param {import('types').ManifestData} manifest_data
584
606
  * @param {string} output
@@ -878,28 +900,6 @@ function write_types(config, manifest_data) {
878
900
  });
879
901
  }
880
902
 
881
- /**
882
- * @param {import('types').ManifestData} manifest_data
883
- * @param {string} output
884
- */
885
- function write_validators(manifest_data, output) {
886
- const imports = [];
887
- const matchers = [];
888
-
889
- for (const key in manifest_data.matchers) {
890
- const src = manifest_data.matchers[key];
891
-
892
- imports.push(`import { match as ${key} } from ${s(path__default.relative(output, src))};`);
893
- matchers.push(key);
894
- }
895
-
896
- const module = imports.length
897
- ? `${imports.join('\n')}\n\nexport const matchers = { ${matchers.join(', ')} };`
898
- : 'export const matchers = {};';
899
-
900
- write_if_changed(`${output}/client-matchers.js`, module);
901
- }
902
-
903
903
  /** @param {import('types').ValidatedConfig} config */
904
904
  function init(config) {
905
905
  copy_assets(path__default.join(config.kit.outDir, 'runtime'));
@@ -915,7 +915,7 @@ function update(config) {
915
915
 
916
916
  write_manifest(manifest_data, base, output);
917
917
  write_root(manifest_data, output);
918
- write_validators(manifest_data, output);
918
+ write_matchers(manifest_data, output);
919
919
  write_types(config, manifest_data);
920
920
 
921
921
  return { manifest_data };
package/dist/cli.js CHANGED
@@ -869,7 +869,7 @@ async function launch(port, https) {
869
869
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
870
870
  }
871
871
 
872
- const prog = sade('svelte-kit').version('1.0.0-next.301');
872
+ const prog = sade('svelte-kit').version('1.0.0-next.302');
873
873
 
874
874
  prog
875
875
  .command('dev')
@@ -1047,7 +1047,7 @@ async function check_port(port) {
1047
1047
  function welcome({ port, host, https, open, loose, allow, cwd }) {
1048
1048
  if (open) launch(port, https);
1049
1049
 
1050
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.301'}\n`));
1050
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.302'}\n`));
1051
1051
 
1052
1052
  const protocol = https ? 'https:' : 'http:';
1053
1053
  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.301",
3
+ "version": "1.0.0-next.302",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",