babel-plugin-react-compiler 0.0.0-experimental-9e9cd66-20250520 → 0.0.0-experimental-8f8b1db-20250523
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.d.ts +15 -4
- package/dist/index.js +737 -336
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1376,8 +1376,8 @@ var require_renamer = __commonJS({
|
|
1376
1376
|
value: true
|
1377
1377
|
});
|
1378
1378
|
exports2.default = void 0;
|
1379
|
-
var
|
1380
|
-
var _t =
|
1379
|
+
var t6 = require("@babel/types");
|
1380
|
+
var _t = t6;
|
1381
1381
|
var _traverseNode = require_traverse_node();
|
1382
1382
|
var _visitors = require_visitors();
|
1383
1383
|
var _context3 = require_context2();
|
@@ -1442,7 +1442,7 @@ var require_renamer = __commonJS({
|
|
1442
1442
|
const {
|
1443
1443
|
declaration
|
1444
1444
|
} = maybeExportDeclar.node;
|
1445
|
-
if (
|
1445
|
+
if (t6.isDeclaration(declaration) && !declaration.id) {
|
1446
1446
|
return;
|
1447
1447
|
}
|
1448
1448
|
}
|
@@ -1478,11 +1478,11 @@ var require_renamer = __commonJS({
|
|
1478
1478
|
const skipKeys = {
|
1479
1479
|
discriminant: true
|
1480
1480
|
};
|
1481
|
-
if (
|
1481
|
+
if (t6.isMethod(blockToTraverse)) {
|
1482
1482
|
if (blockToTraverse.computed) {
|
1483
1483
|
skipKeys.key = true;
|
1484
1484
|
}
|
1485
|
-
if (!
|
1485
|
+
if (!t6.isObjectMethod(blockToTraverse)) {
|
1486
1486
|
skipKeys.decorators = true;
|
1487
1487
|
}
|
1488
1488
|
}
|
@@ -3225,7 +3225,7 @@ var require_scope = __commonJS({
|
|
3225
3225
|
var _binding = require_binding();
|
3226
3226
|
var _globals4 = require_globals2();
|
3227
3227
|
var _t = require("@babel/types");
|
3228
|
-
var
|
3228
|
+
var t6 = _t;
|
3229
3229
|
var _cache = require_cache();
|
3230
3230
|
var _visitors = require_visitors();
|
3231
3231
|
var {
|
@@ -3812,7 +3812,7 @@ var require_scope = __commonJS({
|
|
3812
3812
|
} else if (isCallExpression(node)) {
|
3813
3813
|
return matchesPattern(node.callee, "Symbol.for") && !this.hasBinding("Symbol", {
|
3814
3814
|
noGlobals: true
|
3815
|
-
}) && node.arguments.length === 1 &&
|
3815
|
+
}) && node.arguments.length === 1 && t6.isStringLiteral(node.arguments[0]);
|
3816
3816
|
} else {
|
3817
3817
|
return isPureish(node);
|
3818
3818
|
}
|
@@ -5855,7 +5855,7 @@ var require_parentheses = __commonJS({
|
|
5855
5855
|
exports2.DoExpression = DoExpression;
|
5856
5856
|
exports2.FunctionExpression = FunctionExpression7;
|
5857
5857
|
exports2.FunctionTypeAnnotation = FunctionTypeAnnotation;
|
5858
|
-
exports2.Identifier =
|
5858
|
+
exports2.Identifier = Identifier29;
|
5859
5859
|
exports2.LogicalExpression = LogicalExpression;
|
5860
5860
|
exports2.NullableTypeAnnotation = NullableTypeAnnotation;
|
5861
5861
|
exports2.ObjectExpression = ObjectExpression;
|
@@ -6070,7 +6070,7 @@ var require_parentheses = __commonJS({
|
|
6070
6070
|
return parent.operator !== "??";
|
6071
6071
|
}
|
6072
6072
|
}
|
6073
|
-
function
|
6073
|
+
function Identifier29(node, parent, tokenContext, _inForInit, getRawIdentifier) {
|
6074
6074
|
var _node$extra;
|
6075
6075
|
const parentType = parent.type;
|
6076
6076
|
if ((_node$extra = node.extra) != null && _node$extra.parenthesized && parentType === "AssignmentExpression" && parent.left === node) {
|
@@ -8040,7 +8040,7 @@ var require_types = __commonJS({
|
|
8040
8040
|
exports2.ArrayPattern = exports2.ArrayExpression = ArrayExpression5;
|
8041
8041
|
exports2.BigIntLiteral = BigIntLiteral;
|
8042
8042
|
exports2.BooleanLiteral = BooleanLiteral;
|
8043
|
-
exports2.Identifier =
|
8043
|
+
exports2.Identifier = Identifier29;
|
8044
8044
|
exports2.NullLiteral = NullLiteral;
|
8045
8045
|
exports2.NumericLiteral = NumericLiteral;
|
8046
8046
|
exports2.ObjectPattern = exports2.ObjectExpression = ObjectExpression;
|
@@ -8077,7 +8077,7 @@ var require_types = __commonJS({
|
|
8077
8077
|
}
|
8078
8078
|
return lastRawIdentResult = node.name;
|
8079
8079
|
}
|
8080
|
-
function
|
8080
|
+
function Identifier29(node) {
|
8081
8081
|
var _node$loc;
|
8082
8082
|
this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name);
|
8083
8083
|
this.word(this.tokenMap ? this._getRawIdentifier(node) : node.name);
|
@@ -9234,7 +9234,7 @@ var require_typescript = __commonJS({
|
|
9234
9234
|
this.tokenChar(60);
|
9235
9235
|
let printTrailingSeparator = parent.type === "ArrowFunctionExpression" && node.params.length === 1;
|
9236
9236
|
if (this.tokenMap && node.start != null && node.end != null) {
|
9237
|
-
printTrailingSeparator && (printTrailingSeparator = !!this.tokenMap.find(node, (
|
9237
|
+
printTrailingSeparator && (printTrailingSeparator = !!this.tokenMap.find(node, (t6) => this.tokenMap.matchesOriginal(t6, ",")));
|
9238
9238
|
printTrailingSeparator || (printTrailingSeparator = this.shouldPrintTrailingComma(">"));
|
9239
9239
|
}
|
9240
9240
|
this.printList(node.params, printTrailingSeparator);
|
@@ -12637,12 +12637,12 @@ var require_lib4 = __commonJS({
|
|
12637
12637
|
});
|
12638
12638
|
function _objectWithoutPropertiesLoose(r, e) {
|
12639
12639
|
if (null == r) return {};
|
12640
|
-
var
|
12640
|
+
var t6 = {};
|
12641
12641
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
12642
12642
|
if (-1 !== e.indexOf(n)) continue;
|
12643
|
-
|
12643
|
+
t6[n] = r[n];
|
12644
12644
|
}
|
12645
|
-
return
|
12645
|
+
return t6;
|
12646
12646
|
}
|
12647
12647
|
var Position = class {
|
12648
12648
|
constructor(line2, col, index) {
|
@@ -21126,7 +21126,7 @@ var require_lib4 = __commonJS({
|
|
21126
21126
|
}
|
21127
21127
|
tsParseTypeOrTypePredicateAnnotation(returnToken) {
|
21128
21128
|
return this.tsInType(() => {
|
21129
|
-
const
|
21129
|
+
const t6 = this.startNode();
|
21130
21130
|
this.expect(returnToken);
|
21131
21131
|
const node = this.startNode();
|
21132
21132
|
const asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
|
@@ -21141,26 +21141,26 @@ var require_lib4 = __commonJS({
|
|
21141
21141
|
this.resetStartLocationFromNode(thisTypePredicate, node);
|
21142
21142
|
thisTypePredicate.asserts = true;
|
21143
21143
|
}
|
21144
|
-
|
21145
|
-
return this.finishNode(
|
21144
|
+
t6.typeAnnotation = thisTypePredicate;
|
21145
|
+
return this.finishNode(t6, "TSTypeAnnotation");
|
21146
21146
|
}
|
21147
21147
|
const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));
|
21148
21148
|
if (!typePredicateVariable) {
|
21149
21149
|
if (!asserts) {
|
21150
|
-
return this.tsParseTypeAnnotation(false,
|
21150
|
+
return this.tsParseTypeAnnotation(false, t6);
|
21151
21151
|
}
|
21152
21152
|
node.parameterName = this.parseIdentifier();
|
21153
21153
|
node.asserts = asserts;
|
21154
21154
|
node.typeAnnotation = null;
|
21155
|
-
|
21156
|
-
return this.finishNode(
|
21155
|
+
t6.typeAnnotation = this.finishNode(node, "TSTypePredicate");
|
21156
|
+
return this.finishNode(t6, "TSTypeAnnotation");
|
21157
21157
|
}
|
21158
21158
|
const type = this.tsParseTypeAnnotation(false);
|
21159
21159
|
node.parameterName = typePredicateVariable;
|
21160
21160
|
node.typeAnnotation = type;
|
21161
21161
|
node.asserts = asserts;
|
21162
|
-
|
21163
|
-
return this.finishNode(
|
21162
|
+
t6.typeAnnotation = this.finishNode(node, "TSTypePredicate");
|
21163
|
+
return this.finishNode(t6, "TSTypeAnnotation");
|
21164
21164
|
});
|
21165
21165
|
}
|
21166
21166
|
tsTryParseTypeOrTypePredicateAnnotation() {
|
@@ -21199,12 +21199,12 @@ var require_lib4 = __commonJS({
|
|
21199
21199
|
}
|
21200
21200
|
return true;
|
21201
21201
|
}
|
21202
|
-
tsParseTypeAnnotation(eatColon = true,
|
21202
|
+
tsParseTypeAnnotation(eatColon = true, t6 = this.startNode()) {
|
21203
21203
|
this.tsInType(() => {
|
21204
21204
|
if (eatColon) this.expect(14);
|
21205
|
-
|
21205
|
+
t6.typeAnnotation = this.tsParseType();
|
21206
21206
|
});
|
21207
|
-
return this.finishNode(
|
21207
|
+
return this.finishNode(t6, "TSTypeAnnotation");
|
21208
21208
|
}
|
21209
21209
|
tsParseType() {
|
21210
21210
|
assert(this.state.inType);
|
@@ -23001,7 +23001,7 @@ var require_lib4 = __commonJS({
|
|
23001
23001
|
}
|
23002
23002
|
const topicToken = pluginsMap.get("pipelineOperator").topicToken;
|
23003
23003
|
if (!TOPIC_TOKENS.includes(topicToken)) {
|
23004
|
-
const tokenList = TOPIC_TOKENS.map((
|
23004
|
+
const tokenList = TOPIC_TOKENS.map((t6) => `"${t6}"`).join(", ");
|
23005
23005
|
throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
|
23006
23006
|
}
|
23007
23007
|
if (topicToken === "#" && tupleSyntaxIsHash) {
|
@@ -27550,12 +27550,12 @@ var require_options = __commonJS({
|
|
27550
27550
|
var _excluded = ["placeholderWhitelist", "placeholderPattern", "preserveComments", "syntacticPlaceholders"];
|
27551
27551
|
function _objectWithoutPropertiesLoose(r, e) {
|
27552
27552
|
if (null == r) return {};
|
27553
|
-
var
|
27553
|
+
var t6 = {};
|
27554
27554
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
27555
27555
|
if (-1 !== e.indexOf(n)) continue;
|
27556
|
-
|
27556
|
+
t6[n] = r[n];
|
27557
27557
|
}
|
27558
|
-
return
|
27558
|
+
return t6;
|
27559
27559
|
}
|
27560
27560
|
function merge3(a, b) {
|
27561
27561
|
const {
|
@@ -29546,7 +29546,7 @@ var require_path = __commonJS({
|
|
29546
29546
|
var _index = require_lib6();
|
29547
29547
|
var _index2 = require_scope();
|
29548
29548
|
var _t = require("@babel/types");
|
29549
|
-
var
|
29549
|
+
var t6 = _t;
|
29550
29550
|
var cache = require_cache();
|
29551
29551
|
var _generator = require_lib();
|
29552
29552
|
var NodePath_ancestry = require_ancestry();
|
@@ -29811,9 +29811,9 @@ var require_path = __commonJS({
|
|
29811
29811
|
_getPattern: NodePath_family._getPattern
|
29812
29812
|
});
|
29813
29813
|
}
|
29814
|
-
for (const type of
|
29814
|
+
for (const type of t6.TYPES) {
|
29815
29815
|
const typeKey = `is${type}`;
|
29816
|
-
const fn =
|
29816
|
+
const fn = t6[typeKey];
|
29817
29817
|
NodePath_Final.prototype[typeKey] = function(opts) {
|
29818
29818
|
return fn(this.node, opts);
|
29819
29819
|
};
|
@@ -29826,7 +29826,7 @@ var require_path = __commonJS({
|
|
29826
29826
|
Object.assign(NodePath_Final.prototype, NodePath_virtual_types_validator);
|
29827
29827
|
for (const type of Object.keys(virtualTypes)) {
|
29828
29828
|
if (type[0] === "_") continue;
|
29829
|
-
if (!
|
29829
|
+
if (!t6.TYPES.includes(type)) t6.TYPES.push(type);
|
29830
29830
|
}
|
29831
29831
|
}
|
29832
29832
|
});
|
@@ -30016,7 +30016,7 @@ var require_context2 = __commonJS({
|
|
30016
30016
|
var _traverseNode = require_traverse_node();
|
30017
30017
|
var _index = require_path();
|
30018
30018
|
var _removal = require_removal();
|
30019
|
-
var
|
30019
|
+
var t6 = require("@babel/types");
|
30020
30020
|
function call(key2) {
|
30021
30021
|
const opts = this.opts;
|
30022
30022
|
this.debug(key2);
|
@@ -30208,7 +30208,7 @@ var require_context2 = __commonJS({
|
|
30208
30208
|
context,
|
30209
30209
|
node
|
30210
30210
|
} = this;
|
30211
|
-
if (!
|
30211
|
+
if (!t6.isPrivate(node) && node.computed) {
|
30212
30212
|
context.maybeQueue(this.get("key"));
|
30213
30213
|
}
|
30214
30214
|
if (node.decorators) {
|
@@ -32929,8 +32929,8 @@ var require_renamer2 = __commonJS({
|
|
32929
32929
|
value: true
|
32930
32930
|
});
|
32931
32931
|
exports2.default = void 0;
|
32932
|
-
var
|
32933
|
-
var _t =
|
32932
|
+
var t6 = require("@babel/types");
|
32933
|
+
var _t = t6;
|
32934
32934
|
var _traverseNode = require_traverse_node2();
|
32935
32935
|
var _visitors = require_visitors2();
|
32936
32936
|
var _context3 = require_context4();
|
@@ -32995,7 +32995,7 @@ var require_renamer2 = __commonJS({
|
|
32995
32995
|
const {
|
32996
32996
|
declaration
|
32997
32997
|
} = maybeExportDeclar.node;
|
32998
|
-
if (
|
32998
|
+
if (t6.isDeclaration(declaration) && !declaration.id) {
|
32999
32999
|
return;
|
33000
33000
|
}
|
33001
33001
|
}
|
@@ -33031,11 +33031,11 @@ var require_renamer2 = __commonJS({
|
|
33031
33031
|
const skipKeys = {
|
33032
33032
|
discriminant: true
|
33033
33033
|
};
|
33034
|
-
if (
|
33034
|
+
if (t6.isMethod(blockToTraverse)) {
|
33035
33035
|
if (blockToTraverse.computed) {
|
33036
33036
|
skipKeys.key = true;
|
33037
33037
|
}
|
33038
|
-
if (!
|
33038
|
+
if (!t6.isObjectMethod(blockToTraverse)) {
|
33039
33039
|
skipKeys.decorators = true;
|
33040
33040
|
}
|
33041
33041
|
}
|
@@ -33201,7 +33201,7 @@ var require_scope2 = __commonJS({
|
|
33201
33201
|
var _binding = require_binding2();
|
33202
33202
|
var _globals4 = require_globals2();
|
33203
33203
|
var _t = require("@babel/types");
|
33204
|
-
var
|
33204
|
+
var t6 = _t;
|
33205
33205
|
var _cache = require_cache2();
|
33206
33206
|
var {
|
33207
33207
|
assignmentExpression: assignmentExpression2,
|
@@ -33405,7 +33405,7 @@ var require_scope2 = __commonJS({
|
|
33405
33405
|
parent.registerDeclaration(path);
|
33406
33406
|
},
|
33407
33407
|
ReferencedIdentifier(path, state) {
|
33408
|
-
if (
|
33408
|
+
if (t6.isTSQualifiedName(path.parent) && path.parent.right === path.node) {
|
33409
33409
|
return;
|
33410
33410
|
}
|
33411
33411
|
if (path.parentPath.isTSImportEqualsDeclaration()) return;
|
@@ -33805,7 +33805,7 @@ var require_scope2 = __commonJS({
|
|
33805
33805
|
} else if (isCallExpression(node)) {
|
33806
33806
|
return matchesPattern(node.callee, "Symbol.for") && !this.hasBinding("Symbol", {
|
33807
33807
|
noGlobals: true
|
33808
|
-
}) && node.arguments.length === 1 &&
|
33808
|
+
}) && node.arguments.length === 1 && t6.isStringLiteral(node.arguments[0]);
|
33809
33809
|
} else {
|
33810
33810
|
return isPureish(node);
|
33811
33811
|
}
|
@@ -34766,7 +34766,7 @@ var require_parentheses2 = __commonJS({
|
|
34766
34766
|
exports2.DoExpression = DoExpression;
|
34767
34767
|
exports2.FunctionExpression = FunctionExpression7;
|
34768
34768
|
exports2.FunctionTypeAnnotation = FunctionTypeAnnotation;
|
34769
|
-
exports2.Identifier =
|
34769
|
+
exports2.Identifier = Identifier29;
|
34770
34770
|
exports2.LogicalExpression = LogicalExpression;
|
34771
34771
|
exports2.NullableTypeAnnotation = NullableTypeAnnotation;
|
34772
34772
|
exports2.ObjectExpression = ObjectExpression;
|
@@ -34981,7 +34981,7 @@ var require_parentheses2 = __commonJS({
|
|
34981
34981
|
return parent.operator !== "??";
|
34982
34982
|
}
|
34983
34983
|
}
|
34984
|
-
function
|
34984
|
+
function Identifier29(node, parent, tokenContext, _inForInit, getRawIdentifier) {
|
34985
34985
|
var _node$extra;
|
34986
34986
|
const parentType = parent.type;
|
34987
34987
|
if ((_node$extra = node.extra) != null && _node$extra.parenthesized && parentType === "AssignmentExpression" && parent.left === node) {
|
@@ -36951,7 +36951,7 @@ var require_types2 = __commonJS({
|
|
36951
36951
|
exports2.ArrayPattern = exports2.ArrayExpression = ArrayExpression5;
|
36952
36952
|
exports2.BigIntLiteral = BigIntLiteral;
|
36953
36953
|
exports2.BooleanLiteral = BooleanLiteral;
|
36954
|
-
exports2.Identifier =
|
36954
|
+
exports2.Identifier = Identifier29;
|
36955
36955
|
exports2.NullLiteral = NullLiteral;
|
36956
36956
|
exports2.NumericLiteral = NumericLiteral;
|
36957
36957
|
exports2.ObjectPattern = exports2.ObjectExpression = ObjectExpression;
|
@@ -36988,7 +36988,7 @@ var require_types2 = __commonJS({
|
|
36988
36988
|
}
|
36989
36989
|
return lastRawIdentResult = node.name;
|
36990
36990
|
}
|
36991
|
-
function
|
36991
|
+
function Identifier29(node) {
|
36992
36992
|
var _node$loc;
|
36993
36993
|
this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name);
|
36994
36994
|
this.word(this.tokenMap ? this._getRawIdentifier(node) : node.name);
|
@@ -38145,7 +38145,7 @@ var require_typescript2 = __commonJS({
|
|
38145
38145
|
this.tokenChar(60);
|
38146
38146
|
let printTrailingSeparator = parent.type === "ArrowFunctionExpression" && node.params.length === 1;
|
38147
38147
|
if (this.tokenMap && node.start != null && node.end != null) {
|
38148
|
-
printTrailingSeparator && (printTrailingSeparator = !!this.tokenMap.find(node, (
|
38148
|
+
printTrailingSeparator && (printTrailingSeparator = !!this.tokenMap.find(node, (t6) => this.tokenMap.matchesOriginal(t6, ",")));
|
38149
38149
|
printTrailingSeparator || (printTrailingSeparator = this.shouldPrintTrailingComma(">"));
|
38150
38150
|
}
|
38151
38151
|
this.printList(node.params, printTrailingSeparator);
|
@@ -43113,7 +43113,7 @@ var require_path2 = __commonJS({
|
|
43113
43113
|
var _index = require_lib9();
|
43114
43114
|
var _index2 = require_scope2();
|
43115
43115
|
var _t = require("@babel/types");
|
43116
|
-
var
|
43116
|
+
var t6 = _t;
|
43117
43117
|
var cache = require_cache2();
|
43118
43118
|
var _generator = require_lib8();
|
43119
43119
|
var NodePath_ancestry = require_ancestry2();
|
@@ -43378,9 +43378,9 @@ var require_path2 = __commonJS({
|
|
43378
43378
|
_getPattern: NodePath_family._getPattern
|
43379
43379
|
});
|
43380
43380
|
}
|
43381
|
-
for (const type of
|
43381
|
+
for (const type of t6.TYPES) {
|
43382
43382
|
const typeKey = `is${type}`;
|
43383
|
-
const fn =
|
43383
|
+
const fn = t6[typeKey];
|
43384
43384
|
NodePath_Final.prototype[typeKey] = function(opts) {
|
43385
43385
|
return fn(this.node, opts);
|
43386
43386
|
};
|
@@ -43393,7 +43393,7 @@ var require_path2 = __commonJS({
|
|
43393
43393
|
Object.assign(NodePath_Final.prototype, NodePath_virtual_types_validator);
|
43394
43394
|
for (const type of Object.keys(virtualTypes)) {
|
43395
43395
|
if (type[0] === "_") continue;
|
43396
|
-
if (!
|
43396
|
+
if (!t6.TYPES.includes(type)) t6.TYPES.push(type);
|
43397
43397
|
}
|
43398
43398
|
}
|
43399
43399
|
});
|
@@ -43583,7 +43583,7 @@ var require_context4 = __commonJS({
|
|
43583
43583
|
var _traverseNode = require_traverse_node2();
|
43584
43584
|
var _index = require_path2();
|
43585
43585
|
var _removal = require_removal2();
|
43586
|
-
var
|
43586
|
+
var t6 = require("@babel/types");
|
43587
43587
|
function call(key2) {
|
43588
43588
|
const opts = this.opts;
|
43589
43589
|
this.debug(key2);
|
@@ -43775,7 +43775,7 @@ var require_context4 = __commonJS({
|
|
43775
43775
|
context,
|
43776
43776
|
node
|
43777
43777
|
} = this;
|
43778
|
-
if (!
|
43778
|
+
if (!t6.isPrivate(node) && node.computed) {
|
43779
43779
|
context.maybeQueue(this.get("key"));
|
43780
43780
|
}
|
43781
43781
|
if (node.decorators) {
|
@@ -44997,9 +44997,9 @@ var require_file = __commonJS({
|
|
44997
44997
|
};
|
44998
44998
|
return data;
|
44999
44999
|
}
|
45000
|
-
function
|
45000
|
+
function t6() {
|
45001
45001
|
const data = _interopRequireWildcard(require("@babel/types"));
|
45002
|
-
|
45002
|
+
t6 = function() {
|
45003
45003
|
return data;
|
45004
45004
|
};
|
45005
45005
|
return data;
|
@@ -45085,7 +45085,7 @@ var require_file = __commonJS({
|
|
45085
45085
|
}
|
45086
45086
|
set shebang(value) {
|
45087
45087
|
if (value) {
|
45088
|
-
this.path.get("interpreter").replaceWith(
|
45088
|
+
this.path.get("interpreter").replaceWith(t6().interpreterDirective(value));
|
45089
45089
|
} else {
|
45090
45090
|
this.path.get("interpreter").remove();
|
45091
45091
|
}
|
@@ -45146,7 +45146,7 @@ var require_file = __commonJS({
|
|
45146
45146
|
}
|
45147
45147
|
addHelper(name) {
|
45148
45148
|
const declar = this.declarations[name];
|
45149
|
-
if (declar) return
|
45149
|
+
if (declar) return t6().cloneNode(declar);
|
45150
45150
|
const generator = this.get("helperGenerator");
|
45151
45151
|
if (generator) {
|
45152
45152
|
const res = generator(name);
|
@@ -45241,9 +45241,9 @@ var require_build_external_helpers = __commonJS({
|
|
45241
45241
|
};
|
45242
45242
|
return data;
|
45243
45243
|
}
|
45244
|
-
function
|
45244
|
+
function t6() {
|
45245
45245
|
const data = _interopRequireWildcard(require("@babel/types"));
|
45246
|
-
|
45246
|
+
t6 = function() {
|
45247
45247
|
return data;
|
45248
45248
|
};
|
45249
45249
|
return data;
|
@@ -45286,48 +45286,48 @@ var require_build_external_helpers = __commonJS({
|
|
45286
45286
|
});
|
45287
45287
|
`(replacements);
|
45288
45288
|
function buildGlobal(whitelist) {
|
45289
|
-
const namespace =
|
45289
|
+
const namespace = t6().identifier("babelHelpers");
|
45290
45290
|
const body = [];
|
45291
|
-
const container =
|
45292
|
-
const tree =
|
45293
|
-
body.push(
|
45291
|
+
const container = t6().functionExpression(null, [t6().identifier("global")], t6().blockStatement(body));
|
45292
|
+
const tree = t6().program([t6().expressionStatement(t6().callExpression(container, [t6().conditionalExpression(t6().binaryExpression("===", t6().unaryExpression("typeof", t6().identifier("global")), t6().stringLiteral("undefined")), t6().identifier("self"), t6().identifier("global"))]))]);
|
45293
|
+
body.push(t6().variableDeclaration("var", [t6().variableDeclarator(namespace, t6().assignmentExpression("=", t6().memberExpression(t6().identifier("global"), namespace), t6().objectExpression([])))]));
|
45294
45294
|
buildHelpers(body, namespace, whitelist);
|
45295
45295
|
return tree;
|
45296
45296
|
}
|
45297
45297
|
function buildModule(whitelist) {
|
45298
45298
|
const body = [];
|
45299
45299
|
const refs = buildHelpers(body, null, whitelist);
|
45300
|
-
body.unshift(
|
45301
|
-
return
|
45300
|
+
body.unshift(t6().exportNamedDeclaration(null, Object.keys(refs).map((name) => {
|
45301
|
+
return t6().exportSpecifier(t6().cloneNode(refs[name]), t6().identifier(name));
|
45302
45302
|
})));
|
45303
|
-
return
|
45303
|
+
return t6().program(body, [], "module");
|
45304
45304
|
}
|
45305
45305
|
function buildUmd(whitelist) {
|
45306
|
-
const namespace =
|
45306
|
+
const namespace = t6().identifier("babelHelpers");
|
45307
45307
|
const body = [];
|
45308
|
-
body.push(
|
45308
|
+
body.push(t6().variableDeclaration("var", [t6().variableDeclarator(namespace, t6().identifier("global"))]));
|
45309
45309
|
buildHelpers(body, namespace, whitelist);
|
45310
|
-
return
|
45311
|
-
FACTORY_PARAMETERS:
|
45312
|
-
BROWSER_ARGUMENTS:
|
45313
|
-
COMMON_ARGUMENTS:
|
45314
|
-
AMD_ARGUMENTS:
|
45310
|
+
return t6().program([buildUmdWrapper({
|
45311
|
+
FACTORY_PARAMETERS: t6().identifier("global"),
|
45312
|
+
BROWSER_ARGUMENTS: t6().assignmentExpression("=", t6().memberExpression(t6().identifier("root"), namespace), t6().objectExpression([])),
|
45313
|
+
COMMON_ARGUMENTS: t6().identifier("exports"),
|
45314
|
+
AMD_ARGUMENTS: t6().arrayExpression([t6().stringLiteral("exports")]),
|
45315
45315
|
FACTORY_BODY: body,
|
45316
|
-
UMD_ROOT:
|
45316
|
+
UMD_ROOT: t6().identifier("this")
|
45317
45317
|
})]);
|
45318
45318
|
}
|
45319
45319
|
function buildVar(whitelist) {
|
45320
|
-
const namespace =
|
45320
|
+
const namespace = t6().identifier("babelHelpers");
|
45321
45321
|
const body = [];
|
45322
|
-
body.push(
|
45323
|
-
const tree =
|
45322
|
+
body.push(t6().variableDeclaration("var", [t6().variableDeclarator(namespace, t6().objectExpression([]))]));
|
45323
|
+
const tree = t6().program(body);
|
45324
45324
|
buildHelpers(body, namespace, whitelist);
|
45325
|
-
body.push(
|
45325
|
+
body.push(t6().expressionStatement(namespace));
|
45326
45326
|
return tree;
|
45327
45327
|
}
|
45328
45328
|
function buildHelpers(body, namespace, whitelist) {
|
45329
45329
|
const getHelperReference = (name) => {
|
45330
|
-
return namespace ?
|
45330
|
+
return namespace ? t6().memberExpression(namespace, t6().identifier(name)) : t6().identifier(`_${name}`);
|
45331
45331
|
};
|
45332
45332
|
const refs = {};
|
45333
45333
|
helpers().list.forEach(function(name) {
|
@@ -53912,9 +53912,9 @@ var require_normalize_file = __commonJS({
|
|
53912
53912
|
};
|
53913
53913
|
return data;
|
53914
53914
|
}
|
53915
|
-
function
|
53915
|
+
function t6() {
|
53916
53916
|
const data = _interopRequireWildcard(require("@babel/types"));
|
53917
|
-
|
53917
|
+
t6 = function() {
|
53918
53918
|
return data;
|
53919
53919
|
};
|
53920
53920
|
return data;
|
@@ -54004,7 +54004,7 @@ var require_normalize_file = __commonJS({
|
|
54004
54004
|
}
|
54005
54005
|
if (ast) {
|
54006
54006
|
if (ast.type === "Program") {
|
54007
|
-
ast =
|
54007
|
+
ast = t6().file(ast, [], []);
|
54008
54008
|
} else if (ast.type !== "File") {
|
54009
54009
|
throw new Error("AST root must be a Program or File node");
|
54010
54010
|
}
|
@@ -57128,9 +57128,9 @@ var require_whitespace3 = __commonJS({
|
|
57128
57128
|
value: true
|
57129
57129
|
});
|
57130
57130
|
exports2.list = exports2.nodes = void 0;
|
57131
|
-
function
|
57131
|
+
function t6() {
|
57132
57132
|
const data = _interopRequireWildcard(require("@babel/types"));
|
57133
|
-
|
57133
|
+
t6 = function() {
|
57134
57134
|
return data;
|
57135
57135
|
};
|
57136
57136
|
return data;
|
@@ -57157,37 +57157,37 @@ var require_whitespace3 = __commonJS({
|
|
57157
57157
|
}
|
57158
57158
|
}
|
57159
57159
|
function crawl(node, state = {}) {
|
57160
|
-
if (
|
57160
|
+
if (t6().isMemberExpression(node)) {
|
57161
57161
|
crawl(node.object, state);
|
57162
57162
|
if (node.computed) crawl(node.property, state);
|
57163
|
-
} else if (
|
57163
|
+
} else if (t6().isBinary(node) || t6().isAssignmentExpression(node)) {
|
57164
57164
|
crawl(node.left, state);
|
57165
57165
|
crawl(node.right, state);
|
57166
|
-
} else if (
|
57166
|
+
} else if (t6().isCallExpression(node)) {
|
57167
57167
|
state.hasCall = true;
|
57168
57168
|
crawl(node.callee, state);
|
57169
|
-
} else if (
|
57169
|
+
} else if (t6().isFunction(node)) {
|
57170
57170
|
state.hasFunction = true;
|
57171
|
-
} else if (
|
57171
|
+
} else if (t6().isIdentifier(node)) {
|
57172
57172
|
state.hasHelper = state.hasHelper || isHelper(node.callee);
|
57173
57173
|
}
|
57174
57174
|
return state;
|
57175
57175
|
}
|
57176
57176
|
function isHelper(node) {
|
57177
|
-
if (
|
57177
|
+
if (t6().isMemberExpression(node)) {
|
57178
57178
|
return isHelper(node.object) || isHelper(node.property);
|
57179
|
-
} else if (
|
57179
|
+
} else if (t6().isIdentifier(node)) {
|
57180
57180
|
return node.name === "require" || node.name[0] === "_";
|
57181
|
-
} else if (
|
57181
|
+
} else if (t6().isCallExpression(node)) {
|
57182
57182
|
return isHelper(node.callee);
|
57183
|
-
} else if (
|
57184
|
-
return
|
57183
|
+
} else if (t6().isBinary(node) || t6().isAssignmentExpression(node)) {
|
57184
|
+
return t6().isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
|
57185
57185
|
} else {
|
57186
57186
|
return false;
|
57187
57187
|
}
|
57188
57188
|
}
|
57189
57189
|
function isType(node) {
|
57190
|
-
return
|
57190
|
+
return t6().isLiteral(node) || t6().isObjectExpression(node) || t6().isArrayExpression(node) || t6().isIdentifier(node) || t6().isMemberExpression(node);
|
57191
57191
|
}
|
57192
57192
|
var nodes = {
|
57193
57193
|
AssignmentExpression(node) {
|
@@ -57206,7 +57206,7 @@ var require_whitespace3 = __commonJS({
|
|
57206
57206
|
};
|
57207
57207
|
},
|
57208
57208
|
LogicalExpression(node) {
|
57209
|
-
if (
|
57209
|
+
if (t6().isFunction(node.left) || t6().isFunction(node.right)) {
|
57210
57210
|
return {
|
57211
57211
|
after: true
|
57212
57212
|
};
|
@@ -57220,7 +57220,7 @@ var require_whitespace3 = __commonJS({
|
|
57220
57220
|
}
|
57221
57221
|
},
|
57222
57222
|
CallExpression(node) {
|
57223
|
-
if (
|
57223
|
+
if (t6().isFunction(node.callee) || isHelper(node)) {
|
57224
57224
|
return {
|
57225
57225
|
before: true,
|
57226
57226
|
after: true
|
@@ -57244,7 +57244,7 @@ var require_whitespace3 = __commonJS({
|
|
57244
57244
|
}
|
57245
57245
|
},
|
57246
57246
|
IfStatement(node) {
|
57247
|
-
if (
|
57247
|
+
if (t6().isBlockStatement(node.consequent)) {
|
57248
57248
|
return {
|
57249
57249
|
before: true,
|
57250
57250
|
after: true
|
@@ -57300,7 +57300,7 @@ var require_whitespace3 = __commonJS({
|
|
57300
57300
|
before: amounts
|
57301
57301
|
};
|
57302
57302
|
}
|
57303
|
-
[type].concat(
|
57303
|
+
[type].concat(t6().FLIPPED_ALIAS_KEYS[type] || []).forEach(function(type2) {
|
57304
57304
|
nodes[type2] = function() {
|
57305
57305
|
return amounts;
|
57306
57306
|
};
|
@@ -57335,9 +57335,9 @@ var require_parentheses3 = __commonJS({
|
|
57335
57335
|
exports2.OptionalMemberExpression = OptionalMemberExpression;
|
57336
57336
|
exports2.AssignmentExpression = AssignmentExpression;
|
57337
57337
|
exports2.NewExpression = NewExpression2;
|
57338
|
-
function
|
57338
|
+
function t6() {
|
57339
57339
|
const data = _interopRequireWildcard(require("@babel/types"));
|
57340
|
-
|
57340
|
+
t6 = function() {
|
57341
57341
|
return data;
|
57342
57342
|
};
|
57343
57343
|
return data;
|
@@ -57389,16 +57389,16 @@ var require_parentheses3 = __commonJS({
|
|
57389
57389
|
"%": 9,
|
57390
57390
|
"**": 10
|
57391
57391
|
};
|
57392
|
-
var isClassExtendsClause = (node, parent) => (
|
57392
|
+
var isClassExtendsClause = (node, parent) => (t6().isClassDeclaration(parent) || t6().isClassExpression(parent)) && parent.superClass === node;
|
57393
57393
|
function NullableTypeAnnotation(node, parent) {
|
57394
|
-
return
|
57394
|
+
return t6().isArrayTypeAnnotation(parent);
|
57395
57395
|
}
|
57396
57396
|
function UpdateExpression(node, parent) {
|
57397
|
-
return
|
57397
|
+
return t6().isMemberExpression(parent, {
|
57398
57398
|
object: node
|
57399
|
-
}) ||
|
57399
|
+
}) || t6().isCallExpression(parent, {
|
57400
57400
|
callee: node
|
57401
|
-
}) ||
|
57401
|
+
}) || t6().isNewExpression(parent, {
|
57402
57402
|
callee: node
|
57403
57403
|
}) || isClassExtendsClause(node, parent);
|
57404
57404
|
}
|
@@ -57411,7 +57411,7 @@ var require_parentheses3 = __commonJS({
|
|
57411
57411
|
return isFirstInStatement(printStack);
|
57412
57412
|
}
|
57413
57413
|
function Binary(node, parent) {
|
57414
|
-
if (node.operator === "**" &&
|
57414
|
+
if (node.operator === "**" && t6().isBinaryExpression(parent, {
|
57415
57415
|
operator: "**"
|
57416
57416
|
})) {
|
57417
57417
|
return parent.left === node;
|
@@ -57419,22 +57419,22 @@ var require_parentheses3 = __commonJS({
|
|
57419
57419
|
if (isClassExtendsClause(node, parent)) {
|
57420
57420
|
return true;
|
57421
57421
|
}
|
57422
|
-
if ((
|
57422
|
+
if ((t6().isCallExpression(parent) || t6().isNewExpression(parent)) && parent.callee === node || t6().isUnaryLike(parent) || t6().isMemberExpression(parent) && parent.object === node || t6().isAwaitExpression(parent)) {
|
57423
57423
|
return true;
|
57424
57424
|
}
|
57425
|
-
if (
|
57425
|
+
if (t6().isBinary(parent)) {
|
57426
57426
|
const parentOp = parent.operator;
|
57427
57427
|
const parentPos = PRECEDENCE[parentOp];
|
57428
57428
|
const nodeOp = node.operator;
|
57429
57429
|
const nodePos = PRECEDENCE[nodeOp];
|
57430
|
-
if (parentPos === nodePos && parent.right === node && !
|
57430
|
+
if (parentPos === nodePos && parent.right === node && !t6().isLogicalExpression(parent) || parentPos > nodePos) {
|
57431
57431
|
return true;
|
57432
57432
|
}
|
57433
57433
|
}
|
57434
57434
|
return false;
|
57435
57435
|
}
|
57436
57436
|
function UnionTypeAnnotation(node, parent) {
|
57437
|
-
return
|
57437
|
+
return t6().isArrayTypeAnnotation(parent) || t6().isNullableTypeAnnotation(parent) || t6().isIntersectionTypeAnnotation(parent) || t6().isUnionTypeAnnotation(parent);
|
57438
57438
|
}
|
57439
57439
|
function TSAsExpression() {
|
57440
57440
|
return true;
|
@@ -57443,16 +57443,16 @@ var require_parentheses3 = __commonJS({
|
|
57443
57443
|
return true;
|
57444
57444
|
}
|
57445
57445
|
function BinaryExpression(node, parent) {
|
57446
|
-
return node.operator === "in" && (
|
57446
|
+
return node.operator === "in" && (t6().isVariableDeclarator(parent) || t6().isFor(parent));
|
57447
57447
|
}
|
57448
57448
|
function SequenceExpression(node, parent) {
|
57449
|
-
if (
|
57449
|
+
if (t6().isForStatement(parent) || t6().isThrowStatement(parent) || t6().isReturnStatement(parent) || t6().isIfStatement(parent) && parent.test === node || t6().isWhileStatement(parent) && parent.test === node || t6().isForInStatement(parent) && parent.right === node || t6().isSwitchStatement(parent) && parent.discriminant === node || t6().isExpressionStatement(parent) && parent.expression === node) {
|
57450
57450
|
return false;
|
57451
57451
|
}
|
57452
57452
|
return true;
|
57453
57453
|
}
|
57454
57454
|
function YieldExpression(node, parent) {
|
57455
|
-
return
|
57455
|
+
return t6().isBinary(parent) || t6().isUnaryLike(parent) || t6().isCallExpression(parent) || t6().isMemberExpression(parent) || t6().isNewExpression(parent) || t6().isAwaitExpression(parent) && t6().isYieldExpression(node) || t6().isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
|
57456
57456
|
}
|
57457
57457
|
function ClassExpression(node, parent, printStack) {
|
57458
57458
|
return isFirstInStatement(printStack, {
|
@@ -57460,13 +57460,13 @@ var require_parentheses3 = __commonJS({
|
|
57460
57460
|
});
|
57461
57461
|
}
|
57462
57462
|
function UnaryLike(node, parent) {
|
57463
|
-
return
|
57463
|
+
return t6().isMemberExpression(parent, {
|
57464
57464
|
object: node
|
57465
|
-
}) ||
|
57465
|
+
}) || t6().isCallExpression(parent, {
|
57466
57466
|
callee: node
|
57467
|
-
}) ||
|
57467
|
+
}) || t6().isNewExpression(parent, {
|
57468
57468
|
callee: node
|
57469
|
-
}) ||
|
57469
|
+
}) || t6().isBinaryExpression(parent, {
|
57470
57470
|
operator: "**",
|
57471
57471
|
left: node
|
57472
57472
|
}) || isClassExtendsClause(node, parent);
|
@@ -57477,21 +57477,21 @@ var require_parentheses3 = __commonJS({
|
|
57477
57477
|
});
|
57478
57478
|
}
|
57479
57479
|
function ArrowFunctionExpression(node, parent) {
|
57480
|
-
return
|
57480
|
+
return t6().isExportDeclaration(parent) || ConditionalExpression(node, parent);
|
57481
57481
|
}
|
57482
57482
|
function ConditionalExpression(node, parent) {
|
57483
|
-
if (
|
57483
|
+
if (t6().isUnaryLike(parent) || t6().isBinary(parent) || t6().isConditionalExpression(parent, {
|
57484
57484
|
test: node
|
57485
|
-
}) ||
|
57485
|
+
}) || t6().isAwaitExpression(parent) || t6().isOptionalMemberExpression(parent) || t6().isTaggedTemplateExpression(parent) || t6().isTSTypeAssertion(parent) || t6().isTSAsExpression(parent)) {
|
57486
57486
|
return true;
|
57487
57487
|
}
|
57488
57488
|
return UnaryLike(node, parent);
|
57489
57489
|
}
|
57490
57490
|
function OptionalMemberExpression(node, parent) {
|
57491
|
-
return
|
57491
|
+
return t6().isCallExpression(parent) || t6().isMemberExpression(parent);
|
57492
57492
|
}
|
57493
57493
|
function AssignmentExpression(node) {
|
57494
|
-
if (
|
57494
|
+
if (t6().isObjectPattern(node.left)) {
|
57495
57495
|
return true;
|
57496
57496
|
} else {
|
57497
57497
|
return ConditionalExpression(...arguments);
|
@@ -57509,24 +57509,24 @@ var require_parentheses3 = __commonJS({
|
|
57509
57509
|
i--;
|
57510
57510
|
let parent = printStack[i];
|
57511
57511
|
while (i > 0) {
|
57512
|
-
if (
|
57512
|
+
if (t6().isExpressionStatement(parent, {
|
57513
57513
|
expression: node
|
57514
|
-
}) ||
|
57514
|
+
}) || t6().isTaggedTemplateExpression(parent) || considerDefaultExports && t6().isExportDefaultDeclaration(parent, {
|
57515
57515
|
declaration: node
|
57516
|
-
}) || considerArrow &&
|
57516
|
+
}) || considerArrow && t6().isArrowFunctionExpression(parent, {
|
57517
57517
|
body: node
|
57518
57518
|
})) {
|
57519
57519
|
return true;
|
57520
57520
|
}
|
57521
|
-
if (
|
57521
|
+
if (t6().isCallExpression(parent, {
|
57522
57522
|
callee: node
|
57523
|
-
}) ||
|
57523
|
+
}) || t6().isSequenceExpression(parent) && parent.expressions[0] === node || t6().isMemberExpression(parent, {
|
57524
57524
|
object: node
|
57525
|
-
}) ||
|
57525
|
+
}) || t6().isConditional(parent, {
|
57526
57526
|
test: node
|
57527
|
-
}) ||
|
57527
|
+
}) || t6().isBinary(parent, {
|
57528
57528
|
left: node
|
57529
|
-
}) ||
|
57529
|
+
}) || t6().isAssignmentExpression(parent, {
|
57530
57530
|
left: node
|
57531
57531
|
})) {
|
57532
57532
|
node = parent;
|
@@ -57554,9 +57554,9 @@ var require_node4 = __commonJS({
|
|
57554
57554
|
exports2.needsParens = needsParens;
|
57555
57555
|
var whitespace = _interopRequireWildcard(require_whitespace3());
|
57556
57556
|
var parens = _interopRequireWildcard(require_parentheses3());
|
57557
|
-
function
|
57557
|
+
function t6() {
|
57558
57558
|
const data = _interopRequireWildcard(require("@babel/types"));
|
57559
|
-
|
57559
|
+
t6 = function() {
|
57560
57560
|
return data;
|
57561
57561
|
};
|
57562
57562
|
return data;
|
@@ -57592,7 +57592,7 @@ var require_node4 = __commonJS({
|
|
57592
57592
|
} : func;
|
57593
57593
|
}
|
57594
57594
|
for (const type of Object.keys(obj)) {
|
57595
|
-
const aliases =
|
57595
|
+
const aliases = t6().FLIPPED_ALIAS_KEYS[type];
|
57596
57596
|
if (aliases) {
|
57597
57597
|
for (const alias of aliases) {
|
57598
57598
|
add(alias, obj[type]);
|
@@ -57611,10 +57611,10 @@ var require_node4 = __commonJS({
|
|
57611
57611
|
return fn ? fn(node, parent, printStack) : null;
|
57612
57612
|
}
|
57613
57613
|
function isOrHasCallExpression(node) {
|
57614
|
-
if (
|
57614
|
+
if (t6().isCallExpression(node)) {
|
57615
57615
|
return true;
|
57616
57616
|
}
|
57617
|
-
if (
|
57617
|
+
if (t6().isMemberExpression(node)) {
|
57618
57618
|
return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
|
57619
57619
|
} else {
|
57620
57620
|
return false;
|
@@ -57622,7 +57622,7 @@ var require_node4 = __commonJS({
|
|
57622
57622
|
}
|
57623
57623
|
function needsWhitespace(node, parent, type) {
|
57624
57624
|
if (!node) return 0;
|
57625
|
-
if (
|
57625
|
+
if (t6().isExpressionStatement(node)) {
|
57626
57626
|
node = node.expression;
|
57627
57627
|
}
|
57628
57628
|
let linesInfo = find(expandedWhitespaceNodes, node, parent);
|
@@ -57648,7 +57648,7 @@ var require_node4 = __commonJS({
|
|
57648
57648
|
}
|
57649
57649
|
function needsParens(node, parent, printStack) {
|
57650
57650
|
if (!parent) return false;
|
57651
|
-
if (
|
57651
|
+
if (t6().isNewExpression(parent) && parent.callee === node) {
|
57652
57652
|
if (isOrHasCallExpression(node)) return true;
|
57653
57653
|
}
|
57654
57654
|
return find(expandedParens, node, parent, printStack);
|
@@ -57719,9 +57719,9 @@ var require_expressions3 = __commonJS({
|
|
57719
57719
|
exports2.MetaProperty = MetaProperty;
|
57720
57720
|
exports2.PrivateName = PrivateName;
|
57721
57721
|
exports2.AwaitExpression = exports2.YieldExpression = void 0;
|
57722
|
-
function
|
57722
|
+
function t6() {
|
57723
57723
|
const data = _interopRequireWildcard(require("@babel/types"));
|
57724
|
-
|
57724
|
+
t6 = function() {
|
57725
57725
|
return data;
|
57726
57726
|
};
|
57727
57727
|
return data;
|
@@ -57793,9 +57793,9 @@ var require_expressions3 = __commonJS({
|
|
57793
57793
|
this.word("new");
|
57794
57794
|
this.space();
|
57795
57795
|
this.print(node.callee, node);
|
57796
|
-
if (this.format.minified && node.arguments.length === 0 && !node.optional && !
|
57796
|
+
if (this.format.minified && node.arguments.length === 0 && !node.optional && !t6().isCallExpression(parent, {
|
57797
57797
|
callee: node
|
57798
|
-
}) && !
|
57798
|
+
}) && !t6().isMemberExpression(parent) && !t6().isNewExpression(parent)) {
|
57799
57799
|
return;
|
57800
57800
|
}
|
57801
57801
|
this.print(node.typeArguments, node);
|
@@ -57823,11 +57823,11 @@ var require_expressions3 = __commonJS({
|
|
57823
57823
|
}
|
57824
57824
|
function OptionalMemberExpression(node) {
|
57825
57825
|
this.print(node.object, node);
|
57826
|
-
if (!node.computed &&
|
57826
|
+
if (!node.computed && t6().isMemberExpression(node.property)) {
|
57827
57827
|
throw new TypeError("Got a MemberExpression for MemberExpression property");
|
57828
57828
|
}
|
57829
57829
|
let computed = node.computed;
|
57830
|
-
if (
|
57830
|
+
if (t6().isLiteral(node.property) && typeof node.property.value === "number") {
|
57831
57831
|
computed = true;
|
57832
57832
|
}
|
57833
57833
|
if (node.optional) {
|
@@ -57925,11 +57925,11 @@ var require_expressions3 = __commonJS({
|
|
57925
57925
|
}
|
57926
57926
|
function MemberExpression(node) {
|
57927
57927
|
this.print(node.object, node);
|
57928
|
-
if (!node.computed &&
|
57928
|
+
if (!node.computed && t6().isMemberExpression(node.property)) {
|
57929
57929
|
throw new TypeError("Got a MemberExpression for MemberExpression property");
|
57930
57930
|
}
|
57931
57931
|
let computed = node.computed;
|
57932
|
-
if (
|
57932
|
+
if (t6().isLiteral(node.property) && typeof node.property.value === "number") {
|
57933
57933
|
computed = true;
|
57934
57934
|
}
|
57935
57935
|
if (computed) {
|
@@ -57974,9 +57974,9 @@ var require_statements3 = __commonJS({
|
|
57974
57974
|
exports2.VariableDeclaration = VariableDeclaration;
|
57975
57975
|
exports2.VariableDeclarator = VariableDeclarator;
|
57976
57976
|
exports2.ThrowStatement = exports2.BreakStatement = exports2.ReturnStatement = exports2.ContinueStatement = exports2.ForOfStatement = exports2.ForInStatement = void 0;
|
57977
|
-
function
|
57977
|
+
function t6() {
|
57978
57978
|
const data = _interopRequireWildcard(require("@babel/types"));
|
57979
|
-
|
57979
|
+
t6 = function() {
|
57980
57980
|
return data;
|
57981
57981
|
};
|
57982
57982
|
return data;
|
@@ -58017,7 +58017,7 @@ var require_statements3 = __commonJS({
|
|
58017
58017
|
this.print(node.test, node);
|
58018
58018
|
this.token(")");
|
58019
58019
|
this.space();
|
58020
|
-
const needsBlock = node.alternate &&
|
58020
|
+
const needsBlock = node.alternate && t6().isIfStatement(getLastStatement(node.consequent));
|
58021
58021
|
if (needsBlock) {
|
58022
58022
|
this.token("{");
|
58023
58023
|
this.newline();
|
@@ -58037,7 +58037,7 @@ var require_statements3 = __commonJS({
|
|
58037
58037
|
}
|
58038
58038
|
}
|
58039
58039
|
function getLastStatement(statement) {
|
58040
|
-
if (!
|
58040
|
+
if (!t6().isStatement(statement.body)) return statement;
|
58041
58041
|
return getLastStatement(statement.body);
|
58042
58042
|
}
|
58043
58043
|
function ForStatement(node) {
|
@@ -58213,7 +58213,7 @@ var require_statements3 = __commonJS({
|
|
58213
58213
|
this.word(node.kind);
|
58214
58214
|
this.space();
|
58215
58215
|
let hasInits = false;
|
58216
|
-
if (!
|
58216
|
+
if (!t6().isFor(parent)) {
|
58217
58217
|
for (const declar of node.declarations) {
|
58218
58218
|
if (declar.init) {
|
58219
58219
|
hasInits = true;
|
@@ -58227,7 +58227,7 @@ var require_statements3 = __commonJS({
|
|
58227
58227
|
this.printList(node.declarations, node, {
|
58228
58228
|
separator
|
58229
58229
|
});
|
58230
|
-
if (
|
58230
|
+
if (t6().isFor(parent)) {
|
58231
58231
|
if (parent.left === node || parent.init === node) return;
|
58232
58232
|
}
|
58233
58233
|
this.semicolon();
|
@@ -58260,9 +58260,9 @@ var require_classes3 = __commonJS({
|
|
58260
58260
|
exports2.ClassMethod = ClassMethod;
|
58261
58261
|
exports2.ClassPrivateMethod = ClassPrivateMethod;
|
58262
58262
|
exports2._classMethodHead = _classMethodHead;
|
58263
|
-
function
|
58263
|
+
function t6() {
|
58264
58264
|
const data = _interopRequireWildcard(require("@babel/types"));
|
58265
|
-
|
58265
|
+
t6 = function() {
|
58266
58266
|
return data;
|
58267
58267
|
};
|
58268
58268
|
return data;
|
@@ -58289,7 +58289,7 @@ var require_classes3 = __commonJS({
|
|
58289
58289
|
}
|
58290
58290
|
}
|
58291
58291
|
function ClassDeclaration(node, parent) {
|
58292
|
-
if (!this.format.decoratorsBeforeExport || !
|
58292
|
+
if (!this.format.decoratorsBeforeExport || !t6().isExportDefaultDeclaration(parent) && !t6().isExportNamedDeclaration(parent)) {
|
58293
58293
|
this.printJoin(node.decorators, node);
|
58294
58294
|
}
|
58295
58295
|
if (node.declare) {
|
@@ -58436,9 +58436,9 @@ var require_methods3 = __commonJS({
|
|
58436
58436
|
exports2._functionHead = _functionHead;
|
58437
58437
|
exports2.FunctionDeclaration = exports2.FunctionExpression = FunctionExpression7;
|
58438
58438
|
exports2.ArrowFunctionExpression = ArrowFunctionExpression;
|
58439
|
-
function
|
58439
|
+
function t6() {
|
58440
58440
|
const data = _interopRequireWildcard(require("@babel/types"));
|
58441
|
-
|
58441
|
+
t6 = function() {
|
58442
58442
|
return data;
|
58443
58443
|
};
|
58444
58444
|
return data;
|
@@ -58548,7 +58548,7 @@ var require_methods3 = __commonJS({
|
|
58548
58548
|
this.space();
|
58549
58549
|
}
|
58550
58550
|
const firstParam = node.params[0];
|
58551
|
-
if (node.params.length === 1 &&
|
58551
|
+
if (node.params.length === 1 && t6().isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
|
58552
58552
|
if (this.format.retainLines && node.loc && node.body.loc && node.loc.start.line < node.body.loc.start.line) {
|
58553
58553
|
this.token("(");
|
58554
58554
|
if (firstParam.loc && firstParam.loc.start.line > node.loc.start.line) {
|
@@ -58595,9 +58595,9 @@ var require_modules3 = __commonJS({
|
|
58595
58595
|
exports2.ExportDefaultDeclaration = ExportDefaultDeclaration;
|
58596
58596
|
exports2.ImportDeclaration = ImportDeclaration;
|
58597
58597
|
exports2.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
|
58598
|
-
function
|
58598
|
+
function t6() {
|
58599
58599
|
const data = _interopRequireWildcard(require("@babel/types"));
|
58600
|
-
|
58600
|
+
t6 = function() {
|
58601
58601
|
return data;
|
58602
58602
|
};
|
58603
58603
|
return data;
|
@@ -58673,7 +58673,7 @@ var require_modules3 = __commonJS({
|
|
58673
58673
|
this.semicolon();
|
58674
58674
|
}
|
58675
58675
|
function ExportNamedDeclaration(node) {
|
58676
|
-
if (this.format.decoratorsBeforeExport &&
|
58676
|
+
if (this.format.decoratorsBeforeExport && t6().isClassDeclaration(node.declaration)) {
|
58677
58677
|
this.printJoin(node.declaration.decorators, node);
|
58678
58678
|
}
|
58679
58679
|
this.word("export");
|
@@ -58681,7 +58681,7 @@ var require_modules3 = __commonJS({
|
|
58681
58681
|
ExportDeclaration.apply(this, arguments);
|
58682
58682
|
}
|
58683
58683
|
function ExportDefaultDeclaration(node) {
|
58684
|
-
if (this.format.decoratorsBeforeExport &&
|
58684
|
+
if (this.format.decoratorsBeforeExport && t6().isClassDeclaration(node.declaration)) {
|
58685
58685
|
this.printJoin(node.declaration.decorators, node);
|
58686
58686
|
}
|
58687
58687
|
this.word("export");
|
@@ -58694,7 +58694,7 @@ var require_modules3 = __commonJS({
|
|
58694
58694
|
if (node.declaration) {
|
58695
58695
|
const declar = node.declaration;
|
58696
58696
|
this.print(declar, node);
|
58697
|
-
if (!
|
58697
|
+
if (!t6().isStatement(declar)) this.semicolon();
|
58698
58698
|
} else {
|
58699
58699
|
if (node.exportKind === "type") {
|
58700
58700
|
this.word("type");
|
@@ -58704,7 +58704,7 @@ var require_modules3 = __commonJS({
|
|
58704
58704
|
let hasSpecial = false;
|
58705
58705
|
while (true) {
|
58706
58706
|
const first = specifiers[0];
|
58707
|
-
if (
|
58707
|
+
if (t6().isExportDefaultSpecifier(first) || t6().isExportNamespaceSpecifier(first)) {
|
58708
58708
|
hasSpecial = true;
|
58709
58709
|
this.print(specifiers.shift(), node);
|
58710
58710
|
if (specifiers.length) {
|
@@ -58744,7 +58744,7 @@ var require_modules3 = __commonJS({
|
|
58744
58744
|
if (specifiers && specifiers.length) {
|
58745
58745
|
while (true) {
|
58746
58746
|
const first = specifiers[0];
|
58747
|
-
if (
|
58747
|
+
if (t6().isImportDefaultSpecifier(first) || t6().isImportNamespaceSpecifier(first)) {
|
58748
58748
|
this.print(specifiers.shift(), node);
|
58749
58749
|
if (specifiers.length) {
|
58750
58750
|
this.token(",");
|
@@ -59070,7 +59070,7 @@ var require_types3 = __commonJS({
|
|
59070
59070
|
Object.defineProperty(exports2, "__esModule", {
|
59071
59071
|
value: true
|
59072
59072
|
});
|
59073
|
-
exports2.Identifier =
|
59073
|
+
exports2.Identifier = Identifier29;
|
59074
59074
|
exports2.SpreadElement = exports2.RestElement = RestElement;
|
59075
59075
|
exports2.ObjectPattern = exports2.ObjectExpression = ObjectExpression;
|
59076
59076
|
exports2.ObjectMethod = ObjectMethod3;
|
@@ -59082,9 +59082,9 @@ var require_types3 = __commonJS({
|
|
59082
59082
|
exports2.NumericLiteral = NumericLiteral;
|
59083
59083
|
exports2.StringLiteral = StringLiteral;
|
59084
59084
|
exports2.BigIntLiteral = BigIntLiteral;
|
59085
|
-
function
|
59085
|
+
function t6() {
|
59086
59086
|
const data = _interopRequireWildcard(require("@babel/types"));
|
59087
|
-
|
59087
|
+
t6 = function() {
|
59088
59088
|
return data;
|
59089
59089
|
};
|
59090
59090
|
return data;
|
@@ -59120,7 +59120,7 @@ var require_types3 = __commonJS({
|
|
59120
59120
|
return newObj;
|
59121
59121
|
}
|
59122
59122
|
}
|
59123
|
-
function
|
59123
|
+
function Identifier29(node) {
|
59124
59124
|
this.exactSource(node.loc, () => {
|
59125
59125
|
this.word(node.name);
|
59126
59126
|
});
|
@@ -59156,12 +59156,12 @@ var require_types3 = __commonJS({
|
|
59156
59156
|
this.print(node.key, node);
|
59157
59157
|
this.token("]");
|
59158
59158
|
} else {
|
59159
|
-
if (
|
59159
|
+
if (t6().isAssignmentPattern(node.value) && t6().isIdentifier(node.key) && node.key.name === node.value.left.name) {
|
59160
59160
|
this.print(node.value, node);
|
59161
59161
|
return;
|
59162
59162
|
}
|
59163
59163
|
this.print(node.key, node);
|
59164
|
-
if (node.shorthand &&
|
59164
|
+
if (node.shorthand && t6().isIdentifier(node.key) && t6().isIdentifier(node.value) && node.key.name === node.value.name) {
|
59165
59165
|
return;
|
59166
59166
|
}
|
59167
59167
|
}
|
@@ -59299,9 +59299,9 @@ var require_flow3 = __commonJS({
|
|
59299
59299
|
return _types2.StringLiteral;
|
59300
59300
|
}
|
59301
59301
|
});
|
59302
|
-
function
|
59302
|
+
function t6() {
|
59303
59303
|
const data = _interopRequireWildcard(require("@babel/types"));
|
59304
|
-
|
59304
|
+
t6 = function() {
|
59305
59305
|
return data;
|
59306
59306
|
};
|
59307
59307
|
return data;
|
@@ -59347,7 +59347,7 @@ var require_flow3 = __commonJS({
|
|
59347
59347
|
this.word("null");
|
59348
59348
|
}
|
59349
59349
|
function DeclareClass(node, parent) {
|
59350
|
-
if (!
|
59350
|
+
if (!t6().isDeclareExportDeclaration(parent)) {
|
59351
59351
|
this.word("declare");
|
59352
59352
|
this.space();
|
59353
59353
|
}
|
@@ -59356,7 +59356,7 @@ var require_flow3 = __commonJS({
|
|
59356
59356
|
this._interfaceish(node);
|
59357
59357
|
}
|
59358
59358
|
function DeclareFunction(node, parent) {
|
59359
|
-
if (!
|
59359
|
+
if (!t6().isDeclareExportDeclaration(parent)) {
|
59360
59360
|
this.word("declare");
|
59361
59361
|
this.space();
|
59362
59362
|
}
|
@@ -59409,14 +59409,14 @@ var require_flow3 = __commonJS({
|
|
59409
59409
|
this.TypeAlias(node);
|
59410
59410
|
}
|
59411
59411
|
function DeclareOpaqueType(node, parent) {
|
59412
|
-
if (!
|
59412
|
+
if (!t6().isDeclareExportDeclaration(parent)) {
|
59413
59413
|
this.word("declare");
|
59414
59414
|
this.space();
|
59415
59415
|
}
|
59416
59416
|
this.OpaqueType(node);
|
59417
59417
|
}
|
59418
59418
|
function DeclareVariable(node, parent) {
|
59419
|
-
if (!
|
59419
|
+
if (!t6().isDeclareExportDeclaration(parent)) {
|
59420
59420
|
this.word("declare");
|
59421
59421
|
this.space();
|
59422
59422
|
}
|
@@ -59446,7 +59446,7 @@ var require_flow3 = __commonJS({
|
|
59446
59446
|
if (node.declaration) {
|
59447
59447
|
const declar = node.declaration;
|
59448
59448
|
this.print(declar, node);
|
59449
|
-
if (!
|
59449
|
+
if (!t6().isStatement(declar)) this.semicolon();
|
59450
59450
|
} else {
|
59451
59451
|
this.token("{");
|
59452
59452
|
if (node.specifiers.length) {
|
@@ -60693,9 +60693,9 @@ var require_printer3 = __commonJS({
|
|
60693
60693
|
}
|
60694
60694
|
var _buffer = _interopRequireDefault(require_buffer3());
|
60695
60695
|
var n = _interopRequireWildcard(require_node4());
|
60696
|
-
function
|
60696
|
+
function t6() {
|
60697
60697
|
const data = _interopRequireWildcard(require("@babel/types"));
|
60698
|
-
|
60698
|
+
t6 = function() {
|
60699
60699
|
return data;
|
60700
60700
|
};
|
60701
60701
|
return data;
|
@@ -60913,7 +60913,7 @@ var require_printer3 = __commonJS({
|
|
60913
60913
|
}
|
60914
60914
|
if (needsParens) this.token("(");
|
60915
60915
|
this._printLeadingComments(node);
|
60916
|
-
const loc =
|
60916
|
+
const loc = t6().isProgram(node) || t6().isFile(node) ? null : node.loc;
|
60917
60917
|
this.withSource("start", loc, () => {
|
60918
60918
|
this[node.type](node, parent);
|
60919
60919
|
});
|
@@ -60984,7 +60984,7 @@ var require_printer3 = __commonJS({
|
|
60984
60984
|
}
|
60985
60985
|
printBlock(parent) {
|
60986
60986
|
const node = parent.body;
|
60987
|
-
if (!
|
60987
|
+
if (!t6().isEmptyStatement(node)) {
|
60988
60988
|
this.space();
|
60989
60989
|
}
|
60990
60990
|
this.print(node, parent);
|
@@ -61580,19 +61580,19 @@ var require_conversions = __commonJS({
|
|
61580
61580
|
var f = h - Math.floor(h);
|
61581
61581
|
var p = 255 * v * (1 - s);
|
61582
61582
|
var q = 255 * v * (1 - s * f);
|
61583
|
-
var
|
61583
|
+
var t6 = 255 * v * (1 - s * (1 - f));
|
61584
61584
|
v *= 255;
|
61585
61585
|
switch (hi) {
|
61586
61586
|
case 0:
|
61587
|
-
return [v,
|
61587
|
+
return [v, t6, p];
|
61588
61588
|
case 1:
|
61589
61589
|
return [q, v, p];
|
61590
61590
|
case 2:
|
61591
|
-
return [p, v,
|
61591
|
+
return [p, v, t6];
|
61592
61592
|
case 3:
|
61593
61593
|
return [p, q, v];
|
61594
61594
|
case 4:
|
61595
|
-
return [
|
61595
|
+
return [t6, p, v];
|
61596
61596
|
case 5:
|
61597
61597
|
return [v, p, q];
|
61598
61598
|
}
|
@@ -62960,7 +62960,7 @@ var require_react_is_production_min = __commonJS({
|
|
62960
62960
|
var p = b ? Symbol.for("react.suspense") : 60113;
|
62961
62961
|
var q = b ? Symbol.for("react.suspense_list") : 60120;
|
62962
62962
|
var r = b ? Symbol.for("react.memo") : 60115;
|
62963
|
-
var
|
62963
|
+
var t6 = b ? Symbol.for("react.lazy") : 60116;
|
62964
62964
|
var v = b ? Symbol.for("react.block") : 60121;
|
62965
62965
|
var w = b ? Symbol.for("react.fundamental") : 60117;
|
62966
62966
|
var x = b ? Symbol.for("react.responder") : 60118;
|
@@ -62982,7 +62982,7 @@ var require_react_is_production_min = __commonJS({
|
|
62982
62982
|
switch (a = a && a.$$typeof, a) {
|
62983
62983
|
case k:
|
62984
62984
|
case n:
|
62985
|
-
case
|
62985
|
+
case t6:
|
62986
62986
|
case r:
|
62987
62987
|
case h:
|
62988
62988
|
return a;
|
@@ -63005,7 +63005,7 @@ var require_react_is_production_min = __commonJS({
|
|
63005
63005
|
exports2.Element = c2;
|
63006
63006
|
exports2.ForwardRef = n;
|
63007
63007
|
exports2.Fragment = e;
|
63008
|
-
exports2.Lazy =
|
63008
|
+
exports2.Lazy = t6;
|
63009
63009
|
exports2.Memo = r;
|
63010
63010
|
exports2.Portal = d;
|
63011
63011
|
exports2.Profiler = g;
|
@@ -63031,7 +63031,7 @@ var require_react_is_production_min = __commonJS({
|
|
63031
63031
|
return z2(a) === e;
|
63032
63032
|
};
|
63033
63033
|
exports2.isLazy = function(a) {
|
63034
|
-
return z2(a) ===
|
63034
|
+
return z2(a) === t6;
|
63035
63035
|
};
|
63036
63036
|
exports2.isMemo = function(a) {
|
63037
63037
|
return z2(a) === r;
|
@@ -63049,7 +63049,7 @@ var require_react_is_production_min = __commonJS({
|
|
63049
63049
|
return z2(a) === p;
|
63050
63050
|
};
|
63051
63051
|
exports2.isValidElementType = function(a) {
|
63052
|
-
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof ===
|
63052
|
+
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t6 || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
63053
63053
|
};
|
63054
63054
|
exports2.typeOf = z2;
|
63055
63055
|
}
|
@@ -63758,7 +63758,7 @@ __export(index_exports, {
|
|
63758
63758
|
compileProgram: () => compileProgram,
|
63759
63759
|
default: () => index_default,
|
63760
63760
|
findDirectiveDisablingMemoization: () => findDirectiveDisablingMemoization,
|
63761
|
-
findDirectiveEnablingMemoization: () =>
|
63761
|
+
findDirectiveEnablingMemoization: () => tryFindDirectiveEnablingMemoization,
|
63762
63762
|
parseConfigPragmaForTests: () => parseConfigPragmaForTests,
|
63763
63763
|
parsePluginOptions: () => parsePluginOptions,
|
63764
63764
|
printFunctionWithOutlined: () => printFunctionWithOutlined,
|
@@ -64291,7 +64291,7 @@ function buildFunctionExpression(node) {
|
|
64291
64291
|
}
|
64292
64292
|
|
64293
64293
|
// src/Entrypoint/Imports.ts
|
64294
|
-
var
|
64294
|
+
var t5 = __toESM(require("@babel/types"));
|
64295
64295
|
|
64296
64296
|
// src/HIR/HIR.ts
|
64297
64297
|
var t2 = __toESM(require("@babel/types"));
|
@@ -64460,8 +64460,8 @@ var ZodParsedType = util2.arrayToEnum([
|
|
64460
64460
|
"set"
|
64461
64461
|
]);
|
64462
64462
|
var getParsedType = (data) => {
|
64463
|
-
const
|
64464
|
-
switch (
|
64463
|
+
const t6 = typeof data;
|
64464
|
+
switch (t6) {
|
64465
64465
|
case "undefined":
|
64466
64466
|
return ZodParsedType.undefined;
|
64467
64467
|
case "string":
|
@@ -71106,7 +71106,7 @@ function newBlock(id, kind) {
|
|
71106
71106
|
}
|
71107
71107
|
var _completed, _current, _entry, _scopes, _context, _bindings, _env, _exceptionHandlerStack, _HIRBuilder_instances, resolveBabelBinding_fn;
|
71108
71108
|
var HIRBuilder = class {
|
71109
|
-
constructor(env,
|
71109
|
+
constructor(env, options) {
|
71110
71110
|
__privateAdd(this, _HIRBuilder_instances);
|
71111
71111
|
__privateAdd(this, _completed, /* @__PURE__ */ new Map());
|
71112
71112
|
__privateAdd(this, _current);
|
@@ -71122,12 +71122,12 @@ var HIRBuilder = class {
|
|
71122
71122
|
* of the current babel node.
|
71123
71123
|
*/
|
71124
71124
|
this.fbtDepth = 0;
|
71125
|
+
var _a, _b, _c;
|
71125
71126
|
__privateSet(this, _env, env);
|
71126
|
-
__privateSet(this, _bindings, bindings != null ?
|
71127
|
-
this
|
71128
|
-
__privateSet(this, _context, context != null ? context : []);
|
71127
|
+
__privateSet(this, _bindings, (_a = options == null ? void 0 : options.bindings) != null ? _a : /* @__PURE__ */ new Map());
|
71128
|
+
__privateSet(this, _context, (_b = options == null ? void 0 : options.context) != null ? _b : []);
|
71129
71129
|
__privateSet(this, _entry, makeBlockId(env.nextBlockId));
|
71130
|
-
__privateSet(this, _current, newBlock(__privateGet(this, _entry), "block"));
|
71130
|
+
__privateSet(this, _current, newBlock(__privateGet(this, _entry), (_c = options == null ? void 0 : options.entryBlockKind) != null ? _c : "block"));
|
71131
71131
|
}
|
71132
71132
|
get nextIdentifierId() {
|
71133
71133
|
return __privateGet(this, _env).nextIdentifierId;
|
@@ -71211,7 +71211,7 @@ var HIRBuilder = class {
|
|
71211
71211
|
if (babelBinding == null) {
|
71212
71212
|
return { kind: "Global", name: originalName };
|
71213
71213
|
}
|
71214
|
-
const outerBinding = this.parentFunction.scope.parent.getBinding(originalName);
|
71214
|
+
const outerBinding = __privateGet(this, _env).parentFunction.scope.parent.getBinding(originalName);
|
71215
71215
|
if (babelBinding === outerBinding) {
|
71216
71216
|
const path2 = babelBinding.path;
|
71217
71217
|
if (path2.isImportDefaultSpecifier()) {
|
@@ -71256,7 +71256,7 @@ var HIRBuilder = class {
|
|
71256
71256
|
isContextIdentifier(path) {
|
71257
71257
|
const binding = __privateMethod(this, _HIRBuilder_instances, resolveBabelBinding_fn).call(this, path);
|
71258
71258
|
if (binding) {
|
71259
|
-
const outerBinding = this.parentFunction.scope.parent.getBinding(
|
71259
|
+
const outerBinding = __privateGet(this, _env).parentFunction.scope.parent.getBinding(
|
71260
71260
|
path.node.name
|
71261
71261
|
);
|
71262
71262
|
if (binding === outerBinding) {
|
@@ -71347,6 +71347,7 @@ var HIRBuilder = class {
|
|
71347
71347
|
const nextId = __privateGet(this, _env).nextBlockId;
|
71348
71348
|
__privateSet(this, _current, newBlock(nextId, nextBlockKind));
|
71349
71349
|
}
|
71350
|
+
return blockId;
|
71350
71351
|
}
|
71351
71352
|
/*
|
71352
71353
|
* Terminate the current block w the given terminal, and set the previously
|
@@ -71588,6 +71589,11 @@ function getReversePostorderedBlocks(func) {
|
|
71588
71589
|
return;
|
71589
71590
|
}
|
71590
71591
|
const block = func.blocks.get(blockId);
|
71592
|
+
CompilerError.invariant(block != null, {
|
71593
|
+
reason: "[HIRBuilder] Unexpected null block",
|
71594
|
+
description: `expected block ${blockId} to exist`,
|
71595
|
+
loc: GeneratedSource
|
71596
|
+
});
|
71591
71597
|
const successors = [...eachTerminalSuccessor(block.terminal)].reverse();
|
71592
71598
|
const fallthrough = terminalFallthrough(block.terminal);
|
71593
71599
|
if (fallthrough != null) {
|
@@ -72696,9 +72702,12 @@ var DefaultNonmutatingHook = addHook(
|
|
72696
72702
|
);
|
72697
72703
|
|
72698
72704
|
// src/HIR/BuildHIR.ts
|
72699
|
-
function lower(func, env, bindings = null, capturedRefs = []
|
72705
|
+
function lower(func, env, bindings = null, capturedRefs = []) {
|
72700
72706
|
var _a, _b, _c;
|
72701
|
-
const builder = new HIRBuilder(env,
|
72707
|
+
const builder = new HIRBuilder(env, {
|
72708
|
+
bindings,
|
72709
|
+
context: capturedRefs
|
72710
|
+
});
|
72702
72711
|
const context = [];
|
72703
72712
|
for (const ref of capturedRefs != null ? capturedRefs : []) {
|
72704
72713
|
context.push({
|
@@ -72827,7 +72836,7 @@ function lower(func, env, bindings = null, capturedRefs = [], parent = null) {
|
|
72827
72836
|
return Ok({
|
72828
72837
|
id,
|
72829
72838
|
params,
|
72830
|
-
fnType:
|
72839
|
+
fnType: bindings == null ? env.fnType : "Other",
|
72831
72840
|
returnTypeAnnotation: null,
|
72832
72841
|
// TODO: extract the actual return type node if present
|
72833
72842
|
returnType: makeType(),
|
@@ -75620,15 +75629,12 @@ function lowerFunctionToValue(builder, expr) {
|
|
75620
75629
|
};
|
75621
75630
|
}
|
75622
75631
|
function lowerFunction(builder, expr) {
|
75623
|
-
const componentScope = builder.parentFunction.scope;
|
75632
|
+
const componentScope = builder.environment.parentFunction.scope;
|
75624
75633
|
const capturedContext = gatherCapturedContext(expr, componentScope);
|
75625
|
-
const lowering = lower(
|
75626
|
-
|
75627
|
-
|
75628
|
-
|
75629
|
-
[...builder.context, ...capturedContext],
|
75630
|
-
builder.parentFunction
|
75631
|
-
);
|
75634
|
+
const lowering = lower(expr, builder.environment, builder.bindings, [
|
75635
|
+
...builder.context,
|
75636
|
+
...capturedContext
|
75637
|
+
]);
|
75632
75638
|
let loweredFunc;
|
75633
75639
|
if (lowering.isErr()) {
|
75634
75640
|
lowering.unwrapErr().details.forEach((detail) => builder.errors.pushErrorDetail(detail));
|
@@ -78179,7 +78185,7 @@ var EnvironmentConfigSchema = z.object({
|
|
78179
78185
|
});
|
78180
78186
|
var _globals, _shapes, _moduleTypes, _nextIdentifer, _nextBlock, _nextScope, _scope, _outlinedFunctions, _contextIdentifiers, _hoistedIdentifiers, _Environment_instances, resolveModuleType_fn, isKnownReactModule_fn, getCustomHookType_fn;
|
78181
78187
|
var Environment = class {
|
78182
|
-
constructor(scope, fnType, compilerMode, config, contextIdentifiers, logger, filename, code, programContext) {
|
78188
|
+
constructor(scope, fnType, compilerMode, config, contextIdentifiers, parentFunction, logger, filename, code, programContext) {
|
78183
78189
|
__privateAdd(this, _Environment_instances);
|
78184
78190
|
__privateAdd(this, _globals);
|
78185
78191
|
__privateAdd(this, _shapes);
|
@@ -78236,6 +78242,7 @@ var Environment = class {
|
|
78236
78242
|
const reanimatedModuleType = getReanimatedModuleType(__privateGet(this, _shapes));
|
78237
78243
|
__privateGet(this, _moduleTypes).set(REANIMATED_MODULE_NAME, reanimatedModuleType);
|
78238
78244
|
}
|
78245
|
+
this.parentFunction = parentFunction;
|
78239
78246
|
__privateSet(this, _contextIdentifiers, contextIdentifiers);
|
78240
78247
|
__privateSet(this, _hoistedIdentifiers, /* @__PURE__ */ new Set());
|
78241
78248
|
}
|
@@ -79142,6 +79149,9 @@ function pruneUnusedLabelsHIR(fn) {
|
|
79142
79149
|
}
|
79143
79150
|
}
|
79144
79151
|
|
79152
|
+
// src/Entrypoint/Program.ts
|
79153
|
+
var t4 = __toESM(require("@babel/types"));
|
79154
|
+
|
79145
79155
|
// src/Utils/ComponentDeclaration.ts
|
79146
79156
|
function isComponentDeclaration(node) {
|
79147
79157
|
return Object.prototype.hasOwnProperty.call(node, "__componentDeclaration");
|
@@ -79314,8 +79324,8 @@ function handleAssignment(currentFn, identifiers, lvalPath) {
|
|
79314
79324
|
}
|
79315
79325
|
}
|
79316
79326
|
}
|
79317
|
-
function nonNull(
|
79318
|
-
return
|
79327
|
+
function nonNull(t6) {
|
79328
|
+
return t6.node != null;
|
79319
79329
|
}
|
79320
79330
|
|
79321
79331
|
// src/Optimization/ConstantPropagation.ts
|
@@ -85687,6 +85697,7 @@ function canMergeScopes(current, next) {
|
|
85687
85697
|
new Set(
|
85688
85698
|
[...current.scope.declarations.values()].map((declaration) => ({
|
85689
85699
|
identifier: declaration.identifier,
|
85700
|
+
reactive: true,
|
85690
85701
|
path: []
|
85691
85702
|
}))
|
85692
85703
|
),
|
@@ -90190,6 +90201,29 @@ function inferReactivePlaces(fn) {
|
|
90190
90201
|
}
|
90191
90202
|
}
|
90192
90203
|
} while (reactiveIdentifiers.snapshot());
|
90204
|
+
function propagateReactivityToInnerFunctions(fn2, isOutermost) {
|
90205
|
+
for (const [, block] of fn2.body.blocks) {
|
90206
|
+
for (const instr of block.instructions) {
|
90207
|
+
if (!isOutermost) {
|
90208
|
+
for (const operand of eachInstructionOperand(instr)) {
|
90209
|
+
reactiveIdentifiers.isReactive(operand);
|
90210
|
+
}
|
90211
|
+
}
|
90212
|
+
if (instr.value.kind === "ObjectMethod" || instr.value.kind === "FunctionExpression") {
|
90213
|
+
propagateReactivityToInnerFunctions(
|
90214
|
+
instr.value.loweredFunc.func,
|
90215
|
+
false
|
90216
|
+
);
|
90217
|
+
}
|
90218
|
+
}
|
90219
|
+
if (!isOutermost) {
|
90220
|
+
for (const operand of eachTerminalOperand(block.terminal)) {
|
90221
|
+
reactiveIdentifiers.isReactive(operand);
|
90222
|
+
}
|
90223
|
+
}
|
90224
|
+
}
|
90225
|
+
}
|
90226
|
+
propagateReactivityToInnerFunctions(fn, true);
|
90193
90227
|
}
|
90194
90228
|
function postDominatorFrontier(fn, postDominators, targetId) {
|
90195
90229
|
const visited = /* @__PURE__ */ new Set();
|
@@ -90449,7 +90483,7 @@ var PropertyPathRegistry = class _PropertyPathRegistry {
|
|
90449
90483
|
constructor() {
|
90450
90484
|
this.roots = /* @__PURE__ */ new Map();
|
90451
90485
|
}
|
90452
|
-
getOrCreateIdentifier(identifier4) {
|
90486
|
+
getOrCreateIdentifier(identifier4, reactive) {
|
90453
90487
|
let rootNode = this.roots.get(identifier4.id);
|
90454
90488
|
if (rootNode === void 0) {
|
90455
90489
|
rootNode = {
|
@@ -90458,12 +90492,18 @@ var PropertyPathRegistry = class _PropertyPathRegistry {
|
|
90458
90492
|
optionalProperties: /* @__PURE__ */ new Map(),
|
90459
90493
|
fullPath: {
|
90460
90494
|
identifier: identifier4,
|
90495
|
+
reactive,
|
90461
90496
|
path: []
|
90462
90497
|
},
|
90463
90498
|
hasOptional: false,
|
90464
90499
|
parent: null
|
90465
90500
|
};
|
90466
90501
|
this.roots.set(identifier4.id, rootNode);
|
90502
|
+
} else {
|
90503
|
+
CompilerError.invariant(reactive === rootNode.fullPath.reactive, {
|
90504
|
+
reason: "[HoistablePropertyLoads] Found inconsistencies in `reactive` flag when deduping identifier reads within the same scope",
|
90505
|
+
loc: identifier4.loc
|
90506
|
+
});
|
90467
90507
|
}
|
90468
90508
|
return rootNode;
|
90469
90509
|
}
|
@@ -90477,6 +90517,7 @@ var PropertyPathRegistry = class _PropertyPathRegistry {
|
|
90477
90517
|
parent,
|
90478
90518
|
fullPath: {
|
90479
90519
|
identifier: parent.fullPath.identifier,
|
90520
|
+
reactive: parent.fullPath.reactive,
|
90480
90521
|
path: parent.fullPath.path.concat(entry)
|
90481
90522
|
},
|
90482
90523
|
hasOptional: parent.hasOptional || entry.optional
|
@@ -90486,7 +90527,7 @@ var PropertyPathRegistry = class _PropertyPathRegistry {
|
|
90486
90527
|
return child;
|
90487
90528
|
}
|
90488
90529
|
getOrCreateProperty(n) {
|
90489
|
-
let currNode = this.getOrCreateIdentifier(n.identifier);
|
90530
|
+
let currNode = this.getOrCreateIdentifier(n.identifier, n.reactive);
|
90490
90531
|
if (n.path.length === 0) {
|
90491
90532
|
return currNode;
|
90492
90533
|
}
|
@@ -90508,6 +90549,7 @@ function getMaybeNonNullInInstruction(instr, context) {
|
|
90508
90549
|
if (instr.kind === "PropertyLoad") {
|
90509
90550
|
path = (_a = context.temporaries.get(instr.object.identifier.id)) != null ? _a : {
|
90510
90551
|
identifier: instr.object.identifier,
|
90552
|
+
reactive: instr.object.reactive,
|
90511
90553
|
path: []
|
90512
90554
|
};
|
90513
90555
|
} else if (instr.kind === "Destructure") {
|
@@ -90536,7 +90578,7 @@ function collectNonNullsInBlocks(fn, context) {
|
|
90536
90578
|
if (fn.fnType === "Component" && fn.params.length > 0 && fn.params[0].kind === "Identifier") {
|
90537
90579
|
const identifier4 = fn.params[0].identifier;
|
90538
90580
|
knownNonNullIdentifiers.add(
|
90539
|
-
context.registry.getOrCreateIdentifier(identifier4)
|
90581
|
+
context.registry.getOrCreateIdentifier(identifier4, true)
|
90540
90582
|
);
|
90541
90583
|
}
|
90542
90584
|
const nodes = /* @__PURE__ */ new Map();
|
@@ -90681,8 +90723,11 @@ function reduceMaybeOptionalChains(nodes, registry) {
|
|
90681
90723
|
do {
|
90682
90724
|
changed = false;
|
90683
90725
|
for (const original of optionalChainNodes) {
|
90684
|
-
let { identifier: identifier4, path: origPath } = original.fullPath;
|
90685
|
-
let currNode = registry.getOrCreateIdentifier(
|
90726
|
+
let { identifier: identifier4, path: origPath, reactive } = original.fullPath;
|
90727
|
+
let currNode = registry.getOrCreateIdentifier(
|
90728
|
+
identifier4,
|
90729
|
+
reactive
|
90730
|
+
);
|
90686
90731
|
for (let i = 0; i < origPath.length; i++) {
|
90687
90732
|
const entry = origPath[i];
|
90688
90733
|
const nextEntry = entry.optional && nodes.has(currNode) ? { property: entry.property, optional: false } : entry;
|
@@ -90902,6 +90947,7 @@ function traverseOptionalBlock(optional, context, outerAlternate) {
|
|
90902
90947
|
);
|
90903
90948
|
baseObject = {
|
90904
90949
|
identifier: maybeTest.instructions[0].value.place.identifier,
|
90950
|
+
reactive: maybeTest.instructions[0].value.place.reactive,
|
90905
90951
|
path
|
90906
90952
|
};
|
90907
90953
|
test = maybeTest.terminal;
|
@@ -90957,6 +91003,7 @@ function traverseOptionalBlock(optional, context, outerAlternate) {
|
|
90957
91003
|
);
|
90958
91004
|
const load = {
|
90959
91005
|
identifier: baseObject.identifier,
|
91006
|
+
reactive: baseObject.reactive,
|
90960
91007
|
path: [
|
90961
91008
|
...baseObject.path,
|
90962
91009
|
{
|
@@ -90993,8 +91040,8 @@ var _ReactiveScopeDependencyTreeHIR = class _ReactiveScopeDependencyTreeHIR {
|
|
90993
91040
|
__privateAdd(this, _hoistableObjects, /* @__PURE__ */ new Map());
|
90994
91041
|
__privateAdd(this, _deps, /* @__PURE__ */ new Map());
|
90995
91042
|
var _a, _b;
|
90996
|
-
for (const { path, identifier: identifier4 } of hoistableObjects) {
|
90997
|
-
let currNode = __privateMethod(_a = _ReactiveScopeDependencyTreeHIR, _ReactiveScopeDependencyTreeHIR_static, getOrCreateRoot_fn).call(_a, identifier4, __privateGet(this, _hoistableObjects), path.length > 0 && path[0].optional ? "Optional" : "NonNull");
|
91043
|
+
for (const { path, identifier: identifier4, reactive } of hoistableObjects) {
|
91044
|
+
let currNode = __privateMethod(_a = _ReactiveScopeDependencyTreeHIR, _ReactiveScopeDependencyTreeHIR_static, getOrCreateRoot_fn).call(_a, identifier4, reactive, __privateGet(this, _hoistableObjects), path.length > 0 && path[0].optional ? "Optional" : "NonNull");
|
90998
91045
|
for (let i = 0; i < path.length; i++) {
|
90999
91046
|
const prevAccessType = (_b = currNode.properties.get(
|
91000
91047
|
path[i].property
|
@@ -91026,8 +91073,8 @@ var _ReactiveScopeDependencyTreeHIR = class _ReactiveScopeDependencyTreeHIR {
|
|
91026
91073
|
*/
|
91027
91074
|
addDependency(dep) {
|
91028
91075
|
var _a;
|
91029
|
-
const { identifier: identifier4, path } = dep;
|
91030
|
-
let depCursor = __privateMethod(_a = _ReactiveScopeDependencyTreeHIR, _ReactiveScopeDependencyTreeHIR_static, getOrCreateRoot_fn).call(_a, identifier4, __privateGet(this, _deps), "UnconditionalAccess" /* UnconditionalAccess */);
|
91076
|
+
const { identifier: identifier4, reactive, path } = dep;
|
91077
|
+
let depCursor = __privateMethod(_a = _ReactiveScopeDependencyTreeHIR, _ReactiveScopeDependencyTreeHIR_static, getOrCreateRoot_fn).call(_a, identifier4, reactive, __privateGet(this, _deps), "UnconditionalAccess" /* UnconditionalAccess */);
|
91031
91078
|
let hoistableCursor = __privateGet(this, _hoistableObjects).get(identifier4);
|
91032
91079
|
for (const entry of path) {
|
91033
91080
|
let nextHoistableCursor;
|
@@ -91068,7 +91115,13 @@ var _ReactiveScopeDependencyTreeHIR = class _ReactiveScopeDependencyTreeHIR {
|
|
91068
91115
|
deriveMinimalDependencies() {
|
91069
91116
|
const results = /* @__PURE__ */ new Set();
|
91070
91117
|
for (const [rootId, rootNode] of __privateGet(this, _deps).entries()) {
|
91071
|
-
collectMinimalDependenciesInSubtree(
|
91118
|
+
collectMinimalDependenciesInSubtree(
|
91119
|
+
rootNode,
|
91120
|
+
rootNode.reactive,
|
91121
|
+
rootId,
|
91122
|
+
[],
|
91123
|
+
results
|
91124
|
+
);
|
91072
91125
|
}
|
91073
91126
|
return results;
|
91074
91127
|
}
|
@@ -91100,14 +91153,21 @@ var _ReactiveScopeDependencyTreeHIR = class _ReactiveScopeDependencyTreeHIR {
|
|
91100
91153
|
_hoistableObjects = new WeakMap();
|
91101
91154
|
_deps = new WeakMap();
|
91102
91155
|
_ReactiveScopeDependencyTreeHIR_static = new WeakSet();
|
91103
|
-
getOrCreateRoot_fn = function(identifier4, roots, defaultAccessType) {
|
91156
|
+
getOrCreateRoot_fn = function(identifier4, reactive, roots, defaultAccessType) {
|
91104
91157
|
let rootNode = roots.get(identifier4);
|
91105
91158
|
if (rootNode === void 0) {
|
91106
91159
|
rootNode = {
|
91107
91160
|
properties: /* @__PURE__ */ new Map(),
|
91161
|
+
reactive,
|
91108
91162
|
accessType: defaultAccessType
|
91109
91163
|
};
|
91110
91164
|
roots.set(identifier4, rootNode);
|
91165
|
+
} else {
|
91166
|
+
CompilerError.invariant(reactive === rootNode.reactive, {
|
91167
|
+
reason: "[DeriveMinimalDependenciesHIR] Conflicting reactive root flag",
|
91168
|
+
description: `Identifier ${printIdentifier(identifier4)}`,
|
91169
|
+
loc: GeneratedSource
|
91170
|
+
});
|
91111
91171
|
}
|
91112
91172
|
return rootNode;
|
91113
91173
|
};
|
@@ -91142,13 +91202,14 @@ function merge(access1, access2) {
|
|
91142
91202
|
}
|
91143
91203
|
}
|
91144
91204
|
}
|
91145
|
-
function collectMinimalDependenciesInSubtree(node, rootIdentifier, path, results) {
|
91205
|
+
function collectMinimalDependenciesInSubtree(node, reactive, rootIdentifier, path, results) {
|
91146
91206
|
if (isDependency(node.accessType)) {
|
91147
|
-
results.add({ identifier: rootIdentifier, path });
|
91207
|
+
results.add({ identifier: rootIdentifier, reactive, path });
|
91148
91208
|
} else {
|
91149
91209
|
for (const [childName, childNode] of node.properties) {
|
91150
91210
|
collectMinimalDependenciesInSubtree(
|
91151
91211
|
childNode,
|
91212
|
+
reactive,
|
91152
91213
|
rootIdentifier,
|
91153
91214
|
[
|
91154
91215
|
...path,
|
@@ -91316,6 +91377,7 @@ function collectTemporariesSidemapImpl(fn, usedOutsideDeclaringScope, temporarie
|
|
91316
91377
|
)) {
|
91317
91378
|
temporaries.set(lvalue.identifier.id, {
|
91318
91379
|
identifier: value.place.identifier,
|
91380
|
+
reactive: value.place.reactive,
|
91319
91381
|
path: []
|
91320
91382
|
});
|
91321
91383
|
}
|
@@ -91336,11 +91398,13 @@ function getProperty(object, propertyName, optional, temporaries) {
|
|
91336
91398
|
if (resolvedDependency == null) {
|
91337
91399
|
property = {
|
91338
91400
|
identifier: object.identifier,
|
91401
|
+
reactive: object.reactive,
|
91339
91402
|
path: [{ property: propertyName, optional }]
|
91340
91403
|
};
|
91341
91404
|
} else {
|
91342
91405
|
property = {
|
91343
91406
|
identifier: resolvedDependency.identifier,
|
91407
|
+
reactive: resolvedDependency.reactive,
|
91344
91408
|
path: [...resolvedDependency.path, { property: propertyName, optional }]
|
91345
91409
|
};
|
91346
91410
|
}
|
@@ -91429,6 +91493,7 @@ var DependencyCollectionContext = class {
|
|
91429
91493
|
this.visitDependency(
|
91430
91494
|
(_a = __privateGet(this, _temporaries).get(place.identifier.id)) != null ? _a : {
|
91431
91495
|
identifier: place.identifier,
|
91496
|
+
reactive: place.reactive,
|
91432
91497
|
path: []
|
91433
91498
|
}
|
91434
91499
|
);
|
@@ -91463,6 +91528,7 @@ var DependencyCollectionContext = class {
|
|
91463
91528
|
if (isUseRefType(maybeDependency.identifier) && ((_a = maybeDependency.path.at(0)) == null ? void 0 : _a.property) === "current") {
|
91464
91529
|
maybeDependency = {
|
91465
91530
|
identifier: maybeDependency.identifier,
|
91531
|
+
reactive: maybeDependency.reactive,
|
91466
91532
|
path: []
|
91467
91533
|
};
|
91468
91534
|
}
|
@@ -91479,7 +91545,11 @@ var DependencyCollectionContext = class {
|
|
91479
91545
|
if (currentScope != null && !Iterable_some(
|
91480
91546
|
currentScope.reassignments,
|
91481
91547
|
(identifier4) => identifier4.declarationId === place.identifier.declarationId
|
91482
|
-
) && __privateMethod(this, _DependencyCollectionContext_instances, checkValidDependency_fn).call(this, {
|
91548
|
+
) && __privateMethod(this, _DependencyCollectionContext_instances, checkValidDependency_fn).call(this, {
|
91549
|
+
identifier: place.identifier,
|
91550
|
+
reactive: place.reactive,
|
91551
|
+
path: []
|
91552
|
+
})) {
|
91483
91553
|
currentScope.reassignments.add(place.identifier);
|
91484
91554
|
}
|
91485
91555
|
}
|
@@ -91651,10 +91721,215 @@ function collectDependencies(fn, usedOutsideDeclaringScope, temporaries, process
|
|
91651
91721
|
return context.deps;
|
91652
91722
|
}
|
91653
91723
|
|
91724
|
+
// src/HIR/ScopeDependencyUtils.ts
|
91725
|
+
function buildDependencyInstructions(dep, env) {
|
91726
|
+
const builder = new HIRBuilder(env, {
|
91727
|
+
entryBlockKind: "value"
|
91728
|
+
});
|
91729
|
+
let dependencyValue;
|
91730
|
+
if (dep.path.every((path) => !path.optional)) {
|
91731
|
+
dependencyValue = writeNonOptionalDependency(dep, env, builder);
|
91732
|
+
} else {
|
91733
|
+
dependencyValue = writeOptionalDependency(dep, builder, null);
|
91734
|
+
}
|
91735
|
+
const exitBlockId = builder.terminate(
|
91736
|
+
{
|
91737
|
+
kind: "unsupported",
|
91738
|
+
loc: GeneratedSource,
|
91739
|
+
id: makeInstructionId(0)
|
91740
|
+
},
|
91741
|
+
null
|
91742
|
+
);
|
91743
|
+
return {
|
91744
|
+
place: {
|
91745
|
+
kind: "Identifier",
|
91746
|
+
identifier: dependencyValue,
|
91747
|
+
effect: "freeze" /* Freeze */,
|
91748
|
+
reactive: dep.reactive,
|
91749
|
+
loc: GeneratedSource
|
91750
|
+
},
|
91751
|
+
value: builder.build(),
|
91752
|
+
exitBlockId
|
91753
|
+
};
|
91754
|
+
}
|
91755
|
+
function writeNonOptionalDependency(dep, env, builder) {
|
91756
|
+
const loc = dep.identifier.loc;
|
91757
|
+
let curr = makeTemporaryIdentifier(env.nextIdentifierId, loc);
|
91758
|
+
builder.push({
|
91759
|
+
lvalue: {
|
91760
|
+
identifier: curr,
|
91761
|
+
kind: "Identifier",
|
91762
|
+
effect: "mutate" /* Mutate */,
|
91763
|
+
reactive: dep.reactive,
|
91764
|
+
loc
|
91765
|
+
},
|
91766
|
+
value: {
|
91767
|
+
kind: "LoadLocal",
|
91768
|
+
place: {
|
91769
|
+
identifier: dep.identifier,
|
91770
|
+
kind: "Identifier",
|
91771
|
+
effect: "freeze" /* Freeze */,
|
91772
|
+
reactive: dep.reactive,
|
91773
|
+
loc
|
91774
|
+
},
|
91775
|
+
loc
|
91776
|
+
},
|
91777
|
+
id: makeInstructionId(1),
|
91778
|
+
loc
|
91779
|
+
});
|
91780
|
+
for (const path of dep.path) {
|
91781
|
+
const next = makeTemporaryIdentifier(env.nextIdentifierId, loc);
|
91782
|
+
builder.push({
|
91783
|
+
lvalue: {
|
91784
|
+
identifier: next,
|
91785
|
+
kind: "Identifier",
|
91786
|
+
effect: "mutate" /* Mutate */,
|
91787
|
+
reactive: dep.reactive,
|
91788
|
+
loc
|
91789
|
+
},
|
91790
|
+
value: {
|
91791
|
+
kind: "PropertyLoad",
|
91792
|
+
object: {
|
91793
|
+
identifier: curr,
|
91794
|
+
kind: "Identifier",
|
91795
|
+
effect: "freeze" /* Freeze */,
|
91796
|
+
reactive: dep.reactive,
|
91797
|
+
loc
|
91798
|
+
},
|
91799
|
+
property: path.property,
|
91800
|
+
loc
|
91801
|
+
},
|
91802
|
+
id: makeInstructionId(1),
|
91803
|
+
loc
|
91804
|
+
});
|
91805
|
+
curr = next;
|
91806
|
+
}
|
91807
|
+
return curr;
|
91808
|
+
}
|
91809
|
+
function writeOptionalDependency(dep, builder, parentAlternate) {
|
91810
|
+
const env = builder.environment;
|
91811
|
+
const dependencyValue = {
|
91812
|
+
kind: "Identifier",
|
91813
|
+
identifier: makeTemporaryIdentifier(env.nextIdentifierId, GeneratedSource),
|
91814
|
+
effect: "mutate" /* Mutate */,
|
91815
|
+
reactive: dep.reactive,
|
91816
|
+
loc: GeneratedSource
|
91817
|
+
};
|
91818
|
+
const continuationBlock = builder.reserve(builder.currentBlockKind());
|
91819
|
+
let alternate;
|
91820
|
+
if (parentAlternate != null) {
|
91821
|
+
alternate = parentAlternate;
|
91822
|
+
} else {
|
91823
|
+
alternate = builder.enter("value", () => {
|
91824
|
+
const temp = lowerValueToTemporary(builder, {
|
91825
|
+
kind: "Primitive",
|
91826
|
+
value: void 0,
|
91827
|
+
loc: GeneratedSource
|
91828
|
+
});
|
91829
|
+
lowerValueToTemporary(builder, {
|
91830
|
+
kind: "StoreLocal",
|
91831
|
+
lvalue: { kind: "Const" /* Const */, place: __spreadValues({}, dependencyValue) },
|
91832
|
+
value: __spreadValues({}, temp),
|
91833
|
+
type: null,
|
91834
|
+
loc: GeneratedSource
|
91835
|
+
});
|
91836
|
+
return {
|
91837
|
+
kind: "goto",
|
91838
|
+
variant: "Break" /* Break */,
|
91839
|
+
block: continuationBlock.id,
|
91840
|
+
id: makeInstructionId(0),
|
91841
|
+
loc: GeneratedSource
|
91842
|
+
};
|
91843
|
+
});
|
91844
|
+
}
|
91845
|
+
const consequent = builder.reserve("value");
|
91846
|
+
let testIdentifier = null;
|
91847
|
+
const testBlock = builder.enter("value", () => {
|
91848
|
+
const testDependency = __spreadProps(__spreadValues({}, dep), {
|
91849
|
+
path: dep.path.slice(0, dep.path.length - 1)
|
91850
|
+
});
|
91851
|
+
const firstOptional = dep.path.findIndex((path) => path.optional);
|
91852
|
+
CompilerError.invariant(firstOptional !== -1, {
|
91853
|
+
reason: "[ScopeDependencyUtils] Internal invariant broken: expected optional path",
|
91854
|
+
loc: dep.identifier.loc,
|
91855
|
+
description: null,
|
91856
|
+
suggestions: null
|
91857
|
+
});
|
91858
|
+
if (firstOptional === dep.path.length - 1) {
|
91859
|
+
testIdentifier = writeNonOptionalDependency(testDependency, env, builder);
|
91860
|
+
} else {
|
91861
|
+
testIdentifier = writeOptionalDependency(
|
91862
|
+
testDependency,
|
91863
|
+
builder,
|
91864
|
+
alternate
|
91865
|
+
);
|
91866
|
+
}
|
91867
|
+
return {
|
91868
|
+
kind: "branch",
|
91869
|
+
test: {
|
91870
|
+
identifier: testIdentifier,
|
91871
|
+
effect: "freeze" /* Freeze */,
|
91872
|
+
kind: "Identifier",
|
91873
|
+
loc: GeneratedSource,
|
91874
|
+
reactive: dep.reactive
|
91875
|
+
},
|
91876
|
+
consequent: consequent.id,
|
91877
|
+
alternate,
|
91878
|
+
id: makeInstructionId(0),
|
91879
|
+
loc: GeneratedSource,
|
91880
|
+
fallthrough: continuationBlock.id
|
91881
|
+
};
|
91882
|
+
});
|
91883
|
+
builder.enterReserved(consequent, () => {
|
91884
|
+
CompilerError.invariant(testIdentifier !== null, {
|
91885
|
+
reason: "Satisfy type checker",
|
91886
|
+
description: null,
|
91887
|
+
loc: null,
|
91888
|
+
suggestions: null
|
91889
|
+
});
|
91890
|
+
lowerValueToTemporary(builder, {
|
91891
|
+
kind: "StoreLocal",
|
91892
|
+
lvalue: { kind: "Const" /* Const */, place: __spreadValues({}, dependencyValue) },
|
91893
|
+
value: lowerValueToTemporary(builder, {
|
91894
|
+
kind: "PropertyLoad",
|
91895
|
+
object: {
|
91896
|
+
identifier: testIdentifier,
|
91897
|
+
kind: "Identifier",
|
91898
|
+
effect: "freeze" /* Freeze */,
|
91899
|
+
reactive: dep.reactive,
|
91900
|
+
loc: GeneratedSource
|
91901
|
+
},
|
91902
|
+
property: dep.path.at(-1).property,
|
91903
|
+
loc: GeneratedSource
|
91904
|
+
}),
|
91905
|
+
type: null,
|
91906
|
+
loc: GeneratedSource
|
91907
|
+
});
|
91908
|
+
return {
|
91909
|
+
kind: "goto",
|
91910
|
+
variant: "Break" /* Break */,
|
91911
|
+
block: continuationBlock.id,
|
91912
|
+
id: makeInstructionId(0),
|
91913
|
+
loc: GeneratedSource
|
91914
|
+
};
|
91915
|
+
});
|
91916
|
+
builder.terminateWithContinuation(
|
91917
|
+
{
|
91918
|
+
kind: "optional",
|
91919
|
+
optional: dep.path.at(-1).optional,
|
91920
|
+
test: testBlock,
|
91921
|
+
fallthrough: continuationBlock.id,
|
91922
|
+
id: makeInstructionId(0),
|
91923
|
+
loc: GeneratedSource
|
91924
|
+
},
|
91925
|
+
continuationBlock
|
91926
|
+
);
|
91927
|
+
return dependencyValue.identifier;
|
91928
|
+
}
|
91929
|
+
|
91654
91930
|
// src/Inference/InferEffectDependencies.ts
|
91655
91931
|
function inferEffectDependencies(fn) {
|
91656
91932
|
var _a, _b;
|
91657
|
-
let hasRewrite = false;
|
91658
91933
|
const fnExpressions = /* @__PURE__ */ new Map();
|
91659
91934
|
const autodepFnConfigs = /* @__PURE__ */ new Map();
|
91660
91935
|
for (const effectTarget of fn.env.config.inferEffectDependencies) {
|
@@ -91673,6 +91948,7 @@ function inferEffectDependencies(fn) {
|
|
91673
91948
|
const scopeInfos = /* @__PURE__ */ new Map();
|
91674
91949
|
const loadGlobals = /* @__PURE__ */ new Set();
|
91675
91950
|
const reactiveIds = inferReactiveIdentifiers(fn);
|
91951
|
+
const rewriteBlocks = [];
|
91676
91952
|
for (const [, block] of fn.body.blocks) {
|
91677
91953
|
if (block.terminal.kind === "scope") {
|
91678
91954
|
const scopeBlock = fn.body.blocks.get(block.terminal.block);
|
@@ -91683,7 +91959,7 @@ function inferEffectDependencies(fn) {
|
|
91683
91959
|
);
|
91684
91960
|
}
|
91685
91961
|
}
|
91686
|
-
const rewriteInstrs =
|
91962
|
+
const rewriteInstrs = [];
|
91687
91963
|
for (const instr of block.instructions) {
|
91688
91964
|
const { value, lvalue } = instr;
|
91689
91965
|
if (value.kind === "FunctionExpression") {
|
@@ -91724,7 +92000,6 @@ function inferEffectDependencies(fn) {
|
|
91724
92000
|
const callee = value.kind === "CallExpression" ? value.callee : value.property;
|
91725
92001
|
if (value.args.length === autodepFnLoads.get(callee.identifier.id) && value.args[0].kind === "Identifier") {
|
91726
92002
|
const effectDeps = [];
|
91727
|
-
const newInstructions = [];
|
91728
92003
|
const deps = {
|
91729
92004
|
kind: "ArrayExpression",
|
91730
92005
|
elements: effectDeps,
|
@@ -91742,17 +92017,21 @@ function inferEffectDependencies(fn) {
|
|
91742
92017
|
minimalDeps = inferMinimalDependencies(fnExpr);
|
91743
92018
|
}
|
91744
92019
|
const usedDeps = [];
|
91745
|
-
for (const
|
91746
|
-
if ((isUseRefType(
|
92020
|
+
for (const maybeDep of minimalDeps) {
|
92021
|
+
if ((isUseRefType(maybeDep.identifier) || isSetStateType(maybeDep.identifier)) && !reactiveIds.has(maybeDep.identifier.id) || isFireFunctionType(maybeDep.identifier)) {
|
91747
92022
|
continue;
|
91748
92023
|
}
|
91749
|
-
const
|
92024
|
+
const dep = truncateDepAtCurrent(maybeDep);
|
92025
|
+
const { place, value: value2, exitBlockId } = buildDependencyInstructions(
|
91750
92026
|
dep,
|
91751
|
-
|
91752
|
-
fn.env,
|
91753
|
-
fnExpr.loc
|
92027
|
+
fn.env
|
91754
92028
|
);
|
91755
|
-
|
92029
|
+
rewriteInstrs.push({
|
92030
|
+
kind: "block",
|
92031
|
+
location: instr.id,
|
92032
|
+
value: value2,
|
92033
|
+
exitBlockId
|
92034
|
+
});
|
91756
92035
|
effectDeps.push(place);
|
91757
92036
|
usedDeps.push(dep);
|
91758
92037
|
}
|
@@ -91770,24 +92049,30 @@ function inferEffectDependencies(fn) {
|
|
91770
92049
|
decorations
|
91771
92050
|
});
|
91772
92051
|
}
|
91773
|
-
|
91774
|
-
|
91775
|
-
|
91776
|
-
|
91777
|
-
|
92052
|
+
rewriteInstrs.push({
|
92053
|
+
kind: "instr",
|
92054
|
+
location: instr.id,
|
92055
|
+
value: {
|
92056
|
+
id: makeInstructionId(0),
|
92057
|
+
loc: GeneratedSource,
|
92058
|
+
lvalue: __spreadProps(__spreadValues({}, depsPlace), { effect: "mutate" /* Mutate */ }),
|
92059
|
+
value: deps
|
92060
|
+
}
|
91778
92061
|
});
|
91779
92062
|
value.args.push(__spreadProps(__spreadValues({}, depsPlace), { effect: "freeze" /* Freeze */ }));
|
91780
|
-
rewriteInstrs.set(instr.id, newInstructions);
|
91781
92063
|
fn.env.inferredEffectLocations.add(callee.loc);
|
91782
92064
|
} else if (loadGlobals.has(value.args[0].identifier.id)) {
|
91783
|
-
|
91784
|
-
|
91785
|
-
|
91786
|
-
|
91787
|
-
|
92065
|
+
rewriteInstrs.push({
|
92066
|
+
kind: "instr",
|
92067
|
+
location: instr.id,
|
92068
|
+
value: {
|
92069
|
+
id: makeInstructionId(0),
|
92070
|
+
loc: GeneratedSource,
|
92071
|
+
lvalue: __spreadProps(__spreadValues({}, depsPlace), { effect: "mutate" /* Mutate */ }),
|
92072
|
+
value: deps
|
92073
|
+
}
|
91788
92074
|
});
|
91789
92075
|
value.args.push(__spreadProps(__spreadValues({}, depsPlace), { effect: "freeze" /* Freeze */ }));
|
91790
|
-
rewriteInstrs.set(instr.id, newInstructions);
|
91791
92076
|
fn.env.inferredEffectLocations.add(callee.loc);
|
91792
92077
|
}
|
91793
92078
|
} else if (value.args.length >= 2 && value.args.length - 1 === autodepFnLoads.get(callee.identifier.id) && value.args[0] != null && value.args[0].kind === "Identifier") {
|
@@ -91806,70 +92091,81 @@ function inferEffectDependencies(fn) {
|
|
91806
92091
|
}
|
91807
92092
|
}
|
91808
92093
|
}
|
91809
|
-
|
91810
|
-
hasRewrite = true;
|
91811
|
-
const newInstrs = [];
|
91812
|
-
for (const instr of block.instructions) {
|
91813
|
-
const newInstr = rewriteInstrs.get(instr.id);
|
91814
|
-
if (newInstr != null) {
|
91815
|
-
newInstrs.push(...newInstr, instr);
|
91816
|
-
} else {
|
91817
|
-
newInstrs.push(instr);
|
91818
|
-
}
|
91819
|
-
}
|
91820
|
-
block.instructions = newInstrs;
|
91821
|
-
}
|
92094
|
+
rewriteSplices(block, rewriteInstrs, rewriteBlocks);
|
91822
92095
|
}
|
91823
|
-
if (
|
92096
|
+
if (rewriteBlocks.length > 0) {
|
92097
|
+
for (const block of rewriteBlocks) {
|
92098
|
+
fn.body.blocks.set(block.id, block);
|
92099
|
+
}
|
92100
|
+
reversePostorderBlocks(fn.body);
|
92101
|
+
markPredecessors(fn.body);
|
91824
92102
|
markInstructionIds(fn.body);
|
91825
92103
|
fixScopeAndIdentifierRanges(fn.body);
|
91826
92104
|
fn.env.hasInferredEffect = true;
|
91827
92105
|
}
|
91828
92106
|
}
|
91829
|
-
function
|
91830
|
-
const
|
91831
|
-
|
91832
|
-
|
91833
|
-
|
91834
|
-
|
91835
|
-
|
91836
|
-
|
91837
|
-
|
91838
|
-
|
91839
|
-
|
91840
|
-
|
91841
|
-
|
91842
|
-
|
91843
|
-
|
91844
|
-
|
91845
|
-
|
91846
|
-
|
91847
|
-
|
91848
|
-
|
91849
|
-
|
91850
|
-
|
91851
|
-
|
91852
|
-
|
91853
|
-
|
91854
|
-
|
92107
|
+
function truncateDepAtCurrent(dep) {
|
92108
|
+
const idx = dep.path.findIndex((path) => path.property === "current");
|
92109
|
+
if (idx === -1) {
|
92110
|
+
return dep;
|
92111
|
+
} else {
|
92112
|
+
return __spreadProps(__spreadValues({}, dep), { path: dep.path.slice(0, idx) });
|
92113
|
+
}
|
92114
|
+
}
|
92115
|
+
function rewriteSplices(originalBlock, splices, rewriteBlocks) {
|
92116
|
+
if (splices.length === 0) {
|
92117
|
+
return;
|
92118
|
+
}
|
92119
|
+
const originalInstrs = originalBlock.instructions;
|
92120
|
+
let currBlock = __spreadProps(__spreadValues({}, originalBlock), { instructions: [] });
|
92121
|
+
rewriteBlocks.push(currBlock);
|
92122
|
+
let cursor = 0;
|
92123
|
+
for (const rewrite of splices) {
|
92124
|
+
while (originalInstrs[cursor].id < rewrite.location) {
|
92125
|
+
CompilerError.invariant(
|
92126
|
+
originalInstrs[cursor].id < originalInstrs[cursor + 1].id,
|
92127
|
+
{
|
92128
|
+
reason: "[InferEffectDependencies] Internal invariant broken: expected block instructions to be sorted",
|
92129
|
+
loc: originalInstrs[cursor].loc
|
92130
|
+
}
|
92131
|
+
);
|
92132
|
+
currBlock.instructions.push(originalInstrs[cursor]);
|
92133
|
+
cursor++;
|
91855
92134
|
}
|
91856
|
-
|
91857
|
-
|
91858
|
-
|
91859
|
-
id: makeInstructionId(0),
|
91860
|
-
loc: GeneratedSource,
|
91861
|
-
lvalue: __spreadProps(__spreadValues({}, nextValue), { effect: "mutate" /* Mutate */ }),
|
91862
|
-
value: {
|
91863
|
-
kind: "PropertyLoad",
|
91864
|
-
object: __spreadProps(__spreadValues({}, currValue), { effect: "capture" /* Capture */ }),
|
91865
|
-
property: path.property,
|
91866
|
-
loc
|
91867
|
-
}
|
92135
|
+
CompilerError.invariant(originalInstrs[cursor].id === rewrite.location, {
|
92136
|
+
reason: "[InferEffectDependencies] Internal invariant broken: splice location not found",
|
92137
|
+
loc: originalInstrs[cursor].loc
|
91868
92138
|
});
|
91869
|
-
|
92139
|
+
if (rewrite.kind === "instr") {
|
92140
|
+
currBlock.instructions.push(rewrite.value);
|
92141
|
+
} else {
|
92142
|
+
const { entry, blocks } = rewrite.value;
|
92143
|
+
const entryBlock = blocks.get(entry);
|
92144
|
+
currBlock.instructions.push(...entryBlock.instructions);
|
92145
|
+
if (blocks.size > 1) {
|
92146
|
+
CompilerError.invariant(
|
92147
|
+
terminalFallthrough(entryBlock.terminal) === rewrite.exitBlockId,
|
92148
|
+
{
|
92149
|
+
reason: "[InferEffectDependencies] Internal invariant broken: expected entry block to have a fallthrough",
|
92150
|
+
loc: entryBlock.terminal.loc
|
92151
|
+
}
|
92152
|
+
);
|
92153
|
+
const originalTerminal = currBlock.terminal;
|
92154
|
+
currBlock.terminal = entryBlock.terminal;
|
92155
|
+
for (const [id, block] of blocks) {
|
92156
|
+
if (id === entry) {
|
92157
|
+
continue;
|
92158
|
+
}
|
92159
|
+
if (id === rewrite.exitBlockId) {
|
92160
|
+
block.terminal = originalTerminal;
|
92161
|
+
currBlock = block;
|
92162
|
+
}
|
92163
|
+
rewriteBlocks.push(block);
|
92164
|
+
}
|
92165
|
+
}
|
92166
|
+
}
|
91870
92167
|
}
|
91871
|
-
|
91872
|
-
return { place: currValue, instructions };
|
92168
|
+
currBlock.instructions.push(...originalInstrs.slice(cursor));
|
91873
92169
|
}
|
91874
92170
|
function inferReactiveIdentifiers(fn) {
|
91875
92171
|
const reactiveIds = /* @__PURE__ */ new Set();
|
@@ -93390,8 +93686,8 @@ var Unifier = class {
|
|
93390
93686
|
}
|
93391
93687
|
};
|
93392
93688
|
var RefLikeNameRE = /^(?:[a-zA-Z$_][a-zA-Z$_0-9]*)Ref$|^ref$/;
|
93393
|
-
function isRefLikeName(
|
93394
|
-
return
|
93689
|
+
function isRefLikeName(t6) {
|
93690
|
+
return t6.propertyName.kind === "literal" && RefLikeNameRE.test(t6.objectName) && t6.propertyName.value === "current";
|
93395
93691
|
}
|
93396
93692
|
function tryUnionTypes(ty1, ty2) {
|
93397
93693
|
let readonlyType;
|
@@ -96584,6 +96880,7 @@ function run(func, config, fnType, mode, programContext, logger, filename, code)
|
|
96584
96880
|
mode,
|
96585
96881
|
config,
|
96586
96882
|
contextIdentifiers,
|
96883
|
+
func,
|
96587
96884
|
logger,
|
96588
96885
|
filename,
|
96589
96886
|
code,
|
@@ -97049,11 +97346,21 @@ function suppressionsToCompilerError(suppressionRanges) {
|
|
97049
97346
|
// src/Entrypoint/Program.ts
|
97050
97347
|
var OPT_IN_DIRECTIVES = /* @__PURE__ */ new Set(["use forget", "use memo"]);
|
97051
97348
|
var OPT_OUT_DIRECTIVES = /* @__PURE__ */ new Set(["use no forget", "use no memo"]);
|
97052
|
-
|
97053
|
-
|
97054
|
-
|
97349
|
+
var DYNAMIC_GATING_DIRECTIVE = new RegExp("^use memo if\\(([^\\)]*)\\)$");
|
97350
|
+
function tryFindDirectiveEnablingMemoization(directives, opts) {
|
97351
|
+
var _a, _b;
|
97352
|
+
const optIn = directives.find(
|
97055
97353
|
(directive2) => OPT_IN_DIRECTIVES.has(directive2.value.value)
|
97056
|
-
)
|
97354
|
+
);
|
97355
|
+
if (optIn != null) {
|
97356
|
+
return Ok(optIn);
|
97357
|
+
}
|
97358
|
+
const dynamicGating = findDirectivesDynamicGating(directives, opts);
|
97359
|
+
if (dynamicGating.isOk()) {
|
97360
|
+
return Ok((_b = (_a = dynamicGating.unwrap()) == null ? void 0 : _a.directive) != null ? _b : null);
|
97361
|
+
} else {
|
97362
|
+
return Err(dynamicGating.unwrapErr());
|
97363
|
+
}
|
97057
97364
|
}
|
97058
97365
|
function findDirectiveDisablingMemoization(directives) {
|
97059
97366
|
var _a;
|
@@ -97061,6 +97368,53 @@ function findDirectiveDisablingMemoization(directives) {
|
|
97061
97368
|
(directive2) => OPT_OUT_DIRECTIVES.has(directive2.value.value)
|
97062
97369
|
)) != null ? _a : null;
|
97063
97370
|
}
|
97371
|
+
function findDirectivesDynamicGating(directives, opts) {
|
97372
|
+
var _a, _b;
|
97373
|
+
if (opts.dynamicGating === null) {
|
97374
|
+
return Ok(null);
|
97375
|
+
}
|
97376
|
+
const errors = new CompilerError();
|
97377
|
+
const result = [];
|
97378
|
+
for (const directive2 of directives) {
|
97379
|
+
const maybeMatch = DYNAMIC_GATING_DIRECTIVE.exec(directive2.value.value);
|
97380
|
+
if (maybeMatch != null && maybeMatch[1] != null) {
|
97381
|
+
if (t4.isValidIdentifier(maybeMatch[1])) {
|
97382
|
+
result.push({ directive: directive2, match: maybeMatch[1] });
|
97383
|
+
} else {
|
97384
|
+
errors.push({
|
97385
|
+
reason: `Dynamic gating directive is not a valid JavaScript identifier`,
|
97386
|
+
description: `Found '${directive2.value.value}'`,
|
97387
|
+
severity: "InvalidReact" /* InvalidReact */,
|
97388
|
+
loc: (_a = directive2.loc) != null ? _a : null,
|
97389
|
+
suggestions: null
|
97390
|
+
});
|
97391
|
+
}
|
97392
|
+
}
|
97393
|
+
}
|
97394
|
+
if (errors.hasErrors()) {
|
97395
|
+
return Err(errors);
|
97396
|
+
} else if (result.length > 1) {
|
97397
|
+
const error = new CompilerError();
|
97398
|
+
error.push({
|
97399
|
+
reason: `Multiple dynamic gating directives found`,
|
97400
|
+
description: `Expected a single directive but found [${result.map((r) => r.directive.value.value).join(", ")}]`,
|
97401
|
+
severity: "InvalidReact" /* InvalidReact */,
|
97402
|
+
loc: (_b = result[0].directive.loc) != null ? _b : null,
|
97403
|
+
suggestions: null
|
97404
|
+
});
|
97405
|
+
return Err(error);
|
97406
|
+
} else if (result.length === 1) {
|
97407
|
+
return Ok({
|
97408
|
+
gating: {
|
97409
|
+
source: opts.dynamicGating.source,
|
97410
|
+
importSpecifierName: result[0].match
|
97411
|
+
},
|
97412
|
+
directive: result[0].directive
|
97413
|
+
});
|
97414
|
+
} else {
|
97415
|
+
return Ok(null);
|
97416
|
+
}
|
97417
|
+
}
|
97064
97418
|
function isCriticalError(err) {
|
97065
97419
|
return !(err instanceof CompilerError) || err.isCritical();
|
97066
97420
|
}
|
@@ -97330,13 +97684,24 @@ function findFunctionsToCompile(program, pass, programContext) {
|
|
97330
97684
|
return queue;
|
97331
97685
|
}
|
97332
97686
|
function processFn(fn, fnType, programContext) {
|
97333
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
97687
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
97334
97688
|
let directives;
|
97335
97689
|
if (fn.node.body.type !== "BlockStatement") {
|
97336
|
-
directives = {
|
97690
|
+
directives = {
|
97691
|
+
optIn: null,
|
97692
|
+
optOut: null
|
97693
|
+
};
|
97337
97694
|
} else {
|
97695
|
+
const optIn = tryFindDirectiveEnablingMemoization(
|
97696
|
+
fn.node.body.directives,
|
97697
|
+
programContext.opts
|
97698
|
+
);
|
97699
|
+
if (optIn.isErr()) {
|
97700
|
+
handleError(optIn.unwrapErr(), programContext, (_a = fn.node.loc) != null ? _a : null);
|
97701
|
+
return null;
|
97702
|
+
}
|
97338
97703
|
directives = {
|
97339
|
-
optIn:
|
97704
|
+
optIn: optIn.unwrapOr(null),
|
97340
97705
|
optOut: findDirectiveDisablingMemoization(fn.node.body.directives)
|
97341
97706
|
};
|
97342
97707
|
}
|
@@ -97344,9 +97709,9 @@ function processFn(fn, fnType, programContext) {
|
|
97344
97709
|
const compileResult = tryCompileFunction(fn, fnType, programContext);
|
97345
97710
|
if (compileResult.kind === "error") {
|
97346
97711
|
if (directives.optOut != null) {
|
97347
|
-
logError(compileResult.error, programContext, (
|
97712
|
+
logError(compileResult.error, programContext, (_b = fn.node.loc) != null ? _b : null);
|
97348
97713
|
} else {
|
97349
|
-
handleError(compileResult.error, programContext, (
|
97714
|
+
handleError(compileResult.error, programContext, (_c = fn.node.loc) != null ? _c : null);
|
97350
97715
|
}
|
97351
97716
|
const retryResult = retryCompileFunction(fn, fnType, programContext);
|
97352
97717
|
if (retryResult == null) {
|
@@ -97359,16 +97724,16 @@ function processFn(fn, fnType, programContext) {
|
|
97359
97724
|
if (programContext.opts.ignoreUseNoForget === false && directives.optOut != null) {
|
97360
97725
|
programContext.logEvent({
|
97361
97726
|
kind: "CompileSkip",
|
97362
|
-
fnLoc: (
|
97727
|
+
fnLoc: (_d = fn.node.body.loc) != null ? _d : null,
|
97363
97728
|
reason: `Skipped due to '${directives.optOut.value}' directive.`,
|
97364
|
-
loc: (
|
97729
|
+
loc: (_e = directives.optOut.loc) != null ? _e : null
|
97365
97730
|
});
|
97366
97731
|
return null;
|
97367
97732
|
}
|
97368
97733
|
programContext.logEvent({
|
97369
97734
|
kind: "CompileSuccess",
|
97370
|
-
fnLoc: (
|
97371
|
-
fnName: (
|
97735
|
+
fnLoc: (_f = fn.node.loc) != null ? _f : null,
|
97736
|
+
fnName: (_h = (_g = compiledFn.id) == null ? void 0 : _g.name) != null ? _h : null,
|
97372
97737
|
memoSlots: compiledFn.memoSlotsUsed,
|
97373
97738
|
memoBlocks: compiledFn.memoBlocks,
|
97374
97739
|
memoValues: compiledFn.memoValues,
|
@@ -97447,21 +97812,30 @@ function retryCompileFunction(fn, fnType, programContext) {
|
|
97447
97812
|
}
|
97448
97813
|
}
|
97449
97814
|
function applyCompiledFunctions(program, compiledFns, pass, programContext) {
|
97450
|
-
|
97815
|
+
var _a, _b;
|
97816
|
+
let referencedBeforeDeclared = null;
|
97451
97817
|
for (const result of compiledFns) {
|
97452
97818
|
const { kind, originalFn, compiledFn } = result;
|
97453
97819
|
const transformedFn = createNewFunctionNode(originalFn, compiledFn);
|
97454
97820
|
programContext.alreadyCompiled.add(transformedFn);
|
97455
|
-
|
97456
|
-
|
97457
|
-
|
97458
|
-
|
97459
|
-
|
97821
|
+
let dynamicGating = null;
|
97822
|
+
if (originalFn.node.body.type === "BlockStatement") {
|
97823
|
+
const result2 = findDirectivesDynamicGating(
|
97824
|
+
originalFn.node.body.directives,
|
97825
|
+
pass.opts
|
97826
|
+
);
|
97827
|
+
if (result2.isOk()) {
|
97828
|
+
dynamicGating = (_b = (_a = result2.unwrap()) == null ? void 0 : _a.gating) != null ? _b : null;
|
97829
|
+
}
|
97830
|
+
}
|
97831
|
+
const functionGating = dynamicGating != null ? dynamicGating : pass.opts.gating;
|
97832
|
+
if (kind === "original" && functionGating != null) {
|
97833
|
+
referencedBeforeDeclared != null ? referencedBeforeDeclared : referencedBeforeDeclared = getFunctionReferencedBeforeDeclarationAtTopLevel(program, compiledFns);
|
97460
97834
|
insertGatedFunctionDeclaration(
|
97461
97835
|
originalFn,
|
97462
97836
|
transformedFn,
|
97463
97837
|
programContext,
|
97464
|
-
|
97838
|
+
functionGating,
|
97465
97839
|
referencedBeforeDeclared.has(result)
|
97466
97840
|
);
|
97467
97841
|
} else {
|
@@ -97503,8 +97877,13 @@ function getReactFunctionType(fn, pass) {
|
|
97503
97877
|
var _a, _b;
|
97504
97878
|
const hookPattern = pass.opts.environment.hookPattern;
|
97505
97879
|
if (fn.node.body.type === "BlockStatement") {
|
97506
|
-
|
97880
|
+
const optInDirectives = tryFindDirectiveEnablingMemoization(
|
97881
|
+
fn.node.body.directives,
|
97882
|
+
pass.opts
|
97883
|
+
);
|
97884
|
+
if (optInDirectives.unwrapOr(null) != null) {
|
97507
97885
|
return (_a = getComponentOrHookLike(fn, hookPattern)) != null ? _a : "Other";
|
97886
|
+
}
|
97508
97887
|
}
|
97509
97888
|
let componentSyntaxType = null;
|
97510
97889
|
if (fn.isFunctionDeclaration()) {
|
@@ -97988,9 +98367,9 @@ function addImportsToProgram(path, programContext) {
|
|
97988
98367
|
...importsMap.values()
|
97989
98368
|
].sort(({ imported: a }, { imported: b }) => a.localeCompare(b));
|
97990
98369
|
const importSpecifiers = sortedImport.map((specifier) => {
|
97991
|
-
return
|
97992
|
-
|
97993
|
-
|
98370
|
+
return t5.importSpecifier(
|
98371
|
+
t5.identifier(specifier.name),
|
98372
|
+
t5.identifier(specifier.imported)
|
97994
98373
|
);
|
97995
98374
|
});
|
97996
98375
|
const maybeExistingImports = existingImports.get(moduleName);
|
@@ -97998,7 +98377,7 @@ function addImportsToProgram(path, programContext) {
|
|
97998
98377
|
maybeExistingImports.pushContainer("specifiers", importSpecifiers);
|
97999
98378
|
} else {
|
98000
98379
|
stmts.push(
|
98001
|
-
|
98380
|
+
t5.importDeclaration(importSpecifiers, t5.stringLiteral(moduleName))
|
98002
98381
|
);
|
98003
98382
|
}
|
98004
98383
|
}
|
@@ -98026,6 +98405,9 @@ var PanicThresholdOptionsSchema = z.enum([
|
|
98026
98405
|
// Never panic by throwing an exception.
|
98027
98406
|
"none"
|
98028
98407
|
]);
|
98408
|
+
var DynamicGatingOptionsSchema = z.object({
|
98409
|
+
source: z.string()
|
98410
|
+
});
|
98029
98411
|
var CompilerReactTargetSchema = z.union([
|
98030
98412
|
z.literal("17"),
|
98031
98413
|
z.literal("18"),
|
@@ -98068,6 +98450,7 @@ var defaultOptions = {
|
|
98068
98450
|
logger: null,
|
98069
98451
|
gating: null,
|
98070
98452
|
noEmit: false,
|
98453
|
+
dynamicGating: null,
|
98071
98454
|
eslintSuppressionRules: null,
|
98072
98455
|
flowSuppressions: true,
|
98073
98456
|
ignoreUseNoForget: false,
|
@@ -98113,6 +98496,24 @@ function parsePluginOptions(obj) {
|
|
98113
98496
|
}
|
98114
98497
|
break;
|
98115
98498
|
}
|
98499
|
+
case "dynamicGating": {
|
98500
|
+
if (value == null) {
|
98501
|
+
parsedOptions[key2] = null;
|
98502
|
+
} else {
|
98503
|
+
const result = DynamicGatingOptionsSchema.safeParse(value);
|
98504
|
+
if (result.success) {
|
98505
|
+
parsedOptions[key2] = result.data;
|
98506
|
+
} else {
|
98507
|
+
CompilerError.throwInvalidConfig({
|
98508
|
+
reason: "Could not parse dynamic gating. Update React Compiler config to fix the error",
|
98509
|
+
description: `${fromZodError(result.error)}`,
|
98510
|
+
loc: null,
|
98511
|
+
suggestions: null
|
98512
|
+
});
|
98513
|
+
}
|
98514
|
+
}
|
98515
|
+
break;
|
98516
|
+
}
|
98116
98517
|
default: {
|
98117
98518
|
parsedOptions[key2] = value;
|
98118
98519
|
}
|