@sveltejs/kit 1.16.2 → 1.16.3

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.16.2",
3
+ "version": "1.16.3",
4
4
  "description": "The fastest way to build Svelte apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1908,7 +1908,8 @@ function reset_focus() {
1908
1908
  const tabindex = root.getAttribute('tabindex');
1909
1909
 
1910
1910
  root.tabIndex = -1;
1911
- root.focus({ preventScroll: true });
1911
+ // @ts-expect-error
1912
+ root.focus({ preventScroll: true, focusVisible: false });
1912
1913
 
1913
1914
  // restore `tabindex` as to prevent `root` from stealing input from elements
1914
1915
  if (tabindex !== null) {
@@ -96,7 +96,7 @@ export function parse_route_id(id) {
96
96
  return { pattern, params };
97
97
  }
98
98
 
99
- const basic_param_pattern = /\[(\[)?(?:\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/;
99
+ const basic_param_pattern = /\[(\[)?(?:\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;
100
100
 
101
101
  /**
102
102
  * Parses a route ID, then resolves it to a path by replacing parameters with actual values from `entry`.
@@ -112,29 +112,23 @@ export function resolve_entry(id, entry) {
112
112
  return (
113
113
  '/' +
114
114
  segments
115
- .map((segment) => {
116
- const match = basic_param_pattern.exec(segment);
117
-
118
- // static content -- i.e. not a param
119
- if (!match) return segment;
120
-
121
- const optional = !!match[1];
122
- const name = match[2];
123
- const param_value = entry[name];
124
-
125
- // This is nested so TS correctly narrows the type
126
- if (!param_value) {
127
- if (optional) return '';
128
- throw new Error(`Missing parameter '${name}' in route ${id}`);
129
- }
130
-
131
- if (param_value.startsWith('/') || param_value.endsWith('/'))
132
- throw new Error(
133
- `Parameter '${name}' in route ${id} cannot start or end with a slash -- this would cause an invalid route like foo//bar`
134
- );
135
-
136
- return param_value;
137
- })
115
+ .map((segment) =>
116
+ segment.replace(basic_param_pattern, (_, optional, name) => {
117
+ const param_value = entry[name];
118
+
119
+ // This is nested so TS correctly narrows the type
120
+ if (!param_value) {
121
+ if (optional) return '';
122
+ throw new Error(`Missing parameter '${name}' in route ${id}`);
123
+ }
124
+
125
+ if (param_value.startsWith('/') || param_value.endsWith('/'))
126
+ throw new Error(
127
+ `Parameter '${name}' in route ${id} cannot start or end with a slash -- this would cause an invalid route like foo//bar`
128
+ );
129
+ return param_value;
130
+ })
131
+ )
138
132
  .filter(Boolean)
139
133
  .join('/')
140
134
  );