@fictjs/compiler 0.2.2 → 0.3.0

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/dist/index.js CHANGED
@@ -24,9 +24,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  mod
25
25
  ));
26
26
 
27
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/shallowEqual.js
27
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/shallowEqual.js
28
28
  var require_shallowEqual = __commonJS({
29
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/shallowEqual.js"(exports) {
29
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/shallowEqual.js"(exports) {
30
30
  "use strict";
31
31
  Object.defineProperty(exports, "__esModule", {
32
32
  value: true
@@ -44,9 +44,9 @@ var require_shallowEqual = __commonJS({
44
44
  }
45
45
  });
46
46
 
47
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/deprecationWarning.js
47
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/deprecationWarning.js
48
48
  var require_deprecationWarning = __commonJS({
49
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/deprecationWarning.js"(exports) {
49
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/deprecationWarning.js"(exports) {
50
50
  "use strict";
51
51
  Object.defineProperty(exports, "__esModule", {
52
52
  value: true
@@ -92,9 +92,9 @@ ${trace}`);
92
92
  }
93
93
  });
94
94
 
95
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/generated/index.js
95
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/generated/index.js
96
96
  var require_generated = __commonJS({
97
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/generated/index.js"(exports) {
97
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/generated/index.js"(exports) {
98
98
  "use strict";
99
99
  Object.defineProperty(exports, "__esModule", {
100
100
  value: true
@@ -179,7 +179,7 @@ var require_generated = __commonJS({
179
179
  exports.isExpression = isExpression2;
180
180
  exports.isExpressionStatement = isExpressionStatement2;
181
181
  exports.isExpressionWrapper = isExpressionWrapper;
182
- exports.isFile = isFile;
182
+ exports.isFile = isFile2;
183
183
  exports.isFlow = isFlow;
184
184
  exports.isFlowBaseAnnotation = isFlowBaseAnnotation;
185
185
  exports.isFlowDeclaration = isFlowDeclaration;
@@ -489,7 +489,7 @@ var require_generated = __commonJS({
489
489
  if (node.type !== "ExpressionStatement") return false;
490
490
  return opts == null || (0, _shallowEqual.default)(node, opts);
491
491
  }
492
- function isFile(node, opts) {
492
+ function isFile2(node, opts) {
493
493
  if (!node) return false;
494
494
  if (node.type !== "File") return false;
495
495
  return opts == null || (0, _shallowEqual.default)(node, opts);
@@ -2892,9 +2892,9 @@ var require_generated = __commonJS({
2892
2892
  }
2893
2893
  });
2894
2894
 
2895
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/matchesPattern.js
2895
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/matchesPattern.js
2896
2896
  var require_matchesPattern = __commonJS({
2897
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/matchesPattern.js"(exports) {
2897
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/matchesPattern.js"(exports) {
2898
2898
  "use strict";
2899
2899
  Object.defineProperty(exports, "__esModule", {
2900
2900
  value: true
@@ -2939,9 +2939,9 @@ var require_matchesPattern = __commonJS({
2939
2939
  }
2940
2940
  });
2941
2941
 
2942
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js
2942
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js
2943
2943
  var require_buildMatchMemberExpression = __commonJS({
2944
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js"(exports) {
2944
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js"(exports) {
2945
2945
  "use strict";
2946
2946
  Object.defineProperty(exports, "__esModule", {
2947
2947
  value: true
@@ -2955,9 +2955,9 @@ var require_buildMatchMemberExpression = __commonJS({
2955
2955
  }
2956
2956
  });
2957
2957
 
2958
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/react/isReactComponent.js
2958
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/react/isReactComponent.js
2959
2959
  var require_isReactComponent = __commonJS({
2960
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/react/isReactComponent.js"(exports) {
2960
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/react/isReactComponent.js"(exports) {
2961
2961
  "use strict";
2962
2962
  Object.defineProperty(exports, "__esModule", {
2963
2963
  value: true
@@ -2969,9 +2969,9 @@ var require_isReactComponent = __commonJS({
2969
2969
  }
2970
2970
  });
2971
2971
 
2972
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/react/isCompatTag.js
2972
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/react/isCompatTag.js
2973
2973
  var require_isCompatTag = __commonJS({
2974
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/react/isCompatTag.js"(exports) {
2974
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/react/isCompatTag.js"(exports) {
2975
2975
  "use strict";
2976
2976
  Object.defineProperty(exports, "__esModule", {
2977
2977
  value: true
@@ -2983,9 +2983,9 @@ var require_isCompatTag = __commonJS({
2983
2983
  }
2984
2984
  });
2985
2985
 
2986
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isType.js
2986
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isType.js
2987
2987
  var require_isType = __commonJS({
2988
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isType.js"(exports) {
2988
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isType.js"(exports) {
2989
2989
  "use strict";
2990
2990
  Object.defineProperty(exports, "__esModule", {
2991
2991
  value: true
@@ -3003,9 +3003,9 @@ var require_isType = __commonJS({
3003
3003
  }
3004
3004
  });
3005
3005
 
3006
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isPlaceholderType.js
3006
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isPlaceholderType.js
3007
3007
  var require_isPlaceholderType = __commonJS({
3008
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isPlaceholderType.js"(exports) {
3008
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isPlaceholderType.js"(exports) {
3009
3009
  "use strict";
3010
3010
  Object.defineProperty(exports, "__esModule", {
3011
3011
  value: true
@@ -3021,9 +3021,9 @@ var require_isPlaceholderType = __commonJS({
3021
3021
  }
3022
3022
  });
3023
3023
 
3024
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/is.js
3024
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/is.js
3025
3025
  var require_is = __commonJS({
3026
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/is.js"(exports) {
3026
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/is.js"(exports) {
3027
3027
  "use strict";
3028
3028
  Object.defineProperty(exports, "__esModule", {
3029
3029
  value: true
@@ -3222,9 +3222,9 @@ var require_lib = __commonJS({
3222
3222
  }
3223
3223
  });
3224
3224
 
3225
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isValidIdentifier.js
3225
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isValidIdentifier.js
3226
3226
  var require_isValidIdentifier = __commonJS({
3227
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isValidIdentifier.js"(exports) {
3227
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isValidIdentifier.js"(exports) {
3228
3228
  "use strict";
3229
3229
  Object.defineProperty(exports, "__esModule", {
3230
3230
  value: true
@@ -3539,9 +3539,9 @@ var require_lib2 = __commonJS({
3539
3539
  }
3540
3540
  });
3541
3541
 
3542
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/constants/index.js
3542
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/constants/index.js
3543
3543
  var require_constants = __commonJS({
3544
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/constants/index.js"(exports) {
3544
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/constants/index.js"(exports) {
3545
3545
  "use strict";
3546
3546
  Object.defineProperty(exports, "__esModule", {
3547
3547
  value: true
@@ -3568,16 +3568,14 @@ var require_constants = __commonJS({
3568
3568
  optional: ["typeAnnotation", "typeParameters", "returnType"],
3569
3569
  force: ["start", "loc", "end"]
3570
3570
  };
3571
- {
3572
- exports.BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
3573
- exports.NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
3574
- }
3571
+ exports.BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
3572
+ exports.NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
3575
3573
  }
3576
3574
  });
3577
3575
 
3578
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/utils.js
3576
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/utils.js
3579
3577
  var require_utils = __commonJS({
3580
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/utils.js"(exports) {
3578
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/utils.js"(exports) {
3581
3579
  "use strict";
3582
3580
  Object.defineProperty(exports, "__esModule", {
3583
3581
  value: true
@@ -3876,9 +3874,9 @@ ${errors.join("\n")}`);
3876
3874
  }
3877
3875
  });
3878
3876
 
3879
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/core.js
3877
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/core.js
3880
3878
  var require_core = __commonJS({
3881
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/core.js"(exports) {
3879
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/core.js"(exports) {
3882
3880
  "use strict";
3883
3881
  Object.defineProperty(exports, "__esModule", {
3884
3882
  value: true
@@ -4347,8 +4345,6 @@ var require_core = __commonJS({
4347
4345
  validate: (0, _utils.chain)((0, _utils.assertValueType)("number"), Object.assign(function(node, key, val) {
4348
4346
  if (1 / val < 0 || !Number.isFinite(val)) {
4349
4347
  const error = new Error(`NumericLiterals must be non-negative finite numbers. You can use t.valueToNode(${val}) instead.`);
4350
- {
4351
- }
4352
4348
  }
4353
4349
  }, {
4354
4350
  type: "number"
@@ -4956,13 +4952,13 @@ var require_core = __commonJS({
4956
4952
  attributes: {
4957
4953
  optional: true,
4958
4954
  validate: (0, _utils.arrayOfType)("ImportAttribute")
4959
- },
4960
- assertions: {
4961
- deprecated: true,
4962
- optional: true,
4963
- validate: (0, _utils.arrayOfType)("ImportAttribute")
4964
4955
  }
4965
4956
  };
4957
+ importAttributes.assertions = {
4958
+ deprecated: true,
4959
+ optional: true,
4960
+ validate: (0, _utils.arrayOfType)("ImportAttribute")
4961
+ };
4966
4962
  defineType("ExportAllDeclaration", {
4967
4963
  builder: ["source"],
4968
4964
  visitor: ["source", "attributes", "assertions"],
@@ -5609,9 +5605,9 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
5609
5605
  }
5610
5606
  });
5611
5607
 
5612
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/flow.js
5608
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/flow.js
5613
5609
  var require_flow = __commonJS({
5614
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/flow.js"() {
5610
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/flow.js"() {
5615
5611
  "use strict";
5616
5612
  var _core = require_core();
5617
5613
  var _utils = require_utils();
@@ -6107,9 +6103,9 @@ var require_flow = __commonJS({
6107
6103
  }
6108
6104
  });
6109
6105
 
6110
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/jsx.js
6106
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/jsx.js
6111
6107
  var require_jsx = __commonJS({
6112
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/jsx.js"() {
6108
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/jsx.js"() {
6113
6109
  "use strict";
6114
6110
  var _utils = require_utils();
6115
6111
  var defineType = (0, _utils.defineAliasedType)("JSX");
@@ -6267,9 +6263,9 @@ var require_jsx = __commonJS({
6267
6263
  }
6268
6264
  });
6269
6265
 
6270
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/placeholders.js
6266
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/placeholders.js
6271
6267
  var require_placeholders = __commonJS({
6272
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/placeholders.js"(exports) {
6268
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/placeholders.js"(exports) {
6273
6269
  "use strict";
6274
6270
  Object.defineProperty(exports, "__esModule", {
6275
6271
  value: true
@@ -6297,19 +6293,17 @@ var require_placeholders = __commonJS({
6297
6293
  }
6298
6294
  });
6299
6295
 
6300
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/misc.js
6296
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/misc.js
6301
6297
  var require_misc = __commonJS({
6302
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/misc.js"() {
6298
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/misc.js"() {
6303
6299
  "use strict";
6304
6300
  var _utils = require_utils();
6305
6301
  var _placeholders = require_placeholders();
6306
6302
  var _core = require_core();
6307
6303
  var defineType = (0, _utils.defineAliasedType)("Miscellaneous");
6308
- {
6309
- defineType("Noop", {
6310
- visitor: []
6311
- });
6312
- }
6304
+ defineType("Noop", {
6305
+ visitor: []
6306
+ });
6313
6307
  defineType("Placeholder", {
6314
6308
  visitor: [],
6315
6309
  builder: ["expectedNode", "name"],
@@ -6333,9 +6327,9 @@ var require_misc = __commonJS({
6333
6327
  }
6334
6328
  });
6335
6329
 
6336
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/experimental.js
6330
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/experimental.js
6337
6331
  var require_experimental = __commonJS({
6338
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/experimental.js"() {
6332
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/experimental.js"() {
6339
6333
  "use strict";
6340
6334
  var _utils = require_utils();
6341
6335
  (0, _utils.default)("ArgumentPlaceholder", {});
@@ -6412,17 +6406,15 @@ var require_experimental = __commonJS({
6412
6406
  visitor: ["elements"],
6413
6407
  aliases: ["Expression"]
6414
6408
  });
6415
- {
6416
- (0, _utils.default)("DecimalLiteral", {
6417
- builder: ["value"],
6418
- fields: {
6419
- value: {
6420
- validate: (0, _utils.assertValueType)("string")
6421
- }
6422
- },
6423
- aliases: ["Expression", "Pureish", "Literal", "Immutable"]
6424
- });
6425
- }
6409
+ (0, _utils.default)("DecimalLiteral", {
6410
+ builder: ["value"],
6411
+ fields: {
6412
+ value: {
6413
+ validate: (0, _utils.assertValueType)("string")
6414
+ }
6415
+ },
6416
+ aliases: ["Expression", "Pureish", "Literal", "Immutable"]
6417
+ });
6426
6418
  (0, _utils.default)("ModuleExpression", {
6427
6419
  visitor: ["body"],
6428
6420
  fields: {
@@ -6464,9 +6456,9 @@ var require_experimental = __commonJS({
6464
6456
  }
6465
6457
  });
6466
6458
 
6467
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/typescript.js
6459
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/typescript.js
6468
6460
  var require_typescript = __commonJS({
6469
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/typescript.js"() {
6461
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/typescript.js"() {
6470
6462
  "use strict";
6471
6463
  var _utils = require_utils();
6472
6464
  var _core = require_core();
@@ -6778,16 +6770,14 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
6778
6770
  }
6779
6771
  }
6780
6772
  });
6781
- {
6782
- defineType("TSExpressionWithTypeArguments", {
6783
- aliases: ["TSType"],
6784
- visitor: ["expression", "typeParameters"],
6785
- fields: {
6786
- expression: (0, _utils.validateType)("TSEntityName"),
6787
- typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
6788
- }
6789
- });
6790
- }
6773
+ defineType("TSExpressionWithTypeArguments", {
6774
+ aliases: ["TSType"],
6775
+ visitor: ["expression", "typeParameters"],
6776
+ fields: {
6777
+ expression: (0, _utils.validateType)("TSEntityName"),
6778
+ typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
6779
+ }
6780
+ });
6791
6781
  defineType("TSInterfaceDeclaration", {
6792
6782
  aliases: ["Statement", "Declaration"],
6793
6783
  visitor: ["id", "typeParameters", "extends", "body"],
@@ -6847,20 +6837,18 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
6847
6837
  members: (0, _utils.validateArrayOfType)("TSEnumMember")
6848
6838
  }
6849
6839
  });
6850
- {
6851
- defineType("TSEnumDeclaration", {
6852
- aliases: ["Statement", "Declaration"],
6853
- visitor: ["id", "members"],
6854
- fields: {
6855
- declare: (0, _utils.validateOptional)(bool),
6856
- const: (0, _utils.validateOptional)(bool),
6857
- id: (0, _utils.validateType)("Identifier"),
6858
- members: (0, _utils.validateArrayOfType)("TSEnumMember"),
6859
- initializer: (0, _utils.validateOptionalType)("Expression"),
6860
- body: (0, _utils.validateOptionalType)("TSEnumBody")
6861
- }
6862
- });
6863
- }
6840
+ defineType("TSEnumDeclaration", {
6841
+ aliases: ["Statement", "Declaration"],
6842
+ visitor: ["id", "members"],
6843
+ fields: {
6844
+ declare: (0, _utils.validateOptional)(bool),
6845
+ const: (0, _utils.validateOptional)(bool),
6846
+ id: (0, _utils.validateType)("Identifier"),
6847
+ members: (0, _utils.validateArrayOfType)("TSEnumMember"),
6848
+ initializer: (0, _utils.validateOptionalType)("Expression"),
6849
+ body: (0, _utils.validateOptionalType)("TSEnumBody")
6850
+ }
6851
+ });
6864
6852
  defineType("TSEnumMember", {
6865
6853
  visitor: ["id", "initializer"],
6866
6854
  fields: {
@@ -6894,15 +6882,18 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
6894
6882
  aliases: ["TSType"],
6895
6883
  builder: ["argument", "qualifier", "typeParameters"],
6896
6884
  visitor: ["argument", "options", "qualifier", "typeParameters"],
6897
- fields: {
6898
- argument: (0, _utils.validateType)("StringLiteral"),
6899
- qualifier: (0, _utils.validateOptionalType)("TSEntityName"),
6900
- ["typeParameters"]: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation"),
6885
+ fields: Object.assign({}, {
6886
+ argument: (0, _utils.validateType)("StringLiteral")
6887
+ }, {
6888
+ qualifier: (0, _utils.validateOptionalType)("TSEntityName")
6889
+ }, {
6890
+ typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
6891
+ }, {
6901
6892
  options: {
6902
6893
  validate: (0, _utils.assertNodeType)("ObjectExpression"),
6903
6894
  optional: true
6904
6895
  }
6905
- }
6896
+ })
6906
6897
  });
6907
6898
  defineType("TSImportEqualsDeclaration", {
6908
6899
  aliases: ["Statement", "Declaration"],
@@ -6997,9 +6988,9 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
6997
6988
  }
6998
6989
  });
6999
6990
 
7000
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/deprecated-aliases.js
6991
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/deprecated-aliases.js
7001
6992
  var require_deprecated_aliases = __commonJS({
7002
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/deprecated-aliases.js"(exports) {
6993
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/deprecated-aliases.js"(exports) {
7003
6994
  "use strict";
7004
6995
  Object.defineProperty(exports, "__esModule", {
7005
6996
  value: true
@@ -7011,9 +7002,9 @@ var require_deprecated_aliases = __commonJS({
7011
7002
  }
7012
7003
  });
7013
7004
 
7014
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/index.js
7005
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/index.js
7015
7006
  var require_definitions = __commonJS({
7016
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/index.js"(exports) {
7007
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/index.js"(exports) {
7017
7008
  "use strict";
7018
7009
  Object.defineProperty(exports, "__esModule", {
7019
7010
  value: true
@@ -7120,9 +7111,9 @@ var require_definitions = __commonJS({
7120
7111
  }
7121
7112
  });
7122
7113
 
7123
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/validate.js
7114
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/validate.js
7124
7115
  var require_validate = __commonJS({
7125
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/validate.js"(exports) {
7116
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/validate.js"(exports) {
7126
7117
  "use strict";
7127
7118
  Object.defineProperty(exports, "__esModule", {
7128
7119
  value: true
@@ -7165,9 +7156,9 @@ var require_validate = __commonJS({
7165
7156
  }
7166
7157
  });
7167
7158
 
7168
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/lowercase.js
7159
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/lowercase.js
7169
7160
  var require_lowercase = __commonJS({
7170
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/lowercase.js"(exports) {
7161
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/lowercase.js"(exports) {
7171
7162
  "use strict";
7172
7163
  Object.defineProperty(exports, "__esModule", {
7173
7164
  value: true
@@ -7322,7 +7313,7 @@ var require_lowercase = __commonJS({
7322
7313
  exports.restElement = restElement;
7323
7314
  exports.restProperty = RestProperty;
7324
7315
  exports.returnStatement = returnStatement2;
7325
- exports.sequenceExpression = sequenceExpression;
7316
+ exports.sequenceExpression = sequenceExpression2;
7326
7317
  exports.spreadElement = spreadElement;
7327
7318
  exports.spreadProperty = SpreadProperty;
7328
7319
  exports.staticBlock = staticBlock;
@@ -7876,7 +7867,7 @@ var require_lowercase = __commonJS({
7876
7867
  validate(defs.argument, node, "argument", argument, 1);
7877
7868
  return node;
7878
7869
  }
7879
- function sequenceExpression(expressions) {
7870
+ function sequenceExpression2(expressions) {
7880
7871
  const node = {
7881
7872
  type: "SequenceExpression",
7882
7873
  expressions
@@ -10064,9 +10055,9 @@ var require_lowercase = __commonJS({
10064
10055
  }
10065
10056
  });
10066
10057
 
10067
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/uppercase.js
10058
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/uppercase.js
10068
10059
  var require_uppercase = __commonJS({
10069
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/uppercase.js"(exports) {
10060
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/uppercase.js"(exports) {
10070
10061
  "use strict";
10071
10062
  Object.defineProperty(exports, "__esModule", {
10072
10063
  value: true
@@ -10077,9 +10068,7 @@ var require_uppercase = __commonJS({
10077
10068
  var b = require_lowercase();
10078
10069
  var _deprecationWarning = require_deprecationWarning();
10079
10070
  function alias(lowercase) {
10080
- {
10081
- return b[lowercase];
10082
- }
10071
+ return b[lowercase];
10083
10072
  }
10084
10073
  var ArrayExpression = exports.ArrayExpression = alias("arrayExpression");
10085
10074
  var AssignmentExpression = exports.AssignmentExpression = alias("assignmentExpression");
@@ -10341,9 +10330,9 @@ var require_uppercase = __commonJS({
10341
10330
  }
10342
10331
  });
10343
10332
 
10344
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/index.js
10333
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/index.js
10345
10334
  var require_generated2 = __commonJS({
10346
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/index.js"(exports) {
10335
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/index.js"(exports) {
10347
10336
  "use strict";
10348
10337
  Object.defineProperty(exports, "__esModule", {
10349
10338
  value: true
@@ -10373,9 +10362,9 @@ var require_generated2 = __commonJS({
10373
10362
  }
10374
10363
  });
10375
10364
 
10376
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
10365
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
10377
10366
  var require_cleanJSXElementLiteralChild = __commonJS({
10378
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js"(exports) {
10367
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js"(exports) {
10379
10368
  "use strict";
10380
10369
  Object.defineProperty(exports, "__esModule", {
10381
10370
  value: true
@@ -10416,9 +10405,9 @@ var require_cleanJSXElementLiteralChild = __commonJS({
10416
10405
  }
10417
10406
  });
10418
10407
 
10419
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/react/buildChildren.js
10408
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/react/buildChildren.js
10420
10409
  var require_buildChildren = __commonJS({
10421
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/react/buildChildren.js"(exports) {
10410
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/react/buildChildren.js"(exports) {
10422
10411
  "use strict";
10423
10412
  Object.defineProperty(exports, "__esModule", {
10424
10413
  value: true
@@ -10443,9 +10432,9 @@ var require_buildChildren = __commonJS({
10443
10432
  }
10444
10433
  });
10445
10434
 
10446
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isNode.js
10435
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isNode.js
10447
10436
  var require_isNode = __commonJS({
10448
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isNode.js"(exports) {
10437
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isNode.js"(exports) {
10449
10438
  "use strict";
10450
10439
  Object.defineProperty(exports, "__esModule", {
10451
10440
  value: true
@@ -10458,9 +10447,9 @@ var require_isNode = __commonJS({
10458
10447
  }
10459
10448
  });
10460
10449
 
10461
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/asserts/assertNode.js
10450
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/asserts/assertNode.js
10462
10451
  var require_assertNode = __commonJS({
10463
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/asserts/assertNode.js"(exports) {
10452
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/asserts/assertNode.js"(exports) {
10464
10453
  "use strict";
10465
10454
  Object.defineProperty(exports, "__esModule", {
10466
10455
  value: true
@@ -10477,9 +10466,9 @@ var require_assertNode = __commonJS({
10477
10466
  }
10478
10467
  });
10479
10468
 
10480
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/asserts/generated/index.js
10469
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/asserts/generated/index.js
10481
10470
  var require_generated3 = __commonJS({
10482
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/asserts/generated/index.js"(exports) {
10471
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/asserts/generated/index.js"(exports) {
10483
10472
  "use strict";
10484
10473
  Object.defineProperty(exports, "__esModule", {
10485
10474
  value: true
@@ -11731,9 +11720,9 @@ var require_generated3 = __commonJS({
11731
11720
  }
11732
11721
  });
11733
11722
 
11734
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js
11723
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js
11735
11724
  var require_createTypeAnnotationBasedOnTypeof = __commonJS({
11736
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js"(exports) {
11725
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js"(exports) {
11737
11726
  "use strict";
11738
11727
  Object.defineProperty(exports, "__esModule", {
11739
11728
  value: true
@@ -11765,9 +11754,9 @@ var require_createTypeAnnotationBasedOnTypeof = __commonJS({
11765
11754
  }
11766
11755
  });
11767
11756
 
11768
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js
11757
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js
11769
11758
  var require_removeTypeDuplicates = __commonJS({
11770
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js"(exports) {
11759
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js"(exports) {
11771
11760
  "use strict";
11772
11761
  Object.defineProperty(exports, "__esModule", {
11773
11762
  value: true
@@ -11833,9 +11822,9 @@ var require_removeTypeDuplicates = __commonJS({
11833
11822
  }
11834
11823
  });
11835
11824
 
11836
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js
11825
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js
11837
11826
  var require_createFlowUnionType = __commonJS({
11838
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js"(exports) {
11827
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js"(exports) {
11839
11828
  "use strict";
11840
11829
  Object.defineProperty(exports, "__esModule", {
11841
11830
  value: true
@@ -11854,9 +11843,9 @@ var require_createFlowUnionType = __commonJS({
11854
11843
  }
11855
11844
  });
11856
11845
 
11857
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js
11846
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js
11858
11847
  var require_removeTypeDuplicates2 = __commonJS({
11859
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js"(exports) {
11848
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js"(exports) {
11860
11849
  "use strict";
11861
11850
  Object.defineProperty(exports, "__esModule", {
11862
11851
  value: true
@@ -11923,9 +11912,9 @@ var require_removeTypeDuplicates2 = __commonJS({
11923
11912
  }
11924
11913
  });
11925
11914
 
11926
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js
11915
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js
11927
11916
  var require_createTSUnionType = __commonJS({
11928
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js"(exports) {
11917
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js"(exports) {
11929
11918
  "use strict";
11930
11919
  Object.defineProperty(exports, "__esModule", {
11931
11920
  value: true
@@ -11948,9 +11937,9 @@ var require_createTSUnionType = __commonJS({
11948
11937
  }
11949
11938
  });
11950
11939
 
11951
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/productions.js
11940
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/productions.js
11952
11941
  var require_productions = __commonJS({
11953
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/productions.js"(exports) {
11942
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/productions.js"(exports) {
11954
11943
  "use strict";
11955
11944
  Object.defineProperty(exports, "__esModule", {
11956
11945
  value: true
@@ -11963,14 +11952,14 @@ var require_productions = __commonJS({
11963
11952
  }
11964
11953
  });
11965
11954
 
11966
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneNode.js
11955
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneNode.js
11967
11956
  var require_cloneNode = __commonJS({
11968
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneNode.js"(exports) {
11957
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneNode.js"(exports) {
11969
11958
  "use strict";
11970
11959
  Object.defineProperty(exports, "__esModule", {
11971
11960
  value: true
11972
11961
  });
11973
- exports.default = cloneNode;
11962
+ exports.default = cloneNode2;
11974
11963
  var _index = require_definitions();
11975
11964
  var _index2 = require_generated();
11976
11965
  var {
@@ -11990,7 +11979,7 @@ var require_cloneNode = __commonJS({
11990
11979
  }
11991
11980
  return cloneIfNode(obj, deep, withoutLoc, commentsCache);
11992
11981
  }
11993
- function cloneNode(node, deep = true, withoutLoc = false) {
11982
+ function cloneNode2(node, deep = true, withoutLoc = false) {
11994
11983
  return cloneNodeInternal(node, deep, withoutLoc, /* @__PURE__ */ new Map());
11995
11984
  }
11996
11985
  function cloneNodeInternal(node, deep = true, withoutLoc = false, commentsCache) {
@@ -12073,9 +12062,9 @@ var require_cloneNode = __commonJS({
12073
12062
  }
12074
12063
  });
12075
12064
 
12076
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/clone.js
12065
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/clone.js
12077
12066
  var require_clone = __commonJS({
12078
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/clone.js"(exports) {
12067
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/clone.js"(exports) {
12079
12068
  "use strict";
12080
12069
  Object.defineProperty(exports, "__esModule", {
12081
12070
  value: true
@@ -12088,9 +12077,9 @@ var require_clone = __commonJS({
12088
12077
  }
12089
12078
  });
12090
12079
 
12091
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneDeep.js
12080
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneDeep.js
12092
12081
  var require_cloneDeep = __commonJS({
12093
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneDeep.js"(exports) {
12082
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneDeep.js"(exports) {
12094
12083
  "use strict";
12095
12084
  Object.defineProperty(exports, "__esModule", {
12096
12085
  value: true
@@ -12103,9 +12092,9 @@ var require_cloneDeep = __commonJS({
12103
12092
  }
12104
12093
  });
12105
12094
 
12106
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js
12095
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js
12107
12096
  var require_cloneDeepWithoutLoc = __commonJS({
12108
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js"(exports) {
12097
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js"(exports) {
12109
12098
  "use strict";
12110
12099
  Object.defineProperty(exports, "__esModule", {
12111
12100
  value: true
@@ -12118,9 +12107,9 @@ var require_cloneDeepWithoutLoc = __commonJS({
12118
12107
  }
12119
12108
  });
12120
12109
 
12121
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
12110
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
12122
12111
  var require_cloneWithoutLoc = __commonJS({
12123
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js"(exports) {
12112
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js"(exports) {
12124
12113
  "use strict";
12125
12114
  Object.defineProperty(exports, "__esModule", {
12126
12115
  value: true
@@ -12133,9 +12122,9 @@ var require_cloneWithoutLoc = __commonJS({
12133
12122
  }
12134
12123
  });
12135
12124
 
12136
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/addComments.js
12125
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/addComments.js
12137
12126
  var require_addComments = __commonJS({
12138
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/addComments.js"(exports) {
12127
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/addComments.js"(exports) {
12139
12128
  "use strict";
12140
12129
  Object.defineProperty(exports, "__esModule", {
12141
12130
  value: true
@@ -12158,9 +12147,9 @@ var require_addComments = __commonJS({
12158
12147
  }
12159
12148
  });
12160
12149
 
12161
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/addComment.js
12150
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/addComment.js
12162
12151
  var require_addComment = __commonJS({
12163
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/addComment.js"(exports) {
12152
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/addComment.js"(exports) {
12164
12153
  "use strict";
12165
12154
  Object.defineProperty(exports, "__esModule", {
12166
12155
  value: true
@@ -12176,9 +12165,9 @@ var require_addComment = __commonJS({
12176
12165
  }
12177
12166
  });
12178
12167
 
12179
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/inherit.js
12168
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/inherit.js
12180
12169
  var require_inherit = __commonJS({
12181
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/inherit.js"(exports) {
12170
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/inherit.js"(exports) {
12182
12171
  "use strict";
12183
12172
  Object.defineProperty(exports, "__esModule", {
12184
12173
  value: true
@@ -12192,9 +12181,9 @@ var require_inherit = __commonJS({
12192
12181
  }
12193
12182
  });
12194
12183
 
12195
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritInnerComments.js
12184
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritInnerComments.js
12196
12185
  var require_inheritInnerComments = __commonJS({
12197
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritInnerComments.js"(exports) {
12186
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritInnerComments.js"(exports) {
12198
12187
  "use strict";
12199
12188
  Object.defineProperty(exports, "__esModule", {
12200
12189
  value: true
@@ -12207,9 +12196,9 @@ var require_inheritInnerComments = __commonJS({
12207
12196
  }
12208
12197
  });
12209
12198
 
12210
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritLeadingComments.js
12199
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritLeadingComments.js
12211
12200
  var require_inheritLeadingComments = __commonJS({
12212
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritLeadingComments.js"(exports) {
12201
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritLeadingComments.js"(exports) {
12213
12202
  "use strict";
12214
12203
  Object.defineProperty(exports, "__esModule", {
12215
12204
  value: true
@@ -12222,9 +12211,9 @@ var require_inheritLeadingComments = __commonJS({
12222
12211
  }
12223
12212
  });
12224
12213
 
12225
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritTrailingComments.js
12214
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritTrailingComments.js
12226
12215
  var require_inheritTrailingComments = __commonJS({
12227
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritTrailingComments.js"(exports) {
12216
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritTrailingComments.js"(exports) {
12228
12217
  "use strict";
12229
12218
  Object.defineProperty(exports, "__esModule", {
12230
12219
  value: true
@@ -12237,9 +12226,9 @@ var require_inheritTrailingComments = __commonJS({
12237
12226
  }
12238
12227
  });
12239
12228
 
12240
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritsComments.js
12229
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritsComments.js
12241
12230
  var require_inheritsComments = __commonJS({
12242
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritsComments.js"(exports) {
12231
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritsComments.js"(exports) {
12243
12232
  "use strict";
12244
12233
  Object.defineProperty(exports, "__esModule", {
12245
12234
  value: true
@@ -12257,9 +12246,9 @@ var require_inheritsComments = __commonJS({
12257
12246
  }
12258
12247
  });
12259
12248
 
12260
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/removeComments.js
12249
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/removeComments.js
12261
12250
  var require_removeComments = __commonJS({
12262
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/removeComments.js"(exports) {
12251
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/removeComments.js"(exports) {
12263
12252
  "use strict";
12264
12253
  Object.defineProperty(exports, "__esModule", {
12265
12254
  value: true
@@ -12275,9 +12264,9 @@ var require_removeComments = __commonJS({
12275
12264
  }
12276
12265
  });
12277
12266
 
12278
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/constants/generated/index.js
12267
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/constants/generated/index.js
12279
12268
  var require_generated4 = __commonJS({
12280
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/constants/generated/index.js"(exports) {
12269
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/constants/generated/index.js"(exports) {
12281
12270
  "use strict";
12282
12271
  Object.defineProperty(exports, "__esModule", {
12283
12272
  value: true
@@ -12338,9 +12327,9 @@ var require_generated4 = __commonJS({
12338
12327
  }
12339
12328
  });
12340
12329
 
12341
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toBlock.js
12330
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toBlock.js
12342
12331
  var require_toBlock = __commonJS({
12343
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toBlock.js"(exports) {
12332
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toBlock.js"(exports) {
12344
12333
  "use strict";
12345
12334
  Object.defineProperty(exports, "__esModule", {
12346
12335
  value: true
@@ -12370,9 +12359,9 @@ var require_toBlock = __commonJS({
12370
12359
  }
12371
12360
  });
12372
12361
 
12373
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/ensureBlock.js
12362
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/ensureBlock.js
12374
12363
  var require_ensureBlock = __commonJS({
12375
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/ensureBlock.js"(exports) {
12364
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/ensureBlock.js"(exports) {
12376
12365
  "use strict";
12377
12366
  Object.defineProperty(exports, "__esModule", {
12378
12367
  value: true
@@ -12387,9 +12376,9 @@ var require_ensureBlock = __commonJS({
12387
12376
  }
12388
12377
  });
12389
12378
 
12390
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toIdentifier.js
12379
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toIdentifier.js
12391
12380
  var require_toIdentifier = __commonJS({
12392
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toIdentifier.js"(exports) {
12381
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toIdentifier.js"(exports) {
12393
12382
  "use strict";
12394
12383
  Object.defineProperty(exports, "__esModule", {
12395
12384
  value: true
@@ -12415,9 +12404,9 @@ var require_toIdentifier = __commonJS({
12415
12404
  }
12416
12405
  });
12417
12406
 
12418
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
12407
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
12419
12408
  var require_toBindingIdentifierName = __commonJS({
12420
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js"(exports) {
12409
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js"(exports) {
12421
12410
  "use strict";
12422
12411
  Object.defineProperty(exports, "__esModule", {
12423
12412
  value: true
@@ -12432,9 +12421,9 @@ var require_toBindingIdentifierName = __commonJS({
12432
12421
  }
12433
12422
  });
12434
12423
 
12435
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toComputedKey.js
12424
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toComputedKey.js
12436
12425
  var require_toComputedKey = __commonJS({
12437
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toComputedKey.js"(exports) {
12426
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toComputedKey.js"(exports) {
12438
12427
  "use strict";
12439
12428
  Object.defineProperty(exports, "__esModule", {
12440
12429
  value: true
@@ -12449,9 +12438,9 @@ var require_toComputedKey = __commonJS({
12449
12438
  }
12450
12439
  });
12451
12440
 
12452
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toExpression.js
12441
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toExpression.js
12453
12442
  var require_toExpression = __commonJS({
12454
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toExpression.js"(exports) {
12443
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toExpression.js"(exports) {
12455
12444
  "use strict";
12456
12445
  Object.defineProperty(exports, "__esModule", {
12457
12446
  value: true
@@ -12480,9 +12469,9 @@ var require_toExpression = __commonJS({
12480
12469
  }
12481
12470
  });
12482
12471
 
12483
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/traverse/traverseFast.js
12472
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/traverse/traverseFast.js
12484
12473
  var require_traverseFast = __commonJS({
12485
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/traverse/traverseFast.js"(exports) {
12474
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/traverse/traverseFast.js"(exports) {
12486
12475
  "use strict";
12487
12476
  Object.defineProperty(exports, "__esModule", {
12488
12477
  value: true
@@ -12523,9 +12512,9 @@ var require_traverseFast = __commonJS({
12523
12512
  }
12524
12513
  });
12525
12514
 
12526
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/removeProperties.js
12515
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/removeProperties.js
12527
12516
  var require_removeProperties = __commonJS({
12528
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/removeProperties.js"(exports) {
12517
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/removeProperties.js"(exports) {
12529
12518
  "use strict";
12530
12519
  Object.defineProperty(exports, "__esModule", {
12531
12520
  value: true
@@ -12540,7 +12529,7 @@ var require_removeProperties = __commonJS({
12540
12529
  if (node[key] != null) node[key] = void 0;
12541
12530
  }
12542
12531
  for (const key of Object.keys(node)) {
12543
- if (key[0] === "_" && node[key] != null) node[key] = void 0;
12532
+ if (key.startsWith("_") && node[key] != null) node[key] = void 0;
12544
12533
  }
12545
12534
  const symbols = Object.getOwnPropertySymbols(node);
12546
12535
  for (const sym of symbols) {
@@ -12550,9 +12539,9 @@ var require_removeProperties = __commonJS({
12550
12539
  }
12551
12540
  });
12552
12541
 
12553
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js
12542
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js
12554
12543
  var require_removePropertiesDeep = __commonJS({
12555
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js"(exports) {
12544
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js"(exports) {
12556
12545
  "use strict";
12557
12546
  Object.defineProperty(exports, "__esModule", {
12558
12547
  value: true
@@ -12567,9 +12556,9 @@ var require_removePropertiesDeep = __commonJS({
12567
12556
  }
12568
12557
  });
12569
12558
 
12570
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toKeyAlias.js
12559
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toKeyAlias.js
12571
12560
  var require_toKeyAlias = __commonJS({
12572
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toKeyAlias.js"(exports) {
12561
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toKeyAlias.js"(exports) {
12573
12562
  "use strict";
12574
12563
  Object.defineProperty(exports, "__esModule", {
12575
12564
  value: true
@@ -12608,9 +12597,9 @@ var require_toKeyAlias = __commonJS({
12608
12597
  }
12609
12598
  });
12610
12599
 
12611
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toStatement.js
12600
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toStatement.js
12612
12601
  var require_toStatement = __commonJS({
12613
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toStatement.js"(exports) {
12602
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toStatement.js"(exports) {
12614
12603
  "use strict";
12615
12604
  Object.defineProperty(exports, "__esModule", {
12616
12605
  value: true
@@ -12650,9 +12639,9 @@ var require_toStatement = __commonJS({
12650
12639
  }
12651
12640
  });
12652
12641
 
12653
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/valueToNode.js
12642
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/valueToNode.js
12654
12643
  var require_valueToNode = __commonJS({
12655
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/valueToNode.js"(exports) {
12644
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/valueToNode.js"(exports) {
12656
12645
  "use strict";
12657
12646
  Object.defineProperty(exports, "__esModule", {
12658
12647
  value: true
@@ -12741,9 +12730,9 @@ var require_valueToNode = __commonJS({
12741
12730
  }
12742
12731
  });
12743
12732
 
12744
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js
12733
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js
12745
12734
  var require_appendToMemberExpression = __commonJS({
12746
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js"(exports) {
12735
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js"(exports) {
12747
12736
  "use strict";
12748
12737
  Object.defineProperty(exports, "__esModule", {
12749
12738
  value: true
@@ -12759,9 +12748,9 @@ var require_appendToMemberExpression = __commonJS({
12759
12748
  }
12760
12749
  });
12761
12750
 
12762
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/inherits.js
12751
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/inherits.js
12763
12752
  var require_inherits = __commonJS({
12764
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/inherits.js"(exports) {
12753
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/inherits.js"(exports) {
12765
12754
  "use strict";
12766
12755
  Object.defineProperty(exports, "__esModule", {
12767
12756
  value: true
@@ -12777,7 +12766,7 @@ var require_inherits = __commonJS({
12777
12766
  }
12778
12767
  }
12779
12768
  for (const key of Object.keys(parent)) {
12780
- if (key[0] === "_" && key !== "__clone") {
12769
+ if (key.startsWith("_") && key !== "__clone") {
12781
12770
  child[key] = parent[key];
12782
12771
  }
12783
12772
  }
@@ -12790,9 +12779,9 @@ var require_inherits = __commonJS({
12790
12779
  }
12791
12780
  });
12792
12781
 
12793
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js
12782
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js
12794
12783
  var require_prependToMemberExpression = __commonJS({
12795
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js"(exports) {
12784
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js"(exports) {
12796
12785
  "use strict";
12797
12786
  Object.defineProperty(exports, "__esModule", {
12798
12787
  value: true
@@ -12810,9 +12799,9 @@ var require_prependToMemberExpression = __commonJS({
12810
12799
  }
12811
12800
  });
12812
12801
 
12813
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js
12802
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js
12814
12803
  var require_getAssignmentIdentifiers = __commonJS({
12815
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js"(exports) {
12804
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js"(exports) {
12816
12805
  "use strict";
12817
12806
  Object.defineProperty(exports, "__esModule", {
12818
12807
  value: true
@@ -12861,9 +12850,9 @@ var require_getAssignmentIdentifiers = __commonJS({
12861
12850
  }
12862
12851
  });
12863
12852
 
12864
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js
12853
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js
12865
12854
  var require_getBindingIdentifiers = __commonJS({
12866
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js"(exports) {
12855
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js"(exports) {
12867
12856
  "use strict";
12868
12857
  Object.defineProperty(exports, "__esModule", {
12869
12858
  value: true
@@ -12966,9 +12955,9 @@ var require_getBindingIdentifiers = __commonJS({
12966
12955
  }
12967
12956
  });
12968
12957
 
12969
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js
12958
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js
12970
12959
  var require_getOuterBindingIdentifiers = __commonJS({
12971
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js"(exports) {
12960
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js"(exports) {
12972
12961
  "use strict";
12973
12962
  Object.defineProperty(exports, "__esModule", {
12974
12963
  value: true
@@ -12982,9 +12971,9 @@ var require_getOuterBindingIdentifiers = __commonJS({
12982
12971
  }
12983
12972
  });
12984
12973
 
12985
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getFunctionName.js
12974
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getFunctionName.js
12986
12975
  var require_getFunctionName = __commonJS({
12987
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getFunctionName.js"(exports) {
12976
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getFunctionName.js"(exports) {
12988
12977
  "use strict";
12989
12978
  Object.defineProperty(exports, "__esModule", {
12990
12979
  value: true
@@ -13049,9 +13038,9 @@ var require_getFunctionName = __commonJS({
13049
13038
  }
13050
13039
  });
13051
13040
 
13052
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/traverse/traverse.js
13041
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/traverse/traverse.js
13053
13042
  var require_traverse = __commonJS({
13054
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/traverse/traverse.js"(exports) {
13043
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/traverse/traverse.js"(exports) {
13055
13044
  "use strict";
13056
13045
  Object.defineProperty(exports, "__esModule", {
13057
13046
  value: true
@@ -13102,9 +13091,9 @@ var require_traverse = __commonJS({
13102
13091
  }
13103
13092
  });
13104
13093
 
13105
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isBinding.js
13094
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isBinding.js
13106
13095
  var require_isBinding = __commonJS({
13107
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isBinding.js"(exports) {
13096
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isBinding.js"(exports) {
13108
13097
  "use strict";
13109
13098
  Object.defineProperty(exports, "__esModule", {
13110
13099
  value: true
@@ -13132,30 +13121,25 @@ var require_isBinding = __commonJS({
13132
13121
  }
13133
13122
  });
13134
13123
 
13135
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isLet.js
13124
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isLet.js
13136
13125
  var require_isLet = __commonJS({
13137
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isLet.js"(exports) {
13126
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isLet.js"(exports) {
13138
13127
  "use strict";
13139
13128
  Object.defineProperty(exports, "__esModule", {
13140
13129
  value: true
13141
13130
  });
13142
13131
  exports.default = isLet;
13143
13132
  var _index = require_generated();
13144
- {
13145
- BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
13146
- }
13147
- var BLOCK_SCOPED_SYMBOL;
13133
+ var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
13148
13134
  function isLet(node) {
13149
- {
13150
- return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[BLOCK_SCOPED_SYMBOL]);
13151
- }
13135
+ return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[BLOCK_SCOPED_SYMBOL]);
13152
13136
  }
13153
13137
  }
13154
13138
  });
13155
13139
 
13156
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isBlockScoped.js
13140
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isBlockScoped.js
13157
13141
  var require_isBlockScoped = __commonJS({
13158
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isBlockScoped.js"(exports) {
13142
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isBlockScoped.js"(exports) {
13159
13143
  "use strict";
13160
13144
  Object.defineProperty(exports, "__esModule", {
13161
13145
  value: true
@@ -13169,9 +13153,9 @@ var require_isBlockScoped = __commonJS({
13169
13153
  }
13170
13154
  });
13171
13155
 
13172
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isImmutable.js
13156
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isImmutable.js
13173
13157
  var require_isImmutable = __commonJS({
13174
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isImmutable.js"(exports) {
13158
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isImmutable.js"(exports) {
13175
13159
  "use strict";
13176
13160
  Object.defineProperty(exports, "__esModule", {
13177
13161
  value: true
@@ -13193,9 +13177,9 @@ var require_isImmutable = __commonJS({
13193
13177
  }
13194
13178
  });
13195
13179
 
13196
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isNodesEquivalent.js
13180
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isNodesEquivalent.js
13197
13181
  var require_isNodesEquivalent = __commonJS({
13198
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isNodesEquivalent.js"(exports) {
13182
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isNodesEquivalent.js"(exports) {
13199
13183
  "use strict";
13200
13184
  Object.defineProperty(exports, "__esModule", {
13201
13185
  value: true
@@ -13253,9 +13237,9 @@ var require_isNodesEquivalent = __commonJS({
13253
13237
  }
13254
13238
  });
13255
13239
 
13256
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isReferenced.js
13240
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isReferenced.js
13257
13241
  var require_isReferenced = __commonJS({
13258
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isReferenced.js"(exports) {
13242
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isReferenced.js"(exports) {
13259
13243
  "use strict";
13260
13244
  Object.defineProperty(exports, "__esModule", {
13261
13245
  value: true
@@ -13288,7 +13272,7 @@ var require_isReferenced = __commonJS({
13288
13272
  if (parent.key === node) {
13289
13273
  return !!parent.computed;
13290
13274
  }
13291
- return !grandparent || grandparent.type !== "ObjectPattern";
13275
+ return (grandparent == null ? void 0 : grandparent.type) !== "ObjectPattern";
13292
13276
  case "ClassProperty":
13293
13277
  case "ClassAccessorProperty":
13294
13278
  if (parent.key === node) {
@@ -13352,9 +13336,9 @@ var require_isReferenced = __commonJS({
13352
13336
  }
13353
13337
  });
13354
13338
 
13355
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isScope.js
13339
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isScope.js
13356
13340
  var require_isScope = __commonJS({
13357
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isScope.js"(exports) {
13341
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isScope.js"(exports) {
13358
13342
  "use strict";
13359
13343
  Object.defineProperty(exports, "__esModule", {
13360
13344
  value: true
@@ -13373,9 +13357,9 @@ var require_isScope = __commonJS({
13373
13357
  }
13374
13358
  });
13375
13359
 
13376
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isSpecifierDefault.js
13360
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isSpecifierDefault.js
13377
13361
  var require_isSpecifierDefault = __commonJS({
13378
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isSpecifierDefault.js"(exports) {
13362
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isSpecifierDefault.js"(exports) {
13379
13363
  "use strict";
13380
13364
  Object.defineProperty(exports, "__esModule", {
13381
13365
  value: true
@@ -13390,9 +13374,9 @@ var require_isSpecifierDefault = __commonJS({
13390
13374
  }
13391
13375
  });
13392
13376
 
13393
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isValidES3Identifier.js
13377
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isValidES3Identifier.js
13394
13378
  var require_isValidES3Identifier = __commonJS({
13395
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isValidES3Identifier.js"(exports) {
13379
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isValidES3Identifier.js"(exports) {
13396
13380
  "use strict";
13397
13381
  Object.defineProperty(exports, "__esModule", {
13398
13382
  value: true
@@ -13406,32 +13390,27 @@ var require_isValidES3Identifier = __commonJS({
13406
13390
  }
13407
13391
  });
13408
13392
 
13409
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isVar.js
13393
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isVar.js
13410
13394
  var require_isVar = __commonJS({
13411
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isVar.js"(exports) {
13395
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isVar.js"(exports) {
13412
13396
  "use strict";
13413
13397
  Object.defineProperty(exports, "__esModule", {
13414
13398
  value: true
13415
13399
  });
13416
13400
  exports.default = isVar;
13417
13401
  var _index = require_generated();
13418
- {
13419
- BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
13420
- }
13421
- var BLOCK_SCOPED_SYMBOL;
13402
+ var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
13422
13403
  function isVar(node) {
13423
- {
13424
- return (0, _index.isVariableDeclaration)(node, {
13425
- kind: "var"
13426
- }) && !node[BLOCK_SCOPED_SYMBOL];
13427
- }
13404
+ return (0, _index.isVariableDeclaration)(node, {
13405
+ kind: "var"
13406
+ }) && !node[BLOCK_SCOPED_SYMBOL];
13428
13407
  }
13429
13408
  }
13430
13409
  });
13431
13410
 
13432
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
13411
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
13433
13412
  var require_gatherSequenceExpressions = __commonJS({
13434
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js"(exports) {
13413
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js"(exports) {
13435
13414
  "use strict";
13436
13415
  Object.defineProperty(exports, "__esModule", {
13437
13416
  value: true
@@ -13497,9 +13476,9 @@ var require_gatherSequenceExpressions = __commonJS({
13497
13476
  }
13498
13477
  });
13499
13478
 
13500
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toSequenceExpression.js
13479
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toSequenceExpression.js
13501
13480
  var require_toSequenceExpression = __commonJS({
13502
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toSequenceExpression.js"(exports) {
13481
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toSequenceExpression.js"(exports) {
13503
13482
  "use strict";
13504
13483
  Object.defineProperty(exports, "__esModule", {
13505
13484
  value: true
@@ -13519,9 +13498,9 @@ var require_toSequenceExpression = __commonJS({
13519
13498
  }
13520
13499
  });
13521
13500
 
13522
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/index.js
13501
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/index.js
13523
13502
  var require_lib3 = __commonJS({
13524
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/index.js"(exports) {
13503
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/index.js"(exports) {
13525
13504
  "use strict";
13526
13505
  Object.defineProperty(exports, "__esModule", {
13527
13506
  value: true
@@ -14097,9 +14076,7 @@ var require_lib3 = __commonJS({
14097
14076
  isCompatTag: _isCompatTag.default,
14098
14077
  buildChildren: _buildChildren.default
14099
14078
  };
14100
- {
14101
- exports.toSequenceExpression = _toSequenceExpression.default;
14102
- }
14079
+ exports.toSequenceExpression = _toSequenceExpression.default;
14103
14080
  if (process.env.BABEL_TYPES_8_BREAKING) {
14104
14081
  console.warn("BABEL_TYPES_8_BREAKING is not supported anymore. Use the latest Babel 8.0.0 pre-release instead!");
14105
14082
  }
@@ -14152,6 +14129,7 @@ var RUNTIME_HELPERS = {
14152
14129
  propsRest: "__fictPropsRest",
14153
14130
  mergeProps: "mergeProps",
14154
14131
  prop: "prop",
14132
+ keyed: "keyed",
14155
14133
  runInScope: "runInScope",
14156
14134
  createElement: "createElement",
14157
14135
  conditional: "createConditional",
@@ -14186,6 +14164,7 @@ var RUNTIME_ALIASES = {
14186
14164
  propGetter: "__fictProp",
14187
14165
  propsRest: "__fictPropsRest",
14188
14166
  prop: "prop",
14167
+ keyed: "keyed",
14189
14168
  mergeProps: "mergeProps",
14190
14169
  runInScope: "runInScope",
14191
14170
  createElement: "createElement",
@@ -14308,6 +14287,7 @@ function debugWarn(flag, message, data) {
14308
14287
  var t = __toESM(require_lib3(), 1);
14309
14288
  import { transformFromAstSync } from "@babel/core";
14310
14289
  import transformDestructuring from "@babel/plugin-transform-destructuring";
14290
+ import traverseModule from "@babel/traverse";
14311
14291
 
14312
14292
  // src/ir/hir.ts
14313
14293
  var HIRError = class extends Error {
@@ -14393,9 +14373,9 @@ function extractDependencyPath(expr) {
14393
14373
  }
14394
14374
  return void 0;
14395
14375
  }
14396
- function pathToString(path) {
14397
- let result = path.base;
14398
- for (const seg of path.segments) {
14376
+ function pathToString(path2) {
14377
+ let result = path2.base;
14378
+ for (const seg of path2.segments) {
14399
14379
  if (seg.optional) {
14400
14380
  result += "?.";
14401
14381
  } else {
@@ -14420,42 +14400,56 @@ var resolveDestructuringPlugin = () => {
14420
14400
  const mod = transformDestructuring;
14421
14401
  return mod?.default ?? mod;
14422
14402
  };
14423
- var createAssignmentDestructuringPlugin = () => {
14424
- const pluginFactory = resolveDestructuringPlugin();
14425
- if (typeof pluginFactory !== "function") {
14426
- throw new Error("Expected @babel/plugin-transform-destructuring to export a function");
14427
- }
14428
- const plugin = pluginFactory(
14429
- {
14430
- assertVersion() {
14431
- },
14432
- assumption() {
14433
- return void 0;
14434
- },
14435
- types: t
14436
- },
14437
- {}
14438
- );
14439
- return {
14440
- visitor: {
14441
- AssignmentExpression(path, state) {
14442
- if (!t.isObjectPattern(path.node.left) && !t.isArrayPattern(path.node.left)) return;
14443
- const visitor = plugin.visitor?.AssignmentExpression;
14444
- if (!visitor) return;
14445
- visitor.call(this, path, state);
14403
+ var resolveTraverse = () => {
14404
+ const mod = traverseModule;
14405
+ return mod?.default ?? mod;
14406
+ };
14407
+ var OBJECT_REST_HELPERS = /* @__PURE__ */ new Set(["_objectWithoutProperties", "_objectWithoutPropertiesLoose"]);
14408
+ var OBJECT_DESTRUCTURING_EMPTY_HELPER = "_objectDestructuringEmpty";
14409
+ var EXTENDS_HELPER = "_extends";
14410
+ var isSameIdentifier = (left, right) => {
14411
+ return t.isIdentifier(left) && t.isIdentifier(right) && left.name === right.name;
14412
+ };
14413
+ var rewriteObjectRestHelpers = (ast) => {
14414
+ const traverse = resolveTraverse();
14415
+ traverse(ast, {
14416
+ CallExpression(path2) {
14417
+ const { callee, arguments: args } = path2.node;
14418
+ if (t.isIdentifier(callee) && OBJECT_REST_HELPERS.has(callee.name)) {
14419
+ path2.node.callee = t.identifier("__fictPropsRest");
14420
+ return;
14421
+ }
14422
+ if (t.isIdentifier(callee) && callee.name === EXTENDS_HELPER && args.length === 2 && t.isObjectExpression(args[0]) && args[0].properties.length === 0 && t.isSequenceExpression(args[1]) && args[1].expressions.length === 2) {
14423
+ const [checkExpr, sourceExpr] = args[1].expressions;
14424
+ if (t.isCallExpression(checkExpr) && t.isIdentifier(checkExpr.callee) && checkExpr.callee.name === OBJECT_DESTRUCTURING_EMPTY_HELPER && checkExpr.arguments.length === 1) {
14425
+ const [checkArg] = checkExpr.arguments;
14426
+ if (checkArg && isSameIdentifier(checkArg, sourceExpr)) {
14427
+ const restCall = t.callExpression(t.identifier("__fictPropsRest"), [
14428
+ t.cloneNode(sourceExpr, true),
14429
+ t.arrayExpression([])
14430
+ ]);
14431
+ path2.replaceWith(t.sequenceExpression([checkExpr, restCall]));
14432
+ }
14433
+ }
14446
14434
  }
14447
14435
  }
14448
- };
14436
+ });
14449
14437
  };
14450
14438
  var expandDestructuringAssignments = (ast) => {
14439
+ const pluginFactory = resolveDestructuringPlugin();
14440
+ if (typeof pluginFactory !== "function") {
14441
+ throw new Error("Expected @babel/plugin-transform-destructuring to export a function");
14442
+ }
14451
14443
  const result = transformFromAstSync(ast, void 0, {
14452
14444
  configFile: false,
14453
14445
  babelrc: false,
14454
14446
  ast: true,
14455
14447
  code: false,
14456
- plugins: [createAssignmentDestructuringPlugin()]
14448
+ plugins: [pluginFactory]
14457
14449
  });
14458
- return result?.ast ?? ast;
14450
+ const expanded = result?.ast ?? ast;
14451
+ rewriteObjectRestHelpers(expanded);
14452
+ return expanded;
14459
14453
  };
14460
14454
  var reportUnsupportedExpression = (node, overrideMessage) => {
14461
14455
  const loc = getLoc(node);
@@ -15283,8 +15277,18 @@ function convertFunction(name, params, body, options) {
15283
15277
  loc: options?.loc ?? null
15284
15278
  };
15285
15279
  }
15286
- function convertStatementsToHIRFunction(name, statements) {
15287
- return convertFunction(name, [], statements, { loc: getLoc(statements[0]) });
15280
+ function convertStatementsToHIRFunction(name, statements, options) {
15281
+ const prevOptions = activeBuildOptions;
15282
+ if (options) {
15283
+ activeBuildOptions = options;
15284
+ }
15285
+ try {
15286
+ return convertFunction(name, [], statements, { loc: getLoc(statements[0]) });
15287
+ } finally {
15288
+ if (options) {
15289
+ activeBuildOptions = prevOptions;
15290
+ }
15291
+ }
15288
15292
  }
15289
15293
  function convertAssignmentValue(expr) {
15290
15294
  const right = convertExpression(expr.right);
@@ -15802,9 +15806,9 @@ function processStatement(stmt, bb, jumpTarget, ctx) {
15802
15806
  }
15803
15807
  return bb;
15804
15808
  }
15805
- function convertExpression(node) {
15809
+ function convertExpression(node, options) {
15806
15810
  const loc = getLoc(node);
15807
- const convertCallArguments = (args) => args.map((arg) => {
15811
+ const convertCallArguments = (args, reactiveScope) => args.map((arg) => {
15808
15812
  if (t.isSpreadElement(arg)) {
15809
15813
  return {
15810
15814
  kind: "SpreadElement",
@@ -15812,9 +15816,25 @@ function convertExpression(node) {
15812
15816
  loc: getLoc(arg)
15813
15817
  };
15814
15818
  }
15815
- if (t.isExpression(arg)) return convertExpression(arg);
15819
+ if (t.isExpression(arg)) {
15820
+ if (reactiveScope && arg === args[0] && (t.isArrowFunctionExpression(arg) || t.isFunctionExpression(arg))) {
15821
+ return convertExpression(arg, { reactiveScope });
15822
+ }
15823
+ return convertExpression(arg);
15824
+ }
15816
15825
  return void 0;
15817
15826
  }).filter(Boolean);
15827
+ const resolveReactiveScope = (callee) => {
15828
+ const reactiveScopes = activeBuildOptions?.reactiveScopes;
15829
+ if (!reactiveScopes || reactiveScopes.size === 0) return void 0;
15830
+ if (t.isIdentifier(callee)) {
15831
+ return reactiveScopes.has(callee.name) ? callee.name : void 0;
15832
+ }
15833
+ if ((t.isMemberExpression(callee) || t.isOptionalMemberExpression(callee)) && !callee.computed && t.isIdentifier(callee.property)) {
15834
+ return reactiveScopes.has(callee.property.name) ? callee.property.name : void 0;
15835
+ }
15836
+ return void 0;
15837
+ };
15818
15838
  if (t.isParenthesizedExpression(node) && t.isExpression(node.expression)) {
15819
15839
  return convertExpression(node.expression);
15820
15840
  }
@@ -15861,10 +15881,11 @@ function convertExpression(node) {
15861
15881
  if (t.isCallExpression(node)) {
15862
15882
  const callee = normalizeMacroCallee(node.callee);
15863
15883
  const pure = hasPureAnnotation(node) || hasPureAnnotation(node.callee);
15884
+ const reactiveScope = resolveReactiveScope(node.callee);
15864
15885
  const call = {
15865
15886
  kind: "CallExpression",
15866
15887
  callee: convertExpression(callee),
15867
- arguments: convertCallArguments(node.arguments),
15888
+ arguments: convertCallArguments(node.arguments, reactiveScope),
15868
15889
  ...pure ? { pure: true } : null,
15869
15890
  loc
15870
15891
  };
@@ -16074,6 +16095,7 @@ function convertExpression(node) {
16074
16095
  body: nested.blocks,
16075
16096
  isExpression: false,
16076
16097
  isAsync: node.async,
16098
+ reactiveScope: options?.reactiveScope,
16077
16099
  loc
16078
16100
  };
16079
16101
  return arrow;
@@ -16086,6 +16108,7 @@ function convertExpression(node) {
16086
16108
  body: convertExpression(node.body),
16087
16109
  isExpression: true,
16088
16110
  isAsync: node.async,
16111
+ reactiveScope: options?.reactiveScope,
16089
16112
  loc
16090
16113
  };
16091
16114
  return arrow;
@@ -16105,6 +16128,7 @@ function convertExpression(node) {
16105
16128
  params: nested.params,
16106
16129
  body: nested.blocks,
16107
16130
  isAsync: node.async,
16131
+ reactiveScope: options?.reactiveScope,
16108
16132
  loc
16109
16133
  };
16110
16134
  return fn;
@@ -16175,10 +16199,11 @@ function convertExpression(node) {
16175
16199
  }
16176
16200
  if (t.isOptionalCallExpression(node)) {
16177
16201
  const callee = normalizeMacroCallee(node.callee);
16202
+ const reactiveScope = resolveReactiveScope(node.callee);
16178
16203
  return {
16179
16204
  kind: "OptionalCallExpression",
16180
16205
  callee: convertExpression(callee),
16181
- arguments: convertCallArguments(node.arguments),
16206
+ arguments: convertCallArguments(node.arguments, reactiveScope),
16182
16207
  optional: node.optional,
16183
16208
  ...hasPureAnnotation(node) || hasPureAnnotation(node.callee) ? { pure: true } : null,
16184
16209
  loc
@@ -16365,6 +16390,152 @@ function shouldMemoizeRegion(region) {
16365
16390
  return false;
16366
16391
  }
16367
16392
 
16393
+ // src/module-metadata.ts
16394
+ import { existsSync, readFileSync, statSync, writeFileSync } from "fs";
16395
+ import path from "path";
16396
+ import { fileURLToPath } from "url";
16397
+ var globalMetadata = /* @__PURE__ */ new Map();
16398
+ var MODULE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
16399
+ var DEFAULT_META_EXTENSION = ".fict.meta.json";
16400
+ function normalizeFileName(fileName) {
16401
+ let normalized = fileName;
16402
+ const queryStart = normalized.indexOf("?");
16403
+ if (queryStart !== -1) {
16404
+ normalized = normalized.slice(0, queryStart);
16405
+ }
16406
+ if (normalized.startsWith("/@fs/")) {
16407
+ normalized = normalized.slice("/@fs/".length);
16408
+ }
16409
+ if (normalized.startsWith("file://")) {
16410
+ try {
16411
+ normalized = fileURLToPath(normalized);
16412
+ } catch {
16413
+ }
16414
+ }
16415
+ return path.resolve(normalized);
16416
+ }
16417
+ function getMetadataStore(options) {
16418
+ return options?.moduleMetadata ?? globalMetadata;
16419
+ }
16420
+ function getMetadataExtension(options) {
16421
+ return options?.moduleMetadataExtension ?? DEFAULT_META_EXTENSION;
16422
+ }
16423
+ function getMetadataFilePath(fileName, options) {
16424
+ return `${normalizeFileName(fileName)}${getMetadataExtension(options)}`;
16425
+ }
16426
+ function shouldEmitModuleMetadata(options) {
16427
+ const opt = options?.emitModuleMetadata;
16428
+ if (opt === true) return true;
16429
+ if (opt === false) return false;
16430
+ if (options?.moduleMetadata || options?.resolveModuleMetadata) return false;
16431
+ return true;
16432
+ }
16433
+ function readMetadataFromDisk(fileName, store, options) {
16434
+ const metaPath = getMetadataFilePath(fileName, options);
16435
+ if (!existsSync(metaPath)) return void 0;
16436
+ try {
16437
+ const raw = readFileSync(metaPath, "utf8");
16438
+ const parsed = JSON.parse(raw);
16439
+ store.set(normalizeFileName(fileName), parsed);
16440
+ return parsed;
16441
+ } catch {
16442
+ return void 0;
16443
+ }
16444
+ }
16445
+ function isFile(pathName) {
16446
+ try {
16447
+ return statSync(pathName).isFile();
16448
+ } catch {
16449
+ return false;
16450
+ }
16451
+ }
16452
+ function resolveImportSource(source, importer, store) {
16453
+ if (!importer) return void 0;
16454
+ const isAbsolute = path.isAbsolute(source);
16455
+ if (!isAbsolute && !source.startsWith(".")) return void 0;
16456
+ const base = isAbsolute ? source : path.resolve(path.dirname(importer), source);
16457
+ const normalized = normalizeFileName(base);
16458
+ if (store.has(normalized)) return normalized;
16459
+ if (existsSync(normalized) && isFile(normalized)) return normalized;
16460
+ const ext = path.extname(normalized);
16461
+ if (!ext) {
16462
+ for (const suffix of MODULE_EXTENSIONS) {
16463
+ const candidate = `${normalized}${suffix}`;
16464
+ if (store.has(candidate)) return candidate;
16465
+ if (existsSync(candidate) && isFile(candidate)) return candidate;
16466
+ }
16467
+ }
16468
+ for (const suffix of MODULE_EXTENSIONS) {
16469
+ const candidate = path.join(normalized, `index${suffix}`);
16470
+ if (store.has(candidate)) return candidate;
16471
+ if (existsSync(candidate) && isFile(candidate)) return candidate;
16472
+ }
16473
+ return void 0;
16474
+ }
16475
+ function resolveImportSourceByMetadata(source, importer, options) {
16476
+ if (!importer) return void 0;
16477
+ const isAbsolute = path.isAbsolute(source);
16478
+ if (!isAbsolute && !source.startsWith(".")) return void 0;
16479
+ const base = isAbsolute ? source : path.resolve(path.dirname(importer), source);
16480
+ const normalized = normalizeFileName(base);
16481
+ const metaExt = getMetadataExtension(options);
16482
+ const candidates = [];
16483
+ const ext = path.extname(normalized);
16484
+ if (ext) {
16485
+ candidates.push(normalized);
16486
+ } else {
16487
+ for (const suffix of MODULE_EXTENSIONS) {
16488
+ candidates.push(`${normalized}${suffix}`);
16489
+ }
16490
+ }
16491
+ for (const suffix of MODULE_EXTENSIONS) {
16492
+ candidates.push(path.join(normalized, `index${suffix}`));
16493
+ }
16494
+ for (const candidate of candidates) {
16495
+ if (existsSync(`${candidate}${metaExt}`)) {
16496
+ return candidate;
16497
+ }
16498
+ }
16499
+ return void 0;
16500
+ }
16501
+ function resolveModuleMetadata(source, importer, options) {
16502
+ if (options?.resolveModuleMetadata) {
16503
+ const resolved = options.resolveModuleMetadata(source, importer);
16504
+ if (resolved) return resolved;
16505
+ }
16506
+ const store = getMetadataStore(options);
16507
+ let resolvedKey = resolveImportSource(source, importer, store);
16508
+ if (!resolvedKey) {
16509
+ resolvedKey = resolveImportSourceByMetadata(source, importer, options);
16510
+ }
16511
+ if (resolvedKey) {
16512
+ const existing = store.get(resolvedKey);
16513
+ if (existing) return existing;
16514
+ const loaded2 = readMetadataFromDisk(resolvedKey, store, options);
16515
+ if (loaded2) return loaded2;
16516
+ }
16517
+ if (store.has(source)) return store.get(source);
16518
+ const loaded = readMetadataFromDisk(source, store, options);
16519
+ if (loaded) return loaded;
16520
+ return void 0;
16521
+ }
16522
+ function setModuleMetadata(fileName, metadata, options) {
16523
+ if (!fileName) return;
16524
+ const store = getMetadataStore(options);
16525
+ const normalized = normalizeFileName(fileName);
16526
+ store.set(normalized, metadata);
16527
+ if (!shouldEmitModuleMetadata(options)) return;
16528
+ try {
16529
+ const metaPath = getMetadataFilePath(normalized, options);
16530
+ writeFileSync(metaPath, JSON.stringify(metadata), "utf8");
16531
+ } catch {
16532
+ }
16533
+ }
16534
+ function clearModuleMetadata(options) {
16535
+ const store = getMetadataStore(options);
16536
+ store.clear();
16537
+ }
16538
+
16368
16539
  // src/validation.ts
16369
16540
  var DiagnosticMessages = {
16370
16541
  ["FICT-P001" /* FICT_P001 */]: "Props destructuring falls back to non-reactive binding.",
@@ -16523,7 +16694,9 @@ function buildPropsPlan(attributes, children, ctx, helpers) {
16523
16694
  return false;
16524
16695
  };
16525
16696
  const isRuntimeMergeProps = () => !ctx.shadowedNames?.has(RUNTIME_ALIASES.mergeProps) && !ctx.localDeclaredNames?.has(RUNTIME_ALIASES.mergeProps) && (!ctx.moduleDeclaredNames?.has(RUNTIME_ALIASES.mergeProps) || (ctx.moduleRuntimeNames?.has(RUNTIME_ALIASES.mergeProps) ?? false));
16697
+ const isRuntimeKeyed = () => !ctx.shadowedNames?.has(RUNTIME_ALIASES.keyed) && !ctx.localDeclaredNames?.has(RUNTIME_ALIASES.keyed) && (!ctx.moduleDeclaredNames?.has(RUNTIME_ALIASES.keyed) || (ctx.moduleRuntimeNames?.has(RUNTIME_ALIASES.keyed) ?? false));
16526
16698
  const isMergePropsCall = (expr) => expr.kind === "CallExpression" && expr.callee.kind === "Identifier" && expr.callee.name === RUNTIME_ALIASES.mergeProps && isRuntimeMergeProps();
16699
+ const isKeyedCall = (expr) => expr.kind === "CallExpression" && expr.callee.kind === "Identifier" && expr.callee.name === RUNTIME_ALIASES.keyed && isRuntimeKeyed();
16527
16700
  const isDynamicMemberSpread = (expr) => {
16528
16701
  if (expr.kind !== "MemberExpression" && expr.kind !== "OptionalMemberExpression") return false;
16529
16702
  if (expr.computed) return true;
@@ -16557,6 +16730,31 @@ function buildPropsPlan(attributes, children, ctx, helpers) {
16557
16730
  }
16558
16731
  return false;
16559
16732
  };
16733
+ const getBaseIdentifier2 = (expr) => {
16734
+ if (expr.kind === "Identifier") return expr.name;
16735
+ if (expr.kind === "MemberExpression" || expr.kind === "OptionalMemberExpression") {
16736
+ return getBaseIdentifier2(expr.object);
16737
+ }
16738
+ return null;
16739
+ };
16740
+ const isDynamicStoreMember = (expr) => {
16741
+ if (expr.kind !== "MemberExpression" && expr.kind !== "OptionalMemberExpression") return false;
16742
+ if (!expr.computed) return false;
16743
+ if (expr.property.kind === "Literal" && (typeof expr.property.value === "string" || typeof expr.property.value === "number")) {
16744
+ return false;
16745
+ }
16746
+ const base = getBaseIdentifier2(expr.object);
16747
+ if (!base) return false;
16748
+ return ctx.storeVars?.has(helpers.deSSAVarName(base)) ?? false;
16749
+ };
16750
+ const getKeyedCandidate = (expr) => {
16751
+ if (expr.kind !== "MemberExpression") return null;
16752
+ if (!expr.computed || expr.optional) return null;
16753
+ if (expr.property.kind === "Literal" && (typeof expr.property.value === "string" || typeof expr.property.value === "number")) {
16754
+ return null;
16755
+ }
16756
+ return { base: expr.object, key: expr.property };
16757
+ };
16560
16758
  const flushBucket = () => {
16561
16759
  if (bucket.length === 0) return;
16562
16760
  segments.push({ kind: "object", properties: bucket });
@@ -16619,22 +16817,35 @@ function buildPropsPlan(attributes, children, ctx, helpers) {
16619
16817
  ctx.inPropsContext = prevPropsCtx;
16620
16818
  }
16621
16819
  const baseIdent = attr.value.kind === "Identifier" ? helpers.deSSAVarName(attr.value.name) : void 0;
16820
+ const keyedCandidate = getKeyedCandidate(attr.value);
16821
+ const keyedBaseIdent = keyedCandidate && keyedCandidate.base.kind === "Identifier" ? helpers.deSSAVarName(keyedCandidate.base.name) : void 0;
16622
16822
  const isAccessorBase = baseIdent && ((ctx.memoVars?.has(baseIdent) ?? false) || (ctx.signalVars?.has(baseIdent) ?? false) || (ctx.aliasVars?.has(baseIdent) ?? false));
16623
16823
  const isStoreBase = baseIdent ? ctx.storeVars?.has(baseIdent) ?? false : false;
16624
- const alreadyGetter = isFunctionLike || (baseIdent ? isStoreBase || (ctx.memoVars?.has(baseIdent) ?? false) || (ctx.aliasVars?.has(baseIdent) ?? false) : false);
16824
+ const alreadyGetter = isFunctionLike || isKeyedCall(attr.value) || (baseIdent ? isStoreBase || (ctx.memoVars?.has(baseIdent) ?? false) || (ctx.aliasVars?.has(baseIdent) ?? false) : false);
16625
16825
  const usesTracked = (!ctx.nonReactiveScopeDepth || ctx.nonReactiveScopeDepth === 0) && helpers.expressionUsesTracked(attr.value, ctx) && !alreadyGetter;
16626
16826
  const trackedExpr = usesTracked ? helpers.lowerTrackedExpression(
16627
16827
  attr.value,
16628
16828
  ctx
16629
16829
  ) : null;
16630
16830
  const useMemoProp = usesTracked && trackedExpr && t4.isExpression(trackedExpr) && !t4.isIdentifier(trackedExpr) && !t4.isMemberExpression(trackedExpr) && !t4.isLiteral(trackedExpr);
16831
+ const forceMemoProp = usesTracked && isDynamicStoreMember(attr.value);
16832
+ const shouldMemoProp = useMemoProp || forceMemoProp;
16833
+ const canKeyed = usesTracked && keyedCandidate && keyedBaseIdent && !(ctx.signalVars?.has(keyedBaseIdent) ?? false) && !(ctx.memoVars?.has(keyedBaseIdent) ?? false) && !(ctx.aliasVars?.has(keyedBaseIdent) ?? false) && !(ctx.functionVars?.has(keyedBaseIdent) ?? false);
16631
16834
  const valueExpr = !isFunctionLike && isAccessorBase && baseIdent ? (() => {
16632
16835
  ctx.helpersUsed.add("propGetter");
16633
16836
  return t4.callExpression(t4.identifier(RUNTIME_ALIASES.propGetter), [
16634
16837
  t4.arrowFunctionExpression([], t4.callExpression(t4.identifier(baseIdent), []))
16635
16838
  ]);
16636
16839
  })() : usesTracked && t4.isExpression(lowered) ? (() => {
16637
- if (useMemoProp) {
16840
+ if (canKeyed && keyedCandidate) {
16841
+ ctx.helpersUsed.add("keyed");
16842
+ const keyExpr = helpers.lowerDomExpression(keyedCandidate.key, ctx);
16843
+ return t4.callExpression(t4.identifier(RUNTIME_ALIASES.keyed), [
16844
+ t4.identifier(keyedBaseIdent),
16845
+ t4.arrowFunctionExpression([], keyExpr)
16846
+ ]);
16847
+ }
16848
+ if (shouldMemoProp) {
16638
16849
  ctx.helpersUsed.add("prop");
16639
16850
  return t4.callExpression(t4.identifier(RUNTIME_ALIASES.prop), [
16640
16851
  t4.arrowFunctionExpression([], trackedExpr ?? lowered)
@@ -16827,7 +17038,13 @@ function rewriteExprWithMap(expr, rewrites) {
16827
17038
  return {
16828
17039
  ...expr,
16829
17040
  object: rewriteExprWithMap(expr.object, rewrites),
16830
- property: rewriteExprWithMap(expr.property, rewrites)
17041
+ property: expr.computed ? rewriteExprWithMap(expr.property, rewrites) : expr.property
17042
+ };
17043
+ case "OptionalMemberExpression":
17044
+ return {
17045
+ ...expr,
17046
+ object: rewriteExprWithMap(expr.object, rewrites),
17047
+ property: expr.computed ? rewriteExprWithMap(expr.property, rewrites) : expr.property
16831
17048
  };
16832
17049
  case "BinaryExpression":
16833
17050
  case "LogicalExpression":
@@ -16850,11 +17067,12 @@ function rewriteExprWithMap(expr, rewrites) {
16850
17067
  case "ObjectExpression":
16851
17068
  return {
16852
17069
  ...expr,
16853
- properties: expr.properties.map((p) => ({
16854
- ...p,
16855
- key: rewriteExprWithMap(p.key, rewrites),
16856
- value: rewriteExprWithMap(p.value, rewrites)
16857
- }))
17070
+ properties: expr.properties.map((p) => {
17071
+ if (p.kind === "SpreadElement") {
17072
+ return { ...p, argument: rewriteExprWithMap(p.argument, rewrites) };
17073
+ }
17074
+ return { ...p, value: rewriteExprWithMap(p.value, rewrites) };
17075
+ })
16858
17076
  };
16859
17077
  case "ImportExpression":
16860
17078
  return {
@@ -16968,7 +17186,17 @@ function toSSA(fn) {
16968
17186
  arguments: expr.arguments.map((a) => renameExpr(a))
16969
17187
  };
16970
17188
  case "MemberExpression":
16971
- return { ...expr, object: renameExpr(expr.object), property: renameExpr(expr.property) };
17189
+ return {
17190
+ ...expr,
17191
+ object: renameExpr(expr.object),
17192
+ property: expr.computed ? renameExpr(expr.property) : expr.property
17193
+ };
17194
+ case "OptionalMemberExpression":
17195
+ return {
17196
+ ...expr,
17197
+ object: renameExpr(expr.object),
17198
+ property: expr.computed ? renameExpr(expr.property) : expr.property
17199
+ };
16972
17200
  case "BinaryExpression":
16973
17201
  case "LogicalExpression":
16974
17202
  return { ...expr, left: renameExpr(expr.left), right: renameExpr(expr.right) };
@@ -16986,11 +17214,12 @@ function toSSA(fn) {
16986
17214
  case "ObjectExpression":
16987
17215
  return {
16988
17216
  ...expr,
16989
- properties: expr.properties.map((p) => ({
16990
- ...p,
16991
- key: renameExpr(p.key),
16992
- value: renameExpr(p.value)
16993
- }))
17217
+ properties: expr.properties.map((p) => {
17218
+ if (p.kind === "SpreadElement") {
17219
+ return { ...p, argument: renameExpr(p.argument) };
17220
+ }
17221
+ return { ...p, value: renameExpr(p.value) };
17222
+ })
16994
17223
  };
16995
17224
  default:
16996
17225
  return expr;
@@ -17485,8 +17714,8 @@ function mergeOverlappingScopes(scopes, _byName) {
17485
17714
  scope.blocks.forEach((b) => merged.blocks.add(b));
17486
17715
  scope.dependencies.forEach((d) => merged.dependencies.add(d));
17487
17716
  for (const [base, paths] of scope.dependencyPaths) {
17488
- for (const path of paths) {
17489
- addPath(merged.dependencyPaths, base, path);
17717
+ for (const path2 of paths) {
17718
+ addPath(merged.dependencyPaths, base, path2);
17490
17719
  }
17491
17720
  }
17492
17721
  merged.hasExternalEffect = merged.hasExternalEffect || scope.hasExternalEffect;
@@ -17580,12 +17809,12 @@ function collectExprReads(expr, into, paths, bound = /* @__PURE__ */ new Set(),
17580
17809
  if (bound.has(baseName(expr.name))) return;
17581
17810
  into.add(expr.name);
17582
17811
  if (paths) {
17583
- const path = {
17812
+ const path2 = {
17584
17813
  base: expr.name,
17585
17814
  segments: [],
17586
17815
  hasOptional: false
17587
17816
  };
17588
- addPath(paths, expr.name, path);
17817
+ addPath(paths, expr.name, path2);
17589
17818
  }
17590
17819
  return;
17591
17820
  case "CallExpression": {
@@ -17741,11 +17970,11 @@ function collectExprReads(expr, into, paths, bound = /* @__PURE__ */ new Set(),
17741
17970
  return;
17742
17971
  }
17743
17972
  }
17744
- function addPath(paths, base, path) {
17973
+ function addPath(paths, base, path2) {
17745
17974
  const existing = paths.get(base) ?? [];
17746
- const pathStr = pathToString(path);
17975
+ const pathStr = pathToString(path2);
17747
17976
  if (!existing.some((p) => pathToString(p) === pathStr)) {
17748
- existing.push(path);
17977
+ existing.push(path2);
17749
17978
  paths.set(base, existing);
17750
17979
  }
17751
17980
  }
@@ -17764,11 +17993,11 @@ function analyzeOptionalChainDependencies(scope) {
17764
17993
  } else {
17765
17994
  let hasRequiredPath = false;
17766
17995
  let hasOptionalOnlyPath = false;
17767
- for (const path of paths) {
17768
- if (!path.hasOptional) {
17996
+ for (const path2 of paths) {
17997
+ if (!path2.hasOptional) {
17769
17998
  hasRequiredPath = true;
17770
17999
  } else {
17771
- const firstOptionalIndex = path.segments.findIndex((s) => s.optional);
18000
+ const firstOptionalIndex = path2.segments.findIndex((s) => s.optional);
17772
18001
  if (firstOptionalIndex === 0) {
17773
18002
  hasOptionalOnlyPath = true;
17774
18003
  } else if (firstOptionalIndex > 0) {
@@ -18518,13 +18747,34 @@ function createPropsShape() {
18518
18747
  source: { kind: "props" }
18519
18748
  };
18520
18749
  }
18750
+ function createStoreShape(name) {
18751
+ return {
18752
+ knownKeys: /* @__PURE__ */ new Set(),
18753
+ mutableKeys: /* @__PURE__ */ new Set(),
18754
+ dynamicAccess: false,
18755
+ escapes: false,
18756
+ isSpread: false,
18757
+ source: { kind: "store", name }
18758
+ };
18759
+ }
18521
18760
  function cloneKeyContext(ctx) {
18522
- return new Map(ctx);
18761
+ const cloneMap = (map) => {
18762
+ const next = /* @__PURE__ */ new Map();
18763
+ for (const [key, value] of map.entries()) {
18764
+ next.set(key, new Set(value));
18765
+ }
18766
+ return next;
18767
+ };
18768
+ return {
18769
+ values: cloneMap(ctx.values),
18770
+ keySets: cloneMap(ctx.keySets)
18771
+ };
18523
18772
  }
18524
18773
  function clearPatternBindings(pattern, ctx) {
18525
18774
  if (!pattern || typeof pattern !== "object") return;
18526
18775
  if (t2.isIdentifier(pattern)) {
18527
- ctx.delete(pattern.name);
18776
+ ctx.values.delete(pattern.name);
18777
+ ctx.keySets.delete(pattern.name);
18528
18778
  return;
18529
18779
  }
18530
18780
  if (t2.isRestElement(pattern)) {
@@ -18551,19 +18801,132 @@ function clearPatternBindings(pattern, ctx) {
18551
18801
  }
18552
18802
  }
18553
18803
  }
18554
- function resolveNarrowedKey(expr, ctx) {
18804
+ function resolveNarrowedKeys(expr, ctx) {
18555
18805
  if (expr.kind === "Literal") {
18556
18806
  if (typeof expr.value === "string" || typeof expr.value === "number") {
18557
- return expr.value;
18807
+ return /* @__PURE__ */ new Set([expr.value]);
18558
18808
  }
18559
18809
  return null;
18560
18810
  }
18561
18811
  if (expr.kind === "Identifier") {
18562
- return ctx.get(expr.name) ?? null;
18812
+ const value = ctx.values.get(expr.name);
18813
+ return value ? new Set(value) : null;
18814
+ }
18815
+ if (expr.kind === "ConditionalExpression") {
18816
+ const consequent = resolveNarrowedKeys(expr.consequent, ctx);
18817
+ const alternate = resolveNarrowedKeys(expr.alternate, ctx);
18818
+ if (consequent && alternate) {
18819
+ return /* @__PURE__ */ new Set([...consequent, ...alternate]);
18820
+ }
18821
+ return null;
18822
+ }
18823
+ if (expr.kind === "SequenceExpression" && expr.expressions.length > 0) {
18824
+ const last = expr.expressions[expr.expressions.length - 1];
18825
+ return resolveNarrowedKeys(last, ctx);
18826
+ }
18827
+ if (expr.kind === "MemberExpression" || expr.kind === "OptionalMemberExpression") {
18828
+ if (expr.computed && expr.object.kind === "Identifier") {
18829
+ const keySet = ctx.keySets.get(expr.object.name);
18830
+ if (keySet && keySet.size > 0) {
18831
+ return new Set(keySet);
18832
+ }
18833
+ }
18834
+ }
18835
+ return null;
18836
+ }
18837
+ function resolveKeySet(expr, ctx, shapes) {
18838
+ if (expr.kind === "Identifier") {
18839
+ const set = ctx.keySets.get(expr.name);
18840
+ return set ? new Set(set) : null;
18841
+ }
18842
+ if (expr.kind === "ArrayExpression") {
18843
+ const values = [];
18844
+ for (const el of expr.elements) {
18845
+ if (!el) return null;
18846
+ if (el.kind !== "Literal") return null;
18847
+ if (typeof el.value !== "string" && typeof el.value !== "number") return null;
18848
+ values.push(el.value);
18849
+ }
18850
+ return values.length > 0 ? new Set(values) : null;
18851
+ }
18852
+ if (expr.kind === "CallExpression") {
18853
+ if (expr.callee.kind === "MemberExpression") {
18854
+ const object = expr.callee.object;
18855
+ const property = expr.callee.property;
18856
+ if (object.kind === "Identifier" && object.name === "Object" && !expr.callee.computed && property.kind === "Identifier" && (property.name === "keys" || property.name === "getOwnPropertyNames") && expr.arguments.length === 1) {
18857
+ const arg = expr.arguments[0];
18858
+ if (arg.kind === "ObjectExpression") {
18859
+ const values = [];
18860
+ for (const prop of arg.properties) {
18861
+ if (prop.kind !== "Property") return null;
18862
+ if (prop.key.kind === "Identifier") {
18863
+ values.push(prop.key.name);
18864
+ } else if (prop.key.kind === "Literal") {
18865
+ if (typeof prop.key.value !== "string" && typeof prop.key.value !== "number") {
18866
+ return null;
18867
+ }
18868
+ values.push(prop.key.value);
18869
+ } else {
18870
+ return null;
18871
+ }
18872
+ }
18873
+ return values.length > 0 ? new Set(values) : null;
18874
+ }
18875
+ if (arg.kind === "Identifier" && shapes) {
18876
+ const shape = shapes.get(arg.name);
18877
+ if (shape && shape.knownKeys.size > 0 && !shape.dynamicAccess && !shape.escapes && shape.mutableKeys.size === 0) {
18878
+ return new Set(Array.from(shape.knownKeys));
18879
+ }
18880
+ }
18881
+ }
18882
+ }
18883
+ }
18884
+ if (expr.kind === "ConditionalExpression") {
18885
+ const consequent = resolveKeySet(expr.consequent, ctx, shapes);
18886
+ const alternate = resolveKeySet(expr.alternate, ctx, shapes);
18887
+ if (consequent && alternate) {
18888
+ return /* @__PURE__ */ new Set([...consequent, ...alternate]);
18889
+ }
18890
+ return null;
18891
+ }
18892
+ if (expr.kind === "SequenceExpression" && expr.expressions.length > 0) {
18893
+ const last = expr.expressions[expr.expressions.length - 1];
18894
+ return resolveKeySet(last, ctx, shapes);
18563
18895
  }
18564
18896
  return null;
18565
18897
  }
18566
18898
  function extractEqualityNarrowing(expr) {
18899
+ if (expr.kind === "LogicalExpression" && expr.operator === "||") {
18900
+ const left = extractEqualityNarrowing(expr.left);
18901
+ const right = extractEqualityNarrowing(expr.right);
18902
+ if (left && right && left.kind === "eq" && right.kind === "eq" && left.name === right.name) {
18903
+ return {
18904
+ name: left.name,
18905
+ values: /* @__PURE__ */ new Set([...left.values, ...right.values]),
18906
+ kind: "eq"
18907
+ };
18908
+ }
18909
+ }
18910
+ if (expr.kind === "LogicalExpression" && expr.operator === "&&") {
18911
+ const left = extractEqualityNarrowing(expr.left);
18912
+ const right = extractEqualityNarrowing(expr.right);
18913
+ if (left && right && left.name === right.name && left.kind === right.kind) {
18914
+ if (left.kind === "eq") {
18915
+ const intersection = /* @__PURE__ */ new Set();
18916
+ for (const value of left.values) {
18917
+ if (right.values.has(value)) intersection.add(value);
18918
+ }
18919
+ return intersection.size > 0 ? { name: left.name, values: intersection, kind: "eq" } : null;
18920
+ }
18921
+ if (left.kind === "neq") {
18922
+ const union = /* @__PURE__ */ new Set();
18923
+ for (const value of left.values) union.add(value);
18924
+ for (const value of right.values) union.add(value);
18925
+ return { name: left.name, values: union, kind: "neq" };
18926
+ }
18927
+ }
18928
+ return left ?? right;
18929
+ }
18567
18930
  if (expr.kind !== "BinaryExpression") return null;
18568
18931
  const isEq = expr.operator === "===";
18569
18932
  const isNeq = expr.operator === "!==";
@@ -18578,17 +18941,55 @@ function extractEqualityNarrowing(expr) {
18578
18941
  if (expr.left.kind === "Identifier") {
18579
18942
  const value = literalValue(expr.right);
18580
18943
  if (value !== null) {
18581
- return { name: expr.left.name, value, kind: isEq ? "eq" : "neq" };
18944
+ return { name: expr.left.name, values: /* @__PURE__ */ new Set([value]), kind: isEq ? "eq" : "neq" };
18582
18945
  }
18583
18946
  }
18584
18947
  if (expr.right.kind === "Identifier") {
18585
18948
  const value = literalValue(expr.left);
18586
18949
  if (value !== null) {
18587
- return { name: expr.right.name, value, kind: isEq ? "eq" : "neq" };
18950
+ return { name: expr.right.name, values: /* @__PURE__ */ new Set([value]), kind: isEq ? "eq" : "neq" };
18588
18951
  }
18589
18952
  }
18590
18953
  return null;
18591
18954
  }
18955
+ function applyNarrowing(ctx, name, values) {
18956
+ const existing = ctx.values.get(name);
18957
+ if (!existing) {
18958
+ ctx.values.set(name, new Set(values));
18959
+ return;
18960
+ }
18961
+ const intersection = /* @__PURE__ */ new Set();
18962
+ for (const value of existing) {
18963
+ if (values.has(value)) intersection.add(value);
18964
+ }
18965
+ if (intersection.size > 0) {
18966
+ ctx.values.set(name, intersection);
18967
+ } else {
18968
+ ctx.values.delete(name);
18969
+ }
18970
+ }
18971
+ function applyKeyAssignment(ctx, name, expr, shapes) {
18972
+ ctx.values.delete(name);
18973
+ ctx.keySets.delete(name);
18974
+ let assignedKeys = null;
18975
+ let keySet = null;
18976
+ if (expr.kind === "Identifier") {
18977
+ assignedKeys = resolveNarrowedKeys(expr, ctx);
18978
+ keySet = resolveKeySet(expr, ctx, shapes);
18979
+ if (ctx.keySets.has(expr.name)) {
18980
+ ctx.keySets.delete(expr.name);
18981
+ }
18982
+ } else {
18983
+ assignedKeys = resolveNarrowedKeys(expr, ctx);
18984
+ keySet = resolveKeySet(expr, ctx, shapes);
18985
+ }
18986
+ if (assignedKeys && assignedKeys.size > 0) {
18987
+ ctx.values.set(name, new Set(assignedKeys));
18988
+ }
18989
+ if (keySet && keySet.size > 0) {
18990
+ ctx.keySets.set(name, new Set(keySet));
18991
+ }
18992
+ }
18592
18993
  function mergeShapes(a, b) {
18593
18994
  return {
18594
18995
  knownKeys: /* @__PURE__ */ new Set([...a.knownKeys, ...b.knownKeys]),
@@ -18610,7 +19011,7 @@ function analyzeObjectShapes(fn) {
18610
19011
  shapes.set(param.name, createUnknownShape({ kind: "param", name: param.name }));
18611
19012
  }
18612
19013
  }
18613
- const baseCtx = /* @__PURE__ */ new Map();
19014
+ const baseCtx = { values: /* @__PURE__ */ new Map(), keySets: /* @__PURE__ */ new Map() };
18614
19015
  let structured = null;
18615
19016
  try {
18616
19017
  structured = structurizeCFG(fn, {
@@ -18644,6 +19045,13 @@ function analyzeObjectShapes(fn) {
18644
19045
  const propertySubscription = /* @__PURE__ */ new Map();
18645
19046
  const spreadWrapping = /* @__PURE__ */ new Set();
18646
19047
  for (const [name, shape] of shapes) {
19048
+ if (shape.source.kind === "store") {
19049
+ const reads = propertyReads.get(name);
19050
+ if (reads && reads.size > 0) {
19051
+ propertySubscription.set(name, reads);
19052
+ }
19053
+ continue;
19054
+ }
18647
19055
  if (shape.dynamicAccess || shape.source.kind === "unknown") {
18648
19056
  wholeObjectSubscription.add(name);
18649
19057
  } else if (shape.isSpread && !shape.escapes) {
@@ -18697,9 +19105,9 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18697
19105
  const alternateCtx = cloneKeyContext(ctx);
18698
19106
  if (narrowing) {
18699
19107
  if (narrowing.kind === "eq") {
18700
- consequentCtx.set(narrowing.name, narrowing.value);
19108
+ applyNarrowing(consequentCtx, narrowing.name, narrowing.values);
18701
19109
  } else {
18702
- alternateCtx.set(narrowing.name, narrowing.value);
19110
+ applyNarrowing(alternateCtx, narrowing.name, narrowing.values);
18703
19111
  }
18704
19112
  }
18705
19113
  analyzeStructuredNode(node.consequent, shapes, propertyReads, consequentCtx);
@@ -18714,7 +19122,7 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18714
19122
  for (const caseNode of node.cases) {
18715
19123
  const caseCtx = cloneKeyContext(ctx);
18716
19124
  if (discriminant && caseNode.test?.kind === "Literal" && (typeof caseNode.test.value === "string" || typeof caseNode.test.value === "number")) {
18717
- caseCtx.set(discriminant, caseNode.test.value);
19125
+ applyNarrowing(caseCtx, discriminant, /* @__PURE__ */ new Set([caseNode.test.value]));
18718
19126
  }
18719
19127
  analyzeStructuredNode(caseNode.body, shapes, propertyReads, caseCtx);
18720
19128
  }
@@ -18745,10 +19153,21 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18745
19153
  analyzeExpression(node.iterable, shapes, propertyReads, ctx);
18746
19154
  {
18747
19155
  const bodyCtx = cloneKeyContext(ctx);
18748
- bodyCtx.delete(node.variable);
19156
+ bodyCtx.values.delete(node.variable);
19157
+ bodyCtx.keySets.delete(node.variable);
18749
19158
  if (node.pattern) {
18750
19159
  clearPatternBindings(node.pattern, bodyCtx);
18751
19160
  }
19161
+ if (node.iterable.kind === "Identifier") {
19162
+ const keySet = ctx.keySets.get(node.iterable.name);
19163
+ if (keySet) {
19164
+ if (node.pattern && t2.isIdentifier(node.pattern)) {
19165
+ bodyCtx.values.set(node.pattern.name, new Set(keySet));
19166
+ } else {
19167
+ bodyCtx.values.set(node.variable, new Set(keySet));
19168
+ }
19169
+ }
19170
+ }
18752
19171
  analyzeStructuredNode(node.body, shapes, propertyReads, bodyCtx);
18753
19172
  }
18754
19173
  return;
@@ -18756,10 +19175,22 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18756
19175
  analyzeExpression(node.object, shapes, propertyReads, ctx);
18757
19176
  {
18758
19177
  const bodyCtx = cloneKeyContext(ctx);
18759
- bodyCtx.delete(node.variable);
19178
+ bodyCtx.values.delete(node.variable);
19179
+ bodyCtx.keySets.delete(node.variable);
18760
19180
  if (node.pattern) {
18761
19181
  clearPatternBindings(node.pattern, bodyCtx);
18762
19182
  }
19183
+ if (node.object.kind === "Identifier") {
19184
+ const shape = shapes.get(node.object.name);
19185
+ if (shape && shape.knownKeys.size > 0 && !shape.dynamicAccess && !shape.escapes && shape.mutableKeys.size === 0) {
19186
+ const keySet = new Set(shape.knownKeys);
19187
+ if (node.pattern && t2.isIdentifier(node.pattern)) {
19188
+ bodyCtx.values.set(node.pattern.name, keySet);
19189
+ } else {
19190
+ bodyCtx.values.set(node.variable, keySet);
19191
+ }
19192
+ }
19193
+ }
18763
19194
  analyzeStructuredNode(node.body, shapes, propertyReads, bodyCtx);
18764
19195
  }
18765
19196
  return;
@@ -18768,7 +19199,8 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18768
19199
  if (node.handler) {
18769
19200
  const handlerCtx = cloneKeyContext(ctx);
18770
19201
  if (node.handler.param) {
18771
- handlerCtx.delete(node.handler.param);
19202
+ handlerCtx.values.delete(node.handler.param);
19203
+ handlerCtx.keySets.delete(node.handler.param);
18772
19204
  }
18773
19205
  analyzeStructuredNode(node.handler.body, shapes, propertyReads, handlerCtx);
18774
19206
  }
@@ -18794,9 +19226,7 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18794
19226
  }
18795
19227
  function analyzeInstruction(instr, shapes, propertyReads, ctx) {
18796
19228
  if (instr.kind === "Assign") {
18797
- if (ctx.has(instr.target.name)) {
18798
- ctx.delete(instr.target.name);
18799
- }
19229
+ applyKeyAssignment(ctx, instr.target.name, instr.value, shapes);
18800
19230
  const valueShape = analyzeExpression(instr.value, shapes, propertyReads, ctx);
18801
19231
  if (valueShape) {
18802
19232
  const existing = shapes.get(instr.target.name);
@@ -18853,12 +19283,14 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18853
19283
  const reads = propertyReads.get(base) ?? /* @__PURE__ */ new Set();
18854
19284
  const baseShape = shapes.get(base);
18855
19285
  if (directMember.computed) {
18856
- const resolved = resolveNarrowedKey(directMember.property, ctx);
18857
- if (resolved !== null) {
18858
- const key = String(resolved);
18859
- reads.add(key);
18860
- if (baseShape) {
18861
- baseShape.knownKeys.add(key);
19286
+ const resolved = resolveNarrowedKeys(directMember.property, ctx);
19287
+ if (resolved && resolved.size > 0) {
19288
+ for (const value of resolved) {
19289
+ const key = String(value);
19290
+ reads.add(key);
19291
+ if (baseShape) {
19292
+ baseShape.knownKeys.add(key);
19293
+ }
18862
19294
  }
18863
19295
  } else if (baseShape) {
18864
19296
  baseShape.dynamicAccess = true;
@@ -18880,19 +19312,54 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18880
19312
  return null;
18881
19313
  }
18882
19314
  case "CallExpression": {
18883
- for (const arg of expr.arguments) {
19315
+ if (expr.callee.kind === "MemberExpression") {
19316
+ if (expr.callee.object.kind === "Identifier") {
19317
+ const baseName2 = expr.callee.object.name;
19318
+ const propName = !expr.callee.computed && expr.callee.property.kind === "Identifier" ? expr.callee.property.name : expr.callee.property.kind === "Literal" && typeof expr.callee.property.value === "string" ? expr.callee.property.value : null;
19319
+ if (propName && ctx.keySets.has(baseName2) && [
19320
+ "push",
19321
+ "pop",
19322
+ "shift",
19323
+ "unshift",
19324
+ "splice",
19325
+ "sort",
19326
+ "reverse",
19327
+ "copyWithin",
19328
+ "fill"
19329
+ ].includes(propName)) {
19330
+ ctx.keySets.delete(baseName2);
19331
+ }
19332
+ }
19333
+ }
19334
+ for (const arg of expr.arguments) {
19335
+ if (arg.kind === "Identifier" && ctx.keySets.has(arg.name)) {
19336
+ ctx.keySets.delete(arg.name);
19337
+ } else if (arg.kind === "SpreadElement" && arg.argument.kind === "Identifier") {
19338
+ if (ctx.keySets.has(arg.argument.name)) {
19339
+ ctx.keySets.delete(arg.argument.name);
19340
+ }
19341
+ }
19342
+ }
19343
+ for (const arg of expr.arguments) {
18884
19344
  markEscaping(arg, shapes);
18885
19345
  }
18886
19346
  let returnedShape = null;
18887
- if (expr.callee.kind === "Identifier" && expr.callee.name === "$state" && expr.arguments[0]) {
19347
+ if (expr.callee.kind === "Identifier" && (expr.callee.name === "$state" || expr.callee.name === "$store") && expr.arguments[0]) {
18888
19348
  returnedShape = analyzeExpression(
18889
19349
  expr.arguments[0],
18890
19350
  shapes,
18891
19351
  propertyReads,
18892
19352
  ctx
18893
19353
  );
19354
+ if (expr.callee.name === "$store") {
19355
+ if (!returnedShape) {
19356
+ returnedShape = createStoreShape();
19357
+ } else {
19358
+ returnedShape.source = { kind: "store" };
19359
+ }
19360
+ }
18894
19361
  }
18895
- if (!(expr.callee.kind === "Identifier" && expr.callee.name === "$state")) {
19362
+ if (!(expr.callee.kind === "Identifier" && (expr.callee.name === "$state" || expr.callee.name === "$store"))) {
18896
19363
  analyzeExpression(expr.callee, shapes, propertyReads, ctx);
18897
19364
  }
18898
19365
  expr.arguments.slice(returnedShape ? 1 : 0).forEach((arg) => analyzeExpression(arg, shapes, propertyReads, ctx));
@@ -18931,9 +19398,7 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18931
19398
  }
18932
19399
  case "AssignmentExpression": {
18933
19400
  if (expr.left.kind === "Identifier") {
18934
- if (ctx.has(expr.left.name)) {
18935
- ctx.delete(expr.left.name);
18936
- }
19401
+ applyKeyAssignment(ctx, expr.left.name, expr.right, shapes);
18937
19402
  }
18938
19403
  if (expr.left.kind === "MemberExpression") {
18939
19404
  const base = getBaseIdentifier(expr.left.object);
@@ -18945,14 +19410,19 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18945
19410
  } else if (expr.left.property.kind === "Literal" && typeof expr.left.property.value === "string") {
18946
19411
  shape.mutableKeys.add(expr.left.property.value);
18947
19412
  } else {
18948
- const resolved = resolveNarrowedKey(expr.left.property, ctx);
18949
- if (resolved !== null) {
18950
- shape.mutableKeys.add(String(resolved));
19413
+ const resolved = resolveNarrowedKeys(expr.left.property, ctx);
19414
+ if (resolved && resolved.size > 0) {
19415
+ for (const value of resolved) {
19416
+ shape.mutableKeys.add(String(value));
19417
+ }
18951
19418
  } else {
18952
19419
  shape.dynamicAccess = true;
18953
19420
  }
18954
19421
  }
18955
19422
  }
19423
+ if (ctx.keySets.has(base)) {
19424
+ ctx.keySets.delete(base);
19425
+ }
18956
19426
  }
18957
19427
  }
18958
19428
  analyzeExpression(expr.right, shapes, propertyReads, ctx);
@@ -18960,8 +19430,13 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18960
19430
  }
18961
19431
  case "UpdateExpression": {
18962
19432
  if (expr.argument.kind === "Identifier") {
18963
- if (ctx.has(expr.argument.name)) {
18964
- ctx.delete(expr.argument.name);
19433
+ ctx.values.delete(expr.argument.name);
19434
+ ctx.keySets.delete(expr.argument.name);
19435
+ }
19436
+ if (expr.argument.kind === "MemberExpression") {
19437
+ const base = getBaseIdentifier(expr.argument.object);
19438
+ if (base) {
19439
+ ctx.keySets.delete(base);
18965
19440
  }
18966
19441
  }
18967
19442
  analyzeExpression(expr.argument, shapes, propertyReads, ctx);
@@ -19393,7 +19868,11 @@ function expressionUsesTracked(expr, ctx) {
19393
19868
  return ctx.trackedVars.has(deSSAVarName(expr.name)) || (ctx.externalTracked?.has(deSSAVarName(expr.name)) ?? false) || (ctx.memoVars?.has(deSSAVarName(expr.name)) ?? false) || (ctx.aliasVars?.has(deSSAVarName(expr.name)) ?? false);
19394
19869
  case "MemberExpression":
19395
19870
  case "OptionalMemberExpression":
19396
- return expressionUsesTracked(expr.object, ctx);
19871
+ if (expressionUsesTracked(expr.object, ctx)) return true;
19872
+ if (expr.computed && expr.property.kind !== "Literal") {
19873
+ return expressionUsesTracked(expr.property, ctx);
19874
+ }
19875
+ return false;
19397
19876
  case "CallExpression":
19398
19877
  case "OptionalCallExpression":
19399
19878
  if (expressionUsesTracked(expr.callee, ctx)) return true;
@@ -19415,6 +19894,10 @@ function expressionUsesTracked(expr, ctx) {
19415
19894
  return expr.expressions.some((e) => expressionUsesTracked(e, ctx));
19416
19895
  case "SpreadElement":
19417
19896
  return expressionUsesTracked(expr.argument, ctx);
19897
+ case "UnaryExpression":
19898
+ return expressionUsesTracked(expr.argument, ctx);
19899
+ case "UpdateExpression":
19900
+ return expressionUsesTracked(expr.argument, ctx);
19418
19901
  default:
19419
19902
  return false;
19420
19903
  }
@@ -19553,6 +20036,12 @@ function lowerNodeWithRegionContext(node, t4, ctx, declaredVars, regionCtx) {
19553
20036
  case "if": {
19554
20037
  const prevConditional = ctx.inConditional ?? 0;
19555
20038
  ctx.inConditional = prevConditional + 1;
20039
+ const inNonReactiveScope = !!(ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0);
20040
+ const mightWrapInEffect = ctx.wrapTrackedExpressions !== false && !ctx.inRegionMemo && !inNonReactiveScope && expressionUsesTracked(node.test, ctx);
20041
+ const prevNonReactiveDepth = ctx.nonReactiveScopeDepth ?? 0;
20042
+ if (mightWrapInEffect) {
20043
+ ctx.nonReactiveScopeDepth = prevNonReactiveDepth + 1;
20044
+ }
19556
20045
  const conseqStmts = lowerNodeWithRegionContext(
19557
20046
  node.consequent,
19558
20047
  t4,
@@ -19561,6 +20050,9 @@ function lowerNodeWithRegionContext(node, t4, ctx, declaredVars, regionCtx) {
19561
20050
  regionCtx
19562
20051
  );
19563
20052
  const altStmts = node.alternate ? lowerNodeWithRegionContext(node.alternate, t4, ctx, declaredVars, regionCtx) : null;
20053
+ if (mightWrapInEffect) {
20054
+ ctx.nonReactiveScopeDepth = prevNonReactiveDepth;
20055
+ }
19564
20056
  ctx.inConditional = prevConditional;
19565
20057
  const conseqReactiveOnly = nodeIsPureReactiveScope(node.consequent, ctx.memoMacroNames);
19566
20058
  const altReactiveOnly = node.alternate ? nodeIsPureReactiveScope(node.alternate, ctx.memoMacroNames) : false;
@@ -19609,13 +20101,17 @@ function lowerNodeWithRegionContext(node, t4, ctx, declaredVars, regionCtx) {
19609
20101
  }
19610
20102
  return stmts;
19611
20103
  }
20104
+ const conseqIsEmpty = conseqStmts.length === 0;
20105
+ const altIsEmpty = !altStmts || altStmts.length === 0;
20106
+ if (conseqIsEmpty && altIsEmpty) {
20107
+ return [];
20108
+ }
19612
20109
  const ifStmt = t4.ifStatement(
19613
20110
  testExpr,
19614
20111
  t4.blockStatement(conseqStmts),
19615
20112
  altStmts ? t4.blockStatement(altStmts) : null
19616
20113
  );
19617
- const inNonReactiveScope = !!(ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0);
19618
- const shouldWrapEffect = ctx.wrapTrackedExpressions !== false && !ctx.inRegionMemo && !inNonReactiveScope && expressionUsesTracked(node.test, ctx) && !statementHasEarlyExit(ifStmt, t4);
20114
+ const shouldWrapEffect = mightWrapInEffect && !statementHasEarlyExit(ifStmt, t4);
19619
20115
  if (shouldWrapEffect) {
19620
20116
  const effectFn = t4.arrowFunctionExpression([], t4.blockStatement([ifStmt]));
19621
20117
  return [t4.expressionStatement(buildEffectCall(ctx, t4, effectFn))];
@@ -19836,7 +20332,7 @@ function lowerStructuredNodeForRegion(node, region, t4, ctx, declaredVars, regio
19836
20332
  }
19837
20333
  case "if": {
19838
20334
  const inNonReactiveScope = !!(ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0);
19839
- const baseShouldWrapEffect = ctx.wrapTrackedExpressions !== false && !ctx.inRegionMemo && !inNonReactiveScope && expressionUsesTracked(node.test, ctx);
20335
+ const mightWrapInEffect = ctx.wrapTrackedExpressions !== false && !ctx.inRegionMemo && !inNonReactiveScope && expressionUsesTracked(node.test, ctx);
19840
20336
  const lowerChild = (child, forceNonReactive) => {
19841
20337
  if (!child) return [];
19842
20338
  if (!forceNonReactive) {
@@ -19866,8 +20362,8 @@ function lowerStructuredNodeForRegion(node, region, t4, ctx, declaredVars, regio
19866
20362
  ctx.nonReactiveScopeDepth = prevDepth;
19867
20363
  }
19868
20364
  };
19869
- let consequent = lowerChild(node.consequent, baseShouldWrapEffect);
19870
- let alternate = node.alternate ? lowerChild(node.alternate, baseShouldWrapEffect) : [];
20365
+ let consequent = lowerChild(node.consequent, mightWrapInEffect);
20366
+ let alternate = node.alternate ? lowerChild(node.alternate, mightWrapInEffect) : [];
19871
20367
  if (consequent.length === 0 && alternate.length === 0) return [];
19872
20368
  const buildIfStmt = (cons, alt) => t4.ifStatement(
19873
20369
  lowerExpressionWithDeSSA(node.test, ctx),
@@ -19875,8 +20371,9 @@ function lowerStructuredNodeForRegion(node, region, t4, ctx, declaredVars, regio
19875
20371
  alt.length > 0 ? t4.blockStatement(alt) : null
19876
20372
  );
19877
20373
  let ifStmt = buildIfStmt(consequent, alternate);
19878
- const shouldWrapEffect = baseShouldWrapEffect && !statementHasEarlyExit(ifStmt, t4);
19879
- if (!shouldWrapEffect && baseShouldWrapEffect) {
20374
+ const hasEarlyExit = statementHasEarlyExit(ifStmt, t4);
20375
+ const shouldWrapEffect = mightWrapInEffect && !hasEarlyExit;
20376
+ if (!shouldWrapEffect && mightWrapInEffect && !hasEarlyExit) {
19880
20377
  consequent = lowerChild(node.consequent, false);
19881
20378
  alternate = node.alternate ? lowerChild(node.alternate, false) : [];
19882
20379
  if (consequent.length === 0 && alternate.length === 0) return [];
@@ -20338,19 +20835,6 @@ function wrapInMemo(region, t4, declaredVars, ctx, bodyStatementsOverride, outpu
20338
20835
  );
20339
20836
  ctx.memoVars?.add(name);
20340
20837
  }
20341
- if (region.hasControlFlow && getterOutputs.length > 0) {
20342
- const effectBody = t4.blockStatement(
20343
- getterOutputs.map((name) => t4.expressionStatement(t4.callExpression(t4.identifier(name), [])))
20344
- );
20345
- statements.push(
20346
- t4.expressionStatement(
20347
- buildEffectCall(ctx, t4, t4.arrowFunctionExpression([], effectBody), {
20348
- slot: ctx.inModule ? void 0 : reserveHookSlot(ctx),
20349
- forceSlot: true
20350
- })
20351
- )
20352
- );
20353
- }
20354
20838
  }
20355
20839
  return statements;
20356
20840
  }
@@ -20596,11 +21080,15 @@ function reserveHookSlot(ctx) {
20596
21080
  ctx.nextHookSlot = slot + 1;
20597
21081
  return slot;
20598
21082
  }
21083
+ function createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4) {
21084
+ ctx.trackedVars.delete(baseName2);
21085
+ ctx.memoVars?.delete(baseName2);
21086
+ return t4.variableDeclaration("let", [t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)]);
21087
+ }
20599
21088
  function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20600
21089
  if (instr.kind === "Assign") {
20601
21090
  const ssaName = instr.target.name;
20602
21091
  const baseName2 = deSSAVarName(ssaName);
20603
- const memoMacroNames = ctx.memoMacroNames ?? /* @__PURE__ */ new Set(["$memo", "createMemo"]);
20604
21092
  const declKindRaw = instr.declarationKind;
20605
21093
  propagateHookResultAlias(baseName2, instr.value, ctx);
20606
21094
  const hookMember = resolveHookMemberValue(instr.value, ctx);
@@ -20650,12 +21138,14 @@ function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20650
21138
  const isShadowDeclaration = !!declKind && declaredVars.has(baseName2);
20651
21139
  const treatAsTracked = !isShadowDeclaration && isTracked;
20652
21140
  const isDestructuringTemp = baseName2.startsWith("__destruct_");
20653
- const isStateCall2 = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$state";
21141
+ const callKind = getReactiveCallKind(instr.value, ctx);
21142
+ const isStateCall2 = callKind === "signal";
20654
21143
  const inRegionMemo = ctx.inRegionMemo ?? false;
20655
21144
  const isFunctionValue = instr.value.kind === "ArrowFunction" || instr.value.kind === "FunctionExpression";
20656
- const isAccessorReturningCall = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && (memoMacroNames.has(instr.value.callee.name) || instr.value.callee.name === "prop");
21145
+ const isAccessorReturningCall = callKind === "memo" || instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "prop";
20657
21146
  const isReactiveObjectCall = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && ["mergeProps"].includes(instr.value.callee.name);
20658
21147
  const isMemoReturningCall = isAccessorReturningCall || isReactiveObjectCall;
21148
+ const needsMutable = ctx.mutatedVars?.has(baseName2) ?? false;
20659
21149
  const lowerAssignedValue = (forceAssigned = false) => lowerExpressionWithDeSSA(instr.value, ctx, forceAssigned || isFunctionValue);
20660
21150
  const buildDerivedMemoCall = (expr) => {
20661
21151
  const slot = !ctx.inModule && inRegionMemo ? reserveHookSlot(ctx) : void 0;
@@ -20666,7 +21156,6 @@ function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20666
21156
  }
20667
21157
  if (declKind) {
20668
21158
  const normalizedDecl = isStateCall2 || dependsOnTracked && !isDestructuringTemp ? "const" : declKind;
20669
- const needsMutable = ctx.mutatedVars?.has(baseName2) ?? false;
20670
21159
  const isExternalAlias = declKind === "const" && instr.value.kind === "Identifier" && !(ctx.scopes?.byName?.has(deSSAVarName(instr.value.name)) ?? false);
20671
21160
  const fallbackDecl = !treatAsTracked && (!dependsOnTracked || isDestructuringTemp) ? declKind === "const" && (needsMutable || isExternalAlias) ? "let" : declKind : normalizedDecl;
20672
21161
  declaredVars.add(baseName2);
@@ -20682,7 +21171,11 @@ function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20682
21171
  }
20683
21172
  const derivedExpr = lowerAssignedValue(true);
20684
21173
  if (ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0) {
20685
- return t4.variableDeclaration(normalizedDecl, [
21174
+ return createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4);
21175
+ }
21176
+ if (needsMutable) {
21177
+ ctx.memoVars?.delete(baseName2);
21178
+ return t4.variableDeclaration("let", [
20686
21179
  t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)
20687
21180
  ]);
20688
21181
  }
@@ -20709,7 +21202,11 @@ function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20709
21202
  }
20710
21203
  const derivedExpr = lowerAssignedValue(true);
20711
21204
  if (ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0) {
20712
- return t4.variableDeclaration(normalizedDecl, [
21205
+ return createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4);
21206
+ }
21207
+ if (needsMutable) {
21208
+ ctx.memoVars?.delete(baseName2);
21209
+ return t4.variableDeclaration("let", [
20713
21210
  t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)
20714
21211
  ]);
20715
21212
  }
@@ -20824,7 +21321,10 @@ Consider:
20824
21321
  if (dependsOnTracked) {
20825
21322
  const derivedExpr = lowerAssignedValue(true);
20826
21323
  if (ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0) {
20827
- return t4.variableDeclaration("const", [
21324
+ return createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4);
21325
+ }
21326
+ if (needsMutable) {
21327
+ return t4.variableDeclaration("let", [
20828
21328
  t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)
20829
21329
  ]);
20830
21330
  }
@@ -20851,6 +21351,9 @@ Consider:
20851
21351
  if (dependsOnTracked) {
20852
21352
  const derivedExpr = lowerAssignedValue(true);
20853
21353
  if (ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0) {
21354
+ return createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4);
21355
+ }
21356
+ if (needsMutable) {
20854
21357
  return t4.variableDeclaration("let", [
20855
21358
  t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)
20856
21359
  ]);
@@ -20896,7 +21399,8 @@ Consider:
20896
21399
  const loweredExpr = lowerExpressionWithDeSSA(instr.value, ctx);
20897
21400
  const effectBody = depReads.length > 0 ? ctx.t.blockStatement([...depReads, ctx.t.expressionStatement(loweredExpr)]) : loweredExpr;
20898
21401
  const effectFn = ctx.t.isBlockStatement(effectBody) ? t4.arrowFunctionExpression([], effectBody) : t4.arrowFunctionExpression([], effectBody);
20899
- return t4.expressionStatement(buildEffectCall(ctx, t4, effectFn));
21402
+ const slot = ctx.inModule ? void 0 : reserveHookSlot(ctx);
21403
+ return t4.expressionStatement(buildEffectCall(ctx, t4, effectFn, { slot }));
20900
21404
  }
20901
21405
  return t4.expressionStatement(lowerExpressionWithDeSSA(instr.value, ctx));
20902
21406
  }
@@ -21201,6 +21705,24 @@ function setNodeLoc(node, loc) {
21201
21705
  node.loc = cloneLoc(loc) ?? null;
21202
21706
  return node;
21203
21707
  }
21708
+ function serializeHookReturnInfo(info) {
21709
+ const objectProps = info.objectProps ? Object.fromEntries(info.objectProps.entries()) : void 0;
21710
+ const arrayProps = info.arrayProps ? Object.fromEntries(Array.from(info.arrayProps.entries()).map(([k, v]) => [String(k), v])) : void 0;
21711
+ return {
21712
+ objectProps,
21713
+ arrayProps,
21714
+ directAccessor: info.directAccessor
21715
+ };
21716
+ }
21717
+ function deserializeHookReturnInfo(info) {
21718
+ const objectProps = info.objectProps ? new Map(Object.entries(info.objectProps)) : void 0;
21719
+ const arrayProps = info.arrayProps ? new Map(Object.entries(info.arrayProps).map(([k, v]) => [Number.parseInt(k, 10), v])) : void 0;
21720
+ return {
21721
+ objectProps,
21722
+ arrayProps,
21723
+ directAccessor: info.directAccessor
21724
+ };
21725
+ }
21204
21726
  function propagateHookResultAlias(targetBase, value, ctx) {
21205
21727
  const mapSource = (source) => {
21206
21728
  const hookName = ctx.hookResultVarMap?.get(source);
@@ -21224,6 +21746,15 @@ function propagateHookResultAlias(targetBase, value, ctx) {
21224
21746
  mapSource(deSSAVarName(firstArg.name));
21225
21747
  }
21226
21748
  }
21749
+ if (value.kind === "SequenceExpression" && value.expressions.length > 0) {
21750
+ const last = value.expressions[value.expressions.length - 1];
21751
+ if (last && last.kind === "CallExpression" && last.callee.kind === "Identifier" && last.callee.name === "__fictPropsRest") {
21752
+ const firstArg = last.arguments[0];
21753
+ if (firstArg && firstArg.kind === "Identifier") {
21754
+ mapSource(deSSAVarName(firstArg.name));
21755
+ }
21756
+ }
21757
+ }
21227
21758
  }
21228
21759
  function applyRegionToContext(ctx, region) {
21229
21760
  const prevRegion = ctx.currentRegion;
@@ -21519,6 +22050,9 @@ function createCodegenContext(t4) {
21519
22050
  t: t4,
21520
22051
  moduleDeclaredNames: /* @__PURE__ */ new Set(),
21521
22052
  moduleRuntimeNames: /* @__PURE__ */ new Set(),
22053
+ moduleRuntimeImportMap: /* @__PURE__ */ new Map(),
22054
+ moduleRuntimeNamespaceImports: /* @__PURE__ */ new Set(),
22055
+ stateMacroNames: /* @__PURE__ */ new Set(),
21522
22056
  localDeclaredNames: /* @__PURE__ */ new Set(),
21523
22057
  helpersUsed: /* @__PURE__ */ new Set(),
21524
22058
  tempCounter: 0,
@@ -21530,6 +22064,7 @@ function createCodegenContext(t4) {
21530
22064
  aliasVars: /* @__PURE__ */ new Set(),
21531
22065
  externalTracked: /* @__PURE__ */ new Set(),
21532
22066
  storeVars: /* @__PURE__ */ new Set(),
22067
+ importedNamespaces: /* @__PURE__ */ new Map(),
21533
22068
  signalVars: /* @__PURE__ */ new Set(),
21534
22069
  functionVars: /* @__PURE__ */ new Set(),
21535
22070
  memoVars: /* @__PURE__ */ new Set(),
@@ -21577,9 +22112,10 @@ function withGetterCache(ctx, fn) {
21577
22112
  ctx.getterCacheEnabled = prevEnabled;
21578
22113
  return { result, cacheDeclarations };
21579
22114
  }
21580
- function collectHookReactiveVars(fn) {
22115
+ function collectHookReactiveVars(fn, ctx) {
21581
22116
  const signalVars = /* @__PURE__ */ new Set();
21582
22117
  const storeVars = /* @__PURE__ */ new Set();
22118
+ const memoVars = /* @__PURE__ */ new Set();
21583
22119
  const functionVars = /* @__PURE__ */ new Set();
21584
22120
  const mutatedVars = /* @__PURE__ */ new Set();
21585
22121
  for (const block of fn.blocks) {
@@ -21589,11 +22125,14 @@ function collectHookReactiveVars(fn) {
21589
22125
  if (instr.value.kind === "ArrowFunction" || instr.value.kind === "FunctionExpression") {
21590
22126
  functionVars.add(target);
21591
22127
  }
21592
- if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier") {
21593
- if (instr.value.callee.name === "$state") {
22128
+ if (instr.value.kind === "CallExpression" || instr.value.kind === "OptionalCallExpression") {
22129
+ const callKind = getReactiveCallKind(instr.value, ctx);
22130
+ if (callKind === "signal") {
21594
22131
  signalVars.add(target);
21595
- } else if (instr.value.callee.name === "$store") {
22132
+ } else if (callKind === "store") {
21596
22133
  storeVars.add(target);
22134
+ } else if (callKind === "memo") {
22135
+ memoVars.add(target);
21597
22136
  }
21598
22137
  }
21599
22138
  if (!instr.declarationKind) {
@@ -21604,11 +22143,14 @@ function collectHookReactiveVars(fn) {
21604
22143
  }
21605
22144
  }
21606
22145
  }
21607
- return { signalVars, storeVars, functionVars, mutatedVars };
22146
+ return { signalVars, storeVars, memoVars, functionVars, mutatedVars };
21608
22147
  }
21609
22148
  function analyzeHookReturnInfo(fn, ctx) {
21610
22149
  if (!isHookName(fn.name)) return null;
21611
- const { signalVars, storeVars, functionVars, mutatedVars } = collectHookReactiveVars(fn);
22150
+ const { signalVars, storeVars, memoVars, functionVars, mutatedVars } = collectHookReactiveVars(
22151
+ fn,
22152
+ ctx
22153
+ );
21612
22154
  const tmpCtx = createCodegenContext(ctx.t);
21613
22155
  tmpCtx.signalVars = new Set(signalVars);
21614
22156
  tmpCtx.storeVars = new Set(storeVars);
@@ -21616,9 +22158,9 @@ function analyzeHookReturnInfo(fn, ctx) {
21616
22158
  tmpCtx.mutatedVars = new Set(mutatedVars);
21617
22159
  tmpCtx.aliasVars = /* @__PURE__ */ new Set();
21618
22160
  tmpCtx.trackedVars = /* @__PURE__ */ new Set();
21619
- tmpCtx.memoVars = /* @__PURE__ */ new Set();
22161
+ tmpCtx.memoVars = new Set(memoVars);
21620
22162
  const scopeResult = analyzeReactiveScopesWithSSA(fn);
21621
- detectDerivedCycles(fn, scopeResult);
22163
+ detectDerivedCycles(fn, scopeResult, ctx);
21622
22164
  tmpCtx.scopes = scopeResult;
21623
22165
  const regionResult = generateRegions(fn, scopeResult);
21624
22166
  tmpCtx.regions = flattenRegions(regionResult.topLevelRegions);
@@ -21760,23 +22302,32 @@ function getCachedGetterExpression(ctx, getterName, callExpr) {
21760
22302
  }
21761
22303
  return ctx.t.identifier(existingEntry);
21762
22304
  }
21763
- function getOrCreateHoistedTemplate(html, ctx) {
22305
+ function getOrCreateHoistedTemplate(html, ctx, isSVG, isMathML) {
21764
22306
  if (!ctx.inListRender || !ctx.hoistedTemplates || !ctx.hoistedTemplateStatements) {
21765
22307
  return null;
21766
22308
  }
21767
- const existing = ctx.hoistedTemplates.get(html);
22309
+ const cacheKey = isSVG ? `svg:${html}` : isMathML ? `mathml:${html}` : html;
22310
+ const existing = ctx.hoistedTemplates.get(cacheKey);
21768
22311
  if (existing) {
21769
22312
  return existing;
21770
22313
  }
21771
22314
  const { t: t4 } = ctx;
21772
22315
  ctx.helpersUsed.add("template");
21773
22316
  const tmplId = genTemp(ctx, "htmpl");
21774
- ctx.hoistedTemplates.set(html, tmplId);
22317
+ ctx.hoistedTemplates.set(cacheKey, tmplId);
22318
+ const templateArgs = [t4.stringLiteral(html)];
22319
+ if (isSVG || isMathML) {
22320
+ templateArgs.push(t4.identifier("undefined"));
22321
+ templateArgs.push(isSVG ? t4.booleanLiteral(true) : t4.identifier("undefined"));
22322
+ if (isMathML) {
22323
+ templateArgs.push(t4.booleanLiteral(true));
22324
+ }
22325
+ }
21775
22326
  ctx.hoistedTemplateStatements.push(
21776
22327
  t4.variableDeclaration("const", [
21777
22328
  t4.variableDeclarator(
21778
22329
  tmplId,
21779
- t4.callExpression(t4.identifier(RUNTIME_ALIASES.template), [t4.stringLiteral(html)])
22330
+ t4.callExpression(t4.identifier(RUNTIME_ALIASES.template), templateArgs)
21780
22331
  )
21781
22332
  ])
21782
22333
  );
@@ -21818,7 +22369,7 @@ function matchesListKeyPattern(expr, ctx) {
21818
22369
  const exprPropName = expr.property.kind === "Identifier" ? expr.property.name : String(expr.property.value);
21819
22370
  return exprPropName === keyPropName;
21820
22371
  }
21821
- function detectDerivedCycles(fn, _scopeResult) {
22372
+ function detectDerivedCycles(fn, _scopeResult, ctx) {
21822
22373
  if (debugEnabled("cycles_throw")) {
21823
22374
  throw new Error("cycle check invoked");
21824
22375
  }
@@ -21827,11 +22378,12 @@ function detectDerivedCycles(fn, _scopeResult) {
21827
22378
  for (const instr of block.instructions) {
21828
22379
  if (instr.kind !== "Assign") continue;
21829
22380
  const target = deSSAVarName(instr.target.name);
21830
- const isStateCall2 = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$state";
21831
- const isStoreCall = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$store";
22381
+ const callKind = getReactiveCallKind(instr.value, ctx);
22382
+ const isSignalCall = callKind === "signal";
22383
+ const isStoreCall = callKind === "store";
21832
22384
  const prev = declared.get(target);
21833
22385
  declared.set(target, {
21834
- isState: (prev?.isState ?? false) || isStateCall2,
22386
+ isSignal: (prev?.isSignal ?? false) || isSignalCall,
21835
22387
  isStore: (prev?.isStore ?? false) || isStoreCall,
21836
22388
  declaredHere: prev?.declaredHere || !!instr.declarationKind,
21837
22389
  count: (prev?.count ?? 0) + 1
@@ -21844,7 +22396,7 @@ function detectDerivedCycles(fn, _scopeResult) {
21844
22396
  if (instr.kind !== "Assign") continue;
21845
22397
  const target = deSSAVarName(instr.target.name);
21846
22398
  const declInfo = declared.get(target);
21847
- if (declInfo?.isState || !declInfo?.declaredHere) continue;
22399
+ if (declInfo?.isSignal || declInfo?.isStore || !declInfo?.declaredHere) continue;
21848
22400
  if ((declInfo.count ?? 0) !== 1) continue;
21849
22401
  const deps = graph.get(target) ?? /* @__PURE__ */ new Set();
21850
22402
  const rawDeps = /* @__PURE__ */ new Set();
@@ -21852,7 +22404,7 @@ function detectDerivedCycles(fn, _scopeResult) {
21852
22404
  for (const dep of rawDeps) {
21853
22405
  const base = deSSAVarName(dep.split(".")[0] ?? dep);
21854
22406
  const depInfo = declared.get(base);
21855
- if (depInfo && depInfo.declaredHere && !depInfo.isState && (depInfo.count ?? 0) === 1) {
22407
+ if (depInfo && depInfo.declaredHere && !depInfo.isSignal && !depInfo.isStore && (depInfo.count ?? 0) === 1) {
21856
22408
  deps.add(base);
21857
22409
  }
21858
22410
  }
@@ -22477,6 +23029,12 @@ function extractKeyFromMapCallback(callback) {
22477
23029
  if (!jsx) return void 0;
22478
23030
  return extractKeyFromAttributes(jsx.attributes);
22479
23031
  }
23032
+ function buildOutputParams(fn, t4) {
23033
+ if (fn.rawParams && fn.rawParams.length > 0) {
23034
+ return fn.rawParams.map((param) => t4.cloneNode(param, true));
23035
+ }
23036
+ return fn.params.map((p) => t4.identifier(deSSAVarName(p.name)));
23037
+ }
22480
23038
  function lowerTrackedExpression(expr, ctx) {
22481
23039
  const regionOverride = ctx.inReturn && ctx.currentFnIsHook ? null : ctx.currentRegion ?? (ctx.trackedVars.size ? {
22482
23040
  id: -1,
@@ -22558,20 +23116,28 @@ function lowerInstruction(instr, ctx) {
22558
23116
  }
22559
23117
  }
22560
23118
  if (ctx.signalVars?.has(baseName2)) {
23119
+ ctx.currentAssignmentName = baseName2;
23120
+ const loweredValue = (() => {
23121
+ try {
23122
+ return lowerTrackedExpression(instr.value, ctx);
23123
+ } finally {
23124
+ ctx.currentAssignmentName = void 0;
23125
+ }
23126
+ })();
22561
23127
  return applyLoc(
22562
- t4.expressionStatement(
22563
- t4.callExpression(t4.identifier(baseName2), [lowerTrackedExpression(instr.value, ctx)])
22564
- )
23128
+ t4.expressionStatement(t4.callExpression(t4.identifier(baseName2), [loweredValue]))
22565
23129
  );
22566
23130
  }
23131
+ ctx.currentAssignmentName = baseName2;
23132
+ const loweredAssign = (() => {
23133
+ try {
23134
+ return lowerTrackedExpression(instr.value, ctx);
23135
+ } finally {
23136
+ ctx.currentAssignmentName = void 0;
23137
+ }
23138
+ })();
22567
23139
  return applyLoc(
22568
- t4.expressionStatement(
22569
- t4.assignmentExpression(
22570
- "=",
22571
- t4.identifier(baseName2),
22572
- lowerTrackedExpression(instr.value, ctx)
22573
- )
22574
- )
23140
+ t4.expressionStatement(t4.assignmentExpression("=", t4.identifier(baseName2), loweredAssign))
22575
23141
  );
22576
23142
  }
22577
23143
  if (instr.kind === "Expression") {
@@ -22589,16 +23155,18 @@ function lowerTerminator(block, ctx) {
22589
23155
  const applyLoc = (stmts) => stmts.map((stmt) => setNodeLoc(stmt, baseLoc));
22590
23156
  switch (block.terminator.kind) {
22591
23157
  case "Return": {
22592
- const prevRegion = ctx.currentRegion;
22593
23158
  const preserveAccessors = ctx.currentFnIsHook;
22594
- if (preserveAccessors) ctx.currentRegion = void 0;
23159
+ const prevHookFlag = ctx.currentFnIsHook;
23160
+ if (preserveAccessors) ctx.currentFnIsHook = false;
22595
23161
  ctx.inReturn = true;
22596
23162
  let retExpr = block.terminator.argument ? lowerTrackedExpression(block.terminator.argument, ctx) : null;
23163
+ ctx.inReturn = false;
23164
+ if (preserveAccessors) {
23165
+ ctx.currentFnIsHook = prevHookFlag;
23166
+ }
22597
23167
  if (preserveAccessors && retExpr) {
22598
23168
  retExpr = unwrapAccessorCalls(retExpr, ctx);
22599
23169
  }
22600
- ctx.inReturn = false;
22601
- ctx.currentRegion = prevRegion;
22602
23170
  return applyLoc([t4.returnStatement(retExpr)]);
22603
23171
  }
22604
23172
  case "Throw":
@@ -22758,17 +23326,253 @@ function collectDeclaredNames(body, t4) {
22758
23326
  }
22759
23327
  return declared;
22760
23328
  }
22761
- function collectRuntimeImportNames(body, t4) {
22762
- const runtimeModules = /* @__PURE__ */ new Set([RUNTIME_MODULE, "@fictjs/runtime", "fict"]);
22763
- const imported = /* @__PURE__ */ new Set();
23329
+ var RUNTIME_IMPORT_MODULES = /* @__PURE__ */ new Set([
23330
+ RUNTIME_MODULE,
23331
+ "@fictjs/runtime",
23332
+ "@fictjs/runtime/advanced",
23333
+ "fict",
23334
+ "fict/advanced"
23335
+ ]);
23336
+ function collectRuntimeImports(body, t4) {
23337
+ const names = /* @__PURE__ */ new Set();
23338
+ const importMap = /* @__PURE__ */ new Map();
23339
+ const namespaces = /* @__PURE__ */ new Set();
23340
+ for (const stmt of body) {
23341
+ if (!t4.isImportDeclaration(stmt)) continue;
23342
+ if (stmt.importKind === "type") continue;
23343
+ if (!RUNTIME_IMPORT_MODULES.has(stmt.source.value)) continue;
23344
+ for (const spec of stmt.specifiers) {
23345
+ if (t4.isImportSpecifier(spec) && spec.importKind === "type") {
23346
+ continue;
23347
+ }
23348
+ names.add(spec.local.name);
23349
+ if (t4.isImportSpecifier(spec)) {
23350
+ const importedName = t4.isIdentifier(spec.imported) ? spec.imported.name : spec.imported.value;
23351
+ importMap.set(spec.local.name, importedName);
23352
+ } else if (t4.isImportNamespaceSpecifier(spec) || t4.isImportDefaultSpecifier(spec)) {
23353
+ namespaces.add(spec.local.name);
23354
+ }
23355
+ }
23356
+ }
23357
+ return { names, importMap, namespaces };
23358
+ }
23359
+ var RUNTIME_REACTIVE_CREATORS = /* @__PURE__ */ new Map([
23360
+ ["createSignal", "signal"],
23361
+ ["createStore", "store"],
23362
+ ["createMemo", "memo"]
23363
+ ]);
23364
+ function isNameShadowed(name, ctx) {
23365
+ return !!(ctx.shadowedNames?.has(name) || ctx.localDeclaredNames?.has(name));
23366
+ }
23367
+ function getRuntimeImportedKind(name, ctx) {
23368
+ if (isNameShadowed(name, ctx)) return null;
23369
+ const imported = ctx.moduleRuntimeImportMap?.get(name);
23370
+ if (!imported) return null;
23371
+ return RUNTIME_REACTIVE_CREATORS.get(imported) ?? null;
23372
+ }
23373
+ function getRuntimeMemberKind(expr, ctx) {
23374
+ if (expr.kind !== "MemberExpression" && expr.kind !== "OptionalMemberExpression") return null;
23375
+ if (expr.object.kind !== "Identifier") return null;
23376
+ const objectName = deSSAVarName(expr.object.name);
23377
+ if (isNameShadowed(objectName, ctx)) return null;
23378
+ if (!ctx.moduleRuntimeNamespaceImports?.has(objectName)) return null;
23379
+ const propName = getStaticPropName(expr.property, expr.computed);
23380
+ if (typeof propName !== "string") return null;
23381
+ return RUNTIME_REACTIVE_CREATORS.get(propName) ?? null;
23382
+ }
23383
+ function getReactiveCallKind(expr, ctx) {
23384
+ if (expr.kind !== "CallExpression" && expr.kind !== "OptionalCallExpression") return null;
23385
+ const callee = expr.callee;
23386
+ if (callee.kind === "Identifier") {
23387
+ const name = deSSAVarName(callee.name);
23388
+ if (ctx.stateMacroNames?.has(name)) return "signal";
23389
+ if (name === "$store") return "store";
23390
+ if (ctx.memoMacroNames?.has(name)) return "memo";
23391
+ return getRuntimeImportedKind(name, ctx);
23392
+ }
23393
+ return getRuntimeMemberKind(callee, ctx);
23394
+ }
23395
+ function getReactiveCallKindFromBabel(callExpr, ctx, t4) {
23396
+ const callee = callExpr.callee;
23397
+ if (t4.isIdentifier(callee)) {
23398
+ const name = callee.name;
23399
+ if (ctx.stateMacroNames?.has(name)) return "signal";
23400
+ if (name === "$store") return "store";
23401
+ if (ctx.memoMacroNames?.has(name)) return "memo";
23402
+ return getRuntimeImportedKind(name, ctx);
23403
+ }
23404
+ if (t4.isMemberExpression(callee) || t4.isOptionalMemberExpression(callee)) {
23405
+ const memberCallee = callee;
23406
+ if (!t4.isIdentifier(memberCallee.object)) return null;
23407
+ const objectName = memberCallee.object.name;
23408
+ if (isNameShadowed(objectName, ctx)) return null;
23409
+ if (!ctx.moduleRuntimeNamespaceImports?.has(objectName)) return null;
23410
+ const propName = t4.isIdentifier(memberCallee.property) ? memberCallee.property.name : t4.isStringLiteral(memberCallee.property) ? memberCallee.property.value : t4.isNumericLiteral(memberCallee.property) ? String(memberCallee.property.value) : null;
23411
+ if (!propName) return null;
23412
+ return RUNTIME_REACTIVE_CREATORS.get(propName) ?? null;
23413
+ }
23414
+ return null;
23415
+ }
23416
+ function addImportedReactiveBinding(name, kind, ctx) {
23417
+ const base = deSSAVarName(name);
23418
+ if (kind === "signal") {
23419
+ ctx.signalVars?.add(base);
23420
+ } else if (kind === "store") {
23421
+ ctx.storeVars?.add(base);
23422
+ } else if (kind === "memo") {
23423
+ ctx.memoVars?.add(base);
23424
+ }
23425
+ ctx.trackedVars.add(base);
23426
+ }
23427
+ function applyImportedReactiveMetadata(body, ctx, t4, options) {
23428
+ const importer = options?.filename;
23429
+ const namespaces = /* @__PURE__ */ new Map();
22764
23430
  for (const stmt of body) {
22765
23431
  if (!t4.isImportDeclaration(stmt)) continue;
22766
- if (!runtimeModules.has(stmt.source.value)) continue;
23432
+ const meta = resolveModuleMetadata(stmt.source.value, importer, options);
23433
+ if (!meta) continue;
22767
23434
  for (const spec of stmt.specifiers) {
22768
- imported.add(spec.local.name);
23435
+ if (t4.isImportSpecifier(spec)) {
23436
+ const importedName = t4.isIdentifier(spec.imported) ? spec.imported.name : String(spec.imported.value);
23437
+ const localName = spec.local.name;
23438
+ const kind = meta.exports[importedName];
23439
+ if (kind) {
23440
+ addImportedReactiveBinding(localName, kind, ctx);
23441
+ }
23442
+ const hookInfo = meta.hooks?.[importedName];
23443
+ if (hookInfo) {
23444
+ ctx.hookReturnInfo = ctx.hookReturnInfo ?? /* @__PURE__ */ new Map();
23445
+ ctx.hookReturnInfo.set(localName, deserializeHookReturnInfo(hookInfo));
23446
+ }
23447
+ continue;
23448
+ }
23449
+ if (t4.isImportDefaultSpecifier(spec)) {
23450
+ const localName = spec.local.name;
23451
+ const kind = meta.exports.default;
23452
+ if (kind) {
23453
+ addImportedReactiveBinding(localName, kind, ctx);
23454
+ }
23455
+ const hookInfo = meta.hooks?.default;
23456
+ if (hookInfo) {
23457
+ ctx.hookReturnInfo = ctx.hookReturnInfo ?? /* @__PURE__ */ new Map();
23458
+ ctx.hookReturnInfo.set(localName, deserializeHookReturnInfo(hookInfo));
23459
+ }
23460
+ continue;
23461
+ }
23462
+ if (t4.isImportNamespaceSpecifier(spec)) {
23463
+ namespaces.set(spec.local.name, meta);
23464
+ }
22769
23465
  }
22770
23466
  }
22771
- return imported;
23467
+ if (namespaces.size > 0) {
23468
+ ctx.importedNamespaces = namespaces;
23469
+ }
23470
+ }
23471
+ function classifyReactiveExport(name, ctx) {
23472
+ const base = deSSAVarName(name);
23473
+ if (ctx.storeVars?.has(base)) return "store";
23474
+ if (ctx.signalVars?.has(base)) return "signal";
23475
+ if (ctx.aliasVars?.has(base)) return "signal";
23476
+ if (ctx.memoVars?.has(base)) return "memo";
23477
+ return null;
23478
+ }
23479
+ function buildModuleReactiveMetadata(body, ctx, t4, options) {
23480
+ const metadata = { exports: {} };
23481
+ const hookExports = {};
23482
+ const addExport = (exportName, localName) => {
23483
+ const kind = classifyReactiveExport(localName, ctx);
23484
+ if (kind) {
23485
+ metadata.exports[exportName] = kind;
23486
+ }
23487
+ const hookInfo = getHookReturnInfo(localName, ctx);
23488
+ if (hookInfo) {
23489
+ hookExports[exportName] = serializeHookReturnInfo(hookInfo);
23490
+ }
23491
+ };
23492
+ const addExportFromSource = (source, importedName, exportName) => {
23493
+ const sourceMeta = resolveModuleMetadata(source, options?.filename, options);
23494
+ if (!sourceMeta) return;
23495
+ const kind = sourceMeta.exports[importedName];
23496
+ if (kind) {
23497
+ metadata.exports[exportName] = kind;
23498
+ }
23499
+ const hookInfo = sourceMeta.hooks?.[importedName];
23500
+ if (hookInfo) {
23501
+ hookExports[exportName] = hookInfo;
23502
+ }
23503
+ };
23504
+ const addDefaultExportKind = (kind) => {
23505
+ if (kind) {
23506
+ metadata.exports.default = kind;
23507
+ }
23508
+ };
23509
+ for (const stmt of body) {
23510
+ if (t4.isExportNamedDeclaration(stmt)) {
23511
+ if (stmt.source && stmt.specifiers.length > 0) {
23512
+ for (const spec of stmt.specifiers) {
23513
+ if (!t4.isExportSpecifier(spec)) continue;
23514
+ const importedName = spec.local.name;
23515
+ const exportName = t4.isIdentifier(spec.exported) ? spec.exported.name : t4.isStringLiteral(spec.exported) ? spec.exported.value : String(spec.exported);
23516
+ addExportFromSource(stmt.source.value, importedName, exportName);
23517
+ }
23518
+ continue;
23519
+ }
23520
+ if (stmt.declaration) {
23521
+ const decl = stmt.declaration;
23522
+ if (t4.isFunctionDeclaration(decl) && decl.id) {
23523
+ addExport(decl.id.name, decl.id.name);
23524
+ } else if (t4.isClassDeclaration(decl) && decl.id) {
23525
+ addExport(decl.id.name, decl.id.name);
23526
+ } else if (t4.isVariableDeclaration(decl)) {
23527
+ for (const v of decl.declarations) {
23528
+ if (t4.isIdentifier(v.id)) {
23529
+ addExport(v.id.name, v.id.name);
23530
+ }
23531
+ }
23532
+ }
23533
+ } else {
23534
+ for (const spec of stmt.specifiers) {
23535
+ if (!t4.isExportSpecifier(spec)) continue;
23536
+ const localName = spec.local.name;
23537
+ const exportName = t4.isIdentifier(spec.exported) ? spec.exported.name : t4.isStringLiteral(spec.exported) ? spec.exported.value : String(spec.exported);
23538
+ addExport(exportName, localName);
23539
+ }
23540
+ }
23541
+ continue;
23542
+ }
23543
+ if (t4.isExportAllDeclaration(stmt)) {
23544
+ const sourceMeta = resolveModuleMetadata(stmt.source.value, options?.filename, options);
23545
+ if (!sourceMeta) continue;
23546
+ for (const [exportName, kind] of Object.entries(sourceMeta.exports)) {
23547
+ if (exportName === "default") continue;
23548
+ metadata.exports[exportName] = kind;
23549
+ }
23550
+ if (sourceMeta.hooks) {
23551
+ for (const [exportName, info] of Object.entries(sourceMeta.hooks)) {
23552
+ if (exportName === "default") continue;
23553
+ hookExports[exportName] = info;
23554
+ }
23555
+ }
23556
+ continue;
23557
+ }
23558
+ if (t4.isExportDefaultDeclaration(stmt)) {
23559
+ const decl = stmt.declaration;
23560
+ if (t4.isIdentifier(decl)) {
23561
+ addExport("default", decl.name);
23562
+ } else if (t4.isFunctionDeclaration(decl) && decl.id) {
23563
+ addExport("default", decl.id.name);
23564
+ } else if (t4.isClassDeclaration(decl) && decl.id) {
23565
+ addExport("default", decl.id.name);
23566
+ } else if (t4.isCallExpression(decl) || t4.isOptionalCallExpression(decl)) {
23567
+ const kind = getReactiveCallKindFromBabel(decl, ctx, t4);
23568
+ addDefaultExportKind(kind);
23569
+ }
23570
+ }
23571
+ }
23572
+ if (Object.keys(hookExports).length > 0) {
23573
+ metadata.hooks = hookExports;
23574
+ }
23575
+ return metadata;
22772
23576
  }
22773
23577
  function collectLocalDeclaredNames(params, blocks, t4) {
22774
23578
  const declared = /* @__PURE__ */ new Set();
@@ -22978,6 +23782,45 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
22978
23782
  return lowerBlocksToStatements(blocks);
22979
23783
  }
22980
23784
  };
23785
+ const lowerReactiveScopeExpression = (fnExpr) => {
23786
+ if (!fnExpr.reactiveScope) return null;
23787
+ const blocks = Array.isArray(fnExpr.body) ? fnExpr.body : [
23788
+ {
23789
+ id: 0,
23790
+ instructions: [],
23791
+ terminator: {
23792
+ kind: "Return",
23793
+ argument: fnExpr.body
23794
+ }
23795
+ }
23796
+ ];
23797
+ const fn = {
23798
+ params: fnExpr.params,
23799
+ blocks,
23800
+ meta: {
23801
+ fromExpression: true,
23802
+ isArrow: fnExpr.kind === "ArrowFunction",
23803
+ hasExpressionBody: fnExpr.kind === "ArrowFunction" && fnExpr.isExpression,
23804
+ isAsync: fnExpr.isAsync ?? false
23805
+ },
23806
+ loc: fnExpr.loc ?? null
23807
+ };
23808
+ const lowered = lowerFunctionWithRegions(fn, ctx, { forceHookContext: true });
23809
+ if (!lowered) return null;
23810
+ const params = lowered.params;
23811
+ if (fnExpr.kind === "ArrowFunction") {
23812
+ const arrow = t4.arrowFunctionExpression(params, lowered.body);
23813
+ arrow.async = lowered.async;
23814
+ return arrow;
23815
+ }
23816
+ const fnExprAst = t4.functionExpression(
23817
+ fnExpr.name ? t4.identifier(deSSAVarName(fnExpr.name)) : null,
23818
+ params,
23819
+ lowered.body
23820
+ );
23821
+ fnExprAst.async = lowered.async;
23822
+ return fnExprAst;
23823
+ };
22981
23824
  switch (expr.kind) {
22982
23825
  case "Identifier":
22983
23826
  return t4.identifier(deSSAVarName(expr.name));
@@ -22999,6 +23842,22 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
22999
23842
  case "CallExpression": {
23000
23843
  if (expr.callee.kind === "Identifier" && expr.callee.name === "$state") {
23001
23844
  const args = lowerCallArguments(expr.arguments);
23845
+ const includeDevtools = ctx.options?.dev !== false;
23846
+ if (includeDevtools) {
23847
+ const options = [];
23848
+ if (ctx.currentAssignmentName) {
23849
+ options.push(
23850
+ t4.objectProperty(t4.identifier("name"), t4.stringLiteral(ctx.currentAssignmentName))
23851
+ );
23852
+ }
23853
+ if (expr.loc) {
23854
+ const source = `${ctx.options?.filename ?? ""}:${expr.loc.start.line}:${expr.loc.start.column}`;
23855
+ options.push(t4.objectProperty(t4.identifier("devToolsSource"), t4.stringLiteral(source)));
23856
+ }
23857
+ if (options.length > 0) {
23858
+ args.push(t4.objectExpression(options));
23859
+ }
23860
+ }
23002
23861
  if (ctx.inModule) {
23003
23862
  ctx.helpersUsed.add("signal");
23004
23863
  return t4.callExpression(t4.identifier(RUNTIME_ALIASES.signal), args);
@@ -23010,6 +23869,34 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23010
23869
  ...args
23011
23870
  ]);
23012
23871
  }
23872
+ if (expr.callee.kind === "Identifier") {
23873
+ const memoCalleeName = deSSAVarName(expr.callee.name);
23874
+ if (ctx.memoMacroNames?.has(memoCalleeName)) {
23875
+ const args = lowerCallArguments(expr.arguments);
23876
+ const includeDevtools = ctx.options?.dev !== false;
23877
+ if (includeDevtools && expr.arguments.length === 1) {
23878
+ const options = [];
23879
+ if (ctx.currentAssignmentName) {
23880
+ options.push(
23881
+ t4.objectProperty(t4.identifier("name"), t4.stringLiteral(ctx.currentAssignmentName))
23882
+ );
23883
+ }
23884
+ if (expr.loc) {
23885
+ const source = `${ctx.options?.filename ?? ""}:${expr.loc.start.line}:${expr.loc.start.column}`;
23886
+ options.push(
23887
+ t4.objectProperty(t4.identifier("devToolsSource"), t4.stringLiteral(source))
23888
+ );
23889
+ }
23890
+ if (options.length > 0) {
23891
+ args.push(t4.objectExpression(options));
23892
+ }
23893
+ }
23894
+ return t4.callExpression(
23895
+ lowerExpression(expr.callee, ctx),
23896
+ args
23897
+ );
23898
+ }
23899
+ }
23013
23900
  if (expr.callee.kind === "Identifier" && expr.callee.name === "$effect") {
23014
23901
  const args = lowerCallArguments(
23015
23902
  expr.arguments,
@@ -23078,6 +23965,24 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23078
23965
  if (matchesListKeyPattern(expr, ctx)) {
23079
23966
  return t4.identifier(ctx.listKeyParamName);
23080
23967
  }
23968
+ if (expr.object.kind === "Identifier") {
23969
+ const nsMeta = ctx.importedNamespaces?.get(deSSAVarName(expr.object.name));
23970
+ if (nsMeta) {
23971
+ const propName = getStaticPropName(expr.property, expr.computed);
23972
+ if (typeof propName === "string") {
23973
+ const kind = nsMeta.exports[propName];
23974
+ if (kind === "signal" || kind === "memo") {
23975
+ const member = t4.memberExpression(
23976
+ t4.identifier(deSSAVarName(expr.object.name)),
23977
+ expr.computed ? t4.stringLiteral(propName) : t4.identifier(propName),
23978
+ expr.computed,
23979
+ expr.optional
23980
+ );
23981
+ return t4.callExpression(member, []);
23982
+ }
23983
+ }
23984
+ }
23985
+ }
23081
23986
  if (expr.object.kind === "Identifier" && ctx.hookResultVarMap?.has(deSSAVarName(expr.object.name))) {
23082
23987
  const hookName = ctx.hookResultVarMap.get(deSSAVarName(expr.object.name));
23083
23988
  const info = getHookReturnInfo(hookName, ctx);
@@ -23170,6 +24075,8 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23170
24075
  case "JSXElement":
23171
24076
  return lowerJSXElement(expr, ctx);
23172
24077
  case "ArrowFunction": {
24078
+ const reactiveLowered = lowerReactiveScopeExpression(expr);
24079
+ if (reactiveLowered) return reactiveLowered;
23173
24080
  const paramIds = mapParams(expr.params);
23174
24081
  const shadowed = new Set(expr.params.map((p) => deSSAVarName(p.name)));
23175
24082
  const localDeclared = collectLocalDeclaredNames(
@@ -23216,6 +24123,8 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23216
24123
  );
23217
24124
  }
23218
24125
  case "FunctionExpression": {
24126
+ const reactiveLowered = lowerReactiveScopeExpression(expr);
24127
+ if (reactiveLowered) return reactiveLowered;
23219
24128
  const paramIds = mapParams(expr.params);
23220
24129
  const shadowed = new Set(expr.params.map((p) => deSSAVarName(p.name)));
23221
24130
  const localDeclared = collectLocalDeclaredNames(expr.params, expr.body, t4);
@@ -23568,9 +24477,21 @@ function collectExpressionDependencies(expr, deps) {
23568
24477
  deps.add(deSSAVarName(expr.name));
23569
24478
  return;
23570
24479
  }
24480
+ if (expr.kind === "ArrowFunction") {
24481
+ if (expr.isExpression && !Array.isArray(expr.body)) {
24482
+ collectExpressionDependencies(expr.body, deps);
24483
+ } else if (Array.isArray(expr.body)) {
24484
+ collectBlockDependencies(expr.body, deps);
24485
+ }
24486
+ return;
24487
+ }
24488
+ if (expr.kind === "FunctionExpression") {
24489
+ collectBlockDependencies(expr.body, deps);
24490
+ return;
24491
+ }
23571
24492
  if (expr.kind === "MemberExpression") {
23572
- const path = getMemberDependencyPath(expr);
23573
- if (path) deps.add(path);
24493
+ const path2 = getMemberDependencyPath(expr);
24494
+ if (path2) deps.add(path2);
23574
24495
  collectExpressionDependencies(expr.object, deps);
23575
24496
  if (expr.computed && expr.property.kind !== "Literal") {
23576
24497
  collectExpressionDependencies(expr.property, deps);
@@ -23616,6 +24537,51 @@ function collectExpressionDependencies(expr, deps) {
23616
24537
  return;
23617
24538
  }
23618
24539
  }
24540
+ function collectBlockDependencies(blocks, deps) {
24541
+ for (const block of blocks) {
24542
+ for (const instr of block.instructions) {
24543
+ switch (instr.kind) {
24544
+ case "Assign":
24545
+ case "Expression":
24546
+ collectExpressionDependencies(instr.value, deps);
24547
+ break;
24548
+ case "Phi":
24549
+ for (const source of instr.sources) {
24550
+ deps.add(deSSAVarName(source.id.name));
24551
+ }
24552
+ break;
24553
+ default:
24554
+ break;
24555
+ }
24556
+ }
24557
+ const term = block.terminator;
24558
+ switch (term.kind) {
24559
+ case "Return":
24560
+ if (term.argument) collectExpressionDependencies(term.argument, deps);
24561
+ break;
24562
+ case "Throw":
24563
+ collectExpressionDependencies(term.argument, deps);
24564
+ break;
24565
+ case "Branch":
24566
+ collectExpressionDependencies(term.test, deps);
24567
+ break;
24568
+ case "Switch":
24569
+ collectExpressionDependencies(term.discriminant, deps);
24570
+ for (const c of term.cases) {
24571
+ if (c.test) collectExpressionDependencies(c.test, deps);
24572
+ }
24573
+ break;
24574
+ case "ForOf":
24575
+ collectExpressionDependencies(term.iterable, deps);
24576
+ break;
24577
+ case "ForIn":
24578
+ collectExpressionDependencies(term.object, deps);
24579
+ break;
24580
+ default:
24581
+ break;
24582
+ }
24583
+ }
24584
+ }
23619
24585
  function normalizeDependencyKey2(name) {
23620
24586
  return name.split(".").map((part) => deSSAVarName(part)).join(".");
23621
24587
  }
@@ -23755,9 +24721,9 @@ function replaceIdentifiersWithOverrides(node, overrides, t4, parentKind, parent
23755
24721
  if (!skipCurrentNode && (t4.isMemberExpression(node) || t4.isOptionalMemberExpression(node))) {
23756
24722
  const propertyNode = node.property;
23757
24723
  const isDynamicComputed = (node.computed ?? false) && !t4.isStringLiteral(propertyNode) && !t4.isNumericLiteral(propertyNode);
23758
- const path = getDependencyPathFromNode(node, t4);
23759
- const normalized = path ? normalizeDependencyKey2(path) : null;
23760
- const override = normalized && overrides[normalized] || (path ? overrides[path] : void 0);
24724
+ const path2 = getDependencyPathFromNode(node, t4);
24725
+ const normalized = path2 ? normalizeDependencyKey2(path2) : null;
24726
+ const override = normalized && overrides[normalized] || (path2 ? overrides[path2] : void 0);
23761
24727
  if (override && !isCallTarget && !isDynamicComputed) {
23762
24728
  const replacement = override();
23763
24729
  Object.assign(node, replacement);
@@ -23792,6 +24758,9 @@ function replaceIdentifiersWithOverrides(node, overrides, t4, parentKind, parent
23792
24758
  }
23793
24759
  return;
23794
24760
  }
24761
+ const isMethodCallMember = (t4.isMemberExpression(node) || t4.isOptionalMemberExpression(node)) && !node.computed && t4.isIdentifier(node.property) && ["call", "apply", "bind"].includes(
24762
+ node.property.name
24763
+ );
23795
24764
  for (const key of Object.keys(node)) {
23796
24765
  if (key === "type" || key === "loc" || key === "start" || key === "end") continue;
23797
24766
  if (t4.isObjectProperty(node) && key === "key" && !node.computed) {
@@ -23800,6 +24769,9 @@ function replaceIdentifiersWithOverrides(node, overrides, t4, parentKind, parent
23800
24769
  if ((t4.isMemberExpression(node) || t4.isOptionalMemberExpression(node)) && key === "property" && !node.computed) {
23801
24770
  continue;
23802
24771
  }
24772
+ if (isMethodCallMember && key === "object") {
24773
+ continue;
24774
+ }
23803
24775
  const value = node[key];
23804
24776
  if (Array.isArray(value)) {
23805
24777
  for (const item of value) {
@@ -24032,7 +25004,13 @@ function normalizeHIRAttrName(name) {
24032
25004
  if (name === "htmlFor") return "for";
24033
25005
  return name;
24034
25006
  }
24035
- function extractHIRStaticHtml(jsx, ctx, parentPath = []) {
25007
+ function resolveNamespaceContext(tagName, parentNamespace) {
25008
+ if (tagName === "svg") return "svg";
25009
+ if (tagName === "math") return "mathml";
25010
+ if (tagName === "foreignObject" && parentNamespace === "svg") return null;
25011
+ return parentNamespace;
25012
+ }
25013
+ function extractHIRStaticHtml(jsx, ctx, parentPath = [], namespace = null) {
24036
25014
  if (jsx.isComponent || typeof jsx.tagName !== "string") {
24037
25015
  return {
24038
25016
  html: "<!---->",
@@ -24046,6 +25024,7 @@ function extractHIRStaticHtml(jsx, ctx, parentPath = []) {
24046
25024
  };
24047
25025
  }
24048
25026
  const tagName = jsx.tagName;
25027
+ const resolvedNamespace = resolveNamespaceContext(tagName, namespace);
24049
25028
  let html = `<${tagName}`;
24050
25029
  const bindings = [];
24051
25030
  for (const attr of jsx.attributes) {
@@ -24145,7 +25124,7 @@ function extractHIRStaticHtml(jsx, ctx, parentPath = []) {
24145
25124
  }
24146
25125
  } else if (child.kind === "element") {
24147
25126
  const childPath = [...parentPath, childIndex];
24148
- const childResult = extractHIRStaticHtml(child.value, ctx, childPath);
25127
+ const childResult = extractHIRStaticHtml(child.value, ctx, childPath, resolvedNamespace);
24149
25128
  html += childResult.html;
24150
25129
  bindings.push(...childResult.bindings);
24151
25130
  childIndex++;
@@ -24156,26 +25135,42 @@ function extractHIRStaticHtml(jsx, ctx, parentPath = []) {
24156
25135
  bindings.push({
24157
25136
  type: "text",
24158
25137
  path: [...parentPath, childIndex],
24159
- expr: child.value
25138
+ expr: child.value,
25139
+ // Track namespace for dynamic text bindings
25140
+ namespace: resolvedNamespace
24160
25141
  });
24161
25142
  } else {
24162
25143
  html += "<!---->";
24163
25144
  bindings.push({
24164
25145
  type: "child",
24165
25146
  path: [...parentPath, childIndex],
24166
- expr: child.value
25147
+ expr: child.value,
25148
+ // Track namespace for dynamic child bindings
25149
+ namespace: resolvedNamespace
24167
25150
  });
24168
25151
  }
24169
25152
  childIndex++;
24170
25153
  }
24171
25154
  }
24172
25155
  html += `</${tagName}>`;
24173
- return { html, bindings };
25156
+ const needsSVG = namespace === "svg" && tagName !== "svg";
25157
+ const needsMathML = namespace === "mathml" && tagName !== "math";
25158
+ return {
25159
+ html,
25160
+ bindings,
25161
+ isSVG: needsSVG || void 0,
25162
+ isMathML: needsMathML || void 0
25163
+ };
24174
25164
  }
24175
25165
  function lowerIntrinsicElement(jsx, ctx) {
24176
25166
  const { t: t4 } = ctx;
24177
25167
  const statements = [];
24178
- const { html, bindings } = extractHIRStaticHtml(jsx, ctx);
25168
+ const { html, bindings, isSVG, isMathML } = extractHIRStaticHtml(
25169
+ jsx,
25170
+ ctx,
25171
+ [],
25172
+ ctx.namespaceContext ?? null
25173
+ );
24179
25174
  const allDeps = /* @__PURE__ */ new Set();
24180
25175
  for (const binding of bindings) {
24181
25176
  if (binding.expr) collectExpressionDependencies(binding.expr, allDeps);
@@ -24201,7 +25196,7 @@ function lowerIntrinsicElement(jsx, ctx) {
24201
25196
  ctx.needsCtx = true;
24202
25197
  }
24203
25198
  }
24204
- const hoistedTmplId = getOrCreateHoistedTemplate(html, ctx);
25199
+ const hoistedTmplId = getOrCreateHoistedTemplate(html, ctx, isSVG, isMathML);
24205
25200
  const rootId = genTemp(ctx, "root");
24206
25201
  if (hoistedTmplId) {
24207
25202
  statements.push(
@@ -24212,11 +25207,19 @@ function lowerIntrinsicElement(jsx, ctx) {
24212
25207
  } else {
24213
25208
  ctx.helpersUsed.add("template");
24214
25209
  const tmplId = genTemp(ctx, "tmpl");
25210
+ const templateArgs = [t4.stringLiteral(html)];
25211
+ if (isSVG || isMathML) {
25212
+ templateArgs.push(t4.identifier("undefined"));
25213
+ templateArgs.push(isSVG ? t4.booleanLiteral(true) : t4.identifier("undefined"));
25214
+ if (isMathML) {
25215
+ templateArgs.push(t4.booleanLiteral(true));
25216
+ }
25217
+ }
24215
25218
  statements.push(
24216
25219
  t4.variableDeclaration("const", [
24217
25220
  t4.variableDeclarator(
24218
25221
  tmplId,
24219
- t4.callExpression(t4.identifier(RUNTIME_ALIASES.template), [t4.stringLiteral(html)])
25222
+ t4.callExpression(t4.identifier(RUNTIME_ALIASES.template), templateArgs)
24220
25223
  )
24221
25224
  ])
24222
25225
  );
@@ -24229,6 +25232,12 @@ function lowerIntrinsicElement(jsx, ctx) {
24229
25232
  const elId = rootId;
24230
25233
  const nodeCache = /* @__PURE__ */ new Map();
24231
25234
  nodeCache.set("", elId);
25235
+ const tagName = typeof jsx.tagName === "string" ? jsx.tagName : null;
25236
+ const prevNamespace = ctx.namespaceContext;
25237
+ if (tagName) {
25238
+ const elementNamespace = resolveNamespaceContext(tagName, ctx.namespaceContext ?? null);
25239
+ ctx.namespaceContext = elementNamespace;
25240
+ }
24232
25241
  const pathStatements = [];
24233
25242
  for (const binding of bindings) {
24234
25243
  resolveHIRBindingPath(binding.path, nodeCache, pathStatements, ctx);
@@ -24243,23 +25252,17 @@ function lowerIntrinsicElement(jsx, ctx) {
24243
25252
  const hirDataBinding = isDelegated && binding.expr ? extractDelegatedEventDataFromHIR(binding.expr, ctx) : null;
24244
25253
  if (hirDataBinding) {
24245
25254
  ctx.delegatedEventsUsed?.add(eventName);
24246
- const handlerExpr = lowerExpression(hirDataBinding.handler, ctx);
25255
+ const handlerExpr = hirDataBinding.handler.kind === "Identifier" ? t4.identifier(hirDataBinding.handler.name) : lowerExpression(hirDataBinding.handler, ctx);
24247
25256
  const dataExpr = lowerDomExpression(hirDataBinding.data, ctx, containingRegion, {
24248
25257
  skipHookAccessors: false,
24249
25258
  skipRegionRootOverride: true
24250
25259
  });
24251
- const dataParam = t4.identifier("__data");
24252
- const eventParam = t4.identifier("_e");
24253
- const wrappedHandler = t4.arrowFunctionExpression(
24254
- [dataParam, eventParam],
24255
- t4.callExpression(handlerExpr, [dataParam])
24256
- );
24257
25260
  statements.push(
24258
25261
  t4.expressionStatement(
24259
25262
  t4.assignmentExpression(
24260
25263
  "=",
24261
25264
  t4.memberExpression(targetId, t4.identifier(`$$${eventName}`)),
24262
- wrappedHandler
25265
+ handlerExpr
24263
25266
  )
24264
25267
  )
24265
25268
  );
@@ -24293,16 +25296,54 @@ function lowerIntrinsicElement(jsx, ctx) {
24293
25296
  if (fn.params.length > 0) return fn;
24294
25297
  return t4.functionExpression(fn.id, [eventParam], fn.body, fn.generator, fn.async);
24295
25298
  }
24296
- return t4.arrowFunctionExpression(
25299
+ if (t4.isIdentifier(fn) || t4.isMemberExpression(fn)) {
25300
+ return fn;
25301
+ }
25302
+ if (t4.isCallExpression(fn) && fn.arguments.length === 0 && (t4.isIdentifier(fn.callee) || t4.isMemberExpression(fn.callee))) {
25303
+ return fn.callee;
25304
+ }
25305
+ return t4.functionExpression(
25306
+ null,
24297
25307
  [eventParam],
24298
- t4.callExpression(fn, [eventParam])
25308
+ t4.blockStatement([
25309
+ t4.returnStatement(
25310
+ t4.callExpression(
25311
+ t4.memberExpression(fn, t4.identifier("call")),
25312
+ [t4.thisExpression(), eventParam]
25313
+ )
25314
+ )
25315
+ ])
24299
25316
  );
24300
25317
  };
24301
25318
  const handlerExpr = !isFn && shouldWrapHandler ? t4.arrowFunctionExpression([], valueExpr) : ensureHandlerParam(valueExpr);
24302
- const dataBinding = isDelegated && !shouldWrapHandler ? extractDelegatedEventData(valueExpr, t4) : null;
25319
+ let dataBinding = isDelegated && !shouldWrapHandler ? extractDelegatedEventData(valueExpr, t4) : null;
25320
+ if (dataBinding && t4.isIdentifier(dataBinding.handler)) {
25321
+ const handlerName = dataBinding.handler.name;
25322
+ if (ctx.signalVars?.has(handlerName) || ctx.memoVars?.has(handlerName) || ctx.aliasVars?.has(handlerName) || ctx.storeVars?.has(handlerName) || ctx.trackedVars.has(handlerName)) {
25323
+ dataBinding = null;
25324
+ }
25325
+ }
24303
25326
  if (isDelegated) {
24304
25327
  ctx.delegatedEventsUsed?.add(eventName);
24305
- const finalHandler = !isFn && shouldWrapHandler ? t4.arrowFunctionExpression([eventParam], t4.callExpression(valueExpr, [eventParam])) : handlerExpr;
25328
+ let handlerName = null;
25329
+ if (t4.isIdentifier(valueExpr)) {
25330
+ handlerName = valueExpr.name;
25331
+ } else if (t4.isCallExpression(valueExpr) && valueExpr.arguments.length === 0 && t4.isIdentifier(valueExpr.callee)) {
25332
+ handlerName = valueExpr.callee.name;
25333
+ }
25334
+ const handlerForCall = handlerName ? t4.identifier(handlerName) : t4.cloneNode(valueExpr, true);
25335
+ const finalHandler = !isFn && shouldWrapHandler ? t4.functionExpression(
25336
+ null,
25337
+ [eventParam],
25338
+ t4.blockStatement([
25339
+ t4.returnStatement(
25340
+ t4.callExpression(t4.memberExpression(handlerForCall, t4.identifier("call")), [
25341
+ t4.thisExpression(),
25342
+ eventParam
25343
+ ])
25344
+ )
25345
+ ])
25346
+ ) : handlerExpr;
24306
25347
  const normalizeHandler = (expr) => {
24307
25348
  if (t4.isCallExpression(expr) && (t4.isIdentifier(expr.callee) || t4.isMemberExpression(expr.callee))) {
24308
25349
  return expr.callee;
@@ -24315,19 +25356,7 @@ function lowerIntrinsicElement(jsx, ctx) {
24315
25356
  const dataForDelegate = dataBinding?.data && (t4.isArrowFunctionExpression(dataBinding.data) || t4.isFunctionExpression(dataBinding.data) ? dataBinding.data : t4.arrowFunctionExpression([], dataBinding.data));
24316
25357
  const handlerForDelegate = normalizedDataHandler ?? (dataBinding ? normalizeHandler(handlerExpr) : finalHandler);
24317
25358
  const handlerIsCallableExpr = t4.isArrowFunctionExpression(handlerForDelegate) || t4.isFunctionExpression(handlerForDelegate) || t4.isIdentifier(handlerForDelegate) || t4.isMemberExpression(handlerForDelegate);
24318
- let handlerToAssign = handlerIsCallableExpr ? handlerForDelegate : t4.arrowFunctionExpression([eventParam], handlerForDelegate);
24319
- if (dataForDelegate) {
24320
- let payloadExpr;
24321
- if (t4.isArrowFunctionExpression(dataForDelegate) && dataForDelegate.params.length === 0) {
24322
- payloadExpr = t4.isBlockStatement(dataForDelegate.body) ? t4.callExpression(t4.arrowFunctionExpression([], dataForDelegate.body), []) : dataForDelegate.body;
24323
- } else {
24324
- payloadExpr = t4.callExpression(dataForDelegate, []);
24325
- }
24326
- handlerToAssign = t4.arrowFunctionExpression(
24327
- [eventParam],
24328
- t4.callExpression(handlerForDelegate, [payloadExpr])
24329
- );
24330
- }
25359
+ const handlerToAssign = handlerIsCallableExpr ? handlerForDelegate : t4.arrowFunctionExpression([eventParam], handlerForDelegate);
24331
25360
  statements.push(
24332
25361
  t4.expressionStatement(
24333
25362
  t4.assignmentExpression(
@@ -24466,10 +25495,18 @@ function lowerIntrinsicElement(jsx, ctx) {
24466
25495
  );
24467
25496
  }
24468
25497
  } else if (binding.type === "child" && binding.expr) {
24469
- emitHIRChildBinding(targetId, binding.expr, statements, ctx, containingRegion);
25498
+ emitHIRChildBinding(
25499
+ targetId,
25500
+ binding.expr,
25501
+ statements,
25502
+ ctx,
25503
+ containingRegion,
25504
+ binding.namespace
25505
+ );
24470
25506
  }
24471
25507
  }
24472
25508
  applyRegionToContext(ctx, prevRegion ?? null);
25509
+ ctx.namespaceContext = prevNamespace;
24473
25510
  statements.push(t4.returnStatement(elId));
24474
25511
  const body = t4.blockStatement(statements);
24475
25512
  if (shouldMemo && containingRegion) {
@@ -24488,11 +25525,11 @@ function lowerIntrinsicElement(jsx, ctx) {
24488
25525
  }
24489
25526
  return t4.callExpression(t4.arrowFunctionExpression([], body), []);
24490
25527
  }
24491
- function resolveHIRBindingPath(path, cache, statements, ctx) {
24492
- const key = path.join(",");
25528
+ function resolveHIRBindingPath(path2, cache, statements, ctx) {
25529
+ const key = path2.join(",");
24493
25530
  if (cache.has(key)) return cache.get(key);
24494
25531
  const { t: t4 } = ctx;
24495
- const ancestorPath = [...path];
25532
+ const ancestorPath = [...path2];
24496
25533
  let ancestorId;
24497
25534
  let relativePath = [];
24498
25535
  while (ancestorPath.length > 0) {
@@ -24500,13 +25537,13 @@ function resolveHIRBindingPath(path, cache, statements, ctx) {
24500
25537
  const ancestorKey = ancestorPath.join(",");
24501
25538
  if (cache.has(ancestorKey)) {
24502
25539
  ancestorId = cache.get(ancestorKey);
24503
- relativePath = path.slice(ancestorPath.length);
25540
+ relativePath = path2.slice(ancestorPath.length);
24504
25541
  break;
24505
25542
  }
24506
25543
  }
24507
25544
  if (!ancestorId) {
24508
25545
  ancestorId = cache.get("");
24509
- relativePath = path;
25546
+ relativePath = path2;
24510
25547
  }
24511
25548
  let currentExpr = ancestorId;
24512
25549
  for (const index of relativePath) {
@@ -24520,9 +25557,12 @@ function resolveHIRBindingPath(path, cache, statements, ctx) {
24520
25557
  cache.set(key, varId);
24521
25558
  return varId;
24522
25559
  }
24523
- function emitHIRChildBinding(markerId, expr, statements, ctx, containingRegion) {
25560
+ function emitHIRChildBinding(markerId, expr, statements, ctx, containingRegion, namespace) {
24524
25561
  const { t: t4 } = ctx;
24525
25562
  const parentId = t4.memberExpression(markerId, t4.identifier("parentNode"));
25563
+ if (namespace !== void 0) {
25564
+ ctx.namespaceContext = namespace;
25565
+ }
24526
25566
  if (expr.kind === "CallExpression" && expr.callee.kind === "Identifier" && expr.callee.name === "createPortal") {
24527
25567
  ctx.helpersUsed.add("onDestroy");
24528
25568
  const portalId = genTemp(ctx, "portal");
@@ -24744,7 +25784,7 @@ function extractDelegatedEventData(expr, t4) {
24744
25784
  const bodyExpr = t4.isBlockStatement(expr.body) ? expr.body.body.length === 1 && t4.isReturnStatement(expr.body.body[0]) && expr.body.body[0].argument && t4.isExpression(expr.body.body[0].argument) ? expr.body.body[0].argument : null : expr.body;
24745
25785
  if (!bodyExpr || !t4.isCallExpression(bodyExpr)) return null;
24746
25786
  if (paramNames.some((name) => expressionUsesIdentifier(bodyExpr, name, t4))) return null;
24747
- if (!t4.isIdentifier(bodyExpr.callee) && !t4.isMemberExpression(bodyExpr.callee)) return null;
25787
+ if (!t4.isIdentifier(bodyExpr.callee)) return null;
24748
25788
  if (bodyExpr.arguments.length === 0) return null;
24749
25789
  if (bodyExpr.arguments.length > 1) return null;
24750
25790
  const dataArg = bodyExpr.arguments[0];
@@ -24770,12 +25810,16 @@ function extractDelegatedEventDataFromHIR(expr, ctx) {
24770
25810
  if (callee.kind !== "Identifier") {
24771
25811
  return null;
24772
25812
  }
25813
+ const handlerName = callee.name;
25814
+ if (ctx.signalVars?.has(handlerName) || ctx.memoVars?.has(handlerName) || ctx.aliasVars?.has(handlerName) || ctx.storeVars?.has(handlerName) || ctx.trackedVars.has(handlerName)) {
25815
+ return null;
25816
+ }
24773
25817
  if (bodyExpr.arguments.length !== 1) {
24774
25818
  return null;
24775
25819
  }
24776
25820
  if (callee.kind === "Identifier") {
24777
- const handlerName = deSSAVarName(callee.name);
24778
- const isTrackedAccessor = ctx.signalVars?.has(handlerName) || ctx.memoVars?.has(handlerName) || ctx.aliasVars?.has(handlerName);
25821
+ const handlerName2 = deSSAVarName(callee.name);
25822
+ const isTrackedAccessor = ctx.signalVars?.has(handlerName2) || ctx.memoVars?.has(handlerName2) || ctx.aliasVars?.has(handlerName2);
24779
25823
  if (isTrackedAccessor) {
24780
25824
  return null;
24781
25825
  }
@@ -25314,18 +26358,26 @@ function lowerHIRWithRegions(program, t4, options, macroAliases) {
25314
26358
  const emittedFunctionNames = /* @__PURE__ */ new Set();
25315
26359
  const originalBody = program.originalBody ?? [];
25316
26360
  ctx.moduleDeclaredNames = collectDeclaredNames(originalBody, t4);
25317
- ctx.moduleRuntimeNames = collectRuntimeImportNames(originalBody, t4);
26361
+ const runtimeImports = collectRuntimeImports(originalBody, t4);
26362
+ ctx.moduleRuntimeNames = runtimeImports.names;
26363
+ ctx.moduleRuntimeImportMap = runtimeImports.importMap;
26364
+ ctx.moduleRuntimeNamespaceImports = runtimeImports.namespaces;
26365
+ applyImportedReactiveMetadata(originalBody, ctx, t4, options);
25318
26366
  const stateMacroNames = /* @__PURE__ */ new Set(["$state", ...macroAliases?.state ?? []]);
25319
26367
  const memoMacroNames = new Set(macroAliases?.memo ?? ctx.memoMacroNames ?? []);
25320
26368
  if (!memoMacroNames.has("$memo")) memoMacroNames.add("$memo");
25321
26369
  if (!memoMacroNames.has("createMemo")) memoMacroNames.add("createMemo");
26370
+ ctx.stateMacroNames = stateMacroNames;
25322
26371
  ctx.memoMacroNames = memoMacroNames;
25323
26372
  for (const stmt of originalBody) {
25324
26373
  if (t4.isVariableDeclaration(stmt)) {
25325
26374
  for (const decl of stmt.declarations) {
25326
- if (t4.isIdentifier(decl.id) && decl.init && t4.isCallExpression(decl.init) && t4.isIdentifier(decl.init.callee) && (stateMacroNames.has(decl.init.callee.name) || decl.init.callee.name === "$store")) {
25327
- ctx.trackedVars.add(decl.id.name);
25328
- if (decl.init.callee.name === "$store") {
26375
+ if (t4.isIdentifier(decl.id) && decl.init && (t4.isCallExpression(decl.init) || t4.isOptionalCallExpression(decl.init))) {
26376
+ const callKind = getReactiveCallKindFromBabel(decl.init, ctx, t4);
26377
+ if (callKind === "signal") {
26378
+ ctx.trackedVars.add(decl.id.name);
26379
+ } else if (callKind === "store") {
26380
+ ctx.trackedVars.add(decl.id.name);
25329
26381
  ctx.storeVars?.add(decl.id.name);
25330
26382
  }
25331
26383
  }
@@ -25554,13 +26606,20 @@ function lowerHIRWithRegions(program, t4, options, macroAliases) {
25554
26606
  ctx.helpersUsed.add("popContext");
25555
26607
  body.push(t4.expressionStatement(t4.callExpression(t4.identifier(RUNTIME_ALIASES.popContext), [])));
25556
26608
  }
26609
+ const moduleMeta = buildModuleReactiveMetadata(originalBody, ctx, t4, options);
26610
+ setModuleMetadata(options?.filename, moduleMeta, options);
25557
26611
  return t4.file(t4.program(attachHelperImports(ctx, body, t4)));
25558
26612
  }
25559
26613
  function lowerTopLevelStatementBlock(statements, ctx, t4, name = "__module_segment", existingAliases) {
25560
26614
  if (statements.length === 0) return { statements: [], aliases: /* @__PURE__ */ new Set() };
25561
- const fn = convertStatementsToHIRFunction(name, statements);
26615
+ const reactiveScopes = ctx.options?.reactiveScopes;
26616
+ const fn = convertStatementsToHIRFunction(
26617
+ name,
26618
+ statements,
26619
+ reactiveScopes && reactiveScopes.length > 0 ? { reactiveScopes: new Set(reactiveScopes) } : void 0
26620
+ );
25562
26621
  const scopeResult = analyzeReactiveScopesWithSSA(fn);
25563
- detectDerivedCycles(fn, scopeResult);
26622
+ detectDerivedCycles(fn, scopeResult, ctx);
25564
26623
  ctx.scopes = scopeResult;
25565
26624
  const regionResult = generateRegions(fn, scopeResult);
25566
26625
  ctx.regions = flattenRegions(regionResult.topLevelRegions);
@@ -25572,10 +26631,12 @@ function lowerTopLevelStatementBlock(statements, ctx, t4, name = "__module_segme
25572
26631
  const functionVars = ctx.functionVars ?? /* @__PURE__ */ new Set();
25573
26632
  const signalVars = ctx.signalVars ?? /* @__PURE__ */ new Set();
25574
26633
  const storeVars = ctx.storeVars ?? /* @__PURE__ */ new Set();
26634
+ const memoVars = ctx.memoVars ?? /* @__PURE__ */ new Set();
25575
26635
  const mutatedVars = /* @__PURE__ */ new Set();
25576
26636
  ctx.functionVars = functionVars;
25577
26637
  ctx.signalVars = signalVars;
25578
26638
  ctx.storeVars = storeVars;
26639
+ ctx.memoVars = memoVars;
25579
26640
  ctx.mutatedVars = mutatedVars;
25580
26641
  for (const block of fn.blocks) {
25581
26642
  for (const instr of block.instructions) {
@@ -25584,11 +26645,14 @@ function lowerTopLevelStatementBlock(statements, ctx, t4, name = "__module_segme
25584
26645
  if (instr.value.kind === "ArrowFunction" || instr.value.kind === "FunctionExpression") {
25585
26646
  functionVars.add(target);
25586
26647
  }
25587
- if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier") {
25588
- if (instr.value.callee.name === "$state") {
26648
+ if (instr.value.kind === "CallExpression" || instr.value.kind === "OptionalCallExpression") {
26649
+ const callKind = getReactiveCallKind(instr.value, ctx);
26650
+ if (callKind === "signal") {
25589
26651
  signalVars.add(target);
25590
- } else if (instr.value.callee.name === "$store") {
26652
+ } else if (callKind === "store") {
25591
26653
  storeVars.add(target);
26654
+ } else if (callKind === "memo") {
26655
+ memoVars.add(target);
25592
26656
  }
25593
26657
  }
25594
26658
  if (!instr.declarationKind) {
@@ -25705,7 +26769,7 @@ function transformControlFlowReturns(statements, ctx) {
25705
26769
  }
25706
26770
  return null;
25707
26771
  }
25708
- function lowerFunctionWithRegions(fn, ctx) {
26772
+ function lowerFunctionWithRegions(fn, ctx, options) {
25709
26773
  const { t: t4 } = ctx;
25710
26774
  const prevTracked = ctx.trackedVars;
25711
26775
  const prevSignalVars = ctx.signalVars;
@@ -25764,8 +26828,15 @@ function lowerFunctionWithRegions(fn, ctx) {
25764
26828
  if (instr.value.kind === "ArrowFunction" || instr.value.kind === "FunctionExpression") {
25765
26829
  ctx.functionVars?.add(target);
25766
26830
  }
25767
- if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$state") {
25768
- ctx.signalVars?.add(target);
26831
+ if (instr.value.kind === "CallExpression" || instr.value.kind === "OptionalCallExpression") {
26832
+ const callKind = getReactiveCallKind(instr.value, ctx);
26833
+ if (callKind === "signal") {
26834
+ ctx.signalVars?.add(target);
26835
+ } else if (callKind === "store") {
26836
+ ctx.storeVars?.add(target);
26837
+ } else if (callKind === "memo") {
26838
+ ctx.memoVars?.add(target);
26839
+ }
25769
26840
  }
25770
26841
  if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && isHookName(instr.value.callee.name)) {
25771
26842
  hookResultVars.add(target);
@@ -25774,9 +26845,6 @@ function lowerFunctionWithRegions(fn, ctx) {
25774
26845
  if (instr.value.kind === "MemberExpression" && instr.value.object.kind === "Identifier" && hookResultVars.has(deSSAVarName(instr.value.object.name))) {
25775
26846
  hookAccessorAliases.add(target);
25776
26847
  }
25777
- if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$store") {
25778
- ctx.storeVars?.add(target);
25779
- }
25780
26848
  if (!instr.declarationKind) {
25781
26849
  ctx.mutatedVars?.add(target);
25782
26850
  }
@@ -25789,15 +26857,18 @@ function lowerFunctionWithRegions(fn, ctx) {
25789
26857
  ctx.aliasVars?.add(name);
25790
26858
  ctx.trackedVars.add(name);
25791
26859
  });
25792
- const inferredHook = isHookLikeFunction(fn);
26860
+ const inferredHook = options?.forceHookContext ? true : isHookLikeFunction(fn);
25793
26861
  const scopeResult = analyzeReactiveScopesWithSSA(fn);
25794
- detectDerivedCycles(fn, scopeResult);
26862
+ detectDerivedCycles(fn, scopeResult, ctx);
25795
26863
  ctx.scopes = scopeResult;
25796
26864
  const regionResult = generateRegions(fn, scopeResult);
25797
26865
  const prevHookFlag = ctx.currentFnIsHook;
25798
26866
  ctx.currentFnIsHook = inferredHook;
25799
26867
  const isComponent = !!(fn.name && fn.name[0] === fn.name[0]?.toUpperCase());
25800
26868
  ctx.isComponentFn = isComponent;
26869
+ if (!isComponent && !inferredHook) {
26870
+ ctx.inModule = true;
26871
+ }
25801
26872
  const rawPropsParam = fn.params.length === 1 && fn.params[0] ? deSSAVarName(fn.params[0].name) : void 0;
25802
26873
  if (isComponent && rawPropsParam) {
25803
26874
  ctx.propsParamName = rawPropsParam;
@@ -26034,7 +27105,7 @@ function lowerFunctionWithRegions(fn, ctx) {
26034
27105
  if (!hasComplexControlFlow && !isAsync) {
26035
27106
  const pureDeclaredVars = /* @__PURE__ */ new Set();
26036
27107
  const pureStatements = lowerStructuredNodeWithoutRegions(structured, t4, ctx, pureDeclaredVars);
26037
- const params2 = fn.params.map((p) => t4.identifier(deSSAVarName(p.name)));
27108
+ const params2 = buildOutputParams(fn, t4);
26038
27109
  const funcDecl2 = setNodeLoc(
26039
27110
  t4.functionDeclaration(
26040
27111
  t4.identifier(fn.name ?? "fn"),
@@ -26109,13 +27180,31 @@ function lowerFunctionWithRegions(fn, ctx) {
26109
27180
  )
26110
27181
  );
26111
27182
  }
26112
- let finalParams = fn.params.map((p) => t4.identifier(deSSAVarName(p.name)));
27183
+ let finalParams = buildOutputParams(fn, t4);
26113
27184
  const propsDestructuring = [];
26114
27185
  if (isComponent && fn.rawParams && fn.rawParams.length === 1) {
26115
27186
  const rawParam = fn.rawParams[0];
26116
27187
  if (rawParam && (rawParam.type === "ObjectPattern" || rawParam.type === "AssignmentPattern" && rawParam.left?.type === "ObjectPattern")) {
26117
- finalParams = [t4.identifier("__props")];
26118
27188
  const pattern = rawParam.type === "AssignmentPattern" ? rawParam.left : rawParam;
27189
+ const defaultExpr = rawParam.type === "AssignmentPattern" ? rawParam.right : null;
27190
+ if (defaultExpr) {
27191
+ const propsParamName = "__propsParam";
27192
+ finalParams = [t4.identifier(propsParamName)];
27193
+ propsDestructuring.push(
27194
+ t4.variableDeclaration("const", [
27195
+ t4.variableDeclarator(
27196
+ t4.identifier("__props"),
27197
+ t4.conditionalExpression(
27198
+ t4.binaryExpression("===", t4.identifier(propsParamName), t4.identifier("undefined")),
27199
+ t4.cloneNode(defaultExpr, true),
27200
+ t4.identifier(propsParamName)
27201
+ )
27202
+ )
27203
+ ])
27204
+ );
27205
+ } else {
27206
+ finalParams = [t4.identifier("__props")];
27207
+ }
26119
27208
  if (propsDestructurePlan) {
26120
27209
  if (propsDestructurePlan.usesProp) {
26121
27210
  ctx.helpersUsed.add("prop");
@@ -26273,7 +27362,7 @@ function optimizeHIR(program, options = {}) {
26273
27362
  originalBody: []
26274
27363
  });
26275
27364
  const ssaFn = ssaProgram.functions[0];
26276
- return ssaFn ? optimizeSSAFunction(ssaFn) : fn;
27365
+ return ssaFn ? optimizeSSAFunction(ssaFn, options) : fn;
26277
27366
  }
26278
27367
  if (isReactiveOptimizationCandidate(fn)) {
26279
27368
  return optimizeReactiveFunction(fn, exportedNames, options);
@@ -26285,9 +27374,9 @@ function optimizeHIR(program, options = {}) {
26285
27374
  functions
26286
27375
  };
26287
27376
  }
26288
- function optimizeSSAFunction(fn) {
27377
+ function optimizeSSAFunction(fn, options) {
26289
27378
  let current = fn;
26290
- current = propagateConstants(current);
27379
+ current = propagateConstants(current, options);
26291
27380
  const purity = buildPurityContext(current);
26292
27381
  current = eliminateCommonSubexpressions(current, purity);
26293
27382
  current = inlineSingleUse(current, purity);
@@ -26912,7 +28001,9 @@ function optimizeReactiveFunction(fn, exportedNames, options) {
26912
28001
  const reactive = buildReactiveContext(fn);
26913
28002
  const purity = buildPurityContext(fn);
26914
28003
  const hookLike = isHookLikeFunction(fn);
26915
- const transformedBlocks = fn.blocks.map((block) => optimizeReactiveBlock(block, reactive, purity));
28004
+ const transformedBlocks = fn.blocks.map(
28005
+ (block) => optimizeReactiveBlock(block, reactive, purity, options)
28006
+ );
26916
28007
  let transformed = { ...fn, blocks: transformedBlocks };
26917
28008
  if (isCrossBlockConstPropagationEnabled()) {
26918
28009
  transformed = propagateCrossBlockConstants(transformed, reactive, purity, scopeResult);
@@ -26947,7 +28038,7 @@ function optimizeReactiveFunction(fn, exportedNames, options) {
26947
28038
  });
26948
28039
  return { ...transformed, blocks };
26949
28040
  }
26950
- function optimizeReactiveBlock(block, reactive, purity) {
28041
+ function optimizeReactiveBlock(block, reactive, purity, options) {
26951
28042
  const constants = /* @__PURE__ */ new Map();
26952
28043
  const constObjects = /* @__PURE__ */ new Map();
26953
28044
  const constArrays = /* @__PURE__ */ new Map();
@@ -26985,7 +28076,7 @@ function optimizeReactiveBlock(block, reactive, purity) {
26985
28076
  constArrays.delete(name);
26986
28077
  }
26987
28078
  const dependsOnReactiveValue = expressionDependsOnReactive(instr.value, reactive);
26988
- let value = dependsOnReactiveValue ? instr.value : foldExpressionWithConstants(instr.value, constants, constObjects, constArrays);
28079
+ let value = dependsOnReactiveValue ? instr.value : foldExpressionWithConstants(instr.value, constants, options, constObjects, constArrays);
26989
28080
  const allowCSE = isCompilerGeneratedName(target) && (!declKind || declKind === "const");
26990
28081
  if (allowCSE && isPureExpression(value, purity) && !isExplicitMemoCall(value, purity) && !dependsOnReactiveValue && isCSESafeExpression(value, purity)) {
26991
28082
  const deps = collectExpressionIdentifiers2(value, true);
@@ -27033,7 +28124,7 @@ function optimizeReactiveBlock(block, reactive, purity) {
27033
28124
  constArrays.delete(name);
27034
28125
  }
27035
28126
  const dependsOnReactiveValue = expressionDependsOnReactive(instr.value, reactive);
27036
- const value = dependsOnReactiveValue ? instr.value : foldExpressionWithConstants(instr.value, constants, constObjects, constArrays);
28127
+ const value = dependsOnReactiveValue ? instr.value : foldExpressionWithConstants(instr.value, constants, options, constObjects, constArrays);
27037
28128
  instructions.push(value === instr.value ? instr : { ...instr, value });
27038
28129
  continue;
27039
28130
  }
@@ -27042,6 +28133,7 @@ function optimizeReactiveBlock(block, reactive, purity) {
27042
28133
  const terminator = foldTerminatorWithConstants(
27043
28134
  block.terminator,
27044
28135
  constants,
28136
+ options,
27045
28137
  reactive,
27046
28138
  constObjects,
27047
28139
  constArrays
@@ -27973,7 +29065,7 @@ function blocksContainImpureMarkers(blocks) {
27973
29065
  }
27974
29066
  return false;
27975
29067
  }
27976
- function propagateConstants(fn) {
29068
+ function propagateConstants(fn, options) {
27977
29069
  const constants = computeConstantMap(fn);
27978
29070
  if (constants.size === 0) return fn;
27979
29071
  const blocks = fn.blocks.map((block) => ({
@@ -27981,12 +29073,12 @@ function propagateConstants(fn) {
27981
29073
  instructions: block.instructions.map((instr) => {
27982
29074
  if (instr.kind === "Assign") {
27983
29075
  const replaced = replaceIdentifiersWithConstants(instr.value, constants);
27984
- const folded = foldExpression(replaced, constants);
29076
+ const folded = foldExpression(replaced, constants, options);
27985
29077
  return { ...instr, value: folded };
27986
29078
  }
27987
29079
  if (instr.kind === "Expression") {
27988
29080
  const replaced = replaceIdentifiersWithConstants(instr.value, constants);
27989
- const folded = foldExpression(replaced, constants);
29081
+ const folded = foldExpression(replaced, constants, options);
27990
29082
  return { ...instr, value: folded };
27991
29083
  }
27992
29084
  if (instr.kind === "Phi") {
@@ -28386,15 +29478,18 @@ function evaluateBinary(operator, left, right) {
28386
29478
  return UNKNOWN_CONST;
28387
29479
  }
28388
29480
  }
28389
- function foldExpression(expr, constants) {
29481
+ function foldExpression(expr, constants, options) {
28390
29482
  const value = evaluateConstant(expr, constants);
28391
29483
  if (value === UNKNOWN_CONST) {
28392
- return simplifyAlgebraically(expr, constants);
29484
+ return simplifyAlgebraically(expr, constants, options);
28393
29485
  }
28394
29486
  return { kind: "Literal", value, loc: expr.loc };
28395
29487
  }
28396
- function simplifyAlgebraically(expr, constants) {
28397
- const simplified = simplifyChildren(expr, constants);
29488
+ function simplifyAlgebraically(expr, constants, options) {
29489
+ const simplified = simplifyChildren(expr, constants, options);
29490
+ if (options.optimizeLevel === "safe") {
29491
+ return simplified;
29492
+ }
28398
29493
  if (simplified.kind === "BinaryExpression") {
28399
29494
  const { operator, left, right, loc } = simplified;
28400
29495
  switch (operator) {
@@ -28473,37 +29568,37 @@ function simplifyAlgebraically(expr, constants) {
28473
29568
  }
28474
29569
  return simplified;
28475
29570
  }
28476
- function simplifyChildren(expr, constants) {
29571
+ function simplifyChildren(expr, constants, options) {
28477
29572
  switch (expr.kind) {
28478
29573
  case "BinaryExpression":
28479
29574
  return {
28480
29575
  ...expr,
28481
- left: simplifyAlgebraically(expr.left, constants),
28482
- right: simplifyAlgebraically(expr.right, constants)
29576
+ left: simplifyAlgebraically(expr.left, constants, options),
29577
+ right: simplifyAlgebraically(expr.right, constants, options)
28483
29578
  };
28484
29579
  case "LogicalExpression":
28485
29580
  return {
28486
29581
  ...expr,
28487
- left: simplifyAlgebraically(expr.left, constants),
28488
- right: simplifyAlgebraically(expr.right, constants)
29582
+ left: simplifyAlgebraically(expr.left, constants, options),
29583
+ right: simplifyAlgebraically(expr.right, constants, options)
28489
29584
  };
28490
29585
  case "UnaryExpression":
28491
29586
  return {
28492
29587
  ...expr,
28493
- argument: simplifyAlgebraically(expr.argument, constants)
29588
+ argument: simplifyAlgebraically(expr.argument, constants, options)
28494
29589
  };
28495
29590
  case "ConditionalExpression":
28496
29591
  return {
28497
29592
  ...expr,
28498
- test: simplifyAlgebraically(expr.test, constants),
28499
- consequent: simplifyAlgebraically(expr.consequent, constants),
28500
- alternate: simplifyAlgebraically(expr.alternate, constants)
29593
+ test: simplifyAlgebraically(expr.test, constants, options),
29594
+ consequent: simplifyAlgebraically(expr.consequent, constants, options),
29595
+ alternate: simplifyAlgebraically(expr.alternate, constants, options)
28501
29596
  };
28502
29597
  case "ArrayExpression":
28503
29598
  return {
28504
29599
  ...expr,
28505
29600
  elements: expr.elements.map(
28506
- (el) => el ? simplifyAlgebraically(el, constants) : el
29601
+ (el) => el ? simplifyAlgebraically(el, constants, options) : el
28507
29602
  )
28508
29603
  };
28509
29604
  case "ObjectExpression":
@@ -28513,13 +29608,13 @@ function simplifyChildren(expr, constants) {
28513
29608
  if (prop.kind === "Property") {
28514
29609
  return {
28515
29610
  ...prop,
28516
- value: simplifyAlgebraically(prop.value, constants)
29611
+ value: simplifyAlgebraically(prop.value, constants, options)
28517
29612
  };
28518
29613
  }
28519
29614
  if (prop.kind === "SpreadElement") {
28520
29615
  return {
28521
29616
  ...prop,
28522
- argument: simplifyAlgebraically(prop.argument, constants)
29617
+ argument: simplifyAlgebraically(prop.argument, constants, options)
28523
29618
  };
28524
29619
  }
28525
29620
  return prop;
@@ -28529,35 +29624,35 @@ function simplifyChildren(expr, constants) {
28529
29624
  case "OptionalCallExpression":
28530
29625
  return {
28531
29626
  ...expr,
28532
- arguments: expr.arguments.map((arg) => simplifyAlgebraically(arg, constants))
29627
+ arguments: expr.arguments.map((arg) => simplifyAlgebraically(arg, constants, options))
28533
29628
  };
28534
29629
  case "ImportExpression":
28535
29630
  return {
28536
29631
  ...expr,
28537
- source: simplifyAlgebraically(expr.source, constants)
29632
+ source: simplifyAlgebraically(expr.source, constants, options)
28538
29633
  };
28539
29634
  case "MemberExpression":
28540
29635
  case "OptionalMemberExpression":
28541
29636
  return {
28542
29637
  ...expr,
28543
- object: simplifyAlgebraically(expr.object, constants),
28544
- property: expr.computed ? simplifyAlgebraically(expr.property, constants) : expr.property
29638
+ object: simplifyAlgebraically(expr.object, constants, options),
29639
+ property: expr.computed ? simplifyAlgebraically(expr.property, constants, options) : expr.property
28545
29640
  };
28546
29641
  default:
28547
29642
  return expr;
28548
29643
  }
28549
29644
  }
28550
- function foldExpressionWithConstants(expr, constants, constObjects, constArrays) {
29645
+ function foldExpressionWithConstants(expr, constants, options, constObjects, constArrays) {
28551
29646
  const replaced = replaceIdentifiersWithConstants(expr, constants);
28552
29647
  if (!constObjects && !constArrays) {
28553
- return foldExpression(replaced, constants);
29648
+ return foldExpression(replaced, constants, options);
28554
29649
  }
28555
29650
  const memberReplaced = replaceConstMemberExpressions(
28556
29651
  replaced,
28557
29652
  constObjects ?? /* @__PURE__ */ new Map(),
28558
29653
  constArrays ?? /* @__PURE__ */ new Map()
28559
29654
  );
28560
- return foldExpression(memberReplaced, constants);
29655
+ return foldExpression(memberReplaced, constants, options);
28561
29656
  }
28562
29657
  function replaceIdentifiersWithConstants(expr, constants, context = {}) {
28563
29658
  switch (expr.kind) {
@@ -28719,10 +29814,10 @@ function replaceConstantsInTerminator(term, constants) {
28719
29814
  return term;
28720
29815
  }
28721
29816
  }
28722
- function foldTerminatorWithConstants(term, constants, reactive, constObjects, constArrays) {
29817
+ function foldTerminatorWithConstants(term, constants, options, reactive, constObjects, constArrays) {
28723
29818
  const fold = (expr) => {
28724
29819
  if (reactive && expressionDependsOnReactive(expr, reactive)) return expr;
28725
- return foldExpressionWithConstants(expr, constants, constObjects, constArrays);
29820
+ return foldExpressionWithConstants(expr, constants, options, constObjects, constArrays);
28726
29821
  };
28727
29822
  switch (term.kind) {
28728
29823
  case "Return":
@@ -28839,11 +29934,14 @@ function hasSideEffectsBetween(instructions, start, end, purity) {
28839
29934
  function eliminateDeadCode(fn, purity) {
28840
29935
  const depsByVar = buildDependencyGraph(fn);
28841
29936
  const live = computeLiveVariables(fn, depsByVar, purity);
29937
+ const baseLive = /* @__PURE__ */ new Set();
29938
+ live.forEach((name) => baseLive.add(getSSABaseName(name)));
28842
29939
  const blocks = fn.blocks.map((block) => {
28843
29940
  const instructions = block.instructions.filter((instr) => {
28844
29941
  if (instr.kind === "Assign") {
28845
29942
  const name = instr.target.name;
28846
29943
  if (live.has(name)) return true;
29944
+ if (instr.declarationKind && baseLive.has(getSSABaseName(name))) return true;
28847
29945
  return !isPureExpression(instr.value, purity) || isExplicitMemoCall(instr.value, purity);
28848
29946
  }
28849
29947
  if (instr.kind === "Phi") {
@@ -29855,8 +30953,8 @@ function getRootIdentifier(expr, t4) {
29855
30953
  }
29856
30954
 
29857
30955
  // src/index.ts
29858
- function stripMacroImports(path, t4) {
29859
- path.traverse({
30956
+ function stripMacroImports(path2, t4) {
30957
+ path2.traverse({
29860
30958
  ImportDeclaration(importPath) {
29861
30959
  if (importPath.node.source.value !== "fict" && importPath.node.source.value !== "fict/slim")
29862
30960
  return;
@@ -29874,30 +30972,18 @@ function stripMacroImports(path, t4) {
29874
30972
  }
29875
30973
  });
29876
30974
  }
29877
- function isInsideLoop(path) {
29878
- return !!path.findParent(
30975
+ function isInsideLoop(path2) {
30976
+ return !!path2.findParent(
29879
30977
  (p) => p.isForStatement?.() || p.isWhileStatement?.() || p.isDoWhileStatement?.() || p.isForInStatement?.() || p.isForOfStatement?.()
29880
30978
  );
29881
30979
  }
29882
- function isInsideConditional(path) {
29883
- return !!path.findParent(
30980
+ function isInsideConditional(path2) {
30981
+ return !!path2.findParent(
29884
30982
  (p) => p.isIfStatement?.() || p.isConditionalExpression?.() || p.isSwitchCase?.()
29885
30983
  );
29886
30984
  }
29887
- function isInsideNestedFunction(path) {
29888
- let depth = 0;
29889
- let current = path;
29890
- while (current) {
29891
- if (current.isFunction?.()) {
29892
- depth++;
29893
- if (depth > 1) return true;
29894
- }
29895
- current = current.parentPath;
29896
- }
29897
- return false;
29898
- }
29899
- function isInsideJSX(path) {
29900
- return !!path.findParent((p) => p.isJSXElement?.() || p.isJSXFragment?.());
30985
+ function isInsideJSX(path2) {
30986
+ return !!path2.findParent((p) => p.isJSXElement?.() || p.isJSXFragment?.());
29901
30987
  }
29902
30988
  function parseSuppressionCodes(raw) {
29903
30989
  if (!raw) return void 0;
@@ -29926,12 +31012,42 @@ function shouldSuppressWarning(suppressions, code, line) {
29926
31012
  return entry.codes.has(code);
29927
31013
  });
29928
31014
  }
29929
- function createWarningDispatcher(onWarn, suppressions) {
29930
- if (!onWarn) return () => {
31015
+ function hasErrorEscalation(options) {
31016
+ if (options.warningsAsErrors === true) return true;
31017
+ if (Array.isArray(options.warningsAsErrors) && options.warningsAsErrors.length > 0) return true;
31018
+ if (options.warningLevels) {
31019
+ return Object.values(options.warningLevels).some((level) => level === "error");
31020
+ }
31021
+ return false;
31022
+ }
31023
+ function resolveWarningLevel(code, options) {
31024
+ const override = options.warningLevels?.[code];
31025
+ if (override) return override;
31026
+ if (options.warningsAsErrors === true) return "error";
31027
+ if (Array.isArray(options.warningsAsErrors) && options.warningsAsErrors.includes(code)) {
31028
+ return "error";
31029
+ }
31030
+ return "warn";
31031
+ }
31032
+ function formatWarningAsError(warning) {
31033
+ const location = warning.line > 0 ? `${warning.fileName}:${warning.line}:${warning.column}` : warning.fileName;
31034
+ return `Fict warning treated as error (${warning.code}): ${warning.message}
31035
+ at ${location}`;
31036
+ }
31037
+ function createWarningDispatcher(onWarn, suppressions, options, dev) {
31038
+ const hasEscalation = hasErrorEscalation(options);
31039
+ if (!dev && !hasEscalation) return () => {
29931
31040
  };
29932
31041
  return (warning) => {
29933
31042
  if (shouldSuppressWarning(suppressions, warning.code, warning.line)) return;
29934
- onWarn(warning);
31043
+ const level = resolveWarningLevel(warning.code, options);
31044
+ if (level === "off") return;
31045
+ if (level === "error") {
31046
+ throw new Error(formatWarningAsError(warning));
31047
+ }
31048
+ if (dev && onWarn) {
31049
+ onWarn(warning);
31050
+ }
29935
31051
  };
29936
31052
  }
29937
31053
  function emitWarning(node, code, message, warn, fileName) {
@@ -30031,13 +31147,13 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30031
31147
  };
30032
31148
  const reactiveNames = /* @__PURE__ */ new Set([...stateVars, ...derivedVars]);
30033
31149
  programPath.traverse({
30034
- AssignmentExpression(path) {
30035
- const { left } = path.node;
31150
+ AssignmentExpression(path2) {
31151
+ const { left } = path2.node;
30036
31152
  if (t4.isIdentifier(left)) return;
30037
31153
  if (t4.isMemberExpression(left) || t4.isOptionalMemberExpression(left)) {
30038
31154
  if (isStateRoot(left.object)) {
30039
31155
  emitWarning(
30040
- path.node,
31156
+ path2.node,
30041
31157
  "FICT-M",
30042
31158
  "Direct mutation of nested property detected; use immutable update or $store helpers",
30043
31159
  warn,
@@ -30045,7 +31161,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30045
31161
  );
30046
31162
  if (isDynamicPropertyAccess(left, t4)) {
30047
31163
  emitWarning(
30048
- path.node,
31164
+ path2.node,
30049
31165
  "FICT-H",
30050
31166
  "Dynamic property access widens dependency tracking",
30051
31167
  warn,
@@ -30055,12 +31171,12 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30055
31171
  }
30056
31172
  }
30057
31173
  },
30058
- UpdateExpression(path) {
30059
- const arg = path.node.argument;
31174
+ UpdateExpression(path2) {
31175
+ const arg = path2.node.argument;
30060
31176
  if (t4.isMemberExpression(arg) || t4.isOptionalMemberExpression(arg)) {
30061
31177
  if (isStateRoot(arg.object)) {
30062
31178
  emitWarning(
30063
- path.node,
31179
+ path2.node,
30064
31180
  "FICT-M",
30065
31181
  "Direct mutation of nested property detected; use immutable update or $store helpers",
30066
31182
  warn,
@@ -30068,7 +31184,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30068
31184
  );
30069
31185
  if (isDynamicPropertyAccess(arg, t4)) {
30070
31186
  emitWarning(
30071
- path.node,
31187
+ path2.node,
30072
31188
  "FICT-H",
30073
31189
  "Dynamic property access widens dependency tracking",
30074
31190
  warn,
@@ -30078,13 +31194,13 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30078
31194
  }
30079
31195
  }
30080
31196
  },
30081
- MemberExpression(path) {
30082
- if (!path.node.computed) return;
30083
- if (path.parentPath.isAssignmentExpression({ left: path.node })) return;
30084
- if (path.parentPath.isUpdateExpression({ argument: path.node })) return;
30085
- if (isDynamicPropertyAccess(path.node, t4) && isStateRoot(path.node.object)) {
31197
+ MemberExpression(path2) {
31198
+ if (!path2.node.computed) return;
31199
+ if (path2.parentPath.isAssignmentExpression({ left: path2.node })) return;
31200
+ if (path2.parentPath.isUpdateExpression({ argument: path2.node })) return;
31201
+ if (isDynamicPropertyAccess(path2.node, t4) && isStateRoot(path2.node.object)) {
30086
31202
  emitWarning(
30087
- path.node,
31203
+ path2.node,
30088
31204
  "FICT-H",
30089
31205
  "Dynamic property access widens dependency tracking",
30090
31206
  warn,
@@ -30092,12 +31208,12 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30092
31208
  );
30093
31209
  }
30094
31210
  },
30095
- Function(path) {
31211
+ Function(path2) {
30096
31212
  const captured = /* @__PURE__ */ new Set();
30097
- path.traverse(
31213
+ path2.traverse(
30098
31214
  {
30099
31215
  Function(inner) {
30100
- if (inner === path) return;
31216
+ if (inner === path2) return;
30101
31217
  inner.skip();
30102
31218
  },
30103
31219
  Identifier(idPath) {
@@ -30105,7 +31221,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30105
31221
  if (!reactiveNames.has(name)) return;
30106
31222
  const binding = idPath.scope.getBinding(name);
30107
31223
  if (!binding) return;
30108
- if (binding.scope === idPath.scope || binding.scope === path.scope) return;
31224
+ if (binding.scope === idPath.scope || binding.scope === path2.scope) return;
30109
31225
  captured.add(name);
30110
31226
  }
30111
31227
  },
@@ -30113,7 +31229,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30113
31229
  );
30114
31230
  if (captured.size > 0) {
30115
31231
  emitWarning(
30116
- path.node,
31232
+ path2.node,
30117
31233
  "FICT-R005",
30118
31234
  `Function captures reactive variable(s): ${Array.from(captured).join(", ")}. Pass them as parameters or memoize explicitly to avoid hidden dependencies.`,
30119
31235
  warn,
@@ -30121,9 +31237,9 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30121
31237
  );
30122
31238
  }
30123
31239
  },
30124
- CallExpression(path) {
30125
- if (t4.isIdentifier(path.node.callee, { name: "$effect" })) {
30126
- const argPath = path.get("arguments.0");
31240
+ CallExpression(path2) {
31241
+ if (t4.isIdentifier(path2.node.callee, { name: "$effect" })) {
31242
+ const argPath = path2.get("arguments.0");
30127
31243
  if (argPath?.isFunctionExpression() || argPath?.isArrowFunctionExpression()) {
30128
31244
  let hasReactiveDependency = false;
30129
31245
  argPath.traverse({
@@ -30144,7 +31260,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30144
31260
  });
30145
31261
  if (!hasReactiveDependency) {
30146
31262
  emitWarning(
30147
- path.node,
31263
+ path2.node,
30148
31264
  "FICT-E001",
30149
31265
  "Effect has no reactive reads; it will run once. Consider removing $effect or adding dependencies.",
30150
31266
  warn,
@@ -30154,7 +31270,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30154
31270
  }
30155
31271
  return;
30156
31272
  }
30157
- const callee = path.node.callee;
31273
+ const callee = path2.node.callee;
30158
31274
  let calleeName = "";
30159
31275
  if (t4.isIdentifier(callee)) {
30160
31276
  calleeName = callee.name;
@@ -30166,7 +31282,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30166
31282
  }
30167
31283
  const isSafe = calleeName && SAFE_FUNCTIONS.has(calleeName);
30168
31284
  if (isSafe) return;
30169
- for (const arg of path.node.arguments) {
31285
+ for (const arg of path2.node.arguments) {
30170
31286
  if (!t4.isExpression(arg)) continue;
30171
31287
  if (isStateRoot(arg)) {
30172
31288
  emitWarning(
@@ -30180,13 +31296,13 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30180
31296
  }
30181
31297
  }
30182
31298
  },
30183
- OptionalMemberExpression(path) {
30184
- if (!path.node.computed) return;
30185
- if (path.parentPath.isAssignmentExpression({ left: path.node })) return;
30186
- if (path.parentPath.isUpdateExpression({ argument: path.node })) return;
30187
- if (isDynamicPropertyAccess(path.node, t4) && isStateRoot(path.node.object)) {
31299
+ OptionalMemberExpression(path2) {
31300
+ if (!path2.node.computed) return;
31301
+ if (path2.parentPath.isAssignmentExpression({ left: path2.node })) return;
31302
+ if (path2.parentPath.isUpdateExpression({ argument: path2.node })) return;
31303
+ if (isDynamicPropertyAccess(path2.node, t4) && isStateRoot(path2.node.object)) {
30188
31304
  emitWarning(
30189
- path.node,
31305
+ path2.node,
30190
31306
  "FICT-H",
30191
31307
  "Dynamic property access widens dependency tracking",
30192
31308
  warn,
@@ -30237,15 +31353,66 @@ function createHIREntrypointVisitor(t4, options) {
30237
31353
  };
30238
31354
  return {
30239
31355
  Program: {
30240
- exit(path) {
30241
- const fileName = path.hub?.file?.opts?.filename || "<unknown>";
30242
- const comments = path.hub?.file?.ast?.comments || [];
31356
+ exit(path2) {
31357
+ const fileName = path2.hub?.file?.opts?.filename || "<unknown>";
31358
+ const comments = path2.hub?.file?.ast?.comments || [];
30243
31359
  const suppressions = parseSuppressions(comments);
30244
31360
  const dev = options.dev !== false;
30245
- const warn = dev ? createWarningDispatcher(options.onWarn, suppressions) : () => {
31361
+ const warn = createWarningDispatcher(options.onWarn, suppressions, options, dev);
31362
+ const optionsWithWarnings = {
31363
+ ...options,
31364
+ onWarn: warn,
31365
+ filename: fileName
30246
31366
  };
30247
- const optionsWithWarnings = dev ? { ...options, onWarn: warn } : { ...options, onWarn: void 0 };
30248
31367
  const isHookName2 = (name) => !!name && /^use[A-Z]/.test(name);
31368
+ const reactiveScopesSet = new Set(options.reactiveScopes ?? []);
31369
+ const resolveReactiveScopeName = (callee) => {
31370
+ if (reactiveScopesSet.size === 0) return null;
31371
+ if (t4.isIdentifier(callee)) {
31372
+ return reactiveScopesSet.has(callee.name) ? callee.name : null;
31373
+ }
31374
+ if ((t4.isMemberExpression(callee) || t4.isOptionalMemberExpression(callee)) && !callee.computed && t4.isIdentifier(callee.property)) {
31375
+ return reactiveScopesSet.has(callee.property.name) ? callee.property.name : null;
31376
+ }
31377
+ return null;
31378
+ };
31379
+ const isReactiveScopeCallback = (fnPath) => {
31380
+ if (reactiveScopesSet.size === 0) return false;
31381
+ const parent = fnPath.parentPath;
31382
+ if (!parent || !(parent.isCallExpression() || parent.isOptionalCallExpression())) {
31383
+ return false;
31384
+ }
31385
+ if (parent.node.arguments[0] !== fnPath.node) return false;
31386
+ const callee = parent.node.callee;
31387
+ return !!resolveReactiveScopeName(callee);
31388
+ };
31389
+ const isReactiveScopeCallbackNode = (fnNode, parentNode) => {
31390
+ if (reactiveScopesSet.size === 0) return false;
31391
+ if (!parentNode) return false;
31392
+ if (!t4.isCallExpression(parentNode) && !t4.isOptionalCallExpression(parentNode)) {
31393
+ return false;
31394
+ }
31395
+ if (parentNode.arguments[0] !== fnNode) return false;
31396
+ return !!resolveReactiveScopeName(parentNode.callee);
31397
+ };
31398
+ const isInsideNestedFunctionWithReactiveScopes = (nodePath) => {
31399
+ let depth = 0;
31400
+ let current = nodePath;
31401
+ while (current) {
31402
+ if (current.isFunction?.()) {
31403
+ depth++;
31404
+ if (isReactiveScopeCallbackNode(
31405
+ current.node,
31406
+ current.parentPath?.node
31407
+ )) {
31408
+ return depth > 1;
31409
+ }
31410
+ if (depth > 1) return true;
31411
+ }
31412
+ current = current.parentPath;
31413
+ }
31414
+ return false;
31415
+ };
30249
31416
  const getFunctionName = (fnPath) => {
30250
31417
  return fnPath.isFunctionDeclaration() && fnPath.node.id ? fnPath.node.id.name : fnPath.isFunctionExpression() && fnPath.node.id ? fnPath.node.id.name : fnPath.parentPath.isVariableDeclarator() && t4.isIdentifier(fnPath.parentPath.node.id) && fnPath.parentPath.node.init === fnPath.node ? fnPath.parentPath.node.id.name : void 0;
30251
31418
  };
@@ -30257,7 +31424,7 @@ function createHIREntrypointVisitor(t4, options) {
30257
31424
  const name = getFunctionName(fnPath);
30258
31425
  return isHookName2(name);
30259
31426
  };
30260
- const isComponentOrHookDefinition = (fnPath) => isComponentDefinition(fnPath) || isHookDefinition(fnPath);
31427
+ const isComponentOrHookDefinition = (fnPath) => isComponentDefinition(fnPath) || isHookDefinition(fnPath) || isReactiveScopeCallback(fnPath);
30261
31428
  const isComponentLike = (fnPath) => {
30262
31429
  const name = getFunctionName(fnPath);
30263
31430
  return name && isComponentName2(name) || isHookName2(name) || functionHasJSX(fnPath) || functionUsesStateLike(fnPath, t4);
@@ -30345,7 +31512,7 @@ function createHIREntrypointVisitor(t4, options) {
30345
31512
  };
30346
31513
  return checkNode(fn.body);
30347
31514
  };
30348
- path.traverse({
31515
+ path2.traverse({
30349
31516
  FunctionDeclaration(fnPath) {
30350
31517
  const name = fnPath.node.id?.name;
30351
31518
  if (!isComponentName2(name)) return;
@@ -30382,7 +31549,7 @@ function createHIREntrypointVisitor(t4, options) {
30382
31549
  const stateMacroNames = /* @__PURE__ */ new Set(["$state"]);
30383
31550
  const effectMacroNames = /* @__PURE__ */ new Set(["$effect"]);
30384
31551
  const memoMacroNames = /* @__PURE__ */ new Set(["$memo", "createMemo"]);
30385
- path.traverse({
31552
+ path2.traverse({
30386
31553
  ImportDeclaration(importPath) {
30387
31554
  if (importPath.node.source.value !== "fict" && importPath.node.source.value !== "fict/slim")
30388
31555
  return;
@@ -30402,7 +31569,7 @@ function createHIREntrypointVisitor(t4, options) {
30402
31569
  }
30403
31570
  }
30404
31571
  });
30405
- path.traverse({
31572
+ path2.traverse({
30406
31573
  JSXExpressionContainer(exprPath) {
30407
31574
  const expr = exprPath.node.expression;
30408
31575
  if (!t4.isCallExpression(expr)) return;
@@ -30447,7 +31614,7 @@ function createHIREntrypointVisitor(t4, options) {
30447
31614
  const stateVars = /* @__PURE__ */ new Set();
30448
31615
  const derivedVars = /* @__PURE__ */ new Set();
30449
31616
  const destructuredAliases = /* @__PURE__ */ new Set();
30450
- path.traverse({
31617
+ path2.traverse({
30451
31618
  VariableDeclarator(varPath) {
30452
31619
  const init = varPath.node.init;
30453
31620
  if (!init) return;
@@ -30490,7 +31657,7 @@ Signals must be created at the top level of components for stable identity.
30490
31657
  Move the $state() declaration before the loop/condition.`
30491
31658
  );
30492
31659
  }
30493
- if (isInsideNestedFunction(varPath)) {
31660
+ if (isInsideNestedFunctionWithReactiveScopes(varPath)) {
30494
31661
  throw varPath.buildCodeFrameError(
30495
31662
  `$state() cannot be declared inside nested functions.
30496
31663
 
@@ -30575,7 +31742,7 @@ Move the declaration to the top of your component.
30575
31742
  For dynamic collections, consider using $store with an array/object.`
30576
31743
  );
30577
31744
  }
30578
- if (isInsideNestedFunction(callPath)) {
31745
+ if (isInsideNestedFunctionWithReactiveScopes(callPath)) {
30579
31746
  throw callPath.buildCodeFrameError(
30580
31747
  `$state() cannot be declared inside nested functions.
30581
31748
 
@@ -30602,7 +31769,7 @@ For conditional effects, use a condition inside the effect body instead:
30602
31769
  $effect(() => { if (condition) { /* ... */ } })`
30603
31770
  );
30604
31771
  }
30605
- if (isInsideNestedFunction(callPath)) {
31772
+ if (isInsideNestedFunctionWithReactiveScopes(callPath)) {
30606
31773
  throw callPath.buildCodeFrameError(
30607
31774
  `$effect() cannot be called inside nested functions.
30608
31775
 
@@ -30636,7 +31803,7 @@ or extract the nested logic into a custom hook (useXxx).`
30636
31803
  `${calleeId}() must be called inside a component or hook (useX)`
30637
31804
  );
30638
31805
  }
30639
- if (isInsideLoop(callPath) || isInsideConditional(callPath) || isInsideNestedFunction(callPath)) {
31806
+ if (isInsideLoop(callPath) || isInsideConditional(callPath) || isInsideNestedFunctionWithReactiveScopes(callPath)) {
30640
31807
  throw callPath.buildCodeFrameError(
30641
31808
  `${calleeId}() must be called at the top level of a component or hook (no loops/conditions/nested functions)`
30642
31809
  );
@@ -30696,7 +31863,7 @@ or extract the nested logic into a custom hook (useXxx).`
30696
31863
  return usesState;
30697
31864
  };
30698
31865
  debugLog("alias", "state vars", Array.from(stateVars));
30699
- path.traverse({
31866
+ path2.traverse({
30700
31867
  Function: {
30701
31868
  enter() {
30702
31869
  aliasStack.push(/* @__PURE__ */ new Set());
@@ -30754,7 +31921,7 @@ or extract the nested logic into a custom hook (useXxx).`
30754
31921
  }
30755
31922
  });
30756
31923
  if (derivedVars.size > 0) {
30757
- path.traverse({
31924
+ path2.traverse({
30758
31925
  AssignmentExpression(assignPath) {
30759
31926
  const { left } = assignPath.node;
30760
31927
  if (t4.isIdentifier(left) && derivedVars.has(left.name)) {
@@ -30775,7 +31942,7 @@ or extract the nested logic into a custom hook (useXxx).`
30775
31942
  });
30776
31943
  }
30777
31944
  if (destructuredAliases.size > 0) {
30778
- path.traverse({
31945
+ path2.traverse({
30779
31946
  AssignmentExpression(assignPath) {
30780
31947
  const { left } = assignPath.node;
30781
31948
  if (t4.isIdentifier(left) && destructuredAliases.has(left.name)) {
@@ -30803,10 +31970,11 @@ or extract the nested logic into a custom hook (useXxx).`
30803
31970
  }
30804
31971
  });
30805
31972
  }
30806
- if (dev) {
30807
- runWarningPass(path, stateVars, derivedVars, warn, fileName, t4);
31973
+ const shouldRunWarnings = dev || hasErrorEscalation(options);
31974
+ if (shouldRunWarnings) {
31975
+ runWarningPass(path2, stateVars, derivedVars, warn, fileName, t4);
30808
31976
  }
30809
- const fileAst = t4.file(path.node);
31977
+ const fileAst = t4.file(path2.node);
30810
31978
  const hir = buildHIR(
30811
31979
  fileAst,
30812
31980
  {
@@ -30816,24 +31984,26 @@ or extract the nested logic into a custom hook (useXxx).`
30816
31984
  {
30817
31985
  dev,
30818
31986
  fileName,
30819
- onWarn: warn
31987
+ onWarn: warn,
31988
+ reactiveScopes: reactiveScopesSet
30820
31989
  }
30821
31990
  );
30822
31991
  const optimized = optionsWithWarnings.optimize ? optimizeHIR(hir, {
30823
31992
  memoMacroNames,
30824
- inlineDerivedMemos: optionsWithWarnings.inlineDerivedMemos ?? true
31993
+ inlineDerivedMemos: optionsWithWarnings.inlineDerivedMemos ?? true,
31994
+ optimizeLevel: optionsWithWarnings.optimizeLevel ?? "safe"
30825
31995
  }) : hir;
30826
31996
  const lowered = lowerHIRWithRegions(optimized, t4, optionsWithWarnings, {
30827
31997
  state: stateMacroNames,
30828
31998
  effect: effectMacroNames,
30829
31999
  memo: memoMacroNames
30830
32000
  });
30831
- path.node.body = lowered.program.body;
30832
- path.node.directives = lowered.program.directives;
32001
+ path2.node.body = lowered.program.body;
32002
+ path2.node.directives = lowered.program.directives;
30833
32003
  if (!process.env.FICT_SKIP_SCOPE_CRAWL) {
30834
- path.scope.crawl();
32004
+ path2.scope.crawl();
30835
32005
  }
30836
- stripMacroImports(path, t4);
32006
+ stripMacroImports(path2, t4);
30837
32007
  }
30838
32008
  }
30839
32009
  };
@@ -30846,7 +32016,9 @@ var createFictPlugin = declare(
30846
32016
  ...options,
30847
32017
  fineGrainedDom: options.fineGrainedDom ?? true,
30848
32018
  optimize: options.optimize ?? true,
32019
+ optimizeLevel: options.optimizeLevel ?? "safe",
30849
32020
  inlineDerivedMemos: options.inlineDerivedMemos ?? true,
32021
+ emitModuleMetadata: options.emitModuleMetadata ?? "auto",
30850
32022
  dev: options.dev ?? (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test")
30851
32023
  };
30852
32024
  return {
@@ -30857,6 +32029,9 @@ var createFictPlugin = declare(
30857
32029
  );
30858
32030
  var index_default = createFictPlugin;
30859
32031
  export {
32032
+ clearModuleMetadata,
30860
32033
  createFictPlugin,
30861
- index_default as default
32034
+ index_default as default,
32035
+ resolveModuleMetadata,
32036
+ setModuleMetadata
30862
32037
  };