what-compiler 0.13.11 → 0.15.0
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/LICENSE +21 -0
- package/README.md +181 -2
- package/babel.d.ts +78 -2
- package/dist/babel/auto-selector.min.js +94 -0
- package/dist/babel/common.min.js +2053 -0
- package/dist/babel/dev-metadata.min.js +106 -0
- package/dist/babel/dom.min.js +1669 -0
- package/dist/babel/jsx-root.min.js +13 -0
- package/dist/babel/lists.min.js +492 -0
- package/dist/babel/nesting.min.js +328 -0
- package/dist/babel/reactivity.min.js +1218 -0
- package/dist/babel/server-actions.min.js +85 -0
- package/dist/babel/ssr.min.js +496 -0
- package/dist/babel/types.min.js +9 -0
- package/dist/babel-plugin.min.js +101 -1
- package/dist/file-router.min.js +368 -12
- package/dist/framework-files.min.js +62 -0
- package/dist/hot.min.js +315 -0
- package/dist/index.min.js +13 -414
- package/dist/release.min.js +78 -0
- package/dist/runtime.min.js +9 -1
- package/dist/tables/import-changes.min.js +272 -0
- package/dist/tables/markup-rules.min.js +213 -0
- package/dist/vite-plugin.min.js +432 -399
- package/file-router.d.ts +3 -1
- package/index.d.ts +1 -1
- package/package.json +11 -2
- package/runtime.d.ts +2 -1
- package/src/babel/auto-selector.js +248 -0
- package/src/babel/common.js +3800 -0
- package/src/babel/dev-metadata.js +167 -0
- package/src/babel/dom.js +3386 -0
- package/src/babel/jsx-root.js +27 -0
- package/src/babel/lists.js +704 -0
- package/src/babel/nesting.js +260 -0
- package/src/babel/reactivity.js +1998 -0
- package/src/babel/server-actions.js +144 -0
- package/src/babel/ssr.js +870 -0
- package/src/babel/types.js +10 -0
- package/src/babel-plugin.js +185 -3598
- package/src/file-router.js +58 -38
- package/src/framework-files.js +106 -0
- package/src/hot.js +523 -0
- package/src/release.js +127 -0
- package/src/runtime.js +7 -7
- package/src/tables/import-changes.js +157 -0
- package/src/tables/markup-rules.js +388 -0
- package/src/vite-plugin.js +460 -175
- package/vite.d.ts +47 -3
- package/src/error-overlay.js +0 -428
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/babel/jsx-root.js
|
|
2
|
+
import { annotateNamespaces as a } from "./common.min.js";
|
|
3
|
+
import { collectSignalNamesFromScope as c } from "./reactivity.min.js";
|
|
4
|
+
import { validateNesting as m } from "./nesting.min.js";
|
|
5
|
+
function N(e, o) {
|
|
6
|
+
let s = e.scope, n = o._signalNamesCache;
|
|
7
|
+
n || (n = o._signalNamesCache = /* @__PURE__ */ new WeakMap());
|
|
8
|
+
let i = n.get(s);
|
|
9
|
+
i || (i = c(e), n.set(s, i)), o.signalNames = i, o._jsxScope = s, e.node._whatNs === void 0 && a(e.node), m(e.node, o);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
N as enterJsxRoot
|
|
13
|
+
};
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
// src/babel/lists.js
|
|
2
|
+
import { t as r } from "./types.min.js";
|
|
3
|
+
import { controlFlowTag as C, getAttrName as S, getAttributeValue as k, helper as A, uniqueName as N } from "./common.min.js";
|
|
4
|
+
import { isPotentiallyReactive as j, isSignalIdentifier as P } from "./reactivity.min.js";
|
|
5
|
+
function x(i, n) {
|
|
6
|
+
if (!i || typeof i != "object") return n;
|
|
7
|
+
switch (i.type) {
|
|
8
|
+
case "Identifier":
|
|
9
|
+
n.add(i.name);
|
|
10
|
+
break;
|
|
11
|
+
case "AssignmentPattern":
|
|
12
|
+
x(i.left, n);
|
|
13
|
+
break;
|
|
14
|
+
case "RestElement":
|
|
15
|
+
x(i.argument, n);
|
|
16
|
+
break;
|
|
17
|
+
case "ArrayPattern":
|
|
18
|
+
for (let u of i.elements) x(u, n);
|
|
19
|
+
break;
|
|
20
|
+
case "ObjectPattern":
|
|
21
|
+
for (let u of i.properties)
|
|
22
|
+
x(u.type === "RestElement" ? u.argument : u.value, n);
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
return n;
|
|
28
|
+
}
|
|
29
|
+
function R(i) {
|
|
30
|
+
let n = /* @__PURE__ */ new Set();
|
|
31
|
+
for (let s = 1; s < i.params.length; s++) x(i.params[s], n);
|
|
32
|
+
let u = (s) => {
|
|
33
|
+
if (!(!s || typeof s != "object")) {
|
|
34
|
+
if (Array.isArray(s)) {
|
|
35
|
+
s.forEach(u);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
switch (s.type) {
|
|
39
|
+
case "VariableDeclaration":
|
|
40
|
+
for (let a of s.declarations) x(a.id, n);
|
|
41
|
+
return;
|
|
42
|
+
case "FunctionDeclaration":
|
|
43
|
+
case "ClassDeclaration":
|
|
44
|
+
s.id && n.add(s.id.name);
|
|
45
|
+
return;
|
|
46
|
+
// body is its own scope
|
|
47
|
+
case "FunctionExpression":
|
|
48
|
+
case "ArrowFunctionExpression":
|
|
49
|
+
case "ClassExpression":
|
|
50
|
+
return;
|
|
51
|
+
// own scope
|
|
52
|
+
case "CatchClause":
|
|
53
|
+
x(s.param, n), u(s.body);
|
|
54
|
+
return;
|
|
55
|
+
case "ForStatement":
|
|
56
|
+
case "ForInStatement":
|
|
57
|
+
case "ForOfStatement":
|
|
58
|
+
u(s.init), u(s.left), u(s.body);
|
|
59
|
+
return;
|
|
60
|
+
default:
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
for (let a of Object.keys(s)) {
|
|
64
|
+
if (a === "loc" || a === "start" || a === "end" || a === "type" || a === "leadingComments" || a === "trailingComments" || a === "innerComments") continue;
|
|
65
|
+
let l = s[a];
|
|
66
|
+
l && typeof l == "object" && u(l);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
r.isBlockStatement(i.body) && u(i.body.body);
|
|
71
|
+
for (let s of x(i.params[0], /* @__PURE__ */ new Set())) n.delete(s);
|
|
72
|
+
return n;
|
|
73
|
+
}
|
|
74
|
+
function w(i, n) {
|
|
75
|
+
if (n.size === 0) return null;
|
|
76
|
+
let u = null, s = (a) => {
|
|
77
|
+
if (!(u || !a || typeof a != "object")) {
|
|
78
|
+
if (Array.isArray(a)) {
|
|
79
|
+
a.forEach(s);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (a.type === "Identifier") {
|
|
83
|
+
n.has(a.name) && (u = a.name);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
for (let l of Object.keys(a)) {
|
|
87
|
+
if (l === "loc" || l === "start" || l === "end" || l === "type" || l === "leadingComments" || l === "trailingComments" || l === "innerComments" || a.type === "MemberExpression" && l === "property" && !a.computed || (a.type === "ObjectProperty" || a.type === "ObjectMethod") && l === "key" && !a.computed) continue;
|
|
88
|
+
let e = a[l];
|
|
89
|
+
e && typeof e == "object" && s(e);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return s(i), u;
|
|
94
|
+
}
|
|
95
|
+
function K(i, n, u) {
|
|
96
|
+
if (!r.isCallExpression(i) && !(r.isOptionalCallExpression(i) && !i.optional)) return null;
|
|
97
|
+
let s = i.callee;
|
|
98
|
+
if (!r.isMemberExpression(s) && !r.isOptionalMemberExpression(s) || s.computed || !r.isIdentifier(s.property, { name: "map" }) || i.arguments.length < 1) return null;
|
|
99
|
+
let a = i.arguments[0];
|
|
100
|
+
if (!r.isArrowFunctionExpression(a) && !r.isFunctionExpression(a)) return null;
|
|
101
|
+
O(a, n);
|
|
102
|
+
let l = null;
|
|
103
|
+
if (r.isArrowFunctionExpression(a)) {
|
|
104
|
+
if (r.isExpression(a.body))
|
|
105
|
+
l = a.body;
|
|
106
|
+
else if (r.isBlockStatement(a.body)) {
|
|
107
|
+
let o = a.body.body.find((p) => r.isReturnStatement(p));
|
|
108
|
+
o && (l = o.argument);
|
|
109
|
+
}
|
|
110
|
+
} else if (r.isFunctionExpression(a)) {
|
|
111
|
+
let o = a.body.body.find((p) => r.isReturnStatement(p));
|
|
112
|
+
o && (l = o.argument);
|
|
113
|
+
}
|
|
114
|
+
if (!l || !r.isJSXElement(l)) return null;
|
|
115
|
+
let e = l.openingElement.attributes, c = null;
|
|
116
|
+
for (let o of e)
|
|
117
|
+
if (r.isJSXAttribute(o) && S(o) === "key") {
|
|
118
|
+
c = o;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
if (!u) return { mapFn: a, returnExpr: l, keyAttr: c, keyValue: c ? k(c.value) : null };
|
|
122
|
+
if (!c)
|
|
123
|
+
return null;
|
|
124
|
+
let t = k(c.value);
|
|
125
|
+
if (!t) return null;
|
|
126
|
+
let f = d(a);
|
|
127
|
+
return w(t, f) ? null : { mapFn: a, returnExpr: l, keyAttr: c, keyValue: t };
|
|
128
|
+
}
|
|
129
|
+
function $(i, n, u, s, a) {
|
|
130
|
+
let l = I(i, n);
|
|
131
|
+
if (l === null || l.length === 0) return !1;
|
|
132
|
+
let e = i.params[0].name;
|
|
133
|
+
for (let [c, t, f] of l) {
|
|
134
|
+
let b = u();
|
|
135
|
+
b._whatRowItem = !0;
|
|
136
|
+
let o = f !== void 0 ? [r.identifier(s), r.stringLiteral(f)] : [r.identifier(s)], p = r.callExpression(b, o);
|
|
137
|
+
p._whatRowItemName = e, c[t] = p;
|
|
138
|
+
}
|
|
139
|
+
return i.params = [r.identifier(s), i.params[1] || r.identifier(a), i.params[0]], !0;
|
|
140
|
+
}
|
|
141
|
+
function J(i) {
|
|
142
|
+
let n = i;
|
|
143
|
+
for (; r.isMemberExpression(n) || r.isOptionalMemberExpression(n); ) {
|
|
144
|
+
if (n.computed && !r.isStringLiteral(n.property) && !r.isNumericLiteral(n.property)) return null;
|
|
145
|
+
n = n.object;
|
|
146
|
+
}
|
|
147
|
+
return r.isCallExpression(n) && n.callee._whatRowItem === !0 || r.isIdentifier(n) && n._whatRowItem === !0 ? n : null;
|
|
148
|
+
}
|
|
149
|
+
function M(i, n, u) {
|
|
150
|
+
if (i === n) return u;
|
|
151
|
+
let s = r.cloneNode(i, !1);
|
|
152
|
+
return s.object = M(i.object, n, u), s;
|
|
153
|
+
}
|
|
154
|
+
function X(i, n) {
|
|
155
|
+
let u = I(i, n);
|
|
156
|
+
if (u !== null) for (let [s, a] of u) s[a]._whatRowItem = !0;
|
|
157
|
+
}
|
|
158
|
+
function B(i, n) {
|
|
159
|
+
return i.params.length > 0 && I(i, n) === null;
|
|
160
|
+
}
|
|
161
|
+
function O(i, n) {
|
|
162
|
+
let u = i.params[0];
|
|
163
|
+
if (!r.isObjectPattern(u)) return;
|
|
164
|
+
let s = /* @__PURE__ */ new Map(), a = [], l = null, e = (o, p) => {
|
|
165
|
+
let m = null;
|
|
166
|
+
if (r.isAssignmentPattern(o) && (m = o.right, o = o.left, !(r.isStringLiteral(m) || r.isNumericLiteral(m) || r.isBooleanLiteral(m) || r.isNullLiteral(m) || r.isTemplateLiteral(m) && m.expressions.length === 0)))
|
|
167
|
+
return !1;
|
|
168
|
+
if (r.isObjectPattern(o)) return m === null && c(o, p, !1);
|
|
169
|
+
if (!r.isIdentifier(o) || s.has(o.name)) return !1;
|
|
170
|
+
let y = (h) => p.reduce((v, E) => r.memberExpression(v, r.isValidIdentifier(E) ? r.identifier(E) : r.stringLiteral(E), !r.isValidIdentifier(E)), h);
|
|
171
|
+
return s.set(o.name, m === null ? y : (h) => r.conditionalExpression(r.binaryExpression("===", y(h), r.unaryExpression("void", r.numericLiteral(0))), r.cloneNode(m), y(h))), !0;
|
|
172
|
+
}, c = (o, p, m) => {
|
|
173
|
+
for (let y of o.properties) {
|
|
174
|
+
if (r.isRestElement(y)) {
|
|
175
|
+
if (!m || !r.isIdentifier(y.argument)) return !1;
|
|
176
|
+
l = y.argument;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
let h = r.isIdentifier(y.key) && !y.computed ? y.key.name : r.isStringLiteral(y.key) ? y.key.value : null;
|
|
180
|
+
if (h === null || (m && a.push(h), !e(y.value, [...p, h]))) return !1;
|
|
181
|
+
}
|
|
182
|
+
return !0;
|
|
183
|
+
};
|
|
184
|
+
if (!c(u, [], !0)) return;
|
|
185
|
+
let t = new Set(s.keys());
|
|
186
|
+
l !== null && t.add(l.name);
|
|
187
|
+
let f = T(i, t);
|
|
188
|
+
if (f === null) return;
|
|
189
|
+
let b = N(n, "_row$");
|
|
190
|
+
for (let [o, p, m] of f) {
|
|
191
|
+
let y = s.get(m);
|
|
192
|
+
y !== void 0 && (o[p] = y(r.identifier(b)));
|
|
193
|
+
}
|
|
194
|
+
if (i.params[0] = r.identifier(b), l !== null) {
|
|
195
|
+
let o = n.ssr ? n.file.addHelper("objectWithoutProperties") : A(n, "_$omit"), p = r.variableDeclaration("const", [r.variableDeclarator(
|
|
196
|
+
r.identifier(l.name),
|
|
197
|
+
r.callExpression(o, [r.identifier(b), r.arrayExpression(a.map((m) => r.stringLiteral(m)))])
|
|
198
|
+
)]);
|
|
199
|
+
r.isBlockStatement(i.body) || (i.body = r.blockStatement([r.returnStatement(i.body)])), i.body.body.unshift(p);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function T(i, n) {
|
|
203
|
+
let u = [], s = !1, a = (e) => [...x(e, /* @__PURE__ */ new Set())].some((c) => n.has(c)), l = (e, c, t) => {
|
|
204
|
+
if (!(s || !e || typeof e != "object")) {
|
|
205
|
+
if (Array.isArray(e)) {
|
|
206
|
+
for (let f = 0; f < e.length; f++) l(e[f], e, f);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (typeof e.type == "string") {
|
|
210
|
+
switch (e.type) {
|
|
211
|
+
case "Identifier":
|
|
212
|
+
n.has(e.name) && u.push([c, t, e.name]);
|
|
213
|
+
return;
|
|
214
|
+
case "JSXIdentifier":
|
|
215
|
+
n.has(e.name) && (s = !0);
|
|
216
|
+
return;
|
|
217
|
+
case "JSXAttribute":
|
|
218
|
+
l(e.value, e, "value");
|
|
219
|
+
return;
|
|
220
|
+
case "MemberExpression":
|
|
221
|
+
case "OptionalMemberExpression":
|
|
222
|
+
l(e.object, e, "object"), e.computed && l(e.property, e, "property");
|
|
223
|
+
return;
|
|
224
|
+
case "ObjectProperty":
|
|
225
|
+
e.computed && l(e.key, e, "key"), e.shorthand && r.isIdentifier(e.value) && n.has(e.value.name) && (e.shorthand = !1, e.value = r.cloneNode(e.value)), l(e.value, e, "value");
|
|
226
|
+
return;
|
|
227
|
+
case "ObjectMethod":
|
|
228
|
+
case "ClassMethod":
|
|
229
|
+
case "ClassPrivateMethod":
|
|
230
|
+
if (e.params.some(a)) {
|
|
231
|
+
s = !0;
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
e.computed && l(e.key, e, "key"), l(e.body, e, "body");
|
|
235
|
+
return;
|
|
236
|
+
case "ClassProperty":
|
|
237
|
+
case "ClassPrivateProperty":
|
|
238
|
+
e.computed && l(e.key, e, "key"), l(e.value, e, "value");
|
|
239
|
+
return;
|
|
240
|
+
case "FunctionExpression":
|
|
241
|
+
case "ArrowFunctionExpression":
|
|
242
|
+
case "FunctionDeclaration":
|
|
243
|
+
if (e.id && n.has(e.id.name) || e.params.some(a)) {
|
|
244
|
+
s = !0;
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
l(e.params, e, "params"), l(e.body, e, "body");
|
|
248
|
+
return;
|
|
249
|
+
case "ClassDeclaration":
|
|
250
|
+
case "ClassExpression":
|
|
251
|
+
if (e.id && n.has(e.id.name)) {
|
|
252
|
+
s = !0;
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
l(e.superClass, e, "superClass"), l(e.body, e, "body");
|
|
256
|
+
return;
|
|
257
|
+
case "VariableDeclarator":
|
|
258
|
+
if (a(e.id)) {
|
|
259
|
+
s = !0;
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
l(e.init, e, "init");
|
|
263
|
+
return;
|
|
264
|
+
case "CatchClause":
|
|
265
|
+
if (e.param && a(e.param)) {
|
|
266
|
+
s = !0;
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
l(e.body, e, "body");
|
|
270
|
+
return;
|
|
271
|
+
case "AssignmentExpression":
|
|
272
|
+
if (a(e.left)) {
|
|
273
|
+
s = !0;
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
277
|
+
case "UpdateExpression":
|
|
278
|
+
if (r.isIdentifier(e.argument) && n.has(e.argument.name)) {
|
|
279
|
+
s = !0;
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
case "LabeledStatement":
|
|
284
|
+
l(e.body, e, "body");
|
|
285
|
+
return;
|
|
286
|
+
case "BreakStatement":
|
|
287
|
+
case "ContinueStatement":
|
|
288
|
+
case "MetaProperty":
|
|
289
|
+
return;
|
|
290
|
+
default:
|
|
291
|
+
if (e.type.startsWith("TS") && e.type !== "TSAsExpression" && e.type !== "TSSatisfiesExpression" && e.type !== "TSNonNullExpression") return;
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
for (let f of Object.keys(e)) {
|
|
295
|
+
if (f === "loc" || f === "start" || f === "end" || f === "type" || f === "extra" || f === "typeAnnotation" || f === "returnType" || f === "typeParameters" || f === "leadingComments" || f === "trailingComments" || f === "innerComments") continue;
|
|
296
|
+
let b = e[f];
|
|
297
|
+
b && typeof b == "object" && l(b, e, f);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
for (let e = 1; e < i.params.length; e++) if (a(i.params[e])) return null;
|
|
303
|
+
return l(i.body, i, "body"), s ? null : u;
|
|
304
|
+
}
|
|
305
|
+
function W(i) {
|
|
306
|
+
return typeof i.start == "number" ? r.numericLiteral(i.start) : null;
|
|
307
|
+
}
|
|
308
|
+
function F(i, n) {
|
|
309
|
+
let u = i.node.openingElement.attributes.find((a) => r.isJSXAttribute(a) && S(a) === "key");
|
|
310
|
+
if (u === void 0) return;
|
|
311
|
+
let s = i;
|
|
312
|
+
for (; ; ) {
|
|
313
|
+
let a = s.parentPath;
|
|
314
|
+
if (a === null) return;
|
|
315
|
+
if (a.isConditionalExpression() && s.key !== "test" || a.isLogicalExpression() && s.key === "right" || a.isParenthesizedExpression() || a.isTSAsExpression() || a.isTSNonNullExpression()) {
|
|
316
|
+
s = a;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
let l = a.isArrowFunctionExpression() && s.key === "body" ? a : a.isReturnStatement() ? a.getFunctionParent() : null;
|
|
320
|
+
if (l === null) return;
|
|
321
|
+
let e = l.parentPath, c = e.node.callee;
|
|
322
|
+
((e.isCallExpression() || e.isOptionalCallExpression()) && l.listKey === "arguments" && (r.isMemberExpression(c) || r.isOptionalMemberExpression(c)) && !c.computed && r.isIdentifier(c.property) && (c.property.name === "map" || c.property.name === "flatMap") || e.isJSXExpressionContainer() && C(e.parent, n) === "For") && (u._whatRowKey = !0);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function L(i, n) {
|
|
327
|
+
for (let u of i.openingElement.attributes) {
|
|
328
|
+
if (!r.isJSXAttribute(u) || u._whatRowKey === !0 || S(u) !== "key") continue;
|
|
329
|
+
let s = k(u.value);
|
|
330
|
+
if (s == null || !(g(s) || j(s, n.signalNames, n.importedIdentifiers))) return null;
|
|
331
|
+
let a = n.signalNames && n.signalNames.fromDestructuredProps;
|
|
332
|
+
return r.isIdentifier(s) && !(a && a.has(s.name)) && P(s.name, n.signalNames) ? r.callExpression(s, []) : s;
|
|
333
|
+
}
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
function U(i, n, u) {
|
|
337
|
+
return n === "static" ? null : L(i, u);
|
|
338
|
+
}
|
|
339
|
+
function g(i) {
|
|
340
|
+
if (!i || typeof i != "object") return !1;
|
|
341
|
+
if (Array.isArray(i)) return i.some(g);
|
|
342
|
+
if (i._whatRowItem === !0) return !0;
|
|
343
|
+
if (r.isFunction(i)) return !1;
|
|
344
|
+
for (let n of r.VISITOR_KEYS[i.type] || [])
|
|
345
|
+
if (g(i[n])) return !0;
|
|
346
|
+
return !1;
|
|
347
|
+
}
|
|
348
|
+
function Y(i) {
|
|
349
|
+
return !!i.keyValue && !w(i.keyValue, d(i.mapFn));
|
|
350
|
+
}
|
|
351
|
+
function d(i) {
|
|
352
|
+
let n = R(i);
|
|
353
|
+
return r.isIdentifier(i.params[1]) && n.delete(i.params[1].name), n;
|
|
354
|
+
}
|
|
355
|
+
function q(i) {
|
|
356
|
+
let n = i.mapFn.params[1];
|
|
357
|
+
return r.isIdentifier(n) && w(i.keyValue, /* @__PURE__ */ new Set([n.name])) ? n.name : null;
|
|
358
|
+
}
|
|
359
|
+
function I(i, n) {
|
|
360
|
+
let u = i.params[0];
|
|
361
|
+
if (!r.isIdentifier(u)) return null;
|
|
362
|
+
let s = u.name, a = [], l = !1, e = (t) => x(t, /* @__PURE__ */ new Set()).has(s), c = (t, f, b) => {
|
|
363
|
+
if (!(l || !t || typeof t != "object")) {
|
|
364
|
+
if (Array.isArray(t)) {
|
|
365
|
+
for (let o = 0; o < t.length; o++) c(t[o], t, o);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (typeof t.type == "string" && !(t.type === n.type && r.isNodesEquivalent(t, n))) {
|
|
369
|
+
switch (t.type) {
|
|
370
|
+
case "Identifier":
|
|
371
|
+
t.name === s && a.push([f, b]);
|
|
372
|
+
return;
|
|
373
|
+
case "JSXIdentifier":
|
|
374
|
+
t.name === s && (l = !0);
|
|
375
|
+
return;
|
|
376
|
+
case "JSXAttribute":
|
|
377
|
+
c(t.value, t, "value");
|
|
378
|
+
return;
|
|
379
|
+
case "MemberExpression":
|
|
380
|
+
case "OptionalMemberExpression":
|
|
381
|
+
if (r.isIdentifier(t.object, { name: s })) {
|
|
382
|
+
let o = b === "callee" && (r.isCallExpression(f) || r.isOptionalCallExpression(f) || r.isNewExpression(f)) || b === "tag" && r.isTaggedTemplateExpression(f), p = !t.computed && r.isIdentifier(t.property) ? t.property.name : t.computed && (r.isStringLiteral(t.property) || r.isNumericLiteral(t.property)) ? String(t.property.value) : void 0;
|
|
383
|
+
a.push([t, "object", o ? void 0 : p]);
|
|
384
|
+
} else
|
|
385
|
+
c(t.object, t, "object");
|
|
386
|
+
t.computed && c(t.property, t, "property");
|
|
387
|
+
return;
|
|
388
|
+
case "ObjectProperty":
|
|
389
|
+
t.computed && c(t.key, t, "key"), t.shorthand && r.isIdentifier(t.value, { name: s }) && (t.shorthand = !1, t.value = r.cloneNode(t.value)), c(t.value, t, "value");
|
|
390
|
+
return;
|
|
391
|
+
case "ObjectMethod":
|
|
392
|
+
case "ClassMethod":
|
|
393
|
+
case "ClassPrivateMethod":
|
|
394
|
+
if (t.params.some(e)) {
|
|
395
|
+
l = !0;
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
t.computed && c(t.key, t, "key"), c(t.body, t, "body");
|
|
399
|
+
return;
|
|
400
|
+
case "ClassProperty":
|
|
401
|
+
case "ClassPrivateProperty":
|
|
402
|
+
t.computed && c(t.key, t, "key"), c(t.value, t, "value");
|
|
403
|
+
return;
|
|
404
|
+
case "FunctionExpression":
|
|
405
|
+
case "ArrowFunctionExpression":
|
|
406
|
+
case "FunctionDeclaration":
|
|
407
|
+
if (t.id && t.id.name === s || t.params.some(e)) {
|
|
408
|
+
l = !0;
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
c(t.params, t, "params"), c(t.body, t, "body");
|
|
412
|
+
return;
|
|
413
|
+
case "ClassDeclaration":
|
|
414
|
+
case "ClassExpression":
|
|
415
|
+
if (t.id && t.id.name === s) {
|
|
416
|
+
l = !0;
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
c(t.superClass, t, "superClass"), c(t.body, t, "body");
|
|
420
|
+
return;
|
|
421
|
+
case "VariableDeclarator":
|
|
422
|
+
if (e(t.id)) {
|
|
423
|
+
l = !0;
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
c(t.init, t, "init");
|
|
427
|
+
return;
|
|
428
|
+
case "CatchClause":
|
|
429
|
+
if (t.param && e(t.param)) {
|
|
430
|
+
l = !0;
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
c(t.body, t, "body");
|
|
434
|
+
return;
|
|
435
|
+
case "AssignmentExpression":
|
|
436
|
+
if (e(t.left)) {
|
|
437
|
+
l = !0;
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
case "UpdateExpression":
|
|
442
|
+
if (r.isIdentifier(t.argument, { name: s })) {
|
|
443
|
+
l = !0;
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
break;
|
|
447
|
+
case "LabeledStatement":
|
|
448
|
+
c(t.body, t, "body");
|
|
449
|
+
return;
|
|
450
|
+
case "BreakStatement":
|
|
451
|
+
case "ContinueStatement":
|
|
452
|
+
case "MetaProperty":
|
|
453
|
+
return;
|
|
454
|
+
case "TSAsExpression":
|
|
455
|
+
case "TSSatisfiesExpression":
|
|
456
|
+
case "TSNonNullExpression":
|
|
457
|
+
case "TSTypeAssertion":
|
|
458
|
+
c(t.expression, t, "expression");
|
|
459
|
+
return;
|
|
460
|
+
default:
|
|
461
|
+
if (t.type.startsWith("TS")) return;
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
for (let o of Object.keys(t)) {
|
|
465
|
+
if (o === "loc" || o === "start" || o === "end" || o === "type" || o === "extra" || o === "typeAnnotation" || o === "returnType" || o === "typeParameters" || o === "leadingComments" || o === "trailingComments" || o === "innerComments") continue;
|
|
466
|
+
let p = t[o];
|
|
467
|
+
p && typeof p == "object" && c(p, t, o);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
for (let t = 1; t < i.params.length; t++)
|
|
473
|
+
if (e(i.params[t])) return null;
|
|
474
|
+
return c(i.body, i, "body"), l ? null : a;
|
|
475
|
+
}
|
|
476
|
+
export {
|
|
477
|
+
x as collectPatternNames,
|
|
478
|
+
K as findMappedJsx,
|
|
479
|
+
Y as isKeyedRow,
|
|
480
|
+
U as islandKey,
|
|
481
|
+
q as keyIndex,
|
|
482
|
+
W as listSlot,
|
|
483
|
+
L as liveKey,
|
|
484
|
+
X as markRowItemReads,
|
|
485
|
+
F as markRowKey,
|
|
486
|
+
R as namesInvisibleToKeyFn,
|
|
487
|
+
$ as readItemThroughAccessor,
|
|
488
|
+
g as readsRowItem,
|
|
489
|
+
J as rowField,
|
|
490
|
+
B as rowItemUnread,
|
|
491
|
+
M as withItem
|
|
492
|
+
};
|