@sveltejs/kit 2.1.1 → 2.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "The fastest way to build Svelte apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +1,5 @@
1
+ import { BROWSER } from 'esm-env';
2
+
1
3
  const param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
2
4
 
3
5
  /**
@@ -62,9 +64,15 @@ export function parse_route_id(id) {
62
64
  );
63
65
  }
64
66
 
65
- // We know the match cannot be null because manifest generation would have
66
- // if we hit an invalid param/matcher name with non-alphanumeric character.
67
+ // We know the match cannot be null in the browser because manifest generation
68
+ // would have invoked this during build and failed if we hit an invalid
69
+ // param/matcher name with non-alphanumeric character.
67
70
  const match = /** @type {RegExpExecArray} */ (param_pattern.exec(content));
71
+ if (!BROWSER && !match) {
72
+ throw new Error(
73
+ `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
74
+ );
75
+ }
68
76
 
69
77
  const [, is_optional, is_rest, name, matcher] = match;
70
78
  // It's assumed that the following invalid route id cases are already checked
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // generated during release, do not modify
2
2
 
3
3
  /** @type {string} */
4
- export const VERSION = '2.1.1';
4
+ export const VERSION = '2.1.2';