@barefootjs/test 0.31.3 → 0.31.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +530 -411
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -187288,7 +187288,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
187288
187288
|
});
|
|
187289
187289
|
|
|
187290
187290
|
// ../jsx/src/compiler.ts
|
|
187291
|
-
var
|
|
187291
|
+
var import_typescript24 = __toESM(require_typescript(), 1);
|
|
187292
187292
|
|
|
187293
187293
|
// ../jsx/src/analyzer.ts
|
|
187294
187294
|
var import_typescript9 = __toESM(require_typescript(), 1);
|
|
@@ -188846,6 +188846,24 @@ function templatePartsToJsExpr(parts, opts) {
|
|
|
188846
188846
|
return result;
|
|
188847
188847
|
}
|
|
188848
188848
|
|
|
188849
|
+
// ../jsx/src/identifier-pattern.ts
|
|
188850
|
+
function withUnicodeFlag(flags) {
|
|
188851
|
+
return flags.includes("u") ? flags : `${flags}u`;
|
|
188852
|
+
}
|
|
188853
|
+
function escapeIdentifierForRegex(name) {
|
|
188854
|
+
return name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
188855
|
+
}
|
|
188856
|
+
var ID_BOUNDARY_BEFORE = "(?<![\\p{ID_Continue}$])";
|
|
188857
|
+
var ID_BOUNDARY_AFTER = "(?![\\p{ID_Continue}$])";
|
|
188858
|
+
function identifierPattern(name, flags = "") {
|
|
188859
|
+
const esc = escapeIdentifierForRegex(name);
|
|
188860
|
+
return new RegExp(`${ID_BOUNDARY_BEFORE}${esc}${ID_BOUNDARY_AFTER}`, withUnicodeFlag(flags));
|
|
188861
|
+
}
|
|
188862
|
+
function identifierCallPattern(name, flags = "") {
|
|
188863
|
+
const esc = escapeIdentifierForRegex(name);
|
|
188864
|
+
return new RegExp(`${ID_BOUNDARY_BEFORE}${esc}\\s*\\(`, withUnicodeFlag(flags));
|
|
188865
|
+
}
|
|
188866
|
+
|
|
188849
188867
|
// ../jsx/src/scanner/js-scanner.ts
|
|
188850
188868
|
var import_typescript2 = __toESM(require_typescript(), 1);
|
|
188851
188869
|
function* iterateJsTokens(text, start = 0, end = text.length) {
|
|
@@ -189229,6 +189247,83 @@ function extractFreeIdentifiersFromText(text) {
|
|
|
189229
189247
|
return extractFreeIdentifiersFromNode(expr);
|
|
189230
189248
|
}
|
|
189231
189249
|
|
|
189250
|
+
// ../jsx/src/scope/binding-scope.ts
|
|
189251
|
+
class BindingScope {
|
|
189252
|
+
frames;
|
|
189253
|
+
static EMPTY = new BindingScope([]);
|
|
189254
|
+
constructor(frames) {
|
|
189255
|
+
this.frames = frames;
|
|
189256
|
+
}
|
|
189257
|
+
enterLoopRow(loop) {
|
|
189258
|
+
const bindings = new Map;
|
|
189259
|
+
if (loop.paramBindings && loop.paramBindings.length > 0) {
|
|
189260
|
+
for (const b of loop.paramBindings)
|
|
189261
|
+
bindings.set(b.name, { source: "destructure" });
|
|
189262
|
+
} else {
|
|
189263
|
+
bindings.set(loop.param, { source: "item" });
|
|
189264
|
+
}
|
|
189265
|
+
if (loop.index != null)
|
|
189266
|
+
bindings.set(loop.index, { source: "index" });
|
|
189267
|
+
for (const name of loop.preamble?.declaredNames ?? [])
|
|
189268
|
+
bindings.set(name, { source: "preamble" });
|
|
189269
|
+
const frame = { kind: "loop-row", bindings };
|
|
189270
|
+
return new BindingScope([frame, ...this.frames]);
|
|
189271
|
+
}
|
|
189272
|
+
enterCallback(params) {
|
|
189273
|
+
const bindings = new Map;
|
|
189274
|
+
for (const name of params)
|
|
189275
|
+
bindings.set(name, { source: "param" });
|
|
189276
|
+
const frame = { kind: "callback", bindings };
|
|
189277
|
+
return new BindingScope([frame, ...this.frames]);
|
|
189278
|
+
}
|
|
189279
|
+
isBound(name) {
|
|
189280
|
+
for (const frame of this.frames) {
|
|
189281
|
+
if (frame.bindings.has(name))
|
|
189282
|
+
return true;
|
|
189283
|
+
}
|
|
189284
|
+
return false;
|
|
189285
|
+
}
|
|
189286
|
+
lookup(name) {
|
|
189287
|
+
for (let depth = 0;depth < this.frames.length; depth++) {
|
|
189288
|
+
const frame = this.frames[depth];
|
|
189289
|
+
const binding = frame.bindings.get(name);
|
|
189290
|
+
if (binding)
|
|
189291
|
+
return { depth, frame, binding };
|
|
189292
|
+
}
|
|
189293
|
+
return null;
|
|
189294
|
+
}
|
|
189295
|
+
boundNames() {
|
|
189296
|
+
if (this.boundNamesCache)
|
|
189297
|
+
return this.boundNamesCache;
|
|
189298
|
+
const names = new Set;
|
|
189299
|
+
for (const frame of this.frames) {
|
|
189300
|
+
for (const name of frame.bindings.keys())
|
|
189301
|
+
names.add(name);
|
|
189302
|
+
}
|
|
189303
|
+
this.boundNamesCache = names;
|
|
189304
|
+
return names;
|
|
189305
|
+
}
|
|
189306
|
+
boundNamesCache;
|
|
189307
|
+
valueBoundNamesCache;
|
|
189308
|
+
valueBoundNames() {
|
|
189309
|
+
if (this.valueBoundNamesCache)
|
|
189310
|
+
return this.valueBoundNamesCache;
|
|
189311
|
+
const names = new Set;
|
|
189312
|
+
for (const frame of this.frames) {
|
|
189313
|
+
for (const [name, binding] of frame.bindings) {
|
|
189314
|
+
if (binding.source === "item" || binding.source === "index" || binding.source === "destructure") {
|
|
189315
|
+
names.add(name);
|
|
189316
|
+
}
|
|
189317
|
+
}
|
|
189318
|
+
}
|
|
189319
|
+
this.valueBoundNamesCache = names;
|
|
189320
|
+
return names;
|
|
189321
|
+
}
|
|
189322
|
+
asShadowPredicate() {
|
|
189323
|
+
return (name) => this.isBound(name);
|
|
189324
|
+
}
|
|
189325
|
+
}
|
|
189326
|
+
|
|
189232
189327
|
// ../jsx/src/ir-to-client-js/html-template.ts
|
|
189233
189328
|
function splitTemplateInterpolations(inner) {
|
|
189234
189329
|
const parts = [];
|
|
@@ -193544,7 +193639,7 @@ function validateObjectFactoryDestructure(ctx, pattern, callee, loc) {
|
|
|
193544
193639
|
}
|
|
193545
193640
|
|
|
193546
193641
|
// ../jsx/src/jsx-to-ir.ts
|
|
193547
|
-
var
|
|
193642
|
+
var import_typescript13 = __toESM(require_typescript(), 1);
|
|
193548
193643
|
|
|
193549
193644
|
// ../jsx/src/types.ts
|
|
193550
193645
|
var SCOPE_FORBIDDEN = {
|
|
@@ -193620,6 +193715,7 @@ var AttrValueOf = {
|
|
|
193620
193715
|
};
|
|
193621
193716
|
|
|
193622
193717
|
// ../jsx/src/module-exports.ts
|
|
193718
|
+
var import_typescript10 = __toESM(require_typescript(), 1);
|
|
193623
193719
|
function formatParamWithType(p) {
|
|
193624
193720
|
const rest = p.isRest ? "..." : "";
|
|
193625
193721
|
const optional = p.optional ? "?" : "";
|
|
@@ -193633,7 +193729,7 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
193633
193729
|
const reachable = new Set;
|
|
193634
193730
|
const queue = [];
|
|
193635
193731
|
for (const name of allNames) {
|
|
193636
|
-
if (
|
|
193732
|
+
if (identifierPattern(name).test(primaryRefs)) {
|
|
193637
193733
|
reachable.add(name);
|
|
193638
193734
|
queue.push(name);
|
|
193639
193735
|
}
|
|
@@ -193642,7 +193738,7 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
193642
193738
|
const current = queue.shift();
|
|
193643
193739
|
const body = bodyMap.get(current) || "";
|
|
193644
193740
|
for (const name of allNames) {
|
|
193645
|
-
if (!reachable.has(name) &&
|
|
193741
|
+
if (!reachable.has(name) && identifierPattern(name).test(body)) {
|
|
193646
193742
|
reachable.add(name);
|
|
193647
193743
|
queue.push(name);
|
|
193648
193744
|
}
|
|
@@ -193650,6 +193746,49 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
193650
193746
|
}
|
|
193651
193747
|
return reachable;
|
|
193652
193748
|
}
|
|
193749
|
+
function findAssignedNames(bodyText, candidates) {
|
|
193750
|
+
const assigned = new Set;
|
|
193751
|
+
if (candidates.size === 0)
|
|
193752
|
+
return assigned;
|
|
193753
|
+
const sf = import_typescript10.default.createSourceFile("bf-assignment-scan.tsx", bodyText, import_typescript10.default.ScriptTarget.Latest, false, import_typescript10.default.ScriptKind.TSX);
|
|
193754
|
+
const record = (target) => {
|
|
193755
|
+
if (import_typescript10.default.isIdentifier(target) && candidates.has(target.text)) {
|
|
193756
|
+
assigned.add(target.text);
|
|
193757
|
+
}
|
|
193758
|
+
};
|
|
193759
|
+
const visit2 = (node) => {
|
|
193760
|
+
if (import_typescript10.default.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
193761
|
+
record(node.left);
|
|
193762
|
+
} else if ((import_typescript10.default.isPrefixUnaryExpression(node) || import_typescript10.default.isPostfixUnaryExpression(node)) && (node.operator === import_typescript10.default.SyntaxKind.PlusPlusToken || node.operator === import_typescript10.default.SyntaxKind.MinusMinusToken)) {
|
|
193763
|
+
record(node.operand);
|
|
193764
|
+
}
|
|
193765
|
+
import_typescript10.default.forEachChild(node, visit2);
|
|
193766
|
+
};
|
|
193767
|
+
import_typescript10.default.forEachChild(sf, visit2);
|
|
193768
|
+
return assigned;
|
|
193769
|
+
}
|
|
193770
|
+
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
193771
|
+
let reachable = findReachableNames(primaryRefs, declarations);
|
|
193772
|
+
if (mutableNames.size === 0)
|
|
193773
|
+
return reachable;
|
|
193774
|
+
let seedText = primaryRefs;
|
|
193775
|
+
for (let round = 0;round <= declarations.length; round++) {
|
|
193776
|
+
const survivingMutables = new Set([...reachable].filter((name) => mutableNames.has(name)));
|
|
193777
|
+
if (survivingMutables.size === 0)
|
|
193778
|
+
return reachable;
|
|
193779
|
+
const added = declarations.filter((d) => !reachable.has(d.name)).filter((d) => findAssignedNames(d.body, survivingMutables).size > 0).map((d) => d.name);
|
|
193780
|
+
if (added.length === 0)
|
|
193781
|
+
return reachable;
|
|
193782
|
+
seedText += `
|
|
193783
|
+
` + added.join(`
|
|
193784
|
+
`);
|
|
193785
|
+
reachable = findReachableNames(seedText, declarations);
|
|
193786
|
+
}
|
|
193787
|
+
return reachable;
|
|
193788
|
+
}
|
|
193789
|
+
function isAssignmentOperator(kind) {
|
|
193790
|
+
return kind >= import_typescript10.default.SyntaxKind.FirstAssignment && kind <= import_typescript10.default.SyntaxKind.LastAssignment;
|
|
193791
|
+
}
|
|
193653
193792
|
|
|
193654
193793
|
// ../jsx/src/builtins.ts
|
|
193655
193794
|
var CLIENT_BUILTIN_SOURCE = "@barefootjs/client";
|
|
@@ -193658,7 +193797,7 @@ function isClientBuiltinName(name) {
|
|
|
193658
193797
|
}
|
|
193659
193798
|
|
|
193660
193799
|
// ../jsx/src/reactivity-checker.ts
|
|
193661
|
-
var
|
|
193800
|
+
var import_typescript11 = __toESM(require_typescript(), 1);
|
|
193662
193801
|
var REACTIVE_BRAND = "__reactive";
|
|
193663
193802
|
function queryType(checker, node) {
|
|
193664
193803
|
incrementCounter("typeCheckerQueries");
|
|
@@ -193676,7 +193815,7 @@ function safeGetText(node) {
|
|
|
193676
193815
|
}
|
|
193677
193816
|
}
|
|
193678
193817
|
function analyze(node, checker) {
|
|
193679
|
-
if (
|
|
193818
|
+
if (import_typescript11.default.isPropertyAccessExpression(node)) {
|
|
193680
193819
|
try {
|
|
193681
193820
|
const type2 = queryType(checker, node);
|
|
193682
193821
|
if (isReactiveType(type2)) {
|
|
@@ -193700,7 +193839,7 @@ function analyze(node, checker) {
|
|
|
193700
193839
|
}
|
|
193701
193840
|
return NOT_REACTIVE;
|
|
193702
193841
|
}
|
|
193703
|
-
if (
|
|
193842
|
+
if (import_typescript11.default.isIdentifier(node)) {
|
|
193704
193843
|
try {
|
|
193705
193844
|
const type2 = queryType(checker, node);
|
|
193706
193845
|
if (isReactiveType(type2)) {
|
|
@@ -193712,7 +193851,7 @@ function analyze(node, checker) {
|
|
|
193712
193851
|
} catch {}
|
|
193713
193852
|
return NOT_REACTIVE;
|
|
193714
193853
|
}
|
|
193715
|
-
if (
|
|
193854
|
+
if (import_typescript11.default.isCallExpression(node)) {
|
|
193716
193855
|
try {
|
|
193717
193856
|
const calleeType = queryType(checker, node.expression);
|
|
193718
193857
|
if (isReactiveType(calleeType)) {
|
|
@@ -193725,7 +193864,7 @@ function analyze(node, checker) {
|
|
|
193725
193864
|
}
|
|
193726
193865
|
let foundChild;
|
|
193727
193866
|
let foundChildText = "";
|
|
193728
|
-
|
|
193867
|
+
import_typescript11.default.forEachChild(node, (child) => {
|
|
193729
193868
|
if (foundChild?.isReactive)
|
|
193730
193869
|
return;
|
|
193731
193870
|
const result = analyze(child, checker);
|
|
@@ -193754,7 +193893,7 @@ function containsReactiveExpression(node, checker) {
|
|
|
193754
193893
|
}
|
|
193755
193894
|
|
|
193756
193895
|
// ../jsx/src/free-refs.ts
|
|
193757
|
-
var
|
|
193896
|
+
var import_typescript12 = __toESM(require_typescript(), 1);
|
|
193758
193897
|
var _bindingMapCache = new WeakMap;
|
|
193759
193898
|
function buildBindingMap(env) {
|
|
193760
193899
|
const cached = _bindingMapCache.get(env);
|
|
@@ -193792,8 +193931,8 @@ function buildBindingMap(env) {
|
|
|
193792
193931
|
for (const m of env.memos) {
|
|
193793
193932
|
map.set(m.name, "memo-getter");
|
|
193794
193933
|
}
|
|
193795
|
-
if (env.
|
|
193796
|
-
for (const name of env.
|
|
193934
|
+
if (env.loopValueBoundNames) {
|
|
193935
|
+
for (const name of env.loopValueBoundNames)
|
|
193797
193936
|
map.set(name, "render-item");
|
|
193798
193937
|
}
|
|
193799
193938
|
_bindingMapCache.set(env, map);
|
|
@@ -193822,20 +193961,20 @@ function defaultBindingScope(kind) {
|
|
|
193822
193961
|
function collectIdentifiers2(node) {
|
|
193823
193962
|
const out = [];
|
|
193824
193963
|
const visit2 = (n, parent) => {
|
|
193825
|
-
if (
|
|
193826
|
-
if (parent &&
|
|
193964
|
+
if (import_typescript12.default.isIdentifier(n)) {
|
|
193965
|
+
if (parent && import_typescript12.default.isPropertyAccessExpression(parent) && parent.name === n)
|
|
193827
193966
|
return;
|
|
193828
|
-
if (parent &&
|
|
193967
|
+
if (parent && import_typescript12.default.isPropertyAssignment(parent) && parent.name === n)
|
|
193829
193968
|
return;
|
|
193830
|
-
if (parent && (
|
|
193969
|
+
if (parent && (import_typescript12.default.isJsxOpeningElement(parent) || import_typescript12.default.isJsxClosingElement(parent) || import_typescript12.default.isJsxSelfClosingElement(parent)) && parent.tagName === n) {
|
|
193831
193970
|
return;
|
|
193832
193971
|
}
|
|
193833
|
-
if (parent &&
|
|
193972
|
+
if (parent && import_typescript12.default.isJsxAttribute(parent) && parent.name === n)
|
|
193834
193973
|
return;
|
|
193835
193974
|
out.push(n);
|
|
193836
193975
|
return;
|
|
193837
193976
|
}
|
|
193838
|
-
|
|
193977
|
+
import_typescript12.default.forEachChild(n, (child) => visit2(child, n));
|
|
193839
193978
|
};
|
|
193840
193979
|
visit2(node);
|
|
193841
193980
|
return out;
|
|
@@ -193844,7 +193983,7 @@ function collectReactiveBrandRefs(node, checker) {
|
|
|
193844
193983
|
const out = [];
|
|
193845
193984
|
const seen = new Set;
|
|
193846
193985
|
const visit2 = (n) => {
|
|
193847
|
-
if (
|
|
193986
|
+
if (import_typescript12.default.isPropertyAccessExpression(n)) {
|
|
193848
193987
|
try {
|
|
193849
193988
|
const type2 = checker.getTypeAtLocation(n);
|
|
193850
193989
|
if (isReactiveType(type2)) {
|
|
@@ -193862,7 +194001,7 @@ function collectReactiveBrandRefs(node, checker) {
|
|
|
193862
194001
|
incrementCounter("freeRefsTypeLookupFailures");
|
|
193863
194002
|
}
|
|
193864
194003
|
}
|
|
193865
|
-
|
|
194004
|
+
import_typescript12.default.forEachChild(n, visit2);
|
|
193866
194005
|
};
|
|
193867
194006
|
visit2(node);
|
|
193868
194007
|
return out;
|
|
@@ -193872,14 +194011,14 @@ function resolveConstantInitializerRefs(c, env, visited) {
|
|
|
193872
194011
|
return [];
|
|
193873
194012
|
if (c.containsArrow)
|
|
193874
194013
|
return [];
|
|
193875
|
-
const sf =
|
|
194014
|
+
const sf = import_typescript12.default.createSourceFile("__const_init.ts", `const __probe = (${c.value});`, import_typescript12.default.ScriptTarget.Latest, true);
|
|
193876
194015
|
const stmt = sf.statements[0];
|
|
193877
|
-
if (!stmt || !
|
|
194016
|
+
if (!stmt || !import_typescript12.default.isVariableStatement(stmt))
|
|
193878
194017
|
return [];
|
|
193879
194018
|
const decl = stmt.declarationList.declarations[0];
|
|
193880
194019
|
if (!decl || !decl.initializer)
|
|
193881
194020
|
return [];
|
|
193882
|
-
const expr =
|
|
194021
|
+
const expr = import_typescript12.default.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
|
|
193883
194022
|
return resolveFreeRefsInternal(expr, env, visited);
|
|
193884
194023
|
}
|
|
193885
194024
|
function resolveFreeRefsInternal(node, env, visited) {
|
|
@@ -193891,7 +194030,7 @@ function resolveFreeRefsInternal(node, env, visited) {
|
|
|
193891
194030
|
const name = ident.text;
|
|
193892
194031
|
if (env.propsObjectName === name) {
|
|
193893
194032
|
const parent = ident.parent;
|
|
193894
|
-
if (parent &&
|
|
194033
|
+
if (parent && import_typescript12.default.isPropertyAccessExpression(parent) && parent.expression === ident && parent.name.text === "children") {
|
|
193895
194034
|
continue;
|
|
193896
194035
|
}
|
|
193897
194036
|
}
|
|
@@ -194294,83 +194433,6 @@ var toLocaleDatePlugin = {
|
|
|
194294
194433
|
}
|
|
194295
194434
|
};
|
|
194296
194435
|
|
|
194297
|
-
// ../jsx/src/scope/binding-scope.ts
|
|
194298
|
-
class BindingScope {
|
|
194299
|
-
frames;
|
|
194300
|
-
static EMPTY = new BindingScope([]);
|
|
194301
|
-
constructor(frames) {
|
|
194302
|
-
this.frames = frames;
|
|
194303
|
-
}
|
|
194304
|
-
enterLoopRow(loop) {
|
|
194305
|
-
const bindings = new Map;
|
|
194306
|
-
if (loop.paramBindings && loop.paramBindings.length > 0) {
|
|
194307
|
-
for (const b of loop.paramBindings)
|
|
194308
|
-
bindings.set(b.name, { source: "destructure" });
|
|
194309
|
-
} else {
|
|
194310
|
-
bindings.set(loop.param, { source: "item" });
|
|
194311
|
-
}
|
|
194312
|
-
if (loop.index != null)
|
|
194313
|
-
bindings.set(loop.index, { source: "index" });
|
|
194314
|
-
for (const name of loop.preamble?.declaredNames ?? [])
|
|
194315
|
-
bindings.set(name, { source: "preamble" });
|
|
194316
|
-
const frame = { kind: "loop-row", bindings };
|
|
194317
|
-
return new BindingScope([frame, ...this.frames]);
|
|
194318
|
-
}
|
|
194319
|
-
enterCallback(params) {
|
|
194320
|
-
const bindings = new Map;
|
|
194321
|
-
for (const name of params)
|
|
194322
|
-
bindings.set(name, { source: "param" });
|
|
194323
|
-
const frame = { kind: "callback", bindings };
|
|
194324
|
-
return new BindingScope([frame, ...this.frames]);
|
|
194325
|
-
}
|
|
194326
|
-
isBound(name) {
|
|
194327
|
-
for (const frame of this.frames) {
|
|
194328
|
-
if (frame.bindings.has(name))
|
|
194329
|
-
return true;
|
|
194330
|
-
}
|
|
194331
|
-
return false;
|
|
194332
|
-
}
|
|
194333
|
-
lookup(name) {
|
|
194334
|
-
for (let depth = 0;depth < this.frames.length; depth++) {
|
|
194335
|
-
const frame = this.frames[depth];
|
|
194336
|
-
const binding = frame.bindings.get(name);
|
|
194337
|
-
if (binding)
|
|
194338
|
-
return { depth, frame, binding };
|
|
194339
|
-
}
|
|
194340
|
-
return null;
|
|
194341
|
-
}
|
|
194342
|
-
boundNames() {
|
|
194343
|
-
if (this.boundNamesCache)
|
|
194344
|
-
return this.boundNamesCache;
|
|
194345
|
-
const names = new Set;
|
|
194346
|
-
for (const frame of this.frames) {
|
|
194347
|
-
for (const name of frame.bindings.keys())
|
|
194348
|
-
names.add(name);
|
|
194349
|
-
}
|
|
194350
|
-
this.boundNamesCache = names;
|
|
194351
|
-
return names;
|
|
194352
|
-
}
|
|
194353
|
-
boundNamesCache;
|
|
194354
|
-
valueBoundNamesCache;
|
|
194355
|
-
valueBoundNames() {
|
|
194356
|
-
if (this.valueBoundNamesCache)
|
|
194357
|
-
return this.valueBoundNamesCache;
|
|
194358
|
-
const names = new Set;
|
|
194359
|
-
for (const frame of this.frames) {
|
|
194360
|
-
for (const [name, binding] of frame.bindings) {
|
|
194361
|
-
if (binding.source === "item" || binding.source === "index" || binding.source === "destructure") {
|
|
194362
|
-
names.add(name);
|
|
194363
|
-
}
|
|
194364
|
-
}
|
|
194365
|
-
}
|
|
194366
|
-
this.valueBoundNamesCache = names;
|
|
194367
|
-
return names;
|
|
194368
|
-
}
|
|
194369
|
-
asShadowPredicate() {
|
|
194370
|
-
return (name) => this.isBound(name);
|
|
194371
|
-
}
|
|
194372
|
-
}
|
|
194373
|
-
|
|
194374
194436
|
// ../jsx/src/jsx-to-ir.ts
|
|
194375
194437
|
var CLIENT_DIRECTIVE_INTERIOR_RE2 = /^\s*@client\s*$/;
|
|
194376
194438
|
var BLOCK_COMMENT_RE2 = /\/\*([\s\S]*?)\*\//g;
|
|
@@ -194396,13 +194458,13 @@ function exprCallsReactiveGetters(expr, ctx) {
|
|
|
194396
194458
|
function visit2(n) {
|
|
194397
194459
|
if (found)
|
|
194398
194460
|
return;
|
|
194399
|
-
if (
|
|
194461
|
+
if (import_typescript13.default.isCallExpression(n) && import_typescript13.default.isIdentifier(n.expression)) {
|
|
194400
194462
|
if (names.has(n.expression.text)) {
|
|
194401
194463
|
found = true;
|
|
194402
194464
|
return;
|
|
194403
194465
|
}
|
|
194404
194466
|
}
|
|
194405
|
-
|
|
194467
|
+
import_typescript13.default.forEachChild(n, visit2);
|
|
194406
194468
|
}
|
|
194407
194469
|
visit2(expr);
|
|
194408
194470
|
return found;
|
|
@@ -194429,11 +194491,11 @@ function exprReferencesModuleClientSignal(expr, ctx) {
|
|
|
194429
194491
|
function visit2(n) {
|
|
194430
194492
|
if (found)
|
|
194431
194493
|
return;
|
|
194432
|
-
if (
|
|
194494
|
+
if (import_typescript13.default.isCallExpression(n) && import_typescript13.default.isIdentifier(n.expression) && names.has(n.expression.text)) {
|
|
194433
194495
|
found = true;
|
|
194434
194496
|
return;
|
|
194435
194497
|
}
|
|
194436
|
-
|
|
194498
|
+
import_typescript13.default.forEachChild(n, visit2);
|
|
194437
194499
|
}
|
|
194438
194500
|
visit2(expr);
|
|
194439
194501
|
return found;
|
|
@@ -194443,11 +194505,11 @@ function exprHasFunctionCalls(expr) {
|
|
|
194443
194505
|
function visit2(n) {
|
|
194444
194506
|
if (found)
|
|
194445
194507
|
return;
|
|
194446
|
-
if (
|
|
194508
|
+
if (import_typescript13.default.isCallExpression(n)) {
|
|
194447
194509
|
found = true;
|
|
194448
194510
|
return;
|
|
194449
194511
|
}
|
|
194450
|
-
|
|
194512
|
+
import_typescript13.default.forEachChild(n, visit2);
|
|
194451
194513
|
}
|
|
194452
194514
|
visit2(expr);
|
|
194453
194515
|
return found;
|
|
@@ -194484,10 +194546,10 @@ function lowerDateCalls(text, expr, ctx) {
|
|
|
194484
194546
|
return text;
|
|
194485
194547
|
const candidates = [];
|
|
194486
194548
|
function visit2(n) {
|
|
194487
|
-
if (
|
|
194549
|
+
if (import_typescript13.default.isCallExpression(n) && n.arguments.length === 0 && import_typescript13.default.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && DATE_METHODS.has(n.expression.name.text)) {
|
|
194488
194550
|
candidates.push(n);
|
|
194489
194551
|
}
|
|
194490
|
-
|
|
194552
|
+
import_typescript13.default.forEachChild(n, visit2);
|
|
194491
194553
|
}
|
|
194492
194554
|
visit2(expr);
|
|
194493
194555
|
if (candidates.length === 0)
|
|
@@ -194512,10 +194574,10 @@ function lowerToLocaleDateCalls(text, expr, ctx) {
|
|
|
194512
194574
|
return text;
|
|
194513
194575
|
const candidates = [];
|
|
194514
194576
|
function visit2(n) {
|
|
194515
|
-
if (
|
|
194577
|
+
if (import_typescript13.default.isCallExpression(n) && n.arguments.length === 2 && import_typescript13.default.isPropertyAccessExpression(n.expression) && !n.expression.questionDotToken && n.expression.name.text === "toLocaleDateString") {
|
|
194516
194578
|
candidates.push(n);
|
|
194517
194579
|
}
|
|
194518
|
-
|
|
194580
|
+
import_typescript13.default.forEachChild(n, visit2);
|
|
194519
194581
|
}
|
|
194520
194582
|
visit2(expr);
|
|
194521
194583
|
if (candidates.length === 0)
|
|
@@ -194569,10 +194631,10 @@ function collectBranchLocalPropRefsViaSubstitution(node, ctx) {
|
|
|
194569
194631
|
return;
|
|
194570
194632
|
let acc;
|
|
194571
194633
|
function visit2(n, parent) {
|
|
194572
|
-
if (
|
|
194573
|
-
const isObjectKey = parent &&
|
|
194574
|
-
const isShorthand = parent &&
|
|
194575
|
-
const isAccessName = parent &&
|
|
194634
|
+
if (import_typescript13.default.isIdentifier(n) && propDepsMap.has(n.text)) {
|
|
194635
|
+
const isObjectKey = parent && import_typescript13.default.isPropertyAssignment(parent) && parent.name === n;
|
|
194636
|
+
const isShorthand = parent && import_typescript13.default.isShorthandPropertyAssignment(parent) && parent.name === n;
|
|
194637
|
+
const isAccessName = parent && import_typescript13.default.isPropertyAccessExpression(parent) && parent.name === n;
|
|
194576
194638
|
if (!isObjectKey && !isShorthand && !isAccessName) {
|
|
194577
194639
|
const deps = propDepsMap.get(n.text);
|
|
194578
194640
|
if (deps && deps.size > 0) {
|
|
@@ -194583,7 +194645,7 @@ function collectBranchLocalPropRefsViaSubstitution(node, ctx) {
|
|
|
194583
194645
|
}
|
|
194584
194646
|
}
|
|
194585
194647
|
}
|
|
194586
|
-
|
|
194648
|
+
import_typescript13.default.forEachChild(n, (child) => visit2(child, n));
|
|
194587
194649
|
}
|
|
194588
194650
|
visit2(node);
|
|
194589
194651
|
return acc;
|
|
@@ -194634,17 +194696,17 @@ function createTransformContext(analyzer) {
|
|
|
194634
194696
|
patterns: {
|
|
194635
194697
|
signals: analyzer.signals.map((s) => ({
|
|
194636
194698
|
getter: s.getter,
|
|
194637
|
-
pattern:
|
|
194699
|
+
pattern: identifierCallPattern(s.getter)
|
|
194638
194700
|
})),
|
|
194639
194701
|
memos: analyzer.memos.map((m) => ({
|
|
194640
194702
|
name: m.name,
|
|
194641
|
-
pattern:
|
|
194703
|
+
pattern: identifierCallPattern(m.name)
|
|
194642
194704
|
})),
|
|
194643
|
-
props: analyzer.propsParams.filter((p) => p.name !== "children").map((p) => ({ name: p.name, pattern:
|
|
194705
|
+
props: analyzer.propsParams.filter((p) => p.name !== "children").map((p) => ({ name: p.name, pattern: identifierPattern(p.name) })),
|
|
194644
194706
|
constants: analyzer.localConstants.map((c) => ({
|
|
194645
194707
|
name: c.name,
|
|
194646
194708
|
value: c.value,
|
|
194647
|
-
pattern:
|
|
194709
|
+
pattern: identifierPattern(c.name)
|
|
194648
194710
|
}))
|
|
194649
194711
|
},
|
|
194650
194712
|
getJS(node) {
|
|
@@ -194659,21 +194721,21 @@ function createTransformContext(analyzer) {
|
|
|
194659
194721
|
function buildComponentNamespaces(ctx) {
|
|
194660
194722
|
const result = new Map;
|
|
194661
194723
|
for (const stmt of ctx.sourceFile.statements) {
|
|
194662
|
-
if (!
|
|
194724
|
+
if (!import_typescript13.default.isVariableStatement(stmt))
|
|
194663
194725
|
continue;
|
|
194664
194726
|
for (const decl of stmt.declarationList.declarations) {
|
|
194665
|
-
if (!decl.initializer || !
|
|
194727
|
+
if (!decl.initializer || !import_typescript13.default.isIdentifier(decl.name))
|
|
194666
194728
|
continue;
|
|
194667
194729
|
let init = decl.initializer;
|
|
194668
|
-
while (
|
|
194730
|
+
while (import_typescript13.default.isParenthesizedExpression(init))
|
|
194669
194731
|
init = init.expression;
|
|
194670
|
-
if (!
|
|
194732
|
+
if (!import_typescript13.default.isObjectLiteralExpression(init))
|
|
194671
194733
|
continue;
|
|
194672
194734
|
const members = new Map;
|
|
194673
194735
|
for (const prop of init.properties) {
|
|
194674
|
-
if (
|
|
194736
|
+
if (import_typescript13.default.isShorthandPropertyAssignment(prop)) {
|
|
194675
194737
|
members.set(prop.name.text, prop.name.text);
|
|
194676
|
-
} else if (
|
|
194738
|
+
} else if (import_typescript13.default.isPropertyAssignment(prop) && (import_typescript13.default.isIdentifier(prop.name) || import_typescript13.default.isStringLiteral(prop.name)) && import_typescript13.default.isIdentifier(prop.initializer)) {
|
|
194677
194739
|
members.set(prop.name.text, prop.initializer.text);
|
|
194678
194740
|
}
|
|
194679
194741
|
}
|
|
@@ -194685,11 +194747,11 @@ function buildComponentNamespaces(ctx) {
|
|
|
194685
194747
|
return result;
|
|
194686
194748
|
}
|
|
194687
194749
|
function resolveMemberExpressionTag(tagNode, ctx) {
|
|
194688
|
-
if (!
|
|
194750
|
+
if (!import_typescript13.default.isPropertyAccessExpression(tagNode))
|
|
194689
194751
|
return null;
|
|
194690
|
-
if (!
|
|
194752
|
+
if (!import_typescript13.default.isIdentifier(tagNode.expression))
|
|
194691
194753
|
return null;
|
|
194692
|
-
if (!
|
|
194754
|
+
if (!import_typescript13.default.isIdentifier(tagNode.name))
|
|
194693
194755
|
return null;
|
|
194694
194756
|
if (!ctx._componentNamespaces) {
|
|
194695
194757
|
ctx._componentNamespaces = buildComponentNamespaces(ctx);
|
|
@@ -194722,7 +194784,7 @@ function makeBindingEnv(ctx) {
|
|
|
194722
194784
|
localFunctions: a.localFunctions,
|
|
194723
194785
|
imports: a.imports,
|
|
194724
194786
|
ambientGlobals: a.ambientGlobals,
|
|
194725
|
-
|
|
194787
|
+
loopValueBoundNames: boundNames,
|
|
194726
194788
|
checker: a.checker
|
|
194727
194789
|
};
|
|
194728
194790
|
ctx._bindingEnv = env;
|
|
@@ -194846,7 +194908,7 @@ function buildIRRoot(analyzer) {
|
|
|
194846
194908
|
return null;
|
|
194847
194909
|
const ctx = createTransformContext(analyzer);
|
|
194848
194910
|
const jsxReturn = analyzer.jsxReturn;
|
|
194849
|
-
if (
|
|
194911
|
+
if (import_typescript13.default.isJsxElement(jsxReturn) || import_typescript13.default.isJsxSelfClosingElement(jsxReturn) || import_typescript13.default.isJsxFragment(jsxReturn)) {
|
|
194850
194912
|
const ir2 = transformNode(jsxReturn, ctx);
|
|
194851
194913
|
if (ir2 && needsScopeWrapper(ir2)) {
|
|
194852
194914
|
return wrapInScopeElement(ir2);
|
|
@@ -194902,22 +194964,22 @@ function wrapInScopeElement(node) {
|
|
|
194902
194964
|
};
|
|
194903
194965
|
}
|
|
194904
194966
|
function transformNode(node, ctx) {
|
|
194905
|
-
if (
|
|
194967
|
+
if (import_typescript13.default.isJsxElement(node)) {
|
|
194906
194968
|
return transformJsxElement(node, ctx);
|
|
194907
194969
|
}
|
|
194908
|
-
if (
|
|
194970
|
+
if (import_typescript13.default.isJsxSelfClosingElement(node)) {
|
|
194909
194971
|
return transformSelfClosingElement(node, ctx);
|
|
194910
194972
|
}
|
|
194911
|
-
if (
|
|
194973
|
+
if (import_typescript13.default.isJsxFragment(node)) {
|
|
194912
194974
|
return transformFragment(node, ctx);
|
|
194913
194975
|
}
|
|
194914
|
-
if (
|
|
194976
|
+
if (import_typescript13.default.isJsxText(node)) {
|
|
194915
194977
|
return transformText(node, ctx);
|
|
194916
194978
|
}
|
|
194917
|
-
if (
|
|
194979
|
+
if (import_typescript13.default.isJsxExpression(node)) {
|
|
194918
194980
|
return transformExpression(node, ctx);
|
|
194919
194981
|
}
|
|
194920
|
-
if (
|
|
194982
|
+
if (import_typescript13.default.isConditionalExpression(node)) {
|
|
194921
194983
|
return transformConditional(node, ctx);
|
|
194922
194984
|
}
|
|
194923
194985
|
return null;
|
|
@@ -195274,7 +195336,7 @@ function transformSelfClosingComponent(node, ctx, name) {
|
|
|
195274
195336
|
}
|
|
195275
195337
|
function isTransparentFragment(node, ctx) {
|
|
195276
195338
|
const children = node.children.filter((child2) => {
|
|
195277
|
-
if (
|
|
195339
|
+
if (import_typescript13.default.isJsxText(child2)) {
|
|
195278
195340
|
return child2.text.trim() !== "";
|
|
195279
195341
|
}
|
|
195280
195342
|
return true;
|
|
@@ -195282,7 +195344,7 @@ function isTransparentFragment(node, ctx) {
|
|
|
195282
195344
|
if (children.length !== 1)
|
|
195283
195345
|
return false;
|
|
195284
195346
|
const child = children[0];
|
|
195285
|
-
if (!
|
|
195347
|
+
if (!import_typescript13.default.isJsxExpression(child))
|
|
195286
195348
|
return false;
|
|
195287
195349
|
if (!child.expression)
|
|
195288
195350
|
return false;
|
|
@@ -195326,7 +195388,7 @@ function transformChildren(children, ctx) {
|
|
|
195326
195388
|
const result = [];
|
|
195327
195389
|
for (let i2 = 0;i2 < children.length; i2++) {
|
|
195328
195390
|
const child = children[i2];
|
|
195329
|
-
if (
|
|
195391
|
+
if (import_typescript13.default.isJsxExpression(child) && !child.expression) {
|
|
195330
195392
|
continue;
|
|
195331
195393
|
}
|
|
195332
195394
|
const transformed = transformNode(child, ctx);
|
|
@@ -195341,10 +195403,10 @@ function transformChildren(children, ctx) {
|
|
|
195341
195403
|
}
|
|
195342
195404
|
function isRenderNothingLiteral(expr, ctx) {
|
|
195343
195405
|
let e = expr;
|
|
195344
|
-
while (
|
|
195406
|
+
while (import_typescript13.default.isParenthesizedExpression(e) || import_typescript13.default.isAsExpression(e) || import_typescript13.default.isSatisfiesExpression(e) || import_typescript13.default.isNonNullExpression(e)) {
|
|
195345
195407
|
e = e.expression;
|
|
195346
195408
|
}
|
|
195347
|
-
return e.kind ===
|
|
195409
|
+
return e.kind === import_typescript13.default.SyntaxKind.NullKeyword || e.kind === import_typescript13.default.SyntaxKind.TrueKeyword || e.kind === import_typescript13.default.SyntaxKind.FalseKeyword || import_typescript13.default.isIdentifier(e) && e.text === "undefined" && !isNameBound("undefined", makeBindingEnv(ctx));
|
|
195348
195410
|
}
|
|
195349
195411
|
function transformText(node, ctx) {
|
|
195350
195412
|
const text = node.text.replace(/\s+/g, " ");
|
|
@@ -195370,7 +195432,7 @@ function transformExpressionInner(expr, ctx, node, isClientOnly) {
|
|
|
195370
195432
|
return null;
|
|
195371
195433
|
}
|
|
195372
195434
|
checkBareSignalOrMemoIdentifier(expr, ctx);
|
|
195373
|
-
if (
|
|
195435
|
+
if (import_typescript13.default.isIdentifier(expr)) {
|
|
195374
195436
|
const jsxNode = ctx.analyzer.jsxConstants.get(expr.text);
|
|
195375
195437
|
if (jsxNode) {
|
|
195376
195438
|
return transformNode(jsxNode, ctx);
|
|
@@ -195416,7 +195478,7 @@ function transformExpressionInner(expr, ctx, node, isClientOnly) {
|
|
|
195416
195478
|
};
|
|
195417
195479
|
const reactive = isReactiveExpression(exprText, ctx, expr) || isReactiveOrigin(origin);
|
|
195418
195480
|
const scopeValueNames = ctx.scope.valueBoundNames();
|
|
195419
|
-
const refsLoopParam = scopeValueNames.size > 0 && Array.from(scopeValueNames).some((p) =>
|
|
195481
|
+
const refsLoopParam = scopeValueNames.size > 0 && Array.from(scopeValueNames).some((p) => identifierPattern(p).test(exprText));
|
|
195420
195482
|
const callsReactive = exprCallsReactiveGetters(expr, ctx);
|
|
195421
195483
|
const hasCalls = exprHasFunctionCalls(expr);
|
|
195422
195484
|
const needsSlot = reactive || isClientOnly || refsLoopParam || callsReactive || hasCalls;
|
|
@@ -195451,7 +195513,7 @@ function transformJsxFunctionCall(callExpr, jsxFunc, ctx, _isClientOnly) {
|
|
|
195451
195513
|
const substitutedGetJS = (node) => {
|
|
195452
195514
|
let text = baseGetJS(node);
|
|
195453
195515
|
for (const [paramName, argExpr] of substitutions) {
|
|
195454
|
-
text = text.replace(
|
|
195516
|
+
text = text.replace(identifierPattern(paramName, "g"), () => argExpr);
|
|
195455
195517
|
}
|
|
195456
195518
|
return text;
|
|
195457
195519
|
};
|
|
@@ -195493,7 +195555,7 @@ function transformMultiReturnJsxFunctionCall(callExpr, info, ctx) {
|
|
|
195493
195555
|
const substitutedGetJS = (node) => {
|
|
195494
195556
|
let text = baseGetJS(node);
|
|
195495
195557
|
for (const [paramName, argExpr] of substitutions) {
|
|
195496
|
-
text = text.replace(
|
|
195558
|
+
text = text.replace(identifierPattern(paramName, "g"), () => argExpr);
|
|
195497
195559
|
}
|
|
195498
195560
|
return text;
|
|
195499
195561
|
};
|
|
@@ -195649,38 +195711,38 @@ function transformLogicalAnd(node, ctx) {
|
|
|
195649
195711
|
};
|
|
195650
195712
|
}
|
|
195651
195713
|
function containsJsxInExpression(node) {
|
|
195652
|
-
if (
|
|
195714
|
+
if (import_typescript13.default.isJsxElement(node) || import_typescript13.default.isJsxSelfClosingElement(node) || import_typescript13.default.isJsxFragment(node)) {
|
|
195653
195715
|
return true;
|
|
195654
195716
|
}
|
|
195655
|
-
return
|
|
195717
|
+
return import_typescript13.default.forEachChild(node, containsJsxInExpression) ?? false;
|
|
195656
195718
|
}
|
|
195657
195719
|
function callsJsxHelper(node, ctx) {
|
|
195658
195720
|
let found = false;
|
|
195659
195721
|
const visit2 = (n) => {
|
|
195660
195722
|
if (found)
|
|
195661
195723
|
return;
|
|
195662
|
-
if (
|
|
195724
|
+
if (import_typescript13.default.isCallExpression(n) && import_typescript13.default.isIdentifier(n.expression)) {
|
|
195663
195725
|
const name = n.expression.text;
|
|
195664
195726
|
if (ctx.analyzer.jsxFunctions.has(name) || ctx.analyzer.jsxMultiReturnFunctions.has(name)) {
|
|
195665
195727
|
found = true;
|
|
195666
195728
|
return;
|
|
195667
195729
|
}
|
|
195668
195730
|
}
|
|
195669
|
-
|
|
195731
|
+
import_typescript13.default.forEachChild(n, visit2);
|
|
195670
195732
|
};
|
|
195671
195733
|
visit2(node);
|
|
195672
195734
|
return found;
|
|
195673
195735
|
}
|
|
195674
195736
|
function containsAwaitExpression(node) {
|
|
195675
|
-
if (
|
|
195737
|
+
if (import_typescript13.default.isAwaitExpression(node))
|
|
195676
195738
|
return true;
|
|
195677
|
-
if (
|
|
195739
|
+
if (import_typescript13.default.isFunctionDeclaration(node) || import_typescript13.default.isFunctionExpression(node) || import_typescript13.default.isArrowFunction(node))
|
|
195678
195740
|
return false;
|
|
195679
|
-
return
|
|
195741
|
+
return import_typescript13.default.forEachChild(node, containsAwaitExpression) ?? false;
|
|
195680
195742
|
}
|
|
195681
195743
|
function transformNullishCoalescing(node, ctx) {
|
|
195682
195744
|
const leftText = ctx.getJS(node.left);
|
|
195683
|
-
const isNullish = node.operatorToken.kind ===
|
|
195745
|
+
const isNullish = node.operatorToken.kind === import_typescript13.default.SyntaxKind.QuestionQuestionToken;
|
|
195684
195746
|
const condition = isNullish ? `${leftText} != null` : leftText;
|
|
195685
195747
|
const leftOrigin = {
|
|
195686
195748
|
phase: "tick",
|
|
@@ -195726,36 +195788,36 @@ function transformNullishCoalescing(node, ctx) {
|
|
|
195726
195788
|
}
|
|
195727
195789
|
function assertNever2(expr) {
|
|
195728
195790
|
const kind = expr?.kind;
|
|
195729
|
-
throw new Error(`transformJsxExpression: unhandled ts.SyntaxKind ${kind !== undefined ?
|
|
195791
|
+
throw new Error(`transformJsxExpression: unhandled ts.SyntaxKind ${kind !== undefined ? import_typescript13.default.SyntaxKind[kind] : "unknown"} ` + `(kind=${kind}). Update spec/compiler.md Appendix A and the switch in jsx-to-ir.ts.`);
|
|
195730
195792
|
}
|
|
195731
195793
|
function transformJsxExpression(expr, ctx, isClientOnly = false) {
|
|
195732
195794
|
const node = expr;
|
|
195733
195795
|
switch (node.kind) {
|
|
195734
|
-
case
|
|
195735
|
-
case
|
|
195736
|
-
case
|
|
195737
|
-
case
|
|
195738
|
-
case
|
|
195739
|
-
case
|
|
195796
|
+
case import_typescript13.default.SyntaxKind.ParenthesizedExpression:
|
|
195797
|
+
case import_typescript13.default.SyntaxKind.AsExpression:
|
|
195798
|
+
case import_typescript13.default.SyntaxKind.SatisfiesExpression:
|
|
195799
|
+
case import_typescript13.default.SyntaxKind.NonNullExpression:
|
|
195800
|
+
case import_typescript13.default.SyntaxKind.TypeAssertionExpression:
|
|
195801
|
+
case import_typescript13.default.SyntaxKind.PartiallyEmittedExpression:
|
|
195740
195802
|
return transformJsxExpression(node.expression, ctx, isClientOnly);
|
|
195741
|
-
case
|
|
195803
|
+
case import_typescript13.default.SyntaxKind.JsxElement:
|
|
195742
195804
|
return transformJsxElement(node, ctx);
|
|
195743
|
-
case
|
|
195805
|
+
case import_typescript13.default.SyntaxKind.JsxFragment:
|
|
195744
195806
|
return transformFragment(node, ctx);
|
|
195745
|
-
case
|
|
195807
|
+
case import_typescript13.default.SyntaxKind.JsxSelfClosingElement:
|
|
195746
195808
|
return transformSelfClosingElement(node, ctx);
|
|
195747
|
-
case
|
|
195809
|
+
case import_typescript13.default.SyntaxKind.ConditionalExpression:
|
|
195748
195810
|
return transformConditional(node, ctx);
|
|
195749
|
-
case
|
|
195750
|
-
if (node.operatorToken.kind ===
|
|
195811
|
+
case import_typescript13.default.SyntaxKind.BinaryExpression: {
|
|
195812
|
+
if (node.operatorToken.kind === import_typescript13.default.SyntaxKind.AmpersandAmpersandToken) {
|
|
195751
195813
|
return transformLogicalAnd(node, ctx);
|
|
195752
195814
|
}
|
|
195753
|
-
if ((node.operatorToken.kind ===
|
|
195815
|
+
if ((node.operatorToken.kind === import_typescript13.default.SyntaxKind.QuestionQuestionToken || node.operatorToken.kind === import_typescript13.default.SyntaxKind.BarBarToken) && (containsJsxInExpression(node.right) || callsJsxHelper(node.right, ctx))) {
|
|
195754
195816
|
return transformNullishCoalescing(node, ctx);
|
|
195755
195817
|
}
|
|
195756
195818
|
return null;
|
|
195757
195819
|
}
|
|
195758
|
-
case
|
|
195820
|
+
case import_typescript13.default.SyntaxKind.CallExpression: {
|
|
195759
195821
|
const mapMethod = getMapLikeMethod(node);
|
|
195760
195822
|
if (mapMethod) {
|
|
195761
195823
|
const mapResult = transformMapCall(node, ctx, isClientOnly, mapMethod);
|
|
@@ -195763,7 +195825,7 @@ function transformJsxExpression(expr, ctx, isClientOnly = false) {
|
|
|
195763
195825
|
return mapResult;
|
|
195764
195826
|
}
|
|
195765
195827
|
const callee = node.expression;
|
|
195766
|
-
if (
|
|
195828
|
+
if (import_typescript13.default.isIdentifier(callee)) {
|
|
195767
195829
|
const jsxFunc = ctx.analyzer.jsxFunctions.get(callee.text);
|
|
195768
195830
|
if (jsxFunc) {
|
|
195769
195831
|
return transformJsxFunctionCall(node, jsxFunc, ctx, isClientOnly);
|
|
@@ -195775,39 +195837,39 @@ function transformJsxExpression(expr, ctx, isClientOnly = false) {
|
|
|
195775
195837
|
}
|
|
195776
195838
|
return null;
|
|
195777
195839
|
}
|
|
195778
|
-
case
|
|
195779
|
-
case
|
|
195780
|
-
case
|
|
195781
|
-
case
|
|
195782
|
-
case
|
|
195783
|
-
case
|
|
195784
|
-
case
|
|
195785
|
-
case
|
|
195786
|
-
case
|
|
195787
|
-
case
|
|
195788
|
-
case
|
|
195789
|
-
case
|
|
195790
|
-
case
|
|
195791
|
-
case
|
|
195792
|
-
case
|
|
195793
|
-
case
|
|
195794
|
-
case
|
|
195795
|
-
case
|
|
195796
|
-
case
|
|
195797
|
-
case
|
|
195798
|
-
case
|
|
195799
|
-
case
|
|
195800
|
-
case
|
|
195801
|
-
case
|
|
195802
|
-
case
|
|
195803
|
-
case
|
|
195804
|
-
case
|
|
195805
|
-
case
|
|
195806
|
-
case
|
|
195807
|
-
case
|
|
195808
|
-
case
|
|
195840
|
+
case import_typescript13.default.SyntaxKind.Identifier:
|
|
195841
|
+
case import_typescript13.default.SyntaxKind.StringLiteral:
|
|
195842
|
+
case import_typescript13.default.SyntaxKind.NumericLiteral:
|
|
195843
|
+
case import_typescript13.default.SyntaxKind.BigIntLiteral:
|
|
195844
|
+
case import_typescript13.default.SyntaxKind.RegularExpressionLiteral:
|
|
195845
|
+
case import_typescript13.default.SyntaxKind.NoSubstitutionTemplateLiteral:
|
|
195846
|
+
case import_typescript13.default.SyntaxKind.TemplateExpression:
|
|
195847
|
+
case import_typescript13.default.SyntaxKind.TaggedTemplateExpression:
|
|
195848
|
+
case import_typescript13.default.SyntaxKind.TrueKeyword:
|
|
195849
|
+
case import_typescript13.default.SyntaxKind.FalseKeyword:
|
|
195850
|
+
case import_typescript13.default.SyntaxKind.NullKeyword:
|
|
195851
|
+
case import_typescript13.default.SyntaxKind.ThisKeyword:
|
|
195852
|
+
case import_typescript13.default.SyntaxKind.SuperKeyword:
|
|
195853
|
+
case import_typescript13.default.SyntaxKind.ImportKeyword:
|
|
195854
|
+
case import_typescript13.default.SyntaxKind.PropertyAccessExpression:
|
|
195855
|
+
case import_typescript13.default.SyntaxKind.ElementAccessExpression:
|
|
195856
|
+
case import_typescript13.default.SyntaxKind.PrefixUnaryExpression:
|
|
195857
|
+
case import_typescript13.default.SyntaxKind.PostfixUnaryExpression:
|
|
195858
|
+
case import_typescript13.default.SyntaxKind.TypeOfExpression:
|
|
195859
|
+
case import_typescript13.default.SyntaxKind.VoidExpression:
|
|
195860
|
+
case import_typescript13.default.SyntaxKind.DeleteExpression:
|
|
195861
|
+
case import_typescript13.default.SyntaxKind.NewExpression:
|
|
195862
|
+
case import_typescript13.default.SyntaxKind.ObjectLiteralExpression:
|
|
195863
|
+
case import_typescript13.default.SyntaxKind.ArrowFunction:
|
|
195864
|
+
case import_typescript13.default.SyntaxKind.FunctionExpression:
|
|
195865
|
+
case import_typescript13.default.SyntaxKind.ClassExpression:
|
|
195866
|
+
case import_typescript13.default.SyntaxKind.MetaProperty:
|
|
195867
|
+
case import_typescript13.default.SyntaxKind.ExpressionWithTypeArguments:
|
|
195868
|
+
case import_typescript13.default.SyntaxKind.CommaListExpression:
|
|
195869
|
+
case import_typescript13.default.SyntaxKind.SyntheticExpression:
|
|
195870
|
+
case import_typescript13.default.SyntaxKind.ArrayLiteralExpression:
|
|
195809
195871
|
return null;
|
|
195810
|
-
case
|
|
195872
|
+
case import_typescript13.default.SyntaxKind.AwaitExpression:
|
|
195811
195873
|
ctx.analyzer.errors.push(createError(ErrorCodes.STAGE_AWAIT_IN_TEMPLATE, getSourceLocation(node, ctx.sourceFile, ctx.filePath)));
|
|
195812
195874
|
return {
|
|
195813
195875
|
type: "expression",
|
|
@@ -195818,16 +195880,16 @@ function transformJsxExpression(expr, ctx, isClientOnly = false) {
|
|
|
195818
195880
|
loc: getSourceLocation(node, ctx.sourceFile, ctx.filePath),
|
|
195819
195881
|
origin: { phase: "tick", scope: "template", effect: "pure", freeRefs: [] }
|
|
195820
195882
|
};
|
|
195821
|
-
case
|
|
195883
|
+
case import_typescript13.default.SyntaxKind.YieldExpression:
|
|
195822
195884
|
return null;
|
|
195823
|
-
case
|
|
195824
|
-
case
|
|
195825
|
-
case
|
|
195826
|
-
case
|
|
195827
|
-
case
|
|
195828
|
-
case
|
|
195829
|
-
case
|
|
195830
|
-
case
|
|
195885
|
+
case import_typescript13.default.SyntaxKind.SpreadElement:
|
|
195886
|
+
case import_typescript13.default.SyntaxKind.OmittedExpression:
|
|
195887
|
+
case import_typescript13.default.SyntaxKind.JsxExpression:
|
|
195888
|
+
case import_typescript13.default.SyntaxKind.JsxOpeningElement:
|
|
195889
|
+
case import_typescript13.default.SyntaxKind.JsxOpeningFragment:
|
|
195890
|
+
case import_typescript13.default.SyntaxKind.JsxClosingFragment:
|
|
195891
|
+
case import_typescript13.default.SyntaxKind.JsxAttributes:
|
|
195892
|
+
case import_typescript13.default.SyntaxKind.MissingDeclaration:
|
|
195831
195893
|
return null;
|
|
195832
195894
|
default:
|
|
195833
195895
|
return assertNever2(node);
|
|
@@ -195864,7 +195926,7 @@ function transformConditionalBranch(node, ctx) {
|
|
|
195864
195926
|
};
|
|
195865
195927
|
}
|
|
195866
195928
|
function getMapLikeMethod(node) {
|
|
195867
|
-
if (!
|
|
195929
|
+
if (!import_typescript13.default.isPropertyAccessExpression(node.expression))
|
|
195868
195930
|
return null;
|
|
195869
195931
|
const name = node.expression.name.text;
|
|
195870
195932
|
if (name === "map")
|
|
@@ -195874,9 +195936,9 @@ function getMapLikeMethod(node) {
|
|
|
195874
195936
|
return null;
|
|
195875
195937
|
}
|
|
195876
195938
|
function isFilterCall(node) {
|
|
195877
|
-
if (!
|
|
195939
|
+
if (!import_typescript13.default.isCallExpression(node))
|
|
195878
195940
|
return null;
|
|
195879
|
-
if (!
|
|
195941
|
+
if (!import_typescript13.default.isPropertyAccessExpression(node.expression))
|
|
195880
195942
|
return null;
|
|
195881
195943
|
if (node.expression.name.text !== "filter")
|
|
195882
195944
|
return null;
|
|
@@ -195888,9 +195950,9 @@ function isFilterCall(node) {
|
|
|
195888
195950
|
};
|
|
195889
195951
|
}
|
|
195890
195952
|
function isSortCall(node) {
|
|
195891
|
-
if (!
|
|
195953
|
+
if (!import_typescript13.default.isCallExpression(node))
|
|
195892
195954
|
return null;
|
|
195893
|
-
if (!
|
|
195955
|
+
if (!import_typescript13.default.isPropertyAccessExpression(node.expression))
|
|
195894
195956
|
return null;
|
|
195895
195957
|
const methodName = node.expression.name.text;
|
|
195896
195958
|
if (methodName !== "sort" && methodName !== "toSorted")
|
|
@@ -195904,9 +195966,9 @@ function isSortCall(node) {
|
|
|
195904
195966
|
};
|
|
195905
195967
|
}
|
|
195906
195968
|
function isIteratorShapeCall(node) {
|
|
195907
|
-
if (!
|
|
195969
|
+
if (!import_typescript13.default.isCallExpression(node))
|
|
195908
195970
|
return null;
|
|
195909
|
-
if (!
|
|
195971
|
+
if (!import_typescript13.default.isPropertyAccessExpression(node.expression))
|
|
195910
195972
|
return null;
|
|
195911
195973
|
if (node.arguments.length !== 0)
|
|
195912
195974
|
return null;
|
|
@@ -195916,11 +195978,11 @@ function isIteratorShapeCall(node) {
|
|
|
195916
195978
|
return { array: node.expression.expression, shape: name };
|
|
195917
195979
|
}
|
|
195918
195980
|
function isObjectIteratorCall(node) {
|
|
195919
|
-
if (!
|
|
195981
|
+
if (!import_typescript13.default.isCallExpression(node))
|
|
195920
195982
|
return null;
|
|
195921
|
-
if (!
|
|
195983
|
+
if (!import_typescript13.default.isPropertyAccessExpression(node.expression))
|
|
195922
195984
|
return null;
|
|
195923
|
-
if (!
|
|
195985
|
+
if (!import_typescript13.default.isIdentifier(node.expression.expression))
|
|
195924
195986
|
return null;
|
|
195925
195987
|
if (node.expression.expression.text !== "Object")
|
|
195926
195988
|
return null;
|
|
@@ -195945,7 +196007,7 @@ function extractSortComparator(callback, _method, ctx) {
|
|
|
195945
196007
|
` + `(reverse the operands for descending order).`
|
|
195946
196008
|
});
|
|
195947
196009
|
let resolvedNode = callback;
|
|
195948
|
-
if (
|
|
196010
|
+
if (import_typescript13.default.isIdentifier(callback)) {
|
|
195949
196011
|
const resolved = resolveSortComparatorIdentifier(callback.text, ctx);
|
|
195950
196012
|
if (!resolved) {
|
|
195951
196013
|
return {
|
|
@@ -195955,7 +196017,7 @@ function extractSortComparator(callback, _method, ctx) {
|
|
|
195955
196017
|
}
|
|
195956
196018
|
resolvedNode = resolved;
|
|
195957
196019
|
}
|
|
195958
|
-
if (!
|
|
196020
|
+
if (!import_typescript13.default.isArrowFunction(resolvedNode) && !import_typescript13.default.isFunctionExpression(resolvedNode)) {
|
|
195959
196021
|
return {
|
|
195960
196022
|
result: null,
|
|
195961
196023
|
unsupportedReason: "Sort comparator must be an arrow function or function expression"
|
|
@@ -195982,11 +196044,11 @@ function resolveSortComparatorIdentifier(name, ctx) {
|
|
|
195982
196044
|
return null;
|
|
195983
196045
|
if (constInfo) {
|
|
195984
196046
|
const ast = parseConstInitializer(constInfo);
|
|
195985
|
-
return ast && (
|
|
196047
|
+
return ast && (import_typescript13.default.isArrowFunction(ast) || import_typescript13.default.isFunctionExpression(ast)) ? ast : null;
|
|
195986
196048
|
}
|
|
195987
196049
|
if (fnInfo) {
|
|
195988
196050
|
const ast = parseFunctionInfoAsExpr(fnInfo);
|
|
195989
|
-
return ast && (
|
|
196051
|
+
return ast && (import_typescript13.default.isArrowFunction(ast) || import_typescript13.default.isFunctionExpression(ast)) ? ast : null;
|
|
195990
196052
|
}
|
|
195991
196053
|
return null;
|
|
195992
196054
|
}
|
|
@@ -195997,11 +196059,11 @@ function resolveCallbackMethodFunctionReferenceIdentifier(name, analyzer) {
|
|
|
195997
196059
|
return null;
|
|
195998
196060
|
if (constInfo) {
|
|
195999
196061
|
const ast = parseConstInitializer(constInfo);
|
|
196000
|
-
return ast && (
|
|
196062
|
+
return ast && (import_typescript13.default.isArrowFunction(ast) || import_typescript13.default.isFunctionExpression(ast)) ? ast : null;
|
|
196001
196063
|
}
|
|
196002
196064
|
if (fnInfo) {
|
|
196003
196065
|
const ast = parseFunctionInfoAsExpr(fnInfo);
|
|
196004
|
-
return ast && (
|
|
196066
|
+
return ast && (import_typescript13.default.isArrowFunction(ast) || import_typescript13.default.isFunctionExpression(ast)) ? ast : null;
|
|
196005
196067
|
}
|
|
196006
196068
|
return null;
|
|
196007
196069
|
}
|
|
@@ -196057,13 +196119,13 @@ function resolveCallbackMethodFunctionReferences(expr, analyzer, bound = EMPTY_B
|
|
|
196057
196119
|
return visit2(expr, bound);
|
|
196058
196120
|
}
|
|
196059
196121
|
function extractFilterPredicate(callback, ctx) {
|
|
196060
|
-
if (!
|
|
196122
|
+
if (!import_typescript13.default.isArrowFunction(callback))
|
|
196061
196123
|
return { result: null };
|
|
196062
196124
|
if (callback.parameters.length < 1)
|
|
196063
196125
|
return { result: null };
|
|
196064
196126
|
const firstParam = callback.parameters[0];
|
|
196065
|
-
if (!
|
|
196066
|
-
if (
|
|
196127
|
+
if (!import_typescript13.default.isIdentifier(firstParam.name)) {
|
|
196128
|
+
if (import_typescript13.default.isBlock(callback.body)) {
|
|
196067
196129
|
return {
|
|
196068
196130
|
result: null,
|
|
196069
196131
|
unsupportedReason: "Block body in a destructured filter param is not supported. Workaround: use an expression-body arrow, or add /* @client */."
|
|
@@ -196083,7 +196145,7 @@ function extractFilterPredicate(callback, ctx) {
|
|
|
196083
196145
|
return { result: null };
|
|
196084
196146
|
}
|
|
196085
196147
|
const param = firstParam.name.getText(ctx.sourceFile);
|
|
196086
|
-
if (
|
|
196148
|
+
if (import_typescript13.default.isBlock(callback.body)) {
|
|
196087
196149
|
const raw2 = ctx.getJS(callback.body);
|
|
196088
196150
|
const statements = parseBlockBody(callback.body, ctx.sourceFile, (n) => ctx.getJS(n));
|
|
196089
196151
|
if (!statements) {
|
|
@@ -196109,7 +196171,7 @@ function extractFilterPredicate(callback, ctx) {
|
|
|
196109
196171
|
return { result: { param, predicate, raw } };
|
|
196110
196172
|
}
|
|
196111
196173
|
function extractLoopParamBindings(pattern) {
|
|
196112
|
-
if (
|
|
196174
|
+
if (import_typescript13.default.isIdentifier(pattern))
|
|
196113
196175
|
return null;
|
|
196114
196176
|
const bindings = [];
|
|
196115
196177
|
let unsupported = false;
|
|
@@ -196118,7 +196180,7 @@ function extractLoopParamBindings(pattern) {
|
|
|
196118
196180
|
return false;
|
|
196119
196181
|
for (let i2 = 0;i2 < key.length; ) {
|
|
196120
196182
|
const cp = key.codePointAt(i2);
|
|
196121
|
-
const ok = i2 === 0 ?
|
|
196183
|
+
const ok = i2 === 0 ? import_typescript13.default.isIdentifierStart(cp, import_typescript13.default.ScriptTarget.Latest) : import_typescript13.default.isIdentifierPart(cp, import_typescript13.default.ScriptTarget.Latest);
|
|
196122
196184
|
if (!ok)
|
|
196123
196185
|
return false;
|
|
196124
196186
|
i2 += cp > 65535 ? 2 : 1;
|
|
@@ -196131,17 +196193,17 @@ function extractLoopParamBindings(pattern) {
|
|
|
196131
196193
|
const walk = (p, prefix, segments) => {
|
|
196132
196194
|
if (unsupported)
|
|
196133
196195
|
return;
|
|
196134
|
-
if (
|
|
196196
|
+
if (import_typescript13.default.isArrayBindingPattern(p)) {
|
|
196135
196197
|
const elements2 = p.elements;
|
|
196136
196198
|
for (let index = 0;index < elements2.length; index++) {
|
|
196137
196199
|
if (unsupported)
|
|
196138
196200
|
return;
|
|
196139
196201
|
const el = elements2[index];
|
|
196140
|
-
if (
|
|
196202
|
+
if (import_typescript13.default.isOmittedExpression(el))
|
|
196141
196203
|
continue;
|
|
196142
196204
|
if (el.dotDotDotToken) {
|
|
196143
196205
|
internalInvariant(index === elements2.length - 1, "extractLoopParamBindings: array rest token in non-final position (parser should reject)");
|
|
196144
|
-
internalInvariant(
|
|
196206
|
+
internalInvariant(import_typescript13.default.isIdentifier(el.name), "extractLoopParamBindings: array rest target is not an identifier (parser should reject)");
|
|
196145
196207
|
bindings.push({
|
|
196146
196208
|
name: el.name.text,
|
|
196147
196209
|
path: prefix,
|
|
@@ -196152,7 +196214,7 @@ function extractLoopParamBindings(pattern) {
|
|
|
196152
196214
|
}
|
|
196153
196215
|
const path = `${prefix}[${index}]`;
|
|
196154
196216
|
const nextSegments = [...segments, { kind: "index", index }];
|
|
196155
|
-
if (
|
|
196217
|
+
if (import_typescript13.default.isIdentifier(el.name)) {
|
|
196156
196218
|
bindings.push({ name: el.name.text, path, segments: nextSegments });
|
|
196157
196219
|
} else {
|
|
196158
196220
|
walk(el.name, path, nextSegments);
|
|
@@ -196168,7 +196230,7 @@ function extractLoopParamBindings(pattern) {
|
|
|
196168
196230
|
const el = elements[i2];
|
|
196169
196231
|
if (el.dotDotDotToken) {
|
|
196170
196232
|
internalInvariant(i2 === elements.length - 1, "extractLoopParamBindings: object rest token in non-final position (parser should reject)");
|
|
196171
|
-
internalInvariant(
|
|
196233
|
+
internalInvariant(import_typescript13.default.isIdentifier(el.name), "extractLoopParamBindings: object rest target is not an identifier (parser should reject)");
|
|
196172
196234
|
bindings.push({
|
|
196173
196235
|
name: el.name.text,
|
|
196174
196236
|
path: prefix,
|
|
@@ -196180,17 +196242,17 @@ function extractLoopParamBindings(pattern) {
|
|
|
196180
196242
|
let keyText = null;
|
|
196181
196243
|
if (el.propertyName) {
|
|
196182
196244
|
const pn = el.propertyName;
|
|
196183
|
-
if (
|
|
196245
|
+
if (import_typescript13.default.isIdentifier(pn))
|
|
196184
196246
|
keyText = pn.text;
|
|
196185
|
-
else if (
|
|
196247
|
+
else if (import_typescript13.default.isStringLiteral(pn))
|
|
196186
196248
|
keyText = pn.text;
|
|
196187
|
-
else if (
|
|
196249
|
+
else if (import_typescript13.default.isNumericLiteral(pn))
|
|
196188
196250
|
keyText = pn.text;
|
|
196189
196251
|
else {
|
|
196190
196252
|
unsupported = true;
|
|
196191
196253
|
return;
|
|
196192
196254
|
}
|
|
196193
|
-
} else if (
|
|
196255
|
+
} else if (import_typescript13.default.isIdentifier(el.name)) {
|
|
196194
196256
|
keyText = el.name.text;
|
|
196195
196257
|
} else {
|
|
196196
196258
|
unsupported = true;
|
|
@@ -196200,14 +196262,14 @@ function extractLoopParamBindings(pattern) {
|
|
|
196200
196262
|
collectedKeys.push({ key: keyText, isIdent: keyIsIdent });
|
|
196201
196263
|
const path = appendDotAccess(prefix, keyText);
|
|
196202
196264
|
const nextSegments = [...segments, { kind: "field", key: keyText, isIdent: keyIsIdent }];
|
|
196203
|
-
if (
|
|
196265
|
+
if (import_typescript13.default.isIdentifier(el.name)) {
|
|
196204
196266
|
bindings.push({ name: el.name.text, path, segments: nextSegments });
|
|
196205
196267
|
} else {
|
|
196206
196268
|
walk(el.name, path, nextSegments);
|
|
196207
196269
|
}
|
|
196208
196270
|
}
|
|
196209
196271
|
};
|
|
196210
|
-
if (
|
|
196272
|
+
if (import_typescript13.default.isArrayBindingPattern(pattern) || import_typescript13.default.isObjectBindingPattern(pattern)) {
|
|
196211
196273
|
walk(pattern, "", []);
|
|
196212
196274
|
if (unsupported)
|
|
196213
196275
|
return { unsupported: true };
|
|
@@ -196217,7 +196279,7 @@ function extractLoopParamBindings(pattern) {
|
|
|
196217
196279
|
}
|
|
196218
196280
|
function findKeyJsxAttribute(opening) {
|
|
196219
196281
|
for (const prop of opening.attributes.properties) {
|
|
196220
|
-
if (
|
|
196282
|
+
if (import_typescript13.default.isJsxAttribute(prop) && prop.name.getText() === "key") {
|
|
196221
196283
|
return prop;
|
|
196222
196284
|
}
|
|
196223
196285
|
}
|
|
@@ -196262,7 +196324,7 @@ function keyAttrValueToExpr(v) {
|
|
|
196262
196324
|
function normalizeKeyExpr(expr) {
|
|
196263
196325
|
let out = "";
|
|
196264
196326
|
for (const tok of iterateJsTokens(expr)) {
|
|
196265
|
-
if (tok.kind ===
|
|
196327
|
+
if (tok.kind === import_typescript13.default.SyntaxKind.WhitespaceTrivia || tok.kind === import_typescript13.default.SyntaxKind.NewLineTrivia) {
|
|
196266
196328
|
continue;
|
|
196267
196329
|
}
|
|
196268
196330
|
out += expr.slice(tok.pos, tok.end);
|
|
@@ -196274,13 +196336,13 @@ function conditionalHasExplicitNullishBranch(cond) {
|
|
|
196274
196336
|
}
|
|
196275
196337
|
function branchHasExplicitNullish(branch) {
|
|
196276
196338
|
let b = branch;
|
|
196277
|
-
while (
|
|
196339
|
+
while (import_typescript13.default.isParenthesizedExpression(b))
|
|
196278
196340
|
b = b.expression;
|
|
196279
|
-
if (b.kind ===
|
|
196341
|
+
if (b.kind === import_typescript13.default.SyntaxKind.NullKeyword)
|
|
196280
196342
|
return true;
|
|
196281
|
-
if (
|
|
196343
|
+
if (import_typescript13.default.isIdentifier(b) && b.text === "undefined")
|
|
196282
196344
|
return true;
|
|
196283
|
-
if (
|
|
196345
|
+
if (import_typescript13.default.isConditionalExpression(b))
|
|
196284
196346
|
return conditionalHasExplicitNullishBranch(b);
|
|
196285
196347
|
return false;
|
|
196286
196348
|
}
|
|
@@ -196289,26 +196351,26 @@ function classifyKeyProblem(keyAttr, checker) {
|
|
|
196289
196351
|
return "missing";
|
|
196290
196352
|
if (!keyAttr.initializer)
|
|
196291
196353
|
return "missing";
|
|
196292
|
-
if (
|
|
196354
|
+
if (import_typescript13.default.isJsxExpression(keyAttr.initializer) && !keyAttr.initializer.expression) {
|
|
196293
196355
|
return "missing";
|
|
196294
196356
|
}
|
|
196295
196357
|
let expr;
|
|
196296
|
-
if (
|
|
196358
|
+
if (import_typescript13.default.isStringLiteral(keyAttr.initializer)) {
|
|
196297
196359
|
return null;
|
|
196298
|
-
} else if (
|
|
196360
|
+
} else if (import_typescript13.default.isJsxExpression(keyAttr.initializer)) {
|
|
196299
196361
|
expr = keyAttr.initializer.expression;
|
|
196300
196362
|
}
|
|
196301
196363
|
if (!expr)
|
|
196302
196364
|
return null;
|
|
196303
|
-
if (expr.kind ===
|
|
196365
|
+
if (expr.kind === import_typescript13.default.SyntaxKind.NullKeyword)
|
|
196304
196366
|
return null;
|
|
196305
|
-
if (
|
|
196367
|
+
if (import_typescript13.default.isIdentifier(expr) && expr.text === "undefined")
|
|
196306
196368
|
return null;
|
|
196307
|
-
if (
|
|
196369
|
+
if (import_typescript13.default.isConditionalExpression(expr) && conditionalHasExplicitNullishBranch(expr))
|
|
196308
196370
|
return null;
|
|
196309
196371
|
if (checker) {
|
|
196310
196372
|
const type2 = checker.getTypeAtLocation(expr);
|
|
196311
|
-
const isNullable = type2.isUnion() ? type2.types.some((t) => (t.flags & (
|
|
196373
|
+
const isNullable = type2.isUnion() ? type2.types.some((t) => (t.flags & (import_typescript13.default.TypeFlags.Null | import_typescript13.default.TypeFlags.Undefined | import_typescript13.default.TypeFlags.Void)) !== 0) : (type2.flags & (import_typescript13.default.TypeFlags.Null | import_typescript13.default.TypeFlags.Undefined | import_typescript13.default.TypeFlags.Void)) !== 0;
|
|
196312
196374
|
if (isNullable)
|
|
196313
196375
|
return "nullable-type";
|
|
196314
196376
|
}
|
|
@@ -196334,81 +196396,81 @@ function checkLoopKey(callback, ctx, isNested) {
|
|
|
196334
196396
|
ctx.analyzer.errors.push(createError(errorCode, getSourceLocation(locNode, ctx.sourceFile, ctx.filePath), { suggestion: { message: keyErrorSuggestion(problem) } }));
|
|
196335
196397
|
}
|
|
196336
196398
|
let body = callback.body;
|
|
196337
|
-
if (
|
|
196338
|
-
const ret = body.statements.find((s) =>
|
|
196399
|
+
if (import_typescript13.default.isBlock(body)) {
|
|
196400
|
+
const ret = body.statements.find((s) => import_typescript13.default.isReturnStatement(s) && s.expression != null);
|
|
196339
196401
|
if (!ret?.expression)
|
|
196340
196402
|
return;
|
|
196341
196403
|
body = ret.expression;
|
|
196342
196404
|
}
|
|
196343
|
-
while (
|
|
196405
|
+
while (import_typescript13.default.isParenthesizedExpression(body))
|
|
196344
196406
|
body = body.expression;
|
|
196345
196407
|
function checkJsxOperand(node) {
|
|
196346
196408
|
let n = node;
|
|
196347
|
-
while (
|
|
196409
|
+
while (import_typescript13.default.isParenthesizedExpression(n))
|
|
196348
196410
|
n = n.expression;
|
|
196349
|
-
if (
|
|
196411
|
+
if (import_typescript13.default.isJsxElement(n))
|
|
196350
196412
|
checkOpening(n.openingElement);
|
|
196351
|
-
else if (
|
|
196413
|
+
else if (import_typescript13.default.isJsxSelfClosingElement(n))
|
|
196352
196414
|
checkOpening(n);
|
|
196353
196415
|
}
|
|
196354
|
-
if (
|
|
196416
|
+
if (import_typescript13.default.isConditionalExpression(body)) {
|
|
196355
196417
|
checkJsxOperand(body.whenTrue);
|
|
196356
196418
|
checkJsxOperand(body.whenFalse);
|
|
196357
196419
|
return;
|
|
196358
196420
|
}
|
|
196359
|
-
if (
|
|
196421
|
+
if (import_typescript13.default.isBinaryExpression(body) && (body.operatorToken.kind === import_typescript13.default.SyntaxKind.AmpersandAmpersandToken || body.operatorToken.kind === import_typescript13.default.SyntaxKind.BarBarToken || body.operatorToken.kind === import_typescript13.default.SyntaxKind.QuestionQuestionToken)) {
|
|
196360
196422
|
checkJsxOperand(body.left);
|
|
196361
196423
|
checkJsxOperand(body.right);
|
|
196362
196424
|
return;
|
|
196363
196425
|
}
|
|
196364
|
-
if (
|
|
196426
|
+
if (import_typescript13.default.isJsxElement(body)) {
|
|
196365
196427
|
checkOpening(body.openingElement);
|
|
196366
196428
|
return;
|
|
196367
196429
|
}
|
|
196368
|
-
if (
|
|
196430
|
+
if (import_typescript13.default.isJsxSelfClosingElement(body)) {
|
|
196369
196431
|
checkOpening(body);
|
|
196370
196432
|
return;
|
|
196371
196433
|
}
|
|
196372
196434
|
}
|
|
196373
196435
|
function flatMapProjectionCall(body) {
|
|
196374
196436
|
let expr;
|
|
196375
|
-
if (
|
|
196437
|
+
if (import_typescript13.default.isBlock(body)) {
|
|
196376
196438
|
const real = body.statements;
|
|
196377
|
-
if (real.length !== 1 || !
|
|
196439
|
+
if (real.length !== 1 || !import_typescript13.default.isReturnStatement(real[0]) || !real[0].expression)
|
|
196378
196440
|
return null;
|
|
196379
196441
|
expr = real[0].expression;
|
|
196380
196442
|
} else {
|
|
196381
196443
|
expr = body;
|
|
196382
196444
|
}
|
|
196383
|
-
while (
|
|
196445
|
+
while (import_typescript13.default.isParenthesizedExpression(expr))
|
|
196384
196446
|
expr = expr.expression;
|
|
196385
|
-
if (!
|
|
196447
|
+
if (!import_typescript13.default.isCallExpression(expr))
|
|
196386
196448
|
return null;
|
|
196387
196449
|
if (!getMapLikeMethod(expr))
|
|
196388
196450
|
return null;
|
|
196389
196451
|
const cb = expr.arguments[0];
|
|
196390
|
-
if (!cb || !
|
|
196452
|
+
if (!cb || !import_typescript13.default.isArrowFunction(cb) && !import_typescript13.default.isFunctionExpression(cb))
|
|
196391
196453
|
return null;
|
|
196392
196454
|
for (const p of cb.parameters) {
|
|
196393
|
-
if (!
|
|
196455
|
+
if (!import_typescript13.default.isIdentifier(p.name))
|
|
196394
196456
|
return null;
|
|
196395
196457
|
}
|
|
196396
196458
|
let innerBody = cb.body;
|
|
196397
|
-
if (
|
|
196398
|
-
const ret = innerBody.statements.find((s) =>
|
|
196459
|
+
if (import_typescript13.default.isBlock(innerBody)) {
|
|
196460
|
+
const ret = innerBody.statements.find((s) => import_typescript13.default.isReturnStatement(s) && s.expression != null);
|
|
196399
196461
|
if (innerBody.statements.length !== 1 || !ret?.expression)
|
|
196400
196462
|
return null;
|
|
196401
196463
|
innerBody = ret.expression;
|
|
196402
196464
|
}
|
|
196403
|
-
while (
|
|
196465
|
+
while (import_typescript13.default.isParenthesizedExpression(innerBody))
|
|
196404
196466
|
innerBody = innerBody.expression;
|
|
196405
196467
|
const isElementish = (n) => {
|
|
196406
196468
|
let m = n;
|
|
196407
|
-
while (
|
|
196469
|
+
while (import_typescript13.default.isParenthesizedExpression(m))
|
|
196408
196470
|
m = m.expression;
|
|
196409
|
-
if (
|
|
196471
|
+
if (import_typescript13.default.isJsxElement(m) || import_typescript13.default.isJsxSelfClosingElement(m))
|
|
196410
196472
|
return leafIsWirelessElement(m);
|
|
196411
|
-
if (
|
|
196473
|
+
if (import_typescript13.default.isConditionalExpression(m))
|
|
196412
196474
|
return isElementish(m.whenTrue) && isElementish(m.whenFalse);
|
|
196413
196475
|
return false;
|
|
196414
196476
|
};
|
|
@@ -196421,19 +196483,19 @@ function leafIsWirelessElement(el) {
|
|
|
196421
196483
|
const visit2 = (n) => {
|
|
196422
196484
|
if (!ok)
|
|
196423
196485
|
return;
|
|
196424
|
-
if (
|
|
196486
|
+
if (import_typescript13.default.isJsxOpeningElement(n) || import_typescript13.default.isJsxSelfClosingElement(n)) {
|
|
196425
196487
|
const tagNode = n.tagName;
|
|
196426
|
-
const isIntrinsic =
|
|
196488
|
+
const isIntrinsic = import_typescript13.default.isIdentifier(tagNode) ? !/^[A-Z]/.test(tagNode.text) : import_typescript13.default.isJsxNamespacedName(tagNode);
|
|
196427
196489
|
if (!isIntrinsic) {
|
|
196428
196490
|
ok = false;
|
|
196429
196491
|
return;
|
|
196430
196492
|
}
|
|
196431
196493
|
for (const attr of n.attributes.properties) {
|
|
196432
|
-
if (
|
|
196494
|
+
if (import_typescript13.default.isJsxSpreadAttribute(attr)) {
|
|
196433
196495
|
ok = false;
|
|
196434
196496
|
return;
|
|
196435
196497
|
}
|
|
196436
|
-
if (
|
|
196498
|
+
if (import_typescript13.default.isJsxAttribute(attr)) {
|
|
196437
196499
|
const name = attr.name.getText();
|
|
196438
196500
|
if (/^on[A-Z]/.test(name)) {
|
|
196439
196501
|
ok = false;
|
|
@@ -196442,11 +196504,11 @@ function leafIsWirelessElement(el) {
|
|
|
196442
196504
|
}
|
|
196443
196505
|
}
|
|
196444
196506
|
}
|
|
196445
|
-
if (
|
|
196507
|
+
if (import_typescript13.default.isCallExpression(n) && getMapLikeMethod(n) && containsJsxInExpression(n)) {
|
|
196446
196508
|
ok = false;
|
|
196447
196509
|
return;
|
|
196448
196510
|
}
|
|
196449
|
-
|
|
196511
|
+
import_typescript13.default.forEachChild(n, visit2);
|
|
196450
196512
|
};
|
|
196451
196513
|
visit2(el);
|
|
196452
196514
|
return ok;
|
|
@@ -196626,7 +196688,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196626
196688
|
let children = [];
|
|
196627
196689
|
let paramBindings;
|
|
196628
196690
|
let flatMapCallback;
|
|
196629
|
-
if (
|
|
196691
|
+
if (import_typescript13.default.isArrowFunction(callback)) {
|
|
196630
196692
|
if (callback.parameters.length > 0) {
|
|
196631
196693
|
const firstParam = callback.parameters[0];
|
|
196632
196694
|
param = firstParam.name.getText(ctx.sourceFile);
|
|
@@ -196634,9 +196696,9 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196634
196696
|
paramType = firstParam.type.getText(ctx.sourceFile);
|
|
196635
196697
|
}
|
|
196636
196698
|
const isEntriesShape = iterationShape === "entries" || objectIteration === "entries";
|
|
196637
|
-
if (isEntriesShape &&
|
|
196638
|
-
const elements = firstParam.name.elements.filter((el) => !
|
|
196639
|
-
if (elements.length === 2 &&
|
|
196699
|
+
if (isEntriesShape && import_typescript13.default.isArrayBindingPattern(firstParam.name)) {
|
|
196700
|
+
const elements = firstParam.name.elements.filter((el) => !import_typescript13.default.isOmittedExpression(el));
|
|
196701
|
+
if (elements.length === 2 && import_typescript13.default.isBindingElement(elements[0]) && import_typescript13.default.isIdentifier(elements[0].name) && import_typescript13.default.isBindingElement(elements[1]) && import_typescript13.default.isIdentifier(elements[1].name)) {
|
|
196640
196702
|
index = elements[0].name.text;
|
|
196641
196703
|
param = elements[1].name.text;
|
|
196642
196704
|
} else {
|
|
@@ -196667,10 +196729,10 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196667
196729
|
ctx.scope = ctx.scope.enterLoopRow({ param, index, paramBindings });
|
|
196668
196730
|
ctx.loopDepth++;
|
|
196669
196731
|
const tryTransformRenderableBody = (expr) => {
|
|
196670
|
-
if (!
|
|
196732
|
+
if (!import_typescript13.default.isBinaryExpression(expr))
|
|
196671
196733
|
return;
|
|
196672
196734
|
const op = expr.operatorToken.kind;
|
|
196673
|
-
if (op !==
|
|
196735
|
+
if (op !== import_typescript13.default.SyntaxKind.AmpersandAmpersandToken && op !== import_typescript13.default.SyntaxKind.BarBarToken && op !== import_typescript13.default.SyntaxKind.QuestionQuestionToken) {
|
|
196674
196736
|
return;
|
|
196675
196737
|
}
|
|
196676
196738
|
if (!containsJsxInExpression(expr) && !callsJsxHelper(expr, ctx))
|
|
@@ -196680,33 +196742,33 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196680
196742
|
children = [transformed];
|
|
196681
196743
|
};
|
|
196682
196744
|
const body = callback.body;
|
|
196683
|
-
if (
|
|
196745
|
+
if (import_typescript13.default.isJsxElement(body) || import_typescript13.default.isJsxSelfClosingElement(body) || import_typescript13.default.isJsxFragment(body)) {
|
|
196684
196746
|
const transformed = transformNode(body, ctx);
|
|
196685
196747
|
if (transformed) {
|
|
196686
196748
|
children = [transformed];
|
|
196687
196749
|
}
|
|
196688
|
-
} else if (
|
|
196750
|
+
} else if (import_typescript13.default.isConditionalExpression(body)) {
|
|
196689
196751
|
children = [transformConditional(body, ctx)];
|
|
196690
|
-
} else if (
|
|
196752
|
+
} else if (import_typescript13.default.isParenthesizedExpression(body)) {
|
|
196691
196753
|
let inner = body.expression;
|
|
196692
|
-
while (
|
|
196754
|
+
while (import_typescript13.default.isParenthesizedExpression(inner)) {
|
|
196693
196755
|
inner = inner.expression;
|
|
196694
196756
|
}
|
|
196695
|
-
if (
|
|
196757
|
+
if (import_typescript13.default.isJsxElement(inner) || import_typescript13.default.isJsxSelfClosingElement(inner) || import_typescript13.default.isJsxFragment(inner)) {
|
|
196696
196758
|
const transformed = transformNode(inner, ctx);
|
|
196697
196759
|
if (transformed) {
|
|
196698
196760
|
children = [transformed];
|
|
196699
196761
|
}
|
|
196700
|
-
} else if (
|
|
196762
|
+
} else if (import_typescript13.default.isConditionalExpression(inner)) {
|
|
196701
196763
|
children = [transformConditional(inner, ctx)];
|
|
196702
|
-
} else if (method === "flatMap" &&
|
|
196764
|
+
} else if (method === "flatMap" && import_typescript13.default.isArrayLiteralExpression(inner)) {
|
|
196703
196765
|
children = transformArrayLiteralChildren(inner, ctx);
|
|
196704
196766
|
} else {
|
|
196705
196767
|
tryTransformRenderableBody(inner);
|
|
196706
196768
|
}
|
|
196707
|
-
} else if (method === "flatMap" &&
|
|
196769
|
+
} else if (method === "flatMap" && import_typescript13.default.isArrayLiteralExpression(body)) {
|
|
196708
196770
|
children = transformArrayLiteralChildren(body, ctx);
|
|
196709
|
-
} else if (
|
|
196771
|
+
} else if (import_typescript13.default.isBlock(body)) {
|
|
196710
196772
|
const multiReturn = method !== "flatMap" ? extractMultiReturnJsxBranches(body, true) : null;
|
|
196711
196773
|
if (multiReturn && multiReturn.branches.length > 0) {
|
|
196712
196774
|
const loc = getSourceLocation(body, ctx.sourceFile, ctx.filePath);
|
|
@@ -196724,7 +196786,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196724
196786
|
}
|
|
196725
196787
|
}
|
|
196726
196788
|
}
|
|
196727
|
-
const returnStmt = children.length === 0 ? body.statements.find((s) =>
|
|
196789
|
+
const returnStmt = children.length === 0 ? body.statements.find((s) => import_typescript13.default.isReturnStatement(s) && s.expression != null) : undefined;
|
|
196728
196790
|
let rowScopeBeforePreamble = null;
|
|
196729
196791
|
if (returnStmt) {
|
|
196730
196792
|
const preambleNames = new Set;
|
|
@@ -196745,10 +196807,10 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196745
196807
|
}
|
|
196746
196808
|
if (returnStmt && returnStmt.expression) {
|
|
196747
196809
|
let returnExpr = returnStmt.expression;
|
|
196748
|
-
while (
|
|
196810
|
+
while (import_typescript13.default.isParenthesizedExpression(returnExpr)) {
|
|
196749
196811
|
returnExpr = returnExpr.expression;
|
|
196750
196812
|
}
|
|
196751
|
-
if (
|
|
196813
|
+
if (import_typescript13.default.isJsxElement(returnExpr) || import_typescript13.default.isJsxSelfClosingElement(returnExpr) || import_typescript13.default.isJsxFragment(returnExpr)) {
|
|
196752
196814
|
const transformed = transformNode(returnExpr, ctx);
|
|
196753
196815
|
if (transformed) {
|
|
196754
196816
|
children = [transformed];
|
|
@@ -196830,7 +196892,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196830
196892
|
}
|
|
196831
196893
|
}
|
|
196832
196894
|
}
|
|
196833
|
-
if (method === "flatMap" && children.length === 0 && !flatMapCallback && !
|
|
196895
|
+
if (method === "flatMap" && children.length === 0 && !flatMapCallback && !import_typescript13.default.isBlock(body)) {
|
|
196834
196896
|
flatMapCallback = buildFlatMapCallback(callback, body, ctx);
|
|
196835
196897
|
}
|
|
196836
196898
|
if (flatMapCallback)
|
|
@@ -196848,7 +196910,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196848
196910
|
}
|
|
196849
196911
|
if (children.length === 0 && !flatMapCallback) {
|
|
196850
196912
|
const cb = node.arguments[0];
|
|
196851
|
-
const cbBody = cb && (
|
|
196913
|
+
const cbBody = cb && (import_typescript13.default.isArrowFunction(cb) || import_typescript13.default.isFunctionExpression(cb)) ? cb.body : undefined;
|
|
196852
196914
|
if (cbBody && containsJsxInExpression(cbBody) && ctx.analyzer.errors.length === diagCountAtEntry) {
|
|
196853
196915
|
ctx.analyzer.errors.push(createError(ErrorCodes.UNSUPPORTED_JSX_PATTERN, getSourceLocation(cbBody, ctx.sourceFile, ctx.filePath), {
|
|
196854
196916
|
message: `A .${method}() callback that builds JSX in this shape cannot be ` + "compiled — the JSX would leak verbatim into the client bundle. " + "Recognized bodies: a JSX element/fragment, a ternary or " + "&& / || / ?? expression, an array literal (flatMap), or a block " + "body whose return the compiler can lower.",
|
|
@@ -196859,7 +196921,7 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196859
196921
|
}
|
|
196860
196922
|
return null;
|
|
196861
196923
|
}
|
|
196862
|
-
if (
|
|
196924
|
+
if (import_typescript13.default.isArrowFunction(node.arguments[0]) && children.length > 0) {
|
|
196863
196925
|
checkLoopKey(node.arguments[0], ctx, isNested);
|
|
196864
196926
|
}
|
|
196865
196927
|
const itemConditional = children.length > 0 ? loopBodyItemConditional(children) : null;
|
|
@@ -196913,6 +196975,9 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196913
196975
|
const preambleRegions = preamble && !isStaticArray ? collectPreambleRegions(children, new Set(preamble.declaredNames), ctx) : undefined;
|
|
196914
196976
|
if (preamble && !isStaticArray) {
|
|
196915
196977
|
markPreambleAttrSlots(children, new Set(preamble.declaredNames), ctx);
|
|
196978
|
+
if (preamble.reactiveNames && preamble.reactiveNames.length > 0) {
|
|
196979
|
+
markPreambleConditionalReactivity(children, new Set(preamble.reactiveNames), ctx);
|
|
196980
|
+
}
|
|
196916
196981
|
}
|
|
196917
196982
|
const nestedComponents = collectNestedComponents(children).filter((c) => c.name !== childComponent?.name);
|
|
196918
196983
|
return {
|
|
@@ -196956,12 +197021,12 @@ function transformMapCall(node, ctx, isClientOnly = false, method = "map") {
|
|
|
196956
197021
|
function transformArrayLiteralChildren(arrayLiteral, ctx) {
|
|
196957
197022
|
const children = [];
|
|
196958
197023
|
for (const element of arrayLiteral.elements) {
|
|
196959
|
-
if (
|
|
197024
|
+
if (import_typescript13.default.isSpreadElement(element))
|
|
196960
197025
|
continue;
|
|
196961
197026
|
let inner = element;
|
|
196962
|
-
while (
|
|
197027
|
+
while (import_typescript13.default.isParenthesizedExpression(inner))
|
|
196963
197028
|
inner = inner.expression;
|
|
196964
|
-
if (
|
|
197029
|
+
if (import_typescript13.default.isJsxElement(inner) || import_typescript13.default.isJsxSelfClosingElement(inner) || import_typescript13.default.isJsxFragment(inner)) {
|
|
196965
197030
|
const transformed = transformNode(inner, ctx);
|
|
196966
197031
|
if (transformed)
|
|
196967
197032
|
children.push(transformed);
|
|
@@ -196970,7 +197035,7 @@ function transformArrayLiteralChildren(arrayLiteral, ctx) {
|
|
|
196970
197035
|
return children;
|
|
196971
197036
|
}
|
|
196972
197037
|
function containsJsx(node) {
|
|
196973
|
-
if (
|
|
197038
|
+
if (import_typescript13.default.isJsxElement(node) || import_typescript13.default.isJsxSelfClosingElement(node) || import_typescript13.default.isJsxFragment(node))
|
|
196974
197039
|
return true;
|
|
196975
197040
|
let found = false;
|
|
196976
197041
|
node.forEachChild((child) => {
|
|
@@ -196986,7 +197051,7 @@ function buildFlatMapCallback(callback, body, ctx) {
|
|
|
196986
197051
|
const leafIrs = [];
|
|
196987
197052
|
let refusalNode;
|
|
196988
197053
|
const collectJsx = (n, underTemplate) => {
|
|
196989
|
-
if (
|
|
197054
|
+
if (import_typescript13.default.isJsxElement(n) || import_typescript13.default.isJsxSelfClosingElement(n) || import_typescript13.default.isJsxFragment(n)) {
|
|
196990
197055
|
if (underTemplate)
|
|
196991
197056
|
refusalNode ??= n;
|
|
196992
197057
|
leafSpans.push({ start: n.getStart(ctx.sourceFile), end: n.getEnd() });
|
|
@@ -196994,7 +197059,7 @@ function buildFlatMapCallback(callback, body, ctx) {
|
|
|
196994
197059
|
leafIrs.push(ir ?? { type: "text", value: "", loc: getSourceLocation(n, ctx.sourceFile, ctx.filePath) });
|
|
196995
197060
|
return;
|
|
196996
197061
|
}
|
|
196997
|
-
const inTemplate = underTemplate ||
|
|
197062
|
+
const inTemplate = underTemplate || import_typescript13.default.isTemplateExpression(n) || import_typescript13.default.isTaggedTemplateExpression(n);
|
|
196998
197063
|
n.forEachChild((c) => collectJsx(c, inTemplate));
|
|
196999
197064
|
};
|
|
197000
197065
|
collectJsx(body, false);
|
|
@@ -197170,6 +197235,33 @@ function markPreambleAttrSlots(nodes, declared, ctx) {
|
|
|
197170
197235
|
};
|
|
197171
197236
|
visit2(nodes);
|
|
197172
197237
|
}
|
|
197238
|
+
function markPreambleConditionalReactivity(nodes, reactiveNames, ctx) {
|
|
197239
|
+
if (reactiveNames.size === 0)
|
|
197240
|
+
return;
|
|
197241
|
+
const visit2 = (list) => {
|
|
197242
|
+
for (const node of list) {
|
|
197243
|
+
switch (node.type) {
|
|
197244
|
+
case "element":
|
|
197245
|
+
case "fragment":
|
|
197246
|
+
visit2(node.children);
|
|
197247
|
+
break;
|
|
197248
|
+
case "conditional": {
|
|
197249
|
+
if (!node.reactive) {
|
|
197250
|
+
const refs = extractFreeIdentifiersFromText(node.condition);
|
|
197251
|
+
if ([...refs].some((r) => reactiveNames.has(r))) {
|
|
197252
|
+
node.reactive = true;
|
|
197253
|
+
if (!node.slotId)
|
|
197254
|
+
node.slotId = generateSlotId(ctx);
|
|
197255
|
+
}
|
|
197256
|
+
}
|
|
197257
|
+
visit2([node.whenTrue, ...node.whenFalse ? [node.whenFalse] : []]);
|
|
197258
|
+
break;
|
|
197259
|
+
}
|
|
197260
|
+
}
|
|
197261
|
+
}
|
|
197262
|
+
};
|
|
197263
|
+
visit2(nodes);
|
|
197264
|
+
}
|
|
197173
197265
|
function attrValueText(value) {
|
|
197174
197266
|
if (value.kind === "expression")
|
|
197175
197267
|
return value.expr;
|
|
@@ -197185,24 +197277,46 @@ function attrValueText(value) {
|
|
|
197185
197277
|
return out.join(" ");
|
|
197186
197278
|
}
|
|
197187
197279
|
function collectBindingNames2(name, out) {
|
|
197188
|
-
if (
|
|
197280
|
+
if (import_typescript13.default.isIdentifier(name)) {
|
|
197189
197281
|
out.add(name.text);
|
|
197190
197282
|
return;
|
|
197191
197283
|
}
|
|
197192
197284
|
for (const el of name.elements) {
|
|
197193
|
-
if (
|
|
197285
|
+
if (import_typescript13.default.isBindingElement(el))
|
|
197194
197286
|
collectBindingNames2(el.name, out);
|
|
197195
197287
|
}
|
|
197196
197288
|
}
|
|
197197
197289
|
function collectPreambleDeclaredNames(stmt, out) {
|
|
197198
|
-
if (
|
|
197290
|
+
if (import_typescript13.default.isVariableStatement(stmt)) {
|
|
197199
197291
|
for (const decl of stmt.declarationList.declarations) {
|
|
197200
197292
|
collectBindingNames2(decl.name, out);
|
|
197201
197293
|
}
|
|
197202
|
-
} else if (
|
|
197294
|
+
} else if (import_typescript13.default.isFunctionDeclaration(stmt) && stmt.name) {
|
|
197203
197295
|
out.add(stmt.name.text);
|
|
197204
197296
|
}
|
|
197205
197297
|
}
|
|
197298
|
+
function computePreambleReactiveNames(statements, ctx) {
|
|
197299
|
+
const reactiveNames = new Set;
|
|
197300
|
+
for (const stmt of statements) {
|
|
197301
|
+
if (!import_typescript13.default.isVariableStatement(stmt))
|
|
197302
|
+
continue;
|
|
197303
|
+
for (const decl of stmt.declarationList.declarations) {
|
|
197304
|
+
if (!decl.initializer)
|
|
197305
|
+
continue;
|
|
197306
|
+
const boundNames = new Set;
|
|
197307
|
+
collectBindingNames2(decl.name, boundNames);
|
|
197308
|
+
const initText = ctx.getJS(decl.initializer);
|
|
197309
|
+
const initFreeRefs = extractFreeIdentifiersFromNode(decl.initializer);
|
|
197310
|
+
const readsEarlierReactive = [...initFreeRefs].some((r) => reactiveNames.has(r));
|
|
197311
|
+
const isReactive = readsEarlierReactive || isReactiveExpression(initText, ctx, decl.initializer);
|
|
197312
|
+
if (isReactive) {
|
|
197313
|
+
for (const n of boundNames)
|
|
197314
|
+
reactiveNames.add(n);
|
|
197315
|
+
}
|
|
197316
|
+
}
|
|
197317
|
+
}
|
|
197318
|
+
return reactiveNames;
|
|
197319
|
+
}
|
|
197206
197320
|
function preambleFromValueStatements(statements, ctx) {
|
|
197207
197321
|
const segments = [];
|
|
197208
197322
|
const typedParts = [];
|
|
@@ -197217,21 +197331,23 @@ function preambleFromValueStatements(statements, ctx) {
|
|
|
197217
197331
|
typedParts.push(raw0.endsWith(";") ? raw0 : raw0 + ";");
|
|
197218
197332
|
segments.push(tjs !== js ? { kind: "js", text: js, templateText: tjs } : { kind: "js", text: js });
|
|
197219
197333
|
}
|
|
197334
|
+
const reactiveNames = computePreambleReactiveNames(statements, ctx);
|
|
197220
197335
|
return {
|
|
197221
197336
|
segments: trimPreambleSegments(segments),
|
|
197222
197337
|
ssrText: tsxSourceText(typedParts.join(" ")),
|
|
197223
197338
|
declaredNames: [...declared],
|
|
197224
197339
|
builderNames: [],
|
|
197225
|
-
declarations: neutralPreambleDeclarations(statements, ctx) ?? undefined
|
|
197340
|
+
declarations: neutralPreambleDeclarations(statements, ctx) ?? undefined,
|
|
197341
|
+
reactiveNames: reactiveNames.size > 0 ? [...reactiveNames] : undefined
|
|
197226
197342
|
};
|
|
197227
197343
|
}
|
|
197228
197344
|
function neutralPreambleDeclarations(statements, ctx) {
|
|
197229
197345
|
const out = [];
|
|
197230
197346
|
for (const stmt of statements) {
|
|
197231
|
-
if (!
|
|
197347
|
+
if (!import_typescript13.default.isVariableStatement(stmt))
|
|
197232
197348
|
return null;
|
|
197233
197349
|
for (const decl of stmt.declarationList.declarations) {
|
|
197234
|
-
if (!
|
|
197350
|
+
if (!import_typescript13.default.isIdentifier(decl.name))
|
|
197235
197351
|
return null;
|
|
197236
197352
|
if (!decl.initializer)
|
|
197237
197353
|
return null;
|
|
@@ -197264,11 +197380,11 @@ function buildPreambleSegments(statements, returnStmt, ctx) {
|
|
|
197264
197380
|
let refusalNode;
|
|
197265
197381
|
const recordBuilderTarget = (leaf, stmt) => {
|
|
197266
197382
|
for (let n = leaf.parent;n && n !== stmt.parent; n = n.parent) {
|
|
197267
|
-
if (
|
|
197383
|
+
if (import_typescript13.default.isCallExpression(n) && import_typescript13.default.isPropertyAccessExpression(n.expression) && (n.expression.name.text === "push" || n.expression.name.text === "unshift") && import_typescript13.default.isIdentifier(n.expression.expression)) {
|
|
197268
197384
|
builders.add(n.expression.expression.text);
|
|
197269
197385
|
return;
|
|
197270
197386
|
}
|
|
197271
|
-
if (
|
|
197387
|
+
if (import_typescript13.default.isVariableDeclaration(n) && import_typescript13.default.isIdentifier(n.name)) {
|
|
197272
197388
|
builders.add(n.name.text);
|
|
197273
197389
|
return;
|
|
197274
197390
|
}
|
|
@@ -197281,7 +197397,7 @@ function buildPreambleSegments(statements, returnStmt, ctx) {
|
|
|
197281
197397
|
const leafSpans = [];
|
|
197282
197398
|
const leafIrs = [];
|
|
197283
197399
|
const collect = (n, underTemplate) => {
|
|
197284
|
-
if (
|
|
197400
|
+
if (import_typescript13.default.isJsxElement(n) || import_typescript13.default.isJsxSelfClosingElement(n) || import_typescript13.default.isJsxFragment(n)) {
|
|
197285
197401
|
if (underTemplate)
|
|
197286
197402
|
refusalNode ??= n;
|
|
197287
197403
|
recordBuilderTarget(n, stmt);
|
|
@@ -197292,7 +197408,7 @@ function buildPreambleSegments(statements, returnStmt, ctx) {
|
|
|
197292
197408
|
leafIrs.push(ir ?? { type: "text", value: "", loc: getSourceLocation(n, ctx.sourceFile, ctx.filePath) });
|
|
197293
197409
|
return;
|
|
197294
197410
|
}
|
|
197295
|
-
const inTemplate = underTemplate ||
|
|
197411
|
+
const inTemplate = underTemplate || import_typescript13.default.isTemplateExpression(n) || import_typescript13.default.isTaggedTemplateExpression(n);
|
|
197296
197412
|
n.forEachChild((c) => collect(c, inTemplate));
|
|
197297
197413
|
};
|
|
197298
197414
|
collect(stmt, false);
|
|
@@ -197396,13 +197512,13 @@ function expandSpreadAttribute(attr, ctx) {
|
|
|
197396
197512
|
}];
|
|
197397
197513
|
}
|
|
197398
197514
|
function attrFreeIdentifiers(attr) {
|
|
197399
|
-
if (!attr.initializer || !
|
|
197515
|
+
if (!attr.initializer || !import_typescript13.default.isJsxExpression(attr.initializer) || !attr.initializer.expression) {
|
|
197400
197516
|
return;
|
|
197401
197517
|
}
|
|
197402
197518
|
return extractFreeIdentifiersFromNode(attr.initializer.expression);
|
|
197403
197519
|
}
|
|
197404
197520
|
function computeReactivityFlags(attr, ctx) {
|
|
197405
|
-
if (!attr.initializer || !
|
|
197521
|
+
if (!attr.initializer || !import_typescript13.default.isJsxExpression(attr.initializer) || !attr.initializer.expression) {
|
|
197406
197522
|
return {};
|
|
197407
197523
|
}
|
|
197408
197524
|
const expr = attr.initializer.expression;
|
|
@@ -197428,22 +197544,22 @@ function processAttributes(attributes, ctx) {
|
|
|
197428
197544
|
const events = [];
|
|
197429
197545
|
let ref = null;
|
|
197430
197546
|
for (const attr of attributes.properties) {
|
|
197431
|
-
if (
|
|
197547
|
+
if (import_typescript13.default.isJsxSpreadAttribute(attr)) {
|
|
197432
197548
|
attrs.push(...expandSpreadAttribute(attr, ctx));
|
|
197433
197549
|
continue;
|
|
197434
197550
|
}
|
|
197435
|
-
if (!
|
|
197551
|
+
if (!import_typescript13.default.isJsxAttribute(attr))
|
|
197436
197552
|
continue;
|
|
197437
197553
|
const rawName = attr.name.getText(ctx.sourceFile);
|
|
197438
197554
|
if (rawName === "ref") {
|
|
197439
|
-
if (attr.initializer &&
|
|
197555
|
+
if (attr.initializer && import_typescript13.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
197440
197556
|
reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
|
|
197441
197557
|
ref = ctx.getJS(attr.initializer.expression);
|
|
197442
197558
|
}
|
|
197443
197559
|
continue;
|
|
197444
197560
|
}
|
|
197445
197561
|
if (/^on[A-Z]/.test(rawName)) {
|
|
197446
|
-
if (attr.initializer &&
|
|
197562
|
+
if (attr.initializer && import_typescript13.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
197447
197563
|
const eventName = rawName.slice(2).toLowerCase();
|
|
197448
197564
|
reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
|
|
197449
197565
|
events.push({
|
|
@@ -197458,7 +197574,7 @@ function processAttributes(attributes, ctx) {
|
|
|
197458
197574
|
const name = toHTMLAttrName(rawName);
|
|
197459
197575
|
let value = getAttributeValue(attr, ctx);
|
|
197460
197576
|
let clientOnly;
|
|
197461
|
-
if (attr.initializer &&
|
|
197577
|
+
if (attr.initializer && import_typescript13.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
197462
197578
|
if (value.kind === "expression" && value.templateExpr === undefined) {
|
|
197463
197579
|
const rewritten = rewriteBarePropRefs2(value.expr, attr.initializer.expression, ctx);
|
|
197464
197580
|
if (rewritten !== value.expr) {
|
|
@@ -197485,55 +197601,55 @@ function getAttributeValue(attr, ctx) {
|
|
|
197485
197601
|
if (!attr.initializer) {
|
|
197486
197602
|
return AttrValueOf.booleanAttr();
|
|
197487
197603
|
}
|
|
197488
|
-
if (
|
|
197604
|
+
if (import_typescript13.default.isStringLiteral(attr.initializer)) {
|
|
197489
197605
|
return AttrValueOf.literal(decodeEntities(attr.initializer.text));
|
|
197490
197606
|
}
|
|
197491
|
-
if (
|
|
197607
|
+
if (import_typescript13.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
197492
197608
|
let expr = attr.initializer.expression;
|
|
197493
|
-
if (
|
|
197609
|
+
if (import_typescript13.default.isIdentifier(expr)) {
|
|
197494
197610
|
const branchInit = ctx._branchScopeVars?.get(expr.text);
|
|
197495
197611
|
if (branchInit && !initializerShapeContainsJsx(branchInit)) {
|
|
197496
197612
|
expr = branchInit;
|
|
197497
197613
|
}
|
|
197498
197614
|
}
|
|
197499
197615
|
expr = tryDesugarInterleaveTaggedTemplate(expr, ctx);
|
|
197500
|
-
if (
|
|
197616
|
+
if (import_typescript13.default.isAwaitExpression(expr)) {
|
|
197501
197617
|
ctx.analyzer.errors.push(createError(ErrorCodes.STAGE_AWAIT_IN_TEMPLATE, getSourceLocation(expr, ctx.sourceFile, ctx.filePath)));
|
|
197502
197618
|
return AttrValueOf.expression("undefined");
|
|
197503
197619
|
}
|
|
197504
197620
|
checkBareSignalOrMemoIdentifier(expr, ctx);
|
|
197505
|
-
if (attr.name.getText(ctx.sourceFile) === "style" &&
|
|
197621
|
+
if (attr.name.getText(ctx.sourceFile) === "style" && import_typescript13.default.isObjectLiteralExpression(expr)) {
|
|
197506
197622
|
const cssString = tryStaticStyleObjectToCss(expr);
|
|
197507
197623
|
if (cssString !== null) {
|
|
197508
197624
|
return AttrValueOf.literal(cssString);
|
|
197509
197625
|
}
|
|
197510
197626
|
}
|
|
197511
|
-
if (
|
|
197627
|
+
if (import_typescript13.default.isTemplateExpression(expr)) {
|
|
197512
197628
|
const parts = parseTemplateLiteral(expr, ctx);
|
|
197513
197629
|
if (parts.some((p) => p.type === "ternary" || p.type === "lookup")) {
|
|
197514
197630
|
return AttrValueOf.template(parts);
|
|
197515
197631
|
}
|
|
197516
197632
|
}
|
|
197517
|
-
if (
|
|
197633
|
+
if (import_typescript13.default.isElementAccessExpression(expr) && !import_typescript13.default.isStringLiteralLike(expr.argumentExpression) && !import_typescript13.default.isNumericLiteral(expr.argumentExpression)) {
|
|
197518
197634
|
const parts = tryResolveTemplateSpanFromConst(expr, ctx);
|
|
197519
197635
|
if (parts) {
|
|
197520
197636
|
return AttrValueOf.template(parts);
|
|
197521
197637
|
}
|
|
197522
197638
|
}
|
|
197523
|
-
if (
|
|
197639
|
+
if (import_typescript13.default.isIdentifier(expr)) {
|
|
197524
197640
|
const resolved = tryResolveIdentifierAsTemplateLiteral(expr, ctx);
|
|
197525
197641
|
if (resolved) {
|
|
197526
197642
|
return AttrValueOf.template(resolved);
|
|
197527
197643
|
}
|
|
197528
197644
|
}
|
|
197529
|
-
if (
|
|
197645
|
+
if (import_typescript13.default.isConditionalExpression(expr)) {
|
|
197530
197646
|
const ternary = parseTernary(expr, ctx);
|
|
197531
197647
|
if (ternary) {
|
|
197532
197648
|
return AttrValueOf.template([ternary]);
|
|
197533
197649
|
}
|
|
197534
197650
|
}
|
|
197535
|
-
if (
|
|
197536
|
-
if (
|
|
197651
|
+
if (import_typescript13.default.isBinaryExpression(expr) && expr.operatorToken.kind === import_typescript13.default.SyntaxKind.BarBarToken) {
|
|
197652
|
+
if (import_typescript13.default.isIdentifier(expr.right) && expr.right.text === "undefined") {
|
|
197537
197653
|
const baseExpr = ctx.getJS(expr.left);
|
|
197538
197654
|
return AttrValueOf.expression(baseExpr, { presenceOrUndefined: true });
|
|
197539
197655
|
}
|
|
@@ -197546,11 +197662,11 @@ function getAttributeValue(attr, ctx) {
|
|
|
197546
197662
|
function tryStaticStyleObjectToCss(expr) {
|
|
197547
197663
|
const parts = [];
|
|
197548
197664
|
for (const prop of expr.properties) {
|
|
197549
|
-
if (!
|
|
197665
|
+
if (!import_typescript13.default.isPropertyAssignment(prop))
|
|
197550
197666
|
return null;
|
|
197551
|
-
if (!
|
|
197667
|
+
if (!import_typescript13.default.isIdentifier(prop.name) && !import_typescript13.default.isStringLiteral(prop.name))
|
|
197552
197668
|
return null;
|
|
197553
|
-
if (!
|
|
197669
|
+
if (!import_typescript13.default.isStringLiteral(prop.initializer))
|
|
197554
197670
|
return null;
|
|
197555
197671
|
const key = cssKebabCase(prop.name.text);
|
|
197556
197672
|
parts.push(`${key}:${prop.initializer.text}`);
|
|
@@ -197563,7 +197679,7 @@ function parseTemplateLiteral(expr, ctx) {
|
|
|
197563
197679
|
parts.push({ type: "string", value: expr.head.text });
|
|
197564
197680
|
}
|
|
197565
197681
|
for (const span of expr.templateSpans) {
|
|
197566
|
-
if (
|
|
197682
|
+
if (import_typescript13.default.isConditionalExpression(span.expression)) {
|
|
197567
197683
|
const ternary = parseTernary(span.expression, ctx);
|
|
197568
197684
|
if (ternary) {
|
|
197569
197685
|
parts.push(ternary);
|
|
@@ -197589,7 +197705,7 @@ function parseTemplateLiteral(expr, ctx) {
|
|
|
197589
197705
|
return parts;
|
|
197590
197706
|
}
|
|
197591
197707
|
function tryResolveTemplateSpanFromConst(expr, ctx) {
|
|
197592
|
-
if (
|
|
197708
|
+
if (import_typescript13.default.isIdentifier(expr)) {
|
|
197593
197709
|
if (ctx.scope.isBound(expr.text))
|
|
197594
197710
|
return null;
|
|
197595
197711
|
const constInfo = findLocalConst(expr.text, ctx.analyzer);
|
|
@@ -197598,13 +197714,13 @@ function tryResolveTemplateSpanFromConst(expr, ctx) {
|
|
|
197598
197714
|
const ast = parseConstInitializer(constInfo);
|
|
197599
197715
|
if (!ast)
|
|
197600
197716
|
return null;
|
|
197601
|
-
if (
|
|
197717
|
+
if (import_typescript13.default.isStringLiteral(ast) || import_typescript13.default.isNoSubstitutionTemplateLiteral(ast)) {
|
|
197602
197718
|
return [{ type: "string", value: ast.text }];
|
|
197603
197719
|
}
|
|
197604
197720
|
return null;
|
|
197605
197721
|
}
|
|
197606
|
-
if (
|
|
197607
|
-
if (!
|
|
197722
|
+
if (import_typescript13.default.isElementAccessExpression(expr)) {
|
|
197723
|
+
if (!import_typescript13.default.isIdentifier(expr.expression))
|
|
197608
197724
|
return null;
|
|
197609
197725
|
if (ctx.scope.isBound(expr.expression.text))
|
|
197610
197726
|
return null;
|
|
@@ -197612,17 +197728,17 @@ function tryResolveTemplateSpanFromConst(expr, ctx) {
|
|
|
197612
197728
|
if (!constInfo)
|
|
197613
197729
|
return null;
|
|
197614
197730
|
const ast = parseConstInitializer(constInfo);
|
|
197615
|
-
if (!ast || !
|
|
197731
|
+
if (!ast || !import_typescript13.default.isObjectLiteralExpression(ast))
|
|
197616
197732
|
return null;
|
|
197617
197733
|
const cases = {};
|
|
197618
197734
|
for (const prop of ast.properties) {
|
|
197619
|
-
if (!
|
|
197735
|
+
if (!import_typescript13.default.isPropertyAssignment(prop))
|
|
197620
197736
|
return null;
|
|
197621
|
-
const keyName = prop.name && (
|
|
197737
|
+
const keyName = prop.name && (import_typescript13.default.isStringLiteral(prop.name) || import_typescript13.default.isIdentifier(prop.name)) ? prop.name.text : null;
|
|
197622
197738
|
if (!keyName)
|
|
197623
197739
|
return null;
|
|
197624
197740
|
const value = prop.initializer;
|
|
197625
|
-
if (
|
|
197741
|
+
if (import_typescript13.default.isStringLiteral(value) || import_typescript13.default.isNoSubstitutionTemplateLiteral(value)) {
|
|
197626
197742
|
cases[keyName] = value.text;
|
|
197627
197743
|
} else {
|
|
197628
197744
|
return null;
|
|
@@ -197669,17 +197785,17 @@ function hasDynamicTagBinding(name, sourceFile) {
|
|
|
197669
197785
|
const visit2 = (node) => {
|
|
197670
197786
|
if (found)
|
|
197671
197787
|
return;
|
|
197672
|
-
if (
|
|
197788
|
+
if (import_typescript13.default.isVariableDeclaration(node) && import_typescript13.default.isIdentifier(node.name) && node.name.text === name && node.initializer) {
|
|
197673
197789
|
let init = node.initializer;
|
|
197674
|
-
while (
|
|
197790
|
+
while (import_typescript13.default.isAsExpression(init) || import_typescript13.default.isSatisfiesExpression(init) || import_typescript13.default.isParenthesizedExpression(init) || import_typescript13.default.isNonNullExpression(init)) {
|
|
197675
197791
|
init = init.expression;
|
|
197676
197792
|
}
|
|
197677
|
-
if (
|
|
197793
|
+
if (import_typescript13.default.isPropertyAccessExpression(init) && init.name.text === "tag") {
|
|
197678
197794
|
found = true;
|
|
197679
197795
|
return;
|
|
197680
197796
|
}
|
|
197681
197797
|
}
|
|
197682
|
-
|
|
197798
|
+
import_typescript13.default.forEachChild(node, visit2);
|
|
197683
197799
|
};
|
|
197684
197800
|
visit2(sourceFile);
|
|
197685
197801
|
return found;
|
|
@@ -197693,13 +197809,13 @@ function tryResolveIdentifierAsTemplateLiteral(ident, ctx) {
|
|
|
197693
197809
|
const ast = parseConstInitializer(constInfo);
|
|
197694
197810
|
if (!ast)
|
|
197695
197811
|
return null;
|
|
197696
|
-
if (
|
|
197812
|
+
if (import_typescript13.default.isNoSubstitutionTemplateLiteral(ast) || import_typescript13.default.isStringLiteral(ast)) {
|
|
197697
197813
|
return [{ type: "string", value: ast.text }];
|
|
197698
197814
|
}
|
|
197699
|
-
if (
|
|
197815
|
+
if (import_typescript13.default.isElementAccessExpression(ast) && !import_typescript13.default.isStringLiteralLike(ast.argumentExpression) && !import_typescript13.default.isNumericLiteral(ast.argumentExpression)) {
|
|
197700
197816
|
return tryResolveTemplateSpanFromConst(ast, ctx);
|
|
197701
197817
|
}
|
|
197702
|
-
if (!
|
|
197818
|
+
if (!import_typescript13.default.isTemplateExpression(ast))
|
|
197703
197819
|
return null;
|
|
197704
197820
|
let resolvedAny = false;
|
|
197705
197821
|
const parts = [];
|
|
@@ -197737,14 +197853,14 @@ function parseConstInitializerImpl(c) {
|
|
|
197737
197853
|
if (!c.value)
|
|
197738
197854
|
return null;
|
|
197739
197855
|
const wrapped = `const __bf_resolve__ = (${c.value})`;
|
|
197740
|
-
const sf =
|
|
197856
|
+
const sf = import_typescript13.default.createSourceFile("__bf_resolve.ts", wrapped, import_typescript13.default.ScriptTarget.Latest, true, import_typescript13.default.ScriptKind.TS);
|
|
197741
197857
|
const stmt = sf.statements[0];
|
|
197742
|
-
if (!stmt || !
|
|
197858
|
+
if (!stmt || !import_typescript13.default.isVariableStatement(stmt))
|
|
197743
197859
|
return null;
|
|
197744
197860
|
const decl = stmt.declarationList.declarations[0];
|
|
197745
197861
|
if (!decl?.initializer)
|
|
197746
197862
|
return null;
|
|
197747
|
-
return
|
|
197863
|
+
return import_typescript13.default.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
|
|
197748
197864
|
}
|
|
197749
197865
|
function astText(node) {
|
|
197750
197866
|
return node.getText(node.getSourceFile());
|
|
@@ -197764,9 +197880,9 @@ function parseFunctionInfoAsExprImpl(fn) {
|
|
|
197764
197880
|
const params = fn.typedParams !== undefined ? fn.typedParams : fn.params.map(formatParamWithType).join(", ");
|
|
197765
197881
|
const body = fn.typedBody ?? fn.body;
|
|
197766
197882
|
const wrapped = `const __bf_resolve_fn__ = function(${params}) ${body}`;
|
|
197767
|
-
const sf =
|
|
197883
|
+
const sf = import_typescript13.default.createSourceFile("__bf_resolve_fn.ts", wrapped, import_typescript13.default.ScriptTarget.Latest, true, import_typescript13.default.ScriptKind.TS);
|
|
197768
197884
|
const stmt = sf.statements[0];
|
|
197769
|
-
if (!stmt || !
|
|
197885
|
+
if (!stmt || !import_typescript13.default.isVariableStatement(stmt))
|
|
197770
197886
|
return null;
|
|
197771
197887
|
const decl = stmt.declarationList.declarations[0];
|
|
197772
197888
|
if (!decl?.initializer)
|
|
@@ -197774,9 +197890,9 @@ function parseFunctionInfoAsExprImpl(fn) {
|
|
|
197774
197890
|
return decl.initializer;
|
|
197775
197891
|
}
|
|
197776
197892
|
function tryDesugarInterleaveTaggedTemplate(expr, ctx) {
|
|
197777
|
-
if (!
|
|
197893
|
+
if (!import_typescript13.default.isTaggedTemplateExpression(expr))
|
|
197778
197894
|
return expr;
|
|
197779
|
-
if (!
|
|
197895
|
+
if (!import_typescript13.default.isIdentifier(expr.tag))
|
|
197780
197896
|
return expr;
|
|
197781
197897
|
const resolvedTag = resolveInterleaveTagIdentifier(expr.tag.text, ctx);
|
|
197782
197898
|
if (!resolvedTag)
|
|
@@ -197793,23 +197909,23 @@ function resolveInterleaveTagIdentifier(name, ctx) {
|
|
|
197793
197909
|
return null;
|
|
197794
197910
|
if (constInfo) {
|
|
197795
197911
|
const ast = parseConstInitializer(constInfo);
|
|
197796
|
-
return ast && (
|
|
197912
|
+
return ast && (import_typescript13.default.isArrowFunction(ast) || import_typescript13.default.isFunctionExpression(ast)) ? ast : null;
|
|
197797
197913
|
}
|
|
197798
197914
|
if (fnInfo) {
|
|
197799
197915
|
const ast = parseFunctionInfoAsExpr(fnInfo);
|
|
197800
|
-
return ast && (
|
|
197916
|
+
return ast && (import_typescript13.default.isArrowFunction(ast) || import_typescript13.default.isFunctionExpression(ast)) ? ast : null;
|
|
197801
197917
|
}
|
|
197802
197918
|
return null;
|
|
197803
197919
|
}
|
|
197804
197920
|
function isInterleaveTagFunction(fn) {
|
|
197805
|
-
if (!
|
|
197921
|
+
if (!import_typescript13.default.isArrowFunction(fn) && !import_typescript13.default.isFunctionExpression(fn))
|
|
197806
197922
|
return false;
|
|
197807
197923
|
if (fn.parameters.length !== 2)
|
|
197808
197924
|
return false;
|
|
197809
197925
|
const [partsParam, argsParam] = fn.parameters;
|
|
197810
|
-
if (!
|
|
197926
|
+
if (!import_typescript13.default.isIdentifier(partsParam.name) || partsParam.dotDotDotToken)
|
|
197811
197927
|
return false;
|
|
197812
|
-
if (!
|
|
197928
|
+
if (!import_typescript13.default.isIdentifier(argsParam.name) || !argsParam.dotDotDotToken)
|
|
197813
197929
|
return false;
|
|
197814
197930
|
const parsed = tsNodeToParsedExpr(fn);
|
|
197815
197931
|
if (parsed.kind !== "arrow")
|
|
@@ -197866,7 +197982,7 @@ function isInterleaveSpanExpr(expr, i2, argsName) {
|
|
|
197866
197982
|
function buildUntaggedTemplateLiteral(node, ctx) {
|
|
197867
197983
|
const template = node.template;
|
|
197868
197984
|
let text;
|
|
197869
|
-
if (
|
|
197985
|
+
if (import_typescript13.default.isNoSubstitutionTemplateLiteral(template)) {
|
|
197870
197986
|
text = "`" + (template.rawText ?? template.text) + "`";
|
|
197871
197987
|
} else {
|
|
197872
197988
|
let body = template.head.rawText ?? template.head.text;
|
|
@@ -197878,15 +197994,15 @@ function buildUntaggedTemplateLiteral(node, ctx) {
|
|
|
197878
197994
|
text = "`" + body + "`";
|
|
197879
197995
|
}
|
|
197880
197996
|
const wrapped = `const __bf_resolve_tagged__ = (${text})`;
|
|
197881
|
-
const sf =
|
|
197997
|
+
const sf = import_typescript13.default.createSourceFile("__bf_resolve_tagged.tsx", wrapped, import_typescript13.default.ScriptTarget.Latest, true, import_typescript13.default.ScriptKind.TSX);
|
|
197882
197998
|
const stmt = sf.statements[0];
|
|
197883
|
-
if (!stmt || !
|
|
197999
|
+
if (!stmt || !import_typescript13.default.isVariableStatement(stmt))
|
|
197884
198000
|
return null;
|
|
197885
198001
|
const decl = stmt.declarationList.declarations[0];
|
|
197886
198002
|
if (!decl?.initializer)
|
|
197887
198003
|
return null;
|
|
197888
|
-
const result =
|
|
197889
|
-
if (!
|
|
198004
|
+
const result = import_typescript13.default.isParenthesizedExpression(decl.initializer) ? decl.initializer.expression : decl.initializer;
|
|
198005
|
+
if (!import_typescript13.default.isTemplateExpression(result) && !import_typescript13.default.isNoSubstitutionTemplateLiteral(result))
|
|
197890
198006
|
return null;
|
|
197891
198007
|
return result;
|
|
197892
198008
|
}
|
|
@@ -197906,10 +198022,10 @@ function parseTernary(expr, ctx) {
|
|
|
197906
198022
|
return null;
|
|
197907
198023
|
}
|
|
197908
198024
|
function getStringValue(node) {
|
|
197909
|
-
if (
|
|
198025
|
+
if (import_typescript13.default.isStringLiteral(node)) {
|
|
197910
198026
|
return node.text;
|
|
197911
198027
|
}
|
|
197912
|
-
if (
|
|
198028
|
+
if (import_typescript13.default.isNoSubstitutionTemplateLiteral(node)) {
|
|
197913
198029
|
return node.text;
|
|
197914
198030
|
}
|
|
197915
198031
|
return null;
|
|
@@ -197917,19 +198033,19 @@ function getStringValue(node) {
|
|
|
197917
198033
|
function processComponentProps(attributes, ctx) {
|
|
197918
198034
|
const props = [];
|
|
197919
198035
|
for (const attr of attributes.properties) {
|
|
197920
|
-
if (
|
|
198036
|
+
if (import_typescript13.default.isJsxSpreadAttribute(attr)) {
|
|
197921
198037
|
props.push(...expandSpreadAttribute(attr, ctx));
|
|
197922
198038
|
continue;
|
|
197923
198039
|
}
|
|
197924
|
-
if (!
|
|
198040
|
+
if (!import_typescript13.default.isJsxAttribute(attr))
|
|
197925
198041
|
continue;
|
|
197926
198042
|
const name = attr.name.getText(ctx.sourceFile);
|
|
197927
|
-
if (attr.initializer &&
|
|
198043
|
+
if (attr.initializer && import_typescript13.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
197928
198044
|
let jsxExpr = attr.initializer.expression;
|
|
197929
|
-
while (
|
|
198045
|
+
while (import_typescript13.default.isParenthesizedExpression(jsxExpr)) {
|
|
197930
198046
|
jsxExpr = jsxExpr.expression;
|
|
197931
198047
|
}
|
|
197932
|
-
if (
|
|
198048
|
+
if (import_typescript13.default.isJsxElement(jsxExpr) || import_typescript13.default.isJsxSelfClosingElement(jsxExpr) || import_typescript13.default.isJsxFragment(jsxExpr)) {
|
|
197933
198049
|
const prevInsideComponentChildren = ctx.insideComponentChildren;
|
|
197934
198050
|
ctx.insideComponentChildren = true;
|
|
197935
198051
|
const irNode = transformNode(jsxExpr, ctx);
|
|
@@ -197956,7 +198072,7 @@ function processComponentProps(attributes, ctx) {
|
|
|
197956
198072
|
value = AttrValueOf.booleanShorthand();
|
|
197957
198073
|
}
|
|
197958
198074
|
let clientOnly;
|
|
197959
|
-
if (attr.initializer &&
|
|
198075
|
+
if (attr.initializer && import_typescript13.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
|
|
197960
198076
|
if (value.kind === "expression" && value.templateExpr === undefined) {
|
|
197961
198077
|
const rewritten = rewriteBarePropRefs2(value.expr, attr.initializer.expression, ctx);
|
|
197962
198078
|
if (rewritten !== value.expr) {
|
|
@@ -197980,7 +198096,7 @@ function processComponentProps(attributes, ctx) {
|
|
|
197980
198096
|
return props;
|
|
197981
198097
|
}
|
|
197982
198098
|
function checkBareSignalOrMemoIdentifier(expr, ctx) {
|
|
197983
|
-
if (!
|
|
198099
|
+
if (!import_typescript13.default.isIdentifier(expr))
|
|
197984
198100
|
return;
|
|
197985
198101
|
const name = expr.text;
|
|
197986
198102
|
for (const signal of ctx.analyzer.signals) {
|
|
@@ -198011,12 +198127,12 @@ function checkBareSignalOrMemoIdentifier(expr, ctx) {
|
|
|
198011
198127
|
function isArrayExprDirectPropRef(arrayExpr, ctx) {
|
|
198012
198128
|
const propNames = new Set(ctx.patterns.props.map((p) => p.name));
|
|
198013
198129
|
const propsObjName = ctx.analyzer.propsObjectName;
|
|
198014
|
-
if (
|
|
198130
|
+
if (import_typescript13.default.isIdentifier(arrayExpr)) {
|
|
198015
198131
|
return propNames.has(arrayExpr.text);
|
|
198016
198132
|
}
|
|
198017
|
-
if (
|
|
198133
|
+
if (import_typescript13.default.isPropertyAccessExpression(arrayExpr) && propsObjName) {
|
|
198018
198134
|
const obj = arrayExpr.expression;
|
|
198019
|
-
if (
|
|
198135
|
+
if (import_typescript13.default.isIdentifier(obj) && obj.text === propsObjName) {
|
|
198020
198136
|
return true;
|
|
198021
198137
|
}
|
|
198022
198138
|
}
|
|
@@ -198038,7 +198154,7 @@ function referencesLoopParam(expr, ctx) {
|
|
|
198038
198154
|
if (boundNames.size === 0)
|
|
198039
198155
|
return false;
|
|
198040
198156
|
for (const p of boundNames) {
|
|
198041
|
-
if (
|
|
198157
|
+
if (identifierPattern(p).test(expr))
|
|
198042
198158
|
return true;
|
|
198043
198159
|
}
|
|
198044
198160
|
return false;
|
|
@@ -198120,7 +198236,7 @@ function hasReactiveAttributes(attrs, ctx) {
|
|
|
198120
198236
|
const scopeValueNames = ctx.scope.valueBoundNames();
|
|
198121
198237
|
if (scopeValueNames.size > 0) {
|
|
198122
198238
|
for (const p of scopeValueNames) {
|
|
198123
|
-
if (
|
|
198239
|
+
if (identifierPattern(p).test(valueToCheck))
|
|
198124
198240
|
return true;
|
|
198125
198241
|
}
|
|
198126
198242
|
}
|
|
@@ -198211,7 +198327,7 @@ function buildIfStatementChain(analyzer, ctx, opts) {
|
|
|
198211
198327
|
jsxBranchLocalNames.add(n);
|
|
198212
198328
|
}
|
|
198213
198329
|
for (const decl of condReturn.scopeVariables) {
|
|
198214
|
-
if (
|
|
198330
|
+
if (import_typescript13.default.isIdentifier(decl.name) && decl.initializer) {
|
|
198215
198331
|
branchScopeVars.set(decl.name.text, decl.initializer);
|
|
198216
198332
|
if (initializerShapeContainsJsx(decl.initializer)) {
|
|
198217
198333
|
jsxBranchLocalNames.add(decl.name.text);
|
|
@@ -198278,7 +198394,7 @@ function buildIfStatementChain(analyzer, ctx, opts) {
|
|
|
198278
198394
|
}
|
|
198279
198395
|
const scopeVariables = [];
|
|
198280
198396
|
for (const decl of condReturn.scopeVariables) {
|
|
198281
|
-
if (
|
|
198397
|
+
if (import_typescript13.default.isIdentifier(decl.name) && decl.initializer) {
|
|
198282
198398
|
const init = ctx.getJS(decl.initializer);
|
|
198283
198399
|
const typedInit = decl.initializer.getText(ctx.sourceFile);
|
|
198284
198400
|
scopeVariables.push({
|
|
@@ -198416,13 +198532,13 @@ var KEYWORDS_AND_GLOBALS = new Set([
|
|
|
198416
198532
|
]);
|
|
198417
198533
|
|
|
198418
198534
|
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
198419
|
-
var
|
|
198535
|
+
var import_typescript14 = __toESM(require_typescript(), 1);
|
|
198420
198536
|
|
|
198421
198537
|
// ../jsx/src/value-references.ts
|
|
198422
|
-
var
|
|
198538
|
+
var import_typescript15 = __toESM(require_typescript(), 1);
|
|
198423
198539
|
|
|
198424
198540
|
// ../jsx/src/relocate.ts
|
|
198425
|
-
var
|
|
198541
|
+
var import_typescript16 = __toESM(require_typescript(), 1);
|
|
198426
198542
|
|
|
198427
198543
|
// ../jsx/src/lowering-registry.ts
|
|
198428
198544
|
var plugins = [];
|
|
@@ -198601,10 +198717,10 @@ function formatDateLocalNames(metadata) {
|
|
|
198601
198717
|
}
|
|
198602
198718
|
|
|
198603
198719
|
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
198604
|
-
var
|
|
198720
|
+
var import_typescript17 = __toESM(require_typescript(), 1);
|
|
198605
198721
|
|
|
198606
198722
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
198607
|
-
var
|
|
198723
|
+
var import_typescript18 = __toESM(require_typescript(), 1);
|
|
198608
198724
|
var NO_PREAMBLE = {
|
|
198609
198725
|
lazySafe: true,
|
|
198610
198726
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -198654,7 +198770,7 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
198654
198770
|
]);
|
|
198655
198771
|
|
|
198656
198772
|
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
198657
|
-
var
|
|
198773
|
+
var import_typescript19 = __toESM(require_typescript(), 1);
|
|
198658
198774
|
|
|
198659
198775
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
|
|
198660
198776
|
var NON_BUBBLING_EVENTS = new Set([
|
|
@@ -198669,7 +198785,7 @@ var NON_BUBBLING_EVENTS = new Set([
|
|
|
198669
198785
|
]);
|
|
198670
198786
|
|
|
198671
198787
|
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
198672
|
-
var
|
|
198788
|
+
var import_typescript20 = __toESM(require_typescript(), 1);
|
|
198673
198789
|
|
|
198674
198790
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
198675
198791
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -198760,21 +198876,21 @@ class SourceMapGenerator {
|
|
|
198760
198876
|
}
|
|
198761
198877
|
|
|
198762
198878
|
// ../jsx/src/preprocess-inline-jsx-callbacks.ts
|
|
198763
|
-
var
|
|
198879
|
+
var import_typescript21 = __toESM(require_typescript(), 1);
|
|
198764
198880
|
|
|
198765
198881
|
// ../jsx/src/ssr-defaults.ts
|
|
198766
|
-
var
|
|
198882
|
+
var import_typescript22 = __toESM(require_typescript(), 1);
|
|
198767
198883
|
var UNRESOLVED = Symbol("unresolved");
|
|
198768
198884
|
var NO_RETURN = Symbol("no-return");
|
|
198769
198885
|
|
|
198770
198886
|
// ../jsx/src/augment-inherited-props.ts
|
|
198771
|
-
var
|
|
198887
|
+
var import_typescript23 = __toESM(require_typescript(), 1);
|
|
198772
198888
|
|
|
198773
198889
|
// ../jsx/src/rich-type-refusal.ts
|
|
198774
198890
|
var EMPTY_BINDINGS2 = new Map;
|
|
198775
198891
|
// ../jsx/src/shared-program.ts
|
|
198776
198892
|
init_path();
|
|
198777
|
-
var
|
|
198893
|
+
var import_typescript25 = __toESM(require_typescript(), 1);
|
|
198778
198894
|
// ../jsx/src/adapters/interface.ts
|
|
198779
198895
|
class BaseAdapter {
|
|
198780
198896
|
renderChildren(children) {
|
|
@@ -198827,7 +198943,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
198827
198943
|
...localFunctions.map((f) => ({ name: f.name, body: f.body })),
|
|
198828
198944
|
...localConstants.map((c) => ({ name: c.name, body: c.value }))
|
|
198829
198945
|
];
|
|
198830
|
-
const reachable =
|
|
198946
|
+
const reachable = closeOverWritersOfMutableBindings(primaryRefText, declarations, new Set(ir.metadata.localConstants.filter((c) => (c.declarationKind ?? "const") !== "const").map((c) => c.name)));
|
|
198831
198947
|
const reachableBodies = [...reachable].map((name) => {
|
|
198832
198948
|
const func = localFunctions.find((f) => f.name === name);
|
|
198833
198949
|
if (func)
|
|
@@ -198857,9 +198973,10 @@ class JsxAdapter extends BaseAdapter {
|
|
|
198857
198973
|
lines.push(` const ${signal.getter} = () => ${initialValue}`);
|
|
198858
198974
|
}
|
|
198859
198975
|
if (signal.setter) {
|
|
198860
|
-
const setterUsed =
|
|
198976
|
+
const setterUsed = identifierPattern(signal.setter).test(setterRefText);
|
|
198861
198977
|
if (setterUsed) {
|
|
198862
|
-
|
|
198978
|
+
const setterType = preserveTypes && signal.type.kind !== "unknown" ? `(valueOrFn: ${signal.type.raw} | ((prev: ${signal.type.raw}) => ${signal.type.raw})) => void` : null;
|
|
198979
|
+
lines.push(setterType ? ` const ${signal.setter}: ${setterType} = () => {}` : ` const ${signal.setter} = (..._args: any[]) => {}`);
|
|
198863
198980
|
}
|
|
198864
198981
|
}
|
|
198865
198982
|
}
|
|
@@ -199055,6 +199172,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
199055
199172
|
}
|
|
199056
199173
|
|
|
199057
199174
|
// ../jsx/src/adapters/template-imports.ts
|
|
199175
|
+
var import_typescript26 = __toESM(require_typescript(), 1);
|
|
199058
199176
|
var CLIENT_PACKAGE_SOURCES = new Set([
|
|
199059
199177
|
"@barefootjs/client",
|
|
199060
199178
|
"@barefootjs/client/runtime"
|
|
@@ -199193,7 +199311,8 @@ export default ${this.componentName}` : "";
|
|
|
199193
199311
|
const noArgDefault = hasRequiredProps ? "" : ` = {} as ${propsTypeExpr}`;
|
|
199194
199312
|
const lines = [];
|
|
199195
199313
|
const exportPrefix = ir.metadata.isExported === false ? "" : "export ";
|
|
199196
|
-
|
|
199314
|
+
const typeParameters = ir.metadata.typeParameters ?? "";
|
|
199315
|
+
lines.push(`${exportPrefix}function ${name}${typeParameters}(${fullPropsDestructure}${typeAnnotation}${noArgDefault}) {`);
|
|
199197
199316
|
if (hasClientInteractivity) {
|
|
199198
199317
|
lines.push(` const __scopeId = (/_s\\d/.test(__bfScope || '') ? __bfScope : null) || __instanceId || \`${name}_\${Math.random().toString(36).slice(2, 8)}\``);
|
|
199199
199318
|
} else {
|
|
@@ -199444,9 +199563,9 @@ function registerBuiltinLoweringPlugins() {
|
|
|
199444
199563
|
registerLoweringPlugin(plugin);
|
|
199445
199564
|
}
|
|
199446
199565
|
// ../jsx/src/combine-client-js.ts
|
|
199447
|
-
var
|
|
199566
|
+
var import_typescript27 = __toESM(require_typescript(), 1);
|
|
199448
199567
|
// ../jsx/src/debug.ts
|
|
199449
|
-
var
|
|
199568
|
+
var import_typescript28 = __toESM(require_typescript(), 1);
|
|
199450
199569
|
function escapeForIdBoundary(name) {
|
|
199451
199570
|
return name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
199452
199571
|
}
|
|
@@ -199538,7 +199657,7 @@ function resolveSetters(handler, setterToSignal, fnSetters) {
|
|
|
199538
199657
|
return refs;
|
|
199539
199658
|
}
|
|
199540
199659
|
// ../jsx/src/profiler.ts
|
|
199541
|
-
var
|
|
199660
|
+
var import_typescript29 = __toESM(require_typescript(), 1);
|
|
199542
199661
|
|
|
199543
199662
|
// ../jsx/src/index.ts
|
|
199544
199663
|
registerBuiltinLoweringPlugins();
|