octane 0.2.12 → 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/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-tables.cjs +4 -94
- package/dist/cjs/error-codes.client.generated.cjs +33 -0
- package/dist/cjs/error-codes.server.generated.cjs +19 -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 +6 -0
- package/dist/cjs/runtime.cjs +2791 -215
- package/dist/cjs/runtime.server.cjs +716 -76
- package/dist/cjs/server/early-signals.cjs +45 -0
- package/dist/cjs/server/index.cjs +44 -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 +163 -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 +32 -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/version.cjs +1 -1
- package/dist/class-names.d.ts +5 -0
- package/dist/class-names.js +25 -0
- package/dist/compiler/bundler.js +34 -6
- package/dist/compiler/compile.js +2234 -559
- 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 +26 -0
- package/dist/compiler/hydrate-boundaries.js +358 -15
- package/dist/compiler/index.d.ts +38 -1
- package/dist/compiler/index.js +1 -0
- package/dist/compiler/native-attribute-reads.js +127 -0
- package/dist/compiler/native-read-diagnostics.js +48 -9
- package/dist/compiler/native-read-types.js +55 -32
- 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.js +57 -10
- 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.d.ts +6 -1
- package/dist/compiler/volar.js +674 -143
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +10 -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-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 +5 -0
- package/dist/error-codes.server.generated.js +19 -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 +2 -0
- package/dist/index.js +4 -0
- package/dist/internal/signal-read.d.ts +1 -0
- package/dist/internal/signal-read.js +4 -0
- package/dist/jsx-runtime.d.ts +45 -6
- package/dist/public-types.d.ts +15 -1
- package/dist/runtime.d.ts +259 -21
- package/dist/runtime.js +2812 -220
- package/dist/runtime.server.d.ts +86 -6
- package/dist/runtime.server.js +712 -76
- package/dist/server/early-signals.d.ts +14 -0
- package/dist/server/early-signals.js +34 -0
- package/dist/server/index.d.ts +10 -2
- package/dist/server/index.js +48 -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 +50 -5
- package/dist/signals/graph.js +170 -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 +32 -3
- package/dist/signals/read-protocol.js +26 -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/version.js +1 -1
- package/package.json +37 -1
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,6 +11449,116 @@ function apply_mutations(node, mutations) {
|
|
|
11449
11449
|
);
|
|
11450
11450
|
}
|
|
11451
11451
|
|
|
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
|
+
|
|
11452
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;
|
|
@@ -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,29 @@ 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
|
+
}
|
|
11793
|
+
function parenthesized(expression, loc_info) {
|
|
11794
|
+
const node = (
|
|
11795
|
+
/** @type {AST.ParenthesizedExpression} */
|
|
11796
|
+
{
|
|
11797
|
+
type: "ParenthesizedExpression",
|
|
11798
|
+
expression,
|
|
11799
|
+
metadata: { path: [] }
|
|
11800
|
+
}
|
|
11801
|
+
);
|
|
11802
|
+
return set_location(node, loc_info);
|
|
11803
|
+
}
|
|
11601
11804
|
function ts_type_query(expr_name, type_arguments = null, loc_info) {
|
|
11602
11805
|
const node = (
|
|
11603
11806
|
/** @type {AST.TSTypeQuery} */
|
|
@@ -11633,6 +11836,28 @@ function ts_type_reference(type_name, type_arguments = null, loc_info) {
|
|
|
11633
11836
|
);
|
|
11634
11837
|
return set_location(node, loc_info);
|
|
11635
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
|
+
}
|
|
11636
11861
|
function ts_keyword_type(keyword, loc_info) {
|
|
11637
11862
|
const keyword_to_type = {
|
|
11638
11863
|
string: "TSStringKeyword",
|
|
@@ -11736,6 +11961,14 @@ function ts_type_alias(id2, type_annotation, loc_info) {
|
|
|
11736
11961
|
);
|
|
11737
11962
|
return set_location(node, loc_info);
|
|
11738
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
|
+
}
|
|
11739
11972
|
function object(properties, loc_info) {
|
|
11740
11973
|
const node = { type: "ObjectExpression", properties, metadata: { path: [] } };
|
|
11741
11974
|
return set_location(node, loc_info);
|
|
@@ -11767,10 +12000,39 @@ function assignment_prop(key2, value, computed = false, shorthand = false) {
|
|
|
11767
12000
|
metadata: { path: [] }
|
|
11768
12001
|
};
|
|
11769
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
|
+
}
|
|
11770
12017
|
function quasi(cooked, tail = false) {
|
|
11771
12018
|
const raw = sanitize_template_string(cooked);
|
|
11772
12019
|
return { type: "TemplateElement", value: { raw, cooked }, tail, metadata: { path: [] } };
|
|
11773
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
|
+
}
|
|
11774
12036
|
function stmt(expression) {
|
|
11775
12037
|
return { type: "ExpressionStatement", expression, metadata: { path: [] } };
|
|
11776
12038
|
}
|
|
@@ -11778,16 +12040,89 @@ function template(elements, expressions, loc_info) {
|
|
|
11778
12040
|
const node = { type: "TemplateLiteral", quasis: elements, expressions, metadata: { path: [] } };
|
|
11779
12041
|
return set_location(node, loc_info);
|
|
11780
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
|
+
}
|
|
11781
12076
|
var true_instance = literal2(true);
|
|
11782
12077
|
var false_instance = literal2(false);
|
|
11783
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
|
+
};
|
|
11784
12087
|
function let_builder(pattern, init2) {
|
|
11785
12088
|
return declaration("let", [declarator(pattern, init2)]);
|
|
11786
12089
|
}
|
|
11787
12090
|
function const_builder(pattern, init2) {
|
|
11788
12091
|
return declaration("const", [declarator(pattern, init2)]);
|
|
11789
12092
|
}
|
|
11790
|
-
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) {
|
|
11791
12126
|
const node = {
|
|
11792
12127
|
type: "FunctionExpression",
|
|
11793
12128
|
id: id2,
|
|
@@ -11795,7 +12130,7 @@ function function_builder(id2, params, body, async = false, type_parameters, loc
|
|
|
11795
12130
|
body,
|
|
11796
12131
|
typeParameters: type_parameters,
|
|
11797
12132
|
generator: false,
|
|
11798
|
-
async,
|
|
12133
|
+
async: async2,
|
|
11799
12134
|
metadata: { path: [] }
|
|
11800
12135
|
};
|
|
11801
12136
|
return set_location(node, loc_info);
|
|
@@ -11804,6 +12139,16 @@ function if_builder(test, consequent, alternate, loc_info) {
|
|
|
11804
12139
|
const node = { type: "IfStatement", test, consequent, alternate, metadata: { path: [] } };
|
|
11805
12140
|
return set_location(node, loc_info);
|
|
11806
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
|
+
}
|
|
11807
12152
|
function imports(parts, source, attributes = [], importKind = "value") {
|
|
11808
12153
|
return {
|
|
11809
12154
|
type: "ImportDeclaration",
|
|
@@ -11837,6 +12182,13 @@ function return_builder(argument = null, loc_info) {
|
|
|
11837
12182
|
const node = { type: "ReturnStatement", argument, metadata: { path: [] } };
|
|
11838
12183
|
return set_location(node, loc_info);
|
|
11839
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
|
+
}
|
|
11840
12192
|
function try_builder(block2, handler = null, finalizer = null, pending = null) {
|
|
11841
12193
|
return {
|
|
11842
12194
|
type: "TryStatement",
|
|
@@ -11974,6 +12326,17 @@ function jsx_member(object3, property) {
|
|
|
11974
12326
|
metadata: { path: [] }
|
|
11975
12327
|
};
|
|
11976
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
|
+
}
|
|
11977
12340
|
function jsx_text(value, raw, loc_info) {
|
|
11978
12341
|
const node = (
|
|
11979
12342
|
/** @type {ESTreeJSX.JSXText} */
|
|
@@ -12004,6 +12367,16 @@ function switch_case(test = null, consequent = []) {
|
|
|
12004
12367
|
};
|
|
12005
12368
|
}
|
|
12006
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
|
+
};
|
|
12007
12380
|
|
|
12008
12381
|
// ../../node_modules/.pnpm/@tsrx+core@0.2.0/node_modules/@tsrx/core/src/utils/ast.js
|
|
12009
12382
|
function is_ast_node(value) {
|
|
@@ -15127,20 +15500,20 @@ function TSRXPlugin(config) {
|
|
|
15127
15500
|
this.raise(this.start, "Expected `{` after JSX control-flow directive.");
|
|
15128
15501
|
}
|
|
15129
15502
|
const emptyKeyword = this.#lastClauseKeywordSpan;
|
|
15130
|
-
let
|
|
15503
|
+
let empty3;
|
|
15131
15504
|
this.#templateControlFlowBlockDepth++;
|
|
15132
15505
|
try {
|
|
15133
|
-
|
|
15506
|
+
empty3 = this.parseBlock();
|
|
15134
15507
|
} finally {
|
|
15135
15508
|
this.#templateControlFlowBlockDepth--;
|
|
15136
15509
|
}
|
|
15137
|
-
node.empty =
|
|
15510
|
+
node.empty = empty3;
|
|
15138
15511
|
node.emptyKeyword = emptyKeyword;
|
|
15139
|
-
node.end =
|
|
15512
|
+
node.end = empty3.end;
|
|
15140
15513
|
node.loc.end = /** @type {AST.NodeWithLocation} */
|
|
15141
|
-
|
|
15514
|
+
empty3.loc.end;
|
|
15142
15515
|
if (node.range) node.range[1] = /** @type {number} */
|
|
15143
|
-
|
|
15516
|
+
empty3.end;
|
|
15144
15517
|
} else if (this.#isUnprefixedDirectiveClauseContinuation("empty", ["{"])) {
|
|
15145
15518
|
this.raise(this.start, "Expected `@empty` after `@for` block.");
|
|
15146
15519
|
} else {
|
|
@@ -21278,7 +21651,7 @@ var ts_default = (options = {}) => {
|
|
|
21278
21651
|
}
|
|
21279
21652
|
context.write(" }");
|
|
21280
21653
|
}
|
|
21281
|
-
function
|
|
21654
|
+
function sequence2(context, nodes, until, pad, separator = ",", trailing_newline = true) {
|
|
21282
21655
|
let multiline = false;
|
|
21283
21656
|
let length = -1;
|
|
21284
21657
|
const multiline_nodes = [];
|
|
@@ -21392,7 +21765,7 @@ var ts_default = (options = {}) => {
|
|
|
21392
21765
|
*/
|
|
21393
21766
|
"ArrayExpression|ArrayPattern": (node, context) => {
|
|
21394
21767
|
context.write("[", token_at(node.loc?.start));
|
|
21395
|
-
|
|
21768
|
+
sequence2(
|
|
21396
21769
|
context,
|
|
21397
21770
|
/** @type {TSESTree.Node[]} */
|
|
21398
21771
|
node.elements,
|
|
@@ -21528,7 +21901,7 @@ var ts_default = (options = {}) => {
|
|
|
21528
21901
|
}
|
|
21529
21902
|
if (node.implements && node.implements.length > 0) {
|
|
21530
21903
|
context.write("implements");
|
|
21531
|
-
|
|
21904
|
+
sequence2(context, node.implements, node.body.loc?.start ?? null, true);
|
|
21532
21905
|
}
|
|
21533
21906
|
context.visit(node.body);
|
|
21534
21907
|
},
|
|
@@ -21587,7 +21960,7 @@ var ts_default = (options = {}) => {
|
|
|
21587
21960
|
context.visit(node.typeParameters);
|
|
21588
21961
|
}
|
|
21589
21962
|
context.write("(");
|
|
21590
|
-
|
|
21963
|
+
sequence2(context, node.params, (node.returnType ?? node.body).loc?.start ?? null, false);
|
|
21591
21964
|
context.write(")");
|
|
21592
21965
|
if (node.returnType) context.visit(node.returnType);
|
|
21593
21966
|
context.write(" ");
|
|
@@ -21629,7 +22002,7 @@ var ts_default = (options = {}) => {
|
|
|
21629
22002
|
if (node.optional) context.write("?");
|
|
21630
22003
|
if (node.typeParameters) context.visit(node.typeParameters);
|
|
21631
22004
|
context.write("(");
|
|
21632
|
-
|
|
22005
|
+
sequence2(
|
|
21633
22006
|
context,
|
|
21634
22007
|
node.value.params,
|
|
21635
22008
|
(node.value.returnType ?? node.value.body)?.loc?.start ?? node.loc?.end ?? null,
|
|
@@ -21719,7 +22092,7 @@ var ts_default = (options = {}) => {
|
|
|
21719
22092
|
context.visit(node.typeParameters);
|
|
21720
22093
|
}
|
|
21721
22094
|
context.write("(");
|
|
21722
|
-
|
|
22095
|
+
sequence2(
|
|
21723
22096
|
context,
|
|
21724
22097
|
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
|
|
21725
22098
|
node.parameters ?? node.params,
|
|
@@ -21743,7 +22116,7 @@ var ts_default = (options = {}) => {
|
|
|
21743
22116
|
}
|
|
21744
22117
|
if (node.typeParameters) context.visit(node.typeParameters);
|
|
21745
22118
|
context.write("(");
|
|
21746
|
-
|
|
22119
|
+
sequence2(
|
|
21747
22120
|
context,
|
|
21748
22121
|
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
|
|
21749
22122
|
node.parameters ?? node.params,
|
|
@@ -21779,7 +22152,7 @@ var ts_default = (options = {}) => {
|
|
|
21779
22152
|
context.visit(node.typeParameters);
|
|
21780
22153
|
}
|
|
21781
22154
|
context.write("(");
|
|
21782
|
-
|
|
22155
|
+
sequence2(context, node.params, (node.returnType ?? node.body).loc?.start ?? null, false);
|
|
21783
22156
|
context.write(")");
|
|
21784
22157
|
if (node.returnType) context.visit(node.returnType);
|
|
21785
22158
|
context.write(" => ");
|
|
@@ -21941,7 +22314,7 @@ var ts_default = (options = {}) => {
|
|
|
21941
22314
|
else context.write("type ");
|
|
21942
22315
|
}
|
|
21943
22316
|
context.write("{");
|
|
21944
|
-
|
|
22317
|
+
sequence2(context, node.specifiers, node.source?.loc?.start ?? node.loc?.end ?? null, true);
|
|
21945
22318
|
context.write("}");
|
|
21946
22319
|
if (node.source) {
|
|
21947
22320
|
context.write(" from ");
|
|
@@ -22058,7 +22431,7 @@ var ts_default = (options = {}) => {
|
|
|
22058
22431
|
}
|
|
22059
22432
|
if (named_specifiers.length > 0) {
|
|
22060
22433
|
context.write("{");
|
|
22061
|
-
|
|
22434
|
+
sequence2(context, named_specifiers, node.source.loc?.start ?? null, true);
|
|
22062
22435
|
context.write("}");
|
|
22063
22436
|
}
|
|
22064
22437
|
context.write(" from ");
|
|
@@ -22129,12 +22502,12 @@ var ts_default = (options = {}) => {
|
|
|
22129
22502
|
NewExpression: shared["CallExpression|NewExpression"],
|
|
22130
22503
|
ObjectExpression(node, context) {
|
|
22131
22504
|
context.write("{", token_at(node.loc?.start));
|
|
22132
|
-
|
|
22505
|
+
sequence2(context, node.properties, node.loc?.end ?? null, true);
|
|
22133
22506
|
context.write("}", token_before(node.loc?.end));
|
|
22134
22507
|
},
|
|
22135
22508
|
ObjectPattern(node, context) {
|
|
22136
22509
|
context.write("{", token_at(node.loc?.start));
|
|
22137
|
-
|
|
22510
|
+
sequence2(context, node.properties, node.loc?.end ?? null, true);
|
|
22138
22511
|
context.write("}", token_before(node.loc?.end));
|
|
22139
22512
|
if (node.typeAnnotation) context.visit(node.typeAnnotation);
|
|
22140
22513
|
},
|
|
@@ -22171,7 +22544,7 @@ var ts_default = (options = {}) => {
|
|
|
22171
22544
|
context.visit(node.key);
|
|
22172
22545
|
if (node.computed) context.write("]", token_at(node.key.loc?.end));
|
|
22173
22546
|
context.write("(");
|
|
22174
|
-
|
|
22547
|
+
sequence2(
|
|
22175
22548
|
context,
|
|
22176
22549
|
node.value.params,
|
|
22177
22550
|
(node.value.returnType ?? node.value.body).loc?.start ?? null,
|
|
@@ -22210,7 +22583,7 @@ var ts_default = (options = {}) => {
|
|
|
22210
22583
|
},
|
|
22211
22584
|
SequenceExpression(node, context) {
|
|
22212
22585
|
context.write("(");
|
|
22213
|
-
|
|
22586
|
+
sequence2(context, node.expressions, node.loc?.end ?? null, false);
|
|
22214
22587
|
context.write(")");
|
|
22215
22588
|
},
|
|
22216
22589
|
SpreadElement: shared["RestElement|SpreadElement"],
|
|
@@ -22382,7 +22755,7 @@ var ts_default = (options = {}) => {
|
|
|
22382
22755
|
context.visit(node.typeParameters);
|
|
22383
22756
|
}
|
|
22384
22757
|
context.write("(");
|
|
22385
|
-
|
|
22758
|
+
sequence2(context, node.params, node.returnType?.loc?.start ?? node.loc?.end ?? null, false);
|
|
22386
22759
|
context.write(")");
|
|
22387
22760
|
if (node.returnType) {
|
|
22388
22761
|
context.visit(node.returnType);
|
|
@@ -22438,7 +22811,7 @@ var ts_default = (options = {}) => {
|
|
|
22438
22811
|
},
|
|
22439
22812
|
TSTypeLiteral(node, context) {
|
|
22440
22813
|
context.write("{ ");
|
|
22441
|
-
|
|
22814
|
+
sequence2(context, node.members, node.loc?.end ?? null, false, ";");
|
|
22442
22815
|
context.write(" }");
|
|
22443
22816
|
},
|
|
22444
22817
|
TSPropertySignature(node, context) {
|
|
@@ -22571,7 +22944,7 @@ var ts_default = (options = {}) => {
|
|
|
22571
22944
|
TSIndexSignature(node, context) {
|
|
22572
22945
|
if (node.readonly) context.write("readonly ");
|
|
22573
22946
|
context.write("[");
|
|
22574
|
-
|
|
22947
|
+
sequence2(context, node.parameters, node.typeAnnotation?.loc?.start ?? null, false);
|
|
22575
22948
|
context.write("]");
|
|
22576
22949
|
context.visit(node.typeAnnotation);
|
|
22577
22950
|
},
|
|
@@ -22621,7 +22994,7 @@ var ts_default = (options = {}) => {
|
|
|
22621
22994
|
context.visit(node.typeParameters);
|
|
22622
22995
|
}
|
|
22623
22996
|
context.write("(");
|
|
22624
|
-
|
|
22997
|
+
sequence2(
|
|
22625
22998
|
context,
|
|
22626
22999
|
// @ts-expect-error `acorn-typescript` and `@typescript-eslint/types` have slightly different type definitions
|
|
22627
23000
|
node.parameters ?? node.params,
|
|
@@ -22636,7 +23009,7 @@ var ts_default = (options = {}) => {
|
|
|
22636
23009
|
},
|
|
22637
23010
|
TSTupleType(node, context) {
|
|
22638
23011
|
context.write("[");
|
|
22639
|
-
|
|
23012
|
+
sequence2(context, node.elementTypes, node.loc?.end ?? null, false);
|
|
22640
23013
|
context.write("]");
|
|
22641
23014
|
},
|
|
22642
23015
|
TSNamedTupleMember(node, context) {
|
|
@@ -22646,10 +23019,10 @@ var ts_default = (options = {}) => {
|
|
|
22646
23019
|
context.visit(node.elementType);
|
|
22647
23020
|
},
|
|
22648
23021
|
TSUnionType(node, context) {
|
|
22649
|
-
|
|
23022
|
+
sequence2(context, node.types, node.loc?.end ?? null, false, " |", false);
|
|
22650
23023
|
},
|
|
22651
23024
|
TSIntersectionType(node, context) {
|
|
22652
|
-
|
|
23025
|
+
sequence2(context, node.types, node.loc?.end ?? null, false, " &", false);
|
|
22653
23026
|
},
|
|
22654
23027
|
TSInferType(node, context) {
|
|
22655
23028
|
context.write("infer ");
|
|
@@ -22727,7 +23100,7 @@ var ts_default = (options = {}) => {
|
|
|
22727
23100
|
context.write(" {");
|
|
22728
23101
|
context.indent();
|
|
22729
23102
|
context.newline();
|
|
22730
|
-
|
|
23103
|
+
sequence2(context, node.members ?? node.body.members, node.loc?.end ?? null, false);
|
|
22731
23104
|
context.dedent();
|
|
22732
23105
|
context.newline();
|
|
22733
23106
|
context.write("}");
|
|
@@ -22768,7 +23141,7 @@ var ts_default = (options = {}) => {
|
|
|
22768
23141
|
context.write("!");
|
|
22769
23142
|
},
|
|
22770
23143
|
TSInterfaceBody(node, context) {
|
|
22771
|
-
|
|
23144
|
+
sequence2(context, node.body, node.loc?.end ?? null, true, ";");
|
|
22772
23145
|
},
|
|
22773
23146
|
TSInterfaceDeclaration(node, context) {
|
|
22774
23147
|
if (node.declare) context.write("declare ");
|
|
@@ -22777,7 +23150,7 @@ var ts_default = (options = {}) => {
|
|
|
22777
23150
|
if (node.typeParameters) context.visit(node.typeParameters);
|
|
22778
23151
|
if (node.extends && node.extends.length > 0) {
|
|
22779
23152
|
context.write(" extends ");
|
|
22780
|
-
|
|
23153
|
+
sequence2(context, node.extends, node.body.loc?.start ?? null, false);
|
|
22781
23154
|
}
|
|
22782
23155
|
context.write(" {");
|
|
22783
23156
|
context.visit(node.body);
|
|
@@ -23846,17 +24219,17 @@ function class_attribute_base(attr) {
|
|
|
23846
24219
|
function build_scope_class_value(parts) {
|
|
23847
24220
|
const { base, hashes, applied } = parts;
|
|
23848
24221
|
const base_literal = base?.type === "Literal" && typeof base.value === "string" ? base : null;
|
|
23849
|
-
const
|
|
23850
|
-
if (base_literal)
|
|
24222
|
+
const sequence2 = [];
|
|
24223
|
+
if (base_literal) sequence2.push(
|
|
23851
24224
|
/** @type {string} */
|
|
23852
24225
|
base_literal.value
|
|
23853
24226
|
);
|
|
23854
|
-
else if (base)
|
|
23855
|
-
|
|
24227
|
+
else if (base) sequence2.push(base);
|
|
24228
|
+
sequence2.push(...hashes, ...applied);
|
|
23856
24229
|
const quasis = [];
|
|
23857
24230
|
const expressions = [];
|
|
23858
24231
|
let text = "";
|
|
23859
|
-
for (const part of
|
|
24232
|
+
for (const part of sequence2) {
|
|
23860
24233
|
if (typeof part === "string") {
|
|
23861
24234
|
if (part) text = text ? `${text} ${part}` : part;
|
|
23862
24235
|
continue;
|
|
@@ -24405,7 +24778,7 @@ function relative_selector_might_apply_to_node(relative_selector, rule, element,
|
|
|
24405
24778
|
);
|
|
24406
24779
|
let matched = false;
|
|
24407
24780
|
for (const complex_selector of complex_selectors) {
|
|
24408
|
-
const [first, ...
|
|
24781
|
+
const [first, ...rest2] = truncate(complex_selector);
|
|
24409
24782
|
if (!first) {
|
|
24410
24783
|
complex_selector.metadata.used = true;
|
|
24411
24784
|
matched = true;
|
|
@@ -24414,7 +24787,7 @@ function relative_selector_might_apply_to_node(relative_selector, rule, element,
|
|
|
24414
24787
|
if (include_self) {
|
|
24415
24788
|
const selector_including_self = [
|
|
24416
24789
|
first.combinator ? { ...first, combinator: null } : first,
|
|
24417
|
-
...
|
|
24790
|
+
...rest2
|
|
24418
24791
|
];
|
|
24419
24792
|
if (apply_selector(selector_including_self, rule, element, FORWARD)) {
|
|
24420
24793
|
complex_selector.metadata.used = true;
|
|
@@ -24424,7 +24797,7 @@ function relative_selector_might_apply_to_node(relative_selector, rule, element,
|
|
|
24424
24797
|
const selector_excluding_self = [
|
|
24425
24798
|
create_any_selector(first.start, first.end),
|
|
24426
24799
|
first.combinator ? first : { ...first, combinator: create_descendant_combinator(first.start, first.end) },
|
|
24427
|
-
...
|
|
24800
|
+
...rest2
|
|
24428
24801
|
];
|
|
24429
24802
|
if (apply_selector(selector_excluding_self, rule, element, FORWARD)) {
|
|
24430
24803
|
complex_selector.metadata.used = true;
|
|
@@ -25371,11 +25744,11 @@ function lower_colliding_import(statement, hoisted_name) {
|
|
|
25371
25744
|
function lower_declaration(declaration2, outside_names, block_name) {
|
|
25372
25745
|
const hoisted_imports = [];
|
|
25373
25746
|
const aliases = [];
|
|
25374
|
-
const
|
|
25747
|
+
const rest2 = [];
|
|
25375
25748
|
let hoisted_index = 0;
|
|
25376
25749
|
for (const statement of declaration2.body?.body ?? []) {
|
|
25377
25750
|
if (statement.type !== "ImportDeclaration") {
|
|
25378
|
-
|
|
25751
|
+
rest2.push(statement);
|
|
25379
25752
|
continue;
|
|
25380
25753
|
}
|
|
25381
25754
|
const collides = statement.specifiers.some(
|
|
@@ -25397,7 +25770,7 @@ function lower_declaration(declaration2, outside_names, block_name) {
|
|
|
25397
25770
|
id: id2,
|
|
25398
25771
|
kind: "namespace",
|
|
25399
25772
|
metadata: { ...declaration2.metadata, module_keyword: "namespace" },
|
|
25400
|
-
body: { ...declaration2.body, body: [...aliases, ...
|
|
25773
|
+
body: { ...declaration2.body, body: [...aliases, ...rest2] }
|
|
25401
25774
|
}
|
|
25402
25775
|
);
|
|
25403
25776
|
return [...hoisted_imports, namespace];
|
|
@@ -25524,14 +25897,14 @@ function expand_child_code_blocks(node, seen = /* @__PURE__ */ new Set()) {
|
|
|
25524
25897
|
node
|
|
25525
25898
|
);
|
|
25526
25899
|
let out = source;
|
|
25527
|
-
const
|
|
25900
|
+
const set2 = (key2, value) => {
|
|
25528
25901
|
if (out[key2] === value) return;
|
|
25529
25902
|
if (out === source) out = { ...source };
|
|
25530
25903
|
out[key2] = value;
|
|
25531
25904
|
};
|
|
25532
25905
|
const children = source.children;
|
|
25533
25906
|
if (Array.isArray(children) && children.some((c) => is_ast_node(c) && c.type === "JSXCodeBlock")) {
|
|
25534
|
-
|
|
25907
|
+
set2(
|
|
25535
25908
|
"children",
|
|
25536
25909
|
children.flatMap(
|
|
25537
25910
|
(child) => is_ast_node(child) && child.type === "JSXCodeBlock" ? lower_code_block_child(child) : [child]
|
|
@@ -25549,9 +25922,9 @@ function expand_child_code_blocks(node, seen = /* @__PURE__ */ new Set()) {
|
|
|
25549
25922
|
if (walked !== entry) changed = true;
|
|
25550
25923
|
return walked;
|
|
25551
25924
|
});
|
|
25552
|
-
if (changed)
|
|
25925
|
+
if (changed) set2(key2, result);
|
|
25553
25926
|
} else if (is_ast_node(value)) {
|
|
25554
|
-
|
|
25927
|
+
set2(key2, expand_child_code_blocks(value, seen));
|
|
25555
25928
|
}
|
|
25556
25929
|
}
|
|
25557
25930
|
return (
|
|
@@ -25633,26 +26006,26 @@ function wrap_control_flow_expression_values(node, transform_context, seen = /*
|
|
|
25633
26006
|
node
|
|
25634
26007
|
);
|
|
25635
26008
|
let out = source;
|
|
25636
|
-
const
|
|
26009
|
+
const set2 = (key2, value) => {
|
|
25637
26010
|
if (out[key2] === value) return;
|
|
25638
26011
|
if (out === source) out = { ...source };
|
|
25639
26012
|
out[key2] = value;
|
|
25640
26013
|
};
|
|
25641
26014
|
if (node.type === "ArrowFunctionExpression" && node.body?.type !== "BlockStatement" && is_template_directive(node.body)) {
|
|
25642
|
-
|
|
26015
|
+
set2("body", wrap_in_native_tsrx_fragment(node.body));
|
|
25643
26016
|
} else if (node.type === "ReturnStatement" && is_template_directive(node.argument)) {
|
|
25644
|
-
|
|
26017
|
+
set2("argument", wrap_in_native_tsrx_fragment(node.argument));
|
|
25645
26018
|
} else if (node.type === "ExpressionStatement" && is_template_directive(node.expression)) {
|
|
25646
|
-
|
|
26019
|
+
set2("expression", wrap_in_native_tsrx_fragment(node.expression));
|
|
25647
26020
|
} else if (node.type === "VariableDeclarator" && is_template_directive(node.init)) {
|
|
25648
|
-
|
|
26021
|
+
set2("init", wrap_in_native_tsrx_fragment(node.init));
|
|
25649
26022
|
} else if (node.type === "AssignmentExpression" && is_template_directive(node.right)) {
|
|
25650
|
-
|
|
26023
|
+
set2("right", wrap_in_native_tsrx_fragment(node.right));
|
|
25651
26024
|
} else if ((node.type === "CallExpression" || node.type === "NewExpression") && Array.isArray(node.arguments)) {
|
|
25652
26025
|
const args = node.arguments;
|
|
25653
26026
|
const wrapped = args.map(wrap_value);
|
|
25654
26027
|
if (wrapped.some((argument, i2) => argument !== args[i2])) {
|
|
25655
|
-
|
|
26028
|
+
set2("arguments", wrapped);
|
|
25656
26029
|
}
|
|
25657
26030
|
}
|
|
25658
26031
|
for (const key2 of Object.keys(out)) {
|
|
@@ -25669,11 +26042,11 @@ function wrap_control_flow_expression_values(node, transform_context, seen = /*
|
|
|
25669
26042
|
if (next !== entry) changed = true;
|
|
25670
26043
|
return next;
|
|
25671
26044
|
});
|
|
25672
|
-
if (changed)
|
|
26045
|
+
if (changed) set2(key2, result);
|
|
25673
26046
|
} else if (is_ast_node(value)) {
|
|
25674
26047
|
let next = lower_child(value);
|
|
25675
26048
|
if (!allowed_slot) next = wrap_directive_in_expression(next);
|
|
25676
|
-
|
|
26049
|
+
set2(key2, wrap_control_flow_expression_values(next, transform_context, seen));
|
|
25677
26050
|
}
|
|
25678
26051
|
}
|
|
25679
26052
|
return (
|
|
@@ -27035,7 +27408,7 @@ function lower_remaining_jsx_code_blocks(node, transform_context, seen = /* @__P
|
|
|
27035
27408
|
is_function_node(node) ? lower_jsx_code_block_function_body(node) : node
|
|
27036
27409
|
);
|
|
27037
27410
|
let out = source;
|
|
27038
|
-
const
|
|
27411
|
+
const set2 = (key2, value) => {
|
|
27039
27412
|
if (out[key2] === value) return;
|
|
27040
27413
|
if (out === source) out = { ...source };
|
|
27041
27414
|
out[key2] = value;
|
|
@@ -27063,9 +27436,9 @@ function lower_remaining_jsx_code_blocks(node, transform_context, seen = /* @__P
|
|
|
27063
27436
|
if (walked !== child) changed = true;
|
|
27064
27437
|
return walked;
|
|
27065
27438
|
});
|
|
27066
|
-
if (changed)
|
|
27439
|
+
if (changed) set2(key2, result);
|
|
27067
27440
|
} else if (is_ast_node(value)) {
|
|
27068
|
-
|
|
27441
|
+
set2(key2, lower_remaining_jsx_code_blocks(value, transform_context, seen));
|
|
27069
27442
|
}
|
|
27070
27443
|
}
|
|
27071
27444
|
return (
|
|
@@ -28863,7 +29236,7 @@ function normalize_host_ref_spreads(attrs, is_host, transform_context) {
|
|
|
28863
29236
|
const normalized_id = create_generated_identifier(
|
|
28864
29237
|
create_spread_props_name(transform_context)
|
|
28865
29238
|
);
|
|
28866
|
-
const
|
|
29239
|
+
const spread2 = {
|
|
28867
29240
|
...attr,
|
|
28868
29241
|
argument: clone_identifier(normalized_id)
|
|
28869
29242
|
};
|
|
@@ -28875,8 +29248,8 @@ function normalize_host_ref_spreads(attrs, is_host, transform_context) {
|
|
|
28875
29248
|
);
|
|
28876
29249
|
ref_attr.metadata = { ...ref_attr.metadata || {} };
|
|
28877
29250
|
ref_attr.metadata.synthetic_ref = true;
|
|
28878
|
-
add_jsx_setup_declaration(
|
|
28879
|
-
return [
|
|
29251
|
+
add_jsx_setup_declaration(spread2, let_builder(clone_identifier(normalized_id), normalized));
|
|
29252
|
+
return [spread2, ref_attr];
|
|
28880
29253
|
}
|
|
28881
29254
|
return [
|
|
28882
29255
|
{
|
|
@@ -31417,6 +31790,13 @@ import { analyzeNativeChangeDiagnostics } from "./native-change-diagnostics.js";
|
|
|
31417
31790
|
import { analyzeStrongMode } from "./strong-mode.js";
|
|
31418
31791
|
import { analyzeNativeReadDiagnostics, nativeReadOptions } from "./native-read-diagnostics.js";
|
|
31419
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";
|
|
31420
31800
|
import {
|
|
31421
31801
|
DOM_RENDERER_MODULE,
|
|
31422
31802
|
normalizeRendererConfig,
|
|
@@ -31449,6 +31829,149 @@ var OCTANE_PLATFORM = {
|
|
|
31449
31829
|
}
|
|
31450
31830
|
};
|
|
31451
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
|
+
}
|
|
31452
31975
|
var octaneTransformWithAuthoredSuspense = createJsxTransform({
|
|
31453
31976
|
...OCTANE_PLATFORM,
|
|
31454
31977
|
hooks: {
|
|
@@ -31574,16 +32097,24 @@ function compileToVolarMappings(source, filename, options) {
|
|
|
31574
32097
|
transformAst = { ...ast, body: [first, ...ast.body.slice(1)] };
|
|
31575
32098
|
}
|
|
31576
32099
|
const transform = selectOctaneTransform(ast);
|
|
31577
|
-
const transformed = transform(
|
|
31578
|
-
|
|
31579
|
-
|
|
31580
|
-
|
|
31581
|
-
|
|
31582
|
-
|
|
31583
|
-
|
|
31584
|
-
|
|
31585
|
-
|
|
31586
|
-
|
|
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
|
+
);
|
|
31587
32118
|
if (strongDiagnostics !== null || nativeReadDiagnostics.length > 0) {
|
|
31588
32119
|
for (const diagnostic of [...strongDiagnostics ?? [], ...nativeReadDiagnostics]) {
|
|
31589
32120
|
if (diagnostic.severity !== "error") continue;
|
|
@@ -31720,7 +32251,7 @@ function compileTypesInspection(source, filename, options) {
|
|
|
31720
32251
|
const renderer = resolveRendererForFile(rendererConfig, filename ?? "untitled.tsrx");
|
|
31721
32252
|
const rendererPragma = authoredLeadingPragma(ast, comments) ? null : createRendererTypePragma(renderer, ast);
|
|
31722
32253
|
const transform = selectOctaneTransform(ast);
|
|
31723
|
-
const transformed = transform(ast, source, filename, {
|
|
32254
|
+
const transformed = transform(projectServerContextCalls(ast, filename), source, filename, {
|
|
31724
32255
|
collect: true,
|
|
31725
32256
|
loose: true,
|
|
31726
32257
|
typeOnly: true,
|