octane 0.2.11 → 0.2.13
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/README.md +5 -0
- package/dist/behavior-root.d.ts +13 -3
- package/dist/behavior-root.js +28 -5
- package/dist/cjs/behavior-root.cjs +32 -6
- package/dist/cjs/class-names.cjs +49 -0
- package/dist/cjs/constants.cjs +9 -0
- package/dist/cjs/context-epoch.cjs +38 -0
- package/dist/cjs/css.cjs +6 -27
- package/dist/cjs/data-encoding.cjs +160 -0
- package/dist/cjs/dom-binding-handoff.cjs +93 -0
- package/dist/cjs/dom-binding-protocol.cjs +115 -0
- package/dist/cjs/dom-binding-styles.cjs +292 -0
- package/dist/cjs/dom-bindings.cjs +700 -0
- package/dist/cjs/dom-focused-move.cjs +66 -0
- package/dist/cjs/dom-stage.cjs +896 -0
- package/dist/cjs/dom-tables.cjs +4 -94
- package/dist/cjs/error-codes.client.generated.cjs +33 -0
- package/dist/cjs/error-codes.server.generated.cjs +24 -0
- package/dist/cjs/hydration/control-capture.cjs +244 -0
- package/dist/cjs/hydration/event-capture.cjs +125 -43
- package/dist/cjs/hydration/interaction-config.cjs +50 -2
- package/dist/cjs/hydration-markers.cjs +37 -0
- package/dist/cjs/independent-hydration-protocol.cjs +106 -0
- package/dist/cjs/index.cjs +9 -0
- package/dist/cjs/runtime.cjs +6397 -1683
- package/dist/cjs/runtime.server.cjs +1465 -213
- package/dist/cjs/server/early-signals.cjs +45 -0
- package/dist/cjs/server/index.cjs +47 -0
- package/dist/cjs/server/rpc-batch.cjs +149 -0
- package/dist/cjs/server/rpc-stream.cjs +146 -0
- package/dist/cjs/server/rpc.cjs +34 -15
- package/dist/cjs/server/signal-query-observation.cjs +158 -0
- package/dist/cjs/server/streamed-region.cjs +52 -0
- package/dist/cjs/server/streamed-signals.cjs +512 -0
- package/dist/cjs/server-call.cjs +103 -0
- package/dist/cjs/server-rpc-batch-client.cjs +141 -0
- package/dist/cjs/server-rpc-client.cjs +94 -27
- package/dist/cjs/server-rpc-protocol.cjs +141 -0
- package/dist/cjs/server-rpc-stream-client.cjs +118 -0
- package/dist/cjs/signals/actions.cjs +474 -0
- package/dist/cjs/signals/client.cjs +4 -1
- package/dist/cjs/signals/computations.cjs +460 -0
- package/dist/cjs/signals/control-binding.cjs +368 -0
- package/dist/cjs/signals/derived-facade.cjs +50 -0
- package/dist/cjs/signals/document-owner.cjs +71 -0
- package/dist/cjs/signals/early-values.cjs +155 -0
- package/dist/cjs/signals/encoding.cjs +6 -95
- package/dist/cjs/signals/engine.cjs +276 -12
- package/dist/cjs/signals/errors.cjs +18 -0
- package/dist/cjs/signals/facade.cjs +477 -0
- package/dist/cjs/signals/graph.cjs +166 -20
- package/dist/cjs/signals/handle-protocol.cjs +36 -0
- package/dist/cjs/signals/index.cjs +81 -2
- package/dist/cjs/signals/native-read-client.cjs +10 -0
- package/dist/cjs/signals/owner-context.cjs +112 -0
- package/dist/cjs/signals/query-attempt-observer.cjs +68 -0
- package/dist/cjs/signals/query-facade.cjs +72 -0
- package/dist/cjs/signals/read-protocol.cjs +54 -0
- package/dist/cjs/signals/requests.cjs +287 -14
- package/dist/cjs/signals/scalar-computations.cjs +76 -0
- package/dist/cjs/signals/server.cjs +4 -1
- package/dist/cjs/signals/transition-candidate.cjs +567 -0
- package/dist/cjs/signals/transition-state.cjs +106 -0
- package/dist/cjs/signals/types.cjs +50 -0
- package/dist/cjs/stream-protocol.cjs +3 -0
- package/dist/cjs/streamed-signals-protocol.cjs +159 -0
- package/dist/cjs/style-values.cjs +122 -0
- package/dist/cjs/trusted-html.cjs +30 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/class-names.d.ts +5 -0
- package/dist/class-names.js +25 -0
- package/dist/compiler/bundler.js +51 -22
- package/dist/compiler/compile.js +2534 -581
- package/dist/compiler/dom-binding-program.js +935 -0
- package/dist/compiler/dom-binding-request.js +57 -0
- package/dist/compiler/dom-bindings.js +2245 -0
- package/dist/compiler/hook-deps.js +759 -10
- package/dist/compiler/hydrate-boundaries.js +358 -15
- package/dist/compiler/index.d.ts +39 -2
- package/dist/compiler/index.js +1 -0
- package/dist/compiler/native-attribute-reads.js +127 -0
- package/dist/compiler/native-change-diagnostics.js +32 -38
- package/dist/compiler/native-read-diagnostics.js +69 -8
- package/dist/compiler/native-read-types.js +80 -34
- package/dist/compiler/parser.node.js +1 -1
- package/dist/compiler/renderer-boundaries.js +40 -0
- package/dist/compiler/server-context.js +118 -0
- package/dist/compiler/signal-attempt-reads.js +479 -0
- package/dist/compiler/signal-declarations.js +557 -0
- package/dist/compiler/signal-start-reads.js +413 -0
- package/dist/compiler/slot-hooks.d.ts +3 -1
- package/dist/compiler/slot-hooks.js +168 -34
- package/dist/compiler/strong-auto-memo.js +90 -0
- package/dist/compiler/strong-html.js +143 -0
- package/dist/compiler/strong-mode.js +764 -66
- package/dist/compiler/strong-template-policy.js +307 -0
- package/dist/compiler/template-ir.js +200 -0
- package/dist/compiler/typescript.d.ts +2 -0
- package/dist/compiler/typescript.js +2 -0
- package/dist/compiler/vite.d.ts +3 -1
- package/dist/compiler/vite.js +122 -4
- package/dist/compiler/volar.LICENSES.txt +1 -1
- package/dist/compiler/volar.d.ts +6 -1
- package/dist/compiler/volar.js +750 -1433
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +10 -0
- package/dist/context-epoch.d.ts +2 -0
- package/dist/context-epoch.js +13 -0
- package/dist/css.d.ts +2 -5
- package/dist/css.js +2 -23
- package/dist/data-encoding.d.ts +9 -0
- package/dist/data-encoding.js +134 -0
- package/dist/dom-binding-classes.d.ts +15 -0
- package/dist/dom-binding-classes.js +129 -0
- package/dist/dom-binding-controls.d.ts +2 -0
- package/dist/dom-binding-controls.js +6 -0
- package/dist/dom-binding-handoff.d.ts +55 -0
- package/dist/dom-binding-handoff.js +62 -0
- package/dist/dom-binding-program.d.ts +300 -0
- package/dist/dom-binding-program.js +1625 -0
- package/dist/dom-binding-projections.d.ts +15 -0
- package/dist/dom-binding-projections.js +187 -0
- package/dist/dom-binding-protocol.d.ts +13 -0
- package/dist/dom-binding-protocol.js +88 -0
- package/dist/dom-binding-signals.d.ts +21 -0
- package/dist/dom-binding-signals.js +109 -0
- package/dist/dom-binding-styles.d.ts +17 -0
- package/dist/dom-binding-styles.js +272 -0
- package/dist/dom-bindings.d.ts +89 -0
- package/dist/dom-bindings.js +670 -0
- package/dist/dom-focused-move.d.ts +6 -0
- package/dist/dom-focused-move.js +42 -0
- package/dist/dom-stage.d.ts +52 -0
- package/dist/dom-stage.js +872 -0
- package/dist/dom-tables.d.ts +1 -3
- package/dist/dom-tables.js +1 -91
- package/dist/error-codes.client.generated.d.ts +9 -0
- package/dist/error-codes.client.generated.js +33 -0
- package/dist/error-codes.server.generated.d.ts +6 -0
- package/dist/error-codes.server.generated.js +24 -0
- package/dist/hydration/control-capture.d.ts +62 -0
- package/dist/hydration/control-capture.js +223 -0
- package/dist/hydration/document-lifecycle.d.ts +23 -0
- package/dist/hydration/document-lifecycle.js +80 -0
- package/dist/hydration/event-capture.d.ts +20 -1
- package/dist/hydration/event-capture.js +128 -42
- package/dist/hydration/independent-island.d.ts +45 -0
- package/dist/hydration/independent-island.js +233 -0
- package/dist/hydration/index.d.ts +8 -1
- package/dist/hydration/index.js +55 -1
- package/dist/hydration/interaction-config.d.ts +5 -0
- package/dist/hydration/interaction-config.js +44 -1
- package/dist/hydration/stream-delivery.d.ts +32 -0
- package/dist/hydration/stream-delivery.js +333 -0
- package/dist/hydration/stream-receiver.d.ts +26 -0
- package/dist/hydration/stream-receiver.js +204 -0
- package/dist/hydration/stream-result-receiver.d.ts +70 -0
- package/dist/hydration/stream-result-receiver.js +246 -0
- package/dist/hydration/streamed-signals.d.ts +44 -0
- package/dist/hydration/streamed-signals.js +186 -0
- package/dist/hydration/types.d.ts +6 -0
- package/dist/hydration-markers.d.ts +7 -0
- package/dist/hydration-markers.js +10 -0
- package/dist/independent-hydration-protocol.d.ts +31 -0
- package/dist/independent-hydration-protocol.js +80 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/internal/signal-read.d.ts +1 -0
- package/dist/internal/signal-read.js +4 -0
- package/dist/jsx-runtime-strong.d.ts +33 -0
- package/dist/jsx-runtime.d.ts +58 -2
- package/dist/public-types.d.ts +15 -1
- package/dist/runtime.d.ts +297 -23
- package/dist/runtime.js +6405 -1679
- package/dist/runtime.server.d.ts +110 -27
- package/dist/runtime.server.js +1458 -213
- package/dist/server/early-signals.d.ts +14 -0
- package/dist/server/early-signals.js +34 -0
- package/dist/server/index.d.ts +11 -2
- package/dist/server/index.js +50 -1
- package/dist/server/rpc-batch.d.ts +17 -0
- package/dist/server/rpc-batch.js +129 -0
- package/dist/server/rpc-stream.d.ts +9 -0
- package/dist/server/rpc-stream.js +125 -0
- package/dist/server/rpc.d.ts +5 -1
- package/dist/server/rpc.js +37 -13
- package/dist/server/signal-query-observation.d.ts +3 -0
- package/dist/server/signal-query-observation.js +134 -0
- package/dist/server/streamed-region.d.ts +15 -0
- package/dist/server/streamed-region.js +30 -0
- package/dist/server/streamed-signals.d.ts +45 -0
- package/dist/server/streamed-signals.js +488 -0
- package/dist/server-call.d.ts +41 -0
- package/dist/server-call.js +75 -0
- package/dist/server-rpc-batch-client.d.ts +7 -0
- package/dist/server-rpc-batch-client.js +119 -0
- package/dist/server-rpc-client.d.ts +3 -1
- package/dist/server-rpc-client.js +99 -27
- package/dist/server-rpc-protocol.d.ts +47 -0
- package/dist/server-rpc-protocol.js +109 -0
- package/dist/server-rpc-stream-client.d.ts +5 -0
- package/dist/server-rpc-stream-client.js +98 -0
- package/dist/signals/actions.d.ts +12 -0
- package/dist/signals/actions.js +466 -0
- package/dist/signals/client.d.ts +2 -0
- package/dist/signals/client.js +1 -0
- package/dist/signals/computations.d.ts +37 -0
- package/dist/signals/computations.js +455 -0
- package/dist/signals/control-binding.d.ts +31 -0
- package/dist/signals/control-binding.js +353 -0
- package/dist/signals/derived-facade.d.ts +3 -0
- package/dist/signals/derived-facade.js +25 -0
- package/dist/signals/document-owner.d.ts +10 -0
- package/dist/signals/document-owner.js +43 -0
- package/dist/signals/early-values.d.ts +24 -0
- package/dist/signals/early-values.js +124 -0
- package/dist/signals/encoding.d.ts +1 -3
- package/dist/signals/encoding.js +3 -93
- package/dist/signals/engine.d.ts +53 -4
- package/dist/signals/engine.js +275 -16
- package/dist/signals/errors.d.ts +7 -0
- package/dist/signals/errors.js +16 -0
- package/dist/signals/facade.d.ts +74 -0
- package/dist/signals/facade.js +452 -0
- package/dist/signals/graph.d.ts +52 -6
- package/dist/signals/graph.js +174 -19
- package/dist/signals/handle-protocol.d.ts +4 -0
- package/dist/signals/handle-protocol.js +11 -0
- package/dist/signals/index.d.ts +12 -3
- package/dist/signals/index.js +71 -2
- package/dist/signals/native-read-client.d.ts +3 -0
- package/dist/signals/native-read-client.js +10 -0
- package/dist/signals/owner-context.d.ts +22 -0
- package/dist/signals/owner-context.js +77 -0
- package/dist/signals/query-attempt-observer.d.ts +49 -0
- package/dist/signals/query-attempt-observer.js +41 -0
- package/dist/signals/query-facade.d.ts +3 -0
- package/dist/signals/query-facade.js +49 -0
- package/dist/signals/read-protocol.d.ts +37 -2
- package/dist/signals/read-protocol.js +44 -0
- package/dist/signals/requests.d.ts +38 -5
- package/dist/signals/requests.js +298 -15
- package/dist/signals/scalar-computations.d.ts +2 -0
- package/dist/signals/scalar-computations.js +60 -0
- package/dist/signals/server.d.ts +2 -0
- package/dist/signals/server.js +1 -0
- package/dist/signals/transition-candidate.d.ts +71 -0
- package/dist/signals/transition-candidate.js +557 -0
- package/dist/signals/transition-state.d.ts +51 -0
- package/dist/signals/transition-state.js +70 -0
- package/dist/signals/types.d.ts +95 -5
- package/dist/signals/types.js +20 -0
- package/dist/stream-protocol.d.ts +0 -5
- package/dist/stream-protocol.js +3 -0
- package/dist/streamed-signals-protocol.d.ts +60 -0
- package/dist/streamed-signals-protocol.js +130 -0
- package/dist/style-values.d.ts +3 -0
- package/dist/style-values.js +96 -0
- package/dist/trusted-html.d.ts +17 -0
- package/dist/trusted-html.js +6 -0
- package/dist/universal-core.d.ts +6 -0
- package/dist/universal-core.js +214 -202
- package/dist/version.js +1 -1
- package/package.json +48 -5
package/dist/compiler/volar.js
CHANGED
|
@@ -51,14 +51,14 @@ var keywords$1 = {
|
|
|
51
51
|
var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
52
52
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
53
53
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
54
|
-
function isInAstralSet(code,
|
|
54
|
+
function isInAstralSet(code, set2) {
|
|
55
55
|
var pos = 65536;
|
|
56
|
-
for (var i2 = 0; i2 <
|
|
57
|
-
pos +=
|
|
56
|
+
for (var i2 = 0; i2 < set2.length; i2 += 2) {
|
|
57
|
+
pos += set2[i2];
|
|
58
58
|
if (pos > code) {
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
|
-
pos +=
|
|
61
|
+
pos += set2[i2 + 1];
|
|
62
62
|
if (pos >= code) {
|
|
63
63
|
return true;
|
|
64
64
|
}
|
|
@@ -459,8 +459,8 @@ var SCOPE_CLASS_STATIC_BLOCK = 256;
|
|
|
459
459
|
var SCOPE_CLASS_FIELD_INIT = 512;
|
|
460
460
|
var SCOPE_SWITCH = 1024;
|
|
461
461
|
var SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
|
|
462
|
-
function functionFlags(
|
|
463
|
-
return SCOPE_FUNCTION | (
|
|
462
|
+
function functionFlags(async2, generator) {
|
|
463
|
+
return SCOPE_FUNCTION | (async2 ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
|
|
464
464
|
}
|
|
465
465
|
var BIND_NONE = 0;
|
|
466
466
|
var BIND_VAR = 1;
|
|
@@ -1504,29 +1504,29 @@ pp$8.parseClassElementName = function(element) {
|
|
|
1504
1504
|
this.parsePropertyName(element);
|
|
1505
1505
|
}
|
|
1506
1506
|
};
|
|
1507
|
-
pp$8.parseClassMethod = function(
|
|
1508
|
-
var key2 =
|
|
1509
|
-
if (
|
|
1507
|
+
pp$8.parseClassMethod = function(method2, isGenerator, isAsync, allowsDirectSuper) {
|
|
1508
|
+
var key2 = method2.key;
|
|
1509
|
+
if (method2.kind === "constructor") {
|
|
1510
1510
|
if (isGenerator) {
|
|
1511
1511
|
this.raise(key2.start, "Constructor can't be a generator");
|
|
1512
1512
|
}
|
|
1513
1513
|
if (isAsync) {
|
|
1514
1514
|
this.raise(key2.start, "Constructor can't be an async method");
|
|
1515
1515
|
}
|
|
1516
|
-
} else if (
|
|
1516
|
+
} else if (method2.static && checkKeyName(method2, "prototype")) {
|
|
1517
1517
|
this.raise(key2.start, "Classes may not have a static property named prototype");
|
|
1518
1518
|
}
|
|
1519
|
-
var value =
|
|
1520
|
-
if (
|
|
1519
|
+
var value = method2.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
|
|
1520
|
+
if (method2.kind === "get" && value.params.length !== 0) {
|
|
1521
1521
|
this.raiseRecoverable(value.start, "getter should have no params");
|
|
1522
1522
|
}
|
|
1523
|
-
if (
|
|
1523
|
+
if (method2.kind === "set" && value.params.length !== 1) {
|
|
1524
1524
|
this.raiseRecoverable(value.start, "setter should have exactly one param");
|
|
1525
1525
|
}
|
|
1526
|
-
if (
|
|
1526
|
+
if (method2.kind === "set" && value.params[0].type === "RestElement") {
|
|
1527
1527
|
this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params");
|
|
1528
1528
|
}
|
|
1529
|
-
return this.finishNode(
|
|
1529
|
+
return this.finishNode(method2, "MethodDefinition");
|
|
1530
1530
|
};
|
|
1531
1531
|
pp$8.parseClassField = function(field) {
|
|
1532
1532
|
if (checkKeyName(field, "constructor")) {
|
|
@@ -2043,9 +2043,9 @@ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowMod
|
|
|
2043
2043
|
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
|
|
2044
2044
|
break;
|
|
2045
2045
|
} else if (this.type === types$1.ellipsis) {
|
|
2046
|
-
var
|
|
2047
|
-
this.parseBindingListItem(
|
|
2048
|
-
elts.push(
|
|
2046
|
+
var rest2 = this.parseRestBinding();
|
|
2047
|
+
this.parseBindingListItem(rest2);
|
|
2048
|
+
elts.push(rest2);
|
|
2049
2049
|
if (this.type === types$1.comma) {
|
|
2050
2050
|
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
|
|
2051
2051
|
}
|
|
@@ -2212,11 +2212,11 @@ pp$6.inGeneratorContext = function() {
|
|
|
2212
2212
|
return false;
|
|
2213
2213
|
};
|
|
2214
2214
|
pp$6.updateContext = function(prevType) {
|
|
2215
|
-
var
|
|
2215
|
+
var update2, type = this.type;
|
|
2216
2216
|
if (type.keyword && prevType === types$1.dot) {
|
|
2217
2217
|
this.exprAllowed = false;
|
|
2218
|
-
} else if (
|
|
2219
|
-
|
|
2218
|
+
} else if (update2 = type.updateContext) {
|
|
2219
|
+
update2.call(this, prevType);
|
|
2220
2220
|
} else {
|
|
2221
2221
|
this.exprAllowed = type.beforeExpr;
|
|
2222
2222
|
}
|
|
@@ -2493,13 +2493,13 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
2493
2493
|
expr = this.parseAwait(forInit);
|
|
2494
2494
|
sawUnary = true;
|
|
2495
2495
|
} else if (this.type.prefix) {
|
|
2496
|
-
var node = this.startNode(),
|
|
2496
|
+
var node = this.startNode(), update2 = this.type === types$1.incDec;
|
|
2497
2497
|
node.operator = this.value;
|
|
2498
2498
|
node.prefix = true;
|
|
2499
2499
|
this.next();
|
|
2500
|
-
node.argument = this.parseMaybeUnary(null, true,
|
|
2500
|
+
node.argument = this.parseMaybeUnary(null, true, update2, forInit);
|
|
2501
2501
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
2502
|
-
if (
|
|
2502
|
+
if (update2) {
|
|
2503
2503
|
this.checkLValSimple(node.argument);
|
|
2504
2504
|
} else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument)) {
|
|
2505
2505
|
this.raiseRecoverable(node.start, "Deleting local variable in strict mode");
|
|
@@ -2508,7 +2508,7 @@ pp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forIni
|
|
|
2508
2508
|
} else {
|
|
2509
2509
|
sawUnary = true;
|
|
2510
2510
|
}
|
|
2511
|
-
expr = this.finishNode(node,
|
|
2511
|
+
expr = this.finishNode(node, update2 ? "UpdateExpression" : "UnaryExpression");
|
|
2512
2512
|
} else if (!sawUnary && this.type === types$1.privateId) {
|
|
2513
2513
|
if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) {
|
|
2514
2514
|
this.unexpected();
|
|
@@ -7167,8 +7167,8 @@ var acornScope = {
|
|
|
7167
7167
|
BIND_FLAGS_CLASS: 128
|
|
7168
7168
|
// function
|
|
7169
7169
|
};
|
|
7170
|
-
function functionFlags2(
|
|
7171
|
-
return acornScope.SCOPE_FUNCTION | (
|
|
7170
|
+
function functionFlags2(async2, generator) {
|
|
7171
|
+
return acornScope.SCOPE_FUNCTION | (async2 ? acornScope.SCOPE_ASYNC : 0) | (generator ? acornScope.SCOPE_GENERATOR : 0);
|
|
7172
7172
|
}
|
|
7173
7173
|
function isPossiblyLiteralEnum(expression) {
|
|
7174
7174
|
if (expression.type !== "MemberExpression") return false;
|
|
@@ -8439,7 +8439,7 @@ function tsPlugin(options) {
|
|
|
8439
8439
|
tsParseTupleElementType() {
|
|
8440
8440
|
const startLoc = this.startLoc;
|
|
8441
8441
|
const startPos = this["start"];
|
|
8442
|
-
const
|
|
8442
|
+
const rest2 = this.eat(tt.ellipsis);
|
|
8443
8443
|
let type;
|
|
8444
8444
|
if (this.tsIsTupleElementLabel()) {
|
|
8445
8445
|
const labeledNode = this.startNode();
|
|
@@ -8460,7 +8460,7 @@ function tsPlugin(options) {
|
|
|
8460
8460
|
type = this.finishNode(optionalTypeNode, "TSOptionalType");
|
|
8461
8461
|
}
|
|
8462
8462
|
}
|
|
8463
|
-
if (
|
|
8463
|
+
if (rest2) {
|
|
8464
8464
|
const restNode = this.startNodeAt(startPos, startLoc);
|
|
8465
8465
|
restNode.typeAnnotation = type;
|
|
8466
8466
|
type = this.finishNode(restNode, "TSRestType");
|
|
@@ -8982,26 +8982,26 @@ function tsPlugin(options) {
|
|
|
8982
8982
|
if (readonly) {
|
|
8983
8983
|
this.raise(node.start, TypeScriptError.ReadonlyForMethodSignature);
|
|
8984
8984
|
}
|
|
8985
|
-
const
|
|
8986
|
-
if (
|
|
8985
|
+
const method2 = nodeAny;
|
|
8986
|
+
if (method2.kind && this.tsMatchLeftRelational()) {
|
|
8987
8987
|
this.raise(this.start, TypeScriptError.AccesorCannotHaveTypeParameters);
|
|
8988
8988
|
}
|
|
8989
|
-
this.tsFillSignature(tt.colon,
|
|
8989
|
+
this.tsFillSignature(tt.colon, method2);
|
|
8990
8990
|
this.tsParseTypeMemberSemicolon();
|
|
8991
8991
|
const paramsKey = "parameters";
|
|
8992
8992
|
const returnTypeKey = "typeAnnotation";
|
|
8993
|
-
if (
|
|
8994
|
-
if (
|
|
8993
|
+
if (method2.kind === "get") {
|
|
8994
|
+
if (method2[paramsKey].length > 0) {
|
|
8995
8995
|
this.raise(this.start, "A 'get' accesor must not have any formal parameters.");
|
|
8996
|
-
if (this.isThisParam(
|
|
8996
|
+
if (this.isThisParam(method2[paramsKey][0])) {
|
|
8997
8997
|
this.raise(this.start, TypeScriptError.AccesorCannotDeclareThisParameter);
|
|
8998
8998
|
}
|
|
8999
8999
|
}
|
|
9000
|
-
} else if (
|
|
9001
|
-
if (
|
|
9000
|
+
} else if (method2.kind === "set") {
|
|
9001
|
+
if (method2[paramsKey].length !== 1) {
|
|
9002
9002
|
this.raise(this.start, "A 'get' accesor must not have any formal parameters.");
|
|
9003
9003
|
} else {
|
|
9004
|
-
const firstParameter =
|
|
9004
|
+
const firstParameter = method2[paramsKey][0];
|
|
9005
9005
|
if (this.isThisParam(firstParameter)) {
|
|
9006
9006
|
this.raise(this.start, TypeScriptError.AccesorCannotDeclareThisParameter);
|
|
9007
9007
|
}
|
|
@@ -9012,16 +9012,16 @@ function tsPlugin(options) {
|
|
|
9012
9012
|
this.raise(this.start, TypeScriptError.SetAccesorCannotHaveRestParameter);
|
|
9013
9013
|
}
|
|
9014
9014
|
}
|
|
9015
|
-
if (
|
|
9015
|
+
if (method2[returnTypeKey]) {
|
|
9016
9016
|
this.raise(
|
|
9017
|
-
|
|
9017
|
+
method2[returnTypeKey].start,
|
|
9018
9018
|
TypeScriptError.SetAccesorCannotHaveReturnType
|
|
9019
9019
|
);
|
|
9020
9020
|
}
|
|
9021
9021
|
} else {
|
|
9022
|
-
|
|
9022
|
+
method2.kind = "method";
|
|
9023
9023
|
}
|
|
9024
|
-
return this.finishNode(
|
|
9024
|
+
return this.finishNode(method2, "TSMethodSignature");
|
|
9025
9025
|
} else {
|
|
9026
9026
|
const property = nodeAny;
|
|
9027
9027
|
if (readonly) property.readonly = true;
|
|
@@ -9998,17 +9998,17 @@ function tsPlugin(options) {
|
|
|
9998
9998
|
}
|
|
9999
9999
|
return super.parseClassField(field);
|
|
10000
10000
|
}
|
|
10001
|
-
parseClassMethod(
|
|
10002
|
-
const isConstructor =
|
|
10003
|
-
const isPrivate =
|
|
10001
|
+
parseClassMethod(method2, isGenerator, isAsync, allowsDirectSuper) {
|
|
10002
|
+
const isConstructor = method2.kind === "constructor";
|
|
10003
|
+
const isPrivate = method2.key.type === "PrivateIdentifier";
|
|
10004
10004
|
const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
10005
10005
|
if (isPrivate) {
|
|
10006
|
-
if (typeParameters)
|
|
10007
|
-
if (
|
|
10006
|
+
if (typeParameters) method2.typeParameters = typeParameters;
|
|
10007
|
+
if (method2.accessibility) {
|
|
10008
10008
|
this.raise(
|
|
10009
|
-
|
|
10009
|
+
method2.start,
|
|
10010
10010
|
TypeScriptError.PrivateMethodsHasAccessibility({
|
|
10011
|
-
modifier:
|
|
10011
|
+
modifier: method2.accessibility
|
|
10012
10012
|
})
|
|
10013
10013
|
);
|
|
10014
10014
|
}
|
|
@@ -10017,32 +10017,32 @@ function tsPlugin(options) {
|
|
|
10017
10017
|
this.raise(typeParameters.start, TypeScriptError.ConstructorHasTypeParameters);
|
|
10018
10018
|
}
|
|
10019
10019
|
}
|
|
10020
|
-
const { declare = false, kind } =
|
|
10020
|
+
const { declare = false, kind } = method2;
|
|
10021
10021
|
if (declare && (kind === "get" || kind === "set")) {
|
|
10022
|
-
this.raise(
|
|
10022
|
+
this.raise(method2.start, TypeScriptError.DeclareAccessor({ kind }));
|
|
10023
10023
|
}
|
|
10024
|
-
if (typeParameters)
|
|
10025
|
-
const key2 =
|
|
10026
|
-
if (
|
|
10024
|
+
if (typeParameters) method2.typeParameters = typeParameters;
|
|
10025
|
+
const key2 = method2.key;
|
|
10026
|
+
if (method2.kind === "constructor") {
|
|
10027
10027
|
if (isGenerator) this.raise(key2.start, "Constructor can't be a generator");
|
|
10028
10028
|
if (isAsync) this.raise(key2.start, "Constructor can't be an async method");
|
|
10029
|
-
} else if (
|
|
10029
|
+
} else if (method2.static && checkKeyName2(method2, "prototype")) {
|
|
10030
10030
|
this.raise(key2.start, "Classes may not have a static property named prototype");
|
|
10031
10031
|
}
|
|
10032
|
-
const value =
|
|
10032
|
+
const value = method2.value = this.parseMethod(
|
|
10033
10033
|
isGenerator,
|
|
10034
10034
|
isAsync,
|
|
10035
10035
|
allowsDirectSuper,
|
|
10036
10036
|
true,
|
|
10037
|
-
|
|
10037
|
+
method2
|
|
10038
10038
|
);
|
|
10039
|
-
if (
|
|
10039
|
+
if (method2.kind === "get" && value["params"].length !== 0)
|
|
10040
10040
|
this.raiseRecoverable(value.start, "getter should have no params");
|
|
10041
|
-
if (
|
|
10041
|
+
if (method2.kind === "set" && value["params"].length !== 1)
|
|
10042
10042
|
this.raiseRecoverable(value.start, "setter should have exactly one param");
|
|
10043
|
-
if (
|
|
10043
|
+
if (method2.kind === "set" && value["params"][0].type === "RestElement")
|
|
10044
10044
|
this.raiseRecoverable(value["params"][0].start, "Setter cannot use rest params");
|
|
10045
|
-
return this.finishNode(
|
|
10045
|
+
return this.finishNode(method2, "MethodDefinition");
|
|
10046
10046
|
}
|
|
10047
10047
|
isClassMethod() {
|
|
10048
10048
|
return this.match(tt.relational);
|
|
@@ -11026,7 +11026,7 @@ function tsPlugin(options) {
|
|
|
11026
11026
|
if (typeParameters) params.typeParameters = typeParameters;
|
|
11027
11027
|
return params;
|
|
11028
11028
|
}
|
|
11029
|
-
parseMethod(isGenerator, isAsync, allowDirectSuper, inClassScope,
|
|
11029
|
+
parseMethod(isGenerator, isAsync, allowDirectSuper, inClassScope, method2) {
|
|
11030
11030
|
let node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
11031
11031
|
this.initFunction(node);
|
|
11032
11032
|
if (this.ecmaVersion >= 6) node.generator = isGenerator;
|
|
@@ -11046,14 +11046,14 @@ function tsPlugin(options) {
|
|
|
11046
11046
|
this.yieldPos = oldYieldPos;
|
|
11047
11047
|
this.awaitPos = oldAwaitPos;
|
|
11048
11048
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
11049
|
-
if (
|
|
11049
|
+
if (method2 && method2.abstract) {
|
|
11050
11050
|
const hasBody = !!node.body;
|
|
11051
11051
|
if (hasBody) {
|
|
11052
|
-
const { key: key2 } =
|
|
11052
|
+
const { key: key2 } = method2;
|
|
11053
11053
|
this.raise(
|
|
11054
|
-
|
|
11054
|
+
method2.start,
|
|
11055
11055
|
TypeScriptError.AbstractMethodHasImplementation({
|
|
11056
|
-
methodName: key2.type === "Identifier" && !
|
|
11056
|
+
methodName: key2.type === "Identifier" && !method2.computed ? key2.name : `[${this.input.slice(key2.start, key2.end)}]`
|
|
11057
11057
|
})
|
|
11058
11058
|
);
|
|
11059
11059
|
}
|
|
@@ -11449,17 +11449,127 @@ function apply_mutations(node, mutations) {
|
|
|
11449
11449
|
);
|
|
11450
11450
|
}
|
|
11451
11451
|
|
|
11452
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
11452
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/builders.js
|
|
11453
|
+
var builders_exports = {};
|
|
11454
|
+
__export(builders_exports, {
|
|
11455
|
+
array: () => array,
|
|
11456
|
+
array_pattern: () => array_pattern,
|
|
11457
|
+
arrow: () => arrow,
|
|
11458
|
+
assignment: () => assignment,
|
|
11459
|
+
assignment_pattern: () => assignment_pattern,
|
|
11460
|
+
assignment_prop: () => assignment_prop,
|
|
11461
|
+
async: () => async,
|
|
11462
|
+
await: () => await_builder,
|
|
11463
|
+
binary: () => binary,
|
|
11464
|
+
block: () => block,
|
|
11465
|
+
break: () => break_statement,
|
|
11466
|
+
break_statement: () => break_statement,
|
|
11467
|
+
call: () => call,
|
|
11468
|
+
catch_clause: () => catch_clause_builder,
|
|
11469
|
+
catch_clause_builder: () => catch_clause_builder,
|
|
11470
|
+
conditional: () => conditional,
|
|
11471
|
+
const: () => const_builder,
|
|
11472
|
+
continue: () => continue_statement,
|
|
11473
|
+
continue_statement: () => continue_statement,
|
|
11474
|
+
debugger: () => debugger_builder,
|
|
11475
|
+
declaration: () => declaration,
|
|
11476
|
+
declarator: () => declarator,
|
|
11477
|
+
do_while: () => do_while,
|
|
11478
|
+
empty: () => empty2,
|
|
11479
|
+
export: () => export_builder,
|
|
11480
|
+
export_builder: () => export_builder,
|
|
11481
|
+
export_default: () => export_default,
|
|
11482
|
+
export_specifier: () => export_specifier,
|
|
11483
|
+
false: () => false_instance,
|
|
11484
|
+
for: () => for_builder,
|
|
11485
|
+
for_of: () => for_of,
|
|
11486
|
+
function: () => function_builder,
|
|
11487
|
+
function_declaration: () => function_declaration,
|
|
11488
|
+
get: () => get,
|
|
11489
|
+
id: () => id,
|
|
11490
|
+
if: () => if_builder,
|
|
11491
|
+
import_all: () => import_all,
|
|
11492
|
+
import_declaration: () => import_declaration,
|
|
11493
|
+
import_specifier: () => import_specifier,
|
|
11494
|
+
imports: () => imports,
|
|
11495
|
+
init: () => init,
|
|
11496
|
+
jsx_attribute: () => jsx_attribute,
|
|
11497
|
+
jsx_closing_element: () => jsx_closing_element,
|
|
11498
|
+
jsx_element: () => jsx_element,
|
|
11499
|
+
jsx_element_fresh: () => jsx_element_fresh,
|
|
11500
|
+
jsx_expression_container: () => jsx_expression_container,
|
|
11501
|
+
jsx_fragment: () => jsx_fragment,
|
|
11502
|
+
jsx_id: () => jsx_id,
|
|
11503
|
+
jsx_member: () => jsx_member,
|
|
11504
|
+
jsx_opening_element: () => jsx_opening_element,
|
|
11505
|
+
jsx_spread_attribute: () => jsx_spread_attribute,
|
|
11506
|
+
jsx_text: () => jsx_text,
|
|
11507
|
+
key: () => key,
|
|
11508
|
+
labeled: () => labeled,
|
|
11509
|
+
let: () => let_builder,
|
|
11510
|
+
literal: () => literal2,
|
|
11511
|
+
logical: () => logical,
|
|
11512
|
+
maybe_call: () => maybe_call,
|
|
11513
|
+
member: () => member,
|
|
11514
|
+
member_id: () => member_id,
|
|
11515
|
+
method: () => method,
|
|
11516
|
+
new: () => new_builder,
|
|
11517
|
+
null: () => null_instance,
|
|
11518
|
+
object: () => object,
|
|
11519
|
+
object_pattern: () => object_pattern,
|
|
11520
|
+
parenthesized: () => parenthesized,
|
|
11521
|
+
private_id: () => private_id,
|
|
11522
|
+
prop: () => prop,
|
|
11523
|
+
prop_def: () => prop_def,
|
|
11524
|
+
quasi: () => quasi,
|
|
11525
|
+
rest: () => rest,
|
|
11526
|
+
return: () => return_builder,
|
|
11527
|
+
sequence: () => sequence,
|
|
11528
|
+
set: () => set,
|
|
11529
|
+
set_location: () => set_location,
|
|
11530
|
+
spread: () => spread,
|
|
11531
|
+
stmt: () => stmt,
|
|
11532
|
+
switch: () => switch_builder,
|
|
11533
|
+
switch_builder: () => switch_builder,
|
|
11534
|
+
switch_case: () => switch_case,
|
|
11535
|
+
template: () => template,
|
|
11536
|
+
this: () => this_instance,
|
|
11537
|
+
throw_error: () => throw_error,
|
|
11538
|
+
thunk: () => thunk,
|
|
11539
|
+
true: () => true_instance,
|
|
11540
|
+
try: () => try_builder,
|
|
11541
|
+
try_builder: () => try_builder,
|
|
11542
|
+
ts_as: () => ts_as,
|
|
11543
|
+
ts_import_equals: () => ts_import_equals,
|
|
11544
|
+
ts_intersection_type: () => ts_intersection_type,
|
|
11545
|
+
ts_keyword_type: () => ts_keyword_type,
|
|
11546
|
+
ts_literal_type: () => ts_literal_type,
|
|
11547
|
+
ts_property_signature: () => ts_property_signature,
|
|
11548
|
+
ts_qualified_name: () => ts_qualified_name,
|
|
11549
|
+
ts_type_alias: () => ts_type_alias,
|
|
11550
|
+
ts_type_annotation: () => ts_type_annotation,
|
|
11551
|
+
ts_type_literal: () => ts_type_literal,
|
|
11552
|
+
ts_type_parameter_instantiation: () => ts_type_parameter_instantiation,
|
|
11553
|
+
ts_type_query: () => ts_type_query,
|
|
11554
|
+
ts_type_reference: () => ts_type_reference,
|
|
11555
|
+
unary: () => unary,
|
|
11556
|
+
unthunk: () => unthunk,
|
|
11557
|
+
update: () => update,
|
|
11558
|
+
var: () => var_builder,
|
|
11559
|
+
void0: () => void0
|
|
11560
|
+
});
|
|
11561
|
+
|
|
11562
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/patterns.js
|
|
11453
11563
|
var regex_not_whitespace = /[^ \t\r\n]/;
|
|
11454
11564
|
var regex_newline_characters = /\n/g;
|
|
11455
11565
|
var regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
|
|
11456
11566
|
|
|
11457
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
11567
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/sanitize_template_string.js
|
|
11458
11568
|
function sanitize_template_string(str) {
|
|
11459
11569
|
return (str ?? "").replace(/(`|\${|\\)/g, "\\$1");
|
|
11460
11570
|
}
|
|
11461
11571
|
|
|
11462
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
11572
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/builders.js
|
|
11463
11573
|
function set_location(node, loc_info, is_deep_copy = false) {
|
|
11464
11574
|
if (loc_info) {
|
|
11465
11575
|
node.start = loc_info.start;
|
|
@@ -11478,7 +11588,13 @@ function set_location(node, loc_info, is_deep_copy = false) {
|
|
|
11478
11588
|
function array(elements = []) {
|
|
11479
11589
|
return { type: "ArrayExpression", elements, metadata: { path: [] } };
|
|
11480
11590
|
}
|
|
11481
|
-
function
|
|
11591
|
+
function array_pattern(elements) {
|
|
11592
|
+
return { type: "ArrayPattern", elements, metadata: { path: [] } };
|
|
11593
|
+
}
|
|
11594
|
+
function assignment_pattern(left, right) {
|
|
11595
|
+
return { type: "AssignmentPattern", left, right, metadata: { path: [] } };
|
|
11596
|
+
}
|
|
11597
|
+
function arrow(params, body, async2 = false, type_parameters, loc_info) {
|
|
11482
11598
|
const node = (
|
|
11483
11599
|
/** @type {AST.ArrowFunctionExpression} */
|
|
11484
11600
|
{
|
|
@@ -11487,7 +11603,7 @@ function arrow(params, body, async = false, type_parameters, loc_info) {
|
|
|
11487
11603
|
body,
|
|
11488
11604
|
expression: body.type !== "BlockStatement",
|
|
11489
11605
|
generator: false,
|
|
11490
|
-
async,
|
|
11606
|
+
async: async2,
|
|
11491
11607
|
typeParameters: type_parameters,
|
|
11492
11608
|
metadata: { path: [] }
|
|
11493
11609
|
}
|
|
@@ -11497,6 +11613,12 @@ function arrow(params, body, async = false, type_parameters, loc_info) {
|
|
|
11497
11613
|
function assignment(operator, left, right) {
|
|
11498
11614
|
return { type: "AssignmentExpression", operator, left, right, metadata: { path: [] } };
|
|
11499
11615
|
}
|
|
11616
|
+
function async(func) {
|
|
11617
|
+
return { ...func, async: true };
|
|
11618
|
+
}
|
|
11619
|
+
function await_builder(argument) {
|
|
11620
|
+
return { type: "AwaitExpression", argument, metadata: { path: [] } };
|
|
11621
|
+
}
|
|
11500
11622
|
function binary(operator, left, right) {
|
|
11501
11623
|
return { type: "BinaryExpression", operator, left, right, metadata: { path: [] } };
|
|
11502
11624
|
}
|
|
@@ -11504,6 +11626,9 @@ function block(body, loc_info) {
|
|
|
11504
11626
|
const node = { type: "BlockStatement", body, metadata: { path: [] } };
|
|
11505
11627
|
return set_location(node, loc_info);
|
|
11506
11628
|
}
|
|
11629
|
+
function labeled(name, body) {
|
|
11630
|
+
return { type: "LabeledStatement", label: id(name), body, metadata: { path: [] } };
|
|
11631
|
+
}
|
|
11507
11632
|
function call(callee, ...args) {
|
|
11508
11633
|
if (typeof callee === "string") callee = id(callee);
|
|
11509
11634
|
args = args.slice();
|
|
@@ -11531,6 +11656,18 @@ function call(callee, ...args) {
|
|
|
11531
11656
|
metadata: { path: [] }
|
|
11532
11657
|
};
|
|
11533
11658
|
}
|
|
11659
|
+
function maybe_call(callee, ...args) {
|
|
11660
|
+
const expression = (
|
|
11661
|
+
/** @type {AST.SimpleCallExpression} */
|
|
11662
|
+
call(callee, ...args)
|
|
11663
|
+
);
|
|
11664
|
+
expression.optional = true;
|
|
11665
|
+
return {
|
|
11666
|
+
type: "ChainExpression",
|
|
11667
|
+
expression,
|
|
11668
|
+
metadata: { path: [] }
|
|
11669
|
+
};
|
|
11670
|
+
}
|
|
11534
11671
|
function unary(operator, argument) {
|
|
11535
11672
|
return { type: "UnaryExpression", argument, operator, prefix: true, metadata: { path: [] } };
|
|
11536
11673
|
}
|
|
@@ -11552,7 +11689,34 @@ function declarator(pattern, init2) {
|
|
|
11552
11689
|
if (typeof pattern === "string") pattern = id(pattern);
|
|
11553
11690
|
return { type: "VariableDeclarator", id: pattern, init: init2, metadata: { path: [] } };
|
|
11554
11691
|
}
|
|
11555
|
-
|
|
11692
|
+
var empty2 = {
|
|
11693
|
+
type: "EmptyStatement",
|
|
11694
|
+
metadata: { path: [] }
|
|
11695
|
+
};
|
|
11696
|
+
function export_default(declaration2) {
|
|
11697
|
+
return { type: "ExportDefaultDeclaration", declaration: declaration2, metadata: { path: [] } };
|
|
11698
|
+
}
|
|
11699
|
+
function export_specifier(local, exported = local, exportKind = "value") {
|
|
11700
|
+
return {
|
|
11701
|
+
type: "ExportSpecifier",
|
|
11702
|
+
local: typeof local === "string" ? id(local) : local,
|
|
11703
|
+
exported: typeof exported === "string" ? id(exported) : exported,
|
|
11704
|
+
exportKind,
|
|
11705
|
+
metadata: { path: [] }
|
|
11706
|
+
};
|
|
11707
|
+
}
|
|
11708
|
+
function export_builder(declaration2, specifiers = [], attributes = [], exportKind = "value", source = null) {
|
|
11709
|
+
return {
|
|
11710
|
+
type: "ExportNamedDeclaration",
|
|
11711
|
+
declaration: declaration2,
|
|
11712
|
+
specifiers,
|
|
11713
|
+
attributes,
|
|
11714
|
+
exportKind,
|
|
11715
|
+
source,
|
|
11716
|
+
metadata: { path: [] }
|
|
11717
|
+
};
|
|
11718
|
+
}
|
|
11719
|
+
function function_declaration(id2, params, body, async2 = false, type_parameters) {
|
|
11556
11720
|
return {
|
|
11557
11721
|
type: "FunctionDeclaration",
|
|
11558
11722
|
id: id2,
|
|
@@ -11560,10 +11724,16 @@ function function_declaration(id2, params, body, async = false, type_parameters)
|
|
|
11560
11724
|
params,
|
|
11561
11725
|
body,
|
|
11562
11726
|
generator: false,
|
|
11563
|
-
async,
|
|
11727
|
+
async: async2,
|
|
11564
11728
|
metadata: { path: [] }
|
|
11565
11729
|
};
|
|
11566
11730
|
}
|
|
11731
|
+
function get(name, body) {
|
|
11732
|
+
return (
|
|
11733
|
+
/** @type {AST.Property & { value: AST.FunctionExpression}} */
|
|
11734
|
+
prop("get", key(name), function_builder(null, [], block(body)))
|
|
11735
|
+
);
|
|
11736
|
+
}
|
|
11567
11737
|
function id(name, loc_info) {
|
|
11568
11738
|
const node = {
|
|
11569
11739
|
type: "Identifier",
|
|
@@ -11574,6 +11744,16 @@ function id(name, loc_info) {
|
|
|
11574
11744
|
};
|
|
11575
11745
|
return set_location(node, loc_info);
|
|
11576
11746
|
}
|
|
11747
|
+
function private_id(name) {
|
|
11748
|
+
return { type: "PrivateIdentifier", name, metadata: { path: [] } };
|
|
11749
|
+
}
|
|
11750
|
+
function import_namespace(local) {
|
|
11751
|
+
return {
|
|
11752
|
+
type: "ImportNamespaceSpecifier",
|
|
11753
|
+
local: id(local),
|
|
11754
|
+
metadata: { path: [] }
|
|
11755
|
+
};
|
|
11756
|
+
}
|
|
11577
11757
|
function init(name, value) {
|
|
11578
11758
|
return prop("init", key(name), value);
|
|
11579
11759
|
}
|
|
@@ -11598,6 +11778,18 @@ function member(object3, property, computed = false, optional = false, loc_info)
|
|
|
11598
11778
|
};
|
|
11599
11779
|
return set_location(node, loc_info);
|
|
11600
11780
|
}
|
|
11781
|
+
function ts_as(expression, type_annotation, loc_info) {
|
|
11782
|
+
const node = (
|
|
11783
|
+
/** @type {AST.TSAsExpression} */
|
|
11784
|
+
{
|
|
11785
|
+
type: "TSAsExpression",
|
|
11786
|
+
expression,
|
|
11787
|
+
typeAnnotation: type_annotation,
|
|
11788
|
+
metadata: { path: [] }
|
|
11789
|
+
}
|
|
11790
|
+
);
|
|
11791
|
+
return set_location(node, loc_info);
|
|
11792
|
+
}
|
|
11601
11793
|
function parenthesized(expression, loc_info) {
|
|
11602
11794
|
const node = (
|
|
11603
11795
|
/** @type {AST.ParenthesizedExpression} */
|
|
@@ -11644,6 +11836,28 @@ function ts_type_reference(type_name, type_arguments = null, loc_info) {
|
|
|
11644
11836
|
);
|
|
11645
11837
|
return set_location(node, loc_info);
|
|
11646
11838
|
}
|
|
11839
|
+
function ts_literal_type(literal_node, loc_info) {
|
|
11840
|
+
const node = (
|
|
11841
|
+
/** @type {AST.TSLiteralType} */
|
|
11842
|
+
{
|
|
11843
|
+
type: "TSLiteralType",
|
|
11844
|
+
literal: literal_node,
|
|
11845
|
+
metadata: { path: [] }
|
|
11846
|
+
}
|
|
11847
|
+
);
|
|
11848
|
+
return set_location(node, loc_info);
|
|
11849
|
+
}
|
|
11850
|
+
function ts_intersection_type(types2, loc_info) {
|
|
11851
|
+
const node = (
|
|
11852
|
+
/** @type {AST.TSIntersectionType} */
|
|
11853
|
+
{
|
|
11854
|
+
type: "TSIntersectionType",
|
|
11855
|
+
types: types2,
|
|
11856
|
+
metadata: { path: [] }
|
|
11857
|
+
}
|
|
11858
|
+
);
|
|
11859
|
+
return set_location(node, loc_info);
|
|
11860
|
+
}
|
|
11647
11861
|
function ts_keyword_type(keyword, loc_info) {
|
|
11648
11862
|
const keyword_to_type = {
|
|
11649
11863
|
string: "TSStringKeyword",
|
|
@@ -11747,6 +11961,14 @@ function ts_type_alias(id2, type_annotation, loc_info) {
|
|
|
11747
11961
|
);
|
|
11748
11962
|
return set_location(node, loc_info);
|
|
11749
11963
|
}
|
|
11964
|
+
function member_id(path) {
|
|
11965
|
+
const parts = path.split(".");
|
|
11966
|
+
let expression = id(parts[0]);
|
|
11967
|
+
for (let i2 = 1; i2 < parts.length; i2 += 1) {
|
|
11968
|
+
expression = member(expression, id(parts[i2]));
|
|
11969
|
+
}
|
|
11970
|
+
return expression;
|
|
11971
|
+
}
|
|
11750
11972
|
function object(properties, loc_info) {
|
|
11751
11973
|
const node = { type: "ObjectExpression", properties, metadata: { path: [] } };
|
|
11752
11974
|
return set_location(node, loc_info);
|
|
@@ -11778,10 +12000,39 @@ function assignment_prop(key2, value, computed = false, shorthand = false) {
|
|
|
11778
12000
|
metadata: { path: [] }
|
|
11779
12001
|
};
|
|
11780
12002
|
}
|
|
12003
|
+
function prop_def(key2, value, computed = false, is_static = false) {
|
|
12004
|
+
return (
|
|
12005
|
+
/** @type {AST.PropertyDefinition} */
|
|
12006
|
+
{
|
|
12007
|
+
type: "PropertyDefinition",
|
|
12008
|
+
key: key2,
|
|
12009
|
+
value,
|
|
12010
|
+
decorators: [],
|
|
12011
|
+
computed,
|
|
12012
|
+
static: is_static,
|
|
12013
|
+
metadata: { path: [] }
|
|
12014
|
+
}
|
|
12015
|
+
);
|
|
12016
|
+
}
|
|
11781
12017
|
function quasi(cooked, tail = false) {
|
|
11782
12018
|
const raw = sanitize_template_string(cooked);
|
|
11783
12019
|
return { type: "TemplateElement", value: { raw, cooked }, tail, metadata: { path: [] } };
|
|
11784
12020
|
}
|
|
12021
|
+
function rest(argument) {
|
|
12022
|
+
return { type: "RestElement", argument, metadata: { path: [] } };
|
|
12023
|
+
}
|
|
12024
|
+
function sequence(expressions) {
|
|
12025
|
+
return { type: "SequenceExpression", expressions, metadata: { path: [] } };
|
|
12026
|
+
}
|
|
12027
|
+
function set(name, body) {
|
|
12028
|
+
return (
|
|
12029
|
+
/** @type {AST.Property & { value: AST.FunctionExpression}} */
|
|
12030
|
+
prop("set", key(name), function_builder(null, [id("$$value")], block(body)))
|
|
12031
|
+
);
|
|
12032
|
+
}
|
|
12033
|
+
function spread(argument) {
|
|
12034
|
+
return { type: "SpreadElement", argument, metadata: { path: [] } };
|
|
12035
|
+
}
|
|
11785
12036
|
function stmt(expression) {
|
|
11786
12037
|
return { type: "ExpressionStatement", expression, metadata: { path: [] } };
|
|
11787
12038
|
}
|
|
@@ -11789,16 +12040,89 @@ function template(elements, expressions, loc_info) {
|
|
|
11789
12040
|
const node = { type: "TemplateLiteral", quasis: elements, expressions, metadata: { path: [] } };
|
|
11790
12041
|
return set_location(node, loc_info);
|
|
11791
12042
|
}
|
|
12043
|
+
function thunk(expression, async2 = false) {
|
|
12044
|
+
const fn = arrow([], expression);
|
|
12045
|
+
if (async2) fn.async = true;
|
|
12046
|
+
return unthunk(fn);
|
|
12047
|
+
}
|
|
12048
|
+
function unthunk(expression) {
|
|
12049
|
+
if (expression.type === "ArrowFunctionExpression" && expression.async === false && expression.body.type === "CallExpression" && expression.body.callee.type === "Identifier" && expression.params.length === expression.body.arguments.length && expression.params.every((param, index) => {
|
|
12050
|
+
const arg = (
|
|
12051
|
+
/** @type {AST.SimpleCallExpression} */
|
|
12052
|
+
expression.body.arguments[index]
|
|
12053
|
+
);
|
|
12054
|
+
return param.type === "Identifier" && arg.type === "Identifier" && param.name === arg.name;
|
|
12055
|
+
})) {
|
|
12056
|
+
return expression.body.callee;
|
|
12057
|
+
}
|
|
12058
|
+
return expression;
|
|
12059
|
+
}
|
|
12060
|
+
function new_builder(expression, loc_info, ...args) {
|
|
12061
|
+
if (typeof expression === "string") expression = id(expression);
|
|
12062
|
+
const node = {
|
|
12063
|
+
callee: expression,
|
|
12064
|
+
arguments: args,
|
|
12065
|
+
type: "NewExpression",
|
|
12066
|
+
metadata: { path: [] }
|
|
12067
|
+
};
|
|
12068
|
+
return set_location(node, loc_info);
|
|
12069
|
+
}
|
|
12070
|
+
function update(operator, argument, prefix = false) {
|
|
12071
|
+
return { type: "UpdateExpression", operator, argument, prefix, metadata: { path: [] } };
|
|
12072
|
+
}
|
|
12073
|
+
function do_while(test, body) {
|
|
12074
|
+
return { type: "DoWhileStatement", test, body, metadata: { path: [] } };
|
|
12075
|
+
}
|
|
11792
12076
|
var true_instance = literal2(true);
|
|
11793
12077
|
var false_instance = literal2(false);
|
|
11794
12078
|
var null_instance = literal2(null);
|
|
12079
|
+
var debugger_builder = {
|
|
12080
|
+
type: "DebuggerStatement",
|
|
12081
|
+
metadata: { path: [] }
|
|
12082
|
+
};
|
|
12083
|
+
var this_instance = {
|
|
12084
|
+
type: "ThisExpression",
|
|
12085
|
+
metadata: { path: [] }
|
|
12086
|
+
};
|
|
11795
12087
|
function let_builder(pattern, init2) {
|
|
11796
12088
|
return declaration("let", [declarator(pattern, init2)]);
|
|
11797
12089
|
}
|
|
11798
12090
|
function const_builder(pattern, init2) {
|
|
11799
12091
|
return declaration("const", [declarator(pattern, init2)]);
|
|
11800
12092
|
}
|
|
11801
|
-
function
|
|
12093
|
+
function var_builder(pattern, init2) {
|
|
12094
|
+
return declaration("var", [declarator(pattern, init2)]);
|
|
12095
|
+
}
|
|
12096
|
+
function for_builder(init2, test, update2, body) {
|
|
12097
|
+
return { type: "ForStatement", init: init2, test, update: update2, body, metadata: { path: [] } };
|
|
12098
|
+
}
|
|
12099
|
+
function for_of(left, right, body, await_flag = false, loc_info) {
|
|
12100
|
+
const node = {
|
|
12101
|
+
type: "ForOfStatement",
|
|
12102
|
+
left,
|
|
12103
|
+
right,
|
|
12104
|
+
body,
|
|
12105
|
+
await: await_flag,
|
|
12106
|
+
metadata: { path: [] }
|
|
12107
|
+
};
|
|
12108
|
+
return set_location(node, loc_info);
|
|
12109
|
+
}
|
|
12110
|
+
function method(kind, key2, params, body, computed = false, is_static = false) {
|
|
12111
|
+
return (
|
|
12112
|
+
/** @type {AST.MethodDefinition} */
|
|
12113
|
+
{
|
|
12114
|
+
type: "MethodDefinition",
|
|
12115
|
+
key: key2,
|
|
12116
|
+
kind,
|
|
12117
|
+
value: function_builder(null, params, block(body)),
|
|
12118
|
+
decorators: [],
|
|
12119
|
+
computed,
|
|
12120
|
+
static: is_static,
|
|
12121
|
+
metadata: { path: [] }
|
|
12122
|
+
}
|
|
12123
|
+
);
|
|
12124
|
+
}
|
|
12125
|
+
function function_builder(id2, params, body, async2 = false, type_parameters, loc_info) {
|
|
11802
12126
|
const node = {
|
|
11803
12127
|
type: "FunctionExpression",
|
|
11804
12128
|
id: id2,
|
|
@@ -11806,7 +12130,7 @@ function function_builder(id2, params, body, async = false, type_parameters, loc
|
|
|
11806
12130
|
body,
|
|
11807
12131
|
typeParameters: type_parameters,
|
|
11808
12132
|
generator: false,
|
|
11809
|
-
async,
|
|
12133
|
+
async: async2,
|
|
11810
12134
|
metadata: { path: [] }
|
|
11811
12135
|
};
|
|
11812
12136
|
return set_location(node, loc_info);
|
|
@@ -11815,6 +12139,16 @@ function if_builder(test, consequent, alternate, loc_info) {
|
|
|
11815
12139
|
const node = { type: "IfStatement", test, consequent, alternate, metadata: { path: [] } };
|
|
11816
12140
|
return set_location(node, loc_info);
|
|
11817
12141
|
}
|
|
12142
|
+
function import_all(as, source, attributes = [], importKind = "value") {
|
|
12143
|
+
return {
|
|
12144
|
+
type: "ImportDeclaration",
|
|
12145
|
+
source: literal2(source),
|
|
12146
|
+
specifiers: [import_namespace(as)],
|
|
12147
|
+
attributes,
|
|
12148
|
+
importKind,
|
|
12149
|
+
metadata: { path: [] }
|
|
12150
|
+
};
|
|
12151
|
+
}
|
|
11818
12152
|
function imports(parts, source, attributes = [], importKind = "value") {
|
|
11819
12153
|
return {
|
|
11820
12154
|
type: "ImportDeclaration",
|
|
@@ -11848,6 +12182,13 @@ function return_builder(argument = null, loc_info) {
|
|
|
11848
12182
|
const node = { type: "ReturnStatement", argument, metadata: { path: [] } };
|
|
11849
12183
|
return set_location(node, loc_info);
|
|
11850
12184
|
}
|
|
12185
|
+
function throw_error(str) {
|
|
12186
|
+
return {
|
|
12187
|
+
type: "ThrowStatement",
|
|
12188
|
+
argument: new_builder("Error", void 0, literal2(str)),
|
|
12189
|
+
metadata: { path: [] }
|
|
12190
|
+
};
|
|
12191
|
+
}
|
|
11851
12192
|
function try_builder(block2, handler = null, finalizer = null, pending = null) {
|
|
11852
12193
|
return {
|
|
11853
12194
|
type: "TryStatement",
|
|
@@ -11985,6 +12326,17 @@ function jsx_member(object3, property) {
|
|
|
11985
12326
|
metadata: { path: [] }
|
|
11986
12327
|
};
|
|
11987
12328
|
}
|
|
12329
|
+
function jsx_spread_attribute(argument, loc_info) {
|
|
12330
|
+
const node = (
|
|
12331
|
+
/** @type {ESTreeJSX.JSXSpreadAttribute} */
|
|
12332
|
+
{
|
|
12333
|
+
type: "JSXSpreadAttribute",
|
|
12334
|
+
argument,
|
|
12335
|
+
metadata: { path: [] }
|
|
12336
|
+
}
|
|
12337
|
+
);
|
|
12338
|
+
return set_location(node, loc_info);
|
|
12339
|
+
}
|
|
11988
12340
|
function jsx_text(value, raw, loc_info) {
|
|
11989
12341
|
const node = (
|
|
11990
12342
|
/** @type {ESTreeJSX.JSXText} */
|
|
@@ -12015,8 +12367,18 @@ function switch_case(test = null, consequent = []) {
|
|
|
12015
12367
|
};
|
|
12016
12368
|
}
|
|
12017
12369
|
var void0 = unary("void", literal2(0));
|
|
12370
|
+
var break_statement = {
|
|
12371
|
+
type: "BreakStatement",
|
|
12372
|
+
label: null,
|
|
12373
|
+
metadata: { path: [] }
|
|
12374
|
+
};
|
|
12375
|
+
var continue_statement = {
|
|
12376
|
+
type: "ContinueStatement",
|
|
12377
|
+
label: null,
|
|
12378
|
+
metadata: { path: [] }
|
|
12379
|
+
};
|
|
12018
12380
|
|
|
12019
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
12381
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/ast.js
|
|
12020
12382
|
function is_ast_node(value) {
|
|
12021
12383
|
return !!value && typeof value === "object" && "type" in value;
|
|
12022
12384
|
}
|
|
@@ -12064,9 +12426,6 @@ function is_function_node(node) {
|
|
|
12064
12426
|
function is_function_or_class_node(node) {
|
|
12065
12427
|
return !!node && (is_function_node(node) || is_class_node(node));
|
|
12066
12428
|
}
|
|
12067
|
-
function is_function_or_component_node(node) {
|
|
12068
|
-
return is_function_node(node);
|
|
12069
|
-
}
|
|
12070
12429
|
function is_class_node(node) {
|
|
12071
12430
|
return node.type === "ClassExpression" || node.type === "ClassDeclaration";
|
|
12072
12431
|
}
|
|
@@ -12118,23 +12477,6 @@ function is_transparent_expression_wrapper(parent, child) {
|
|
|
12118
12477
|
return (parent.type === "ParenthesizedExpression" || parent.type === "TSAsExpression" || parent.type === "TSSatisfiesExpression" || parent.type === "TSNonNullExpression" || parent.type === "TSInstantiationExpression" || parent.type === "TSTypeAssertion" || parent.type === "ChainExpression") && /** @type {{ expression?: AST.Node }} */
|
|
12119
12478
|
parent.expression === child;
|
|
12120
12479
|
}
|
|
12121
|
-
function is_supported_lazy_assignment_position(node, path) {
|
|
12122
|
-
if (node.operator !== "=" || node.left.type !== "ObjectPattern" && node.left.type !== "ArrayPattern" || !node.left.lazy) {
|
|
12123
|
-
return false;
|
|
12124
|
-
}
|
|
12125
|
-
let child = node;
|
|
12126
|
-
for (let i2 = path.length - 1; i2 >= 0; i2 -= 1) {
|
|
12127
|
-
const parent = path[i2];
|
|
12128
|
-
if (is_transparent_expression_wrapper(parent, child)) {
|
|
12129
|
-
child = parent;
|
|
12130
|
-
continue;
|
|
12131
|
-
}
|
|
12132
|
-
if (parent.type !== "ExpressionStatement" || parent.expression !== child) return false;
|
|
12133
|
-
const container = path[i2 - 1];
|
|
12134
|
-
return !!container && is_statement_list_item(container, parent);
|
|
12135
|
-
}
|
|
12136
|
-
return false;
|
|
12137
|
-
}
|
|
12138
12480
|
function object2(expression) {
|
|
12139
12481
|
while (expression.type === "MemberExpression") {
|
|
12140
12482
|
expression = /** @type {AST.MemberExpression | AST.Identifier} */
|
|
@@ -12180,7 +12522,7 @@ function extract_identifiers(pattern) {
|
|
|
12180
12522
|
return unwrap_pattern(pattern, []).filter((node) => node.type === "Identifier");
|
|
12181
12523
|
}
|
|
12182
12524
|
|
|
12183
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
12525
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/parse/index.js
|
|
12184
12526
|
var BINDING_TYPES = {
|
|
12185
12527
|
BIND_NONE: 0,
|
|
12186
12528
|
// Not a binding
|
|
@@ -13129,13 +13471,13 @@ var sha256 = /* @__PURE__ */ createHasher(
|
|
|
13129
13471
|
/* @__PURE__ */ oidNist(1)
|
|
13130
13472
|
);
|
|
13131
13473
|
|
|
13132
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
13474
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/hashing.js
|
|
13133
13475
|
var regex_return_characters = /\r/g;
|
|
13134
13476
|
function strong_hash(str) {
|
|
13135
13477
|
return bytesToHex(sha256(utf8ToBytes(str.replace(regex_return_characters, "")))).slice(0, 8);
|
|
13136
13478
|
}
|
|
13137
13479
|
|
|
13138
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
13480
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/parse/style.js
|
|
13139
13481
|
var REGEX_MATCHER = /^[~^$*|]?=/;
|
|
13140
13482
|
var REGEX_ATTRIBUTE_FLAGS = /^[a-zA-Z]+/;
|
|
13141
13483
|
var REGEX_COMMENT_CLOSE = /\*\//;
|
|
@@ -13702,7 +14044,7 @@ function read_identifier(parser) {
|
|
|
13702
14044
|
return identifier;
|
|
13703
14045
|
}
|
|
13704
14046
|
|
|
13705
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
14047
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/errors.js
|
|
13706
14048
|
function error(message, filename, node, errors, comments, code) {
|
|
13707
14049
|
if (errors && comments && is_error_suppressed(node, comments)) {
|
|
13708
14050
|
return;
|
|
@@ -13752,7 +14094,7 @@ function is_error_suppressed(node, comments) {
|
|
|
13752
14094
|
return false;
|
|
13753
14095
|
}
|
|
13754
14096
|
|
|
13755
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
14097
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/diagnostics.js
|
|
13756
14098
|
var DIAGNOSTIC_CODES = {
|
|
13757
14099
|
/** A recognized `import.meta.env.platform.*` flag is used without a selected platform. */
|
|
13758
14100
|
PLATFORM_REQUIRED: "tsrx-platform-required",
|
|
@@ -13762,7 +14104,6 @@ var DIAGNOSTIC_CODES = {
|
|
|
13762
14104
|
TEMPLATE_EXPRESSION_TRAILING_SEMICOLON: "tsrx-template-expression-trailing-semicolon",
|
|
13763
14105
|
TEMPLATE_RETURN_STATEMENT: "tsrx-template-return-statement",
|
|
13764
14106
|
FORGOTTEN_STATEMENT_CONTAINER: "tsrx-forgotten-statement-container",
|
|
13765
|
-
UNSUPPORTED_LAZY_ASSIGNMENT_POSITION: "tsrx-unsupported-lazy-assignment-position",
|
|
13766
14107
|
/** `<style apply>` carries no expression value. */
|
|
13767
14108
|
STYLE_APPLY_VALUE: "tsrx-style-apply-value",
|
|
13768
14109
|
/** An `apply` entry is not an identifier, member, or array of those, or does not resolve to a style block. */
|
|
@@ -13787,10 +14128,9 @@ var DIAGNOSTIC_CODES = {
|
|
|
13787
14128
|
CSS_GLOBAL_PLACEMENT: "tsrx-css-global-placement"
|
|
13788
14129
|
};
|
|
13789
14130
|
|
|
13790
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
14131
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/analyze/validation.js
|
|
13791
14132
|
var TSRX_RETURN_STATEMENT_ERROR = "Return statements are not allowed inside TSRX templates. Move the return before the TSRX return value, or use conditional rendering instead.";
|
|
13792
14133
|
var TSRX_FORGOTTEN_STATEMENT_CONTAINER_ERROR = "This TSRX template output is unused. Return it, assign it to a value that is rendered, or make it part of the rendered output of a function '@{...}' body.";
|
|
13793
|
-
var TSRX_UNSUPPORTED_LAZY_ASSIGNMENT_POSITION_ERROR = "Lazy destructuring assignments require a directly lazy target as a standalone statement inside a program, block, TSRX code block, or switch case.";
|
|
13794
14134
|
var TSRX_STYLE_APPLY_VALUE_ERROR = "The 'apply' attribute of a <style> block requires an expression value: apply={theme} or apply={[a, b]}.";
|
|
13795
14135
|
var TSRX_STYLE_APPLY_DUPLICATE_ERROR = "A <style> block accepts a single 'apply' attribute; pass several themes as an array: apply={[a, b]}.";
|
|
13796
14136
|
var TSRX_STYLE_APPLY_UNSUPPORTED_HOST_ERROR = "The 'apply' attribute is only supported on scoped <style> blocks, not on <head> styles or resource styles.";
|
|
@@ -13819,16 +14159,6 @@ function validate_forgotten_statement_container(node, filename, errors, comments
|
|
|
13819
14159
|
DIAGNOSTIC_CODES.FORGOTTEN_STATEMENT_CONTAINER
|
|
13820
14160
|
);
|
|
13821
14161
|
}
|
|
13822
|
-
function validate_unsupported_lazy_assignment_position(node, filename, errors, comments) {
|
|
13823
|
-
error(
|
|
13824
|
-
TSRX_UNSUPPORTED_LAZY_ASSIGNMENT_POSITION_ERROR,
|
|
13825
|
-
filename ?? null,
|
|
13826
|
-
node,
|
|
13827
|
-
errors,
|
|
13828
|
-
comments,
|
|
13829
|
-
DIAGNOSTIC_CODES.UNSUPPORTED_LAZY_ASSIGNMENT_POSITION
|
|
13830
|
-
);
|
|
13831
|
-
}
|
|
13832
14162
|
function is_template_value_position(parent, child) {
|
|
13833
14163
|
switch (parent.type) {
|
|
13834
14164
|
case "VariableDeclarator":
|
|
@@ -13868,7 +14198,7 @@ function validate_style(message, code, node, filename, errors, comments) {
|
|
|
13868
14198
|
error(message, filename, node, errors, comments, code);
|
|
13869
14199
|
}
|
|
13870
14200
|
|
|
13871
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
14201
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/plugin.js
|
|
13872
14202
|
var CharCode = Object.freeze({
|
|
13873
14203
|
tab: 9,
|
|
13874
14204
|
lineFeed: 10,
|
|
@@ -13969,62 +14299,6 @@ function get_argument_clash_reported_names(check_clashes) {
|
|
|
13969
14299
|
}
|
|
13970
14300
|
return reported_names;
|
|
13971
14301
|
}
|
|
13972
|
-
function get_lazy_binding_pos(refDestructuringErrors) {
|
|
13973
|
-
return refDestructuringErrors?.lazyBindingPos ?? -1;
|
|
13974
|
-
}
|
|
13975
|
-
var lazy_target_wrapper_types = /* @__PURE__ */ new Set([
|
|
13976
|
-
"ParenthesizedExpression",
|
|
13977
|
-
"TSAsExpression",
|
|
13978
|
-
"TSSatisfiesExpression",
|
|
13979
|
-
"TSNonNullExpression",
|
|
13980
|
-
"TSTypeAssertion",
|
|
13981
|
-
"TSTypeCastExpression"
|
|
13982
|
-
]);
|
|
13983
|
-
function pattern_position_contains_lazy(node, pos) {
|
|
13984
|
-
if (!node || typeof node !== "object") return false;
|
|
13985
|
-
if (
|
|
13986
|
-
/** @type {AST.ObjectPattern | AST.ArrayPattern} */
|
|
13987
|
-
node.lazy && /** @type {number} */
|
|
13988
|
-
node.start === pos + 1
|
|
13989
|
-
) {
|
|
13990
|
-
return true;
|
|
13991
|
-
}
|
|
13992
|
-
if (lazy_target_wrapper_types.has(node.type)) {
|
|
13993
|
-
return pattern_position_contains_lazy(
|
|
13994
|
-
/** @type {{ expression: AST.Node }} */
|
|
13995
|
-
/** @type {unknown} */
|
|
13996
|
-
node.expression,
|
|
13997
|
-
pos
|
|
13998
|
-
);
|
|
13999
|
-
}
|
|
14000
|
-
switch (node.type) {
|
|
14001
|
-
case "ObjectExpression":
|
|
14002
|
-
case "ObjectPattern":
|
|
14003
|
-
return node.properties.some(
|
|
14004
|
-
(property) => pattern_position_contains_lazy(
|
|
14005
|
-
property.type === "Property" ? (
|
|
14006
|
-
/** @type {AST.Node} */
|
|
14007
|
-
property.value
|
|
14008
|
-
) : property.argument,
|
|
14009
|
-
pos
|
|
14010
|
-
)
|
|
14011
|
-
);
|
|
14012
|
-
case "ArrayExpression":
|
|
14013
|
-
case "ArrayPattern":
|
|
14014
|
-
return node.elements.some(
|
|
14015
|
-
(element) => element && pattern_position_contains_lazy(element, pos)
|
|
14016
|
-
);
|
|
14017
|
-
case "AssignmentExpression":
|
|
14018
|
-
return node.operator === "=" && pattern_position_contains_lazy(node.left, pos);
|
|
14019
|
-
case "AssignmentPattern":
|
|
14020
|
-
return pattern_position_contains_lazy(node.left, pos);
|
|
14021
|
-
case "SpreadElement":
|
|
14022
|
-
case "RestElement":
|
|
14023
|
-
return pattern_position_contains_lazy(node.argument, pos);
|
|
14024
|
-
default:
|
|
14025
|
-
return false;
|
|
14026
|
-
}
|
|
14027
|
-
}
|
|
14028
14302
|
function can_start_tag_after_lt(input, index) {
|
|
14029
14303
|
const next = index + 1 < input.length ? input.charCodeAt(index + 1) : -1;
|
|
14030
14304
|
return next === CharCode.slash || next === CharCode.greaterThan || next === CharCode.openBrace || next === CharCode.at || next === CharCode.dollar || next === CharCode.underscore || next >= CharCode.uppercaseA && next <= CharCode.uppercaseZ || next >= CharCode.lowercaseA && next <= CharCode.lowercaseZ;
|
|
@@ -15115,16 +15389,6 @@ function TSRXPlugin(config) {
|
|
|
15115
15389
|
* @type {Parse.Parser['parseExprAtom']}
|
|
15116
15390
|
*/
|
|
15117
15391
|
parseExprAtom(refDestructuringErrors, forInit, forNew) {
|
|
15118
|
-
if (refDestructuringErrors && this.type === tt.bitwiseAND && (this.input.charCodeAt(this.end) === CharCode.openBrace || this.input.charCodeAt(this.end) === CharCode.openBracket)) {
|
|
15119
|
-
if (get_lazy_binding_pos(refDestructuringErrors) < 0) {
|
|
15120
|
-
refDestructuringErrors.lazyBindingPos = this.start;
|
|
15121
|
-
}
|
|
15122
|
-
return (
|
|
15123
|
-
/** @type {AST.Expression} */
|
|
15124
|
-
/** @type {unknown} */
|
|
15125
|
-
this.parseBindingAtom()
|
|
15126
|
-
);
|
|
15127
|
-
}
|
|
15128
15392
|
if (this.input.charCodeAt(this.start) === CharCode.at && this.type !== tstt.jsxText) {
|
|
15129
15393
|
if (this.#isCodeBlockStart(this.start)) {
|
|
15130
15394
|
return this.#parseCodeBlock();
|
|
@@ -15236,20 +15500,20 @@ function TSRXPlugin(config) {
|
|
|
15236
15500
|
this.raise(this.start, "Expected `{` after JSX control-flow directive.");
|
|
15237
15501
|
}
|
|
15238
15502
|
const emptyKeyword = this.#lastClauseKeywordSpan;
|
|
15239
|
-
let
|
|
15503
|
+
let empty3;
|
|
15240
15504
|
this.#templateControlFlowBlockDepth++;
|
|
15241
15505
|
try {
|
|
15242
|
-
|
|
15506
|
+
empty3 = this.parseBlock();
|
|
15243
15507
|
} finally {
|
|
15244
15508
|
this.#templateControlFlowBlockDepth--;
|
|
15245
15509
|
}
|
|
15246
|
-
node.empty =
|
|
15510
|
+
node.empty = empty3;
|
|
15247
15511
|
node.emptyKeyword = emptyKeyword;
|
|
15248
|
-
node.end =
|
|
15512
|
+
node.end = empty3.end;
|
|
15249
15513
|
node.loc.end = /** @type {AST.NodeWithLocation} */
|
|
15250
|
-
|
|
15514
|
+
empty3.loc.end;
|
|
15251
15515
|
if (node.range) node.range[1] = /** @type {number} */
|
|
15252
|
-
|
|
15516
|
+
empty3.end;
|
|
15253
15517
|
} else if (this.#isUnprefixedDirectiveClauseContinuation("empty", ["{"])) {
|
|
15254
15518
|
this.raise(this.start, "Expected `@empty` after `@for` block.");
|
|
15255
15519
|
} else {
|
|
@@ -16455,43 +16719,6 @@ function TSRXPlugin(config) {
|
|
|
16455
16719
|
}
|
|
16456
16720
|
return super.getTokenFromCode(code);
|
|
16457
16721
|
}
|
|
16458
|
-
/**
|
|
16459
|
-
* Override isLet to recognize `let &{` and `let &[` as variable declarations.
|
|
16460
|
-
* Acorn's isLet checks the char after `let` and only recognizes `{`, `[`, or identifiers.
|
|
16461
|
-
* The `&` character is not in that set, so `let &{...}` would not be parsed as a declaration.
|
|
16462
|
-
* @type {Parse.Parser['isLet']}
|
|
16463
|
-
*/
|
|
16464
|
-
isLet(context) {
|
|
16465
|
-
if (!this.isContextual("let")) return false;
|
|
16466
|
-
const skip = /\s*/y;
|
|
16467
|
-
skip.lastIndex = this.pos;
|
|
16468
|
-
const match = skip.exec(this.input);
|
|
16469
|
-
if (!match) return super.isLet(context);
|
|
16470
|
-
const next = this.pos + match[0].length;
|
|
16471
|
-
const nextCh = this.input.charCodeAt(next);
|
|
16472
|
-
if (nextCh === CharCode.ampersand) {
|
|
16473
|
-
const afterAmp = this.input.charCodeAt(next + 1);
|
|
16474
|
-
if (afterAmp === CharCode.openBrace || afterAmp === CharCode.openBracket) return true;
|
|
16475
|
-
}
|
|
16476
|
-
return super.isLet(context);
|
|
16477
|
-
}
|
|
16478
|
-
/**
|
|
16479
|
-
* Parse binding atom - handles lazy destructuring patterns (&{...} and &[...])
|
|
16480
|
-
* When & is directly followed by { or [, parse as a lazy destructuring pattern.
|
|
16481
|
-
* The resulting ObjectPattern/ArrayPattern node gets a `lazy: true` flag.
|
|
16482
|
-
*/
|
|
16483
|
-
parseBindingAtom() {
|
|
16484
|
-
if (this.type === tt.bitwiseAND) {
|
|
16485
|
-
const charAfterAmp = this.input.charCodeAt(this.end);
|
|
16486
|
-
if (charAfterAmp === CharCode.openBrace || charAfterAmp === CharCode.openBracket) {
|
|
16487
|
-
this.next();
|
|
16488
|
-
const pattern = super.parseBindingAtom();
|
|
16489
|
-
pattern.lazy = true;
|
|
16490
|
-
return pattern;
|
|
16491
|
-
}
|
|
16492
|
-
}
|
|
16493
|
-
return super.parseBindingAtom();
|
|
16494
|
-
}
|
|
16495
16722
|
/**
|
|
16496
16723
|
* Acorn reports only the second duplicate function parameter. When collecting,
|
|
16497
16724
|
* report the first one too so editor diagnostics can underline both
|
|
@@ -16550,39 +16777,10 @@ function TSRXPlugin(config) {
|
|
|
16550
16777
|
}
|
|
16551
16778
|
return expr;
|
|
16552
16779
|
}
|
|
16553
|
-
/**
|
|
16554
|
-
* A recorded lazy binding pattern that never became a binding or
|
|
16555
|
-
* assignment target is a pending error, exactly like `{a = b}` shorthand
|
|
16556
|
-
* outside a destructuring pattern. Acorn calls the throwing form at every
|
|
16557
|
-
* boundary where a context definitively stayed an expression
|
|
16558
|
-
* (parenthesized expressions, call arguments, plain assignments'
|
|
16559
|
-
* right-hand sides, …) — that is where the record is enforced.
|
|
16560
|
-
*
|
|
16561
|
-
* The non-throwing form is deliberately left untouched: Acorn uses it in
|
|
16562
|
-
* parseExprOps/parseMaybeConditional to stop parsing operators early, and
|
|
16563
|
-
* returning true there would cut the pattern off from the `as` /
|
|
16564
|
-
* `satisfies` operator lane before toAssignable can accept the wrapped
|
|
16565
|
-
* target (`[&{ a } as T] = arr`). Every path that keeps a stale record
|
|
16566
|
-
* still ends in a throwing check.
|
|
16567
|
-
*
|
|
16568
|
-
* @type {Parse.Parser['checkExpressionErrors']}
|
|
16569
|
-
*/
|
|
16570
|
-
checkExpressionErrors(refDestructuringErrors, andThrow) {
|
|
16571
|
-
if (andThrow) {
|
|
16572
|
-
const lazy_binding_pos = get_lazy_binding_pos(refDestructuringErrors);
|
|
16573
|
-
if (lazy_binding_pos >= 0) {
|
|
16574
|
-
this.raise(
|
|
16575
|
-
lazy_binding_pos,
|
|
16576
|
-
"Lazy binding patterns are only valid as binding or assignment targets"
|
|
16577
|
-
);
|
|
16578
|
-
}
|
|
16579
|
-
}
|
|
16580
|
-
return super.checkExpressionErrors(refDestructuringErrors, andThrow);
|
|
16581
|
-
}
|
|
16582
16780
|
/**
|
|
16583
16781
|
* acorn-typescript unwraps TS expression wrappers in checkLValSimple,
|
|
16584
16782
|
* which is only right for simple targets (`[b as any] = arr`). A wrapped
|
|
16585
|
-
* destructuring pattern (`[
|
|
16783
|
+
* destructuring pattern (`[{ a } as T] = arr`) reaches checkLValPattern
|
|
16586
16784
|
* still wrapped — toAssignableList ignores return values, so the wrapper
|
|
16587
16785
|
* survives conversion — and would fall through to checkLValSimple's
|
|
16588
16786
|
* "Assigning to rvalue". Unwrap here so wrapped patterns take the
|
|
@@ -16600,29 +16798,6 @@ function TSRXPlugin(config) {
|
|
|
16600
16798
|
}
|
|
16601
16799
|
return super.checkLValPattern(node, bindingType, checkClashes);
|
|
16602
16800
|
}
|
|
16603
|
-
/**
|
|
16604
|
-
* Converting a node into an assignment target resolves any lazy binding
|
|
16605
|
-
* pattern recorded inside it — the pattern landed in a valid position,
|
|
16606
|
-
* so its pending error must not outlive the conversion (e.g.
|
|
16607
|
-
* `({ pair: &{ a } } = obj)` would otherwise still raise when the
|
|
16608
|
-
* enclosing parenthesized expression runs checkExpressionErrors). This
|
|
16609
|
-
* mirrors how Acorn resets `shorthandAssign` once the shorthand ends up
|
|
16610
|
-
* inside a converted left-hand side.
|
|
16611
|
-
*
|
|
16612
|
-
* @type {Parse.Parser['toAssignable']}
|
|
16613
|
-
*/
|
|
16614
|
-
toAssignable(node, isBinding, refDestructuringErrors, preserveTypeScriptWrapper) {
|
|
16615
|
-
const lazy_binding_pos = get_lazy_binding_pos(refDestructuringErrors);
|
|
16616
|
-
if (lazy_binding_pos >= 0 && pattern_position_contains_lazy(node, lazy_binding_pos)) {
|
|
16617
|
-
refDestructuringErrors.lazyBindingPos = -1;
|
|
16618
|
-
}
|
|
16619
|
-
return super.toAssignable(
|
|
16620
|
-
node,
|
|
16621
|
-
isBinding,
|
|
16622
|
-
refDestructuringErrors,
|
|
16623
|
-
preserveTypeScriptWrapper
|
|
16624
|
-
);
|
|
16625
|
-
}
|
|
16626
16801
|
/**
|
|
16627
16802
|
* Override checkLocalExport to check all scopes in the scope stack.
|
|
16628
16803
|
* This is needed because submodules create nested scopes, but exports
|
|
@@ -18239,39 +18414,6 @@ function TSRXPlugin(config) {
|
|
|
18239
18414
|
this.finishNode(node, "ExpressionStatement")
|
|
18240
18415
|
);
|
|
18241
18416
|
}
|
|
18242
|
-
if (this.type === tt.bitwiseAND) {
|
|
18243
|
-
const charAfterAmp = this.input.charCodeAt(this.end);
|
|
18244
|
-
if (charAfterAmp === CharCode.openBrace || charAfterAmp === CharCode.openBracket) {
|
|
18245
|
-
const node = (
|
|
18246
|
-
/** @type {AST.ExpressionStatement} */
|
|
18247
|
-
this.startNode()
|
|
18248
|
-
);
|
|
18249
|
-
const assign_node = (
|
|
18250
|
-
/** @type {AST.AssignmentExpression} */
|
|
18251
|
-
this.startNode()
|
|
18252
|
-
);
|
|
18253
|
-
this.next();
|
|
18254
|
-
const left = (
|
|
18255
|
-
/** @type {AST.ArrayPattern | AST.ObjectPattern} */
|
|
18256
|
-
/** @type {unknown} */
|
|
18257
|
-
this.parseExprAtom()
|
|
18258
|
-
);
|
|
18259
|
-
this.toAssignable(left, false);
|
|
18260
|
-
left.lazy = true;
|
|
18261
|
-
this.expect(tt.eq);
|
|
18262
|
-
assign_node.operator = "=";
|
|
18263
|
-
assign_node.left = left;
|
|
18264
|
-
assign_node.right = /** @type {AST.Expression} */
|
|
18265
|
-
this.parseMaybeAssign();
|
|
18266
|
-
node.expression = /** @type {AST.AssignmentExpression} */
|
|
18267
|
-
this.finishNode(assign_node, "AssignmentExpression");
|
|
18268
|
-
this.semicolon();
|
|
18269
|
-
return (
|
|
18270
|
-
/** @type {AST.ExpressionStatement} */
|
|
18271
|
-
this.finishNode(node, "ExpressionStatement")
|
|
18272
|
-
);
|
|
18273
|
-
}
|
|
18274
|
-
}
|
|
18275
18417
|
return super.parseStatement(context, topLevel, exports);
|
|
18276
18418
|
}
|
|
18277
18419
|
/**
|
|
@@ -18311,13 +18453,13 @@ function TSRXPlugin(config) {
|
|
|
18311
18453
|
};
|
|
18312
18454
|
}
|
|
18313
18455
|
|
|
18314
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
18456
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/parse/parse-module.js
|
|
18315
18457
|
var parse4 = createParser(TSRXPlugin());
|
|
18316
18458
|
function parse_module(source, filename, options) {
|
|
18317
18459
|
return parse4(source, filename, options);
|
|
18318
18460
|
}
|
|
18319
18461
|
|
|
18320
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
18462
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/is-reference.js
|
|
18321
18463
|
function is_reference(node, parent) {
|
|
18322
18464
|
if (node.type === "MemberExpression") {
|
|
18323
18465
|
return !node.computed && is_reference(node.object, node);
|
|
@@ -18354,7 +18496,7 @@ function is_reference(node, parent) {
|
|
|
18354
18496
|
}
|
|
18355
18497
|
}
|
|
18356
18498
|
|
|
18357
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
18499
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/dom.js
|
|
18358
18500
|
var RESERVED_WORDS = [
|
|
18359
18501
|
"arguments",
|
|
18360
18502
|
"await",
|
|
@@ -18457,12 +18599,12 @@ var DOM_PROPERTIES = [
|
|
|
18457
18599
|
"disableRemotePlayback"
|
|
18458
18600
|
];
|
|
18459
18601
|
|
|
18460
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
18602
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/identifier-utils.js
|
|
18461
18603
|
var IDENTIFIER_OBFUSCATION_PREFIX = "_$_";
|
|
18462
18604
|
var SERVER_IDENTIFIER = IDENTIFIER_OBFUSCATION_PREFIX + "server_$_";
|
|
18463
18605
|
var CSS_HASH_IDENTIFIER = IDENTIFIER_OBFUSCATION_PREFIX + "hash";
|
|
18464
18606
|
|
|
18465
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
18607
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/scope.js
|
|
18466
18608
|
function create_scopes(ast, root, parent, error_options) {
|
|
18467
18609
|
const scopes = /* @__PURE__ */ new Map();
|
|
18468
18610
|
const scope = new Scope3(root, parent, false, error_options);
|
|
@@ -18843,7 +18985,7 @@ var ScopeRoot = class {
|
|
|
18843
18985
|
}
|
|
18844
18986
|
};
|
|
18845
18987
|
|
|
18846
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
18988
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/constants.js
|
|
18847
18989
|
var TEMPLATE_USE_IMPORT_NODE = 1 << 1;
|
|
18848
18990
|
var IS_CONTROLLED = 1 << 2;
|
|
18849
18991
|
var IS_INDEXED = 1 << 3;
|
|
@@ -18855,7 +18997,7 @@ var HYDRATION_END = "]";
|
|
|
18855
18997
|
var BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
|
|
18856
18998
|
var BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
|
|
18857
18999
|
|
|
18858
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
19000
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/comment-utils.js
|
|
18859
19001
|
function is_ts_pragma(comment) {
|
|
18860
19002
|
if (comment.type !== "Line") return false;
|
|
18861
19003
|
const pragmas = ["@ts-ignore", "@ts-expect-error", "@ts-nocheck", "@ts-check"];
|
|
@@ -18911,7 +19053,7 @@ function format_comment(comment) {
|
|
|
18911
19053
|
}
|
|
18912
19054
|
}
|
|
18913
19055
|
|
|
18914
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
19056
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/jsx/ast-builders.js
|
|
18915
19057
|
function set_loc(node, source_node) {
|
|
18916
19058
|
node.metadata ??= { path: [] };
|
|
18917
19059
|
if (has_location(source_node)) {
|
|
@@ -19114,7 +19256,7 @@ function clone_ast_node(node, with_locations = true) {
|
|
|
19114
19256
|
return clone;
|
|
19115
19257
|
}
|
|
19116
19258
|
|
|
19117
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
19259
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/style-ref.js
|
|
19118
19260
|
var regex_backslash_and_following_character = /\\(.)/g;
|
|
19119
19261
|
function create_style_class_map(component, css, options = {}) {
|
|
19120
19262
|
return build_style_class_map(
|
|
@@ -19329,7 +19471,7 @@ function get_standalone_class_selector(complex_selector) {
|
|
|
19329
19471
|
return selector.type === "ClassSelector" ? selector : null;
|
|
19330
19472
|
}
|
|
19331
19473
|
|
|
19332
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
19474
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/analyze/style-analyze.js
|
|
19333
19475
|
function nearest_scope(path, scopes) {
|
|
19334
19476
|
for (let i2 = path.length - 1; i2 >= 0; i2 -= 1) {
|
|
19335
19477
|
const scope = scopes.get(path[i2]);
|
|
@@ -19616,50 +19758,7 @@ function analyze_styles(ast, scopes, state) {
|
|
|
19616
19758
|
return styles;
|
|
19617
19759
|
}
|
|
19618
19760
|
|
|
19619
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
19620
|
-
function find_first_lazy_pattern(node) {
|
|
19621
|
-
if ((node.type === "ObjectPattern" || node.type === "ArrayPattern") && node.lazy) {
|
|
19622
|
-
return node;
|
|
19623
|
-
}
|
|
19624
|
-
switch (node.type) {
|
|
19625
|
-
case "AssignmentPattern":
|
|
19626
|
-
return find_first_lazy_pattern(node.left);
|
|
19627
|
-
case "RestElement":
|
|
19628
|
-
return find_first_lazy_pattern(node.argument);
|
|
19629
|
-
case "ObjectPattern":
|
|
19630
|
-
for (const property of node.properties) {
|
|
19631
|
-
const lazy = property.type === "Property" ? find_first_lazy_pattern(property.value) : find_first_lazy_pattern(property.argument);
|
|
19632
|
-
if (lazy) return lazy;
|
|
19633
|
-
}
|
|
19634
|
-
return null;
|
|
19635
|
-
case "ArrayPattern":
|
|
19636
|
-
for (const element of node.elements) {
|
|
19637
|
-
if (!element) continue;
|
|
19638
|
-
const lazy = find_first_lazy_pattern(element);
|
|
19639
|
-
if (lazy) return lazy;
|
|
19640
|
-
}
|
|
19641
|
-
return null;
|
|
19642
|
-
default: {
|
|
19643
|
-
const expression = (
|
|
19644
|
-
/** @type {{ expression?: AST.Node }} */
|
|
19645
|
-
node.expression
|
|
19646
|
-
);
|
|
19647
|
-
return expression && is_transparent_expression_wrapper(node, expression) ? find_first_lazy_pattern(expression) : null;
|
|
19648
|
-
}
|
|
19649
|
-
}
|
|
19650
|
-
}
|
|
19651
|
-
function visit_assignment_expression(node, { next, path, state }) {
|
|
19652
|
-
const lazy = find_first_lazy_pattern(node.left);
|
|
19653
|
-
if (lazy && !is_supported_lazy_assignment_position(node, path)) {
|
|
19654
|
-
validate_unsupported_lazy_assignment_position(
|
|
19655
|
-
lazy,
|
|
19656
|
-
state.filename,
|
|
19657
|
-
state.collect ? state.errors : void 0,
|
|
19658
|
-
state.comments
|
|
19659
|
-
);
|
|
19660
|
-
}
|
|
19661
|
-
next();
|
|
19662
|
-
}
|
|
19761
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/analyze/index.js
|
|
19663
19762
|
function is_free_floating_template(node, path) {
|
|
19664
19763
|
let child = node;
|
|
19665
19764
|
for (let i2 = path.length - 1; i2 >= 0; i2 -= 1) {
|
|
@@ -19710,7 +19809,6 @@ function visit_class(_node, { next, state }) {
|
|
|
19710
19809
|
});
|
|
19711
19810
|
}
|
|
19712
19811
|
var visitors = {
|
|
19713
|
-
AssignmentExpression: visit_assignment_expression,
|
|
19714
19812
|
FunctionDeclaration: visit_function,
|
|
19715
19813
|
FunctionExpression: visit_function,
|
|
19716
19814
|
ArrowFunctionExpression: visit_function,
|
|
@@ -20913,14 +21011,14 @@ var MagicString = class _MagicString {
|
|
|
20913
21011
|
}
|
|
20914
21012
|
};
|
|
20915
21013
|
|
|
20916
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
21014
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/platform.js
|
|
20917
21015
|
var PLATFORMS = (
|
|
20918
21016
|
/** @type {const} */
|
|
20919
21017
|
["web", "ios", "android"]
|
|
20920
21018
|
);
|
|
20921
21019
|
var platform_set = new Set(PLATFORMS);
|
|
20922
21020
|
|
|
20923
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
21021
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/imports.js
|
|
20924
21022
|
function with_deferred_imports(visitors3) {
|
|
20925
21023
|
const print_import_declaration = visitors3.ImportDeclaration;
|
|
20926
21024
|
const print_import_expression = visitors3.ImportExpression;
|
|
@@ -21229,7 +21327,7 @@ function print(node, visitors3, opts = {}) {
|
|
|
21229
21327
|
};
|
|
21230
21328
|
}
|
|
21231
21329
|
|
|
21232
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
21330
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/analyze/css-analyze.js
|
|
21233
21331
|
function is_global_block_selector(simple_selector) {
|
|
21234
21332
|
return simple_selector.type === "PseudoClassSelector" && simple_selector.name === "global" && simple_selector.args === null;
|
|
21235
21333
|
}
|
|
@@ -21553,7 +21651,7 @@ var ts_default = (options = {}) => {
|
|
|
21553
21651
|
}
|
|
21554
21652
|
context.write(" }");
|
|
21555
21653
|
}
|
|
21556
|
-
function
|
|
21654
|
+
function sequence2(context, nodes, until, pad, separator = ",", trailing_newline = true) {
|
|
21557
21655
|
let multiline = false;
|
|
21558
21656
|
let length = -1;
|
|
21559
21657
|
const multiline_nodes = [];
|
|
@@ -21667,7 +21765,7 @@ var ts_default = (options = {}) => {
|
|
|
21667
21765
|
*/
|
|
21668
21766
|
"ArrayExpression|ArrayPattern": (node, context) => {
|
|
21669
21767
|
context.write("[", token_at(node.loc?.start));
|
|
21670
|
-
|
|
21768
|
+
sequence2(
|
|
21671
21769
|
context,
|
|
21672
21770
|
/** @type {TSESTree.Node[]} */
|
|
21673
21771
|
node.elements,
|
|
@@ -21803,7 +21901,7 @@ var ts_default = (options = {}) => {
|
|
|
21803
21901
|
}
|
|
21804
21902
|
if (node.implements && node.implements.length > 0) {
|
|
21805
21903
|
context.write("implements");
|
|
21806
|
-
|
|
21904
|
+
sequence2(context, node.implements, node.body.loc?.start ?? null, true);
|
|
21807
21905
|
}
|
|
21808
21906
|
context.visit(node.body);
|
|
21809
21907
|
},
|
|
@@ -21862,7 +21960,7 @@ var ts_default = (options = {}) => {
|
|
|
21862
21960
|
context.visit(node.typeParameters);
|
|
21863
21961
|
}
|
|
21864
21962
|
context.write("(");
|
|
21865
|
-
|
|
21963
|
+
sequence2(context, node.params, (node.returnType ?? node.body).loc?.start ?? null, false);
|
|
21866
21964
|
context.write(")");
|
|
21867
21965
|
if (node.returnType) context.visit(node.returnType);
|
|
21868
21966
|
context.write(" ");
|
|
@@ -21904,7 +22002,7 @@ var ts_default = (options = {}) => {
|
|
|
21904
22002
|
if (node.optional) context.write("?");
|
|
21905
22003
|
if (node.typeParameters) context.visit(node.typeParameters);
|
|
21906
22004
|
context.write("(");
|
|
21907
|
-
|
|
22005
|
+
sequence2(
|
|
21908
22006
|
context,
|
|
21909
22007
|
node.value.params,
|
|
21910
22008
|
(node.value.returnType ?? node.value.body)?.loc?.start ?? node.loc?.end ?? null,
|
|
@@ -21994,7 +22092,7 @@ var ts_default = (options = {}) => {
|
|
|
21994
22092
|
context.visit(node.typeParameters);
|
|
21995
22093
|
}
|
|
21996
22094
|
context.write("(");
|
|
21997
|
-
|
|
22095
|
+
sequence2(
|
|
21998
22096
|
context,
|
|
21999
22097
|
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
|
|
22000
22098
|
node.parameters ?? node.params,
|
|
@@ -22018,7 +22116,7 @@ var ts_default = (options = {}) => {
|
|
|
22018
22116
|
}
|
|
22019
22117
|
if (node.typeParameters) context.visit(node.typeParameters);
|
|
22020
22118
|
context.write("(");
|
|
22021
|
-
|
|
22119
|
+
sequence2(
|
|
22022
22120
|
context,
|
|
22023
22121
|
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
|
|
22024
22122
|
node.parameters ?? node.params,
|
|
@@ -22054,7 +22152,7 @@ var ts_default = (options = {}) => {
|
|
|
22054
22152
|
context.visit(node.typeParameters);
|
|
22055
22153
|
}
|
|
22056
22154
|
context.write("(");
|
|
22057
|
-
|
|
22155
|
+
sequence2(context, node.params, (node.returnType ?? node.body).loc?.start ?? null, false);
|
|
22058
22156
|
context.write(")");
|
|
22059
22157
|
if (node.returnType) context.visit(node.returnType);
|
|
22060
22158
|
context.write(" => ");
|
|
@@ -22216,7 +22314,7 @@ var ts_default = (options = {}) => {
|
|
|
22216
22314
|
else context.write("type ");
|
|
22217
22315
|
}
|
|
22218
22316
|
context.write("{");
|
|
22219
|
-
|
|
22317
|
+
sequence2(context, node.specifiers, node.source?.loc?.start ?? node.loc?.end ?? null, true);
|
|
22220
22318
|
context.write("}");
|
|
22221
22319
|
if (node.source) {
|
|
22222
22320
|
context.write(" from ");
|
|
@@ -22333,7 +22431,7 @@ var ts_default = (options = {}) => {
|
|
|
22333
22431
|
}
|
|
22334
22432
|
if (named_specifiers.length > 0) {
|
|
22335
22433
|
context.write("{");
|
|
22336
|
-
|
|
22434
|
+
sequence2(context, named_specifiers, node.source.loc?.start ?? null, true);
|
|
22337
22435
|
context.write("}");
|
|
22338
22436
|
}
|
|
22339
22437
|
context.write(" from ");
|
|
@@ -22404,12 +22502,12 @@ var ts_default = (options = {}) => {
|
|
|
22404
22502
|
NewExpression: shared["CallExpression|NewExpression"],
|
|
22405
22503
|
ObjectExpression(node, context) {
|
|
22406
22504
|
context.write("{", token_at(node.loc?.start));
|
|
22407
|
-
|
|
22505
|
+
sequence2(context, node.properties, node.loc?.end ?? null, true);
|
|
22408
22506
|
context.write("}", token_before(node.loc?.end));
|
|
22409
22507
|
},
|
|
22410
22508
|
ObjectPattern(node, context) {
|
|
22411
22509
|
context.write("{", token_at(node.loc?.start));
|
|
22412
|
-
|
|
22510
|
+
sequence2(context, node.properties, node.loc?.end ?? null, true);
|
|
22413
22511
|
context.write("}", token_before(node.loc?.end));
|
|
22414
22512
|
if (node.typeAnnotation) context.visit(node.typeAnnotation);
|
|
22415
22513
|
},
|
|
@@ -22446,7 +22544,7 @@ var ts_default = (options = {}) => {
|
|
|
22446
22544
|
context.visit(node.key);
|
|
22447
22545
|
if (node.computed) context.write("]", token_at(node.key.loc?.end));
|
|
22448
22546
|
context.write("(");
|
|
22449
|
-
|
|
22547
|
+
sequence2(
|
|
22450
22548
|
context,
|
|
22451
22549
|
node.value.params,
|
|
22452
22550
|
(node.value.returnType ?? node.value.body).loc?.start ?? null,
|
|
@@ -22485,7 +22583,7 @@ var ts_default = (options = {}) => {
|
|
|
22485
22583
|
},
|
|
22486
22584
|
SequenceExpression(node, context) {
|
|
22487
22585
|
context.write("(");
|
|
22488
|
-
|
|
22586
|
+
sequence2(context, node.expressions, node.loc?.end ?? null, false);
|
|
22489
22587
|
context.write(")");
|
|
22490
22588
|
},
|
|
22491
22589
|
SpreadElement: shared["RestElement|SpreadElement"],
|
|
@@ -22657,7 +22755,7 @@ var ts_default = (options = {}) => {
|
|
|
22657
22755
|
context.visit(node.typeParameters);
|
|
22658
22756
|
}
|
|
22659
22757
|
context.write("(");
|
|
22660
|
-
|
|
22758
|
+
sequence2(context, node.params, node.returnType?.loc?.start ?? node.loc?.end ?? null, false);
|
|
22661
22759
|
context.write(")");
|
|
22662
22760
|
if (node.returnType) {
|
|
22663
22761
|
context.visit(node.returnType);
|
|
@@ -22713,7 +22811,7 @@ var ts_default = (options = {}) => {
|
|
|
22713
22811
|
},
|
|
22714
22812
|
TSTypeLiteral(node, context) {
|
|
22715
22813
|
context.write("{ ");
|
|
22716
|
-
|
|
22814
|
+
sequence2(context, node.members, node.loc?.end ?? null, false, ";");
|
|
22717
22815
|
context.write(" }");
|
|
22718
22816
|
},
|
|
22719
22817
|
TSPropertySignature(node, context) {
|
|
@@ -22846,7 +22944,7 @@ var ts_default = (options = {}) => {
|
|
|
22846
22944
|
TSIndexSignature(node, context) {
|
|
22847
22945
|
if (node.readonly) context.write("readonly ");
|
|
22848
22946
|
context.write("[");
|
|
22849
|
-
|
|
22947
|
+
sequence2(context, node.parameters, node.typeAnnotation?.loc?.start ?? null, false);
|
|
22850
22948
|
context.write("]");
|
|
22851
22949
|
context.visit(node.typeAnnotation);
|
|
22852
22950
|
},
|
|
@@ -22896,7 +22994,7 @@ var ts_default = (options = {}) => {
|
|
|
22896
22994
|
context.visit(node.typeParameters);
|
|
22897
22995
|
}
|
|
22898
22996
|
context.write("(");
|
|
22899
|
-
|
|
22997
|
+
sequence2(
|
|
22900
22998
|
context,
|
|
22901
22999
|
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
|
|
22902
23000
|
node.parameters ?? node.params,
|
|
@@ -22911,7 +23009,7 @@ var ts_default = (options = {}) => {
|
|
|
22911
23009
|
},
|
|
22912
23010
|
TSTupleType(node, context) {
|
|
22913
23011
|
context.write("[");
|
|
22914
|
-
|
|
23012
|
+
sequence2(context, node.elementTypes, node.loc?.end ?? null, false);
|
|
22915
23013
|
context.write("]");
|
|
22916
23014
|
},
|
|
22917
23015
|
TSNamedTupleMember(node, context) {
|
|
@@ -22921,10 +23019,10 @@ var ts_default = (options = {}) => {
|
|
|
22921
23019
|
context.visit(node.elementType);
|
|
22922
23020
|
},
|
|
22923
23021
|
TSUnionType(node, context) {
|
|
22924
|
-
|
|
23022
|
+
sequence2(context, node.types, node.loc?.end ?? null, false, " |", false);
|
|
22925
23023
|
},
|
|
22926
23024
|
TSIntersectionType(node, context) {
|
|
22927
|
-
|
|
23025
|
+
sequence2(context, node.types, node.loc?.end ?? null, false, " &", false);
|
|
22928
23026
|
},
|
|
22929
23027
|
TSInferType(node, context) {
|
|
22930
23028
|
context.write("infer ");
|
|
@@ -23002,7 +23100,7 @@ var ts_default = (options = {}) => {
|
|
|
23002
23100
|
context.write(" {");
|
|
23003
23101
|
context.indent();
|
|
23004
23102
|
context.newline();
|
|
23005
|
-
|
|
23103
|
+
sequence2(context, node.members ?? node.body.members, node.loc?.end ?? null, false);
|
|
23006
23104
|
context.dedent();
|
|
23007
23105
|
context.newline();
|
|
23008
23106
|
context.write("}");
|
|
@@ -23043,7 +23141,7 @@ var ts_default = (options = {}) => {
|
|
|
23043
23141
|
context.write("!");
|
|
23044
23142
|
},
|
|
23045
23143
|
TSInterfaceBody(node, context) {
|
|
23046
|
-
|
|
23144
|
+
sequence2(context, node.body, node.loc?.end ?? null, true, ";");
|
|
23047
23145
|
},
|
|
23048
23146
|
TSInterfaceDeclaration(node, context) {
|
|
23049
23147
|
if (node.declare) context.write("declare ");
|
|
@@ -23052,7 +23150,7 @@ var ts_default = (options = {}) => {
|
|
|
23052
23150
|
if (node.typeParameters) context.visit(node.typeParameters);
|
|
23053
23151
|
if (node.extends && node.extends.length > 0) {
|
|
23054
23152
|
context.write(" extends ");
|
|
23055
|
-
|
|
23153
|
+
sequence2(context, node.extends, node.body.loc?.start ?? null, false);
|
|
23056
23154
|
}
|
|
23057
23155
|
context.write(" {");
|
|
23058
23156
|
context.visit(node.body);
|
|
@@ -23420,7 +23518,7 @@ var tsx_default = (options) => ({
|
|
|
23420
23518
|
}
|
|
23421
23519
|
});
|
|
23422
23520
|
|
|
23423
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
23521
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/jsx/helpers.js
|
|
23424
23522
|
function in_jsx_child_context(path) {
|
|
23425
23523
|
const parent = path[path.length - 1];
|
|
23426
23524
|
return !!parent && (parent.type === "JSXElement" || parent.type === "JSXFragment");
|
|
@@ -23661,7 +23759,7 @@ function is_template_try_node(node) {
|
|
|
23661
23759
|
return node?.type === "JSXTryExpression" || node?.type === "TryStatement" && node?.statementType === "TryStatement";
|
|
23662
23760
|
}
|
|
23663
23761
|
|
|
23664
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
23762
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/stylesheet.js
|
|
23665
23763
|
var regex_css_browser_prefix = /^-((webkit)|(moz)|(o)|(ms))-/;
|
|
23666
23764
|
var regex_css_name_boundary = /^[\s,;}]$/;
|
|
23667
23765
|
var is_keyframes_node = (node) => remove_css_prefix(node.name) === "keyframes";
|
|
@@ -24016,885 +24114,11 @@ function render_css_result(stylesheets, minify = false) {
|
|
|
24016
24114
|
};
|
|
24017
24115
|
}
|
|
24018
24116
|
|
|
24019
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
24020
|
-
function
|
|
24021
|
-
|
|
24022
|
-
|
|
24023
|
-
|
|
24024
|
-
if (has_location(loc_info)) {
|
|
24025
|
-
node.start = loc_info.start;
|
|
24026
|
-
node.end = loc_info.end;
|
|
24027
|
-
node.loc = loc_info.loc;
|
|
24028
|
-
}
|
|
24029
|
-
return node;
|
|
24030
|
-
}
|
|
24031
|
-
function create_generated_identifier2(name, loc_info, source_name, source_length) {
|
|
24032
|
-
const id2 = id(name);
|
|
24033
|
-
if (source_name && source_name !== name) id2.metadata.source_name = source_name;
|
|
24034
|
-
if (source_length != null) id2.metadata.source_length = source_length;
|
|
24035
|
-
return set_source_location(id2, loc_info);
|
|
24036
|
-
}
|
|
24037
|
-
function get_lazy_pattern_mapping_range(pattern) {
|
|
24038
|
-
if (!has_location(pattern)) return null;
|
|
24039
|
-
const end = pattern.typeAnnotation?.start ?? pattern.end;
|
|
24040
|
-
const end_loc = pattern.typeAnnotation?.loc?.start ?? pattern.loc.end;
|
|
24041
|
-
return {
|
|
24042
|
-
start: pattern.start,
|
|
24043
|
-
end,
|
|
24044
|
-
loc: {
|
|
24045
|
-
start: pattern.loc.start,
|
|
24046
|
-
end: end_loc
|
|
24047
|
-
},
|
|
24048
|
-
source_length: end - pattern.start
|
|
24049
|
-
};
|
|
24050
|
-
}
|
|
24051
|
-
function get_static_property_name(node) {
|
|
24052
|
-
if (node.type === "Identifier") return node.name;
|
|
24053
|
-
if (node.type === "Literal") return String(node.value);
|
|
24054
|
-
return null;
|
|
24055
|
-
}
|
|
24056
|
-
function get_type_property_keys(type_annotation) {
|
|
24057
|
-
const keys = /* @__PURE__ */ new Map();
|
|
24058
|
-
const type = type_annotation?.typeAnnotation;
|
|
24059
|
-
if (type?.type !== "TSTypeLiteral") return keys;
|
|
24060
|
-
for (const member2 of type.members) {
|
|
24061
|
-
if (member2.type !== "TSPropertySignature") continue;
|
|
24062
|
-
const key2 = member2.key;
|
|
24063
|
-
if (key2.type !== "Identifier" && key2.type !== "Literal") continue;
|
|
24064
|
-
const name = get_static_property_name(key2);
|
|
24065
|
-
if (name != null && !keys.has(name)) keys.set(name, key2);
|
|
24066
|
-
}
|
|
24067
|
-
return keys;
|
|
24068
|
-
}
|
|
24069
|
-
function set_lazy_param_binding_mappings(lazy_id, pattern) {
|
|
24070
|
-
if (pattern.type !== "ObjectPattern") return;
|
|
24071
|
-
const type_keys = get_type_property_keys(lazy_id.typeAnnotation);
|
|
24072
|
-
if (type_keys.size === 0) return;
|
|
24073
|
-
const mappings = [];
|
|
24074
|
-
for (const prop2 of pattern.properties) {
|
|
24075
|
-
if (prop2.type === "RestElement" || prop2.computed) continue;
|
|
24076
|
-
const value = prop2.value;
|
|
24077
|
-
const actual = value.type === "AssignmentPattern" ? value.left : value;
|
|
24078
|
-
if (actual.type !== "Identifier" || !has_location(actual)) continue;
|
|
24079
|
-
const key_name = get_static_property_name(prop2.key);
|
|
24080
|
-
const generated = key_name == null ? null : type_keys.get(key_name);
|
|
24081
|
-
if (has_location(generated)) {
|
|
24082
|
-
generated.metadata = { ...generated.metadata, disable_verification: true };
|
|
24083
|
-
mappings.push({ source: actual, generated });
|
|
24084
|
-
}
|
|
24085
|
-
}
|
|
24086
|
-
if (mappings.length > 0) {
|
|
24087
|
-
lazy_id.metadata.lazy_param_binding_mappings = mappings;
|
|
24088
|
-
}
|
|
24089
|
-
}
|
|
24090
|
-
function collect_lazy_bindings(pattern, source_name, lazy_bindings) {
|
|
24091
|
-
collect_lazy_bindings_at(
|
|
24092
|
-
pattern,
|
|
24093
|
-
source_name,
|
|
24094
|
-
() => create_generated_identifier2(source_name),
|
|
24095
|
-
lazy_bindings
|
|
24096
|
-
);
|
|
24097
|
-
}
|
|
24098
|
-
function collect_lazy_bindings_at(pattern, source_name, build_parent, lazy_bindings) {
|
|
24099
|
-
if (pattern.type === "ObjectPattern") {
|
|
24100
|
-
for (const prop2 of pattern.properties) {
|
|
24101
|
-
if (prop2.type === "RestElement") continue;
|
|
24102
|
-
const value = prop2.value;
|
|
24103
|
-
const actual = value.type === "AssignmentPattern" ? value.left : value;
|
|
24104
|
-
const key2 = prop2.key;
|
|
24105
|
-
const computed = prop2.computed || key2.type !== "Identifier";
|
|
24106
|
-
const build_self = (reference) => member(
|
|
24107
|
-
build_parent(),
|
|
24108
|
-
computed || key2.type !== "Identifier" ? { ...key2 } : create_generated_identifier2(key2.name, reference, reference?.name),
|
|
24109
|
-
computed
|
|
24110
|
-
);
|
|
24111
|
-
if (actual.type === "Identifier") {
|
|
24112
|
-
lazy_bindings.set(actual.name, { source_name, read: build_self });
|
|
24113
|
-
} else if (actual.type === "ObjectPattern" || actual.type === "ArrayPattern") {
|
|
24114
|
-
collect_lazy_bindings_at(actual, source_name, build_self, lazy_bindings);
|
|
24115
|
-
}
|
|
24116
|
-
}
|
|
24117
|
-
} else if (pattern.type === "ArrayPattern") {
|
|
24118
|
-
for (let i2 = 0; i2 < pattern.elements.length; i2++) {
|
|
24119
|
-
const element = pattern.elements[i2];
|
|
24120
|
-
if (!element) continue;
|
|
24121
|
-
if (element.type === "RestElement") continue;
|
|
24122
|
-
const actual = element.type === "AssignmentPattern" ? element.left : element;
|
|
24123
|
-
const index = i2;
|
|
24124
|
-
const build_self = () => member(build_parent(), literal2(index), true);
|
|
24125
|
-
if (actual.type === "Identifier") {
|
|
24126
|
-
lazy_bindings.set(actual.name, { source_name, read: build_self });
|
|
24127
|
-
} else if (actual.type === "ObjectPattern" || actual.type === "ArrayPattern") {
|
|
24128
|
-
collect_lazy_bindings_at(actual, source_name, build_self, lazy_bindings);
|
|
24129
|
-
}
|
|
24130
|
-
}
|
|
24131
|
-
}
|
|
24132
|
-
}
|
|
24133
|
-
function collect_lazy_bindings_from_statements(statements, lazy_bindings) {
|
|
24134
|
-
for (const stmt2 of statements) {
|
|
24135
|
-
if (stmt2.type === "VariableDeclaration") {
|
|
24136
|
-
for (const declarator2 of stmt2.declarations) {
|
|
24137
|
-
visit_topmost_lazy_patterns(declarator2.id, (lazy) => {
|
|
24138
|
-
if (!lazy.metadata?.lazy_id) return;
|
|
24139
|
-
collect_lazy_bindings(lazy, lazy.metadata.lazy_id, lazy_bindings);
|
|
24140
|
-
});
|
|
24141
|
-
}
|
|
24142
|
-
} else if (stmt2.type === "ExpressionStatement") {
|
|
24143
|
-
const assignment2 = get_standalone_assignment(stmt2);
|
|
24144
|
-
if (!assignment2 || assignment2.operator !== "=") continue;
|
|
24145
|
-
visit_topmost_lazy_patterns(assignment2.left, (lazy) => {
|
|
24146
|
-
if (!lazy.metadata?.lazy_id) return;
|
|
24147
|
-
collect_lazy_bindings(lazy, lazy.metadata.lazy_id, lazy_bindings);
|
|
24148
|
-
});
|
|
24149
|
-
}
|
|
24150
|
-
}
|
|
24151
|
-
}
|
|
24152
|
-
function get_standalone_assignment(statement) {
|
|
24153
|
-
let expression = statement.expression;
|
|
24154
|
-
while (expression.type !== "AssignmentExpression") {
|
|
24155
|
-
const child = (
|
|
24156
|
-
/** @type {{ expression?: AST.Node }} */
|
|
24157
|
-
expression.expression
|
|
24158
|
-
);
|
|
24159
|
-
if (!child || !is_transparent_expression_wrapper(expression, child)) return null;
|
|
24160
|
-
expression = child;
|
|
24161
|
-
}
|
|
24162
|
-
return expression;
|
|
24163
|
-
}
|
|
24164
|
-
function visit_topmost_lazy_patterns(pattern, visit) {
|
|
24165
|
-
if (!pattern || typeof pattern !== "object") return;
|
|
24166
|
-
if (pattern.type === "AssignmentPattern") {
|
|
24167
|
-
visit_topmost_lazy_patterns(pattern.left, visit);
|
|
24168
|
-
return;
|
|
24169
|
-
}
|
|
24170
|
-
if (pattern.type === "RestElement") {
|
|
24171
|
-
visit_topmost_lazy_patterns(pattern.argument, visit);
|
|
24172
|
-
return;
|
|
24173
|
-
}
|
|
24174
|
-
if (pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") return;
|
|
24175
|
-
if (pattern.lazy) {
|
|
24176
|
-
visit(pattern);
|
|
24177
|
-
return;
|
|
24178
|
-
}
|
|
24179
|
-
if (pattern.type === "ObjectPattern") {
|
|
24180
|
-
for (const prop2 of pattern.properties) {
|
|
24181
|
-
if (prop2.type === "RestElement") visit_topmost_lazy_patterns(prop2.argument, visit);
|
|
24182
|
-
else visit_topmost_lazy_patterns(prop2.value, visit);
|
|
24183
|
-
}
|
|
24184
|
-
} else {
|
|
24185
|
-
for (const element of pattern.elements) {
|
|
24186
|
-
if (element) visit_topmost_lazy_patterns(element, visit);
|
|
24187
|
-
}
|
|
24188
|
-
}
|
|
24189
|
-
}
|
|
24190
|
-
function build_lazy_id_for_pattern(pattern, lazy_id_name, is_top) {
|
|
24191
|
-
const pattern_range = get_lazy_pattern_mapping_range(pattern);
|
|
24192
|
-
const lazy_id = pattern_range ? create_generated_identifier2(
|
|
24193
|
-
lazy_id_name,
|
|
24194
|
-
pattern_range,
|
|
24195
|
-
void 0,
|
|
24196
|
-
pattern_range.source_length
|
|
24197
|
-
) : create_generated_identifier2(lazy_id_name);
|
|
24198
|
-
if (!is_top) return lazy_id;
|
|
24199
|
-
if (pattern.typeAnnotation) {
|
|
24200
|
-
lazy_id.typeAnnotation = pattern.typeAnnotation;
|
|
24201
|
-
}
|
|
24202
|
-
set_lazy_param_binding_mappings(lazy_id, pattern);
|
|
24203
|
-
return lazy_id;
|
|
24204
|
-
}
|
|
24205
|
-
function replace_lazy_in_pattern(pattern, is_top = true) {
|
|
24206
|
-
if (!pattern || typeof pattern !== "object") return pattern;
|
|
24207
|
-
if (pattern.type === "AssignmentPattern") {
|
|
24208
|
-
const new_left = replace_lazy_in_pattern(pattern.left, is_top);
|
|
24209
|
-
return new_left === pattern.left ? pattern : { ...pattern, left: new_left };
|
|
24210
|
-
}
|
|
24211
|
-
if (pattern.type === "RestElement") {
|
|
24212
|
-
const new_arg = replace_lazy_in_pattern(pattern.argument, false);
|
|
24213
|
-
return new_arg === pattern.argument ? pattern : { ...pattern, argument: new_arg };
|
|
24214
|
-
}
|
|
24215
|
-
if (pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") return pattern;
|
|
24216
|
-
const lazy_id = pattern.metadata?.lazy_id;
|
|
24217
|
-
if (pattern.lazy && lazy_id) {
|
|
24218
|
-
return build_lazy_id_for_pattern(pattern, lazy_id, is_top);
|
|
24219
|
-
}
|
|
24220
|
-
if (pattern.type === "ObjectPattern") {
|
|
24221
|
-
let changed2 = false;
|
|
24222
|
-
const new_properties = pattern.properties.map((prop2) => {
|
|
24223
|
-
if (prop2.type === "RestElement") {
|
|
24224
|
-
const new_arg = replace_lazy_in_pattern(prop2.argument, false);
|
|
24225
|
-
if (new_arg === prop2.argument) return prop2;
|
|
24226
|
-
changed2 = true;
|
|
24227
|
-
return { ...prop2, argument: new_arg };
|
|
24228
|
-
}
|
|
24229
|
-
const new_value = replace_lazy_in_pattern(prop2.value, false);
|
|
24230
|
-
if (new_value === prop2.value) return prop2;
|
|
24231
|
-
changed2 = true;
|
|
24232
|
-
return { ...prop2, value: new_value };
|
|
24233
|
-
});
|
|
24234
|
-
return changed2 ? { ...pattern, properties: new_properties } : pattern;
|
|
24235
|
-
}
|
|
24236
|
-
let changed = false;
|
|
24237
|
-
const new_elements = pattern.elements.map((element) => {
|
|
24238
|
-
if (!element) return element;
|
|
24239
|
-
const new_element = replace_lazy_in_pattern(element, false);
|
|
24240
|
-
if (new_element !== element) changed = true;
|
|
24241
|
-
return new_element;
|
|
24242
|
-
});
|
|
24243
|
-
return changed ? { ...pattern, elements: new_elements } : pattern;
|
|
24244
|
-
}
|
|
24245
|
-
function transform_loop_pattern_expressions(pattern, lazy_bindings) {
|
|
24246
|
-
if (!pattern || typeof pattern !== "object") return pattern;
|
|
24247
|
-
if (pattern.type === "AssignmentPattern") {
|
|
24248
|
-
const new_left = transform_loop_pattern_expressions(pattern.left, lazy_bindings);
|
|
24249
|
-
const new_right = apply_lazy_transforms_to_slot(pattern.right, lazy_bindings);
|
|
24250
|
-
return new_left !== pattern.left || new_right !== pattern.right ? (
|
|
24251
|
-
/** @type {T} */
|
|
24252
|
-
{ ...pattern, left: new_left, right: new_right }
|
|
24253
|
-
) : pattern;
|
|
24254
|
-
}
|
|
24255
|
-
if (pattern.type === "RestElement") {
|
|
24256
|
-
const new_argument = transform_loop_pattern_expressions(pattern.argument, lazy_bindings);
|
|
24257
|
-
return new_argument === pattern.argument ? pattern : (
|
|
24258
|
-
/** @type {T} */
|
|
24259
|
-
{ ...pattern, argument: new_argument }
|
|
24260
|
-
);
|
|
24261
|
-
}
|
|
24262
|
-
if (pattern.type === "ObjectPattern") {
|
|
24263
|
-
let changed = false;
|
|
24264
|
-
const properties = pattern.properties.map((property) => {
|
|
24265
|
-
if (property.type === "RestElement") {
|
|
24266
|
-
const new_argument = transform_loop_pattern_expressions(property.argument, lazy_bindings);
|
|
24267
|
-
if (new_argument === property.argument) return property;
|
|
24268
|
-
changed = true;
|
|
24269
|
-
return rebuild(property, { argument: new_argument });
|
|
24270
|
-
}
|
|
24271
|
-
const new_key = property.computed ? apply_lazy_transforms_to_slot(property.key, lazy_bindings) : property.key;
|
|
24272
|
-
const new_value = transform_loop_pattern_expressions(property.value, lazy_bindings);
|
|
24273
|
-
if (new_key === property.key && new_value === property.value) return property;
|
|
24274
|
-
changed = true;
|
|
24275
|
-
return rebuild(property, { key: new_key, value: new_value });
|
|
24276
|
-
});
|
|
24277
|
-
return changed ? (
|
|
24278
|
-
/** @type {T} */
|
|
24279
|
-
{ ...pattern, properties }
|
|
24280
|
-
) : pattern;
|
|
24281
|
-
}
|
|
24282
|
-
if (pattern.type === "ArrayPattern") {
|
|
24283
|
-
let changed = false;
|
|
24284
|
-
const elements = pattern.elements.map((element) => {
|
|
24285
|
-
if (!element) return element;
|
|
24286
|
-
const new_element = transform_loop_pattern_expressions(element, lazy_bindings);
|
|
24287
|
-
if (new_element !== element) changed = true;
|
|
24288
|
-
return new_element;
|
|
24289
|
-
});
|
|
24290
|
-
return changed ? (
|
|
24291
|
-
/** @type {T} */
|
|
24292
|
-
{ ...pattern, elements }
|
|
24293
|
-
) : pattern;
|
|
24294
|
-
}
|
|
24295
|
-
return pattern;
|
|
24296
|
-
}
|
|
24297
|
-
function preallocate_lazy_ids(root, context, assignments_only = false) {
|
|
24298
|
-
const HAS_LAZY = 1;
|
|
24299
|
-
const HAS_VAR_LOOP = 2;
|
|
24300
|
-
const path = [];
|
|
24301
|
-
const assign_id = (pattern) => {
|
|
24302
|
-
visit_topmost_lazy_patterns(pattern, (lazy) => {
|
|
24303
|
-
if (lazy.metadata?.lazy_id) return;
|
|
24304
|
-
lazy.metadata = { ...lazy.metadata, lazy_id: generate_lazy_id(context) };
|
|
24305
|
-
});
|
|
24306
|
-
};
|
|
24307
|
-
const has_preallocated_lazy_binding = (pattern) => {
|
|
24308
|
-
let found = false;
|
|
24309
|
-
visit_topmost_lazy_patterns(pattern, (lazy) => {
|
|
24310
|
-
if (lazy.metadata?.lazy_id) found = true;
|
|
24311
|
-
});
|
|
24312
|
-
return found;
|
|
24313
|
-
};
|
|
24314
|
-
const visit = (value) => {
|
|
24315
|
-
if (!value || typeof value !== "object") return 0;
|
|
24316
|
-
if (Array.isArray(value)) {
|
|
24317
|
-
let flags2 = 0;
|
|
24318
|
-
for (const child of value) {
|
|
24319
|
-
flags2 |= visit(child);
|
|
24320
|
-
}
|
|
24321
|
-
return flags2;
|
|
24322
|
-
}
|
|
24323
|
-
if (!is_ast_node(value)) return 0;
|
|
24324
|
-
const node = value;
|
|
24325
|
-
const is_function_like = is_function_or_component_node(node);
|
|
24326
|
-
if (is_function_like && !assignments_only) {
|
|
24327
|
-
for (const param of node.params) {
|
|
24328
|
-
assign_id(param.type === "AssignmentPattern" ? param.left : param);
|
|
24329
|
-
}
|
|
24330
|
-
}
|
|
24331
|
-
if (node.type === "VariableDeclarator" && !assignments_only) {
|
|
24332
|
-
assign_id(node.id);
|
|
24333
|
-
}
|
|
24334
|
-
if ((node.type === "ForOfStatement" || node.type === "ForInStatement") && node.left.type !== "VariableDeclaration") {
|
|
24335
|
-
assign_id(node.left);
|
|
24336
|
-
}
|
|
24337
|
-
if (node.type === "AssignmentExpression" && is_supported_lazy_assignment_position(node, path)) {
|
|
24338
|
-
assign_id(node.left);
|
|
24339
|
-
}
|
|
24340
|
-
let flags = (node.type === "ObjectPattern" || node.type === "ArrayPattern") && node.lazy === true ? HAS_LAZY : 0;
|
|
24341
|
-
const entries = (
|
|
24342
|
-
/** @type {AST.TraversableAstNode} */
|
|
24343
|
-
node
|
|
24344
|
-
);
|
|
24345
|
-
path.push(node);
|
|
24346
|
-
for (const key2 of Object.keys(entries)) {
|
|
24347
|
-
if (key2 === "loc" || key2 === "start" || key2 === "end" || key2 === "metadata") continue;
|
|
24348
|
-
flags |= visit(entries[key2]);
|
|
24349
|
-
}
|
|
24350
|
-
path.pop();
|
|
24351
|
-
const loop_declaration = node.type === "ForStatement" ? node.init : node.type === "ForOfStatement" || node.type === "ForInStatement" ? node.left : null;
|
|
24352
|
-
if (loop_declaration?.type === "VariableDeclaration" && loop_declaration.kind === "var" && loop_declaration.declarations.some(
|
|
24353
|
-
(declarator2) => has_preallocated_lazy_binding(declarator2.id)
|
|
24354
|
-
)) {
|
|
24355
|
-
flags |= HAS_VAR_LOOP;
|
|
24356
|
-
}
|
|
24357
|
-
if (is_function_like) {
|
|
24358
|
-
if (flags & HAS_LAZY) {
|
|
24359
|
-
node.metadata = { ...node.metadata, has_lazy_descendants: true };
|
|
24360
|
-
}
|
|
24361
|
-
if (flags & HAS_VAR_LOOP) {
|
|
24362
|
-
node.metadata = { ...node.metadata, has_lazy_var_loop_descendants: true };
|
|
24363
|
-
}
|
|
24364
|
-
flags &= ~HAS_VAR_LOOP;
|
|
24365
|
-
} else if (node.type === "StaticBlock") {
|
|
24366
|
-
if (flags & HAS_VAR_LOOP) {
|
|
24367
|
-
node.metadata = { ...node.metadata, has_lazy_var_loop_descendants: true };
|
|
24368
|
-
}
|
|
24369
|
-
flags &= ~HAS_VAR_LOOP;
|
|
24370
|
-
} else if (flags & HAS_VAR_LOOP) {
|
|
24371
|
-
node.metadata = { ...node.metadata, has_lazy_var_loop_descendants: true };
|
|
24372
|
-
}
|
|
24373
|
-
return flags;
|
|
24374
|
-
};
|
|
24375
|
-
visit(root);
|
|
24376
|
-
}
|
|
24377
|
-
function estree_member_to_jsx_name(expr, source) {
|
|
24378
|
-
if (expr.type === "Identifier") {
|
|
24379
|
-
return set_source_location(jsx_id(expr.name), source);
|
|
24380
|
-
}
|
|
24381
|
-
if (expr.type === "MemberExpression" && !expr.computed && expr.property.type === "Identifier") {
|
|
24382
|
-
const object3 = estree_member_to_jsx_name(expr.object, source);
|
|
24383
|
-
if (!object3) return null;
|
|
24384
|
-
return set_source_location(jsx_member(object3, jsx_id(expr.property.name)), source);
|
|
24385
|
-
}
|
|
24386
|
-
return null;
|
|
24387
|
-
}
|
|
24388
|
-
function rewrite_lazy_jsx_name(name, lazy_bindings) {
|
|
24389
|
-
if (!name) return null;
|
|
24390
|
-
if (name.type === "JSXIdentifier") {
|
|
24391
|
-
const binding = lazy_bindings.get(name.name);
|
|
24392
|
-
if (!binding) return null;
|
|
24393
|
-
return estree_member_to_jsx_name(binding.read(name), name);
|
|
24394
|
-
}
|
|
24395
|
-
if (name.type === "JSXMemberExpression") {
|
|
24396
|
-
const new_object = rewrite_lazy_jsx_name(name.object, lazy_bindings);
|
|
24397
|
-
return new_object ? { ...name, object: new_object } : null;
|
|
24398
|
-
}
|
|
24399
|
-
return null;
|
|
24400
|
-
}
|
|
24401
|
-
function apply_lazy_transforms_to_value(value, lazy_bindings) {
|
|
24402
|
-
if (Array.isArray(value)) {
|
|
24403
|
-
return value.map((child) => apply_lazy_transforms_to_value(child, lazy_bindings));
|
|
24404
|
-
}
|
|
24405
|
-
if (!is_ast_node(value)) return value;
|
|
24406
|
-
return apply_lazy_transforms(value, lazy_bindings);
|
|
24407
|
-
}
|
|
24408
|
-
function rebuild(node, changes) {
|
|
24409
|
-
return (
|
|
24410
|
-
/** @type {T} */
|
|
24411
|
-
{ ...node, ...changes }
|
|
24412
|
-
);
|
|
24413
|
-
}
|
|
24414
|
-
function apply_lazy_transforms_to_slot(node, lazy_bindings) {
|
|
24415
|
-
return (
|
|
24416
|
-
/** @type {T} */
|
|
24417
|
-
apply_lazy_transforms(node, lazy_bindings)
|
|
24418
|
-
);
|
|
24419
|
-
}
|
|
24420
|
-
function collect_preallocated_lazy_bindings(pattern, lazy_bindings) {
|
|
24421
|
-
visit_topmost_lazy_patterns(pattern, (lazy) => {
|
|
24422
|
-
if (!lazy.metadata?.lazy_id) return;
|
|
24423
|
-
collect_lazy_bindings(lazy, lazy.metadata.lazy_id, lazy_bindings);
|
|
24424
|
-
});
|
|
24425
|
-
}
|
|
24426
|
-
function collect_statement_var_loop_bindings(node, lazy_bindings) {
|
|
24427
|
-
if (is_function_or_component_node(node) || node.type === "StaticBlock") return;
|
|
24428
|
-
if (node.type === "ForStatement" && node.init?.type === "VariableDeclaration" && node.init.kind === "var") {
|
|
24429
|
-
for (const declarator2 of node.init.declarations) {
|
|
24430
|
-
collect_preallocated_lazy_bindings(declarator2.id, lazy_bindings);
|
|
24431
|
-
}
|
|
24432
|
-
} else if ((node.type === "ForOfStatement" || node.type === "ForInStatement") && node.left.type === "VariableDeclaration" && node.left.kind === "var") {
|
|
24433
|
-
for (const declarator2 of node.left.declarations) {
|
|
24434
|
-
collect_preallocated_lazy_bindings(declarator2.id, lazy_bindings);
|
|
24435
|
-
}
|
|
24436
|
-
}
|
|
24437
|
-
for (const child of child_nodes(node)) {
|
|
24438
|
-
collect_statement_var_loop_bindings(child, lazy_bindings);
|
|
24439
|
-
}
|
|
24440
|
-
}
|
|
24441
|
-
function advance_statement_var_loop_bindings(node, lazy_bindings) {
|
|
24442
|
-
if (!node.metadata?.has_lazy_var_loop_descendants) return lazy_bindings;
|
|
24443
|
-
const statement_bindings = /* @__PURE__ */ new Map();
|
|
24444
|
-
collect_statement_var_loop_bindings(node, statement_bindings);
|
|
24445
|
-
return statement_bindings.size > 0 ? new Map([...lazy_bindings, ...statement_bindings]) : lazy_bindings;
|
|
24446
|
-
}
|
|
24447
|
-
function transform_statement_list(statements, lazy_bindings, has_lazy_var_loop_descendants) {
|
|
24448
|
-
let effective_bindings = lazy_bindings;
|
|
24449
|
-
let changed = false;
|
|
24450
|
-
const body = statements.map((statement) => {
|
|
24451
|
-
const transformed = apply_lazy_transforms_to_slot(statement, effective_bindings);
|
|
24452
|
-
if (transformed !== statement) changed = true;
|
|
24453
|
-
if (has_lazy_var_loop_descendants && statement.metadata?.has_lazy_var_loop_descendants) {
|
|
24454
|
-
effective_bindings = advance_statement_var_loop_bindings(statement, effective_bindings);
|
|
24455
|
-
}
|
|
24456
|
-
return transformed;
|
|
24457
|
-
});
|
|
24458
|
-
return { body, lazy_bindings: effective_bindings, changed };
|
|
24459
|
-
}
|
|
24460
|
-
function transform_classic_for_declaration(declaration2, lazy_bindings) {
|
|
24461
|
-
let effective_bindings = lazy_bindings;
|
|
24462
|
-
let mutable_bindings = null;
|
|
24463
|
-
let changed = false;
|
|
24464
|
-
const declarations = declaration2.declarations.map((declarator2) => {
|
|
24465
|
-
const new_init = declarator2.init && apply_lazy_transforms_to_slot(declarator2.init, effective_bindings);
|
|
24466
|
-
const expression_id = transform_loop_pattern_expressions(declarator2.id, effective_bindings);
|
|
24467
|
-
const new_id = replace_lazy_in_pattern(expression_id);
|
|
24468
|
-
if (new_init !== declarator2.init || new_id !== declarator2.id) changed = true;
|
|
24469
|
-
const own_bindings = /* @__PURE__ */ new Map();
|
|
24470
|
-
collect_preallocated_lazy_bindings(expression_id, own_bindings);
|
|
24471
|
-
if (own_bindings.size > 0) {
|
|
24472
|
-
mutable_bindings ??= new Map(effective_bindings);
|
|
24473
|
-
for (const [name, binding] of own_bindings) mutable_bindings.set(name, binding);
|
|
24474
|
-
effective_bindings = mutable_bindings;
|
|
24475
|
-
}
|
|
24476
|
-
return new_init !== declarator2.init || new_id !== declarator2.id ? rebuild(declarator2, { id: new_id, init: new_init }) : declarator2;
|
|
24477
|
-
});
|
|
24478
|
-
return {
|
|
24479
|
-
declaration: changed ? rebuild(declaration2, { declarations }) : declaration2,
|
|
24480
|
-
lazy_bindings: effective_bindings
|
|
24481
|
-
};
|
|
24482
|
-
}
|
|
24483
|
-
function transform_for_each_left(left, lazy_bindings) {
|
|
24484
|
-
const own_bindings = /* @__PURE__ */ new Map();
|
|
24485
|
-
if (left.type === "VariableDeclaration") {
|
|
24486
|
-
let changed = false;
|
|
24487
|
-
const declarations = left.declarations.map((declarator2) => {
|
|
24488
|
-
const expression_id = transform_loop_pattern_expressions(declarator2.id, lazy_bindings);
|
|
24489
|
-
collect_preallocated_lazy_bindings(expression_id, own_bindings);
|
|
24490
|
-
const new_id2 = replace_lazy_in_pattern(expression_id);
|
|
24491
|
-
if (new_id2 === declarator2.id) return declarator2;
|
|
24492
|
-
changed = true;
|
|
24493
|
-
return rebuild(declarator2, { id: new_id2 });
|
|
24494
|
-
});
|
|
24495
|
-
return {
|
|
24496
|
-
left: changed ? rebuild(left, { declarations }) : left,
|
|
24497
|
-
lazy_bindings: own_bindings
|
|
24498
|
-
};
|
|
24499
|
-
}
|
|
24500
|
-
const expression_left = transform_loop_pattern_expressions(left, lazy_bindings);
|
|
24501
|
-
collect_preallocated_lazy_bindings(expression_left, own_bindings);
|
|
24502
|
-
if (own_bindings.size === 0) return { left: expression_left, lazy_bindings: own_bindings };
|
|
24503
|
-
const new_id = replace_lazy_in_pattern(expression_left);
|
|
24504
|
-
return {
|
|
24505
|
-
left: declaration("const", [declarator(new_id)]),
|
|
24506
|
-
lazy_bindings: own_bindings
|
|
24507
|
-
};
|
|
24508
|
-
}
|
|
24509
|
-
function apply_lazy_transforms(node, lazy_bindings) {
|
|
24510
|
-
if (!node || typeof node !== "object") return node;
|
|
24511
|
-
if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") {
|
|
24512
|
-
let params_changed = false;
|
|
24513
|
-
const new_params = node.params.map((param) => {
|
|
24514
|
-
const transformed = transform_param_defaults(param, lazy_bindings);
|
|
24515
|
-
if (transformed !== param) params_changed = true;
|
|
24516
|
-
return transformed;
|
|
24517
|
-
});
|
|
24518
|
-
const shadowed = /* @__PURE__ */ new Set();
|
|
24519
|
-
for (const param of node.params) {
|
|
24520
|
-
collect_shadowed_names(param, lazy_bindings, shadowed);
|
|
24521
|
-
}
|
|
24522
|
-
const outer_minus_shadow = shadowed.size > 0 ? remove_shadowed(lazy_bindings, shadowed) : lazy_bindings;
|
|
24523
|
-
const own_bindings = /* @__PURE__ */ new Map();
|
|
24524
|
-
let had_lazy_param = false;
|
|
24525
|
-
for (const param of node.params) {
|
|
24526
|
-
visit_topmost_lazy_patterns(param, (lazy) => {
|
|
24527
|
-
if (!lazy.metadata?.lazy_id) return;
|
|
24528
|
-
had_lazy_param = true;
|
|
24529
|
-
collect_lazy_bindings(lazy, lazy.metadata.lazy_id, own_bindings);
|
|
24530
|
-
});
|
|
24531
|
-
}
|
|
24532
|
-
const inner_bindings = own_bindings.size > 0 ? new Map([...outer_minus_shadow, ...own_bindings]) : outer_minus_shadow;
|
|
24533
|
-
if (inner_bindings.size === 0 && !params_changed && !had_lazy_param && !node.metadata?.has_lazy_descendants) {
|
|
24534
|
-
return node;
|
|
24535
|
-
}
|
|
24536
|
-
const new_body = apply_lazy_transforms_to_slot(node.body, inner_bindings);
|
|
24537
|
-
const final_params_src = params_changed ? new_params : node.params;
|
|
24538
|
-
const final_params = had_lazy_param ? replace_lazy_params(final_params_src) : final_params_src;
|
|
24539
|
-
if (new_body !== node.body || final_params !== node.params) {
|
|
24540
|
-
return rebuild(node, { params: final_params, body: new_body });
|
|
24541
|
-
}
|
|
24542
|
-
return node;
|
|
24543
|
-
}
|
|
24544
|
-
if (node.type === "BlockStatement" || node.type === "Program" || node.type === "StaticBlock") {
|
|
24545
|
-
const body = node.body;
|
|
24546
|
-
const block_bindings = collect_block_shadowed_names(body, lazy_bindings);
|
|
24547
|
-
const after_shadow = block_bindings.size > 0 ? remove_shadowed(lazy_bindings, block_bindings) : lazy_bindings;
|
|
24548
|
-
const block_lazy = /* @__PURE__ */ new Map();
|
|
24549
|
-
collect_lazy_bindings_from_statements(body, block_lazy);
|
|
24550
|
-
const initial_bindings = block_lazy.size > 0 ? new Map([...after_shadow, ...block_lazy]) : after_shadow;
|
|
24551
|
-
const transformed = transform_statement_list(
|
|
24552
|
-
node.body,
|
|
24553
|
-
initial_bindings,
|
|
24554
|
-
node.metadata?.has_lazy_var_loop_descendants === true
|
|
24555
|
-
);
|
|
24556
|
-
return transformed.changed ? rebuild(node, { body: transformed.body }) : node;
|
|
24557
|
-
}
|
|
24558
|
-
if (node.type === "CatchClause") {
|
|
24559
|
-
const shadowed = /* @__PURE__ */ new Set();
|
|
24560
|
-
if (node.param) collect_shadowed_names(node.param, lazy_bindings, shadowed);
|
|
24561
|
-
const effective_bindings = shadowed.size > 0 ? remove_shadowed(lazy_bindings, shadowed) : lazy_bindings;
|
|
24562
|
-
const new_body = apply_lazy_transforms_to_slot(node.body, effective_bindings);
|
|
24563
|
-
if (new_body !== node.body) return rebuild(node, { body: new_body });
|
|
24564
|
-
return node;
|
|
24565
|
-
}
|
|
24566
|
-
if (node.type === "DoWhileStatement") {
|
|
24567
|
-
const new_body = apply_lazy_transforms_to_slot(node.body, lazy_bindings);
|
|
24568
|
-
const test_bindings = advance_statement_var_loop_bindings(node.body, lazy_bindings);
|
|
24569
|
-
const new_test = apply_lazy_transforms_to_slot(node.test, test_bindings);
|
|
24570
|
-
if (new_body !== node.body || new_test !== node.test) {
|
|
24571
|
-
return rebuild(node, { body: new_body, test: new_test });
|
|
24572
|
-
}
|
|
24573
|
-
return node;
|
|
24574
|
-
}
|
|
24575
|
-
if (node.type === "IfStatement") {
|
|
24576
|
-
const new_test = apply_lazy_transforms_to_slot(node.test, lazy_bindings);
|
|
24577
|
-
const new_consequent = apply_lazy_transforms_to_slot(node.consequent, lazy_bindings);
|
|
24578
|
-
const alternate_bindings = advance_statement_var_loop_bindings(node.consequent, lazy_bindings);
|
|
24579
|
-
const new_alternate = node.alternate && apply_lazy_transforms_to_slot(node.alternate, alternate_bindings);
|
|
24580
|
-
if (new_test !== node.test || new_consequent !== node.consequent || new_alternate !== node.alternate) {
|
|
24581
|
-
return rebuild(node, {
|
|
24582
|
-
test: new_test,
|
|
24583
|
-
consequent: new_consequent,
|
|
24584
|
-
alternate: new_alternate
|
|
24585
|
-
});
|
|
24586
|
-
}
|
|
24587
|
-
return node;
|
|
24588
|
-
}
|
|
24589
|
-
if (node.type === "TryStatement") {
|
|
24590
|
-
const new_block = apply_lazy_transforms_to_slot(node.block, lazy_bindings);
|
|
24591
|
-
const handler_bindings = advance_statement_var_loop_bindings(node.block, lazy_bindings);
|
|
24592
|
-
const new_handler = node.handler && apply_lazy_transforms_to_slot(node.handler, handler_bindings);
|
|
24593
|
-
const finalizer_bindings = node.handler ? advance_statement_var_loop_bindings(node.handler, handler_bindings) : handler_bindings;
|
|
24594
|
-
const new_finalizer = node.finalizer && apply_lazy_transforms_to_slot(node.finalizer, finalizer_bindings);
|
|
24595
|
-
if (new_block !== node.block || new_handler !== node.handler || new_finalizer !== node.finalizer) {
|
|
24596
|
-
return rebuild(node, {
|
|
24597
|
-
block: new_block,
|
|
24598
|
-
handler: new_handler,
|
|
24599
|
-
finalizer: new_finalizer
|
|
24600
|
-
});
|
|
24601
|
-
}
|
|
24602
|
-
return node;
|
|
24603
|
-
}
|
|
24604
|
-
if (node.type === "ForStatement") {
|
|
24605
|
-
const shadowed = /* @__PURE__ */ new Set();
|
|
24606
|
-
if (node.init?.type === "VariableDeclaration") {
|
|
24607
|
-
for (const decl of node.init.declarations) {
|
|
24608
|
-
if (decl.id) collect_non_lazy_shadowed_names(decl.id, lazy_bindings, shadowed);
|
|
24609
|
-
}
|
|
24610
|
-
}
|
|
24611
|
-
let effective_bindings = shadowed.size > 0 ? remove_shadowed(lazy_bindings, shadowed) : lazy_bindings;
|
|
24612
|
-
let changed2 = false;
|
|
24613
|
-
let new_init = node.init;
|
|
24614
|
-
if (node.init?.type === "VariableDeclaration") {
|
|
24615
|
-
const transformed = transform_classic_for_declaration(node.init, effective_bindings);
|
|
24616
|
-
new_init = transformed.declaration;
|
|
24617
|
-
effective_bindings = transformed.lazy_bindings;
|
|
24618
|
-
} else if (node.init) {
|
|
24619
|
-
new_init = apply_lazy_transforms_to_slot(node.init, effective_bindings);
|
|
24620
|
-
}
|
|
24621
|
-
if (new_init !== node.init) changed2 = true;
|
|
24622
|
-
const new_test = node.test && apply_lazy_transforms_to_slot(node.test, effective_bindings);
|
|
24623
|
-
if (new_test !== node.test) changed2 = true;
|
|
24624
|
-
const new_update = node.update && apply_lazy_transforms_to_slot(node.update, effective_bindings);
|
|
24625
|
-
if (new_update !== node.update) changed2 = true;
|
|
24626
|
-
const new_body = apply_lazy_transforms_to_slot(node.body, effective_bindings);
|
|
24627
|
-
if (new_body !== node.body) changed2 = true;
|
|
24628
|
-
return changed2 ? rebuild(node, { init: new_init, test: new_test, update: new_update, body: new_body }) : node;
|
|
24629
|
-
}
|
|
24630
|
-
if (node.type === "ForOfStatement" || node.type === "ForInStatement") {
|
|
24631
|
-
const shadowed = /* @__PURE__ */ new Set();
|
|
24632
|
-
if (node.left?.type === "VariableDeclaration") {
|
|
24633
|
-
for (const decl of node.left.declarations) {
|
|
24634
|
-
if (decl.id) collect_shadowed_names(decl.id, lazy_bindings, shadowed);
|
|
24635
|
-
}
|
|
24636
|
-
} else {
|
|
24637
|
-
collect_shadowed_names(node.left, lazy_bindings, shadowed);
|
|
24638
|
-
}
|
|
24639
|
-
const after_shadow = shadowed.size > 0 ? remove_shadowed(lazy_bindings, shadowed) : lazy_bindings;
|
|
24640
|
-
const transformed_left = transform_for_each_left(node.left, after_shadow);
|
|
24641
|
-
const effective_bindings = transformed_left.lazy_bindings.size > 0 ? new Map([...after_shadow, ...transformed_left.lazy_bindings]) : after_shadow;
|
|
24642
|
-
let changed2 = false;
|
|
24643
|
-
if (transformed_left.left !== node.left) changed2 = true;
|
|
24644
|
-
const new_right = apply_lazy_transforms_to_slot(node.right, lazy_bindings);
|
|
24645
|
-
if (new_right !== node.right) changed2 = true;
|
|
24646
|
-
const new_body = apply_lazy_transforms_to_slot(node.body, effective_bindings);
|
|
24647
|
-
if (new_body !== node.body) changed2 = true;
|
|
24648
|
-
return changed2 ? rebuild(node, { left: transformed_left.left, right: new_right, body: new_body }) : node;
|
|
24649
|
-
}
|
|
24650
|
-
if (node.type === "SwitchStatement") {
|
|
24651
|
-
const all_consequents = node.cases.flatMap((switch_case2) => switch_case2.consequent);
|
|
24652
|
-
const block_shadowed = collect_block_shadowed_names(all_consequents, lazy_bindings);
|
|
24653
|
-
const after_shadow = block_shadowed.size > 0 ? remove_shadowed(lazy_bindings, block_shadowed) : lazy_bindings;
|
|
24654
|
-
const block_lazy = /* @__PURE__ */ new Map();
|
|
24655
|
-
collect_lazy_bindings_from_statements(all_consequents, block_lazy);
|
|
24656
|
-
const effective_bindings = block_lazy.size > 0 ? new Map([...after_shadow, ...block_lazy]) : after_shadow;
|
|
24657
|
-
let changed2 = false;
|
|
24658
|
-
const new_discriminant = apply_lazy_transforms_to_slot(node.discriminant, after_shadow);
|
|
24659
|
-
if (new_discriminant !== node.discriminant) changed2 = true;
|
|
24660
|
-
let consequent_bindings = effective_bindings;
|
|
24661
|
-
const new_cases = node.cases.map((switch_case2) => {
|
|
24662
|
-
let case_changed = false;
|
|
24663
|
-
const new_test = switch_case2.test ? apply_lazy_transforms_to_slot(switch_case2.test, effective_bindings) : null;
|
|
24664
|
-
if (new_test !== switch_case2.test) case_changed = true;
|
|
24665
|
-
const transformed = transform_statement_list(
|
|
24666
|
-
switch_case2.consequent,
|
|
24667
|
-
consequent_bindings,
|
|
24668
|
-
node.metadata?.has_lazy_var_loop_descendants === true
|
|
24669
|
-
);
|
|
24670
|
-
consequent_bindings = transformed.lazy_bindings;
|
|
24671
|
-
if (transformed.changed) case_changed = true;
|
|
24672
|
-
if (case_changed) {
|
|
24673
|
-
changed2 = true;
|
|
24674
|
-
return rebuild(switch_case2, { test: new_test, consequent: transformed.body });
|
|
24675
|
-
}
|
|
24676
|
-
return switch_case2;
|
|
24677
|
-
});
|
|
24678
|
-
return changed2 ? rebuild(node, { discriminant: new_discriminant, cases: new_cases }) : node;
|
|
24679
|
-
}
|
|
24680
|
-
if (node.type === "ExpressionStatement") {
|
|
24681
|
-
const assignment2 = get_standalone_assignment(node);
|
|
24682
|
-
const pattern = assignment2?.left;
|
|
24683
|
-
if (assignment2?.operator === "=" && (pattern?.type === "ObjectPattern" || pattern?.type === "ArrayPattern") && pattern.lazy) {
|
|
24684
|
-
const lazy_id_name = pattern.metadata?.lazy_id;
|
|
24685
|
-
if (lazy_id_name !== void 0) {
|
|
24686
|
-
const lazy_id = build_lazy_id_for_pattern(pattern, lazy_id_name, false);
|
|
24687
|
-
if (pattern.typeAnnotation) lazy_id.typeAnnotation = pattern.typeAnnotation;
|
|
24688
|
-
const init2 = apply_lazy_transforms_to_slot(assignment2.right, lazy_bindings);
|
|
24689
|
-
return const_builder(lazy_id, init2);
|
|
24690
|
-
}
|
|
24691
|
-
}
|
|
24692
|
-
}
|
|
24693
|
-
if (node.type === "ExpressionStatement" && node.expression?.type === "AssignmentExpression" && node.expression.operator === "=" && (node.expression.left?.type === "ObjectPattern" || node.expression.left?.type === "ArrayPattern") && !node.expression.left.lazy) {
|
|
24694
|
-
const new_left = replace_lazy_in_pattern(node.expression.left);
|
|
24695
|
-
if (new_left !== node.expression.left) {
|
|
24696
|
-
return {
|
|
24697
|
-
...node,
|
|
24698
|
-
expression: {
|
|
24699
|
-
...node.expression,
|
|
24700
|
-
left: new_left,
|
|
24701
|
-
right: apply_lazy_transforms_to_slot(node.expression.right, lazy_bindings)
|
|
24702
|
-
}
|
|
24703
|
-
};
|
|
24704
|
-
}
|
|
24705
|
-
}
|
|
24706
|
-
if (node.type === "AssignmentExpression" && node.operator === "=" && (node.left.type === "ObjectPattern" || node.left.type === "ArrayPattern") && node.left.lazy && !node.left.metadata?.lazy_id) {
|
|
24707
|
-
const new_right = apply_lazy_transforms_to_slot(node.right, lazy_bindings);
|
|
24708
|
-
const recovered = new_right === node.right ? node : { ...node, right: new_right };
|
|
24709
|
-
return parenthesized(recovered, has_location(node) ? node : void 0);
|
|
24710
|
-
}
|
|
24711
|
-
if (node.type === "AssignmentExpression" && node.left?.type === "Identifier" && lazy_bindings.has(node.left.name)) {
|
|
24712
|
-
const binding = (
|
|
24713
|
-
/** @type {LazyBinding} */
|
|
24714
|
-
lazy_bindings.get(node.left.name)
|
|
24715
|
-
);
|
|
24716
|
-
return {
|
|
24717
|
-
...node,
|
|
24718
|
-
left: binding.read(node.left),
|
|
24719
|
-
right: apply_lazy_transforms_to_slot(node.right, lazy_bindings)
|
|
24720
|
-
};
|
|
24721
|
-
}
|
|
24722
|
-
if (node.type === "UpdateExpression" && node.argument?.type === "Identifier" && lazy_bindings.has(node.argument.name)) {
|
|
24723
|
-
const binding = (
|
|
24724
|
-
/** @type {LazyBinding} */
|
|
24725
|
-
lazy_bindings.get(node.argument.name)
|
|
24726
|
-
);
|
|
24727
|
-
return { ...node, argument: binding.read(node.argument) };
|
|
24728
|
-
}
|
|
24729
|
-
if (node.type === "VariableDeclarator" && node.id?.metadata?.lazy_id) {
|
|
24730
|
-
const lazy_id = create_generated_identifier2(node.id.metadata.lazy_id);
|
|
24731
|
-
if (node.id.typeAnnotation) lazy_id.typeAnnotation = node.id.typeAnnotation;
|
|
24732
|
-
return {
|
|
24733
|
-
...node,
|
|
24734
|
-
id: lazy_id,
|
|
24735
|
-
init: node.init && apply_lazy_transforms_to_slot(node.init, lazy_bindings)
|
|
24736
|
-
};
|
|
24737
|
-
}
|
|
24738
|
-
if (node.type === "VariableDeclarator" && (node.id?.type === "ObjectPattern" || node.id?.type === "ArrayPattern") && !node.id.lazy) {
|
|
24739
|
-
const new_id = replace_lazy_in_pattern(node.id);
|
|
24740
|
-
if (new_id !== node.id) {
|
|
24741
|
-
return {
|
|
24742
|
-
...node,
|
|
24743
|
-
id: new_id,
|
|
24744
|
-
init: node.init && apply_lazy_transforms_to_slot(node.init, lazy_bindings)
|
|
24745
|
-
};
|
|
24746
|
-
}
|
|
24747
|
-
}
|
|
24748
|
-
if (node.type === "Property" && node.shorthand && node.value?.type === "Identifier") {
|
|
24749
|
-
const binding = lazy_bindings.get(node.value.name);
|
|
24750
|
-
if (binding) {
|
|
24751
|
-
return { ...node, shorthand: false, value: binding.read(node.value) };
|
|
24752
|
-
}
|
|
24753
|
-
}
|
|
24754
|
-
if (node.type === "Identifier" && lazy_bindings.has(node.name)) {
|
|
24755
|
-
const binding = (
|
|
24756
|
-
/** @type {LazyBinding} */
|
|
24757
|
-
lazy_bindings.get(node.name)
|
|
24758
|
-
);
|
|
24759
|
-
return binding.read(node);
|
|
24760
|
-
}
|
|
24761
|
-
if (node.type === "JSXIdentifier") return node;
|
|
24762
|
-
let changed = false;
|
|
24763
|
-
const entries = (
|
|
24764
|
-
/** @type {AST.TraversableAstNode} */
|
|
24765
|
-
node
|
|
24766
|
-
);
|
|
24767
|
-
const clone = { ...entries };
|
|
24768
|
-
for (const key2 of Object.keys(entries)) {
|
|
24769
|
-
if (key2 === "loc" || key2 === "start" || key2 === "end" || key2 === "metadata") continue;
|
|
24770
|
-
if (key2 === "key" && node.type === "Property" && !node.computed && !node.shorthand) continue;
|
|
24771
|
-
if (key2 === "property" && node.type === "MemberExpression" && !node.computed) continue;
|
|
24772
|
-
if (key2 === "property" && node.type === "JSXMemberExpression") continue;
|
|
24773
|
-
if (key2 === "name" && node.type === "JSXAttribute") continue;
|
|
24774
|
-
if (key2 === "id" && node.type === "VariableDeclarator") continue;
|
|
24775
|
-
if (key2 === "name" && (node.type === "JSXOpeningElement" || node.type === "JSXClosingElement")) {
|
|
24776
|
-
const jsx_name = rewrite_lazy_jsx_name(node.name, lazy_bindings);
|
|
24777
|
-
if (jsx_name) {
|
|
24778
|
-
clone[key2] = jsx_name;
|
|
24779
|
-
changed = true;
|
|
24780
|
-
continue;
|
|
24781
|
-
}
|
|
24782
|
-
}
|
|
24783
|
-
const new_value = apply_lazy_transforms_to_value(entries[key2], lazy_bindings);
|
|
24784
|
-
if (new_value !== entries[key2]) {
|
|
24785
|
-
clone[key2] = new_value;
|
|
24786
|
-
changed = true;
|
|
24787
|
-
}
|
|
24788
|
-
}
|
|
24789
|
-
return changed ? (
|
|
24790
|
-
/** @type {AST.Node} */
|
|
24791
|
-
clone
|
|
24792
|
-
) : node;
|
|
24793
|
-
}
|
|
24794
|
-
function transform_param_defaults(param, lazy_bindings) {
|
|
24795
|
-
if (param.type === "AssignmentPattern") {
|
|
24796
|
-
const new_right = apply_lazy_transforms_to_slot(param.right, lazy_bindings);
|
|
24797
|
-
if (new_right !== param.right) return { ...param, right: new_right };
|
|
24798
|
-
}
|
|
24799
|
-
return param;
|
|
24800
|
-
}
|
|
24801
|
-
function collect_shadowed_names(pattern, lazy_bindings, shadowed) {
|
|
24802
|
-
if (!pattern || typeof pattern !== "object") return;
|
|
24803
|
-
if (pattern.type === "Identifier" && lazy_bindings.has(pattern.name)) {
|
|
24804
|
-
shadowed.add(pattern.name);
|
|
24805
|
-
return;
|
|
24806
|
-
}
|
|
24807
|
-
if (pattern.type === "AssignmentPattern") {
|
|
24808
|
-
collect_shadowed_names(pattern.left, lazy_bindings, shadowed);
|
|
24809
|
-
return;
|
|
24810
|
-
}
|
|
24811
|
-
if (pattern.type === "RestElement") {
|
|
24812
|
-
collect_shadowed_names(pattern.argument, lazy_bindings, shadowed);
|
|
24813
|
-
return;
|
|
24814
|
-
}
|
|
24815
|
-
if (pattern.type === "ObjectPattern") {
|
|
24816
|
-
for (const prop2 of pattern.properties) {
|
|
24817
|
-
if (prop2.type === "RestElement") {
|
|
24818
|
-
collect_shadowed_names(prop2.argument, lazy_bindings, shadowed);
|
|
24819
|
-
} else {
|
|
24820
|
-
collect_shadowed_names(prop2.value, lazy_bindings, shadowed);
|
|
24821
|
-
}
|
|
24822
|
-
}
|
|
24823
|
-
return;
|
|
24824
|
-
}
|
|
24825
|
-
if (pattern.type === "ArrayPattern") {
|
|
24826
|
-
for (const element of pattern.elements) {
|
|
24827
|
-
if (element) collect_shadowed_names(element, lazy_bindings, shadowed);
|
|
24828
|
-
}
|
|
24829
|
-
}
|
|
24830
|
-
}
|
|
24831
|
-
function collect_non_lazy_shadowed_names(pattern, lazy_bindings, shadowed) {
|
|
24832
|
-
if (!pattern || typeof pattern !== "object") return;
|
|
24833
|
-
if ((pattern.type === "ObjectPattern" || pattern.type === "ArrayPattern") && pattern.lazy) {
|
|
24834
|
-
return;
|
|
24835
|
-
}
|
|
24836
|
-
if (pattern.type === "Identifier" && lazy_bindings.has(pattern.name)) {
|
|
24837
|
-
shadowed.add(pattern.name);
|
|
24838
|
-
return;
|
|
24839
|
-
}
|
|
24840
|
-
if (pattern.type === "AssignmentPattern") {
|
|
24841
|
-
collect_non_lazy_shadowed_names(pattern.left, lazy_bindings, shadowed);
|
|
24842
|
-
return;
|
|
24843
|
-
}
|
|
24844
|
-
if (pattern.type === "RestElement") {
|
|
24845
|
-
collect_non_lazy_shadowed_names(pattern.argument, lazy_bindings, shadowed);
|
|
24846
|
-
return;
|
|
24847
|
-
}
|
|
24848
|
-
if (pattern.type === "ObjectPattern") {
|
|
24849
|
-
for (const prop2 of pattern.properties) {
|
|
24850
|
-
collect_non_lazy_shadowed_names(
|
|
24851
|
-
prop2.type === "RestElement" ? prop2.argument : prop2.value,
|
|
24852
|
-
lazy_bindings,
|
|
24853
|
-
shadowed
|
|
24854
|
-
);
|
|
24855
|
-
}
|
|
24856
|
-
return;
|
|
24857
|
-
}
|
|
24858
|
-
if (pattern.type === "ArrayPattern") {
|
|
24859
|
-
for (const element of pattern.elements) {
|
|
24860
|
-
if (element) collect_non_lazy_shadowed_names(element, lazy_bindings, shadowed);
|
|
24861
|
-
}
|
|
24862
|
-
}
|
|
24863
|
-
}
|
|
24864
|
-
function collect_block_shadowed_names(statements, lazy_bindings) {
|
|
24865
|
-
const shadowed = /* @__PURE__ */ new Set();
|
|
24866
|
-
for (const stmt2 of statements) {
|
|
24867
|
-
if (stmt2.type === "VariableDeclaration") {
|
|
24868
|
-
for (const decl of stmt2.declarations) {
|
|
24869
|
-
if (decl.id.metadata?.lazy_id) continue;
|
|
24870
|
-
collect_shadowed_names(decl.id, lazy_bindings, shadowed);
|
|
24871
|
-
}
|
|
24872
|
-
} else if (stmt2.type === "FunctionDeclaration" && stmt2.id) {
|
|
24873
|
-
if (lazy_bindings.has(stmt2.id.name)) shadowed.add(stmt2.id.name);
|
|
24874
|
-
}
|
|
24875
|
-
}
|
|
24876
|
-
return shadowed;
|
|
24877
|
-
}
|
|
24878
|
-
function remove_shadowed(lazy_bindings, shadowed) {
|
|
24879
|
-
const result = new Map(lazy_bindings);
|
|
24880
|
-
for (const name of shadowed) result.delete(name);
|
|
24881
|
-
return result;
|
|
24882
|
-
}
|
|
24883
|
-
function replace_lazy_params(params) {
|
|
24884
|
-
return params.map((param) => {
|
|
24885
|
-
if (param.type === "AssignmentPattern") {
|
|
24886
|
-
const new_left = replace_lazy_in_pattern(param.left);
|
|
24887
|
-
return new_left === param.left ? param : { ...param, left: new_left };
|
|
24888
|
-
}
|
|
24889
|
-
return replace_lazy_in_pattern(param);
|
|
24890
|
-
});
|
|
24891
|
-
}
|
|
24892
|
-
|
|
24893
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.1.71/node_modules/@tsrx/core/src/transform/await.js
|
|
24894
|
-
function find_first_top_level_await_in_tsrx_function_body(body_nodes) {
|
|
24895
|
-
for (const node of body_nodes) {
|
|
24896
|
-
const found = find_first_top_level_await(node, false);
|
|
24897
|
-
if (found) return found;
|
|
24117
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/await.js
|
|
24118
|
+
function find_first_top_level_await_in_tsrx_function_body(body_nodes) {
|
|
24119
|
+
for (const node of body_nodes) {
|
|
24120
|
+
const found = find_first_top_level_await(node, false);
|
|
24121
|
+
if (found) return found;
|
|
24898
24122
|
}
|
|
24899
24123
|
return null;
|
|
24900
24124
|
}
|
|
@@ -24925,7 +24149,7 @@ function find_first_top_level_await(node, inside_nested_function) {
|
|
|
24925
24149
|
return null;
|
|
24926
24150
|
}
|
|
24927
24151
|
|
|
24928
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
24152
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/scoping.js
|
|
24929
24153
|
function prepare_stylesheet_for_render(stylesheet, mode = "scope") {
|
|
24930
24154
|
const render_mode = mode === true ? "class-map" : mode === false ? "scope" : mode;
|
|
24931
24155
|
const is_class_map = render_mode === "class-map";
|
|
@@ -24995,17 +24219,17 @@ function class_attribute_base(attr) {
|
|
|
24995
24219
|
function build_scope_class_value(parts) {
|
|
24996
24220
|
const { base, hashes, applied } = parts;
|
|
24997
24221
|
const base_literal = base?.type === "Literal" && typeof base.value === "string" ? base : null;
|
|
24998
|
-
const
|
|
24999
|
-
if (base_literal)
|
|
24222
|
+
const sequence2 = [];
|
|
24223
|
+
if (base_literal) sequence2.push(
|
|
25000
24224
|
/** @type {string} */
|
|
25001
24225
|
base_literal.value
|
|
25002
24226
|
);
|
|
25003
|
-
else if (base)
|
|
25004
|
-
|
|
24227
|
+
else if (base) sequence2.push(base);
|
|
24228
|
+
sequence2.push(...hashes, ...applied);
|
|
25005
24229
|
const quasis = [];
|
|
25006
24230
|
const expressions = [];
|
|
25007
24231
|
let text = "";
|
|
25008
|
-
for (const part of
|
|
24232
|
+
for (const part of sequence2) {
|
|
25009
24233
|
if (typeof part === "string") {
|
|
25010
24234
|
if (part) text = text ? `${text} ${part}` : part;
|
|
25011
24235
|
continue;
|
|
@@ -25055,7 +24279,7 @@ function add_scope_classes(element, hashes, applied, class_attr_name = "class")
|
|
|
25055
24279
|
};
|
|
25056
24280
|
}
|
|
25057
24281
|
|
|
25058
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
24282
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/analyze/prune.js
|
|
25059
24283
|
var regex_backslash_and_following_character2 = /\\(.)/g;
|
|
25060
24284
|
var FORWARD = 0;
|
|
25061
24285
|
var BACKWARD = 1;
|
|
@@ -25554,7 +24778,7 @@ function relative_selector_might_apply_to_node(relative_selector, rule, element,
|
|
|
25554
24778
|
);
|
|
25555
24779
|
let matched = false;
|
|
25556
24780
|
for (const complex_selector of complex_selectors) {
|
|
25557
|
-
const [first, ...
|
|
24781
|
+
const [first, ...rest2] = truncate(complex_selector);
|
|
25558
24782
|
if (!first) {
|
|
25559
24783
|
complex_selector.metadata.used = true;
|
|
25560
24784
|
matched = true;
|
|
@@ -25563,7 +24787,7 @@ function relative_selector_might_apply_to_node(relative_selector, rule, element,
|
|
|
25563
24787
|
if (include_self) {
|
|
25564
24788
|
const selector_including_self = [
|
|
25565
24789
|
first.combinator ? { ...first, combinator: null } : first,
|
|
25566
|
-
...
|
|
24790
|
+
...rest2
|
|
25567
24791
|
];
|
|
25568
24792
|
if (apply_selector(selector_including_self, rule, element, FORWARD)) {
|
|
25569
24793
|
complex_selector.metadata.used = true;
|
|
@@ -25573,7 +24797,7 @@ function relative_selector_might_apply_to_node(relative_selector, rule, element,
|
|
|
25573
24797
|
const selector_excluding_self = [
|
|
25574
24798
|
create_any_selector(first.start, first.end),
|
|
25575
24799
|
first.combinator ? first : { ...first, combinator: create_descendant_combinator(first.start, first.end) },
|
|
25576
|
-
...
|
|
24800
|
+
...rest2
|
|
25577
24801
|
];
|
|
25578
24802
|
if (apply_selector(selector_excluding_self, rule, element, FORWARD)) {
|
|
25579
24803
|
complex_selector.metadata.used = true;
|
|
@@ -25779,7 +25003,7 @@ function prune_css(css, element, styleClasses, topScopedClasses, regionHash = cs
|
|
|
25779
25003
|
walk(css, null, visitors3);
|
|
25780
25004
|
}
|
|
25781
25005
|
|
|
25782
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
25006
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/jsx/style-scopes.js
|
|
25783
25007
|
function prepare_style_scopes(program, ctx) {
|
|
25784
25008
|
const state = {
|
|
25785
25009
|
ctx,
|
|
@@ -26249,7 +25473,7 @@ function type_only_style(block2) {
|
|
|
26249
25473
|
};
|
|
26250
25474
|
}
|
|
26251
25475
|
|
|
26252
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
25476
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/jsx-interleave.js
|
|
26253
25477
|
function is_interleaved_body(body_nodes, is_jsx_child2) {
|
|
26254
25478
|
let seen_jsx = false;
|
|
26255
25479
|
for (const child of body_nodes) {
|
|
@@ -26276,7 +25500,7 @@ function capture_jsx_child(jsx, capture_index, anchor_id) {
|
|
|
26276
25500
|
return { declaration: declaration2, reference };
|
|
26277
25501
|
}
|
|
26278
25502
|
|
|
26279
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
25503
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/jsx-hoist.js
|
|
26280
25504
|
function is_static_literal(node) {
|
|
26281
25505
|
return node.value === null || typeof node.value === "string" || typeof node.value === "number" || typeof node.value === "boolean" || typeof node.value === "bigint";
|
|
26282
25506
|
}
|
|
@@ -26342,7 +25566,7 @@ function is_hoist_safe_jsx_node(node) {
|
|
|
26342
25566
|
return node.openingElement.attributes.every(is_hoist_safe_jsx_attribute) && node.children.every(is_hoist_safe_jsx_child);
|
|
26343
25567
|
}
|
|
26344
25568
|
|
|
26345
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
25569
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/jsx/server-module.js
|
|
26346
25570
|
var HOISTED_IMPORT_PREFIX = "__tsrx_server_import$";
|
|
26347
25571
|
var WALK_SKIP_KEYS = /* @__PURE__ */ new Set([
|
|
26348
25572
|
"loc",
|
|
@@ -26520,11 +25744,11 @@ function lower_colliding_import(statement, hoisted_name) {
|
|
|
26520
25744
|
function lower_declaration(declaration2, outside_names, block_name) {
|
|
26521
25745
|
const hoisted_imports = [];
|
|
26522
25746
|
const aliases = [];
|
|
26523
|
-
const
|
|
25747
|
+
const rest2 = [];
|
|
26524
25748
|
let hoisted_index = 0;
|
|
26525
25749
|
for (const statement of declaration2.body?.body ?? []) {
|
|
26526
25750
|
if (statement.type !== "ImportDeclaration") {
|
|
26527
|
-
|
|
25751
|
+
rest2.push(statement);
|
|
26528
25752
|
continue;
|
|
26529
25753
|
}
|
|
26530
25754
|
const collides = statement.specifiers.some(
|
|
@@ -26546,7 +25770,7 @@ function lower_declaration(declaration2, outside_names, block_name) {
|
|
|
26546
25770
|
id: id2,
|
|
26547
25771
|
kind: "namespace",
|
|
26548
25772
|
metadata: { ...declaration2.metadata, module_keyword: "namespace" },
|
|
26549
|
-
body: { ...declaration2.body, body: [...aliases, ...
|
|
25773
|
+
body: { ...declaration2.body, body: [...aliases, ...rest2] }
|
|
26550
25774
|
}
|
|
26551
25775
|
);
|
|
26552
25776
|
return [...hoisted_imports, namespace];
|
|
@@ -26606,7 +25830,7 @@ function lower_server_module_for_types(ast, server_module) {
|
|
|
26606
25830
|
) };
|
|
26607
25831
|
}
|
|
26608
25832
|
|
|
26609
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
25833
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/jsx/index.js
|
|
26610
25834
|
var TEMPLATE_FRAGMENT_ERROR = "JSX fragment syntax is not needed in TSRX templates. TSRX renders in immediate mode, so everything is already a fragment. Use `<>...</>` only in expression position.";
|
|
26611
25835
|
var TSRX_FOR_RETURN_ERROR = "Return statements are not allowed inside TSRX template for...of loops. Filter the iterable before rendering or use an @empty fallback for empty lists.";
|
|
26612
25836
|
var TSRX_FOR_BREAK_ERROR = "Break statements are not allowed inside TSRX template for...of loops.";
|
|
@@ -26673,14 +25897,14 @@ function expand_child_code_blocks(node, seen = /* @__PURE__ */ new Set()) {
|
|
|
26673
25897
|
node
|
|
26674
25898
|
);
|
|
26675
25899
|
let out = source;
|
|
26676
|
-
const
|
|
25900
|
+
const set2 = (key2, value) => {
|
|
26677
25901
|
if (out[key2] === value) return;
|
|
26678
25902
|
if (out === source) out = { ...source };
|
|
26679
25903
|
out[key2] = value;
|
|
26680
25904
|
};
|
|
26681
25905
|
const children = source.children;
|
|
26682
25906
|
if (Array.isArray(children) && children.some((c) => is_ast_node(c) && c.type === "JSXCodeBlock")) {
|
|
26683
|
-
|
|
25907
|
+
set2(
|
|
26684
25908
|
"children",
|
|
26685
25909
|
children.flatMap(
|
|
26686
25910
|
(child) => is_ast_node(child) && child.type === "JSXCodeBlock" ? lower_code_block_child(child) : [child]
|
|
@@ -26698,9 +25922,9 @@ function expand_child_code_blocks(node, seen = /* @__PURE__ */ new Set()) {
|
|
|
26698
25922
|
if (walked !== entry) changed = true;
|
|
26699
25923
|
return walked;
|
|
26700
25924
|
});
|
|
26701
|
-
if (changed)
|
|
25925
|
+
if (changed) set2(key2, result);
|
|
26702
25926
|
} else if (is_ast_node(value)) {
|
|
26703
|
-
|
|
25927
|
+
set2(key2, expand_child_code_blocks(value, seen));
|
|
26704
25928
|
}
|
|
26705
25929
|
}
|
|
26706
25930
|
return (
|
|
@@ -26782,26 +26006,26 @@ function wrap_control_flow_expression_values(node, transform_context, seen = /*
|
|
|
26782
26006
|
node
|
|
26783
26007
|
);
|
|
26784
26008
|
let out = source;
|
|
26785
|
-
const
|
|
26009
|
+
const set2 = (key2, value) => {
|
|
26786
26010
|
if (out[key2] === value) return;
|
|
26787
26011
|
if (out === source) out = { ...source };
|
|
26788
26012
|
out[key2] = value;
|
|
26789
26013
|
};
|
|
26790
26014
|
if (node.type === "ArrowFunctionExpression" && node.body?.type !== "BlockStatement" && is_template_directive(node.body)) {
|
|
26791
|
-
|
|
26015
|
+
set2("body", wrap_in_native_tsrx_fragment(node.body));
|
|
26792
26016
|
} else if (node.type === "ReturnStatement" && is_template_directive(node.argument)) {
|
|
26793
|
-
|
|
26017
|
+
set2("argument", wrap_in_native_tsrx_fragment(node.argument));
|
|
26794
26018
|
} else if (node.type === "ExpressionStatement" && is_template_directive(node.expression)) {
|
|
26795
|
-
|
|
26019
|
+
set2("expression", wrap_in_native_tsrx_fragment(node.expression));
|
|
26796
26020
|
} else if (node.type === "VariableDeclarator" && is_template_directive(node.init)) {
|
|
26797
|
-
|
|
26021
|
+
set2("init", wrap_in_native_tsrx_fragment(node.init));
|
|
26798
26022
|
} else if (node.type === "AssignmentExpression" && is_template_directive(node.right)) {
|
|
26799
|
-
|
|
26023
|
+
set2("right", wrap_in_native_tsrx_fragment(node.right));
|
|
26800
26024
|
} else if ((node.type === "CallExpression" || node.type === "NewExpression") && Array.isArray(node.arguments)) {
|
|
26801
26025
|
const args = node.arguments;
|
|
26802
26026
|
const wrapped = args.map(wrap_value);
|
|
26803
26027
|
if (wrapped.some((argument, i2) => argument !== args[i2])) {
|
|
26804
|
-
|
|
26028
|
+
set2("arguments", wrapped);
|
|
26805
26029
|
}
|
|
26806
26030
|
}
|
|
26807
26031
|
for (const key2 of Object.keys(out)) {
|
|
@@ -26818,11 +26042,11 @@ function wrap_control_flow_expression_values(node, transform_context, seen = /*
|
|
|
26818
26042
|
if (next !== entry) changed = true;
|
|
26819
26043
|
return next;
|
|
26820
26044
|
});
|
|
26821
|
-
if (changed)
|
|
26045
|
+
if (changed) set2(key2, result);
|
|
26822
26046
|
} else if (is_ast_node(value)) {
|
|
26823
26047
|
let next = lower_child(value);
|
|
26824
26048
|
if (!allowed_slot) next = wrap_directive_in_expression(next);
|
|
26825
|
-
|
|
26049
|
+
set2(key2, wrap_control_flow_expression_values(next, transform_context, seen));
|
|
26826
26050
|
}
|
|
26827
26051
|
}
|
|
26828
26052
|
return (
|
|
@@ -26870,7 +26094,6 @@ function createJsxTransform(platform) {
|
|
|
26870
26094
|
helper_state: null,
|
|
26871
26095
|
hook_helpers_enabled: false,
|
|
26872
26096
|
available_bindings: /* @__PURE__ */ new Map(),
|
|
26873
|
-
lazy_next_id: 0,
|
|
26874
26097
|
filename: filename ?? null,
|
|
26875
26098
|
source,
|
|
26876
26099
|
collect,
|
|
@@ -26894,9 +26117,6 @@ function createJsxTransform(platform) {
|
|
|
26894
26117
|
expand_child_code_blocks(ast);
|
|
26895
26118
|
ast = /** @type {AST.Program} */
|
|
26896
26119
|
wrap_control_flow_expression_values(ast, transform_context);
|
|
26897
|
-
if (!transform_context.typeOnly) {
|
|
26898
|
-
preallocate_lazy_ids(ast, transform_context);
|
|
26899
|
-
}
|
|
26900
26120
|
const transformed = walk(
|
|
26901
26121
|
/** @type {AST.Node} */
|
|
26902
26122
|
ast,
|
|
@@ -27046,12 +26266,7 @@ function createJsxTransform(platform) {
|
|
|
27046
26266
|
} else {
|
|
27047
26267
|
inject_try_imports(expanded, transform_context, effective_platform, suspense_source);
|
|
27048
26268
|
}
|
|
27049
|
-
const
|
|
27050
|
-
preallocate_lazy_ids(lowered_program, transform_context, transform_context.typeOnly);
|
|
27051
|
-
const final_program = (
|
|
27052
|
-
/** @type {AST.Program} */
|
|
27053
|
-
apply_lazy_transforms(lowered_program, /* @__PURE__ */ new Map())
|
|
27054
|
-
);
|
|
26269
|
+
const final_program = lower_remaining_jsx_code_blocks(expanded, transform_context);
|
|
27055
26270
|
const result = print(
|
|
27056
26271
|
final_program,
|
|
27057
26272
|
// typeOnly output is real TS input: re-emit preserved leading comments
|
|
@@ -27742,10 +26957,10 @@ function get_function_like_name(node) {
|
|
|
27742
26957
|
return get_static_binding_name(parent.id);
|
|
27743
26958
|
}
|
|
27744
26959
|
if (parent.type === "Property" && parent.value === node) {
|
|
27745
|
-
return
|
|
26960
|
+
return get_static_property_name(parent.key);
|
|
27746
26961
|
}
|
|
27747
26962
|
if (parent.type === "MethodDefinition" && parent.value === node) {
|
|
27748
|
-
return
|
|
26963
|
+
return get_static_property_name(parent.key);
|
|
27749
26964
|
}
|
|
27750
26965
|
if (parent.type === "AssignmentExpression" && parent.right === node) {
|
|
27751
26966
|
return get_static_binding_name(parent.left);
|
|
@@ -27757,11 +26972,11 @@ function get_static_binding_name(node) {
|
|
|
27757
26972
|
return node.name;
|
|
27758
26973
|
}
|
|
27759
26974
|
if (node?.type === "MemberExpression" && !node.computed) {
|
|
27760
|
-
return
|
|
26975
|
+
return get_static_property_name(node.property);
|
|
27761
26976
|
}
|
|
27762
26977
|
return null;
|
|
27763
26978
|
}
|
|
27764
|
-
function
|
|
26979
|
+
function get_static_property_name(key2) {
|
|
27765
26980
|
if (key2?.type === "Identifier") {
|
|
27766
26981
|
return key2.name;
|
|
27767
26982
|
}
|
|
@@ -28077,9 +27292,6 @@ function collect_statement_bindings(statement, bindings) {
|
|
|
28077
27292
|
if ((statement.type === "FunctionDeclaration" || statement.type === "ClassDeclaration") && statement.id) {
|
|
28078
27293
|
bindings.set(statement.id.name, statement.id);
|
|
28079
27294
|
}
|
|
28080
|
-
if (statement.type === "ExpressionStatement" && statement.expression?.type === "AssignmentExpression" && statement.expression.operator === "=" && (statement.expression.left?.type === "ObjectPattern" || statement.expression.left?.type === "ArrayPattern") && statement.expression.left.lazy) {
|
|
28081
|
-
collect_pattern_bindings(statement.expression.left, bindings);
|
|
28082
|
-
}
|
|
28083
27295
|
}
|
|
28084
27296
|
function collect_pattern_bindings(pattern, bindings) {
|
|
28085
27297
|
if (!pattern) return;
|
|
@@ -28196,7 +27408,7 @@ function lower_remaining_jsx_code_blocks(node, transform_context, seen = /* @__P
|
|
|
28196
27408
|
is_function_node(node) ? lower_jsx_code_block_function_body(node) : node
|
|
28197
27409
|
);
|
|
28198
27410
|
let out = source;
|
|
28199
|
-
const
|
|
27411
|
+
const set2 = (key2, value) => {
|
|
28200
27412
|
if (out[key2] === value) return;
|
|
28201
27413
|
if (out === source) out = { ...source };
|
|
28202
27414
|
out[key2] = value;
|
|
@@ -28224,9 +27436,9 @@ function lower_remaining_jsx_code_blocks(node, transform_context, seen = /* @__P
|
|
|
28224
27436
|
if (walked !== child) changed = true;
|
|
28225
27437
|
return walked;
|
|
28226
27438
|
});
|
|
28227
|
-
if (changed)
|
|
27439
|
+
if (changed) set2(key2, result);
|
|
28228
27440
|
} else if (is_ast_node(value)) {
|
|
28229
|
-
|
|
27441
|
+
set2(key2, lower_remaining_jsx_code_blocks(value, transform_context, seen));
|
|
28230
27442
|
}
|
|
28231
27443
|
}
|
|
28232
27444
|
return (
|
|
@@ -30024,7 +29236,7 @@ function normalize_host_ref_spreads(attrs, is_host, transform_context) {
|
|
|
30024
29236
|
const normalized_id = create_generated_identifier(
|
|
30025
29237
|
create_spread_props_name(transform_context)
|
|
30026
29238
|
);
|
|
30027
|
-
const
|
|
29239
|
+
const spread2 = {
|
|
30028
29240
|
...attr,
|
|
30029
29241
|
argument: clone_identifier(normalized_id)
|
|
30030
29242
|
};
|
|
@@ -30036,8 +29248,8 @@ function normalize_host_ref_spreads(attrs, is_host, transform_context) {
|
|
|
30036
29248
|
);
|
|
30037
29249
|
ref_attr.metadata = { ...ref_attr.metadata || {} };
|
|
30038
29250
|
ref_attr.metadata.synthetic_ref = true;
|
|
30039
|
-
add_jsx_setup_declaration(
|
|
30040
|
-
return [
|
|
29251
|
+
add_jsx_setup_declaration(spread2, let_builder(clone_identifier(normalized_id), normalized));
|
|
29252
|
+
return [spread2, ref_attr];
|
|
30041
29253
|
}
|
|
30042
29254
|
return [
|
|
30043
29255
|
{
|
|
@@ -30247,7 +29459,7 @@ function build_return_expression(render_nodes, in_jsx_child = false, type_only =
|
|
|
30247
29459
|
);
|
|
30248
29460
|
}
|
|
30249
29461
|
|
|
30250
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
29462
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/source-map-utils.js
|
|
30251
29463
|
var mapping_data = {
|
|
30252
29464
|
verification: true,
|
|
30253
29465
|
completion: true,
|
|
@@ -30435,8 +29647,7 @@ function get_mapping_from_node(node, src_to_gen_map, gen_line_offsets, filtered_
|
|
|
30435
29647
|
return mapping;
|
|
30436
29648
|
}
|
|
30437
29649
|
|
|
30438
|
-
// ../../node_modules/.pnpm/@tsrx+core@0.
|
|
30439
|
-
var LAZY_PARAM_IDENTIFIER_REGEX = /^__lazy\d+$/;
|
|
29650
|
+
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/transform/segments.js
|
|
30440
29651
|
var RETURN_KEYWORD = "return";
|
|
30441
29652
|
var EXPORT_KEYWORD = "export";
|
|
30442
29653
|
var BLOCK_DECLARATION_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -30446,35 +29657,6 @@ var BLOCK_DECLARATION_TYPES = /* @__PURE__ */ new Set([
|
|
|
30446
29657
|
"TSEnumDeclaration",
|
|
30447
29658
|
"TSModuleDeclaration"
|
|
30448
29659
|
]);
|
|
30449
|
-
function escape_regex(value) {
|
|
30450
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
30451
|
-
}
|
|
30452
|
-
function create_lazy_param_hover_replacement(lazy_id, base_hover) {
|
|
30453
|
-
const lazy_param_regex = new RegExp(`\\b${escape_regex(lazy_id)}\\s*:\\s*`, "g");
|
|
30454
|
-
return (content) => {
|
|
30455
|
-
const next = base_hover ? base_hover(content) : content;
|
|
30456
|
-
return next.replace(lazy_param_regex, "&");
|
|
30457
|
-
};
|
|
30458
|
-
}
|
|
30459
|
-
function create_function_hover_replacement(params, base_hover) {
|
|
30460
|
-
const lazy_ids = params?.filter(
|
|
30461
|
-
(param) => param.type === "Identifier" && param.metadata?.source_length != null && LAZY_PARAM_IDENTIFIER_REGEX.test(param.name)
|
|
30462
|
-
).map((param) => (
|
|
30463
|
-
/** @type {AST.Identifier} */
|
|
30464
|
-
param.name
|
|
30465
|
-
)) ?? [];
|
|
30466
|
-
if (lazy_ids.length === 0) return base_hover;
|
|
30467
|
-
const lazy_param_regexes = lazy_ids.map(
|
|
30468
|
-
(lazy_id) => new RegExp(`\\b${escape_regex(lazy_id)}\\s*:\\s*`, "g")
|
|
30469
|
-
);
|
|
30470
|
-
return (content) => {
|
|
30471
|
-
let next = base_hover ? base_hover(content) : content;
|
|
30472
|
-
for (const regex of lazy_param_regexes) {
|
|
30473
|
-
next = next.replace(regex, "&");
|
|
30474
|
-
}
|
|
30475
|
-
return next;
|
|
30476
|
-
};
|
|
30477
|
-
}
|
|
30478
29660
|
function get_style_region_id(hash, fallback) {
|
|
30479
29661
|
return `style-${hash || fallback}`;
|
|
30480
29662
|
}
|
|
@@ -30844,9 +30026,6 @@ function convert_source_map_to_mappings(ast, ast_from_source, source, generated_
|
|
|
30844
30026
|
sourceLength: node.metadata?.source_length
|
|
30845
30027
|
};
|
|
30846
30028
|
}
|
|
30847
|
-
if (node.metadata?.source_length != null && LAZY_PARAM_IDENTIFIER_REGEX.test(node.name)) {
|
|
30848
|
-
token.metadata.hover = create_lazy_param_hover_replacement(node.name);
|
|
30849
|
-
}
|
|
30850
30029
|
if (node.metadata && "hover" in node.metadata) {
|
|
30851
30030
|
token.metadata.hover = node.metadata.hover;
|
|
30852
30031
|
}
|
|
@@ -30861,24 +30040,6 @@ function convert_source_map_to_mappings(ast, ast_from_source, source, generated_
|
|
|
30861
30040
|
}
|
|
30862
30041
|
tokens.push(token);
|
|
30863
30042
|
add_extra_source_mapping_tokens(node);
|
|
30864
|
-
if (Array.isArray(node.metadata?.lazy_param_binding_mappings)) {
|
|
30865
|
-
for (const binding_mapping of node.metadata.lazy_param_binding_mappings) {
|
|
30866
|
-
const source_node = binding_mapping.source;
|
|
30867
|
-
const generated_node = binding_mapping.generated;
|
|
30868
|
-
if (!has_location(source_node) || !has_location(generated_node)) continue;
|
|
30869
|
-
const mapping = get_mapping_from_node(
|
|
30870
|
-
generated_node,
|
|
30871
|
-
src_to_gen_map,
|
|
30872
|
-
gen_line_offsets,
|
|
30873
|
-
mapping_data_verify_only
|
|
30874
|
-
);
|
|
30875
|
-
const source_start = source_node.start;
|
|
30876
|
-
const source_end = source_node.end;
|
|
30877
|
-
mapping.sourceOffsets = [source_start];
|
|
30878
|
-
mapping.lengths = [source_end - source_start];
|
|
30879
|
-
mappings.push(mapping);
|
|
30880
|
-
}
|
|
30881
|
-
}
|
|
30882
30043
|
}
|
|
30883
30044
|
return;
|
|
30884
30045
|
} else if (node.type === "JSXIdentifier") {
|
|
@@ -31158,10 +30319,6 @@ function convert_source_map_to_mappings(ast, ast_from_source, source, generated_
|
|
|
31158
30319
|
/** @type (typeof node) & AST.NodeWithLocation */
|
|
31159
30320
|
node
|
|
31160
30321
|
);
|
|
31161
|
-
const function_hover = create_function_hover_replacement(
|
|
31162
|
-
/** @type {AST.Parameter[]} */
|
|
31163
|
-
node.params
|
|
31164
|
-
);
|
|
31165
30322
|
const keyword_bound = node_fn.id?.start ?? node_fn.params?.[0]?.start ?? node_fn.body?.start ?? node_fn.end;
|
|
31166
30323
|
const lexer_tokens = ast_from_source.tsrx_keyword_tokens ?? [];
|
|
31167
30324
|
const keyword_loc = (keyword, from) => {
|
|
@@ -31198,7 +30355,7 @@ function convert_source_map_to_mappings(ast, ast_from_source, source, generated_
|
|
|
31198
30355
|
source: "function",
|
|
31199
30356
|
generated: "function",
|
|
31200
30357
|
loc: function_loc,
|
|
31201
|
-
metadata:
|
|
30358
|
+
metadata: {}
|
|
31202
30359
|
});
|
|
31203
30360
|
}
|
|
31204
30361
|
}
|
|
@@ -31211,24 +30368,10 @@ function convert_source_map_to_mappings(ast, ast_from_source, source, generated_
|
|
|
31211
30368
|
/** @type {AST.FunctionDeclaration | AST.FunctionExpression} */
|
|
31212
30369
|
node.id
|
|
31213
30370
|
);
|
|
31214
|
-
|
|
31215
|
-
/** @type {AST.
|
|
31216
|
-
|
|
30371
|
+
visit(
|
|
30372
|
+
/** @type {AST.Node} */
|
|
30373
|
+
id2
|
|
31217
30374
|
);
|
|
31218
|
-
if (function_hover && id2.loc) {
|
|
31219
|
-
tokens.push({
|
|
31220
|
-
source: id2.metadata?.source_name ?? id2.name,
|
|
31221
|
-
generated: id2.name,
|
|
31222
|
-
loc: id2.loc,
|
|
31223
|
-
metadata: { hover: function_hover },
|
|
31224
|
-
sourceLength: id2.metadata?.source_length
|
|
31225
|
-
});
|
|
31226
|
-
} else {
|
|
31227
|
-
visit(
|
|
31228
|
-
/** @type {AST.Node} */
|
|
31229
|
-
id2
|
|
31230
|
-
);
|
|
31231
|
-
}
|
|
31232
30375
|
}
|
|
31233
30376
|
if (node.typeParameters) {
|
|
31234
30377
|
visit(node.typeParameters);
|
|
@@ -31522,16 +30665,9 @@ function convert_source_map_to_mappings(ast, ast_from_source, source, generated_
|
|
|
31522
30665
|
visit(node.right);
|
|
31523
30666
|
}
|
|
31524
30667
|
if (node.type === "AssignmentPattern") {
|
|
31525
|
-
|
|
31526
|
-
|
|
31527
|
-
|
|
31528
|
-
node,
|
|
31529
|
-
src_to_gen_map,
|
|
31530
|
-
gen_line_offsets,
|
|
31531
|
-
mapping_data_verify_only
|
|
31532
|
-
)
|
|
31533
|
-
);
|
|
31534
|
-
}
|
|
30668
|
+
mappings.push(
|
|
30669
|
+
get_mapping_from_node(node, src_to_gen_map, gen_line_offsets, mapping_data_verify_only)
|
|
30670
|
+
);
|
|
31535
30671
|
}
|
|
31536
30672
|
return;
|
|
31537
30673
|
} else if (node.type === "ObjectExpression" || node.type === "ObjectPattern") {
|
|
@@ -32654,6 +31790,13 @@ import { analyzeNativeChangeDiagnostics } from "./native-change-diagnostics.js";
|
|
|
32654
31790
|
import { analyzeStrongMode } from "./strong-mode.js";
|
|
32655
31791
|
import { analyzeNativeReadDiagnostics, nativeReadOptions } from "./native-read-diagnostics.js";
|
|
32656
31792
|
import { jsxImportSourcePragmaModule } from "./pragma.js";
|
|
31793
|
+
import { inheritHookMemoOrigin } from "./inline-hook-memo.js";
|
|
31794
|
+
import { lowerNativeAttributeReads } from "./native-attribute-reads.js";
|
|
31795
|
+
import {
|
|
31796
|
+
collectServerFunctionNodes,
|
|
31797
|
+
serverContextTypeImports,
|
|
31798
|
+
serverFunctionContextIndex
|
|
31799
|
+
} from "./server-context.js";
|
|
32657
31800
|
import {
|
|
32658
31801
|
DOM_RENDERER_MODULE,
|
|
32659
31802
|
normalizeRendererConfig,
|
|
@@ -32686,6 +31829,149 @@ var OCTANE_PLATFORM = {
|
|
|
32686
31829
|
}
|
|
32687
31830
|
};
|
|
32688
31831
|
var octaneTransform = createJsxTransform(OCTANE_PLATFORM);
|
|
31832
|
+
function projectNativeAttributeReads(ast, contracts) {
|
|
31833
|
+
const attributes = new Set(
|
|
31834
|
+
contracts?.flatMap((contract) => contract.jsxAttribute ? [contract.jsxAttribute] : [])
|
|
31835
|
+
);
|
|
31836
|
+
if (attributes.size === 0) return ast;
|
|
31837
|
+
const names = /* @__PURE__ */ new Set();
|
|
31838
|
+
const walk2 = (node, replace) => {
|
|
31839
|
+
if (!node || typeof node !== "object") return node;
|
|
31840
|
+
if (Array.isArray(node)) return node.map((child) => walk2(child, replace));
|
|
31841
|
+
let result = node;
|
|
31842
|
+
for (const key2 of Object.keys(node)) {
|
|
31843
|
+
if (["metadata", "loc", "start", "end", "parent"].includes(key2)) continue;
|
|
31844
|
+
const value = node[key2];
|
|
31845
|
+
if (!value || typeof value !== "object") continue;
|
|
31846
|
+
const next = walk2(value, replace);
|
|
31847
|
+
if (next !== value) {
|
|
31848
|
+
if (result === node) result = { ...node };
|
|
31849
|
+
result[key2] = next;
|
|
31850
|
+
}
|
|
31851
|
+
}
|
|
31852
|
+
return replace(result) ?? result;
|
|
31853
|
+
};
|
|
31854
|
+
walk2(ast, (node) => {
|
|
31855
|
+
if (node.type === "Identifier" || node.type === "JSXIdentifier") names.add(node.name);
|
|
31856
|
+
return null;
|
|
31857
|
+
});
|
|
31858
|
+
let helper = "__octane_nativeAttributeValue";
|
|
31859
|
+
while (names.has(helper)) helper += "_";
|
|
31860
|
+
let used = false;
|
|
31861
|
+
const projected = walk2(ast, (node) => {
|
|
31862
|
+
if (node.type !== "JSXOpeningElement" && node.type !== "Element") return null;
|
|
31863
|
+
const name = node.type === "Element" ? node.id : node.name;
|
|
31864
|
+
if (name?.type !== "JSXIdentifier" && name?.type !== "Identifier" || typeof name.name !== "string" || name.name[0] !== name.name[0].toLowerCase())
|
|
31865
|
+
return null;
|
|
31866
|
+
return {
|
|
31867
|
+
...node,
|
|
31868
|
+
attributes: node.attributes.map((attribute) => {
|
|
31869
|
+
if (!attributes.has(attribute.name?.name ?? attribute.name) || attribute.value?.type !== "JSXExpressionContainer")
|
|
31870
|
+
return attribute;
|
|
31871
|
+
const result = lowerNativeAttributeReads(attribute.value.expression, (value) => {
|
|
31872
|
+
used = true;
|
|
31873
|
+
return inheritHookMemoOrigin(builders_exports.call(builders_exports.id(helper), value), value);
|
|
31874
|
+
});
|
|
31875
|
+
return { ...attribute, value: { ...attribute.value, expression: result.expression } };
|
|
31876
|
+
})
|
|
31877
|
+
};
|
|
31878
|
+
});
|
|
31879
|
+
return used ? {
|
|
31880
|
+
...projected,
|
|
31881
|
+
body: [
|
|
31882
|
+
builders_exports.imports([["readNativeDomValue", helper]], "octane/internal/signal-read"),
|
|
31883
|
+
...projected.body
|
|
31884
|
+
]
|
|
31885
|
+
} : ast;
|
|
31886
|
+
}
|
|
31887
|
+
function projectServerContextCalls(ast, filename) {
|
|
31888
|
+
const declaration2 = ast.body.find(
|
|
31889
|
+
(node) => node.type === "TSModuleDeclaration" && node.kind === "module" && !node.declare && (node.id?.name ?? node.id?.value) === "server"
|
|
31890
|
+
);
|
|
31891
|
+
if (!Array.isArray(declaration2?.body?.body)) return ast;
|
|
31892
|
+
const statements = declaration2.body.body;
|
|
31893
|
+
const functions = collectServerFunctionNodes(statements);
|
|
31894
|
+
const imports2 = serverContextTypeImports(statements);
|
|
31895
|
+
const contextExports = /* @__PURE__ */ new Set();
|
|
31896
|
+
const add = (exported, local) => {
|
|
31897
|
+
const fn = functions.get(local);
|
|
31898
|
+
if (fn === void 0) return;
|
|
31899
|
+
try {
|
|
31900
|
+
if (serverFunctionContextIndex(fn, imports2, filename) !== -1) contextExports.add(exported);
|
|
31901
|
+
} catch {
|
|
31902
|
+
}
|
|
31903
|
+
};
|
|
31904
|
+
for (const statement of statements) {
|
|
31905
|
+
if (statement.type !== "ExportNamedDeclaration" || statement.exportKind === "type") continue;
|
|
31906
|
+
const node = statement.declaration;
|
|
31907
|
+
if (node?.type === "FunctionDeclaration") add(node.id?.name, node.id?.name);
|
|
31908
|
+
if (node?.type === "VariableDeclaration") {
|
|
31909
|
+
for (const item of node.declarations) add(item.id?.name, item.id?.name);
|
|
31910
|
+
}
|
|
31911
|
+
for (const specifier of statement.specifiers ?? []) {
|
|
31912
|
+
if (specifier.exportKind !== "type") {
|
|
31913
|
+
add(specifier.exported.name ?? specifier.exported.value, specifier.local.name);
|
|
31914
|
+
}
|
|
31915
|
+
}
|
|
31916
|
+
}
|
|
31917
|
+
if (contextExports.size === 0) return ast;
|
|
31918
|
+
const names = /* @__PURE__ */ new Set();
|
|
31919
|
+
const collectNames = (node) => {
|
|
31920
|
+
if (!node || typeof node !== "object") return;
|
|
31921
|
+
if (Array.isArray(node)) {
|
|
31922
|
+
for (const child of node) collectNames(child);
|
|
31923
|
+
return;
|
|
31924
|
+
}
|
|
31925
|
+
if (node.type === "Identifier") names.add(node.name);
|
|
31926
|
+
for (const key2 in node) {
|
|
31927
|
+
if (key2 !== "metadata" && key2 !== "loc" && key2 !== "parent") collectNames(node[key2]);
|
|
31928
|
+
}
|
|
31929
|
+
};
|
|
31930
|
+
collectNames(ast);
|
|
31931
|
+
let helper = "__octane_ServerFunction";
|
|
31932
|
+
while (names.has(helper)) helper += "_";
|
|
31933
|
+
let changed = false;
|
|
31934
|
+
const body = [];
|
|
31935
|
+
for (const statement of ast.body) {
|
|
31936
|
+
if (statement.type !== "ImportDeclaration" || statement.source.value !== "server" || statement.importKind === "type") {
|
|
31937
|
+
body.push(statement);
|
|
31938
|
+
continue;
|
|
31939
|
+
}
|
|
31940
|
+
const retained = [];
|
|
31941
|
+
for (const specifier of statement.specifiers) {
|
|
31942
|
+
if (specifier.type !== "ImportSpecifier" || specifier.importKind === "type" || !contextExports.has(specifier.imported.name ?? specifier.imported.value)) {
|
|
31943
|
+
retained.push(specifier);
|
|
31944
|
+
continue;
|
|
31945
|
+
}
|
|
31946
|
+
changed = true;
|
|
31947
|
+
const reference = () => builders_exports.member(
|
|
31948
|
+
builders_exports.id("server"),
|
|
31949
|
+
{ ...specifier.imported },
|
|
31950
|
+
specifier.imported.type !== "Identifier"
|
|
31951
|
+
);
|
|
31952
|
+
body.push(
|
|
31953
|
+
inheritHookMemoOrigin(
|
|
31954
|
+
builders_exports.const(
|
|
31955
|
+
{ ...specifier.local },
|
|
31956
|
+
builders_exports.ts_as(
|
|
31957
|
+
builders_exports.ts_as(reference(), builders_exports.ts_keyword_type("unknown")),
|
|
31958
|
+
builders_exports.ts_type_reference(
|
|
31959
|
+
builders_exports.id(helper),
|
|
31960
|
+
builders_exports.ts_type_parameter_instantiation([builders_exports.ts_type_query(reference())])
|
|
31961
|
+
)
|
|
31962
|
+
)
|
|
31963
|
+
),
|
|
31964
|
+
specifier
|
|
31965
|
+
)
|
|
31966
|
+
);
|
|
31967
|
+
}
|
|
31968
|
+
if (retained.length > 0) body.push({ ...statement, specifiers: retained });
|
|
31969
|
+
}
|
|
31970
|
+
return changed ? {
|
|
31971
|
+
...ast,
|
|
31972
|
+
body: [builders_exports.imports([["ServerFunction", helper]], "octane/server", [], "type"), ...body]
|
|
31973
|
+
} : ast;
|
|
31974
|
+
}
|
|
32689
31975
|
var octaneTransformWithAuthoredSuspense = createJsxTransform({
|
|
32690
31976
|
...OCTANE_PLATFORM,
|
|
32691
31977
|
hooks: {
|
|
@@ -32703,13 +31989,13 @@ function selectOctaneTransform(ast) {
|
|
|
32703
31989
|
);
|
|
32704
31990
|
return hasSuspenseImport ? octaneTransformWithAuthoredSuspense : octaneTransform;
|
|
32705
31991
|
}
|
|
32706
|
-
function
|
|
31992
|
+
function authoredLeadingPragma(ast, comments) {
|
|
32707
31993
|
const firstStatementStart = ast.body?.[0]?.start;
|
|
32708
|
-
return comments.
|
|
31994
|
+
return comments.find(
|
|
32709
31995
|
(comment) => (firstStatementStart == null || comment.end <= firstStatementStart) && jsxImportSourcePragmaModule(comment.value) !== null
|
|
32710
31996
|
);
|
|
32711
31997
|
}
|
|
32712
|
-
function createRendererTypePragma(renderer, ast) {
|
|
31998
|
+
function createRendererTypePragma(renderer, ast, strong = false) {
|
|
32713
31999
|
const intrinsics = renderer.intrinsics ?? (renderer.module === DOM_RENDERER_MODULE && renderer.target === "dom" ? DOM_RENDERER_MODULE : void 0);
|
|
32714
32000
|
if (intrinsics === void 0) return null;
|
|
32715
32001
|
const start = ast.loc?.start ?? { line: 1, column: 0 };
|
|
@@ -32717,7 +32003,7 @@ function createRendererTypePragma(renderer, ast) {
|
|
|
32717
32003
|
type: "Block",
|
|
32718
32004
|
// @tsrx/core's semantic-comment formatter turns this into the canonical
|
|
32719
32005
|
// `/** @jsxImportSource … */` spelling during the one type-only print.
|
|
32720
|
-
value: `*@jsxImportSource ${intrinsics}`,
|
|
32006
|
+
value: `*@jsxImportSource ${strong && intrinsics === DOM_RENDERER_MODULE ? "octane/strong" : intrinsics}`,
|
|
32721
32007
|
start: ast.start ?? 0,
|
|
32722
32008
|
end: ast.start ?? 0,
|
|
32723
32009
|
loc: { start: { ...start }, end: { ...start } },
|
|
@@ -32766,14 +32052,21 @@ function compileToVolarMappings(source, filename, options) {
|
|
|
32766
32052
|
});
|
|
32767
32053
|
const rendererConfig = normalizeRendererConfig(options?.renderers);
|
|
32768
32054
|
const renderer = resolveRendererForFile(rendererConfig, filename ?? "untitled.tsrx");
|
|
32769
|
-
const
|
|
32055
|
+
const strongAnalysis = options?.strong === true || source.includes("use strong") ? analyzeStrongMode(ast, source, filename, {
|
|
32056
|
+
...options,
|
|
32057
|
+
renderer,
|
|
32058
|
+
rendererBoundaries: rendererConfig.boundaries,
|
|
32059
|
+
rendererRegistry: rendererConfig.registry
|
|
32060
|
+
}) : null;
|
|
32061
|
+
const strongDiagnostics = strongAnalysis?.diagnostics ?? null;
|
|
32062
|
+
const diagnostics = strongAnalysis?.enabled ? [...strongDiagnostics] : analyzeNativeChangeDiagnostics(ast, source, filename, {
|
|
32770
32063
|
dom: renderer.target === "dom",
|
|
32771
32064
|
renderer,
|
|
32772
32065
|
rendererBoundaries: rendererConfig.boundaries,
|
|
32773
32066
|
rendererRegistry: rendererConfig.registry
|
|
32774
32067
|
}).diagnostics;
|
|
32775
|
-
|
|
32776
|
-
|
|
32068
|
+
if (!strongAnalysis?.enabled && strongDiagnostics !== null)
|
|
32069
|
+
diagnostics.push(...strongDiagnostics);
|
|
32777
32070
|
const nativeReadDiagnostics = analyzeNativeReadDiagnostics(
|
|
32778
32071
|
ast,
|
|
32779
32072
|
source,
|
|
@@ -32786,21 +32079,45 @@ function compileToVolarMappings(source, filename, options) {
|
|
|
32786
32079
|
})
|
|
32787
32080
|
);
|
|
32788
32081
|
diagnostics.push(...nativeReadDiagnostics);
|
|
32789
|
-
const
|
|
32790
|
-
const
|
|
32082
|
+
const authoredPragma = authoredLeadingPragma(ast, comments);
|
|
32083
|
+
const strongDOM = strongAnalysis?.enabled === true && renderer.target === "dom";
|
|
32084
|
+
const rendererPragma = authoredPragma ? null : createRendererTypePragma(renderer, ast, strongDOM);
|
|
32085
|
+
const replacePragma = authoredPragma && strongDOM && jsxImportSourcePragmaModule(authoredPragma.value) === DOM_RENDERER_MODULE;
|
|
32086
|
+
const strongPragma = replacePragma ? {
|
|
32087
|
+
...authoredPragma,
|
|
32088
|
+
value: authoredPragma.type === "Line" ? " @jsxImportSource octane/strong" : "*@jsxImportSource octane/strong"
|
|
32089
|
+
} : null;
|
|
32090
|
+
const printComments = strongPragma ? comments.map((comment) => comment === authoredPragma ? strongPragma : comment) : rendererPragma === null ? comments : [rendererPragma, ...comments];
|
|
32091
|
+
let transformAst = ast;
|
|
32092
|
+
if (strongPragma && ast.body.length > 0) {
|
|
32093
|
+
const first = clone_ast_node(ast.body[0]);
|
|
32094
|
+
first.leadingComments = first.leadingComments?.map(
|
|
32095
|
+
(comment) => comment.start === authoredPragma.start && comment.end === authoredPragma.end ? strongPragma : comment
|
|
32096
|
+
);
|
|
32097
|
+
transformAst = { ...ast, body: [first, ...ast.body.slice(1)] };
|
|
32098
|
+
}
|
|
32791
32099
|
const transform = selectOctaneTransform(ast);
|
|
32792
|
-
const transformed = transform(
|
|
32793
|
-
|
|
32794
|
-
|
|
32795
|
-
|
|
32796
|
-
|
|
32797
|
-
|
|
32798
|
-
|
|
32799
|
-
|
|
32800
|
-
|
|
32801
|
-
|
|
32100
|
+
const transformed = transform(
|
|
32101
|
+
projectServerContextCalls(
|
|
32102
|
+
renderer.target === "dom" ? projectNativeAttributeReads(transformAst, options?.knownAttributeSpreads) : transformAst,
|
|
32103
|
+
filename
|
|
32104
|
+
),
|
|
32105
|
+
source,
|
|
32106
|
+
filename,
|
|
32107
|
+
{
|
|
32108
|
+
collect: true,
|
|
32109
|
+
loose: !!options?.loose,
|
|
32110
|
+
// @tsrx/core routes `typeOnly: true` to its TSX esrap language with
|
|
32111
|
+
// `boundaryTokens: true`. Structural delimiters then carry their own
|
|
32112
|
+
// one-character mappings without changing the virtual TSX bytes.
|
|
32113
|
+
typeOnly: true,
|
|
32114
|
+
errors,
|
|
32115
|
+
comments: printComments
|
|
32116
|
+
}
|
|
32117
|
+
);
|
|
32802
32118
|
if (strongDiagnostics !== null || nativeReadDiagnostics.length > 0) {
|
|
32803
32119
|
for (const diagnostic of [...strongDiagnostics ?? [], ...nativeReadDiagnostics]) {
|
|
32120
|
+
if (diagnostic.severity !== "error") continue;
|
|
32804
32121
|
error(
|
|
32805
32122
|
diagnostic.message,
|
|
32806
32123
|
diagnostic.filename ?? null,
|
|
@@ -32932,9 +32249,9 @@ function compileTypesInspection(source, filename, options) {
|
|
|
32932
32249
|
analyze_tsrx(ast, filename, { collect: true, loose: true, to_ts: true, errors, comments });
|
|
32933
32250
|
const rendererConfig = normalizeRendererConfig(options?.renderers);
|
|
32934
32251
|
const renderer = resolveRendererForFile(rendererConfig, filename ?? "untitled.tsrx");
|
|
32935
|
-
const rendererPragma =
|
|
32252
|
+
const rendererPragma = authoredLeadingPragma(ast, comments) ? null : createRendererTypePragma(renderer, ast);
|
|
32936
32253
|
const transform = selectOctaneTransform(ast);
|
|
32937
|
-
const transformed = transform(ast, source, filename, {
|
|
32254
|
+
const transformed = transform(projectServerContextCalls(ast, filename), source, filename, {
|
|
32938
32255
|
collect: true,
|
|
32939
32256
|
loose: true,
|
|
32940
32257
|
typeOnly: true,
|