babel-plugin-react-compiler 0.0.0-experimental-9e9cd66-20250520 → 0.0.0-experimental-f980e29-20250522
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 +11 -2
- package/dist/index.js +323 -216
- 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
|
}
|
@@ -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
|
}
|
@@ -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(",");
|
@@ -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;
|
@@ -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":
|
@@ -79142,6 +79142,9 @@ function pruneUnusedLabelsHIR(fn) {
|
|
79142
79142
|
}
|
79143
79143
|
}
|
79144
79144
|
|
79145
|
+
// src/Entrypoint/Program.ts
|
79146
|
+
var t4 = __toESM(require("@babel/types"));
|
79147
|
+
|
79145
79148
|
// src/Utils/ComponentDeclaration.ts
|
79146
79149
|
function isComponentDeclaration(node) {
|
79147
79150
|
return Object.prototype.hasOwnProperty.call(node, "__componentDeclaration");
|
@@ -79314,8 +79317,8 @@ function handleAssignment(currentFn, identifiers, lvalPath) {
|
|
79314
79317
|
}
|
79315
79318
|
}
|
79316
79319
|
}
|
79317
|
-
function nonNull(
|
79318
|
-
return
|
79320
|
+
function nonNull(t6) {
|
79321
|
+
return t6.node != null;
|
79319
79322
|
}
|
79320
79323
|
|
79321
79324
|
// src/Optimization/ConstantPropagation.ts
|
@@ -93390,8 +93393,8 @@ var Unifier = class {
|
|
93390
93393
|
}
|
93391
93394
|
};
|
93392
93395
|
var RefLikeNameRE = /^(?:[a-zA-Z$_][a-zA-Z$_0-9]*)Ref$|^ref$/;
|
93393
|
-
function isRefLikeName(
|
93394
|
-
return
|
93396
|
+
function isRefLikeName(t6) {
|
93397
|
+
return t6.propertyName.kind === "literal" && RefLikeNameRE.test(t6.objectName) && t6.propertyName.value === "current";
|
93395
93398
|
}
|
93396
93399
|
function tryUnionTypes(ty1, ty2) {
|
93397
93400
|
let readonlyType;
|
@@ -97049,11 +97052,21 @@ function suppressionsToCompilerError(suppressionRanges) {
|
|
97049
97052
|
// src/Entrypoint/Program.ts
|
97050
97053
|
var OPT_IN_DIRECTIVES = /* @__PURE__ */ new Set(["use forget", "use memo"]);
|
97051
97054
|
var OPT_OUT_DIRECTIVES = /* @__PURE__ */ new Set(["use no forget", "use no memo"]);
|
97052
|
-
|
97053
|
-
|
97054
|
-
|
97055
|
+
var DYNAMIC_GATING_DIRECTIVE = new RegExp("^use memo if\\(([^\\)]*)\\)$");
|
97056
|
+
function tryFindDirectiveEnablingMemoization(directives, opts) {
|
97057
|
+
var _a, _b;
|
97058
|
+
const optIn = directives.find(
|
97055
97059
|
(directive2) => OPT_IN_DIRECTIVES.has(directive2.value.value)
|
97056
|
-
)
|
97060
|
+
);
|
97061
|
+
if (optIn != null) {
|
97062
|
+
return Ok(optIn);
|
97063
|
+
}
|
97064
|
+
const dynamicGating = findDirectivesDynamicGating(directives, opts);
|
97065
|
+
if (dynamicGating.isOk()) {
|
97066
|
+
return Ok((_b = (_a = dynamicGating.unwrap()) == null ? void 0 : _a.directive) != null ? _b : null);
|
97067
|
+
} else {
|
97068
|
+
return Err(dynamicGating.unwrapErr());
|
97069
|
+
}
|
97057
97070
|
}
|
97058
97071
|
function findDirectiveDisablingMemoization(directives) {
|
97059
97072
|
var _a;
|
@@ -97061,6 +97074,53 @@ function findDirectiveDisablingMemoization(directives) {
|
|
97061
97074
|
(directive2) => OPT_OUT_DIRECTIVES.has(directive2.value.value)
|
97062
97075
|
)) != null ? _a : null;
|
97063
97076
|
}
|
97077
|
+
function findDirectivesDynamicGating(directives, opts) {
|
97078
|
+
var _a, _b;
|
97079
|
+
if (opts.dynamicGating === null) {
|
97080
|
+
return Ok(null);
|
97081
|
+
}
|
97082
|
+
const errors = new CompilerError();
|
97083
|
+
const result = [];
|
97084
|
+
for (const directive2 of directives) {
|
97085
|
+
const maybeMatch = DYNAMIC_GATING_DIRECTIVE.exec(directive2.value.value);
|
97086
|
+
if (maybeMatch != null && maybeMatch[1] != null) {
|
97087
|
+
if (t4.isValidIdentifier(maybeMatch[1])) {
|
97088
|
+
result.push({ directive: directive2, match: maybeMatch[1] });
|
97089
|
+
} else {
|
97090
|
+
errors.push({
|
97091
|
+
reason: `Dynamic gating directive is not a valid JavaScript identifier`,
|
97092
|
+
description: `Found '${directive2.value.value}'`,
|
97093
|
+
severity: "InvalidReact" /* InvalidReact */,
|
97094
|
+
loc: (_a = directive2.loc) != null ? _a : null,
|
97095
|
+
suggestions: null
|
97096
|
+
});
|
97097
|
+
}
|
97098
|
+
}
|
97099
|
+
}
|
97100
|
+
if (errors.hasErrors()) {
|
97101
|
+
return Err(errors);
|
97102
|
+
} else if (result.length > 1) {
|
97103
|
+
const error = new CompilerError();
|
97104
|
+
error.push({
|
97105
|
+
reason: `Multiple dynamic gating directives found`,
|
97106
|
+
description: `Expected a single directive but found [${result.map((r) => r.directive.value.value).join(", ")}]`,
|
97107
|
+
severity: "InvalidReact" /* InvalidReact */,
|
97108
|
+
loc: (_b = result[0].directive.loc) != null ? _b : null,
|
97109
|
+
suggestions: null
|
97110
|
+
});
|
97111
|
+
return Err(error);
|
97112
|
+
} else if (result.length === 1) {
|
97113
|
+
return Ok({
|
97114
|
+
gating: {
|
97115
|
+
source: opts.dynamicGating.source,
|
97116
|
+
importSpecifierName: result[0].match
|
97117
|
+
},
|
97118
|
+
directive: result[0].directive
|
97119
|
+
});
|
97120
|
+
} else {
|
97121
|
+
return Ok(null);
|
97122
|
+
}
|
97123
|
+
}
|
97064
97124
|
function isCriticalError(err) {
|
97065
97125
|
return !(err instanceof CompilerError) || err.isCritical();
|
97066
97126
|
}
|
@@ -97330,13 +97390,24 @@ function findFunctionsToCompile(program, pass, programContext) {
|
|
97330
97390
|
return queue;
|
97331
97391
|
}
|
97332
97392
|
function processFn(fn, fnType, programContext) {
|
97333
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
97393
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
97334
97394
|
let directives;
|
97335
97395
|
if (fn.node.body.type !== "BlockStatement") {
|
97336
|
-
directives = {
|
97396
|
+
directives = {
|
97397
|
+
optIn: null,
|
97398
|
+
optOut: null
|
97399
|
+
};
|
97337
97400
|
} else {
|
97401
|
+
const optIn = tryFindDirectiveEnablingMemoization(
|
97402
|
+
fn.node.body.directives,
|
97403
|
+
programContext.opts
|
97404
|
+
);
|
97405
|
+
if (optIn.isErr()) {
|
97406
|
+
handleError(optIn.unwrapErr(), programContext, (_a = fn.node.loc) != null ? _a : null);
|
97407
|
+
return null;
|
97408
|
+
}
|
97338
97409
|
directives = {
|
97339
|
-
optIn:
|
97410
|
+
optIn: optIn.unwrapOr(null),
|
97340
97411
|
optOut: findDirectiveDisablingMemoization(fn.node.body.directives)
|
97341
97412
|
};
|
97342
97413
|
}
|
@@ -97344,9 +97415,9 @@ function processFn(fn, fnType, programContext) {
|
|
97344
97415
|
const compileResult = tryCompileFunction(fn, fnType, programContext);
|
97345
97416
|
if (compileResult.kind === "error") {
|
97346
97417
|
if (directives.optOut != null) {
|
97347
|
-
logError(compileResult.error, programContext, (
|
97418
|
+
logError(compileResult.error, programContext, (_b = fn.node.loc) != null ? _b : null);
|
97348
97419
|
} else {
|
97349
|
-
handleError(compileResult.error, programContext, (
|
97420
|
+
handleError(compileResult.error, programContext, (_c = fn.node.loc) != null ? _c : null);
|
97350
97421
|
}
|
97351
97422
|
const retryResult = retryCompileFunction(fn, fnType, programContext);
|
97352
97423
|
if (retryResult == null) {
|
@@ -97359,16 +97430,16 @@ function processFn(fn, fnType, programContext) {
|
|
97359
97430
|
if (programContext.opts.ignoreUseNoForget === false && directives.optOut != null) {
|
97360
97431
|
programContext.logEvent({
|
97361
97432
|
kind: "CompileSkip",
|
97362
|
-
fnLoc: (
|
97433
|
+
fnLoc: (_d = fn.node.body.loc) != null ? _d : null,
|
97363
97434
|
reason: `Skipped due to '${directives.optOut.value}' directive.`,
|
97364
|
-
loc: (
|
97435
|
+
loc: (_e = directives.optOut.loc) != null ? _e : null
|
97365
97436
|
});
|
97366
97437
|
return null;
|
97367
97438
|
}
|
97368
97439
|
programContext.logEvent({
|
97369
97440
|
kind: "CompileSuccess",
|
97370
|
-
fnLoc: (
|
97371
|
-
fnName: (
|
97441
|
+
fnLoc: (_f = fn.node.loc) != null ? _f : null,
|
97442
|
+
fnName: (_h = (_g = compiledFn.id) == null ? void 0 : _g.name) != null ? _h : null,
|
97372
97443
|
memoSlots: compiledFn.memoSlotsUsed,
|
97373
97444
|
memoBlocks: compiledFn.memoBlocks,
|
97374
97445
|
memoValues: compiledFn.memoValues,
|
@@ -97447,21 +97518,30 @@ function retryCompileFunction(fn, fnType, programContext) {
|
|
97447
97518
|
}
|
97448
97519
|
}
|
97449
97520
|
function applyCompiledFunctions(program, compiledFns, pass, programContext) {
|
97450
|
-
|
97521
|
+
var _a, _b;
|
97522
|
+
let referencedBeforeDeclared = null;
|
97451
97523
|
for (const result of compiledFns) {
|
97452
97524
|
const { kind, originalFn, compiledFn } = result;
|
97453
97525
|
const transformedFn = createNewFunctionNode(originalFn, compiledFn);
|
97454
97526
|
programContext.alreadyCompiled.add(transformedFn);
|
97455
|
-
|
97456
|
-
|
97457
|
-
|
97458
|
-
|
97459
|
-
|
97527
|
+
let dynamicGating = null;
|
97528
|
+
if (originalFn.node.body.type === "BlockStatement") {
|
97529
|
+
const result2 = findDirectivesDynamicGating(
|
97530
|
+
originalFn.node.body.directives,
|
97531
|
+
pass.opts
|
97532
|
+
);
|
97533
|
+
if (result2.isOk()) {
|
97534
|
+
dynamicGating = (_b = (_a = result2.unwrap()) == null ? void 0 : _a.gating) != null ? _b : null;
|
97535
|
+
}
|
97536
|
+
}
|
97537
|
+
const functionGating = dynamicGating != null ? dynamicGating : pass.opts.gating;
|
97538
|
+
if (kind === "original" && functionGating != null) {
|
97539
|
+
referencedBeforeDeclared != null ? referencedBeforeDeclared : referencedBeforeDeclared = getFunctionReferencedBeforeDeclarationAtTopLevel(program, compiledFns);
|
97460
97540
|
insertGatedFunctionDeclaration(
|
97461
97541
|
originalFn,
|
97462
97542
|
transformedFn,
|
97463
97543
|
programContext,
|
97464
|
-
|
97544
|
+
functionGating,
|
97465
97545
|
referencedBeforeDeclared.has(result)
|
97466
97546
|
);
|
97467
97547
|
} else {
|
@@ -97503,8 +97583,13 @@ function getReactFunctionType(fn, pass) {
|
|
97503
97583
|
var _a, _b;
|
97504
97584
|
const hookPattern = pass.opts.environment.hookPattern;
|
97505
97585
|
if (fn.node.body.type === "BlockStatement") {
|
97506
|
-
|
97586
|
+
const optInDirectives = tryFindDirectiveEnablingMemoization(
|
97587
|
+
fn.node.body.directives,
|
97588
|
+
pass.opts
|
97589
|
+
);
|
97590
|
+
if (optInDirectives.unwrapOr(null) != null) {
|
97507
97591
|
return (_a = getComponentOrHookLike(fn, hookPattern)) != null ? _a : "Other";
|
97592
|
+
}
|
97508
97593
|
}
|
97509
97594
|
let componentSyntaxType = null;
|
97510
97595
|
if (fn.isFunctionDeclaration()) {
|
@@ -97988,9 +98073,9 @@ function addImportsToProgram(path, programContext) {
|
|
97988
98073
|
...importsMap.values()
|
97989
98074
|
].sort(({ imported: a }, { imported: b }) => a.localeCompare(b));
|
97990
98075
|
const importSpecifiers = sortedImport.map((specifier) => {
|
97991
|
-
return
|
97992
|
-
|
97993
|
-
|
98076
|
+
return t5.importSpecifier(
|
98077
|
+
t5.identifier(specifier.name),
|
98078
|
+
t5.identifier(specifier.imported)
|
97994
98079
|
);
|
97995
98080
|
});
|
97996
98081
|
const maybeExistingImports = existingImports.get(moduleName);
|
@@ -97998,7 +98083,7 @@ function addImportsToProgram(path, programContext) {
|
|
97998
98083
|
maybeExistingImports.pushContainer("specifiers", importSpecifiers);
|
97999
98084
|
} else {
|
98000
98085
|
stmts.push(
|
98001
|
-
|
98086
|
+
t5.importDeclaration(importSpecifiers, t5.stringLiteral(moduleName))
|
98002
98087
|
);
|
98003
98088
|
}
|
98004
98089
|
}
|
@@ -98026,6 +98111,9 @@ var PanicThresholdOptionsSchema = z.enum([
|
|
98026
98111
|
// Never panic by throwing an exception.
|
98027
98112
|
"none"
|
98028
98113
|
]);
|
98114
|
+
var DynamicGatingOptionsSchema = z.object({
|
98115
|
+
source: z.string()
|
98116
|
+
});
|
98029
98117
|
var CompilerReactTargetSchema = z.union([
|
98030
98118
|
z.literal("17"),
|
98031
98119
|
z.literal("18"),
|
@@ -98068,6 +98156,7 @@ var defaultOptions = {
|
|
98068
98156
|
logger: null,
|
98069
98157
|
gating: null,
|
98070
98158
|
noEmit: false,
|
98159
|
+
dynamicGating: null,
|
98071
98160
|
eslintSuppressionRules: null,
|
98072
98161
|
flowSuppressions: true,
|
98073
98162
|
ignoreUseNoForget: false,
|
@@ -98113,6 +98202,24 @@ function parsePluginOptions(obj) {
|
|
98113
98202
|
}
|
98114
98203
|
break;
|
98115
98204
|
}
|
98205
|
+
case "dynamicGating": {
|
98206
|
+
if (value == null) {
|
98207
|
+
parsedOptions[key2] = null;
|
98208
|
+
} else {
|
98209
|
+
const result = DynamicGatingOptionsSchema.safeParse(value);
|
98210
|
+
if (result.success) {
|
98211
|
+
parsedOptions[key2] = result.data;
|
98212
|
+
} else {
|
98213
|
+
CompilerError.throwInvalidConfig({
|
98214
|
+
reason: "Could not parse dynamic gating. Update React Compiler config to fix the error",
|
98215
|
+
description: `${fromZodError(result.error)}`,
|
98216
|
+
loc: null,
|
98217
|
+
suggestions: null
|
98218
|
+
});
|
98219
|
+
}
|
98220
|
+
}
|
98221
|
+
break;
|
98222
|
+
}
|
98116
98223
|
default: {
|
98117
98224
|
parsedOptions[key2] = value;
|
98118
98225
|
}
|