@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.cjs CHANGED
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/shallowEqual.js
33
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/shallowEqual.js
34
34
  var require_shallowEqual = __commonJS({
35
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/shallowEqual.js"(exports2) {
35
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/shallowEqual.js"(exports2) {
36
36
  "use strict";
37
37
  Object.defineProperty(exports2, "__esModule", {
38
38
  value: true
@@ -50,9 +50,9 @@ var require_shallowEqual = __commonJS({
50
50
  }
51
51
  });
52
52
 
53
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/deprecationWarning.js
53
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/deprecationWarning.js
54
54
  var require_deprecationWarning = __commonJS({
55
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/deprecationWarning.js"(exports2) {
55
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/deprecationWarning.js"(exports2) {
56
56
  "use strict";
57
57
  Object.defineProperty(exports2, "__esModule", {
58
58
  value: true
@@ -98,9 +98,9 @@ ${trace}`);
98
98
  }
99
99
  });
100
100
 
101
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/generated/index.js
101
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/generated/index.js
102
102
  var require_generated = __commonJS({
103
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/generated/index.js"(exports2) {
103
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/generated/index.js"(exports2) {
104
104
  "use strict";
105
105
  Object.defineProperty(exports2, "__esModule", {
106
106
  value: true
@@ -185,7 +185,7 @@ var require_generated = __commonJS({
185
185
  exports2.isExpression = isExpression2;
186
186
  exports2.isExpressionStatement = isExpressionStatement2;
187
187
  exports2.isExpressionWrapper = isExpressionWrapper;
188
- exports2.isFile = isFile;
188
+ exports2.isFile = isFile2;
189
189
  exports2.isFlow = isFlow;
190
190
  exports2.isFlowBaseAnnotation = isFlowBaseAnnotation;
191
191
  exports2.isFlowDeclaration = isFlowDeclaration;
@@ -495,7 +495,7 @@ var require_generated = __commonJS({
495
495
  if (node.type !== "ExpressionStatement") return false;
496
496
  return opts == null || (0, _shallowEqual.default)(node, opts);
497
497
  }
498
- function isFile(node, opts) {
498
+ function isFile2(node, opts) {
499
499
  if (!node) return false;
500
500
  if (node.type !== "File") return false;
501
501
  return opts == null || (0, _shallowEqual.default)(node, opts);
@@ -2898,9 +2898,9 @@ var require_generated = __commonJS({
2898
2898
  }
2899
2899
  });
2900
2900
 
2901
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/matchesPattern.js
2901
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/matchesPattern.js
2902
2902
  var require_matchesPattern = __commonJS({
2903
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/matchesPattern.js"(exports2) {
2903
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/matchesPattern.js"(exports2) {
2904
2904
  "use strict";
2905
2905
  Object.defineProperty(exports2, "__esModule", {
2906
2906
  value: true
@@ -2945,9 +2945,9 @@ var require_matchesPattern = __commonJS({
2945
2945
  }
2946
2946
  });
2947
2947
 
2948
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js
2948
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js
2949
2949
  var require_buildMatchMemberExpression = __commonJS({
2950
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js"(exports2) {
2950
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js"(exports2) {
2951
2951
  "use strict";
2952
2952
  Object.defineProperty(exports2, "__esModule", {
2953
2953
  value: true
@@ -2961,9 +2961,9 @@ var require_buildMatchMemberExpression = __commonJS({
2961
2961
  }
2962
2962
  });
2963
2963
 
2964
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/react/isReactComponent.js
2964
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/react/isReactComponent.js
2965
2965
  var require_isReactComponent = __commonJS({
2966
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/react/isReactComponent.js"(exports2) {
2966
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/react/isReactComponent.js"(exports2) {
2967
2967
  "use strict";
2968
2968
  Object.defineProperty(exports2, "__esModule", {
2969
2969
  value: true
@@ -2975,9 +2975,9 @@ var require_isReactComponent = __commonJS({
2975
2975
  }
2976
2976
  });
2977
2977
 
2978
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/react/isCompatTag.js
2978
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/react/isCompatTag.js
2979
2979
  var require_isCompatTag = __commonJS({
2980
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/react/isCompatTag.js"(exports2) {
2980
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/react/isCompatTag.js"(exports2) {
2981
2981
  "use strict";
2982
2982
  Object.defineProperty(exports2, "__esModule", {
2983
2983
  value: true
@@ -2989,9 +2989,9 @@ var require_isCompatTag = __commonJS({
2989
2989
  }
2990
2990
  });
2991
2991
 
2992
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isType.js
2992
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isType.js
2993
2993
  var require_isType = __commonJS({
2994
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isType.js"(exports2) {
2994
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isType.js"(exports2) {
2995
2995
  "use strict";
2996
2996
  Object.defineProperty(exports2, "__esModule", {
2997
2997
  value: true
@@ -3009,9 +3009,9 @@ var require_isType = __commonJS({
3009
3009
  }
3010
3010
  });
3011
3011
 
3012
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isPlaceholderType.js
3012
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isPlaceholderType.js
3013
3013
  var require_isPlaceholderType = __commonJS({
3014
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isPlaceholderType.js"(exports2) {
3014
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isPlaceholderType.js"(exports2) {
3015
3015
  "use strict";
3016
3016
  Object.defineProperty(exports2, "__esModule", {
3017
3017
  value: true
@@ -3027,9 +3027,9 @@ var require_isPlaceholderType = __commonJS({
3027
3027
  }
3028
3028
  });
3029
3029
 
3030
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/is.js
3030
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/is.js
3031
3031
  var require_is = __commonJS({
3032
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/is.js"(exports2) {
3032
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/is.js"(exports2) {
3033
3033
  "use strict";
3034
3034
  Object.defineProperty(exports2, "__esModule", {
3035
3035
  value: true
@@ -3228,9 +3228,9 @@ var require_lib = __commonJS({
3228
3228
  }
3229
3229
  });
3230
3230
 
3231
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isValidIdentifier.js
3231
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isValidIdentifier.js
3232
3232
  var require_isValidIdentifier = __commonJS({
3233
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isValidIdentifier.js"(exports2) {
3233
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isValidIdentifier.js"(exports2) {
3234
3234
  "use strict";
3235
3235
  Object.defineProperty(exports2, "__esModule", {
3236
3236
  value: true
@@ -3545,9 +3545,9 @@ var require_lib2 = __commonJS({
3545
3545
  }
3546
3546
  });
3547
3547
 
3548
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/constants/index.js
3548
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/constants/index.js
3549
3549
  var require_constants = __commonJS({
3550
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/constants/index.js"(exports2) {
3550
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/constants/index.js"(exports2) {
3551
3551
  "use strict";
3552
3552
  Object.defineProperty(exports2, "__esModule", {
3553
3553
  value: true
@@ -3574,16 +3574,14 @@ var require_constants = __commonJS({
3574
3574
  optional: ["typeAnnotation", "typeParameters", "returnType"],
3575
3575
  force: ["start", "loc", "end"]
3576
3576
  };
3577
- {
3578
- exports2.BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
3579
- exports2.NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
3580
- }
3577
+ exports2.BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
3578
+ exports2.NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
3581
3579
  }
3582
3580
  });
3583
3581
 
3584
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/utils.js
3582
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/utils.js
3585
3583
  var require_utils = __commonJS({
3586
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/utils.js"(exports2) {
3584
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/utils.js"(exports2) {
3587
3585
  "use strict";
3588
3586
  Object.defineProperty(exports2, "__esModule", {
3589
3587
  value: true
@@ -3882,9 +3880,9 @@ ${errors.join("\n")}`);
3882
3880
  }
3883
3881
  });
3884
3882
 
3885
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/core.js
3883
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/core.js
3886
3884
  var require_core = __commonJS({
3887
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/core.js"(exports2) {
3885
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/core.js"(exports2) {
3888
3886
  "use strict";
3889
3887
  Object.defineProperty(exports2, "__esModule", {
3890
3888
  value: true
@@ -4353,8 +4351,6 @@ var require_core = __commonJS({
4353
4351
  validate: (0, _utils.chain)((0, _utils.assertValueType)("number"), Object.assign(function(node, key, val) {
4354
4352
  if (1 / val < 0 || !Number.isFinite(val)) {
4355
4353
  const error = new Error(`NumericLiterals must be non-negative finite numbers. You can use t.valueToNode(${val}) instead.`);
4356
- {
4357
- }
4358
4354
  }
4359
4355
  }, {
4360
4356
  type: "number"
@@ -4962,13 +4958,13 @@ var require_core = __commonJS({
4962
4958
  attributes: {
4963
4959
  optional: true,
4964
4960
  validate: (0, _utils.arrayOfType)("ImportAttribute")
4965
- },
4966
- assertions: {
4967
- deprecated: true,
4968
- optional: true,
4969
- validate: (0, _utils.arrayOfType)("ImportAttribute")
4970
4961
  }
4971
4962
  };
4963
+ importAttributes.assertions = {
4964
+ deprecated: true,
4965
+ optional: true,
4966
+ validate: (0, _utils.arrayOfType)("ImportAttribute")
4967
+ };
4972
4968
  defineType("ExportAllDeclaration", {
4973
4969
  builder: ["source"],
4974
4970
  visitor: ["source", "attributes", "assertions"],
@@ -5615,9 +5611,9 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
5615
5611
  }
5616
5612
  });
5617
5613
 
5618
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/flow.js
5614
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/flow.js
5619
5615
  var require_flow = __commonJS({
5620
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/flow.js"() {
5616
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/flow.js"() {
5621
5617
  "use strict";
5622
5618
  var _core = require_core();
5623
5619
  var _utils = require_utils();
@@ -6113,9 +6109,9 @@ var require_flow = __commonJS({
6113
6109
  }
6114
6110
  });
6115
6111
 
6116
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/jsx.js
6112
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/jsx.js
6117
6113
  var require_jsx = __commonJS({
6118
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/jsx.js"() {
6114
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/jsx.js"() {
6119
6115
  "use strict";
6120
6116
  var _utils = require_utils();
6121
6117
  var defineType = (0, _utils.defineAliasedType)("JSX");
@@ -6273,9 +6269,9 @@ var require_jsx = __commonJS({
6273
6269
  }
6274
6270
  });
6275
6271
 
6276
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/placeholders.js
6272
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/placeholders.js
6277
6273
  var require_placeholders = __commonJS({
6278
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/placeholders.js"(exports2) {
6274
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/placeholders.js"(exports2) {
6279
6275
  "use strict";
6280
6276
  Object.defineProperty(exports2, "__esModule", {
6281
6277
  value: true
@@ -6303,19 +6299,17 @@ var require_placeholders = __commonJS({
6303
6299
  }
6304
6300
  });
6305
6301
 
6306
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/misc.js
6302
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/misc.js
6307
6303
  var require_misc = __commonJS({
6308
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/misc.js"() {
6304
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/misc.js"() {
6309
6305
  "use strict";
6310
6306
  var _utils = require_utils();
6311
6307
  var _placeholders = require_placeholders();
6312
6308
  var _core = require_core();
6313
6309
  var defineType = (0, _utils.defineAliasedType)("Miscellaneous");
6314
- {
6315
- defineType("Noop", {
6316
- visitor: []
6317
- });
6318
- }
6310
+ defineType("Noop", {
6311
+ visitor: []
6312
+ });
6319
6313
  defineType("Placeholder", {
6320
6314
  visitor: [],
6321
6315
  builder: ["expectedNode", "name"],
@@ -6339,9 +6333,9 @@ var require_misc = __commonJS({
6339
6333
  }
6340
6334
  });
6341
6335
 
6342
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/experimental.js
6336
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/experimental.js
6343
6337
  var require_experimental = __commonJS({
6344
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/experimental.js"() {
6338
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/experimental.js"() {
6345
6339
  "use strict";
6346
6340
  var _utils = require_utils();
6347
6341
  (0, _utils.default)("ArgumentPlaceholder", {});
@@ -6418,17 +6412,15 @@ var require_experimental = __commonJS({
6418
6412
  visitor: ["elements"],
6419
6413
  aliases: ["Expression"]
6420
6414
  });
6421
- {
6422
- (0, _utils.default)("DecimalLiteral", {
6423
- builder: ["value"],
6424
- fields: {
6425
- value: {
6426
- validate: (0, _utils.assertValueType)("string")
6427
- }
6428
- },
6429
- aliases: ["Expression", "Pureish", "Literal", "Immutable"]
6430
- });
6431
- }
6415
+ (0, _utils.default)("DecimalLiteral", {
6416
+ builder: ["value"],
6417
+ fields: {
6418
+ value: {
6419
+ validate: (0, _utils.assertValueType)("string")
6420
+ }
6421
+ },
6422
+ aliases: ["Expression", "Pureish", "Literal", "Immutable"]
6423
+ });
6432
6424
  (0, _utils.default)("ModuleExpression", {
6433
6425
  visitor: ["body"],
6434
6426
  fields: {
@@ -6470,9 +6462,9 @@ var require_experimental = __commonJS({
6470
6462
  }
6471
6463
  });
6472
6464
 
6473
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/typescript.js
6465
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/typescript.js
6474
6466
  var require_typescript = __commonJS({
6475
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/typescript.js"() {
6467
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/typescript.js"() {
6476
6468
  "use strict";
6477
6469
  var _utils = require_utils();
6478
6470
  var _core = require_core();
@@ -6784,16 +6776,14 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
6784
6776
  }
6785
6777
  }
6786
6778
  });
6787
- {
6788
- defineType("TSExpressionWithTypeArguments", {
6789
- aliases: ["TSType"],
6790
- visitor: ["expression", "typeParameters"],
6791
- fields: {
6792
- expression: (0, _utils.validateType)("TSEntityName"),
6793
- typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
6794
- }
6795
- });
6796
- }
6779
+ defineType("TSExpressionWithTypeArguments", {
6780
+ aliases: ["TSType"],
6781
+ visitor: ["expression", "typeParameters"],
6782
+ fields: {
6783
+ expression: (0, _utils.validateType)("TSEntityName"),
6784
+ typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
6785
+ }
6786
+ });
6797
6787
  defineType("TSInterfaceDeclaration", {
6798
6788
  aliases: ["Statement", "Declaration"],
6799
6789
  visitor: ["id", "typeParameters", "extends", "body"],
@@ -6853,20 +6843,18 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
6853
6843
  members: (0, _utils.validateArrayOfType)("TSEnumMember")
6854
6844
  }
6855
6845
  });
6856
- {
6857
- defineType("TSEnumDeclaration", {
6858
- aliases: ["Statement", "Declaration"],
6859
- visitor: ["id", "members"],
6860
- fields: {
6861
- declare: (0, _utils.validateOptional)(bool),
6862
- const: (0, _utils.validateOptional)(bool),
6863
- id: (0, _utils.validateType)("Identifier"),
6864
- members: (0, _utils.validateArrayOfType)("TSEnumMember"),
6865
- initializer: (0, _utils.validateOptionalType)("Expression"),
6866
- body: (0, _utils.validateOptionalType)("TSEnumBody")
6867
- }
6868
- });
6869
- }
6846
+ defineType("TSEnumDeclaration", {
6847
+ aliases: ["Statement", "Declaration"],
6848
+ visitor: ["id", "members"],
6849
+ fields: {
6850
+ declare: (0, _utils.validateOptional)(bool),
6851
+ const: (0, _utils.validateOptional)(bool),
6852
+ id: (0, _utils.validateType)("Identifier"),
6853
+ members: (0, _utils.validateArrayOfType)("TSEnumMember"),
6854
+ initializer: (0, _utils.validateOptionalType)("Expression"),
6855
+ body: (0, _utils.validateOptionalType)("TSEnumBody")
6856
+ }
6857
+ });
6870
6858
  defineType("TSEnumMember", {
6871
6859
  visitor: ["id", "initializer"],
6872
6860
  fields: {
@@ -6900,15 +6888,18 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
6900
6888
  aliases: ["TSType"],
6901
6889
  builder: ["argument", "qualifier", "typeParameters"],
6902
6890
  visitor: ["argument", "options", "qualifier", "typeParameters"],
6903
- fields: {
6904
- argument: (0, _utils.validateType)("StringLiteral"),
6905
- qualifier: (0, _utils.validateOptionalType)("TSEntityName"),
6906
- ["typeParameters"]: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation"),
6891
+ fields: Object.assign({}, {
6892
+ argument: (0, _utils.validateType)("StringLiteral")
6893
+ }, {
6894
+ qualifier: (0, _utils.validateOptionalType)("TSEntityName")
6895
+ }, {
6896
+ typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
6897
+ }, {
6907
6898
  options: {
6908
6899
  validate: (0, _utils.assertNodeType)("ObjectExpression"),
6909
6900
  optional: true
6910
6901
  }
6911
- }
6902
+ })
6912
6903
  });
6913
6904
  defineType("TSImportEqualsDeclaration", {
6914
6905
  aliases: ["Statement", "Declaration"],
@@ -7003,9 +6994,9 @@ Expected ${val.length + 1} quasis but got ${node.quasis.length}`);
7003
6994
  }
7004
6995
  });
7005
6996
 
7006
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/deprecated-aliases.js
6997
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/deprecated-aliases.js
7007
6998
  var require_deprecated_aliases = __commonJS({
7008
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/deprecated-aliases.js"(exports2) {
6999
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/deprecated-aliases.js"(exports2) {
7009
7000
  "use strict";
7010
7001
  Object.defineProperty(exports2, "__esModule", {
7011
7002
  value: true
@@ -7017,9 +7008,9 @@ var require_deprecated_aliases = __commonJS({
7017
7008
  }
7018
7009
  });
7019
7010
 
7020
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/index.js
7011
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/index.js
7021
7012
  var require_definitions = __commonJS({
7022
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/definitions/index.js"(exports2) {
7013
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/definitions/index.js"(exports2) {
7023
7014
  "use strict";
7024
7015
  Object.defineProperty(exports2, "__esModule", {
7025
7016
  value: true
@@ -7126,9 +7117,9 @@ var require_definitions = __commonJS({
7126
7117
  }
7127
7118
  });
7128
7119
 
7129
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/validate.js
7120
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/validate.js
7130
7121
  var require_validate = __commonJS({
7131
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/validate.js"(exports2) {
7122
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/validate.js"(exports2) {
7132
7123
  "use strict";
7133
7124
  Object.defineProperty(exports2, "__esModule", {
7134
7125
  value: true
@@ -7171,9 +7162,9 @@ var require_validate = __commonJS({
7171
7162
  }
7172
7163
  });
7173
7164
 
7174
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/lowercase.js
7165
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/lowercase.js
7175
7166
  var require_lowercase = __commonJS({
7176
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/lowercase.js"(exports2) {
7167
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/lowercase.js"(exports2) {
7177
7168
  "use strict";
7178
7169
  Object.defineProperty(exports2, "__esModule", {
7179
7170
  value: true
@@ -7328,7 +7319,7 @@ var require_lowercase = __commonJS({
7328
7319
  exports2.restElement = restElement;
7329
7320
  exports2.restProperty = RestProperty;
7330
7321
  exports2.returnStatement = returnStatement2;
7331
- exports2.sequenceExpression = sequenceExpression;
7322
+ exports2.sequenceExpression = sequenceExpression2;
7332
7323
  exports2.spreadElement = spreadElement;
7333
7324
  exports2.spreadProperty = SpreadProperty;
7334
7325
  exports2.staticBlock = staticBlock;
@@ -7882,7 +7873,7 @@ var require_lowercase = __commonJS({
7882
7873
  validate(defs.argument, node, "argument", argument, 1);
7883
7874
  return node;
7884
7875
  }
7885
- function sequenceExpression(expressions) {
7876
+ function sequenceExpression2(expressions) {
7886
7877
  const node = {
7887
7878
  type: "SequenceExpression",
7888
7879
  expressions
@@ -10070,9 +10061,9 @@ var require_lowercase = __commonJS({
10070
10061
  }
10071
10062
  });
10072
10063
 
10073
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/uppercase.js
10064
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/uppercase.js
10074
10065
  var require_uppercase = __commonJS({
10075
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/uppercase.js"(exports2) {
10066
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/uppercase.js"(exports2) {
10076
10067
  "use strict";
10077
10068
  Object.defineProperty(exports2, "__esModule", {
10078
10069
  value: true
@@ -10083,9 +10074,7 @@ var require_uppercase = __commonJS({
10083
10074
  var b = require_lowercase();
10084
10075
  var _deprecationWarning = require_deprecationWarning();
10085
10076
  function alias(lowercase) {
10086
- {
10087
- return b[lowercase];
10088
- }
10077
+ return b[lowercase];
10089
10078
  }
10090
10079
  var ArrayExpression = exports2.ArrayExpression = alias("arrayExpression");
10091
10080
  var AssignmentExpression = exports2.AssignmentExpression = alias("assignmentExpression");
@@ -10347,9 +10336,9 @@ var require_uppercase = __commonJS({
10347
10336
  }
10348
10337
  });
10349
10338
 
10350
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/index.js
10339
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/index.js
10351
10340
  var require_generated2 = __commonJS({
10352
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/generated/index.js"(exports2) {
10341
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/generated/index.js"(exports2) {
10353
10342
  "use strict";
10354
10343
  Object.defineProperty(exports2, "__esModule", {
10355
10344
  value: true
@@ -10379,9 +10368,9 @@ var require_generated2 = __commonJS({
10379
10368
  }
10380
10369
  });
10381
10370
 
10382
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
10371
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js
10383
10372
  var require_cleanJSXElementLiteralChild = __commonJS({
10384
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js"(exports2) {
10373
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js"(exports2) {
10385
10374
  "use strict";
10386
10375
  Object.defineProperty(exports2, "__esModule", {
10387
10376
  value: true
@@ -10422,9 +10411,9 @@ var require_cleanJSXElementLiteralChild = __commonJS({
10422
10411
  }
10423
10412
  });
10424
10413
 
10425
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/react/buildChildren.js
10414
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/react/buildChildren.js
10426
10415
  var require_buildChildren = __commonJS({
10427
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/react/buildChildren.js"(exports2) {
10416
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/react/buildChildren.js"(exports2) {
10428
10417
  "use strict";
10429
10418
  Object.defineProperty(exports2, "__esModule", {
10430
10419
  value: true
@@ -10449,9 +10438,9 @@ var require_buildChildren = __commonJS({
10449
10438
  }
10450
10439
  });
10451
10440
 
10452
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isNode.js
10441
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isNode.js
10453
10442
  var require_isNode = __commonJS({
10454
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isNode.js"(exports2) {
10443
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isNode.js"(exports2) {
10455
10444
  "use strict";
10456
10445
  Object.defineProperty(exports2, "__esModule", {
10457
10446
  value: true
@@ -10464,9 +10453,9 @@ var require_isNode = __commonJS({
10464
10453
  }
10465
10454
  });
10466
10455
 
10467
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/asserts/assertNode.js
10456
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/asserts/assertNode.js
10468
10457
  var require_assertNode = __commonJS({
10469
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/asserts/assertNode.js"(exports2) {
10458
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/asserts/assertNode.js"(exports2) {
10470
10459
  "use strict";
10471
10460
  Object.defineProperty(exports2, "__esModule", {
10472
10461
  value: true
@@ -10483,9 +10472,9 @@ var require_assertNode = __commonJS({
10483
10472
  }
10484
10473
  });
10485
10474
 
10486
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/asserts/generated/index.js
10475
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/asserts/generated/index.js
10487
10476
  var require_generated3 = __commonJS({
10488
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/asserts/generated/index.js"(exports2) {
10477
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/asserts/generated/index.js"(exports2) {
10489
10478
  "use strict";
10490
10479
  Object.defineProperty(exports2, "__esModule", {
10491
10480
  value: true
@@ -11737,9 +11726,9 @@ var require_generated3 = __commonJS({
11737
11726
  }
11738
11727
  });
11739
11728
 
11740
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js
11729
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js
11741
11730
  var require_createTypeAnnotationBasedOnTypeof = __commonJS({
11742
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js"(exports2) {
11731
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js"(exports2) {
11743
11732
  "use strict";
11744
11733
  Object.defineProperty(exports2, "__esModule", {
11745
11734
  value: true
@@ -11771,9 +11760,9 @@ var require_createTypeAnnotationBasedOnTypeof = __commonJS({
11771
11760
  }
11772
11761
  });
11773
11762
 
11774
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js
11763
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js
11775
11764
  var require_removeTypeDuplicates = __commonJS({
11776
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js"(exports2) {
11765
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js"(exports2) {
11777
11766
  "use strict";
11778
11767
  Object.defineProperty(exports2, "__esModule", {
11779
11768
  value: true
@@ -11839,9 +11828,9 @@ var require_removeTypeDuplicates = __commonJS({
11839
11828
  }
11840
11829
  });
11841
11830
 
11842
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js
11831
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js
11843
11832
  var require_createFlowUnionType = __commonJS({
11844
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js"(exports2) {
11833
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js"(exports2) {
11845
11834
  "use strict";
11846
11835
  Object.defineProperty(exports2, "__esModule", {
11847
11836
  value: true
@@ -11860,9 +11849,9 @@ var require_createFlowUnionType = __commonJS({
11860
11849
  }
11861
11850
  });
11862
11851
 
11863
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js
11852
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js
11864
11853
  var require_removeTypeDuplicates2 = __commonJS({
11865
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js"(exports2) {
11854
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js"(exports2) {
11866
11855
  "use strict";
11867
11856
  Object.defineProperty(exports2, "__esModule", {
11868
11857
  value: true
@@ -11929,9 +11918,9 @@ var require_removeTypeDuplicates2 = __commonJS({
11929
11918
  }
11930
11919
  });
11931
11920
 
11932
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js
11921
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js
11933
11922
  var require_createTSUnionType = __commonJS({
11934
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js"(exports2) {
11923
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js"(exports2) {
11935
11924
  "use strict";
11936
11925
  Object.defineProperty(exports2, "__esModule", {
11937
11926
  value: true
@@ -11954,9 +11943,9 @@ var require_createTSUnionType = __commonJS({
11954
11943
  }
11955
11944
  });
11956
11945
 
11957
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/productions.js
11946
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/productions.js
11958
11947
  var require_productions = __commonJS({
11959
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/builders/productions.js"(exports2) {
11948
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/builders/productions.js"(exports2) {
11960
11949
  "use strict";
11961
11950
  Object.defineProperty(exports2, "__esModule", {
11962
11951
  value: true
@@ -11969,14 +11958,14 @@ var require_productions = __commonJS({
11969
11958
  }
11970
11959
  });
11971
11960
 
11972
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneNode.js
11961
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneNode.js
11973
11962
  var require_cloneNode = __commonJS({
11974
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneNode.js"(exports2) {
11963
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneNode.js"(exports2) {
11975
11964
  "use strict";
11976
11965
  Object.defineProperty(exports2, "__esModule", {
11977
11966
  value: true
11978
11967
  });
11979
- exports2.default = cloneNode;
11968
+ exports2.default = cloneNode2;
11980
11969
  var _index = require_definitions();
11981
11970
  var _index2 = require_generated();
11982
11971
  var {
@@ -11996,7 +11985,7 @@ var require_cloneNode = __commonJS({
11996
11985
  }
11997
11986
  return cloneIfNode(obj, deep, withoutLoc, commentsCache);
11998
11987
  }
11999
- function cloneNode(node, deep = true, withoutLoc = false) {
11988
+ function cloneNode2(node, deep = true, withoutLoc = false) {
12000
11989
  return cloneNodeInternal(node, deep, withoutLoc, /* @__PURE__ */ new Map());
12001
11990
  }
12002
11991
  function cloneNodeInternal(node, deep = true, withoutLoc = false, commentsCache) {
@@ -12079,9 +12068,9 @@ var require_cloneNode = __commonJS({
12079
12068
  }
12080
12069
  });
12081
12070
 
12082
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/clone.js
12071
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/clone.js
12083
12072
  var require_clone = __commonJS({
12084
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/clone.js"(exports2) {
12073
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/clone.js"(exports2) {
12085
12074
  "use strict";
12086
12075
  Object.defineProperty(exports2, "__esModule", {
12087
12076
  value: true
@@ -12094,9 +12083,9 @@ var require_clone = __commonJS({
12094
12083
  }
12095
12084
  });
12096
12085
 
12097
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneDeep.js
12086
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneDeep.js
12098
12087
  var require_cloneDeep = __commonJS({
12099
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneDeep.js"(exports2) {
12088
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneDeep.js"(exports2) {
12100
12089
  "use strict";
12101
12090
  Object.defineProperty(exports2, "__esModule", {
12102
12091
  value: true
@@ -12109,9 +12098,9 @@ var require_cloneDeep = __commonJS({
12109
12098
  }
12110
12099
  });
12111
12100
 
12112
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js
12101
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js
12113
12102
  var require_cloneDeepWithoutLoc = __commonJS({
12114
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js"(exports2) {
12103
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js"(exports2) {
12115
12104
  "use strict";
12116
12105
  Object.defineProperty(exports2, "__esModule", {
12117
12106
  value: true
@@ -12124,9 +12113,9 @@ var require_cloneDeepWithoutLoc = __commonJS({
12124
12113
  }
12125
12114
  });
12126
12115
 
12127
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
12116
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
12128
12117
  var require_cloneWithoutLoc = __commonJS({
12129
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js"(exports2) {
12118
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js"(exports2) {
12130
12119
  "use strict";
12131
12120
  Object.defineProperty(exports2, "__esModule", {
12132
12121
  value: true
@@ -12139,9 +12128,9 @@ var require_cloneWithoutLoc = __commonJS({
12139
12128
  }
12140
12129
  });
12141
12130
 
12142
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/addComments.js
12131
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/addComments.js
12143
12132
  var require_addComments = __commonJS({
12144
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/addComments.js"(exports2) {
12133
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/addComments.js"(exports2) {
12145
12134
  "use strict";
12146
12135
  Object.defineProperty(exports2, "__esModule", {
12147
12136
  value: true
@@ -12164,9 +12153,9 @@ var require_addComments = __commonJS({
12164
12153
  }
12165
12154
  });
12166
12155
 
12167
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/addComment.js
12156
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/addComment.js
12168
12157
  var require_addComment = __commonJS({
12169
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/addComment.js"(exports2) {
12158
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/addComment.js"(exports2) {
12170
12159
  "use strict";
12171
12160
  Object.defineProperty(exports2, "__esModule", {
12172
12161
  value: true
@@ -12182,9 +12171,9 @@ var require_addComment = __commonJS({
12182
12171
  }
12183
12172
  });
12184
12173
 
12185
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/inherit.js
12174
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/inherit.js
12186
12175
  var require_inherit = __commonJS({
12187
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/utils/inherit.js"(exports2) {
12176
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/utils/inherit.js"(exports2) {
12188
12177
  "use strict";
12189
12178
  Object.defineProperty(exports2, "__esModule", {
12190
12179
  value: true
@@ -12198,9 +12187,9 @@ var require_inherit = __commonJS({
12198
12187
  }
12199
12188
  });
12200
12189
 
12201
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritInnerComments.js
12190
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritInnerComments.js
12202
12191
  var require_inheritInnerComments = __commonJS({
12203
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritInnerComments.js"(exports2) {
12192
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritInnerComments.js"(exports2) {
12204
12193
  "use strict";
12205
12194
  Object.defineProperty(exports2, "__esModule", {
12206
12195
  value: true
@@ -12213,9 +12202,9 @@ var require_inheritInnerComments = __commonJS({
12213
12202
  }
12214
12203
  });
12215
12204
 
12216
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritLeadingComments.js
12205
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritLeadingComments.js
12217
12206
  var require_inheritLeadingComments = __commonJS({
12218
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritLeadingComments.js"(exports2) {
12207
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritLeadingComments.js"(exports2) {
12219
12208
  "use strict";
12220
12209
  Object.defineProperty(exports2, "__esModule", {
12221
12210
  value: true
@@ -12228,9 +12217,9 @@ var require_inheritLeadingComments = __commonJS({
12228
12217
  }
12229
12218
  });
12230
12219
 
12231
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritTrailingComments.js
12220
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritTrailingComments.js
12232
12221
  var require_inheritTrailingComments = __commonJS({
12233
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritTrailingComments.js"(exports2) {
12222
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritTrailingComments.js"(exports2) {
12234
12223
  "use strict";
12235
12224
  Object.defineProperty(exports2, "__esModule", {
12236
12225
  value: true
@@ -12243,9 +12232,9 @@ var require_inheritTrailingComments = __commonJS({
12243
12232
  }
12244
12233
  });
12245
12234
 
12246
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritsComments.js
12235
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritsComments.js
12247
12236
  var require_inheritsComments = __commonJS({
12248
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/inheritsComments.js"(exports2) {
12237
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/inheritsComments.js"(exports2) {
12249
12238
  "use strict";
12250
12239
  Object.defineProperty(exports2, "__esModule", {
12251
12240
  value: true
@@ -12263,9 +12252,9 @@ var require_inheritsComments = __commonJS({
12263
12252
  }
12264
12253
  });
12265
12254
 
12266
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/removeComments.js
12255
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/removeComments.js
12267
12256
  var require_removeComments = __commonJS({
12268
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/comments/removeComments.js"(exports2) {
12257
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/comments/removeComments.js"(exports2) {
12269
12258
  "use strict";
12270
12259
  Object.defineProperty(exports2, "__esModule", {
12271
12260
  value: true
@@ -12281,9 +12270,9 @@ var require_removeComments = __commonJS({
12281
12270
  }
12282
12271
  });
12283
12272
 
12284
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/constants/generated/index.js
12273
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/constants/generated/index.js
12285
12274
  var require_generated4 = __commonJS({
12286
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/constants/generated/index.js"(exports2) {
12275
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/constants/generated/index.js"(exports2) {
12287
12276
  "use strict";
12288
12277
  Object.defineProperty(exports2, "__esModule", {
12289
12278
  value: true
@@ -12344,9 +12333,9 @@ var require_generated4 = __commonJS({
12344
12333
  }
12345
12334
  });
12346
12335
 
12347
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toBlock.js
12336
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toBlock.js
12348
12337
  var require_toBlock = __commonJS({
12349
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toBlock.js"(exports2) {
12338
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toBlock.js"(exports2) {
12350
12339
  "use strict";
12351
12340
  Object.defineProperty(exports2, "__esModule", {
12352
12341
  value: true
@@ -12376,9 +12365,9 @@ var require_toBlock = __commonJS({
12376
12365
  }
12377
12366
  });
12378
12367
 
12379
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/ensureBlock.js
12368
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/ensureBlock.js
12380
12369
  var require_ensureBlock = __commonJS({
12381
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/ensureBlock.js"(exports2) {
12370
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/ensureBlock.js"(exports2) {
12382
12371
  "use strict";
12383
12372
  Object.defineProperty(exports2, "__esModule", {
12384
12373
  value: true
@@ -12393,9 +12382,9 @@ var require_ensureBlock = __commonJS({
12393
12382
  }
12394
12383
  });
12395
12384
 
12396
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toIdentifier.js
12385
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toIdentifier.js
12397
12386
  var require_toIdentifier = __commonJS({
12398
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toIdentifier.js"(exports2) {
12387
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toIdentifier.js"(exports2) {
12399
12388
  "use strict";
12400
12389
  Object.defineProperty(exports2, "__esModule", {
12401
12390
  value: true
@@ -12421,9 +12410,9 @@ var require_toIdentifier = __commonJS({
12421
12410
  }
12422
12411
  });
12423
12412
 
12424
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
12413
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
12425
12414
  var require_toBindingIdentifierName = __commonJS({
12426
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js"(exports2) {
12415
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js"(exports2) {
12427
12416
  "use strict";
12428
12417
  Object.defineProperty(exports2, "__esModule", {
12429
12418
  value: true
@@ -12438,9 +12427,9 @@ var require_toBindingIdentifierName = __commonJS({
12438
12427
  }
12439
12428
  });
12440
12429
 
12441
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toComputedKey.js
12430
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toComputedKey.js
12442
12431
  var require_toComputedKey = __commonJS({
12443
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toComputedKey.js"(exports2) {
12432
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toComputedKey.js"(exports2) {
12444
12433
  "use strict";
12445
12434
  Object.defineProperty(exports2, "__esModule", {
12446
12435
  value: true
@@ -12455,9 +12444,9 @@ var require_toComputedKey = __commonJS({
12455
12444
  }
12456
12445
  });
12457
12446
 
12458
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toExpression.js
12447
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toExpression.js
12459
12448
  var require_toExpression = __commonJS({
12460
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toExpression.js"(exports2) {
12449
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toExpression.js"(exports2) {
12461
12450
  "use strict";
12462
12451
  Object.defineProperty(exports2, "__esModule", {
12463
12452
  value: true
@@ -12486,9 +12475,9 @@ var require_toExpression = __commonJS({
12486
12475
  }
12487
12476
  });
12488
12477
 
12489
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/traverse/traverseFast.js
12478
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/traverse/traverseFast.js
12490
12479
  var require_traverseFast = __commonJS({
12491
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/traverse/traverseFast.js"(exports2) {
12480
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/traverse/traverseFast.js"(exports2) {
12492
12481
  "use strict";
12493
12482
  Object.defineProperty(exports2, "__esModule", {
12494
12483
  value: true
@@ -12529,9 +12518,9 @@ var require_traverseFast = __commonJS({
12529
12518
  }
12530
12519
  });
12531
12520
 
12532
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/removeProperties.js
12521
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/removeProperties.js
12533
12522
  var require_removeProperties = __commonJS({
12534
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/removeProperties.js"(exports2) {
12523
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/removeProperties.js"(exports2) {
12535
12524
  "use strict";
12536
12525
  Object.defineProperty(exports2, "__esModule", {
12537
12526
  value: true
@@ -12546,7 +12535,7 @@ var require_removeProperties = __commonJS({
12546
12535
  if (node[key] != null) node[key] = void 0;
12547
12536
  }
12548
12537
  for (const key of Object.keys(node)) {
12549
- if (key[0] === "_" && node[key] != null) node[key] = void 0;
12538
+ if (key.startsWith("_") && node[key] != null) node[key] = void 0;
12550
12539
  }
12551
12540
  const symbols = Object.getOwnPropertySymbols(node);
12552
12541
  for (const sym of symbols) {
@@ -12556,9 +12545,9 @@ var require_removeProperties = __commonJS({
12556
12545
  }
12557
12546
  });
12558
12547
 
12559
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js
12548
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js
12560
12549
  var require_removePropertiesDeep = __commonJS({
12561
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js"(exports2) {
12550
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js"(exports2) {
12562
12551
  "use strict";
12563
12552
  Object.defineProperty(exports2, "__esModule", {
12564
12553
  value: true
@@ -12573,9 +12562,9 @@ var require_removePropertiesDeep = __commonJS({
12573
12562
  }
12574
12563
  });
12575
12564
 
12576
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toKeyAlias.js
12565
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toKeyAlias.js
12577
12566
  var require_toKeyAlias = __commonJS({
12578
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toKeyAlias.js"(exports2) {
12567
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toKeyAlias.js"(exports2) {
12579
12568
  "use strict";
12580
12569
  Object.defineProperty(exports2, "__esModule", {
12581
12570
  value: true
@@ -12614,9 +12603,9 @@ var require_toKeyAlias = __commonJS({
12614
12603
  }
12615
12604
  });
12616
12605
 
12617
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toStatement.js
12606
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toStatement.js
12618
12607
  var require_toStatement = __commonJS({
12619
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toStatement.js"(exports2) {
12608
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toStatement.js"(exports2) {
12620
12609
  "use strict";
12621
12610
  Object.defineProperty(exports2, "__esModule", {
12622
12611
  value: true
@@ -12656,9 +12645,9 @@ var require_toStatement = __commonJS({
12656
12645
  }
12657
12646
  });
12658
12647
 
12659
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/valueToNode.js
12648
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/valueToNode.js
12660
12649
  var require_valueToNode = __commonJS({
12661
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/valueToNode.js"(exports2) {
12650
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/valueToNode.js"(exports2) {
12662
12651
  "use strict";
12663
12652
  Object.defineProperty(exports2, "__esModule", {
12664
12653
  value: true
@@ -12747,9 +12736,9 @@ var require_valueToNode = __commonJS({
12747
12736
  }
12748
12737
  });
12749
12738
 
12750
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js
12739
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js
12751
12740
  var require_appendToMemberExpression = __commonJS({
12752
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js"(exports2) {
12741
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js"(exports2) {
12753
12742
  "use strict";
12754
12743
  Object.defineProperty(exports2, "__esModule", {
12755
12744
  value: true
@@ -12765,9 +12754,9 @@ var require_appendToMemberExpression = __commonJS({
12765
12754
  }
12766
12755
  });
12767
12756
 
12768
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/inherits.js
12757
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/inherits.js
12769
12758
  var require_inherits = __commonJS({
12770
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/inherits.js"(exports2) {
12759
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/inherits.js"(exports2) {
12771
12760
  "use strict";
12772
12761
  Object.defineProperty(exports2, "__esModule", {
12773
12762
  value: true
@@ -12783,7 +12772,7 @@ var require_inherits = __commonJS({
12783
12772
  }
12784
12773
  }
12785
12774
  for (const key of Object.keys(parent)) {
12786
- if (key[0] === "_" && key !== "__clone") {
12775
+ if (key.startsWith("_") && key !== "__clone") {
12787
12776
  child[key] = parent[key];
12788
12777
  }
12789
12778
  }
@@ -12796,9 +12785,9 @@ var require_inherits = __commonJS({
12796
12785
  }
12797
12786
  });
12798
12787
 
12799
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js
12788
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js
12800
12789
  var require_prependToMemberExpression = __commonJS({
12801
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js"(exports2) {
12790
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js"(exports2) {
12802
12791
  "use strict";
12803
12792
  Object.defineProperty(exports2, "__esModule", {
12804
12793
  value: true
@@ -12816,9 +12805,9 @@ var require_prependToMemberExpression = __commonJS({
12816
12805
  }
12817
12806
  });
12818
12807
 
12819
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js
12808
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js
12820
12809
  var require_getAssignmentIdentifiers = __commonJS({
12821
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js"(exports2) {
12810
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js"(exports2) {
12822
12811
  "use strict";
12823
12812
  Object.defineProperty(exports2, "__esModule", {
12824
12813
  value: true
@@ -12867,9 +12856,9 @@ var require_getAssignmentIdentifiers = __commonJS({
12867
12856
  }
12868
12857
  });
12869
12858
 
12870
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js
12859
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js
12871
12860
  var require_getBindingIdentifiers = __commonJS({
12872
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js"(exports2) {
12861
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js"(exports2) {
12873
12862
  "use strict";
12874
12863
  Object.defineProperty(exports2, "__esModule", {
12875
12864
  value: true
@@ -12972,9 +12961,9 @@ var require_getBindingIdentifiers = __commonJS({
12972
12961
  }
12973
12962
  });
12974
12963
 
12975
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js
12964
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js
12976
12965
  var require_getOuterBindingIdentifiers = __commonJS({
12977
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js"(exports2) {
12966
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js"(exports2) {
12978
12967
  "use strict";
12979
12968
  Object.defineProperty(exports2, "__esModule", {
12980
12969
  value: true
@@ -12988,9 +12977,9 @@ var require_getOuterBindingIdentifiers = __commonJS({
12988
12977
  }
12989
12978
  });
12990
12979
 
12991
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getFunctionName.js
12980
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getFunctionName.js
12992
12981
  var require_getFunctionName = __commonJS({
12993
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/retrievers/getFunctionName.js"(exports2) {
12982
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/retrievers/getFunctionName.js"(exports2) {
12994
12983
  "use strict";
12995
12984
  Object.defineProperty(exports2, "__esModule", {
12996
12985
  value: true
@@ -13055,9 +13044,9 @@ var require_getFunctionName = __commonJS({
13055
13044
  }
13056
13045
  });
13057
13046
 
13058
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/traverse/traverse.js
13047
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/traverse/traverse.js
13059
13048
  var require_traverse = __commonJS({
13060
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/traverse/traverse.js"(exports2) {
13049
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/traverse/traverse.js"(exports2) {
13061
13050
  "use strict";
13062
13051
  Object.defineProperty(exports2, "__esModule", {
13063
13052
  value: true
@@ -13108,9 +13097,9 @@ var require_traverse = __commonJS({
13108
13097
  }
13109
13098
  });
13110
13099
 
13111
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isBinding.js
13100
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isBinding.js
13112
13101
  var require_isBinding = __commonJS({
13113
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isBinding.js"(exports2) {
13102
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isBinding.js"(exports2) {
13114
13103
  "use strict";
13115
13104
  Object.defineProperty(exports2, "__esModule", {
13116
13105
  value: true
@@ -13138,30 +13127,25 @@ var require_isBinding = __commonJS({
13138
13127
  }
13139
13128
  });
13140
13129
 
13141
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isLet.js
13130
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isLet.js
13142
13131
  var require_isLet = __commonJS({
13143
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isLet.js"(exports2) {
13132
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isLet.js"(exports2) {
13144
13133
  "use strict";
13145
13134
  Object.defineProperty(exports2, "__esModule", {
13146
13135
  value: true
13147
13136
  });
13148
13137
  exports2.default = isLet;
13149
13138
  var _index = require_generated();
13150
- {
13151
- BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
13152
- }
13153
- var BLOCK_SCOPED_SYMBOL;
13139
+ var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
13154
13140
  function isLet(node) {
13155
- {
13156
- return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[BLOCK_SCOPED_SYMBOL]);
13157
- }
13141
+ return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[BLOCK_SCOPED_SYMBOL]);
13158
13142
  }
13159
13143
  }
13160
13144
  });
13161
13145
 
13162
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isBlockScoped.js
13146
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isBlockScoped.js
13163
13147
  var require_isBlockScoped = __commonJS({
13164
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isBlockScoped.js"(exports2) {
13148
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isBlockScoped.js"(exports2) {
13165
13149
  "use strict";
13166
13150
  Object.defineProperty(exports2, "__esModule", {
13167
13151
  value: true
@@ -13175,9 +13159,9 @@ var require_isBlockScoped = __commonJS({
13175
13159
  }
13176
13160
  });
13177
13161
 
13178
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isImmutable.js
13162
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isImmutable.js
13179
13163
  var require_isImmutable = __commonJS({
13180
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isImmutable.js"(exports2) {
13164
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isImmutable.js"(exports2) {
13181
13165
  "use strict";
13182
13166
  Object.defineProperty(exports2, "__esModule", {
13183
13167
  value: true
@@ -13199,9 +13183,9 @@ var require_isImmutable = __commonJS({
13199
13183
  }
13200
13184
  });
13201
13185
 
13202
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isNodesEquivalent.js
13186
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isNodesEquivalent.js
13203
13187
  var require_isNodesEquivalent = __commonJS({
13204
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isNodesEquivalent.js"(exports2) {
13188
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isNodesEquivalent.js"(exports2) {
13205
13189
  "use strict";
13206
13190
  Object.defineProperty(exports2, "__esModule", {
13207
13191
  value: true
@@ -13259,9 +13243,9 @@ var require_isNodesEquivalent = __commonJS({
13259
13243
  }
13260
13244
  });
13261
13245
 
13262
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isReferenced.js
13246
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isReferenced.js
13263
13247
  var require_isReferenced = __commonJS({
13264
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isReferenced.js"(exports2) {
13248
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isReferenced.js"(exports2) {
13265
13249
  "use strict";
13266
13250
  Object.defineProperty(exports2, "__esModule", {
13267
13251
  value: true
@@ -13294,7 +13278,7 @@ var require_isReferenced = __commonJS({
13294
13278
  if (parent.key === node) {
13295
13279
  return !!parent.computed;
13296
13280
  }
13297
- return !grandparent || grandparent.type !== "ObjectPattern";
13281
+ return (grandparent == null ? void 0 : grandparent.type) !== "ObjectPattern";
13298
13282
  case "ClassProperty":
13299
13283
  case "ClassAccessorProperty":
13300
13284
  if (parent.key === node) {
@@ -13358,9 +13342,9 @@ var require_isReferenced = __commonJS({
13358
13342
  }
13359
13343
  });
13360
13344
 
13361
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isScope.js
13345
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isScope.js
13362
13346
  var require_isScope = __commonJS({
13363
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isScope.js"(exports2) {
13347
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isScope.js"(exports2) {
13364
13348
  "use strict";
13365
13349
  Object.defineProperty(exports2, "__esModule", {
13366
13350
  value: true
@@ -13379,9 +13363,9 @@ var require_isScope = __commonJS({
13379
13363
  }
13380
13364
  });
13381
13365
 
13382
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isSpecifierDefault.js
13366
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isSpecifierDefault.js
13383
13367
  var require_isSpecifierDefault = __commonJS({
13384
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isSpecifierDefault.js"(exports2) {
13368
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isSpecifierDefault.js"(exports2) {
13385
13369
  "use strict";
13386
13370
  Object.defineProperty(exports2, "__esModule", {
13387
13371
  value: true
@@ -13396,9 +13380,9 @@ var require_isSpecifierDefault = __commonJS({
13396
13380
  }
13397
13381
  });
13398
13382
 
13399
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isValidES3Identifier.js
13383
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isValidES3Identifier.js
13400
13384
  var require_isValidES3Identifier = __commonJS({
13401
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isValidES3Identifier.js"(exports2) {
13385
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isValidES3Identifier.js"(exports2) {
13402
13386
  "use strict";
13403
13387
  Object.defineProperty(exports2, "__esModule", {
13404
13388
  value: true
@@ -13412,32 +13396,27 @@ var require_isValidES3Identifier = __commonJS({
13412
13396
  }
13413
13397
  });
13414
13398
 
13415
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isVar.js
13399
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isVar.js
13416
13400
  var require_isVar = __commonJS({
13417
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/validators/isVar.js"(exports2) {
13401
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/validators/isVar.js"(exports2) {
13418
13402
  "use strict";
13419
13403
  Object.defineProperty(exports2, "__esModule", {
13420
13404
  value: true
13421
13405
  });
13422
13406
  exports2.default = isVar;
13423
13407
  var _index = require_generated();
13424
- {
13425
- BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
13426
- }
13427
- var BLOCK_SCOPED_SYMBOL;
13408
+ var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
13428
13409
  function isVar(node) {
13429
- {
13430
- return (0, _index.isVariableDeclaration)(node, {
13431
- kind: "var"
13432
- }) && !node[BLOCK_SCOPED_SYMBOL];
13433
- }
13410
+ return (0, _index.isVariableDeclaration)(node, {
13411
+ kind: "var"
13412
+ }) && !node[BLOCK_SCOPED_SYMBOL];
13434
13413
  }
13435
13414
  }
13436
13415
  });
13437
13416
 
13438
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
13417
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
13439
13418
  var require_gatherSequenceExpressions = __commonJS({
13440
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js"(exports2) {
13419
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js"(exports2) {
13441
13420
  "use strict";
13442
13421
  Object.defineProperty(exports2, "__esModule", {
13443
13422
  value: true
@@ -13503,9 +13482,9 @@ var require_gatherSequenceExpressions = __commonJS({
13503
13482
  }
13504
13483
  });
13505
13484
 
13506
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toSequenceExpression.js
13485
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toSequenceExpression.js
13507
13486
  var require_toSequenceExpression = __commonJS({
13508
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/converters/toSequenceExpression.js"(exports2) {
13487
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/converters/toSequenceExpression.js"(exports2) {
13509
13488
  "use strict";
13510
13489
  Object.defineProperty(exports2, "__esModule", {
13511
13490
  value: true
@@ -13525,9 +13504,9 @@ var require_toSequenceExpression = __commonJS({
13525
13504
  }
13526
13505
  });
13527
13506
 
13528
- // ../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/index.js
13507
+ // ../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/index.js
13529
13508
  var require_lib3 = __commonJS({
13530
- "../../node_modules/.pnpm/@babel+types@7.28.5/node_modules/@babel/types/lib/index.js"(exports2) {
13509
+ "../../node_modules/.pnpm/@babel+types@7.28.6/node_modules/@babel/types/lib/index.js"(exports2) {
13531
13510
  "use strict";
13532
13511
  Object.defineProperty(exports2, "__esModule", {
13533
13512
  value: true
@@ -14103,9 +14082,7 @@ var require_lib3 = __commonJS({
14103
14082
  isCompatTag: _isCompatTag.default,
14104
14083
  buildChildren: _buildChildren.default
14105
14084
  };
14106
- {
14107
- exports2.toSequenceExpression = _toSequenceExpression.default;
14108
- }
14085
+ exports2.toSequenceExpression = _toSequenceExpression.default;
14109
14086
  if (process.env.BABEL_TYPES_8_BREAKING) {
14110
14087
  console.warn("BABEL_TYPES_8_BREAKING is not supported anymore. Use the latest Babel 8.0.0 pre-release instead!");
14111
14088
  }
@@ -14115,8 +14092,11 @@ var require_lib3 = __commonJS({
14115
14092
  // src/index.ts
14116
14093
  var index_exports = {};
14117
14094
  __export(index_exports, {
14095
+ clearModuleMetadata: () => clearModuleMetadata,
14118
14096
  createFictPlugin: () => createFictPlugin,
14119
- default: () => index_default
14097
+ default: () => index_default,
14098
+ resolveModuleMetadata: () => resolveModuleMetadata,
14099
+ setModuleMetadata: () => setModuleMetadata
14120
14100
  });
14121
14101
  module.exports = __toCommonJS(index_exports);
14122
14102
  var import_helper_plugin_utils = require("@babel/helper-plugin-utils");
@@ -14164,6 +14144,7 @@ var RUNTIME_HELPERS = {
14164
14144
  propsRest: "__fictPropsRest",
14165
14145
  mergeProps: "mergeProps",
14166
14146
  prop: "prop",
14147
+ keyed: "keyed",
14167
14148
  runInScope: "runInScope",
14168
14149
  createElement: "createElement",
14169
14150
  conditional: "createConditional",
@@ -14198,6 +14179,7 @@ var RUNTIME_ALIASES = {
14198
14179
  propGetter: "__fictProp",
14199
14180
  propsRest: "__fictPropsRest",
14200
14181
  prop: "prop",
14182
+ keyed: "keyed",
14201
14183
  mergeProps: "mergeProps",
14202
14184
  runInScope: "runInScope",
14203
14185
  createElement: "createElement",
@@ -14319,6 +14301,7 @@ function debugWarn(flag, message, data) {
14319
14301
  // src/ir/build-hir.ts
14320
14302
  var import_core = require("@babel/core");
14321
14303
  var import_plugin_transform_destructuring = __toESM(require("@babel/plugin-transform-destructuring"), 1);
14304
+ var import_traverse = __toESM(require("@babel/traverse"), 1);
14322
14305
  var t = __toESM(require_lib3(), 1);
14323
14306
 
14324
14307
  // src/ir/hir.ts
@@ -14405,9 +14388,9 @@ function extractDependencyPath(expr) {
14405
14388
  }
14406
14389
  return void 0;
14407
14390
  }
14408
- function pathToString(path) {
14409
- let result = path.base;
14410
- for (const seg of path.segments) {
14391
+ function pathToString(path2) {
14392
+ let result = path2.base;
14393
+ for (const seg of path2.segments) {
14411
14394
  if (seg.optional) {
14412
14395
  result += "?.";
14413
14396
  } else {
@@ -14432,42 +14415,56 @@ var resolveDestructuringPlugin = () => {
14432
14415
  const mod = import_plugin_transform_destructuring.default;
14433
14416
  return mod?.default ?? mod;
14434
14417
  };
14435
- var createAssignmentDestructuringPlugin = () => {
14436
- const pluginFactory = resolveDestructuringPlugin();
14437
- if (typeof pluginFactory !== "function") {
14438
- throw new Error("Expected @babel/plugin-transform-destructuring to export a function");
14439
- }
14440
- const plugin = pluginFactory(
14441
- {
14442
- assertVersion() {
14443
- },
14444
- assumption() {
14445
- return void 0;
14446
- },
14447
- types: t
14448
- },
14449
- {}
14450
- );
14451
- return {
14452
- visitor: {
14453
- AssignmentExpression(path, state) {
14454
- if (!t.isObjectPattern(path.node.left) && !t.isArrayPattern(path.node.left)) return;
14455
- const visitor = plugin.visitor?.AssignmentExpression;
14456
- if (!visitor) return;
14457
- visitor.call(this, path, state);
14418
+ var resolveTraverse = () => {
14419
+ const mod = import_traverse.default;
14420
+ return mod?.default ?? mod;
14421
+ };
14422
+ var OBJECT_REST_HELPERS = /* @__PURE__ */ new Set(["_objectWithoutProperties", "_objectWithoutPropertiesLoose"]);
14423
+ var OBJECT_DESTRUCTURING_EMPTY_HELPER = "_objectDestructuringEmpty";
14424
+ var EXTENDS_HELPER = "_extends";
14425
+ var isSameIdentifier = (left, right) => {
14426
+ return t.isIdentifier(left) && t.isIdentifier(right) && left.name === right.name;
14427
+ };
14428
+ var rewriteObjectRestHelpers = (ast) => {
14429
+ const traverse = resolveTraverse();
14430
+ traverse(ast, {
14431
+ CallExpression(path2) {
14432
+ const { callee, arguments: args } = path2.node;
14433
+ if (t.isIdentifier(callee) && OBJECT_REST_HELPERS.has(callee.name)) {
14434
+ path2.node.callee = t.identifier("__fictPropsRest");
14435
+ return;
14436
+ }
14437
+ 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) {
14438
+ const [checkExpr, sourceExpr] = args[1].expressions;
14439
+ if (t.isCallExpression(checkExpr) && t.isIdentifier(checkExpr.callee) && checkExpr.callee.name === OBJECT_DESTRUCTURING_EMPTY_HELPER && checkExpr.arguments.length === 1) {
14440
+ const [checkArg] = checkExpr.arguments;
14441
+ if (checkArg && isSameIdentifier(checkArg, sourceExpr)) {
14442
+ const restCall = t.callExpression(t.identifier("__fictPropsRest"), [
14443
+ t.cloneNode(sourceExpr, true),
14444
+ t.arrayExpression([])
14445
+ ]);
14446
+ path2.replaceWith(t.sequenceExpression([checkExpr, restCall]));
14447
+ }
14448
+ }
14458
14449
  }
14459
14450
  }
14460
- };
14451
+ });
14461
14452
  };
14462
14453
  var expandDestructuringAssignments = (ast) => {
14454
+ const pluginFactory = resolveDestructuringPlugin();
14455
+ if (typeof pluginFactory !== "function") {
14456
+ throw new Error("Expected @babel/plugin-transform-destructuring to export a function");
14457
+ }
14463
14458
  const result = (0, import_core.transformFromAstSync)(ast, void 0, {
14464
14459
  configFile: false,
14465
14460
  babelrc: false,
14466
14461
  ast: true,
14467
14462
  code: false,
14468
- plugins: [createAssignmentDestructuringPlugin()]
14463
+ plugins: [pluginFactory]
14469
14464
  });
14470
- return result?.ast ?? ast;
14465
+ const expanded = result?.ast ?? ast;
14466
+ rewriteObjectRestHelpers(expanded);
14467
+ return expanded;
14471
14468
  };
14472
14469
  var reportUnsupportedExpression = (node, overrideMessage) => {
14473
14470
  const loc = getLoc(node);
@@ -15295,8 +15292,18 @@ function convertFunction(name, params, body, options) {
15295
15292
  loc: options?.loc ?? null
15296
15293
  };
15297
15294
  }
15298
- function convertStatementsToHIRFunction(name, statements) {
15299
- return convertFunction(name, [], statements, { loc: getLoc(statements[0]) });
15295
+ function convertStatementsToHIRFunction(name, statements, options) {
15296
+ const prevOptions = activeBuildOptions;
15297
+ if (options) {
15298
+ activeBuildOptions = options;
15299
+ }
15300
+ try {
15301
+ return convertFunction(name, [], statements, { loc: getLoc(statements[0]) });
15302
+ } finally {
15303
+ if (options) {
15304
+ activeBuildOptions = prevOptions;
15305
+ }
15306
+ }
15300
15307
  }
15301
15308
  function convertAssignmentValue(expr) {
15302
15309
  const right = convertExpression(expr.right);
@@ -15814,9 +15821,9 @@ function processStatement(stmt, bb, jumpTarget, ctx) {
15814
15821
  }
15815
15822
  return bb;
15816
15823
  }
15817
- function convertExpression(node) {
15824
+ function convertExpression(node, options) {
15818
15825
  const loc = getLoc(node);
15819
- const convertCallArguments = (args) => args.map((arg) => {
15826
+ const convertCallArguments = (args, reactiveScope) => args.map((arg) => {
15820
15827
  if (t.isSpreadElement(arg)) {
15821
15828
  return {
15822
15829
  kind: "SpreadElement",
@@ -15824,9 +15831,25 @@ function convertExpression(node) {
15824
15831
  loc: getLoc(arg)
15825
15832
  };
15826
15833
  }
15827
- if (t.isExpression(arg)) return convertExpression(arg);
15834
+ if (t.isExpression(arg)) {
15835
+ if (reactiveScope && arg === args[0] && (t.isArrowFunctionExpression(arg) || t.isFunctionExpression(arg))) {
15836
+ return convertExpression(arg, { reactiveScope });
15837
+ }
15838
+ return convertExpression(arg);
15839
+ }
15828
15840
  return void 0;
15829
15841
  }).filter(Boolean);
15842
+ const resolveReactiveScope = (callee) => {
15843
+ const reactiveScopes = activeBuildOptions?.reactiveScopes;
15844
+ if (!reactiveScopes || reactiveScopes.size === 0) return void 0;
15845
+ if (t.isIdentifier(callee)) {
15846
+ return reactiveScopes.has(callee.name) ? callee.name : void 0;
15847
+ }
15848
+ if ((t.isMemberExpression(callee) || t.isOptionalMemberExpression(callee)) && !callee.computed && t.isIdentifier(callee.property)) {
15849
+ return reactiveScopes.has(callee.property.name) ? callee.property.name : void 0;
15850
+ }
15851
+ return void 0;
15852
+ };
15830
15853
  if (t.isParenthesizedExpression(node) && t.isExpression(node.expression)) {
15831
15854
  return convertExpression(node.expression);
15832
15855
  }
@@ -15873,10 +15896,11 @@ function convertExpression(node) {
15873
15896
  if (t.isCallExpression(node)) {
15874
15897
  const callee = normalizeMacroCallee(node.callee);
15875
15898
  const pure = hasPureAnnotation(node) || hasPureAnnotation(node.callee);
15899
+ const reactiveScope = resolveReactiveScope(node.callee);
15876
15900
  const call = {
15877
15901
  kind: "CallExpression",
15878
15902
  callee: convertExpression(callee),
15879
- arguments: convertCallArguments(node.arguments),
15903
+ arguments: convertCallArguments(node.arguments, reactiveScope),
15880
15904
  ...pure ? { pure: true } : null,
15881
15905
  loc
15882
15906
  };
@@ -16086,6 +16110,7 @@ function convertExpression(node) {
16086
16110
  body: nested.blocks,
16087
16111
  isExpression: false,
16088
16112
  isAsync: node.async,
16113
+ reactiveScope: options?.reactiveScope,
16089
16114
  loc
16090
16115
  };
16091
16116
  return arrow;
@@ -16098,6 +16123,7 @@ function convertExpression(node) {
16098
16123
  body: convertExpression(node.body),
16099
16124
  isExpression: true,
16100
16125
  isAsync: node.async,
16126
+ reactiveScope: options?.reactiveScope,
16101
16127
  loc
16102
16128
  };
16103
16129
  return arrow;
@@ -16117,6 +16143,7 @@ function convertExpression(node) {
16117
16143
  params: nested.params,
16118
16144
  body: nested.blocks,
16119
16145
  isAsync: node.async,
16146
+ reactiveScope: options?.reactiveScope,
16120
16147
  loc
16121
16148
  };
16122
16149
  return fn;
@@ -16187,10 +16214,11 @@ function convertExpression(node) {
16187
16214
  }
16188
16215
  if (t.isOptionalCallExpression(node)) {
16189
16216
  const callee = normalizeMacroCallee(node.callee);
16217
+ const reactiveScope = resolveReactiveScope(node.callee);
16190
16218
  return {
16191
16219
  kind: "OptionalCallExpression",
16192
16220
  callee: convertExpression(callee),
16193
- arguments: convertCallArguments(node.arguments),
16221
+ arguments: convertCallArguments(node.arguments, reactiveScope),
16194
16222
  optional: node.optional,
16195
16223
  ...hasPureAnnotation(node) || hasPureAnnotation(node.callee) ? { pure: true } : null,
16196
16224
  loc
@@ -16377,6 +16405,152 @@ function shouldMemoizeRegion(region) {
16377
16405
  return false;
16378
16406
  }
16379
16407
 
16408
+ // src/module-metadata.ts
16409
+ var import_node_fs = require("fs");
16410
+ var import_node_path = __toESM(require("path"), 1);
16411
+ var import_node_url = require("url");
16412
+ var globalMetadata = /* @__PURE__ */ new Map();
16413
+ var MODULE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
16414
+ var DEFAULT_META_EXTENSION = ".fict.meta.json";
16415
+ function normalizeFileName(fileName) {
16416
+ let normalized = fileName;
16417
+ const queryStart = normalized.indexOf("?");
16418
+ if (queryStart !== -1) {
16419
+ normalized = normalized.slice(0, queryStart);
16420
+ }
16421
+ if (normalized.startsWith("/@fs/")) {
16422
+ normalized = normalized.slice("/@fs/".length);
16423
+ }
16424
+ if (normalized.startsWith("file://")) {
16425
+ try {
16426
+ normalized = (0, import_node_url.fileURLToPath)(normalized);
16427
+ } catch {
16428
+ }
16429
+ }
16430
+ return import_node_path.default.resolve(normalized);
16431
+ }
16432
+ function getMetadataStore(options) {
16433
+ return options?.moduleMetadata ?? globalMetadata;
16434
+ }
16435
+ function getMetadataExtension(options) {
16436
+ return options?.moduleMetadataExtension ?? DEFAULT_META_EXTENSION;
16437
+ }
16438
+ function getMetadataFilePath(fileName, options) {
16439
+ return `${normalizeFileName(fileName)}${getMetadataExtension(options)}`;
16440
+ }
16441
+ function shouldEmitModuleMetadata(options) {
16442
+ const opt = options?.emitModuleMetadata;
16443
+ if (opt === true) return true;
16444
+ if (opt === false) return false;
16445
+ if (options?.moduleMetadata || options?.resolveModuleMetadata) return false;
16446
+ return true;
16447
+ }
16448
+ function readMetadataFromDisk(fileName, store, options) {
16449
+ const metaPath = getMetadataFilePath(fileName, options);
16450
+ if (!(0, import_node_fs.existsSync)(metaPath)) return void 0;
16451
+ try {
16452
+ const raw = (0, import_node_fs.readFileSync)(metaPath, "utf8");
16453
+ const parsed = JSON.parse(raw);
16454
+ store.set(normalizeFileName(fileName), parsed);
16455
+ return parsed;
16456
+ } catch {
16457
+ return void 0;
16458
+ }
16459
+ }
16460
+ function isFile(pathName) {
16461
+ try {
16462
+ return (0, import_node_fs.statSync)(pathName).isFile();
16463
+ } catch {
16464
+ return false;
16465
+ }
16466
+ }
16467
+ function resolveImportSource(source, importer, store) {
16468
+ if (!importer) return void 0;
16469
+ const isAbsolute = import_node_path.default.isAbsolute(source);
16470
+ if (!isAbsolute && !source.startsWith(".")) return void 0;
16471
+ const base = isAbsolute ? source : import_node_path.default.resolve(import_node_path.default.dirname(importer), source);
16472
+ const normalized = normalizeFileName(base);
16473
+ if (store.has(normalized)) return normalized;
16474
+ if ((0, import_node_fs.existsSync)(normalized) && isFile(normalized)) return normalized;
16475
+ const ext = import_node_path.default.extname(normalized);
16476
+ if (!ext) {
16477
+ for (const suffix of MODULE_EXTENSIONS) {
16478
+ const candidate = `${normalized}${suffix}`;
16479
+ if (store.has(candidate)) return candidate;
16480
+ if ((0, import_node_fs.existsSync)(candidate) && isFile(candidate)) return candidate;
16481
+ }
16482
+ }
16483
+ for (const suffix of MODULE_EXTENSIONS) {
16484
+ const candidate = import_node_path.default.join(normalized, `index${suffix}`);
16485
+ if (store.has(candidate)) return candidate;
16486
+ if ((0, import_node_fs.existsSync)(candidate) && isFile(candidate)) return candidate;
16487
+ }
16488
+ return void 0;
16489
+ }
16490
+ function resolveImportSourceByMetadata(source, importer, options) {
16491
+ if (!importer) return void 0;
16492
+ const isAbsolute = import_node_path.default.isAbsolute(source);
16493
+ if (!isAbsolute && !source.startsWith(".")) return void 0;
16494
+ const base = isAbsolute ? source : import_node_path.default.resolve(import_node_path.default.dirname(importer), source);
16495
+ const normalized = normalizeFileName(base);
16496
+ const metaExt = getMetadataExtension(options);
16497
+ const candidates = [];
16498
+ const ext = import_node_path.default.extname(normalized);
16499
+ if (ext) {
16500
+ candidates.push(normalized);
16501
+ } else {
16502
+ for (const suffix of MODULE_EXTENSIONS) {
16503
+ candidates.push(`${normalized}${suffix}`);
16504
+ }
16505
+ }
16506
+ for (const suffix of MODULE_EXTENSIONS) {
16507
+ candidates.push(import_node_path.default.join(normalized, `index${suffix}`));
16508
+ }
16509
+ for (const candidate of candidates) {
16510
+ if ((0, import_node_fs.existsSync)(`${candidate}${metaExt}`)) {
16511
+ return candidate;
16512
+ }
16513
+ }
16514
+ return void 0;
16515
+ }
16516
+ function resolveModuleMetadata(source, importer, options) {
16517
+ if (options?.resolveModuleMetadata) {
16518
+ const resolved = options.resolveModuleMetadata(source, importer);
16519
+ if (resolved) return resolved;
16520
+ }
16521
+ const store = getMetadataStore(options);
16522
+ let resolvedKey = resolveImportSource(source, importer, store);
16523
+ if (!resolvedKey) {
16524
+ resolvedKey = resolveImportSourceByMetadata(source, importer, options);
16525
+ }
16526
+ if (resolvedKey) {
16527
+ const existing = store.get(resolvedKey);
16528
+ if (existing) return existing;
16529
+ const loaded2 = readMetadataFromDisk(resolvedKey, store, options);
16530
+ if (loaded2) return loaded2;
16531
+ }
16532
+ if (store.has(source)) return store.get(source);
16533
+ const loaded = readMetadataFromDisk(source, store, options);
16534
+ if (loaded) return loaded;
16535
+ return void 0;
16536
+ }
16537
+ function setModuleMetadata(fileName, metadata, options) {
16538
+ if (!fileName) return;
16539
+ const store = getMetadataStore(options);
16540
+ const normalized = normalizeFileName(fileName);
16541
+ store.set(normalized, metadata);
16542
+ if (!shouldEmitModuleMetadata(options)) return;
16543
+ try {
16544
+ const metaPath = getMetadataFilePath(normalized, options);
16545
+ (0, import_node_fs.writeFileSync)(metaPath, JSON.stringify(metadata), "utf8");
16546
+ } catch {
16547
+ }
16548
+ }
16549
+ function clearModuleMetadata(options) {
16550
+ const store = getMetadataStore(options);
16551
+ store.clear();
16552
+ }
16553
+
16380
16554
  // src/validation.ts
16381
16555
  var DiagnosticMessages = {
16382
16556
  ["FICT-P001" /* FICT_P001 */]: "Props destructuring falls back to non-reactive binding.",
@@ -16535,7 +16709,9 @@ function buildPropsPlan(attributes, children, ctx, helpers) {
16535
16709
  return false;
16536
16710
  };
16537
16711
  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));
16712
+ 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));
16538
16713
  const isMergePropsCall = (expr) => expr.kind === "CallExpression" && expr.callee.kind === "Identifier" && expr.callee.name === RUNTIME_ALIASES.mergeProps && isRuntimeMergeProps();
16714
+ const isKeyedCall = (expr) => expr.kind === "CallExpression" && expr.callee.kind === "Identifier" && expr.callee.name === RUNTIME_ALIASES.keyed && isRuntimeKeyed();
16539
16715
  const isDynamicMemberSpread = (expr) => {
16540
16716
  if (expr.kind !== "MemberExpression" && expr.kind !== "OptionalMemberExpression") return false;
16541
16717
  if (expr.computed) return true;
@@ -16569,6 +16745,31 @@ function buildPropsPlan(attributes, children, ctx, helpers) {
16569
16745
  }
16570
16746
  return false;
16571
16747
  };
16748
+ const getBaseIdentifier2 = (expr) => {
16749
+ if (expr.kind === "Identifier") return expr.name;
16750
+ if (expr.kind === "MemberExpression" || expr.kind === "OptionalMemberExpression") {
16751
+ return getBaseIdentifier2(expr.object);
16752
+ }
16753
+ return null;
16754
+ };
16755
+ const isDynamicStoreMember = (expr) => {
16756
+ if (expr.kind !== "MemberExpression" && expr.kind !== "OptionalMemberExpression") return false;
16757
+ if (!expr.computed) return false;
16758
+ if (expr.property.kind === "Literal" && (typeof expr.property.value === "string" || typeof expr.property.value === "number")) {
16759
+ return false;
16760
+ }
16761
+ const base = getBaseIdentifier2(expr.object);
16762
+ if (!base) return false;
16763
+ return ctx.storeVars?.has(helpers.deSSAVarName(base)) ?? false;
16764
+ };
16765
+ const getKeyedCandidate = (expr) => {
16766
+ if (expr.kind !== "MemberExpression") return null;
16767
+ if (!expr.computed || expr.optional) return null;
16768
+ if (expr.property.kind === "Literal" && (typeof expr.property.value === "string" || typeof expr.property.value === "number")) {
16769
+ return null;
16770
+ }
16771
+ return { base: expr.object, key: expr.property };
16772
+ };
16572
16773
  const flushBucket = () => {
16573
16774
  if (bucket.length === 0) return;
16574
16775
  segments.push({ kind: "object", properties: bucket });
@@ -16631,22 +16832,35 @@ function buildPropsPlan(attributes, children, ctx, helpers) {
16631
16832
  ctx.inPropsContext = prevPropsCtx;
16632
16833
  }
16633
16834
  const baseIdent = attr.value.kind === "Identifier" ? helpers.deSSAVarName(attr.value.name) : void 0;
16835
+ const keyedCandidate = getKeyedCandidate(attr.value);
16836
+ const keyedBaseIdent = keyedCandidate && keyedCandidate.base.kind === "Identifier" ? helpers.deSSAVarName(keyedCandidate.base.name) : void 0;
16634
16837
  const isAccessorBase = baseIdent && ((ctx.memoVars?.has(baseIdent) ?? false) || (ctx.signalVars?.has(baseIdent) ?? false) || (ctx.aliasVars?.has(baseIdent) ?? false));
16635
16838
  const isStoreBase = baseIdent ? ctx.storeVars?.has(baseIdent) ?? false : false;
16636
- const alreadyGetter = isFunctionLike || (baseIdent ? isStoreBase || (ctx.memoVars?.has(baseIdent) ?? false) || (ctx.aliasVars?.has(baseIdent) ?? false) : false);
16839
+ const alreadyGetter = isFunctionLike || isKeyedCall(attr.value) || (baseIdent ? isStoreBase || (ctx.memoVars?.has(baseIdent) ?? false) || (ctx.aliasVars?.has(baseIdent) ?? false) : false);
16637
16840
  const usesTracked = (!ctx.nonReactiveScopeDepth || ctx.nonReactiveScopeDepth === 0) && helpers.expressionUsesTracked(attr.value, ctx) && !alreadyGetter;
16638
16841
  const trackedExpr = usesTracked ? helpers.lowerTrackedExpression(
16639
16842
  attr.value,
16640
16843
  ctx
16641
16844
  ) : null;
16642
16845
  const useMemoProp = usesTracked && trackedExpr && t4.isExpression(trackedExpr) && !t4.isIdentifier(trackedExpr) && !t4.isMemberExpression(trackedExpr) && !t4.isLiteral(trackedExpr);
16846
+ const forceMemoProp = usesTracked && isDynamicStoreMember(attr.value);
16847
+ const shouldMemoProp = useMemoProp || forceMemoProp;
16848
+ 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);
16643
16849
  const valueExpr = !isFunctionLike && isAccessorBase && baseIdent ? (() => {
16644
16850
  ctx.helpersUsed.add("propGetter");
16645
16851
  return t4.callExpression(t4.identifier(RUNTIME_ALIASES.propGetter), [
16646
16852
  t4.arrowFunctionExpression([], t4.callExpression(t4.identifier(baseIdent), []))
16647
16853
  ]);
16648
16854
  })() : usesTracked && t4.isExpression(lowered) ? (() => {
16649
- if (useMemoProp) {
16855
+ if (canKeyed && keyedCandidate) {
16856
+ ctx.helpersUsed.add("keyed");
16857
+ const keyExpr = helpers.lowerDomExpression(keyedCandidate.key, ctx);
16858
+ return t4.callExpression(t4.identifier(RUNTIME_ALIASES.keyed), [
16859
+ t4.identifier(keyedBaseIdent),
16860
+ t4.arrowFunctionExpression([], keyExpr)
16861
+ ]);
16862
+ }
16863
+ if (shouldMemoProp) {
16650
16864
  ctx.helpersUsed.add("prop");
16651
16865
  return t4.callExpression(t4.identifier(RUNTIME_ALIASES.prop), [
16652
16866
  t4.arrowFunctionExpression([], trackedExpr ?? lowered)
@@ -16839,7 +17053,13 @@ function rewriteExprWithMap(expr, rewrites) {
16839
17053
  return {
16840
17054
  ...expr,
16841
17055
  object: rewriteExprWithMap(expr.object, rewrites),
16842
- property: rewriteExprWithMap(expr.property, rewrites)
17056
+ property: expr.computed ? rewriteExprWithMap(expr.property, rewrites) : expr.property
17057
+ };
17058
+ case "OptionalMemberExpression":
17059
+ return {
17060
+ ...expr,
17061
+ object: rewriteExprWithMap(expr.object, rewrites),
17062
+ property: expr.computed ? rewriteExprWithMap(expr.property, rewrites) : expr.property
16843
17063
  };
16844
17064
  case "BinaryExpression":
16845
17065
  case "LogicalExpression":
@@ -16862,11 +17082,12 @@ function rewriteExprWithMap(expr, rewrites) {
16862
17082
  case "ObjectExpression":
16863
17083
  return {
16864
17084
  ...expr,
16865
- properties: expr.properties.map((p) => ({
16866
- ...p,
16867
- key: rewriteExprWithMap(p.key, rewrites),
16868
- value: rewriteExprWithMap(p.value, rewrites)
16869
- }))
17085
+ properties: expr.properties.map((p) => {
17086
+ if (p.kind === "SpreadElement") {
17087
+ return { ...p, argument: rewriteExprWithMap(p.argument, rewrites) };
17088
+ }
17089
+ return { ...p, value: rewriteExprWithMap(p.value, rewrites) };
17090
+ })
16870
17091
  };
16871
17092
  case "ImportExpression":
16872
17093
  return {
@@ -16980,7 +17201,17 @@ function toSSA(fn) {
16980
17201
  arguments: expr.arguments.map((a) => renameExpr(a))
16981
17202
  };
16982
17203
  case "MemberExpression":
16983
- return { ...expr, object: renameExpr(expr.object), property: renameExpr(expr.property) };
17204
+ return {
17205
+ ...expr,
17206
+ object: renameExpr(expr.object),
17207
+ property: expr.computed ? renameExpr(expr.property) : expr.property
17208
+ };
17209
+ case "OptionalMemberExpression":
17210
+ return {
17211
+ ...expr,
17212
+ object: renameExpr(expr.object),
17213
+ property: expr.computed ? renameExpr(expr.property) : expr.property
17214
+ };
16984
17215
  case "BinaryExpression":
16985
17216
  case "LogicalExpression":
16986
17217
  return { ...expr, left: renameExpr(expr.left), right: renameExpr(expr.right) };
@@ -16998,11 +17229,12 @@ function toSSA(fn) {
16998
17229
  case "ObjectExpression":
16999
17230
  return {
17000
17231
  ...expr,
17001
- properties: expr.properties.map((p) => ({
17002
- ...p,
17003
- key: renameExpr(p.key),
17004
- value: renameExpr(p.value)
17005
- }))
17232
+ properties: expr.properties.map((p) => {
17233
+ if (p.kind === "SpreadElement") {
17234
+ return { ...p, argument: renameExpr(p.argument) };
17235
+ }
17236
+ return { ...p, value: renameExpr(p.value) };
17237
+ })
17006
17238
  };
17007
17239
  default:
17008
17240
  return expr;
@@ -17497,8 +17729,8 @@ function mergeOverlappingScopes(scopes, _byName) {
17497
17729
  scope.blocks.forEach((b) => merged.blocks.add(b));
17498
17730
  scope.dependencies.forEach((d) => merged.dependencies.add(d));
17499
17731
  for (const [base, paths] of scope.dependencyPaths) {
17500
- for (const path of paths) {
17501
- addPath(merged.dependencyPaths, base, path);
17732
+ for (const path2 of paths) {
17733
+ addPath(merged.dependencyPaths, base, path2);
17502
17734
  }
17503
17735
  }
17504
17736
  merged.hasExternalEffect = merged.hasExternalEffect || scope.hasExternalEffect;
@@ -17592,12 +17824,12 @@ function collectExprReads(expr, into, paths, bound = /* @__PURE__ */ new Set(),
17592
17824
  if (bound.has(baseName(expr.name))) return;
17593
17825
  into.add(expr.name);
17594
17826
  if (paths) {
17595
- const path = {
17827
+ const path2 = {
17596
17828
  base: expr.name,
17597
17829
  segments: [],
17598
17830
  hasOptional: false
17599
17831
  };
17600
- addPath(paths, expr.name, path);
17832
+ addPath(paths, expr.name, path2);
17601
17833
  }
17602
17834
  return;
17603
17835
  case "CallExpression": {
@@ -17753,11 +17985,11 @@ function collectExprReads(expr, into, paths, bound = /* @__PURE__ */ new Set(),
17753
17985
  return;
17754
17986
  }
17755
17987
  }
17756
- function addPath(paths, base, path) {
17988
+ function addPath(paths, base, path2) {
17757
17989
  const existing = paths.get(base) ?? [];
17758
- const pathStr = pathToString(path);
17990
+ const pathStr = pathToString(path2);
17759
17991
  if (!existing.some((p) => pathToString(p) === pathStr)) {
17760
- existing.push(path);
17992
+ existing.push(path2);
17761
17993
  paths.set(base, existing);
17762
17994
  }
17763
17995
  }
@@ -17776,11 +18008,11 @@ function analyzeOptionalChainDependencies(scope) {
17776
18008
  } else {
17777
18009
  let hasRequiredPath = false;
17778
18010
  let hasOptionalOnlyPath = false;
17779
- for (const path of paths) {
17780
- if (!path.hasOptional) {
18011
+ for (const path2 of paths) {
18012
+ if (!path2.hasOptional) {
17781
18013
  hasRequiredPath = true;
17782
18014
  } else {
17783
- const firstOptionalIndex = path.segments.findIndex((s) => s.optional);
18015
+ const firstOptionalIndex = path2.segments.findIndex((s) => s.optional);
17784
18016
  if (firstOptionalIndex === 0) {
17785
18017
  hasOptionalOnlyPath = true;
17786
18018
  } else if (firstOptionalIndex > 0) {
@@ -18530,13 +18762,34 @@ function createPropsShape() {
18530
18762
  source: { kind: "props" }
18531
18763
  };
18532
18764
  }
18765
+ function createStoreShape(name) {
18766
+ return {
18767
+ knownKeys: /* @__PURE__ */ new Set(),
18768
+ mutableKeys: /* @__PURE__ */ new Set(),
18769
+ dynamicAccess: false,
18770
+ escapes: false,
18771
+ isSpread: false,
18772
+ source: { kind: "store", name }
18773
+ };
18774
+ }
18533
18775
  function cloneKeyContext(ctx) {
18534
- return new Map(ctx);
18776
+ const cloneMap = (map) => {
18777
+ const next = /* @__PURE__ */ new Map();
18778
+ for (const [key, value] of map.entries()) {
18779
+ next.set(key, new Set(value));
18780
+ }
18781
+ return next;
18782
+ };
18783
+ return {
18784
+ values: cloneMap(ctx.values),
18785
+ keySets: cloneMap(ctx.keySets)
18786
+ };
18535
18787
  }
18536
18788
  function clearPatternBindings(pattern, ctx) {
18537
18789
  if (!pattern || typeof pattern !== "object") return;
18538
18790
  if (t2.isIdentifier(pattern)) {
18539
- ctx.delete(pattern.name);
18791
+ ctx.values.delete(pattern.name);
18792
+ ctx.keySets.delete(pattern.name);
18540
18793
  return;
18541
18794
  }
18542
18795
  if (t2.isRestElement(pattern)) {
@@ -18563,19 +18816,132 @@ function clearPatternBindings(pattern, ctx) {
18563
18816
  }
18564
18817
  }
18565
18818
  }
18566
- function resolveNarrowedKey(expr, ctx) {
18819
+ function resolveNarrowedKeys(expr, ctx) {
18567
18820
  if (expr.kind === "Literal") {
18568
18821
  if (typeof expr.value === "string" || typeof expr.value === "number") {
18569
- return expr.value;
18822
+ return /* @__PURE__ */ new Set([expr.value]);
18570
18823
  }
18571
18824
  return null;
18572
18825
  }
18573
18826
  if (expr.kind === "Identifier") {
18574
- return ctx.get(expr.name) ?? null;
18827
+ const value = ctx.values.get(expr.name);
18828
+ return value ? new Set(value) : null;
18829
+ }
18830
+ if (expr.kind === "ConditionalExpression") {
18831
+ const consequent = resolveNarrowedKeys(expr.consequent, ctx);
18832
+ const alternate = resolveNarrowedKeys(expr.alternate, ctx);
18833
+ if (consequent && alternate) {
18834
+ return /* @__PURE__ */ new Set([...consequent, ...alternate]);
18835
+ }
18836
+ return null;
18837
+ }
18838
+ if (expr.kind === "SequenceExpression" && expr.expressions.length > 0) {
18839
+ const last = expr.expressions[expr.expressions.length - 1];
18840
+ return resolveNarrowedKeys(last, ctx);
18841
+ }
18842
+ if (expr.kind === "MemberExpression" || expr.kind === "OptionalMemberExpression") {
18843
+ if (expr.computed && expr.object.kind === "Identifier") {
18844
+ const keySet = ctx.keySets.get(expr.object.name);
18845
+ if (keySet && keySet.size > 0) {
18846
+ return new Set(keySet);
18847
+ }
18848
+ }
18849
+ }
18850
+ return null;
18851
+ }
18852
+ function resolveKeySet(expr, ctx, shapes) {
18853
+ if (expr.kind === "Identifier") {
18854
+ const set = ctx.keySets.get(expr.name);
18855
+ return set ? new Set(set) : null;
18856
+ }
18857
+ if (expr.kind === "ArrayExpression") {
18858
+ const values = [];
18859
+ for (const el of expr.elements) {
18860
+ if (!el) return null;
18861
+ if (el.kind !== "Literal") return null;
18862
+ if (typeof el.value !== "string" && typeof el.value !== "number") return null;
18863
+ values.push(el.value);
18864
+ }
18865
+ return values.length > 0 ? new Set(values) : null;
18866
+ }
18867
+ if (expr.kind === "CallExpression") {
18868
+ if (expr.callee.kind === "MemberExpression") {
18869
+ const object = expr.callee.object;
18870
+ const property = expr.callee.property;
18871
+ if (object.kind === "Identifier" && object.name === "Object" && !expr.callee.computed && property.kind === "Identifier" && (property.name === "keys" || property.name === "getOwnPropertyNames") && expr.arguments.length === 1) {
18872
+ const arg = expr.arguments[0];
18873
+ if (arg.kind === "ObjectExpression") {
18874
+ const values = [];
18875
+ for (const prop of arg.properties) {
18876
+ if (prop.kind !== "Property") return null;
18877
+ if (prop.key.kind === "Identifier") {
18878
+ values.push(prop.key.name);
18879
+ } else if (prop.key.kind === "Literal") {
18880
+ if (typeof prop.key.value !== "string" && typeof prop.key.value !== "number") {
18881
+ return null;
18882
+ }
18883
+ values.push(prop.key.value);
18884
+ } else {
18885
+ return null;
18886
+ }
18887
+ }
18888
+ return values.length > 0 ? new Set(values) : null;
18889
+ }
18890
+ if (arg.kind === "Identifier" && shapes) {
18891
+ const shape = shapes.get(arg.name);
18892
+ if (shape && shape.knownKeys.size > 0 && !shape.dynamicAccess && !shape.escapes && shape.mutableKeys.size === 0) {
18893
+ return new Set(Array.from(shape.knownKeys));
18894
+ }
18895
+ }
18896
+ }
18897
+ }
18898
+ }
18899
+ if (expr.kind === "ConditionalExpression") {
18900
+ const consequent = resolveKeySet(expr.consequent, ctx, shapes);
18901
+ const alternate = resolveKeySet(expr.alternate, ctx, shapes);
18902
+ if (consequent && alternate) {
18903
+ return /* @__PURE__ */ new Set([...consequent, ...alternate]);
18904
+ }
18905
+ return null;
18906
+ }
18907
+ if (expr.kind === "SequenceExpression" && expr.expressions.length > 0) {
18908
+ const last = expr.expressions[expr.expressions.length - 1];
18909
+ return resolveKeySet(last, ctx, shapes);
18575
18910
  }
18576
18911
  return null;
18577
18912
  }
18578
18913
  function extractEqualityNarrowing(expr) {
18914
+ if (expr.kind === "LogicalExpression" && expr.operator === "||") {
18915
+ const left = extractEqualityNarrowing(expr.left);
18916
+ const right = extractEqualityNarrowing(expr.right);
18917
+ if (left && right && left.kind === "eq" && right.kind === "eq" && left.name === right.name) {
18918
+ return {
18919
+ name: left.name,
18920
+ values: /* @__PURE__ */ new Set([...left.values, ...right.values]),
18921
+ kind: "eq"
18922
+ };
18923
+ }
18924
+ }
18925
+ if (expr.kind === "LogicalExpression" && expr.operator === "&&") {
18926
+ const left = extractEqualityNarrowing(expr.left);
18927
+ const right = extractEqualityNarrowing(expr.right);
18928
+ if (left && right && left.name === right.name && left.kind === right.kind) {
18929
+ if (left.kind === "eq") {
18930
+ const intersection = /* @__PURE__ */ new Set();
18931
+ for (const value of left.values) {
18932
+ if (right.values.has(value)) intersection.add(value);
18933
+ }
18934
+ return intersection.size > 0 ? { name: left.name, values: intersection, kind: "eq" } : null;
18935
+ }
18936
+ if (left.kind === "neq") {
18937
+ const union = /* @__PURE__ */ new Set();
18938
+ for (const value of left.values) union.add(value);
18939
+ for (const value of right.values) union.add(value);
18940
+ return { name: left.name, values: union, kind: "neq" };
18941
+ }
18942
+ }
18943
+ return left ?? right;
18944
+ }
18579
18945
  if (expr.kind !== "BinaryExpression") return null;
18580
18946
  const isEq = expr.operator === "===";
18581
18947
  const isNeq = expr.operator === "!==";
@@ -18590,17 +18956,55 @@ function extractEqualityNarrowing(expr) {
18590
18956
  if (expr.left.kind === "Identifier") {
18591
18957
  const value = literalValue(expr.right);
18592
18958
  if (value !== null) {
18593
- return { name: expr.left.name, value, kind: isEq ? "eq" : "neq" };
18959
+ return { name: expr.left.name, values: /* @__PURE__ */ new Set([value]), kind: isEq ? "eq" : "neq" };
18594
18960
  }
18595
18961
  }
18596
18962
  if (expr.right.kind === "Identifier") {
18597
18963
  const value = literalValue(expr.left);
18598
18964
  if (value !== null) {
18599
- return { name: expr.right.name, value, kind: isEq ? "eq" : "neq" };
18965
+ return { name: expr.right.name, values: /* @__PURE__ */ new Set([value]), kind: isEq ? "eq" : "neq" };
18600
18966
  }
18601
18967
  }
18602
18968
  return null;
18603
18969
  }
18970
+ function applyNarrowing(ctx, name, values) {
18971
+ const existing = ctx.values.get(name);
18972
+ if (!existing) {
18973
+ ctx.values.set(name, new Set(values));
18974
+ return;
18975
+ }
18976
+ const intersection = /* @__PURE__ */ new Set();
18977
+ for (const value of existing) {
18978
+ if (values.has(value)) intersection.add(value);
18979
+ }
18980
+ if (intersection.size > 0) {
18981
+ ctx.values.set(name, intersection);
18982
+ } else {
18983
+ ctx.values.delete(name);
18984
+ }
18985
+ }
18986
+ function applyKeyAssignment(ctx, name, expr, shapes) {
18987
+ ctx.values.delete(name);
18988
+ ctx.keySets.delete(name);
18989
+ let assignedKeys = null;
18990
+ let keySet = null;
18991
+ if (expr.kind === "Identifier") {
18992
+ assignedKeys = resolveNarrowedKeys(expr, ctx);
18993
+ keySet = resolveKeySet(expr, ctx, shapes);
18994
+ if (ctx.keySets.has(expr.name)) {
18995
+ ctx.keySets.delete(expr.name);
18996
+ }
18997
+ } else {
18998
+ assignedKeys = resolveNarrowedKeys(expr, ctx);
18999
+ keySet = resolveKeySet(expr, ctx, shapes);
19000
+ }
19001
+ if (assignedKeys && assignedKeys.size > 0) {
19002
+ ctx.values.set(name, new Set(assignedKeys));
19003
+ }
19004
+ if (keySet && keySet.size > 0) {
19005
+ ctx.keySets.set(name, new Set(keySet));
19006
+ }
19007
+ }
18604
19008
  function mergeShapes(a, b) {
18605
19009
  return {
18606
19010
  knownKeys: /* @__PURE__ */ new Set([...a.knownKeys, ...b.knownKeys]),
@@ -18622,7 +19026,7 @@ function analyzeObjectShapes(fn) {
18622
19026
  shapes.set(param.name, createUnknownShape({ kind: "param", name: param.name }));
18623
19027
  }
18624
19028
  }
18625
- const baseCtx = /* @__PURE__ */ new Map();
19029
+ const baseCtx = { values: /* @__PURE__ */ new Map(), keySets: /* @__PURE__ */ new Map() };
18626
19030
  let structured = null;
18627
19031
  try {
18628
19032
  structured = structurizeCFG(fn, {
@@ -18656,6 +19060,13 @@ function analyzeObjectShapes(fn) {
18656
19060
  const propertySubscription = /* @__PURE__ */ new Map();
18657
19061
  const spreadWrapping = /* @__PURE__ */ new Set();
18658
19062
  for (const [name, shape] of shapes) {
19063
+ if (shape.source.kind === "store") {
19064
+ const reads = propertyReads.get(name);
19065
+ if (reads && reads.size > 0) {
19066
+ propertySubscription.set(name, reads);
19067
+ }
19068
+ continue;
19069
+ }
18659
19070
  if (shape.dynamicAccess || shape.source.kind === "unknown") {
18660
19071
  wholeObjectSubscription.add(name);
18661
19072
  } else if (shape.isSpread && !shape.escapes) {
@@ -18709,9 +19120,9 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18709
19120
  const alternateCtx = cloneKeyContext(ctx);
18710
19121
  if (narrowing) {
18711
19122
  if (narrowing.kind === "eq") {
18712
- consequentCtx.set(narrowing.name, narrowing.value);
19123
+ applyNarrowing(consequentCtx, narrowing.name, narrowing.values);
18713
19124
  } else {
18714
- alternateCtx.set(narrowing.name, narrowing.value);
19125
+ applyNarrowing(alternateCtx, narrowing.name, narrowing.values);
18715
19126
  }
18716
19127
  }
18717
19128
  analyzeStructuredNode(node.consequent, shapes, propertyReads, consequentCtx);
@@ -18726,7 +19137,7 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18726
19137
  for (const caseNode of node.cases) {
18727
19138
  const caseCtx = cloneKeyContext(ctx);
18728
19139
  if (discriminant && caseNode.test?.kind === "Literal" && (typeof caseNode.test.value === "string" || typeof caseNode.test.value === "number")) {
18729
- caseCtx.set(discriminant, caseNode.test.value);
19140
+ applyNarrowing(caseCtx, discriminant, /* @__PURE__ */ new Set([caseNode.test.value]));
18730
19141
  }
18731
19142
  analyzeStructuredNode(caseNode.body, shapes, propertyReads, caseCtx);
18732
19143
  }
@@ -18757,10 +19168,21 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18757
19168
  analyzeExpression(node.iterable, shapes, propertyReads, ctx);
18758
19169
  {
18759
19170
  const bodyCtx = cloneKeyContext(ctx);
18760
- bodyCtx.delete(node.variable);
19171
+ bodyCtx.values.delete(node.variable);
19172
+ bodyCtx.keySets.delete(node.variable);
18761
19173
  if (node.pattern) {
18762
19174
  clearPatternBindings(node.pattern, bodyCtx);
18763
19175
  }
19176
+ if (node.iterable.kind === "Identifier") {
19177
+ const keySet = ctx.keySets.get(node.iterable.name);
19178
+ if (keySet) {
19179
+ if (node.pattern && t2.isIdentifier(node.pattern)) {
19180
+ bodyCtx.values.set(node.pattern.name, new Set(keySet));
19181
+ } else {
19182
+ bodyCtx.values.set(node.variable, new Set(keySet));
19183
+ }
19184
+ }
19185
+ }
18764
19186
  analyzeStructuredNode(node.body, shapes, propertyReads, bodyCtx);
18765
19187
  }
18766
19188
  return;
@@ -18768,10 +19190,22 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18768
19190
  analyzeExpression(node.object, shapes, propertyReads, ctx);
18769
19191
  {
18770
19192
  const bodyCtx = cloneKeyContext(ctx);
18771
- bodyCtx.delete(node.variable);
19193
+ bodyCtx.values.delete(node.variable);
19194
+ bodyCtx.keySets.delete(node.variable);
18772
19195
  if (node.pattern) {
18773
19196
  clearPatternBindings(node.pattern, bodyCtx);
18774
19197
  }
19198
+ if (node.object.kind === "Identifier") {
19199
+ const shape = shapes.get(node.object.name);
19200
+ if (shape && shape.knownKeys.size > 0 && !shape.dynamicAccess && !shape.escapes && shape.mutableKeys.size === 0) {
19201
+ const keySet = new Set(shape.knownKeys);
19202
+ if (node.pattern && t2.isIdentifier(node.pattern)) {
19203
+ bodyCtx.values.set(node.pattern.name, keySet);
19204
+ } else {
19205
+ bodyCtx.values.set(node.variable, keySet);
19206
+ }
19207
+ }
19208
+ }
18775
19209
  analyzeStructuredNode(node.body, shapes, propertyReads, bodyCtx);
18776
19210
  }
18777
19211
  return;
@@ -18780,7 +19214,8 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18780
19214
  if (node.handler) {
18781
19215
  const handlerCtx = cloneKeyContext(ctx);
18782
19216
  if (node.handler.param) {
18783
- handlerCtx.delete(node.handler.param);
19217
+ handlerCtx.values.delete(node.handler.param);
19218
+ handlerCtx.keySets.delete(node.handler.param);
18784
19219
  }
18785
19220
  analyzeStructuredNode(node.handler.body, shapes, propertyReads, handlerCtx);
18786
19221
  }
@@ -18806,9 +19241,7 @@ function analyzeStructuredNode(node, shapes, propertyReads, ctx) {
18806
19241
  }
18807
19242
  function analyzeInstruction(instr, shapes, propertyReads, ctx) {
18808
19243
  if (instr.kind === "Assign") {
18809
- if (ctx.has(instr.target.name)) {
18810
- ctx.delete(instr.target.name);
18811
- }
19244
+ applyKeyAssignment(ctx, instr.target.name, instr.value, shapes);
18812
19245
  const valueShape = analyzeExpression(instr.value, shapes, propertyReads, ctx);
18813
19246
  if (valueShape) {
18814
19247
  const existing = shapes.get(instr.target.name);
@@ -18865,12 +19298,14 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18865
19298
  const reads = propertyReads.get(base) ?? /* @__PURE__ */ new Set();
18866
19299
  const baseShape = shapes.get(base);
18867
19300
  if (directMember.computed) {
18868
- const resolved = resolveNarrowedKey(directMember.property, ctx);
18869
- if (resolved !== null) {
18870
- const key = String(resolved);
18871
- reads.add(key);
18872
- if (baseShape) {
18873
- baseShape.knownKeys.add(key);
19301
+ const resolved = resolveNarrowedKeys(directMember.property, ctx);
19302
+ if (resolved && resolved.size > 0) {
19303
+ for (const value of resolved) {
19304
+ const key = String(value);
19305
+ reads.add(key);
19306
+ if (baseShape) {
19307
+ baseShape.knownKeys.add(key);
19308
+ }
18874
19309
  }
18875
19310
  } else if (baseShape) {
18876
19311
  baseShape.dynamicAccess = true;
@@ -18892,19 +19327,54 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18892
19327
  return null;
18893
19328
  }
18894
19329
  case "CallExpression": {
18895
- for (const arg of expr.arguments) {
19330
+ if (expr.callee.kind === "MemberExpression") {
19331
+ if (expr.callee.object.kind === "Identifier") {
19332
+ const baseName2 = expr.callee.object.name;
19333
+ 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;
19334
+ if (propName && ctx.keySets.has(baseName2) && [
19335
+ "push",
19336
+ "pop",
19337
+ "shift",
19338
+ "unshift",
19339
+ "splice",
19340
+ "sort",
19341
+ "reverse",
19342
+ "copyWithin",
19343
+ "fill"
19344
+ ].includes(propName)) {
19345
+ ctx.keySets.delete(baseName2);
19346
+ }
19347
+ }
19348
+ }
19349
+ for (const arg of expr.arguments) {
19350
+ if (arg.kind === "Identifier" && ctx.keySets.has(arg.name)) {
19351
+ ctx.keySets.delete(arg.name);
19352
+ } else if (arg.kind === "SpreadElement" && arg.argument.kind === "Identifier") {
19353
+ if (ctx.keySets.has(arg.argument.name)) {
19354
+ ctx.keySets.delete(arg.argument.name);
19355
+ }
19356
+ }
19357
+ }
19358
+ for (const arg of expr.arguments) {
18896
19359
  markEscaping(arg, shapes);
18897
19360
  }
18898
19361
  let returnedShape = null;
18899
- if (expr.callee.kind === "Identifier" && expr.callee.name === "$state" && expr.arguments[0]) {
19362
+ if (expr.callee.kind === "Identifier" && (expr.callee.name === "$state" || expr.callee.name === "$store") && expr.arguments[0]) {
18900
19363
  returnedShape = analyzeExpression(
18901
19364
  expr.arguments[0],
18902
19365
  shapes,
18903
19366
  propertyReads,
18904
19367
  ctx
18905
19368
  );
19369
+ if (expr.callee.name === "$store") {
19370
+ if (!returnedShape) {
19371
+ returnedShape = createStoreShape();
19372
+ } else {
19373
+ returnedShape.source = { kind: "store" };
19374
+ }
19375
+ }
18906
19376
  }
18907
- if (!(expr.callee.kind === "Identifier" && expr.callee.name === "$state")) {
19377
+ if (!(expr.callee.kind === "Identifier" && (expr.callee.name === "$state" || expr.callee.name === "$store"))) {
18908
19378
  analyzeExpression(expr.callee, shapes, propertyReads, ctx);
18909
19379
  }
18910
19380
  expr.arguments.slice(returnedShape ? 1 : 0).forEach((arg) => analyzeExpression(arg, shapes, propertyReads, ctx));
@@ -18943,9 +19413,7 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18943
19413
  }
18944
19414
  case "AssignmentExpression": {
18945
19415
  if (expr.left.kind === "Identifier") {
18946
- if (ctx.has(expr.left.name)) {
18947
- ctx.delete(expr.left.name);
18948
- }
19416
+ applyKeyAssignment(ctx, expr.left.name, expr.right, shapes);
18949
19417
  }
18950
19418
  if (expr.left.kind === "MemberExpression") {
18951
19419
  const base = getBaseIdentifier(expr.left.object);
@@ -18957,14 +19425,19 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18957
19425
  } else if (expr.left.property.kind === "Literal" && typeof expr.left.property.value === "string") {
18958
19426
  shape.mutableKeys.add(expr.left.property.value);
18959
19427
  } else {
18960
- const resolved = resolveNarrowedKey(expr.left.property, ctx);
18961
- if (resolved !== null) {
18962
- shape.mutableKeys.add(String(resolved));
19428
+ const resolved = resolveNarrowedKeys(expr.left.property, ctx);
19429
+ if (resolved && resolved.size > 0) {
19430
+ for (const value of resolved) {
19431
+ shape.mutableKeys.add(String(value));
19432
+ }
18963
19433
  } else {
18964
19434
  shape.dynamicAccess = true;
18965
19435
  }
18966
19436
  }
18967
19437
  }
19438
+ if (ctx.keySets.has(base)) {
19439
+ ctx.keySets.delete(base);
19440
+ }
18968
19441
  }
18969
19442
  }
18970
19443
  analyzeExpression(expr.right, shapes, propertyReads, ctx);
@@ -18972,8 +19445,13 @@ function analyzeExpression(expr, shapes, propertyReads, ctx) {
18972
19445
  }
18973
19446
  case "UpdateExpression": {
18974
19447
  if (expr.argument.kind === "Identifier") {
18975
- if (ctx.has(expr.argument.name)) {
18976
- ctx.delete(expr.argument.name);
19448
+ ctx.values.delete(expr.argument.name);
19449
+ ctx.keySets.delete(expr.argument.name);
19450
+ }
19451
+ if (expr.argument.kind === "MemberExpression") {
19452
+ const base = getBaseIdentifier(expr.argument.object);
19453
+ if (base) {
19454
+ ctx.keySets.delete(base);
18977
19455
  }
18978
19456
  }
18979
19457
  analyzeExpression(expr.argument, shapes, propertyReads, ctx);
@@ -19405,7 +19883,11 @@ function expressionUsesTracked(expr, ctx) {
19405
19883
  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);
19406
19884
  case "MemberExpression":
19407
19885
  case "OptionalMemberExpression":
19408
- return expressionUsesTracked(expr.object, ctx);
19886
+ if (expressionUsesTracked(expr.object, ctx)) return true;
19887
+ if (expr.computed && expr.property.kind !== "Literal") {
19888
+ return expressionUsesTracked(expr.property, ctx);
19889
+ }
19890
+ return false;
19409
19891
  case "CallExpression":
19410
19892
  case "OptionalCallExpression":
19411
19893
  if (expressionUsesTracked(expr.callee, ctx)) return true;
@@ -19427,6 +19909,10 @@ function expressionUsesTracked(expr, ctx) {
19427
19909
  return expr.expressions.some((e) => expressionUsesTracked(e, ctx));
19428
19910
  case "SpreadElement":
19429
19911
  return expressionUsesTracked(expr.argument, ctx);
19912
+ case "UnaryExpression":
19913
+ return expressionUsesTracked(expr.argument, ctx);
19914
+ case "UpdateExpression":
19915
+ return expressionUsesTracked(expr.argument, ctx);
19430
19916
  default:
19431
19917
  return false;
19432
19918
  }
@@ -19565,6 +20051,12 @@ function lowerNodeWithRegionContext(node, t4, ctx, declaredVars, regionCtx) {
19565
20051
  case "if": {
19566
20052
  const prevConditional = ctx.inConditional ?? 0;
19567
20053
  ctx.inConditional = prevConditional + 1;
20054
+ const inNonReactiveScope = !!(ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0);
20055
+ const mightWrapInEffect = ctx.wrapTrackedExpressions !== false && !ctx.inRegionMemo && !inNonReactiveScope && expressionUsesTracked(node.test, ctx);
20056
+ const prevNonReactiveDepth = ctx.nonReactiveScopeDepth ?? 0;
20057
+ if (mightWrapInEffect) {
20058
+ ctx.nonReactiveScopeDepth = prevNonReactiveDepth + 1;
20059
+ }
19568
20060
  const conseqStmts = lowerNodeWithRegionContext(
19569
20061
  node.consequent,
19570
20062
  t4,
@@ -19573,6 +20065,9 @@ function lowerNodeWithRegionContext(node, t4, ctx, declaredVars, regionCtx) {
19573
20065
  regionCtx
19574
20066
  );
19575
20067
  const altStmts = node.alternate ? lowerNodeWithRegionContext(node.alternate, t4, ctx, declaredVars, regionCtx) : null;
20068
+ if (mightWrapInEffect) {
20069
+ ctx.nonReactiveScopeDepth = prevNonReactiveDepth;
20070
+ }
19576
20071
  ctx.inConditional = prevConditional;
19577
20072
  const conseqReactiveOnly = nodeIsPureReactiveScope(node.consequent, ctx.memoMacroNames);
19578
20073
  const altReactiveOnly = node.alternate ? nodeIsPureReactiveScope(node.alternate, ctx.memoMacroNames) : false;
@@ -19621,13 +20116,17 @@ function lowerNodeWithRegionContext(node, t4, ctx, declaredVars, regionCtx) {
19621
20116
  }
19622
20117
  return stmts;
19623
20118
  }
20119
+ const conseqIsEmpty = conseqStmts.length === 0;
20120
+ const altIsEmpty = !altStmts || altStmts.length === 0;
20121
+ if (conseqIsEmpty && altIsEmpty) {
20122
+ return [];
20123
+ }
19624
20124
  const ifStmt = t4.ifStatement(
19625
20125
  testExpr,
19626
20126
  t4.blockStatement(conseqStmts),
19627
20127
  altStmts ? t4.blockStatement(altStmts) : null
19628
20128
  );
19629
- const inNonReactiveScope = !!(ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0);
19630
- const shouldWrapEffect = ctx.wrapTrackedExpressions !== false && !ctx.inRegionMemo && !inNonReactiveScope && expressionUsesTracked(node.test, ctx) && !statementHasEarlyExit(ifStmt, t4);
20129
+ const shouldWrapEffect = mightWrapInEffect && !statementHasEarlyExit(ifStmt, t4);
19631
20130
  if (shouldWrapEffect) {
19632
20131
  const effectFn = t4.arrowFunctionExpression([], t4.blockStatement([ifStmt]));
19633
20132
  return [t4.expressionStatement(buildEffectCall(ctx, t4, effectFn))];
@@ -19848,7 +20347,7 @@ function lowerStructuredNodeForRegion(node, region, t4, ctx, declaredVars, regio
19848
20347
  }
19849
20348
  case "if": {
19850
20349
  const inNonReactiveScope = !!(ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0);
19851
- const baseShouldWrapEffect = ctx.wrapTrackedExpressions !== false && !ctx.inRegionMemo && !inNonReactiveScope && expressionUsesTracked(node.test, ctx);
20350
+ const mightWrapInEffect = ctx.wrapTrackedExpressions !== false && !ctx.inRegionMemo && !inNonReactiveScope && expressionUsesTracked(node.test, ctx);
19852
20351
  const lowerChild = (child, forceNonReactive) => {
19853
20352
  if (!child) return [];
19854
20353
  if (!forceNonReactive) {
@@ -19878,8 +20377,8 @@ function lowerStructuredNodeForRegion(node, region, t4, ctx, declaredVars, regio
19878
20377
  ctx.nonReactiveScopeDepth = prevDepth;
19879
20378
  }
19880
20379
  };
19881
- let consequent = lowerChild(node.consequent, baseShouldWrapEffect);
19882
- let alternate = node.alternate ? lowerChild(node.alternate, baseShouldWrapEffect) : [];
20380
+ let consequent = lowerChild(node.consequent, mightWrapInEffect);
20381
+ let alternate = node.alternate ? lowerChild(node.alternate, mightWrapInEffect) : [];
19883
20382
  if (consequent.length === 0 && alternate.length === 0) return [];
19884
20383
  const buildIfStmt = (cons, alt) => t4.ifStatement(
19885
20384
  lowerExpressionWithDeSSA(node.test, ctx),
@@ -19887,8 +20386,9 @@ function lowerStructuredNodeForRegion(node, region, t4, ctx, declaredVars, regio
19887
20386
  alt.length > 0 ? t4.blockStatement(alt) : null
19888
20387
  );
19889
20388
  let ifStmt = buildIfStmt(consequent, alternate);
19890
- const shouldWrapEffect = baseShouldWrapEffect && !statementHasEarlyExit(ifStmt, t4);
19891
- if (!shouldWrapEffect && baseShouldWrapEffect) {
20389
+ const hasEarlyExit = statementHasEarlyExit(ifStmt, t4);
20390
+ const shouldWrapEffect = mightWrapInEffect && !hasEarlyExit;
20391
+ if (!shouldWrapEffect && mightWrapInEffect && !hasEarlyExit) {
19892
20392
  consequent = lowerChild(node.consequent, false);
19893
20393
  alternate = node.alternate ? lowerChild(node.alternate, false) : [];
19894
20394
  if (consequent.length === 0 && alternate.length === 0) return [];
@@ -20350,19 +20850,6 @@ function wrapInMemo(region, t4, declaredVars, ctx, bodyStatementsOverride, outpu
20350
20850
  );
20351
20851
  ctx.memoVars?.add(name);
20352
20852
  }
20353
- if (region.hasControlFlow && getterOutputs.length > 0) {
20354
- const effectBody = t4.blockStatement(
20355
- getterOutputs.map((name) => t4.expressionStatement(t4.callExpression(t4.identifier(name), [])))
20356
- );
20357
- statements.push(
20358
- t4.expressionStatement(
20359
- buildEffectCall(ctx, t4, t4.arrowFunctionExpression([], effectBody), {
20360
- slot: ctx.inModule ? void 0 : reserveHookSlot(ctx),
20361
- forceSlot: true
20362
- })
20363
- )
20364
- );
20365
- }
20366
20853
  }
20367
20854
  return statements;
20368
20855
  }
@@ -20608,11 +21095,15 @@ function reserveHookSlot(ctx) {
20608
21095
  ctx.nextHookSlot = slot + 1;
20609
21096
  return slot;
20610
21097
  }
21098
+ function createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4) {
21099
+ ctx.trackedVars.delete(baseName2);
21100
+ ctx.memoVars?.delete(baseName2);
21101
+ return t4.variableDeclaration("let", [t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)]);
21102
+ }
20611
21103
  function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20612
21104
  if (instr.kind === "Assign") {
20613
21105
  const ssaName = instr.target.name;
20614
21106
  const baseName2 = deSSAVarName(ssaName);
20615
- const memoMacroNames = ctx.memoMacroNames ?? /* @__PURE__ */ new Set(["$memo", "createMemo"]);
20616
21107
  const declKindRaw = instr.declarationKind;
20617
21108
  propagateHookResultAlias(baseName2, instr.value, ctx);
20618
21109
  const hookMember = resolveHookMemberValue(instr.value, ctx);
@@ -20662,12 +21153,14 @@ function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20662
21153
  const isShadowDeclaration = !!declKind && declaredVars.has(baseName2);
20663
21154
  const treatAsTracked = !isShadowDeclaration && isTracked;
20664
21155
  const isDestructuringTemp = baseName2.startsWith("__destruct_");
20665
- const isStateCall2 = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$state";
21156
+ const callKind = getReactiveCallKind(instr.value, ctx);
21157
+ const isStateCall2 = callKind === "signal";
20666
21158
  const inRegionMemo = ctx.inRegionMemo ?? false;
20667
21159
  const isFunctionValue = instr.value.kind === "ArrowFunction" || instr.value.kind === "FunctionExpression";
20668
- const isAccessorReturningCall = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && (memoMacroNames.has(instr.value.callee.name) || instr.value.callee.name === "prop");
21160
+ const isAccessorReturningCall = callKind === "memo" || instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "prop";
20669
21161
  const isReactiveObjectCall = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && ["mergeProps"].includes(instr.value.callee.name);
20670
21162
  const isMemoReturningCall = isAccessorReturningCall || isReactiveObjectCall;
21163
+ const needsMutable = ctx.mutatedVars?.has(baseName2) ?? false;
20671
21164
  const lowerAssignedValue = (forceAssigned = false) => lowerExpressionWithDeSSA(instr.value, ctx, forceAssigned || isFunctionValue);
20672
21165
  const buildDerivedMemoCall = (expr) => {
20673
21166
  const slot = !ctx.inModule && inRegionMemo ? reserveHookSlot(ctx) : void 0;
@@ -20678,7 +21171,6 @@ function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20678
21171
  }
20679
21172
  if (declKind) {
20680
21173
  const normalizedDecl = isStateCall2 || dependsOnTracked && !isDestructuringTemp ? "const" : declKind;
20681
- const needsMutable = ctx.mutatedVars?.has(baseName2) ?? false;
20682
21174
  const isExternalAlias = declKind === "const" && instr.value.kind === "Identifier" && !(ctx.scopes?.byName?.has(deSSAVarName(instr.value.name)) ?? false);
20683
21175
  const fallbackDecl = !treatAsTracked && (!dependsOnTracked || isDestructuringTemp) ? declKind === "const" && (needsMutable || isExternalAlias) ? "let" : declKind : normalizedDecl;
20684
21176
  declaredVars.add(baseName2);
@@ -20694,7 +21186,11 @@ function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20694
21186
  }
20695
21187
  const derivedExpr = lowerAssignedValue(true);
20696
21188
  if (ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0) {
20697
- return t4.variableDeclaration(normalizedDecl, [
21189
+ return createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4);
21190
+ }
21191
+ if (needsMutable) {
21192
+ ctx.memoVars?.delete(baseName2);
21193
+ return t4.variableDeclaration("let", [
20698
21194
  t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)
20699
21195
  ]);
20700
21196
  }
@@ -20721,7 +21217,11 @@ function instructionToStatement(instr, t4, declaredVars, ctx, _buildMemoCall) {
20721
21217
  }
20722
21218
  const derivedExpr = lowerAssignedValue(true);
20723
21219
  if (ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0) {
20724
- return t4.variableDeclaration(normalizedDecl, [
21220
+ return createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4);
21221
+ }
21222
+ if (needsMutable) {
21223
+ ctx.memoVars?.delete(baseName2);
21224
+ return t4.variableDeclaration("let", [
20725
21225
  t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)
20726
21226
  ]);
20727
21227
  }
@@ -20836,7 +21336,10 @@ Consider:
20836
21336
  if (dependsOnTracked) {
20837
21337
  const derivedExpr = lowerAssignedValue(true);
20838
21338
  if (ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0) {
20839
- return t4.variableDeclaration("const", [
21339
+ return createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4);
21340
+ }
21341
+ if (needsMutable) {
21342
+ return t4.variableDeclaration("let", [
20840
21343
  t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)
20841
21344
  ]);
20842
21345
  }
@@ -20863,6 +21366,9 @@ Consider:
20863
21366
  if (dependsOnTracked) {
20864
21367
  const derivedExpr = lowerAssignedValue(true);
20865
21368
  if (ctx.nonReactiveScopeDepth && ctx.nonReactiveScopeDepth > 0) {
21369
+ return createNonReactiveVarDecl(baseName2, derivedExpr, ctx, t4);
21370
+ }
21371
+ if (needsMutable) {
20866
21372
  return t4.variableDeclaration("let", [
20867
21373
  t4.variableDeclarator(t4.identifier(baseName2), derivedExpr)
20868
21374
  ]);
@@ -20908,7 +21414,8 @@ Consider:
20908
21414
  const loweredExpr = lowerExpressionWithDeSSA(instr.value, ctx);
20909
21415
  const effectBody = depReads.length > 0 ? ctx.t.blockStatement([...depReads, ctx.t.expressionStatement(loweredExpr)]) : loweredExpr;
20910
21416
  const effectFn = ctx.t.isBlockStatement(effectBody) ? t4.arrowFunctionExpression([], effectBody) : t4.arrowFunctionExpression([], effectBody);
20911
- return t4.expressionStatement(buildEffectCall(ctx, t4, effectFn));
21417
+ const slot = ctx.inModule ? void 0 : reserveHookSlot(ctx);
21418
+ return t4.expressionStatement(buildEffectCall(ctx, t4, effectFn, { slot }));
20912
21419
  }
20913
21420
  return t4.expressionStatement(lowerExpressionWithDeSSA(instr.value, ctx));
20914
21421
  }
@@ -21213,6 +21720,24 @@ function setNodeLoc(node, loc) {
21213
21720
  node.loc = cloneLoc(loc) ?? null;
21214
21721
  return node;
21215
21722
  }
21723
+ function serializeHookReturnInfo(info) {
21724
+ const objectProps = info.objectProps ? Object.fromEntries(info.objectProps.entries()) : void 0;
21725
+ const arrayProps = info.arrayProps ? Object.fromEntries(Array.from(info.arrayProps.entries()).map(([k, v]) => [String(k), v])) : void 0;
21726
+ return {
21727
+ objectProps,
21728
+ arrayProps,
21729
+ directAccessor: info.directAccessor
21730
+ };
21731
+ }
21732
+ function deserializeHookReturnInfo(info) {
21733
+ const objectProps = info.objectProps ? new Map(Object.entries(info.objectProps)) : void 0;
21734
+ const arrayProps = info.arrayProps ? new Map(Object.entries(info.arrayProps).map(([k, v]) => [Number.parseInt(k, 10), v])) : void 0;
21735
+ return {
21736
+ objectProps,
21737
+ arrayProps,
21738
+ directAccessor: info.directAccessor
21739
+ };
21740
+ }
21216
21741
  function propagateHookResultAlias(targetBase, value, ctx) {
21217
21742
  const mapSource = (source) => {
21218
21743
  const hookName = ctx.hookResultVarMap?.get(source);
@@ -21236,6 +21761,15 @@ function propagateHookResultAlias(targetBase, value, ctx) {
21236
21761
  mapSource(deSSAVarName(firstArg.name));
21237
21762
  }
21238
21763
  }
21764
+ if (value.kind === "SequenceExpression" && value.expressions.length > 0) {
21765
+ const last = value.expressions[value.expressions.length - 1];
21766
+ if (last && last.kind === "CallExpression" && last.callee.kind === "Identifier" && last.callee.name === "__fictPropsRest") {
21767
+ const firstArg = last.arguments[0];
21768
+ if (firstArg && firstArg.kind === "Identifier") {
21769
+ mapSource(deSSAVarName(firstArg.name));
21770
+ }
21771
+ }
21772
+ }
21239
21773
  }
21240
21774
  function applyRegionToContext(ctx, region) {
21241
21775
  const prevRegion = ctx.currentRegion;
@@ -21531,6 +22065,9 @@ function createCodegenContext(t4) {
21531
22065
  t: t4,
21532
22066
  moduleDeclaredNames: /* @__PURE__ */ new Set(),
21533
22067
  moduleRuntimeNames: /* @__PURE__ */ new Set(),
22068
+ moduleRuntimeImportMap: /* @__PURE__ */ new Map(),
22069
+ moduleRuntimeNamespaceImports: /* @__PURE__ */ new Set(),
22070
+ stateMacroNames: /* @__PURE__ */ new Set(),
21534
22071
  localDeclaredNames: /* @__PURE__ */ new Set(),
21535
22072
  helpersUsed: /* @__PURE__ */ new Set(),
21536
22073
  tempCounter: 0,
@@ -21542,6 +22079,7 @@ function createCodegenContext(t4) {
21542
22079
  aliasVars: /* @__PURE__ */ new Set(),
21543
22080
  externalTracked: /* @__PURE__ */ new Set(),
21544
22081
  storeVars: /* @__PURE__ */ new Set(),
22082
+ importedNamespaces: /* @__PURE__ */ new Map(),
21545
22083
  signalVars: /* @__PURE__ */ new Set(),
21546
22084
  functionVars: /* @__PURE__ */ new Set(),
21547
22085
  memoVars: /* @__PURE__ */ new Set(),
@@ -21589,9 +22127,10 @@ function withGetterCache(ctx, fn) {
21589
22127
  ctx.getterCacheEnabled = prevEnabled;
21590
22128
  return { result, cacheDeclarations };
21591
22129
  }
21592
- function collectHookReactiveVars(fn) {
22130
+ function collectHookReactiveVars(fn, ctx) {
21593
22131
  const signalVars = /* @__PURE__ */ new Set();
21594
22132
  const storeVars = /* @__PURE__ */ new Set();
22133
+ const memoVars = /* @__PURE__ */ new Set();
21595
22134
  const functionVars = /* @__PURE__ */ new Set();
21596
22135
  const mutatedVars = /* @__PURE__ */ new Set();
21597
22136
  for (const block of fn.blocks) {
@@ -21601,11 +22140,14 @@ function collectHookReactiveVars(fn) {
21601
22140
  if (instr.value.kind === "ArrowFunction" || instr.value.kind === "FunctionExpression") {
21602
22141
  functionVars.add(target);
21603
22142
  }
21604
- if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier") {
21605
- if (instr.value.callee.name === "$state") {
22143
+ if (instr.value.kind === "CallExpression" || instr.value.kind === "OptionalCallExpression") {
22144
+ const callKind = getReactiveCallKind(instr.value, ctx);
22145
+ if (callKind === "signal") {
21606
22146
  signalVars.add(target);
21607
- } else if (instr.value.callee.name === "$store") {
22147
+ } else if (callKind === "store") {
21608
22148
  storeVars.add(target);
22149
+ } else if (callKind === "memo") {
22150
+ memoVars.add(target);
21609
22151
  }
21610
22152
  }
21611
22153
  if (!instr.declarationKind) {
@@ -21616,11 +22158,14 @@ function collectHookReactiveVars(fn) {
21616
22158
  }
21617
22159
  }
21618
22160
  }
21619
- return { signalVars, storeVars, functionVars, mutatedVars };
22161
+ return { signalVars, storeVars, memoVars, functionVars, mutatedVars };
21620
22162
  }
21621
22163
  function analyzeHookReturnInfo(fn, ctx) {
21622
22164
  if (!isHookName(fn.name)) return null;
21623
- const { signalVars, storeVars, functionVars, mutatedVars } = collectHookReactiveVars(fn);
22165
+ const { signalVars, storeVars, memoVars, functionVars, mutatedVars } = collectHookReactiveVars(
22166
+ fn,
22167
+ ctx
22168
+ );
21624
22169
  const tmpCtx = createCodegenContext(ctx.t);
21625
22170
  tmpCtx.signalVars = new Set(signalVars);
21626
22171
  tmpCtx.storeVars = new Set(storeVars);
@@ -21628,9 +22173,9 @@ function analyzeHookReturnInfo(fn, ctx) {
21628
22173
  tmpCtx.mutatedVars = new Set(mutatedVars);
21629
22174
  tmpCtx.aliasVars = /* @__PURE__ */ new Set();
21630
22175
  tmpCtx.trackedVars = /* @__PURE__ */ new Set();
21631
- tmpCtx.memoVars = /* @__PURE__ */ new Set();
22176
+ tmpCtx.memoVars = new Set(memoVars);
21632
22177
  const scopeResult = analyzeReactiveScopesWithSSA(fn);
21633
- detectDerivedCycles(fn, scopeResult);
22178
+ detectDerivedCycles(fn, scopeResult, ctx);
21634
22179
  tmpCtx.scopes = scopeResult;
21635
22180
  const regionResult = generateRegions(fn, scopeResult);
21636
22181
  tmpCtx.regions = flattenRegions(regionResult.topLevelRegions);
@@ -21772,23 +22317,32 @@ function getCachedGetterExpression(ctx, getterName, callExpr) {
21772
22317
  }
21773
22318
  return ctx.t.identifier(existingEntry);
21774
22319
  }
21775
- function getOrCreateHoistedTemplate(html, ctx) {
22320
+ function getOrCreateHoistedTemplate(html, ctx, isSVG, isMathML) {
21776
22321
  if (!ctx.inListRender || !ctx.hoistedTemplates || !ctx.hoistedTemplateStatements) {
21777
22322
  return null;
21778
22323
  }
21779
- const existing = ctx.hoistedTemplates.get(html);
22324
+ const cacheKey = isSVG ? `svg:${html}` : isMathML ? `mathml:${html}` : html;
22325
+ const existing = ctx.hoistedTemplates.get(cacheKey);
21780
22326
  if (existing) {
21781
22327
  return existing;
21782
22328
  }
21783
22329
  const { t: t4 } = ctx;
21784
22330
  ctx.helpersUsed.add("template");
21785
22331
  const tmplId = genTemp(ctx, "htmpl");
21786
- ctx.hoistedTemplates.set(html, tmplId);
22332
+ ctx.hoistedTemplates.set(cacheKey, tmplId);
22333
+ const templateArgs = [t4.stringLiteral(html)];
22334
+ if (isSVG || isMathML) {
22335
+ templateArgs.push(t4.identifier("undefined"));
22336
+ templateArgs.push(isSVG ? t4.booleanLiteral(true) : t4.identifier("undefined"));
22337
+ if (isMathML) {
22338
+ templateArgs.push(t4.booleanLiteral(true));
22339
+ }
22340
+ }
21787
22341
  ctx.hoistedTemplateStatements.push(
21788
22342
  t4.variableDeclaration("const", [
21789
22343
  t4.variableDeclarator(
21790
22344
  tmplId,
21791
- t4.callExpression(t4.identifier(RUNTIME_ALIASES.template), [t4.stringLiteral(html)])
22345
+ t4.callExpression(t4.identifier(RUNTIME_ALIASES.template), templateArgs)
21792
22346
  )
21793
22347
  ])
21794
22348
  );
@@ -21830,7 +22384,7 @@ function matchesListKeyPattern(expr, ctx) {
21830
22384
  const exprPropName = expr.property.kind === "Identifier" ? expr.property.name : String(expr.property.value);
21831
22385
  return exprPropName === keyPropName;
21832
22386
  }
21833
- function detectDerivedCycles(fn, _scopeResult) {
22387
+ function detectDerivedCycles(fn, _scopeResult, ctx) {
21834
22388
  if (debugEnabled("cycles_throw")) {
21835
22389
  throw new Error("cycle check invoked");
21836
22390
  }
@@ -21839,11 +22393,12 @@ function detectDerivedCycles(fn, _scopeResult) {
21839
22393
  for (const instr of block.instructions) {
21840
22394
  if (instr.kind !== "Assign") continue;
21841
22395
  const target = deSSAVarName(instr.target.name);
21842
- const isStateCall2 = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$state";
21843
- const isStoreCall = instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$store";
22396
+ const callKind = getReactiveCallKind(instr.value, ctx);
22397
+ const isSignalCall = callKind === "signal";
22398
+ const isStoreCall = callKind === "store";
21844
22399
  const prev = declared.get(target);
21845
22400
  declared.set(target, {
21846
- isState: (prev?.isState ?? false) || isStateCall2,
22401
+ isSignal: (prev?.isSignal ?? false) || isSignalCall,
21847
22402
  isStore: (prev?.isStore ?? false) || isStoreCall,
21848
22403
  declaredHere: prev?.declaredHere || !!instr.declarationKind,
21849
22404
  count: (prev?.count ?? 0) + 1
@@ -21856,7 +22411,7 @@ function detectDerivedCycles(fn, _scopeResult) {
21856
22411
  if (instr.kind !== "Assign") continue;
21857
22412
  const target = deSSAVarName(instr.target.name);
21858
22413
  const declInfo = declared.get(target);
21859
- if (declInfo?.isState || !declInfo?.declaredHere) continue;
22414
+ if (declInfo?.isSignal || declInfo?.isStore || !declInfo?.declaredHere) continue;
21860
22415
  if ((declInfo.count ?? 0) !== 1) continue;
21861
22416
  const deps = graph.get(target) ?? /* @__PURE__ */ new Set();
21862
22417
  const rawDeps = /* @__PURE__ */ new Set();
@@ -21864,7 +22419,7 @@ function detectDerivedCycles(fn, _scopeResult) {
21864
22419
  for (const dep of rawDeps) {
21865
22420
  const base = deSSAVarName(dep.split(".")[0] ?? dep);
21866
22421
  const depInfo = declared.get(base);
21867
- if (depInfo && depInfo.declaredHere && !depInfo.isState && (depInfo.count ?? 0) === 1) {
22422
+ if (depInfo && depInfo.declaredHere && !depInfo.isSignal && !depInfo.isStore && (depInfo.count ?? 0) === 1) {
21868
22423
  deps.add(base);
21869
22424
  }
21870
22425
  }
@@ -22489,6 +23044,12 @@ function extractKeyFromMapCallback(callback) {
22489
23044
  if (!jsx) return void 0;
22490
23045
  return extractKeyFromAttributes(jsx.attributes);
22491
23046
  }
23047
+ function buildOutputParams(fn, t4) {
23048
+ if (fn.rawParams && fn.rawParams.length > 0) {
23049
+ return fn.rawParams.map((param) => t4.cloneNode(param, true));
23050
+ }
23051
+ return fn.params.map((p) => t4.identifier(deSSAVarName(p.name)));
23052
+ }
22492
23053
  function lowerTrackedExpression(expr, ctx) {
22493
23054
  const regionOverride = ctx.inReturn && ctx.currentFnIsHook ? null : ctx.currentRegion ?? (ctx.trackedVars.size ? {
22494
23055
  id: -1,
@@ -22570,20 +23131,28 @@ function lowerInstruction(instr, ctx) {
22570
23131
  }
22571
23132
  }
22572
23133
  if (ctx.signalVars?.has(baseName2)) {
23134
+ ctx.currentAssignmentName = baseName2;
23135
+ const loweredValue = (() => {
23136
+ try {
23137
+ return lowerTrackedExpression(instr.value, ctx);
23138
+ } finally {
23139
+ ctx.currentAssignmentName = void 0;
23140
+ }
23141
+ })();
22573
23142
  return applyLoc(
22574
- t4.expressionStatement(
22575
- t4.callExpression(t4.identifier(baseName2), [lowerTrackedExpression(instr.value, ctx)])
22576
- )
23143
+ t4.expressionStatement(t4.callExpression(t4.identifier(baseName2), [loweredValue]))
22577
23144
  );
22578
23145
  }
23146
+ ctx.currentAssignmentName = baseName2;
23147
+ const loweredAssign = (() => {
23148
+ try {
23149
+ return lowerTrackedExpression(instr.value, ctx);
23150
+ } finally {
23151
+ ctx.currentAssignmentName = void 0;
23152
+ }
23153
+ })();
22579
23154
  return applyLoc(
22580
- t4.expressionStatement(
22581
- t4.assignmentExpression(
22582
- "=",
22583
- t4.identifier(baseName2),
22584
- lowerTrackedExpression(instr.value, ctx)
22585
- )
22586
- )
23155
+ t4.expressionStatement(t4.assignmentExpression("=", t4.identifier(baseName2), loweredAssign))
22587
23156
  );
22588
23157
  }
22589
23158
  if (instr.kind === "Expression") {
@@ -22601,16 +23170,18 @@ function lowerTerminator(block, ctx) {
22601
23170
  const applyLoc = (stmts) => stmts.map((stmt) => setNodeLoc(stmt, baseLoc));
22602
23171
  switch (block.terminator.kind) {
22603
23172
  case "Return": {
22604
- const prevRegion = ctx.currentRegion;
22605
23173
  const preserveAccessors = ctx.currentFnIsHook;
22606
- if (preserveAccessors) ctx.currentRegion = void 0;
23174
+ const prevHookFlag = ctx.currentFnIsHook;
23175
+ if (preserveAccessors) ctx.currentFnIsHook = false;
22607
23176
  ctx.inReturn = true;
22608
23177
  let retExpr = block.terminator.argument ? lowerTrackedExpression(block.terminator.argument, ctx) : null;
23178
+ ctx.inReturn = false;
23179
+ if (preserveAccessors) {
23180
+ ctx.currentFnIsHook = prevHookFlag;
23181
+ }
22609
23182
  if (preserveAccessors && retExpr) {
22610
23183
  retExpr = unwrapAccessorCalls(retExpr, ctx);
22611
23184
  }
22612
- ctx.inReturn = false;
22613
- ctx.currentRegion = prevRegion;
22614
23185
  return applyLoc([t4.returnStatement(retExpr)]);
22615
23186
  }
22616
23187
  case "Throw":
@@ -22770,17 +23341,253 @@ function collectDeclaredNames(body, t4) {
22770
23341
  }
22771
23342
  return declared;
22772
23343
  }
22773
- function collectRuntimeImportNames(body, t4) {
22774
- const runtimeModules = /* @__PURE__ */ new Set([RUNTIME_MODULE, "@fictjs/runtime", "fict"]);
22775
- const imported = /* @__PURE__ */ new Set();
23344
+ var RUNTIME_IMPORT_MODULES = /* @__PURE__ */ new Set([
23345
+ RUNTIME_MODULE,
23346
+ "@fictjs/runtime",
23347
+ "@fictjs/runtime/advanced",
23348
+ "fict",
23349
+ "fict/advanced"
23350
+ ]);
23351
+ function collectRuntimeImports(body, t4) {
23352
+ const names = /* @__PURE__ */ new Set();
23353
+ const importMap = /* @__PURE__ */ new Map();
23354
+ const namespaces = /* @__PURE__ */ new Set();
23355
+ for (const stmt of body) {
23356
+ if (!t4.isImportDeclaration(stmt)) continue;
23357
+ if (stmt.importKind === "type") continue;
23358
+ if (!RUNTIME_IMPORT_MODULES.has(stmt.source.value)) continue;
23359
+ for (const spec of stmt.specifiers) {
23360
+ if (t4.isImportSpecifier(spec) && spec.importKind === "type") {
23361
+ continue;
23362
+ }
23363
+ names.add(spec.local.name);
23364
+ if (t4.isImportSpecifier(spec)) {
23365
+ const importedName = t4.isIdentifier(spec.imported) ? spec.imported.name : spec.imported.value;
23366
+ importMap.set(spec.local.name, importedName);
23367
+ } else if (t4.isImportNamespaceSpecifier(spec) || t4.isImportDefaultSpecifier(spec)) {
23368
+ namespaces.add(spec.local.name);
23369
+ }
23370
+ }
23371
+ }
23372
+ return { names, importMap, namespaces };
23373
+ }
23374
+ var RUNTIME_REACTIVE_CREATORS = /* @__PURE__ */ new Map([
23375
+ ["createSignal", "signal"],
23376
+ ["createStore", "store"],
23377
+ ["createMemo", "memo"]
23378
+ ]);
23379
+ function isNameShadowed(name, ctx) {
23380
+ return !!(ctx.shadowedNames?.has(name) || ctx.localDeclaredNames?.has(name));
23381
+ }
23382
+ function getRuntimeImportedKind(name, ctx) {
23383
+ if (isNameShadowed(name, ctx)) return null;
23384
+ const imported = ctx.moduleRuntimeImportMap?.get(name);
23385
+ if (!imported) return null;
23386
+ return RUNTIME_REACTIVE_CREATORS.get(imported) ?? null;
23387
+ }
23388
+ function getRuntimeMemberKind(expr, ctx) {
23389
+ if (expr.kind !== "MemberExpression" && expr.kind !== "OptionalMemberExpression") return null;
23390
+ if (expr.object.kind !== "Identifier") return null;
23391
+ const objectName = deSSAVarName(expr.object.name);
23392
+ if (isNameShadowed(objectName, ctx)) return null;
23393
+ if (!ctx.moduleRuntimeNamespaceImports?.has(objectName)) return null;
23394
+ const propName = getStaticPropName(expr.property, expr.computed);
23395
+ if (typeof propName !== "string") return null;
23396
+ return RUNTIME_REACTIVE_CREATORS.get(propName) ?? null;
23397
+ }
23398
+ function getReactiveCallKind(expr, ctx) {
23399
+ if (expr.kind !== "CallExpression" && expr.kind !== "OptionalCallExpression") return null;
23400
+ const callee = expr.callee;
23401
+ if (callee.kind === "Identifier") {
23402
+ const name = deSSAVarName(callee.name);
23403
+ if (ctx.stateMacroNames?.has(name)) return "signal";
23404
+ if (name === "$store") return "store";
23405
+ if (ctx.memoMacroNames?.has(name)) return "memo";
23406
+ return getRuntimeImportedKind(name, ctx);
23407
+ }
23408
+ return getRuntimeMemberKind(callee, ctx);
23409
+ }
23410
+ function getReactiveCallKindFromBabel(callExpr, ctx, t4) {
23411
+ const callee = callExpr.callee;
23412
+ if (t4.isIdentifier(callee)) {
23413
+ const name = callee.name;
23414
+ if (ctx.stateMacroNames?.has(name)) return "signal";
23415
+ if (name === "$store") return "store";
23416
+ if (ctx.memoMacroNames?.has(name)) return "memo";
23417
+ return getRuntimeImportedKind(name, ctx);
23418
+ }
23419
+ if (t4.isMemberExpression(callee) || t4.isOptionalMemberExpression(callee)) {
23420
+ const memberCallee = callee;
23421
+ if (!t4.isIdentifier(memberCallee.object)) return null;
23422
+ const objectName = memberCallee.object.name;
23423
+ if (isNameShadowed(objectName, ctx)) return null;
23424
+ if (!ctx.moduleRuntimeNamespaceImports?.has(objectName)) return null;
23425
+ 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;
23426
+ if (!propName) return null;
23427
+ return RUNTIME_REACTIVE_CREATORS.get(propName) ?? null;
23428
+ }
23429
+ return null;
23430
+ }
23431
+ function addImportedReactiveBinding(name, kind, ctx) {
23432
+ const base = deSSAVarName(name);
23433
+ if (kind === "signal") {
23434
+ ctx.signalVars?.add(base);
23435
+ } else if (kind === "store") {
23436
+ ctx.storeVars?.add(base);
23437
+ } else if (kind === "memo") {
23438
+ ctx.memoVars?.add(base);
23439
+ }
23440
+ ctx.trackedVars.add(base);
23441
+ }
23442
+ function applyImportedReactiveMetadata(body, ctx, t4, options) {
23443
+ const importer = options?.filename;
23444
+ const namespaces = /* @__PURE__ */ new Map();
22776
23445
  for (const stmt of body) {
22777
23446
  if (!t4.isImportDeclaration(stmt)) continue;
22778
- if (!runtimeModules.has(stmt.source.value)) continue;
23447
+ const meta = resolveModuleMetadata(stmt.source.value, importer, options);
23448
+ if (!meta) continue;
22779
23449
  for (const spec of stmt.specifiers) {
22780
- imported.add(spec.local.name);
23450
+ if (t4.isImportSpecifier(spec)) {
23451
+ const importedName = t4.isIdentifier(spec.imported) ? spec.imported.name : String(spec.imported.value);
23452
+ const localName = spec.local.name;
23453
+ const kind = meta.exports[importedName];
23454
+ if (kind) {
23455
+ addImportedReactiveBinding(localName, kind, ctx);
23456
+ }
23457
+ const hookInfo = meta.hooks?.[importedName];
23458
+ if (hookInfo) {
23459
+ ctx.hookReturnInfo = ctx.hookReturnInfo ?? /* @__PURE__ */ new Map();
23460
+ ctx.hookReturnInfo.set(localName, deserializeHookReturnInfo(hookInfo));
23461
+ }
23462
+ continue;
23463
+ }
23464
+ if (t4.isImportDefaultSpecifier(spec)) {
23465
+ const localName = spec.local.name;
23466
+ const kind = meta.exports.default;
23467
+ if (kind) {
23468
+ addImportedReactiveBinding(localName, kind, ctx);
23469
+ }
23470
+ const hookInfo = meta.hooks?.default;
23471
+ if (hookInfo) {
23472
+ ctx.hookReturnInfo = ctx.hookReturnInfo ?? /* @__PURE__ */ new Map();
23473
+ ctx.hookReturnInfo.set(localName, deserializeHookReturnInfo(hookInfo));
23474
+ }
23475
+ continue;
23476
+ }
23477
+ if (t4.isImportNamespaceSpecifier(spec)) {
23478
+ namespaces.set(spec.local.name, meta);
23479
+ }
22781
23480
  }
22782
23481
  }
22783
- return imported;
23482
+ if (namespaces.size > 0) {
23483
+ ctx.importedNamespaces = namespaces;
23484
+ }
23485
+ }
23486
+ function classifyReactiveExport(name, ctx) {
23487
+ const base = deSSAVarName(name);
23488
+ if (ctx.storeVars?.has(base)) return "store";
23489
+ if (ctx.signalVars?.has(base)) return "signal";
23490
+ if (ctx.aliasVars?.has(base)) return "signal";
23491
+ if (ctx.memoVars?.has(base)) return "memo";
23492
+ return null;
23493
+ }
23494
+ function buildModuleReactiveMetadata(body, ctx, t4, options) {
23495
+ const metadata = { exports: {} };
23496
+ const hookExports = {};
23497
+ const addExport = (exportName, localName) => {
23498
+ const kind = classifyReactiveExport(localName, ctx);
23499
+ if (kind) {
23500
+ metadata.exports[exportName] = kind;
23501
+ }
23502
+ const hookInfo = getHookReturnInfo(localName, ctx);
23503
+ if (hookInfo) {
23504
+ hookExports[exportName] = serializeHookReturnInfo(hookInfo);
23505
+ }
23506
+ };
23507
+ const addExportFromSource = (source, importedName, exportName) => {
23508
+ const sourceMeta = resolveModuleMetadata(source, options?.filename, options);
23509
+ if (!sourceMeta) return;
23510
+ const kind = sourceMeta.exports[importedName];
23511
+ if (kind) {
23512
+ metadata.exports[exportName] = kind;
23513
+ }
23514
+ const hookInfo = sourceMeta.hooks?.[importedName];
23515
+ if (hookInfo) {
23516
+ hookExports[exportName] = hookInfo;
23517
+ }
23518
+ };
23519
+ const addDefaultExportKind = (kind) => {
23520
+ if (kind) {
23521
+ metadata.exports.default = kind;
23522
+ }
23523
+ };
23524
+ for (const stmt of body) {
23525
+ if (t4.isExportNamedDeclaration(stmt)) {
23526
+ if (stmt.source && stmt.specifiers.length > 0) {
23527
+ for (const spec of stmt.specifiers) {
23528
+ if (!t4.isExportSpecifier(spec)) continue;
23529
+ const importedName = spec.local.name;
23530
+ const exportName = t4.isIdentifier(spec.exported) ? spec.exported.name : t4.isStringLiteral(spec.exported) ? spec.exported.value : String(spec.exported);
23531
+ addExportFromSource(stmt.source.value, importedName, exportName);
23532
+ }
23533
+ continue;
23534
+ }
23535
+ if (stmt.declaration) {
23536
+ const decl = stmt.declaration;
23537
+ if (t4.isFunctionDeclaration(decl) && decl.id) {
23538
+ addExport(decl.id.name, decl.id.name);
23539
+ } else if (t4.isClassDeclaration(decl) && decl.id) {
23540
+ addExport(decl.id.name, decl.id.name);
23541
+ } else if (t4.isVariableDeclaration(decl)) {
23542
+ for (const v of decl.declarations) {
23543
+ if (t4.isIdentifier(v.id)) {
23544
+ addExport(v.id.name, v.id.name);
23545
+ }
23546
+ }
23547
+ }
23548
+ } else {
23549
+ for (const spec of stmt.specifiers) {
23550
+ if (!t4.isExportSpecifier(spec)) continue;
23551
+ const localName = spec.local.name;
23552
+ const exportName = t4.isIdentifier(spec.exported) ? spec.exported.name : t4.isStringLiteral(spec.exported) ? spec.exported.value : String(spec.exported);
23553
+ addExport(exportName, localName);
23554
+ }
23555
+ }
23556
+ continue;
23557
+ }
23558
+ if (t4.isExportAllDeclaration(stmt)) {
23559
+ const sourceMeta = resolveModuleMetadata(stmt.source.value, options?.filename, options);
23560
+ if (!sourceMeta) continue;
23561
+ for (const [exportName, kind] of Object.entries(sourceMeta.exports)) {
23562
+ if (exportName === "default") continue;
23563
+ metadata.exports[exportName] = kind;
23564
+ }
23565
+ if (sourceMeta.hooks) {
23566
+ for (const [exportName, info] of Object.entries(sourceMeta.hooks)) {
23567
+ if (exportName === "default") continue;
23568
+ hookExports[exportName] = info;
23569
+ }
23570
+ }
23571
+ continue;
23572
+ }
23573
+ if (t4.isExportDefaultDeclaration(stmt)) {
23574
+ const decl = stmt.declaration;
23575
+ if (t4.isIdentifier(decl)) {
23576
+ addExport("default", decl.name);
23577
+ } else if (t4.isFunctionDeclaration(decl) && decl.id) {
23578
+ addExport("default", decl.id.name);
23579
+ } else if (t4.isClassDeclaration(decl) && decl.id) {
23580
+ addExport("default", decl.id.name);
23581
+ } else if (t4.isCallExpression(decl) || t4.isOptionalCallExpression(decl)) {
23582
+ const kind = getReactiveCallKindFromBabel(decl, ctx, t4);
23583
+ addDefaultExportKind(kind);
23584
+ }
23585
+ }
23586
+ }
23587
+ if (Object.keys(hookExports).length > 0) {
23588
+ metadata.hooks = hookExports;
23589
+ }
23590
+ return metadata;
22784
23591
  }
22785
23592
  function collectLocalDeclaredNames(params, blocks, t4) {
22786
23593
  const declared = /* @__PURE__ */ new Set();
@@ -22990,6 +23797,45 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
22990
23797
  return lowerBlocksToStatements(blocks);
22991
23798
  }
22992
23799
  };
23800
+ const lowerReactiveScopeExpression = (fnExpr) => {
23801
+ if (!fnExpr.reactiveScope) return null;
23802
+ const blocks = Array.isArray(fnExpr.body) ? fnExpr.body : [
23803
+ {
23804
+ id: 0,
23805
+ instructions: [],
23806
+ terminator: {
23807
+ kind: "Return",
23808
+ argument: fnExpr.body
23809
+ }
23810
+ }
23811
+ ];
23812
+ const fn = {
23813
+ params: fnExpr.params,
23814
+ blocks,
23815
+ meta: {
23816
+ fromExpression: true,
23817
+ isArrow: fnExpr.kind === "ArrowFunction",
23818
+ hasExpressionBody: fnExpr.kind === "ArrowFunction" && fnExpr.isExpression,
23819
+ isAsync: fnExpr.isAsync ?? false
23820
+ },
23821
+ loc: fnExpr.loc ?? null
23822
+ };
23823
+ const lowered = lowerFunctionWithRegions(fn, ctx, { forceHookContext: true });
23824
+ if (!lowered) return null;
23825
+ const params = lowered.params;
23826
+ if (fnExpr.kind === "ArrowFunction") {
23827
+ const arrow = t4.arrowFunctionExpression(params, lowered.body);
23828
+ arrow.async = lowered.async;
23829
+ return arrow;
23830
+ }
23831
+ const fnExprAst = t4.functionExpression(
23832
+ fnExpr.name ? t4.identifier(deSSAVarName(fnExpr.name)) : null,
23833
+ params,
23834
+ lowered.body
23835
+ );
23836
+ fnExprAst.async = lowered.async;
23837
+ return fnExprAst;
23838
+ };
22993
23839
  switch (expr.kind) {
22994
23840
  case "Identifier":
22995
23841
  return t4.identifier(deSSAVarName(expr.name));
@@ -23011,6 +23857,22 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23011
23857
  case "CallExpression": {
23012
23858
  if (expr.callee.kind === "Identifier" && expr.callee.name === "$state") {
23013
23859
  const args = lowerCallArguments(expr.arguments);
23860
+ const includeDevtools = ctx.options?.dev !== false;
23861
+ if (includeDevtools) {
23862
+ const options = [];
23863
+ if (ctx.currentAssignmentName) {
23864
+ options.push(
23865
+ t4.objectProperty(t4.identifier("name"), t4.stringLiteral(ctx.currentAssignmentName))
23866
+ );
23867
+ }
23868
+ if (expr.loc) {
23869
+ const source = `${ctx.options?.filename ?? ""}:${expr.loc.start.line}:${expr.loc.start.column}`;
23870
+ options.push(t4.objectProperty(t4.identifier("devToolsSource"), t4.stringLiteral(source)));
23871
+ }
23872
+ if (options.length > 0) {
23873
+ args.push(t4.objectExpression(options));
23874
+ }
23875
+ }
23014
23876
  if (ctx.inModule) {
23015
23877
  ctx.helpersUsed.add("signal");
23016
23878
  return t4.callExpression(t4.identifier(RUNTIME_ALIASES.signal), args);
@@ -23022,6 +23884,34 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23022
23884
  ...args
23023
23885
  ]);
23024
23886
  }
23887
+ if (expr.callee.kind === "Identifier") {
23888
+ const memoCalleeName = deSSAVarName(expr.callee.name);
23889
+ if (ctx.memoMacroNames?.has(memoCalleeName)) {
23890
+ const args = lowerCallArguments(expr.arguments);
23891
+ const includeDevtools = ctx.options?.dev !== false;
23892
+ if (includeDevtools && expr.arguments.length === 1) {
23893
+ const options = [];
23894
+ if (ctx.currentAssignmentName) {
23895
+ options.push(
23896
+ t4.objectProperty(t4.identifier("name"), t4.stringLiteral(ctx.currentAssignmentName))
23897
+ );
23898
+ }
23899
+ if (expr.loc) {
23900
+ const source = `${ctx.options?.filename ?? ""}:${expr.loc.start.line}:${expr.loc.start.column}`;
23901
+ options.push(
23902
+ t4.objectProperty(t4.identifier("devToolsSource"), t4.stringLiteral(source))
23903
+ );
23904
+ }
23905
+ if (options.length > 0) {
23906
+ args.push(t4.objectExpression(options));
23907
+ }
23908
+ }
23909
+ return t4.callExpression(
23910
+ lowerExpression(expr.callee, ctx),
23911
+ args
23912
+ );
23913
+ }
23914
+ }
23025
23915
  if (expr.callee.kind === "Identifier" && expr.callee.name === "$effect") {
23026
23916
  const args = lowerCallArguments(
23027
23917
  expr.arguments,
@@ -23090,6 +23980,24 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23090
23980
  if (matchesListKeyPattern(expr, ctx)) {
23091
23981
  return t4.identifier(ctx.listKeyParamName);
23092
23982
  }
23983
+ if (expr.object.kind === "Identifier") {
23984
+ const nsMeta = ctx.importedNamespaces?.get(deSSAVarName(expr.object.name));
23985
+ if (nsMeta) {
23986
+ const propName = getStaticPropName(expr.property, expr.computed);
23987
+ if (typeof propName === "string") {
23988
+ const kind = nsMeta.exports[propName];
23989
+ if (kind === "signal" || kind === "memo") {
23990
+ const member = t4.memberExpression(
23991
+ t4.identifier(deSSAVarName(expr.object.name)),
23992
+ expr.computed ? t4.stringLiteral(propName) : t4.identifier(propName),
23993
+ expr.computed,
23994
+ expr.optional
23995
+ );
23996
+ return t4.callExpression(member, []);
23997
+ }
23998
+ }
23999
+ }
24000
+ }
23093
24001
  if (expr.object.kind === "Identifier" && ctx.hookResultVarMap?.has(deSSAVarName(expr.object.name))) {
23094
24002
  const hookName = ctx.hookResultVarMap.get(deSSAVarName(expr.object.name));
23095
24003
  const info = getHookReturnInfo(hookName, ctx);
@@ -23182,6 +24090,8 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23182
24090
  case "JSXElement":
23183
24091
  return lowerJSXElement(expr, ctx);
23184
24092
  case "ArrowFunction": {
24093
+ const reactiveLowered = lowerReactiveScopeExpression(expr);
24094
+ if (reactiveLowered) return reactiveLowered;
23185
24095
  const paramIds = mapParams(expr.params);
23186
24096
  const shadowed = new Set(expr.params.map((p) => deSSAVarName(p.name)));
23187
24097
  const localDeclared = collectLocalDeclaredNames(
@@ -23228,6 +24138,8 @@ function lowerExpressionImpl(expr, ctx, _isAssigned = false) {
23228
24138
  );
23229
24139
  }
23230
24140
  case "FunctionExpression": {
24141
+ const reactiveLowered = lowerReactiveScopeExpression(expr);
24142
+ if (reactiveLowered) return reactiveLowered;
23231
24143
  const paramIds = mapParams(expr.params);
23232
24144
  const shadowed = new Set(expr.params.map((p) => deSSAVarName(p.name)));
23233
24145
  const localDeclared = collectLocalDeclaredNames(expr.params, expr.body, t4);
@@ -23580,9 +24492,21 @@ function collectExpressionDependencies(expr, deps) {
23580
24492
  deps.add(deSSAVarName(expr.name));
23581
24493
  return;
23582
24494
  }
24495
+ if (expr.kind === "ArrowFunction") {
24496
+ if (expr.isExpression && !Array.isArray(expr.body)) {
24497
+ collectExpressionDependencies(expr.body, deps);
24498
+ } else if (Array.isArray(expr.body)) {
24499
+ collectBlockDependencies(expr.body, deps);
24500
+ }
24501
+ return;
24502
+ }
24503
+ if (expr.kind === "FunctionExpression") {
24504
+ collectBlockDependencies(expr.body, deps);
24505
+ return;
24506
+ }
23583
24507
  if (expr.kind === "MemberExpression") {
23584
- const path = getMemberDependencyPath(expr);
23585
- if (path) deps.add(path);
24508
+ const path2 = getMemberDependencyPath(expr);
24509
+ if (path2) deps.add(path2);
23586
24510
  collectExpressionDependencies(expr.object, deps);
23587
24511
  if (expr.computed && expr.property.kind !== "Literal") {
23588
24512
  collectExpressionDependencies(expr.property, deps);
@@ -23628,6 +24552,51 @@ function collectExpressionDependencies(expr, deps) {
23628
24552
  return;
23629
24553
  }
23630
24554
  }
24555
+ function collectBlockDependencies(blocks, deps) {
24556
+ for (const block of blocks) {
24557
+ for (const instr of block.instructions) {
24558
+ switch (instr.kind) {
24559
+ case "Assign":
24560
+ case "Expression":
24561
+ collectExpressionDependencies(instr.value, deps);
24562
+ break;
24563
+ case "Phi":
24564
+ for (const source of instr.sources) {
24565
+ deps.add(deSSAVarName(source.id.name));
24566
+ }
24567
+ break;
24568
+ default:
24569
+ break;
24570
+ }
24571
+ }
24572
+ const term = block.terminator;
24573
+ switch (term.kind) {
24574
+ case "Return":
24575
+ if (term.argument) collectExpressionDependencies(term.argument, deps);
24576
+ break;
24577
+ case "Throw":
24578
+ collectExpressionDependencies(term.argument, deps);
24579
+ break;
24580
+ case "Branch":
24581
+ collectExpressionDependencies(term.test, deps);
24582
+ break;
24583
+ case "Switch":
24584
+ collectExpressionDependencies(term.discriminant, deps);
24585
+ for (const c of term.cases) {
24586
+ if (c.test) collectExpressionDependencies(c.test, deps);
24587
+ }
24588
+ break;
24589
+ case "ForOf":
24590
+ collectExpressionDependencies(term.iterable, deps);
24591
+ break;
24592
+ case "ForIn":
24593
+ collectExpressionDependencies(term.object, deps);
24594
+ break;
24595
+ default:
24596
+ break;
24597
+ }
24598
+ }
24599
+ }
23631
24600
  function normalizeDependencyKey2(name) {
23632
24601
  return name.split(".").map((part) => deSSAVarName(part)).join(".");
23633
24602
  }
@@ -23767,9 +24736,9 @@ function replaceIdentifiersWithOverrides(node, overrides, t4, parentKind, parent
23767
24736
  if (!skipCurrentNode && (t4.isMemberExpression(node) || t4.isOptionalMemberExpression(node))) {
23768
24737
  const propertyNode = node.property;
23769
24738
  const isDynamicComputed = (node.computed ?? false) && !t4.isStringLiteral(propertyNode) && !t4.isNumericLiteral(propertyNode);
23770
- const path = getDependencyPathFromNode(node, t4);
23771
- const normalized = path ? normalizeDependencyKey2(path) : null;
23772
- const override = normalized && overrides[normalized] || (path ? overrides[path] : void 0);
24739
+ const path2 = getDependencyPathFromNode(node, t4);
24740
+ const normalized = path2 ? normalizeDependencyKey2(path2) : null;
24741
+ const override = normalized && overrides[normalized] || (path2 ? overrides[path2] : void 0);
23773
24742
  if (override && !isCallTarget && !isDynamicComputed) {
23774
24743
  const replacement = override();
23775
24744
  Object.assign(node, replacement);
@@ -23804,6 +24773,9 @@ function replaceIdentifiersWithOverrides(node, overrides, t4, parentKind, parent
23804
24773
  }
23805
24774
  return;
23806
24775
  }
24776
+ const isMethodCallMember = (t4.isMemberExpression(node) || t4.isOptionalMemberExpression(node)) && !node.computed && t4.isIdentifier(node.property) && ["call", "apply", "bind"].includes(
24777
+ node.property.name
24778
+ );
23807
24779
  for (const key of Object.keys(node)) {
23808
24780
  if (key === "type" || key === "loc" || key === "start" || key === "end") continue;
23809
24781
  if (t4.isObjectProperty(node) && key === "key" && !node.computed) {
@@ -23812,6 +24784,9 @@ function replaceIdentifiersWithOverrides(node, overrides, t4, parentKind, parent
23812
24784
  if ((t4.isMemberExpression(node) || t4.isOptionalMemberExpression(node)) && key === "property" && !node.computed) {
23813
24785
  continue;
23814
24786
  }
24787
+ if (isMethodCallMember && key === "object") {
24788
+ continue;
24789
+ }
23815
24790
  const value = node[key];
23816
24791
  if (Array.isArray(value)) {
23817
24792
  for (const item of value) {
@@ -24044,7 +25019,13 @@ function normalizeHIRAttrName(name) {
24044
25019
  if (name === "htmlFor") return "for";
24045
25020
  return name;
24046
25021
  }
24047
- function extractHIRStaticHtml(jsx, ctx, parentPath = []) {
25022
+ function resolveNamespaceContext(tagName, parentNamespace) {
25023
+ if (tagName === "svg") return "svg";
25024
+ if (tagName === "math") return "mathml";
25025
+ if (tagName === "foreignObject" && parentNamespace === "svg") return null;
25026
+ return parentNamespace;
25027
+ }
25028
+ function extractHIRStaticHtml(jsx, ctx, parentPath = [], namespace = null) {
24048
25029
  if (jsx.isComponent || typeof jsx.tagName !== "string") {
24049
25030
  return {
24050
25031
  html: "<!---->",
@@ -24058,6 +25039,7 @@ function extractHIRStaticHtml(jsx, ctx, parentPath = []) {
24058
25039
  };
24059
25040
  }
24060
25041
  const tagName = jsx.tagName;
25042
+ const resolvedNamespace = resolveNamespaceContext(tagName, namespace);
24061
25043
  let html = `<${tagName}`;
24062
25044
  const bindings = [];
24063
25045
  for (const attr of jsx.attributes) {
@@ -24157,7 +25139,7 @@ function extractHIRStaticHtml(jsx, ctx, parentPath = []) {
24157
25139
  }
24158
25140
  } else if (child.kind === "element") {
24159
25141
  const childPath = [...parentPath, childIndex];
24160
- const childResult = extractHIRStaticHtml(child.value, ctx, childPath);
25142
+ const childResult = extractHIRStaticHtml(child.value, ctx, childPath, resolvedNamespace);
24161
25143
  html += childResult.html;
24162
25144
  bindings.push(...childResult.bindings);
24163
25145
  childIndex++;
@@ -24168,26 +25150,42 @@ function extractHIRStaticHtml(jsx, ctx, parentPath = []) {
24168
25150
  bindings.push({
24169
25151
  type: "text",
24170
25152
  path: [...parentPath, childIndex],
24171
- expr: child.value
25153
+ expr: child.value,
25154
+ // Track namespace for dynamic text bindings
25155
+ namespace: resolvedNamespace
24172
25156
  });
24173
25157
  } else {
24174
25158
  html += "<!---->";
24175
25159
  bindings.push({
24176
25160
  type: "child",
24177
25161
  path: [...parentPath, childIndex],
24178
- expr: child.value
25162
+ expr: child.value,
25163
+ // Track namespace for dynamic child bindings
25164
+ namespace: resolvedNamespace
24179
25165
  });
24180
25166
  }
24181
25167
  childIndex++;
24182
25168
  }
24183
25169
  }
24184
25170
  html += `</${tagName}>`;
24185
- return { html, bindings };
25171
+ const needsSVG = namespace === "svg" && tagName !== "svg";
25172
+ const needsMathML = namespace === "mathml" && tagName !== "math";
25173
+ return {
25174
+ html,
25175
+ bindings,
25176
+ isSVG: needsSVG || void 0,
25177
+ isMathML: needsMathML || void 0
25178
+ };
24186
25179
  }
24187
25180
  function lowerIntrinsicElement(jsx, ctx) {
24188
25181
  const { t: t4 } = ctx;
24189
25182
  const statements = [];
24190
- const { html, bindings } = extractHIRStaticHtml(jsx, ctx);
25183
+ const { html, bindings, isSVG, isMathML } = extractHIRStaticHtml(
25184
+ jsx,
25185
+ ctx,
25186
+ [],
25187
+ ctx.namespaceContext ?? null
25188
+ );
24191
25189
  const allDeps = /* @__PURE__ */ new Set();
24192
25190
  for (const binding of bindings) {
24193
25191
  if (binding.expr) collectExpressionDependencies(binding.expr, allDeps);
@@ -24213,7 +25211,7 @@ function lowerIntrinsicElement(jsx, ctx) {
24213
25211
  ctx.needsCtx = true;
24214
25212
  }
24215
25213
  }
24216
- const hoistedTmplId = getOrCreateHoistedTemplate(html, ctx);
25214
+ const hoistedTmplId = getOrCreateHoistedTemplate(html, ctx, isSVG, isMathML);
24217
25215
  const rootId = genTemp(ctx, "root");
24218
25216
  if (hoistedTmplId) {
24219
25217
  statements.push(
@@ -24224,11 +25222,19 @@ function lowerIntrinsicElement(jsx, ctx) {
24224
25222
  } else {
24225
25223
  ctx.helpersUsed.add("template");
24226
25224
  const tmplId = genTemp(ctx, "tmpl");
25225
+ const templateArgs = [t4.stringLiteral(html)];
25226
+ if (isSVG || isMathML) {
25227
+ templateArgs.push(t4.identifier("undefined"));
25228
+ templateArgs.push(isSVG ? t4.booleanLiteral(true) : t4.identifier("undefined"));
25229
+ if (isMathML) {
25230
+ templateArgs.push(t4.booleanLiteral(true));
25231
+ }
25232
+ }
24227
25233
  statements.push(
24228
25234
  t4.variableDeclaration("const", [
24229
25235
  t4.variableDeclarator(
24230
25236
  tmplId,
24231
- t4.callExpression(t4.identifier(RUNTIME_ALIASES.template), [t4.stringLiteral(html)])
25237
+ t4.callExpression(t4.identifier(RUNTIME_ALIASES.template), templateArgs)
24232
25238
  )
24233
25239
  ])
24234
25240
  );
@@ -24241,6 +25247,12 @@ function lowerIntrinsicElement(jsx, ctx) {
24241
25247
  const elId = rootId;
24242
25248
  const nodeCache = /* @__PURE__ */ new Map();
24243
25249
  nodeCache.set("", elId);
25250
+ const tagName = typeof jsx.tagName === "string" ? jsx.tagName : null;
25251
+ const prevNamespace = ctx.namespaceContext;
25252
+ if (tagName) {
25253
+ const elementNamespace = resolveNamespaceContext(tagName, ctx.namespaceContext ?? null);
25254
+ ctx.namespaceContext = elementNamespace;
25255
+ }
24244
25256
  const pathStatements = [];
24245
25257
  for (const binding of bindings) {
24246
25258
  resolveHIRBindingPath(binding.path, nodeCache, pathStatements, ctx);
@@ -24255,23 +25267,17 @@ function lowerIntrinsicElement(jsx, ctx) {
24255
25267
  const hirDataBinding = isDelegated && binding.expr ? extractDelegatedEventDataFromHIR(binding.expr, ctx) : null;
24256
25268
  if (hirDataBinding) {
24257
25269
  ctx.delegatedEventsUsed?.add(eventName);
24258
- const handlerExpr = lowerExpression(hirDataBinding.handler, ctx);
25270
+ const handlerExpr = hirDataBinding.handler.kind === "Identifier" ? t4.identifier(hirDataBinding.handler.name) : lowerExpression(hirDataBinding.handler, ctx);
24259
25271
  const dataExpr = lowerDomExpression(hirDataBinding.data, ctx, containingRegion, {
24260
25272
  skipHookAccessors: false,
24261
25273
  skipRegionRootOverride: true
24262
25274
  });
24263
- const dataParam = t4.identifier("__data");
24264
- const eventParam = t4.identifier("_e");
24265
- const wrappedHandler = t4.arrowFunctionExpression(
24266
- [dataParam, eventParam],
24267
- t4.callExpression(handlerExpr, [dataParam])
24268
- );
24269
25275
  statements.push(
24270
25276
  t4.expressionStatement(
24271
25277
  t4.assignmentExpression(
24272
25278
  "=",
24273
25279
  t4.memberExpression(targetId, t4.identifier(`$$${eventName}`)),
24274
- wrappedHandler
25280
+ handlerExpr
24275
25281
  )
24276
25282
  )
24277
25283
  );
@@ -24305,16 +25311,54 @@ function lowerIntrinsicElement(jsx, ctx) {
24305
25311
  if (fn.params.length > 0) return fn;
24306
25312
  return t4.functionExpression(fn.id, [eventParam], fn.body, fn.generator, fn.async);
24307
25313
  }
24308
- return t4.arrowFunctionExpression(
25314
+ if (t4.isIdentifier(fn) || t4.isMemberExpression(fn)) {
25315
+ return fn;
25316
+ }
25317
+ if (t4.isCallExpression(fn) && fn.arguments.length === 0 && (t4.isIdentifier(fn.callee) || t4.isMemberExpression(fn.callee))) {
25318
+ return fn.callee;
25319
+ }
25320
+ return t4.functionExpression(
25321
+ null,
24309
25322
  [eventParam],
24310
- t4.callExpression(fn, [eventParam])
25323
+ t4.blockStatement([
25324
+ t4.returnStatement(
25325
+ t4.callExpression(
25326
+ t4.memberExpression(fn, t4.identifier("call")),
25327
+ [t4.thisExpression(), eventParam]
25328
+ )
25329
+ )
25330
+ ])
24311
25331
  );
24312
25332
  };
24313
25333
  const handlerExpr = !isFn && shouldWrapHandler ? t4.arrowFunctionExpression([], valueExpr) : ensureHandlerParam(valueExpr);
24314
- const dataBinding = isDelegated && !shouldWrapHandler ? extractDelegatedEventData(valueExpr, t4) : null;
25334
+ let dataBinding = isDelegated && !shouldWrapHandler ? extractDelegatedEventData(valueExpr, t4) : null;
25335
+ if (dataBinding && t4.isIdentifier(dataBinding.handler)) {
25336
+ const handlerName = dataBinding.handler.name;
25337
+ if (ctx.signalVars?.has(handlerName) || ctx.memoVars?.has(handlerName) || ctx.aliasVars?.has(handlerName) || ctx.storeVars?.has(handlerName) || ctx.trackedVars.has(handlerName)) {
25338
+ dataBinding = null;
25339
+ }
25340
+ }
24315
25341
  if (isDelegated) {
24316
25342
  ctx.delegatedEventsUsed?.add(eventName);
24317
- const finalHandler = !isFn && shouldWrapHandler ? t4.arrowFunctionExpression([eventParam], t4.callExpression(valueExpr, [eventParam])) : handlerExpr;
25343
+ let handlerName = null;
25344
+ if (t4.isIdentifier(valueExpr)) {
25345
+ handlerName = valueExpr.name;
25346
+ } else if (t4.isCallExpression(valueExpr) && valueExpr.arguments.length === 0 && t4.isIdentifier(valueExpr.callee)) {
25347
+ handlerName = valueExpr.callee.name;
25348
+ }
25349
+ const handlerForCall = handlerName ? t4.identifier(handlerName) : t4.cloneNode(valueExpr, true);
25350
+ const finalHandler = !isFn && shouldWrapHandler ? t4.functionExpression(
25351
+ null,
25352
+ [eventParam],
25353
+ t4.blockStatement([
25354
+ t4.returnStatement(
25355
+ t4.callExpression(t4.memberExpression(handlerForCall, t4.identifier("call")), [
25356
+ t4.thisExpression(),
25357
+ eventParam
25358
+ ])
25359
+ )
25360
+ ])
25361
+ ) : handlerExpr;
24318
25362
  const normalizeHandler = (expr) => {
24319
25363
  if (t4.isCallExpression(expr) && (t4.isIdentifier(expr.callee) || t4.isMemberExpression(expr.callee))) {
24320
25364
  return expr.callee;
@@ -24327,19 +25371,7 @@ function lowerIntrinsicElement(jsx, ctx) {
24327
25371
  const dataForDelegate = dataBinding?.data && (t4.isArrowFunctionExpression(dataBinding.data) || t4.isFunctionExpression(dataBinding.data) ? dataBinding.data : t4.arrowFunctionExpression([], dataBinding.data));
24328
25372
  const handlerForDelegate = normalizedDataHandler ?? (dataBinding ? normalizeHandler(handlerExpr) : finalHandler);
24329
25373
  const handlerIsCallableExpr = t4.isArrowFunctionExpression(handlerForDelegate) || t4.isFunctionExpression(handlerForDelegate) || t4.isIdentifier(handlerForDelegate) || t4.isMemberExpression(handlerForDelegate);
24330
- let handlerToAssign = handlerIsCallableExpr ? handlerForDelegate : t4.arrowFunctionExpression([eventParam], handlerForDelegate);
24331
- if (dataForDelegate) {
24332
- let payloadExpr;
24333
- if (t4.isArrowFunctionExpression(dataForDelegate) && dataForDelegate.params.length === 0) {
24334
- payloadExpr = t4.isBlockStatement(dataForDelegate.body) ? t4.callExpression(t4.arrowFunctionExpression([], dataForDelegate.body), []) : dataForDelegate.body;
24335
- } else {
24336
- payloadExpr = t4.callExpression(dataForDelegate, []);
24337
- }
24338
- handlerToAssign = t4.arrowFunctionExpression(
24339
- [eventParam],
24340
- t4.callExpression(handlerForDelegate, [payloadExpr])
24341
- );
24342
- }
25374
+ const handlerToAssign = handlerIsCallableExpr ? handlerForDelegate : t4.arrowFunctionExpression([eventParam], handlerForDelegate);
24343
25375
  statements.push(
24344
25376
  t4.expressionStatement(
24345
25377
  t4.assignmentExpression(
@@ -24478,10 +25510,18 @@ function lowerIntrinsicElement(jsx, ctx) {
24478
25510
  );
24479
25511
  }
24480
25512
  } else if (binding.type === "child" && binding.expr) {
24481
- emitHIRChildBinding(targetId, binding.expr, statements, ctx, containingRegion);
25513
+ emitHIRChildBinding(
25514
+ targetId,
25515
+ binding.expr,
25516
+ statements,
25517
+ ctx,
25518
+ containingRegion,
25519
+ binding.namespace
25520
+ );
24482
25521
  }
24483
25522
  }
24484
25523
  applyRegionToContext(ctx, prevRegion ?? null);
25524
+ ctx.namespaceContext = prevNamespace;
24485
25525
  statements.push(t4.returnStatement(elId));
24486
25526
  const body = t4.blockStatement(statements);
24487
25527
  if (shouldMemo && containingRegion) {
@@ -24500,11 +25540,11 @@ function lowerIntrinsicElement(jsx, ctx) {
24500
25540
  }
24501
25541
  return t4.callExpression(t4.arrowFunctionExpression([], body), []);
24502
25542
  }
24503
- function resolveHIRBindingPath(path, cache, statements, ctx) {
24504
- const key = path.join(",");
25543
+ function resolveHIRBindingPath(path2, cache, statements, ctx) {
25544
+ const key = path2.join(",");
24505
25545
  if (cache.has(key)) return cache.get(key);
24506
25546
  const { t: t4 } = ctx;
24507
- const ancestorPath = [...path];
25547
+ const ancestorPath = [...path2];
24508
25548
  let ancestorId;
24509
25549
  let relativePath = [];
24510
25550
  while (ancestorPath.length > 0) {
@@ -24512,13 +25552,13 @@ function resolveHIRBindingPath(path, cache, statements, ctx) {
24512
25552
  const ancestorKey = ancestorPath.join(",");
24513
25553
  if (cache.has(ancestorKey)) {
24514
25554
  ancestorId = cache.get(ancestorKey);
24515
- relativePath = path.slice(ancestorPath.length);
25555
+ relativePath = path2.slice(ancestorPath.length);
24516
25556
  break;
24517
25557
  }
24518
25558
  }
24519
25559
  if (!ancestorId) {
24520
25560
  ancestorId = cache.get("");
24521
- relativePath = path;
25561
+ relativePath = path2;
24522
25562
  }
24523
25563
  let currentExpr = ancestorId;
24524
25564
  for (const index of relativePath) {
@@ -24532,9 +25572,12 @@ function resolveHIRBindingPath(path, cache, statements, ctx) {
24532
25572
  cache.set(key, varId);
24533
25573
  return varId;
24534
25574
  }
24535
- function emitHIRChildBinding(markerId, expr, statements, ctx, containingRegion) {
25575
+ function emitHIRChildBinding(markerId, expr, statements, ctx, containingRegion, namespace) {
24536
25576
  const { t: t4 } = ctx;
24537
25577
  const parentId = t4.memberExpression(markerId, t4.identifier("parentNode"));
25578
+ if (namespace !== void 0) {
25579
+ ctx.namespaceContext = namespace;
25580
+ }
24538
25581
  if (expr.kind === "CallExpression" && expr.callee.kind === "Identifier" && expr.callee.name === "createPortal") {
24539
25582
  ctx.helpersUsed.add("onDestroy");
24540
25583
  const portalId = genTemp(ctx, "portal");
@@ -24756,7 +25799,7 @@ function extractDelegatedEventData(expr, t4) {
24756
25799
  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;
24757
25800
  if (!bodyExpr || !t4.isCallExpression(bodyExpr)) return null;
24758
25801
  if (paramNames.some((name) => expressionUsesIdentifier(bodyExpr, name, t4))) return null;
24759
- if (!t4.isIdentifier(bodyExpr.callee) && !t4.isMemberExpression(bodyExpr.callee)) return null;
25802
+ if (!t4.isIdentifier(bodyExpr.callee)) return null;
24760
25803
  if (bodyExpr.arguments.length === 0) return null;
24761
25804
  if (bodyExpr.arguments.length > 1) return null;
24762
25805
  const dataArg = bodyExpr.arguments[0];
@@ -24782,12 +25825,16 @@ function extractDelegatedEventDataFromHIR(expr, ctx) {
24782
25825
  if (callee.kind !== "Identifier") {
24783
25826
  return null;
24784
25827
  }
25828
+ const handlerName = callee.name;
25829
+ if (ctx.signalVars?.has(handlerName) || ctx.memoVars?.has(handlerName) || ctx.aliasVars?.has(handlerName) || ctx.storeVars?.has(handlerName) || ctx.trackedVars.has(handlerName)) {
25830
+ return null;
25831
+ }
24785
25832
  if (bodyExpr.arguments.length !== 1) {
24786
25833
  return null;
24787
25834
  }
24788
25835
  if (callee.kind === "Identifier") {
24789
- const handlerName = deSSAVarName(callee.name);
24790
- const isTrackedAccessor = ctx.signalVars?.has(handlerName) || ctx.memoVars?.has(handlerName) || ctx.aliasVars?.has(handlerName);
25836
+ const handlerName2 = deSSAVarName(callee.name);
25837
+ const isTrackedAccessor = ctx.signalVars?.has(handlerName2) || ctx.memoVars?.has(handlerName2) || ctx.aliasVars?.has(handlerName2);
24791
25838
  if (isTrackedAccessor) {
24792
25839
  return null;
24793
25840
  }
@@ -25326,18 +26373,26 @@ function lowerHIRWithRegions(program, t4, options, macroAliases) {
25326
26373
  const emittedFunctionNames = /* @__PURE__ */ new Set();
25327
26374
  const originalBody = program.originalBody ?? [];
25328
26375
  ctx.moduleDeclaredNames = collectDeclaredNames(originalBody, t4);
25329
- ctx.moduleRuntimeNames = collectRuntimeImportNames(originalBody, t4);
26376
+ const runtimeImports = collectRuntimeImports(originalBody, t4);
26377
+ ctx.moduleRuntimeNames = runtimeImports.names;
26378
+ ctx.moduleRuntimeImportMap = runtimeImports.importMap;
26379
+ ctx.moduleRuntimeNamespaceImports = runtimeImports.namespaces;
26380
+ applyImportedReactiveMetadata(originalBody, ctx, t4, options);
25330
26381
  const stateMacroNames = /* @__PURE__ */ new Set(["$state", ...macroAliases?.state ?? []]);
25331
26382
  const memoMacroNames = new Set(macroAliases?.memo ?? ctx.memoMacroNames ?? []);
25332
26383
  if (!memoMacroNames.has("$memo")) memoMacroNames.add("$memo");
25333
26384
  if (!memoMacroNames.has("createMemo")) memoMacroNames.add("createMemo");
26385
+ ctx.stateMacroNames = stateMacroNames;
25334
26386
  ctx.memoMacroNames = memoMacroNames;
25335
26387
  for (const stmt of originalBody) {
25336
26388
  if (t4.isVariableDeclaration(stmt)) {
25337
26389
  for (const decl of stmt.declarations) {
25338
- 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")) {
25339
- ctx.trackedVars.add(decl.id.name);
25340
- if (decl.init.callee.name === "$store") {
26390
+ if (t4.isIdentifier(decl.id) && decl.init && (t4.isCallExpression(decl.init) || t4.isOptionalCallExpression(decl.init))) {
26391
+ const callKind = getReactiveCallKindFromBabel(decl.init, ctx, t4);
26392
+ if (callKind === "signal") {
26393
+ ctx.trackedVars.add(decl.id.name);
26394
+ } else if (callKind === "store") {
26395
+ ctx.trackedVars.add(decl.id.name);
25341
26396
  ctx.storeVars?.add(decl.id.name);
25342
26397
  }
25343
26398
  }
@@ -25566,13 +26621,20 @@ function lowerHIRWithRegions(program, t4, options, macroAliases) {
25566
26621
  ctx.helpersUsed.add("popContext");
25567
26622
  body.push(t4.expressionStatement(t4.callExpression(t4.identifier(RUNTIME_ALIASES.popContext), [])));
25568
26623
  }
26624
+ const moduleMeta = buildModuleReactiveMetadata(originalBody, ctx, t4, options);
26625
+ setModuleMetadata(options?.filename, moduleMeta, options);
25569
26626
  return t4.file(t4.program(attachHelperImports(ctx, body, t4)));
25570
26627
  }
25571
26628
  function lowerTopLevelStatementBlock(statements, ctx, t4, name = "__module_segment", existingAliases) {
25572
26629
  if (statements.length === 0) return { statements: [], aliases: /* @__PURE__ */ new Set() };
25573
- const fn = convertStatementsToHIRFunction(name, statements);
26630
+ const reactiveScopes = ctx.options?.reactiveScopes;
26631
+ const fn = convertStatementsToHIRFunction(
26632
+ name,
26633
+ statements,
26634
+ reactiveScopes && reactiveScopes.length > 0 ? { reactiveScopes: new Set(reactiveScopes) } : void 0
26635
+ );
25574
26636
  const scopeResult = analyzeReactiveScopesWithSSA(fn);
25575
- detectDerivedCycles(fn, scopeResult);
26637
+ detectDerivedCycles(fn, scopeResult, ctx);
25576
26638
  ctx.scopes = scopeResult;
25577
26639
  const regionResult = generateRegions(fn, scopeResult);
25578
26640
  ctx.regions = flattenRegions(regionResult.topLevelRegions);
@@ -25584,10 +26646,12 @@ function lowerTopLevelStatementBlock(statements, ctx, t4, name = "__module_segme
25584
26646
  const functionVars = ctx.functionVars ?? /* @__PURE__ */ new Set();
25585
26647
  const signalVars = ctx.signalVars ?? /* @__PURE__ */ new Set();
25586
26648
  const storeVars = ctx.storeVars ?? /* @__PURE__ */ new Set();
26649
+ const memoVars = ctx.memoVars ?? /* @__PURE__ */ new Set();
25587
26650
  const mutatedVars = /* @__PURE__ */ new Set();
25588
26651
  ctx.functionVars = functionVars;
25589
26652
  ctx.signalVars = signalVars;
25590
26653
  ctx.storeVars = storeVars;
26654
+ ctx.memoVars = memoVars;
25591
26655
  ctx.mutatedVars = mutatedVars;
25592
26656
  for (const block of fn.blocks) {
25593
26657
  for (const instr of block.instructions) {
@@ -25596,11 +26660,14 @@ function lowerTopLevelStatementBlock(statements, ctx, t4, name = "__module_segme
25596
26660
  if (instr.value.kind === "ArrowFunction" || instr.value.kind === "FunctionExpression") {
25597
26661
  functionVars.add(target);
25598
26662
  }
25599
- if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier") {
25600
- if (instr.value.callee.name === "$state") {
26663
+ if (instr.value.kind === "CallExpression" || instr.value.kind === "OptionalCallExpression") {
26664
+ const callKind = getReactiveCallKind(instr.value, ctx);
26665
+ if (callKind === "signal") {
25601
26666
  signalVars.add(target);
25602
- } else if (instr.value.callee.name === "$store") {
26667
+ } else if (callKind === "store") {
25603
26668
  storeVars.add(target);
26669
+ } else if (callKind === "memo") {
26670
+ memoVars.add(target);
25604
26671
  }
25605
26672
  }
25606
26673
  if (!instr.declarationKind) {
@@ -25717,7 +26784,7 @@ function transformControlFlowReturns(statements, ctx) {
25717
26784
  }
25718
26785
  return null;
25719
26786
  }
25720
- function lowerFunctionWithRegions(fn, ctx) {
26787
+ function lowerFunctionWithRegions(fn, ctx, options) {
25721
26788
  const { t: t4 } = ctx;
25722
26789
  const prevTracked = ctx.trackedVars;
25723
26790
  const prevSignalVars = ctx.signalVars;
@@ -25776,8 +26843,15 @@ function lowerFunctionWithRegions(fn, ctx) {
25776
26843
  if (instr.value.kind === "ArrowFunction" || instr.value.kind === "FunctionExpression") {
25777
26844
  ctx.functionVars?.add(target);
25778
26845
  }
25779
- if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$state") {
25780
- ctx.signalVars?.add(target);
26846
+ if (instr.value.kind === "CallExpression" || instr.value.kind === "OptionalCallExpression") {
26847
+ const callKind = getReactiveCallKind(instr.value, ctx);
26848
+ if (callKind === "signal") {
26849
+ ctx.signalVars?.add(target);
26850
+ } else if (callKind === "store") {
26851
+ ctx.storeVars?.add(target);
26852
+ } else if (callKind === "memo") {
26853
+ ctx.memoVars?.add(target);
26854
+ }
25781
26855
  }
25782
26856
  if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && isHookName(instr.value.callee.name)) {
25783
26857
  hookResultVars.add(target);
@@ -25786,9 +26860,6 @@ function lowerFunctionWithRegions(fn, ctx) {
25786
26860
  if (instr.value.kind === "MemberExpression" && instr.value.object.kind === "Identifier" && hookResultVars.has(deSSAVarName(instr.value.object.name))) {
25787
26861
  hookAccessorAliases.add(target);
25788
26862
  }
25789
- if (instr.value.kind === "CallExpression" && instr.value.callee.kind === "Identifier" && instr.value.callee.name === "$store") {
25790
- ctx.storeVars?.add(target);
25791
- }
25792
26863
  if (!instr.declarationKind) {
25793
26864
  ctx.mutatedVars?.add(target);
25794
26865
  }
@@ -25801,15 +26872,18 @@ function lowerFunctionWithRegions(fn, ctx) {
25801
26872
  ctx.aliasVars?.add(name);
25802
26873
  ctx.trackedVars.add(name);
25803
26874
  });
25804
- const inferredHook = isHookLikeFunction(fn);
26875
+ const inferredHook = options?.forceHookContext ? true : isHookLikeFunction(fn);
25805
26876
  const scopeResult = analyzeReactiveScopesWithSSA(fn);
25806
- detectDerivedCycles(fn, scopeResult);
26877
+ detectDerivedCycles(fn, scopeResult, ctx);
25807
26878
  ctx.scopes = scopeResult;
25808
26879
  const regionResult = generateRegions(fn, scopeResult);
25809
26880
  const prevHookFlag = ctx.currentFnIsHook;
25810
26881
  ctx.currentFnIsHook = inferredHook;
25811
26882
  const isComponent = !!(fn.name && fn.name[0] === fn.name[0]?.toUpperCase());
25812
26883
  ctx.isComponentFn = isComponent;
26884
+ if (!isComponent && !inferredHook) {
26885
+ ctx.inModule = true;
26886
+ }
25813
26887
  const rawPropsParam = fn.params.length === 1 && fn.params[0] ? deSSAVarName(fn.params[0].name) : void 0;
25814
26888
  if (isComponent && rawPropsParam) {
25815
26889
  ctx.propsParamName = rawPropsParam;
@@ -26046,7 +27120,7 @@ function lowerFunctionWithRegions(fn, ctx) {
26046
27120
  if (!hasComplexControlFlow && !isAsync) {
26047
27121
  const pureDeclaredVars = /* @__PURE__ */ new Set();
26048
27122
  const pureStatements = lowerStructuredNodeWithoutRegions(structured, t4, ctx, pureDeclaredVars);
26049
- const params2 = fn.params.map((p) => t4.identifier(deSSAVarName(p.name)));
27123
+ const params2 = buildOutputParams(fn, t4);
26050
27124
  const funcDecl2 = setNodeLoc(
26051
27125
  t4.functionDeclaration(
26052
27126
  t4.identifier(fn.name ?? "fn"),
@@ -26121,13 +27195,31 @@ function lowerFunctionWithRegions(fn, ctx) {
26121
27195
  )
26122
27196
  );
26123
27197
  }
26124
- let finalParams = fn.params.map((p) => t4.identifier(deSSAVarName(p.name)));
27198
+ let finalParams = buildOutputParams(fn, t4);
26125
27199
  const propsDestructuring = [];
26126
27200
  if (isComponent && fn.rawParams && fn.rawParams.length === 1) {
26127
27201
  const rawParam = fn.rawParams[0];
26128
27202
  if (rawParam && (rawParam.type === "ObjectPattern" || rawParam.type === "AssignmentPattern" && rawParam.left?.type === "ObjectPattern")) {
26129
- finalParams = [t4.identifier("__props")];
26130
27203
  const pattern = rawParam.type === "AssignmentPattern" ? rawParam.left : rawParam;
27204
+ const defaultExpr = rawParam.type === "AssignmentPattern" ? rawParam.right : null;
27205
+ if (defaultExpr) {
27206
+ const propsParamName = "__propsParam";
27207
+ finalParams = [t4.identifier(propsParamName)];
27208
+ propsDestructuring.push(
27209
+ t4.variableDeclaration("const", [
27210
+ t4.variableDeclarator(
27211
+ t4.identifier("__props"),
27212
+ t4.conditionalExpression(
27213
+ t4.binaryExpression("===", t4.identifier(propsParamName), t4.identifier("undefined")),
27214
+ t4.cloneNode(defaultExpr, true),
27215
+ t4.identifier(propsParamName)
27216
+ )
27217
+ )
27218
+ ])
27219
+ );
27220
+ } else {
27221
+ finalParams = [t4.identifier("__props")];
27222
+ }
26131
27223
  if (propsDestructurePlan) {
26132
27224
  if (propsDestructurePlan.usesProp) {
26133
27225
  ctx.helpersUsed.add("prop");
@@ -26285,7 +27377,7 @@ function optimizeHIR(program, options = {}) {
26285
27377
  originalBody: []
26286
27378
  });
26287
27379
  const ssaFn = ssaProgram.functions[0];
26288
- return ssaFn ? optimizeSSAFunction(ssaFn) : fn;
27380
+ return ssaFn ? optimizeSSAFunction(ssaFn, options) : fn;
26289
27381
  }
26290
27382
  if (isReactiveOptimizationCandidate(fn)) {
26291
27383
  return optimizeReactiveFunction(fn, exportedNames, options);
@@ -26297,9 +27389,9 @@ function optimizeHIR(program, options = {}) {
26297
27389
  functions
26298
27390
  };
26299
27391
  }
26300
- function optimizeSSAFunction(fn) {
27392
+ function optimizeSSAFunction(fn, options) {
26301
27393
  let current = fn;
26302
- current = propagateConstants(current);
27394
+ current = propagateConstants(current, options);
26303
27395
  const purity = buildPurityContext(current);
26304
27396
  current = eliminateCommonSubexpressions(current, purity);
26305
27397
  current = inlineSingleUse(current, purity);
@@ -26924,7 +28016,9 @@ function optimizeReactiveFunction(fn, exportedNames, options) {
26924
28016
  const reactive = buildReactiveContext(fn);
26925
28017
  const purity = buildPurityContext(fn);
26926
28018
  const hookLike = isHookLikeFunction(fn);
26927
- const transformedBlocks = fn.blocks.map((block) => optimizeReactiveBlock(block, reactive, purity));
28019
+ const transformedBlocks = fn.blocks.map(
28020
+ (block) => optimizeReactiveBlock(block, reactive, purity, options)
28021
+ );
26928
28022
  let transformed = { ...fn, blocks: transformedBlocks };
26929
28023
  if (isCrossBlockConstPropagationEnabled()) {
26930
28024
  transformed = propagateCrossBlockConstants(transformed, reactive, purity, scopeResult);
@@ -26959,7 +28053,7 @@ function optimizeReactiveFunction(fn, exportedNames, options) {
26959
28053
  });
26960
28054
  return { ...transformed, blocks };
26961
28055
  }
26962
- function optimizeReactiveBlock(block, reactive, purity) {
28056
+ function optimizeReactiveBlock(block, reactive, purity, options) {
26963
28057
  const constants = /* @__PURE__ */ new Map();
26964
28058
  const constObjects = /* @__PURE__ */ new Map();
26965
28059
  const constArrays = /* @__PURE__ */ new Map();
@@ -26997,7 +28091,7 @@ function optimizeReactiveBlock(block, reactive, purity) {
26997
28091
  constArrays.delete(name);
26998
28092
  }
26999
28093
  const dependsOnReactiveValue = expressionDependsOnReactive(instr.value, reactive);
27000
- let value = dependsOnReactiveValue ? instr.value : foldExpressionWithConstants(instr.value, constants, constObjects, constArrays);
28094
+ let value = dependsOnReactiveValue ? instr.value : foldExpressionWithConstants(instr.value, constants, options, constObjects, constArrays);
27001
28095
  const allowCSE = isCompilerGeneratedName(target) && (!declKind || declKind === "const");
27002
28096
  if (allowCSE && isPureExpression(value, purity) && !isExplicitMemoCall(value, purity) && !dependsOnReactiveValue && isCSESafeExpression(value, purity)) {
27003
28097
  const deps = collectExpressionIdentifiers2(value, true);
@@ -27045,7 +28139,7 @@ function optimizeReactiveBlock(block, reactive, purity) {
27045
28139
  constArrays.delete(name);
27046
28140
  }
27047
28141
  const dependsOnReactiveValue = expressionDependsOnReactive(instr.value, reactive);
27048
- const value = dependsOnReactiveValue ? instr.value : foldExpressionWithConstants(instr.value, constants, constObjects, constArrays);
28142
+ const value = dependsOnReactiveValue ? instr.value : foldExpressionWithConstants(instr.value, constants, options, constObjects, constArrays);
27049
28143
  instructions.push(value === instr.value ? instr : { ...instr, value });
27050
28144
  continue;
27051
28145
  }
@@ -27054,6 +28148,7 @@ function optimizeReactiveBlock(block, reactive, purity) {
27054
28148
  const terminator = foldTerminatorWithConstants(
27055
28149
  block.terminator,
27056
28150
  constants,
28151
+ options,
27057
28152
  reactive,
27058
28153
  constObjects,
27059
28154
  constArrays
@@ -27985,7 +29080,7 @@ function blocksContainImpureMarkers(blocks) {
27985
29080
  }
27986
29081
  return false;
27987
29082
  }
27988
- function propagateConstants(fn) {
29083
+ function propagateConstants(fn, options) {
27989
29084
  const constants = computeConstantMap(fn);
27990
29085
  if (constants.size === 0) return fn;
27991
29086
  const blocks = fn.blocks.map((block) => ({
@@ -27993,12 +29088,12 @@ function propagateConstants(fn) {
27993
29088
  instructions: block.instructions.map((instr) => {
27994
29089
  if (instr.kind === "Assign") {
27995
29090
  const replaced = replaceIdentifiersWithConstants(instr.value, constants);
27996
- const folded = foldExpression(replaced, constants);
29091
+ const folded = foldExpression(replaced, constants, options);
27997
29092
  return { ...instr, value: folded };
27998
29093
  }
27999
29094
  if (instr.kind === "Expression") {
28000
29095
  const replaced = replaceIdentifiersWithConstants(instr.value, constants);
28001
- const folded = foldExpression(replaced, constants);
29096
+ const folded = foldExpression(replaced, constants, options);
28002
29097
  return { ...instr, value: folded };
28003
29098
  }
28004
29099
  if (instr.kind === "Phi") {
@@ -28398,15 +29493,18 @@ function evaluateBinary(operator, left, right) {
28398
29493
  return UNKNOWN_CONST;
28399
29494
  }
28400
29495
  }
28401
- function foldExpression(expr, constants) {
29496
+ function foldExpression(expr, constants, options) {
28402
29497
  const value = evaluateConstant(expr, constants);
28403
29498
  if (value === UNKNOWN_CONST) {
28404
- return simplifyAlgebraically(expr, constants);
29499
+ return simplifyAlgebraically(expr, constants, options);
28405
29500
  }
28406
29501
  return { kind: "Literal", value, loc: expr.loc };
28407
29502
  }
28408
- function simplifyAlgebraically(expr, constants) {
28409
- const simplified = simplifyChildren(expr, constants);
29503
+ function simplifyAlgebraically(expr, constants, options) {
29504
+ const simplified = simplifyChildren(expr, constants, options);
29505
+ if (options.optimizeLevel === "safe") {
29506
+ return simplified;
29507
+ }
28410
29508
  if (simplified.kind === "BinaryExpression") {
28411
29509
  const { operator, left, right, loc } = simplified;
28412
29510
  switch (operator) {
@@ -28485,37 +29583,37 @@ function simplifyAlgebraically(expr, constants) {
28485
29583
  }
28486
29584
  return simplified;
28487
29585
  }
28488
- function simplifyChildren(expr, constants) {
29586
+ function simplifyChildren(expr, constants, options) {
28489
29587
  switch (expr.kind) {
28490
29588
  case "BinaryExpression":
28491
29589
  return {
28492
29590
  ...expr,
28493
- left: simplifyAlgebraically(expr.left, constants),
28494
- right: simplifyAlgebraically(expr.right, constants)
29591
+ left: simplifyAlgebraically(expr.left, constants, options),
29592
+ right: simplifyAlgebraically(expr.right, constants, options)
28495
29593
  };
28496
29594
  case "LogicalExpression":
28497
29595
  return {
28498
29596
  ...expr,
28499
- left: simplifyAlgebraically(expr.left, constants),
28500
- right: simplifyAlgebraically(expr.right, constants)
29597
+ left: simplifyAlgebraically(expr.left, constants, options),
29598
+ right: simplifyAlgebraically(expr.right, constants, options)
28501
29599
  };
28502
29600
  case "UnaryExpression":
28503
29601
  return {
28504
29602
  ...expr,
28505
- argument: simplifyAlgebraically(expr.argument, constants)
29603
+ argument: simplifyAlgebraically(expr.argument, constants, options)
28506
29604
  };
28507
29605
  case "ConditionalExpression":
28508
29606
  return {
28509
29607
  ...expr,
28510
- test: simplifyAlgebraically(expr.test, constants),
28511
- consequent: simplifyAlgebraically(expr.consequent, constants),
28512
- alternate: simplifyAlgebraically(expr.alternate, constants)
29608
+ test: simplifyAlgebraically(expr.test, constants, options),
29609
+ consequent: simplifyAlgebraically(expr.consequent, constants, options),
29610
+ alternate: simplifyAlgebraically(expr.alternate, constants, options)
28513
29611
  };
28514
29612
  case "ArrayExpression":
28515
29613
  return {
28516
29614
  ...expr,
28517
29615
  elements: expr.elements.map(
28518
- (el) => el ? simplifyAlgebraically(el, constants) : el
29616
+ (el) => el ? simplifyAlgebraically(el, constants, options) : el
28519
29617
  )
28520
29618
  };
28521
29619
  case "ObjectExpression":
@@ -28525,13 +29623,13 @@ function simplifyChildren(expr, constants) {
28525
29623
  if (prop.kind === "Property") {
28526
29624
  return {
28527
29625
  ...prop,
28528
- value: simplifyAlgebraically(prop.value, constants)
29626
+ value: simplifyAlgebraically(prop.value, constants, options)
28529
29627
  };
28530
29628
  }
28531
29629
  if (prop.kind === "SpreadElement") {
28532
29630
  return {
28533
29631
  ...prop,
28534
- argument: simplifyAlgebraically(prop.argument, constants)
29632
+ argument: simplifyAlgebraically(prop.argument, constants, options)
28535
29633
  };
28536
29634
  }
28537
29635
  return prop;
@@ -28541,35 +29639,35 @@ function simplifyChildren(expr, constants) {
28541
29639
  case "OptionalCallExpression":
28542
29640
  return {
28543
29641
  ...expr,
28544
- arguments: expr.arguments.map((arg) => simplifyAlgebraically(arg, constants))
29642
+ arguments: expr.arguments.map((arg) => simplifyAlgebraically(arg, constants, options))
28545
29643
  };
28546
29644
  case "ImportExpression":
28547
29645
  return {
28548
29646
  ...expr,
28549
- source: simplifyAlgebraically(expr.source, constants)
29647
+ source: simplifyAlgebraically(expr.source, constants, options)
28550
29648
  };
28551
29649
  case "MemberExpression":
28552
29650
  case "OptionalMemberExpression":
28553
29651
  return {
28554
29652
  ...expr,
28555
- object: simplifyAlgebraically(expr.object, constants),
28556
- property: expr.computed ? simplifyAlgebraically(expr.property, constants) : expr.property
29653
+ object: simplifyAlgebraically(expr.object, constants, options),
29654
+ property: expr.computed ? simplifyAlgebraically(expr.property, constants, options) : expr.property
28557
29655
  };
28558
29656
  default:
28559
29657
  return expr;
28560
29658
  }
28561
29659
  }
28562
- function foldExpressionWithConstants(expr, constants, constObjects, constArrays) {
29660
+ function foldExpressionWithConstants(expr, constants, options, constObjects, constArrays) {
28563
29661
  const replaced = replaceIdentifiersWithConstants(expr, constants);
28564
29662
  if (!constObjects && !constArrays) {
28565
- return foldExpression(replaced, constants);
29663
+ return foldExpression(replaced, constants, options);
28566
29664
  }
28567
29665
  const memberReplaced = replaceConstMemberExpressions(
28568
29666
  replaced,
28569
29667
  constObjects ?? /* @__PURE__ */ new Map(),
28570
29668
  constArrays ?? /* @__PURE__ */ new Map()
28571
29669
  );
28572
- return foldExpression(memberReplaced, constants);
29670
+ return foldExpression(memberReplaced, constants, options);
28573
29671
  }
28574
29672
  function replaceIdentifiersWithConstants(expr, constants, context = {}) {
28575
29673
  switch (expr.kind) {
@@ -28731,10 +29829,10 @@ function replaceConstantsInTerminator(term, constants) {
28731
29829
  return term;
28732
29830
  }
28733
29831
  }
28734
- function foldTerminatorWithConstants(term, constants, reactive, constObjects, constArrays) {
29832
+ function foldTerminatorWithConstants(term, constants, options, reactive, constObjects, constArrays) {
28735
29833
  const fold = (expr) => {
28736
29834
  if (reactive && expressionDependsOnReactive(expr, reactive)) return expr;
28737
- return foldExpressionWithConstants(expr, constants, constObjects, constArrays);
29835
+ return foldExpressionWithConstants(expr, constants, options, constObjects, constArrays);
28738
29836
  };
28739
29837
  switch (term.kind) {
28740
29838
  case "Return":
@@ -28851,11 +29949,14 @@ function hasSideEffectsBetween(instructions, start, end, purity) {
28851
29949
  function eliminateDeadCode(fn, purity) {
28852
29950
  const depsByVar = buildDependencyGraph(fn);
28853
29951
  const live = computeLiveVariables(fn, depsByVar, purity);
29952
+ const baseLive = /* @__PURE__ */ new Set();
29953
+ live.forEach((name) => baseLive.add(getSSABaseName(name)));
28854
29954
  const blocks = fn.blocks.map((block) => {
28855
29955
  const instructions = block.instructions.filter((instr) => {
28856
29956
  if (instr.kind === "Assign") {
28857
29957
  const name = instr.target.name;
28858
29958
  if (live.has(name)) return true;
29959
+ if (instr.declarationKind && baseLive.has(getSSABaseName(name))) return true;
28859
29960
  return !isPureExpression(instr.value, purity) || isExplicitMemoCall(instr.value, purity);
28860
29961
  }
28861
29962
  if (instr.kind === "Phi") {
@@ -29867,8 +30968,8 @@ function getRootIdentifier(expr, t4) {
29867
30968
  }
29868
30969
 
29869
30970
  // src/index.ts
29870
- function stripMacroImports(path, t4) {
29871
- path.traverse({
30971
+ function stripMacroImports(path2, t4) {
30972
+ path2.traverse({
29872
30973
  ImportDeclaration(importPath) {
29873
30974
  if (importPath.node.source.value !== "fict" && importPath.node.source.value !== "fict/slim")
29874
30975
  return;
@@ -29886,30 +30987,18 @@ function stripMacroImports(path, t4) {
29886
30987
  }
29887
30988
  });
29888
30989
  }
29889
- function isInsideLoop(path) {
29890
- return !!path.findParent(
30990
+ function isInsideLoop(path2) {
30991
+ return !!path2.findParent(
29891
30992
  (p) => p.isForStatement?.() || p.isWhileStatement?.() || p.isDoWhileStatement?.() || p.isForInStatement?.() || p.isForOfStatement?.()
29892
30993
  );
29893
30994
  }
29894
- function isInsideConditional(path) {
29895
- return !!path.findParent(
30995
+ function isInsideConditional(path2) {
30996
+ return !!path2.findParent(
29896
30997
  (p) => p.isIfStatement?.() || p.isConditionalExpression?.() || p.isSwitchCase?.()
29897
30998
  );
29898
30999
  }
29899
- function isInsideNestedFunction(path) {
29900
- let depth = 0;
29901
- let current = path;
29902
- while (current) {
29903
- if (current.isFunction?.()) {
29904
- depth++;
29905
- if (depth > 1) return true;
29906
- }
29907
- current = current.parentPath;
29908
- }
29909
- return false;
29910
- }
29911
- function isInsideJSX(path) {
29912
- return !!path.findParent((p) => p.isJSXElement?.() || p.isJSXFragment?.());
31000
+ function isInsideJSX(path2) {
31001
+ return !!path2.findParent((p) => p.isJSXElement?.() || p.isJSXFragment?.());
29913
31002
  }
29914
31003
  function parseSuppressionCodes(raw) {
29915
31004
  if (!raw) return void 0;
@@ -29938,12 +31027,42 @@ function shouldSuppressWarning(suppressions, code, line) {
29938
31027
  return entry.codes.has(code);
29939
31028
  });
29940
31029
  }
29941
- function createWarningDispatcher(onWarn, suppressions) {
29942
- if (!onWarn) return () => {
31030
+ function hasErrorEscalation(options) {
31031
+ if (options.warningsAsErrors === true) return true;
31032
+ if (Array.isArray(options.warningsAsErrors) && options.warningsAsErrors.length > 0) return true;
31033
+ if (options.warningLevels) {
31034
+ return Object.values(options.warningLevels).some((level) => level === "error");
31035
+ }
31036
+ return false;
31037
+ }
31038
+ function resolveWarningLevel(code, options) {
31039
+ const override = options.warningLevels?.[code];
31040
+ if (override) return override;
31041
+ if (options.warningsAsErrors === true) return "error";
31042
+ if (Array.isArray(options.warningsAsErrors) && options.warningsAsErrors.includes(code)) {
31043
+ return "error";
31044
+ }
31045
+ return "warn";
31046
+ }
31047
+ function formatWarningAsError(warning) {
31048
+ const location = warning.line > 0 ? `${warning.fileName}:${warning.line}:${warning.column}` : warning.fileName;
31049
+ return `Fict warning treated as error (${warning.code}): ${warning.message}
31050
+ at ${location}`;
31051
+ }
31052
+ function createWarningDispatcher(onWarn, suppressions, options, dev) {
31053
+ const hasEscalation = hasErrorEscalation(options);
31054
+ if (!dev && !hasEscalation) return () => {
29943
31055
  };
29944
31056
  return (warning) => {
29945
31057
  if (shouldSuppressWarning(suppressions, warning.code, warning.line)) return;
29946
- onWarn(warning);
31058
+ const level = resolveWarningLevel(warning.code, options);
31059
+ if (level === "off") return;
31060
+ if (level === "error") {
31061
+ throw new Error(formatWarningAsError(warning));
31062
+ }
31063
+ if (dev && onWarn) {
31064
+ onWarn(warning);
31065
+ }
29947
31066
  };
29948
31067
  }
29949
31068
  function emitWarning(node, code, message, warn, fileName) {
@@ -30043,13 +31162,13 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30043
31162
  };
30044
31163
  const reactiveNames = /* @__PURE__ */ new Set([...stateVars, ...derivedVars]);
30045
31164
  programPath.traverse({
30046
- AssignmentExpression(path) {
30047
- const { left } = path.node;
31165
+ AssignmentExpression(path2) {
31166
+ const { left } = path2.node;
30048
31167
  if (t4.isIdentifier(left)) return;
30049
31168
  if (t4.isMemberExpression(left) || t4.isOptionalMemberExpression(left)) {
30050
31169
  if (isStateRoot(left.object)) {
30051
31170
  emitWarning(
30052
- path.node,
31171
+ path2.node,
30053
31172
  "FICT-M",
30054
31173
  "Direct mutation of nested property detected; use immutable update or $store helpers",
30055
31174
  warn,
@@ -30057,7 +31176,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30057
31176
  );
30058
31177
  if (isDynamicPropertyAccess(left, t4)) {
30059
31178
  emitWarning(
30060
- path.node,
31179
+ path2.node,
30061
31180
  "FICT-H",
30062
31181
  "Dynamic property access widens dependency tracking",
30063
31182
  warn,
@@ -30067,12 +31186,12 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30067
31186
  }
30068
31187
  }
30069
31188
  },
30070
- UpdateExpression(path) {
30071
- const arg = path.node.argument;
31189
+ UpdateExpression(path2) {
31190
+ const arg = path2.node.argument;
30072
31191
  if (t4.isMemberExpression(arg) || t4.isOptionalMemberExpression(arg)) {
30073
31192
  if (isStateRoot(arg.object)) {
30074
31193
  emitWarning(
30075
- path.node,
31194
+ path2.node,
30076
31195
  "FICT-M",
30077
31196
  "Direct mutation of nested property detected; use immutable update or $store helpers",
30078
31197
  warn,
@@ -30080,7 +31199,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30080
31199
  );
30081
31200
  if (isDynamicPropertyAccess(arg, t4)) {
30082
31201
  emitWarning(
30083
- path.node,
31202
+ path2.node,
30084
31203
  "FICT-H",
30085
31204
  "Dynamic property access widens dependency tracking",
30086
31205
  warn,
@@ -30090,13 +31209,13 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30090
31209
  }
30091
31210
  }
30092
31211
  },
30093
- MemberExpression(path) {
30094
- if (!path.node.computed) return;
30095
- if (path.parentPath.isAssignmentExpression({ left: path.node })) return;
30096
- if (path.parentPath.isUpdateExpression({ argument: path.node })) return;
30097
- if (isDynamicPropertyAccess(path.node, t4) && isStateRoot(path.node.object)) {
31212
+ MemberExpression(path2) {
31213
+ if (!path2.node.computed) return;
31214
+ if (path2.parentPath.isAssignmentExpression({ left: path2.node })) return;
31215
+ if (path2.parentPath.isUpdateExpression({ argument: path2.node })) return;
31216
+ if (isDynamicPropertyAccess(path2.node, t4) && isStateRoot(path2.node.object)) {
30098
31217
  emitWarning(
30099
- path.node,
31218
+ path2.node,
30100
31219
  "FICT-H",
30101
31220
  "Dynamic property access widens dependency tracking",
30102
31221
  warn,
@@ -30104,12 +31223,12 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30104
31223
  );
30105
31224
  }
30106
31225
  },
30107
- Function(path) {
31226
+ Function(path2) {
30108
31227
  const captured = /* @__PURE__ */ new Set();
30109
- path.traverse(
31228
+ path2.traverse(
30110
31229
  {
30111
31230
  Function(inner) {
30112
- if (inner === path) return;
31231
+ if (inner === path2) return;
30113
31232
  inner.skip();
30114
31233
  },
30115
31234
  Identifier(idPath) {
@@ -30117,7 +31236,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30117
31236
  if (!reactiveNames.has(name)) return;
30118
31237
  const binding = idPath.scope.getBinding(name);
30119
31238
  if (!binding) return;
30120
- if (binding.scope === idPath.scope || binding.scope === path.scope) return;
31239
+ if (binding.scope === idPath.scope || binding.scope === path2.scope) return;
30121
31240
  captured.add(name);
30122
31241
  }
30123
31242
  },
@@ -30125,7 +31244,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30125
31244
  );
30126
31245
  if (captured.size > 0) {
30127
31246
  emitWarning(
30128
- path.node,
31247
+ path2.node,
30129
31248
  "FICT-R005",
30130
31249
  `Function captures reactive variable(s): ${Array.from(captured).join(", ")}. Pass them as parameters or memoize explicitly to avoid hidden dependencies.`,
30131
31250
  warn,
@@ -30133,9 +31252,9 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30133
31252
  );
30134
31253
  }
30135
31254
  },
30136
- CallExpression(path) {
30137
- if (t4.isIdentifier(path.node.callee, { name: "$effect" })) {
30138
- const argPath = path.get("arguments.0");
31255
+ CallExpression(path2) {
31256
+ if (t4.isIdentifier(path2.node.callee, { name: "$effect" })) {
31257
+ const argPath = path2.get("arguments.0");
30139
31258
  if (argPath?.isFunctionExpression() || argPath?.isArrowFunctionExpression()) {
30140
31259
  let hasReactiveDependency = false;
30141
31260
  argPath.traverse({
@@ -30156,7 +31275,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30156
31275
  });
30157
31276
  if (!hasReactiveDependency) {
30158
31277
  emitWarning(
30159
- path.node,
31278
+ path2.node,
30160
31279
  "FICT-E001",
30161
31280
  "Effect has no reactive reads; it will run once. Consider removing $effect or adding dependencies.",
30162
31281
  warn,
@@ -30166,7 +31285,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30166
31285
  }
30167
31286
  return;
30168
31287
  }
30169
- const callee = path.node.callee;
31288
+ const callee = path2.node.callee;
30170
31289
  let calleeName = "";
30171
31290
  if (t4.isIdentifier(callee)) {
30172
31291
  calleeName = callee.name;
@@ -30178,7 +31297,7 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30178
31297
  }
30179
31298
  const isSafe = calleeName && SAFE_FUNCTIONS.has(calleeName);
30180
31299
  if (isSafe) return;
30181
- for (const arg of path.node.arguments) {
31300
+ for (const arg of path2.node.arguments) {
30182
31301
  if (!t4.isExpression(arg)) continue;
30183
31302
  if (isStateRoot(arg)) {
30184
31303
  emitWarning(
@@ -30192,13 +31311,13 @@ function runWarningPass(programPath, stateVars, derivedVars, warn, fileName, t4)
30192
31311
  }
30193
31312
  }
30194
31313
  },
30195
- OptionalMemberExpression(path) {
30196
- if (!path.node.computed) return;
30197
- if (path.parentPath.isAssignmentExpression({ left: path.node })) return;
30198
- if (path.parentPath.isUpdateExpression({ argument: path.node })) return;
30199
- if (isDynamicPropertyAccess(path.node, t4) && isStateRoot(path.node.object)) {
31314
+ OptionalMemberExpression(path2) {
31315
+ if (!path2.node.computed) return;
31316
+ if (path2.parentPath.isAssignmentExpression({ left: path2.node })) return;
31317
+ if (path2.parentPath.isUpdateExpression({ argument: path2.node })) return;
31318
+ if (isDynamicPropertyAccess(path2.node, t4) && isStateRoot(path2.node.object)) {
30200
31319
  emitWarning(
30201
- path.node,
31320
+ path2.node,
30202
31321
  "FICT-H",
30203
31322
  "Dynamic property access widens dependency tracking",
30204
31323
  warn,
@@ -30249,15 +31368,66 @@ function createHIREntrypointVisitor(t4, options) {
30249
31368
  };
30250
31369
  return {
30251
31370
  Program: {
30252
- exit(path) {
30253
- const fileName = path.hub?.file?.opts?.filename || "<unknown>";
30254
- const comments = path.hub?.file?.ast?.comments || [];
31371
+ exit(path2) {
31372
+ const fileName = path2.hub?.file?.opts?.filename || "<unknown>";
31373
+ const comments = path2.hub?.file?.ast?.comments || [];
30255
31374
  const suppressions = parseSuppressions(comments);
30256
31375
  const dev = options.dev !== false;
30257
- const warn = dev ? createWarningDispatcher(options.onWarn, suppressions) : () => {
31376
+ const warn = createWarningDispatcher(options.onWarn, suppressions, options, dev);
31377
+ const optionsWithWarnings = {
31378
+ ...options,
31379
+ onWarn: warn,
31380
+ filename: fileName
30258
31381
  };
30259
- const optionsWithWarnings = dev ? { ...options, onWarn: warn } : { ...options, onWarn: void 0 };
30260
31382
  const isHookName2 = (name) => !!name && /^use[A-Z]/.test(name);
31383
+ const reactiveScopesSet = new Set(options.reactiveScopes ?? []);
31384
+ const resolveReactiveScopeName = (callee) => {
31385
+ if (reactiveScopesSet.size === 0) return null;
31386
+ if (t4.isIdentifier(callee)) {
31387
+ return reactiveScopesSet.has(callee.name) ? callee.name : null;
31388
+ }
31389
+ if ((t4.isMemberExpression(callee) || t4.isOptionalMemberExpression(callee)) && !callee.computed && t4.isIdentifier(callee.property)) {
31390
+ return reactiveScopesSet.has(callee.property.name) ? callee.property.name : null;
31391
+ }
31392
+ return null;
31393
+ };
31394
+ const isReactiveScopeCallback = (fnPath) => {
31395
+ if (reactiveScopesSet.size === 0) return false;
31396
+ const parent = fnPath.parentPath;
31397
+ if (!parent || !(parent.isCallExpression() || parent.isOptionalCallExpression())) {
31398
+ return false;
31399
+ }
31400
+ if (parent.node.arguments[0] !== fnPath.node) return false;
31401
+ const callee = parent.node.callee;
31402
+ return !!resolveReactiveScopeName(callee);
31403
+ };
31404
+ const isReactiveScopeCallbackNode = (fnNode, parentNode) => {
31405
+ if (reactiveScopesSet.size === 0) return false;
31406
+ if (!parentNode) return false;
31407
+ if (!t4.isCallExpression(parentNode) && !t4.isOptionalCallExpression(parentNode)) {
31408
+ return false;
31409
+ }
31410
+ if (parentNode.arguments[0] !== fnNode) return false;
31411
+ return !!resolveReactiveScopeName(parentNode.callee);
31412
+ };
31413
+ const isInsideNestedFunctionWithReactiveScopes = (nodePath) => {
31414
+ let depth = 0;
31415
+ let current = nodePath;
31416
+ while (current) {
31417
+ if (current.isFunction?.()) {
31418
+ depth++;
31419
+ if (isReactiveScopeCallbackNode(
31420
+ current.node,
31421
+ current.parentPath?.node
31422
+ )) {
31423
+ return depth > 1;
31424
+ }
31425
+ if (depth > 1) return true;
31426
+ }
31427
+ current = current.parentPath;
31428
+ }
31429
+ return false;
31430
+ };
30261
31431
  const getFunctionName = (fnPath) => {
30262
31432
  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;
30263
31433
  };
@@ -30269,7 +31439,7 @@ function createHIREntrypointVisitor(t4, options) {
30269
31439
  const name = getFunctionName(fnPath);
30270
31440
  return isHookName2(name);
30271
31441
  };
30272
- const isComponentOrHookDefinition = (fnPath) => isComponentDefinition(fnPath) || isHookDefinition(fnPath);
31442
+ const isComponentOrHookDefinition = (fnPath) => isComponentDefinition(fnPath) || isHookDefinition(fnPath) || isReactiveScopeCallback(fnPath);
30273
31443
  const isComponentLike = (fnPath) => {
30274
31444
  const name = getFunctionName(fnPath);
30275
31445
  return name && isComponentName2(name) || isHookName2(name) || functionHasJSX(fnPath) || functionUsesStateLike(fnPath, t4);
@@ -30357,7 +31527,7 @@ function createHIREntrypointVisitor(t4, options) {
30357
31527
  };
30358
31528
  return checkNode(fn.body);
30359
31529
  };
30360
- path.traverse({
31530
+ path2.traverse({
30361
31531
  FunctionDeclaration(fnPath) {
30362
31532
  const name = fnPath.node.id?.name;
30363
31533
  if (!isComponentName2(name)) return;
@@ -30394,7 +31564,7 @@ function createHIREntrypointVisitor(t4, options) {
30394
31564
  const stateMacroNames = /* @__PURE__ */ new Set(["$state"]);
30395
31565
  const effectMacroNames = /* @__PURE__ */ new Set(["$effect"]);
30396
31566
  const memoMacroNames = /* @__PURE__ */ new Set(["$memo", "createMemo"]);
30397
- path.traverse({
31567
+ path2.traverse({
30398
31568
  ImportDeclaration(importPath) {
30399
31569
  if (importPath.node.source.value !== "fict" && importPath.node.source.value !== "fict/slim")
30400
31570
  return;
@@ -30414,7 +31584,7 @@ function createHIREntrypointVisitor(t4, options) {
30414
31584
  }
30415
31585
  }
30416
31586
  });
30417
- path.traverse({
31587
+ path2.traverse({
30418
31588
  JSXExpressionContainer(exprPath) {
30419
31589
  const expr = exprPath.node.expression;
30420
31590
  if (!t4.isCallExpression(expr)) return;
@@ -30459,7 +31629,7 @@ function createHIREntrypointVisitor(t4, options) {
30459
31629
  const stateVars = /* @__PURE__ */ new Set();
30460
31630
  const derivedVars = /* @__PURE__ */ new Set();
30461
31631
  const destructuredAliases = /* @__PURE__ */ new Set();
30462
- path.traverse({
31632
+ path2.traverse({
30463
31633
  VariableDeclarator(varPath) {
30464
31634
  const init = varPath.node.init;
30465
31635
  if (!init) return;
@@ -30502,7 +31672,7 @@ Signals must be created at the top level of components for stable identity.
30502
31672
  Move the $state() declaration before the loop/condition.`
30503
31673
  );
30504
31674
  }
30505
- if (isInsideNestedFunction(varPath)) {
31675
+ if (isInsideNestedFunctionWithReactiveScopes(varPath)) {
30506
31676
  throw varPath.buildCodeFrameError(
30507
31677
  `$state() cannot be declared inside nested functions.
30508
31678
 
@@ -30587,7 +31757,7 @@ Move the declaration to the top of your component.
30587
31757
  For dynamic collections, consider using $store with an array/object.`
30588
31758
  );
30589
31759
  }
30590
- if (isInsideNestedFunction(callPath)) {
31760
+ if (isInsideNestedFunctionWithReactiveScopes(callPath)) {
30591
31761
  throw callPath.buildCodeFrameError(
30592
31762
  `$state() cannot be declared inside nested functions.
30593
31763
 
@@ -30614,7 +31784,7 @@ For conditional effects, use a condition inside the effect body instead:
30614
31784
  $effect(() => { if (condition) { /* ... */ } })`
30615
31785
  );
30616
31786
  }
30617
- if (isInsideNestedFunction(callPath)) {
31787
+ if (isInsideNestedFunctionWithReactiveScopes(callPath)) {
30618
31788
  throw callPath.buildCodeFrameError(
30619
31789
  `$effect() cannot be called inside nested functions.
30620
31790
 
@@ -30648,7 +31818,7 @@ or extract the nested logic into a custom hook (useXxx).`
30648
31818
  `${calleeId}() must be called inside a component or hook (useX)`
30649
31819
  );
30650
31820
  }
30651
- if (isInsideLoop(callPath) || isInsideConditional(callPath) || isInsideNestedFunction(callPath)) {
31821
+ if (isInsideLoop(callPath) || isInsideConditional(callPath) || isInsideNestedFunctionWithReactiveScopes(callPath)) {
30652
31822
  throw callPath.buildCodeFrameError(
30653
31823
  `${calleeId}() must be called at the top level of a component or hook (no loops/conditions/nested functions)`
30654
31824
  );
@@ -30708,7 +31878,7 @@ or extract the nested logic into a custom hook (useXxx).`
30708
31878
  return usesState;
30709
31879
  };
30710
31880
  debugLog("alias", "state vars", Array.from(stateVars));
30711
- path.traverse({
31881
+ path2.traverse({
30712
31882
  Function: {
30713
31883
  enter() {
30714
31884
  aliasStack.push(/* @__PURE__ */ new Set());
@@ -30766,7 +31936,7 @@ or extract the nested logic into a custom hook (useXxx).`
30766
31936
  }
30767
31937
  });
30768
31938
  if (derivedVars.size > 0) {
30769
- path.traverse({
31939
+ path2.traverse({
30770
31940
  AssignmentExpression(assignPath) {
30771
31941
  const { left } = assignPath.node;
30772
31942
  if (t4.isIdentifier(left) && derivedVars.has(left.name)) {
@@ -30787,7 +31957,7 @@ or extract the nested logic into a custom hook (useXxx).`
30787
31957
  });
30788
31958
  }
30789
31959
  if (destructuredAliases.size > 0) {
30790
- path.traverse({
31960
+ path2.traverse({
30791
31961
  AssignmentExpression(assignPath) {
30792
31962
  const { left } = assignPath.node;
30793
31963
  if (t4.isIdentifier(left) && destructuredAliases.has(left.name)) {
@@ -30815,10 +31985,11 @@ or extract the nested logic into a custom hook (useXxx).`
30815
31985
  }
30816
31986
  });
30817
31987
  }
30818
- if (dev) {
30819
- runWarningPass(path, stateVars, derivedVars, warn, fileName, t4);
31988
+ const shouldRunWarnings = dev || hasErrorEscalation(options);
31989
+ if (shouldRunWarnings) {
31990
+ runWarningPass(path2, stateVars, derivedVars, warn, fileName, t4);
30820
31991
  }
30821
- const fileAst = t4.file(path.node);
31992
+ const fileAst = t4.file(path2.node);
30822
31993
  const hir = buildHIR(
30823
31994
  fileAst,
30824
31995
  {
@@ -30828,24 +31999,26 @@ or extract the nested logic into a custom hook (useXxx).`
30828
31999
  {
30829
32000
  dev,
30830
32001
  fileName,
30831
- onWarn: warn
32002
+ onWarn: warn,
32003
+ reactiveScopes: reactiveScopesSet
30832
32004
  }
30833
32005
  );
30834
32006
  const optimized = optionsWithWarnings.optimize ? optimizeHIR(hir, {
30835
32007
  memoMacroNames,
30836
- inlineDerivedMemos: optionsWithWarnings.inlineDerivedMemos ?? true
32008
+ inlineDerivedMemos: optionsWithWarnings.inlineDerivedMemos ?? true,
32009
+ optimizeLevel: optionsWithWarnings.optimizeLevel ?? "safe"
30837
32010
  }) : hir;
30838
32011
  const lowered = lowerHIRWithRegions(optimized, t4, optionsWithWarnings, {
30839
32012
  state: stateMacroNames,
30840
32013
  effect: effectMacroNames,
30841
32014
  memo: memoMacroNames
30842
32015
  });
30843
- path.node.body = lowered.program.body;
30844
- path.node.directives = lowered.program.directives;
32016
+ path2.node.body = lowered.program.body;
32017
+ path2.node.directives = lowered.program.directives;
30845
32018
  if (!process.env.FICT_SKIP_SCOPE_CRAWL) {
30846
- path.scope.crawl();
32019
+ path2.scope.crawl();
30847
32020
  }
30848
- stripMacroImports(path, t4);
32021
+ stripMacroImports(path2, t4);
30849
32022
  }
30850
32023
  }
30851
32024
  };
@@ -30858,7 +32031,9 @@ var createFictPlugin = (0, import_helper_plugin_utils.declare)(
30858
32031
  ...options,
30859
32032
  fineGrainedDom: options.fineGrainedDom ?? true,
30860
32033
  optimize: options.optimize ?? true,
32034
+ optimizeLevel: options.optimizeLevel ?? "safe",
30861
32035
  inlineDerivedMemos: options.inlineDerivedMemos ?? true,
32036
+ emitModuleMetadata: options.emitModuleMetadata ?? "auto",
30862
32037
  dev: options.dev ?? (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test")
30863
32038
  };
30864
32039
  return {
@@ -30870,5 +32045,8 @@ var createFictPlugin = (0, import_helper_plugin_utils.declare)(
30870
32045
  var index_default = createFictPlugin;
30871
32046
  // Annotate the CommonJS export names for ESM import in node:
30872
32047
  0 && (module.exports = {
30873
- createFictPlugin
32048
+ clearModuleMetadata,
32049
+ createFictPlugin,
32050
+ resolveModuleMetadata,
32051
+ setModuleMetadata
30874
32052
  });