svelte 5.56.2 → 5.56.4

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
@@ -2,7 +2,7 @@
2
2
  "name": "svelte",
3
3
  "description": "Cybernetically enhanced web apps",
4
4
  "license": "MIT",
5
- "version": "5.56.2",
5
+ "version": "5.56.4",
6
6
  "type": "module",
7
7
  "types": "./types/index.d.ts",
8
8
  "engines": {
@@ -148,7 +148,7 @@
148
148
  "@types/node": "^20.11.5",
149
149
  "baseline-browser-mapping": "^2.10.32",
150
150
  "dts-buddy": "^0.5.5",
151
- "esbuild": "^0.25.10",
151
+ "esbuild": "^0.28.1",
152
152
  "rollup": "^4.59.0",
153
153
  "source-map": "^0.7.4",
154
154
  "tinyglobby": "^0.2.12",
@@ -168,7 +168,7 @@
168
168
  "clsx": "^2.1.1",
169
169
  "devalue": "^5.8.1",
170
170
  "esm-env": "^1.2.1",
171
- "esrap": "^2.2.11",
171
+ "esrap": "^2.2.12",
172
172
  "is-reference": "^3.0.3",
173
173
  "locate-character": "^3.0.0",
174
174
  "magic-string": "^0.30.11",
@@ -30,6 +30,12 @@ const visitors = {
30
30
  delete n.readonly;
31
31
  delete n.definite;
32
32
  delete n.override;
33
+
34
+ // `optional` is reused by JS optional chaining (`a?.b`, `a?.()`), so only
35
+ // strip the TypeScript optional marker (`x?: T`, `m?(): T`, `x?: T` fields)
36
+ if (n.type !== 'MemberExpression' && n.type !== 'CallExpression') {
37
+ delete n.optional;
38
+ }
33
39
  },
34
40
  Decorator(node) {
35
41
  e.typescript_invalid_feature(node, 'decorators (related TSC proposal is not stage 4 yet)');
@@ -783,6 +783,8 @@ function special(parser) {
783
783
 
784
784
  const expression_start = parser.index;
785
785
  const init = read_expression(parser);
786
+ // parser is past wrapping parens, but `init.end` is not — use the parser position
787
+ const declarator_end = parser.index;
786
788
  if (
787
789
  init.type === 'SequenceExpression' &&
788
790
  !parser.template.substring(expression_start, init.start).includes('(')
@@ -801,7 +803,9 @@ function special(parser) {
801
803
  declaration: {
802
804
  type: 'VariableDeclaration',
803
805
  kind: 'const',
804
- declarations: [{ type: 'VariableDeclarator', id, init, start: id.start, end: init.end }],
806
+ declarations: [
807
+ { type: 'VariableDeclarator', id, init, start: id.start, end: declarator_end }
808
+ ],
805
809
  start: start + 2, // start at const, not at @const
806
810
  end: parser.index - 1
807
811
  },
@@ -3,7 +3,7 @@
3
3
  import { DEV } from 'esm-env';
4
4
  import { FILENAME } from '../../constants.js';
5
5
  import { is_firefox } from './dom/operations.js';
6
- import { ERROR_VALUE, BOUNDARY_EFFECT, REACTION_RAN, EFFECT } from './constants.js';
6
+ import { ERROR_VALUE, BOUNDARY_EFFECT, REACTION_RAN, EFFECT, DESTROYED } from './constants.js';
7
7
  import { define_property, get_descriptor } from '../shared/utils.js';
8
8
  import { active_effect, active_reaction } from './runtime.js';
9
9
 
@@ -45,6 +45,10 @@ export function handle_error(error) {
45
45
  * @param {Effect | null} effect
46
46
  */
47
47
  export function invoke_error_boundary(error, effect) {
48
+ if (effect !== null && (effect.f & DESTROYED) !== 0) {
49
+ return;
50
+ }
51
+
48
52
  while (effect !== null) {
49
53
  if ((effect.f & BOUNDARY_EFFECT) !== 0) {
50
54
  if ((effect.f & REACTION_RAN) === 0) {
@@ -180,4 +180,3 @@ export {
180
180
  } from '../shared/validate.js';
181
181
  export { strict_equals, equals } from './dev/equality.js';
182
182
  export { log_if_contains_state } from './dev/console-log.js';
183
- export { invoke_error_boundary } from './error-handling.js';
@@ -25,6 +25,7 @@ import {
25
25
  set_reactivity_loss_tracker
26
26
  } from './deriveds.js';
27
27
  import { aborted } from './effects.js';
28
+ import { queue_micro_task } from '../dom/task.js';
28
29
 
29
30
  /**
30
31
  * @param {Blocker[]} blockers
@@ -169,6 +170,7 @@ export async function save(promise) {
169
170
 
170
171
  return () => {
171
172
  restore();
173
+ queue_micro_task(unset_context);
172
174
  return value;
173
175
  };
174
176
  }
@@ -54,6 +54,11 @@ export class SvelteURLSearchParams extends URLSearchParams {
54
54
  */
55
55
  [REPLACE](params) {
56
56
  if (this.#updating) return;
57
+
58
+ // the URL may have changed in a way that leaves the search string untouched —
59
+ // don't rebuild the params or notify readers if nothing changed
60
+ if (params.toString() === super.toString()) return;
61
+
57
62
  this.#updating = true;
58
63
 
59
64
  for (const key of [...super.keys()]) {
@@ -126,6 +131,16 @@ export class SvelteURLSearchParams extends URLSearchParams {
126
131
  return super.keys();
127
132
  }
128
133
 
134
+ /**
135
+ * @param {(value: string, key: string, parent: URLSearchParams) => void} callback
136
+ * @param {any} [this_arg]
137
+ * @returns {void}
138
+ */
139
+ forEach(callback, this_arg) {
140
+ get(this.#version);
141
+ super.forEach(callback, this_arg);
142
+ }
143
+
129
144
  /**
130
145
  * @param {string} name
131
146
  * @param {string} value
package/src/version.js CHANGED
@@ -4,5 +4,5 @@
4
4
  * The current version, as set in package.json.
5
5
  * @type {string}
6
6
  */
7
- export const VERSION = '5.56.2';
7
+ export const VERSION = '5.56.4';
8
8
  export const PUBLIC_VERSION = '5';
package/types/index.d.ts CHANGED
@@ -3229,7 +3229,7 @@ declare function $state<T>(initial: T): T;
3229
3229
  declare function $state<T>(): T | undefined;
3230
3230
 
3231
3231
  declare namespace $state {
3232
- type Primitive = string | number | boolean | null | undefined;
3232
+ type Primitive = string | number | bigint | boolean | null | undefined;
3233
3233
 
3234
3234
  type TypedArray =
3235
3235
  | Int8Array