llmz 0.0.30 → 0.0.31
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/{chunk-WP4F6KMW.cjs → chunk-5BEKU5MZ.cjs} +2 -2
- package/dist/{chunk-VADA6DMR.cjs → chunk-66NCLCNT.cjs} +296 -10
- package/dist/{chunk-HCC76DDO.js → chunk-AAHUDKBY.js} +2 -2
- package/dist/{chunk-R3LXNE5N.cjs → chunk-CA7FRCZT.cjs} +303 -38
- package/dist/{chunk-DCYSCVQM.js → chunk-IAYPKHFV.js} +303 -38
- package/dist/{chunk-273DEMEU.cjs → chunk-J57224PD.cjs} +62 -8
- package/dist/{chunk-7POUFE5M.js → chunk-RC6YO5UW.js} +62 -8
- package/dist/{chunk-KQPGB6GB.js → chunk-WYFTNO2Y.js} +289 -3
- package/dist/compiler/plugins/html-to-markdown.d.ts +21 -0
- package/dist/compiler/plugins/jsx-undefined-vars.d.ts +14 -0
- package/dist/{dual-modes-DW3KRXT2.js → dual-modes-LEAHGCOF.js} +1 -1
- package/dist/{dual-modes-F4UV5VAZ.cjs → dual-modes-UBHAMQW4.cjs} +2 -2
- package/dist/exit-parser.d.ts +37 -0
- package/dist/index.cjs +12 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11 -9
- package/dist/{llmz-DYB74G5C.cjs → llmz-NB4CQ5PW.cjs} +21 -42
- package/dist/{llmz-N6KWKJ2Q.js → llmz-VOXE65UW.js} +13 -34
- package/dist/prompts/worker-mode/system.md.d.ts +1 -1
- package/dist/{tool-GEBXW6AQ.js → tool-U6SV6BZ6.js} +1 -1
- package/dist/{tool-GMYMVXUK.cjs → tool-YCYYKKB3.cjs} +2 -2
- package/dist/tool.d.ts +1 -1
- package/dist/{vm-NGQ6DRS3.cjs → vm-2LG42J6U.cjs} +2 -2
- package/dist/{vm-J6UNJGIN.js → vm-FVQBX2XV.js} +1 -1
- package/package.json +1 -1
|
@@ -2101,6 +2101,207 @@ var JSXMarkdown = {
|
|
|
2101
2101
|
}
|
|
2102
2102
|
};
|
|
2103
2103
|
|
|
2104
|
+
// src/compiler/plugins/html-to-markdown.ts
|
|
2105
|
+
var _core = require('@babel/core');
|
|
2106
|
+
function htmlToMarkdownPlugin() {
|
|
2107
|
+
return {
|
|
2108
|
+
name: "html-to-markdown",
|
|
2109
|
+
visitor: {
|
|
2110
|
+
JSXElement(path) {
|
|
2111
|
+
const { openingElement } = path.node;
|
|
2112
|
+
const tagName = _core.types.isJSXIdentifier(openingElement.name) ? openingElement.name.name : null;
|
|
2113
|
+
if (!tagName)
|
|
2114
|
+
return;
|
|
2115
|
+
const lowerTagName = tagName.toLowerCase();
|
|
2116
|
+
if (lowerTagName === "strong" || lowerTagName === "b") {
|
|
2117
|
+
convertToMarkdown(path, "**", "**");
|
|
2118
|
+
} else if (lowerTagName === "em" || lowerTagName === "i") {
|
|
2119
|
+
convertToMarkdown(path, "*", "*");
|
|
2120
|
+
} else if (lowerTagName === "u") {
|
|
2121
|
+
convertToMarkdown(path, "__", "__");
|
|
2122
|
+
} else if (lowerTagName === "a") {
|
|
2123
|
+
convertLinkToMarkdown(path);
|
|
2124
|
+
} else if (lowerTagName === "br") {
|
|
2125
|
+
convertBrToNewline(path);
|
|
2126
|
+
} else if (lowerTagName === "p") {
|
|
2127
|
+
convertParagraphToMarkdown(path);
|
|
2128
|
+
} else if (lowerTagName === "ul") {
|
|
2129
|
+
convertUnorderedListToMarkdown(path);
|
|
2130
|
+
} else if (lowerTagName === "ol") {
|
|
2131
|
+
convertOrderedListToMarkdown(path);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
function hasOnlyTextChildren(children) {
|
|
2138
|
+
return children.every(
|
|
2139
|
+
(child) => _core.types.isJSXText(child) || _core.types.isJSXExpressionContainer(child) && !_core.types.isJSXElement(child.expression) || _core.types.isJSXElement(child) && canConvertToMarkdown(child)
|
|
2140
|
+
);
|
|
2141
|
+
}
|
|
2142
|
+
function canConvertToMarkdown(element) {
|
|
2143
|
+
const { openingElement } = element;
|
|
2144
|
+
const tagName = _core.types.isJSXIdentifier(openingElement.name) ? openingElement.name.name.toLowerCase() : null;
|
|
2145
|
+
if (!tagName)
|
|
2146
|
+
return false;
|
|
2147
|
+
const allowedTags = ["strong", "b", "em", "i", "u", "br", "p", "a", "li", "ul", "ol"];
|
|
2148
|
+
if (!allowedTags.includes(tagName))
|
|
2149
|
+
return false;
|
|
2150
|
+
if (tagName === "a") {
|
|
2151
|
+
return openingElement.attributes.length === 1 && _core.types.isJSXAttribute(openingElement.attributes[0]) && _core.types.isJSXIdentifier(openingElement.attributes[0].name) && openingElement.attributes[0].name.name === "href";
|
|
2152
|
+
}
|
|
2153
|
+
if (tagName === "br") {
|
|
2154
|
+
return openingElement.attributes.length === 0;
|
|
2155
|
+
}
|
|
2156
|
+
return openingElement.attributes.length === 0;
|
|
2157
|
+
}
|
|
2158
|
+
function convertToMarkdown(path, prefix, suffix) {
|
|
2159
|
+
const element = path.node;
|
|
2160
|
+
if (!canConvertToMarkdown(element))
|
|
2161
|
+
return;
|
|
2162
|
+
const children = element.children;
|
|
2163
|
+
if (!hasOnlyTextChildren(children))
|
|
2164
|
+
return;
|
|
2165
|
+
const textContent = extractTextContent(children);
|
|
2166
|
+
if (!textContent)
|
|
2167
|
+
return;
|
|
2168
|
+
const markdownText = `${prefix}${textContent}${suffix}`;
|
|
2169
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2170
|
+
}
|
|
2171
|
+
function convertLinkToMarkdown(path) {
|
|
2172
|
+
const element = path.node;
|
|
2173
|
+
if (!canConvertToMarkdown(element))
|
|
2174
|
+
return;
|
|
2175
|
+
const children = element.children;
|
|
2176
|
+
if (!hasOnlyTextChildren(children))
|
|
2177
|
+
return;
|
|
2178
|
+
const hrefAttr = element.openingElement.attributes.find(
|
|
2179
|
+
(attr) => _core.types.isJSXAttribute(attr) && _core.types.isJSXIdentifier(attr.name) && attr.name.name === "href"
|
|
2180
|
+
);
|
|
2181
|
+
if (!hrefAttr || !_core.types.isJSXAttribute(hrefAttr))
|
|
2182
|
+
return;
|
|
2183
|
+
let href = "";
|
|
2184
|
+
if (_core.types.isStringLiteral(hrefAttr.value)) {
|
|
2185
|
+
href = hrefAttr.value.value;
|
|
2186
|
+
} else if (_core.types.isJSXExpressionContainer(hrefAttr.value) && _core.types.isStringLiteral(hrefAttr.value.expression)) {
|
|
2187
|
+
href = hrefAttr.value.expression.value;
|
|
2188
|
+
} else {
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
const textContent = extractTextContent(children);
|
|
2192
|
+
if (!textContent)
|
|
2193
|
+
return;
|
|
2194
|
+
const markdownText = `[${textContent}](${href})`;
|
|
2195
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2196
|
+
}
|
|
2197
|
+
function convertBrToNewline(path) {
|
|
2198
|
+
const element = path.node;
|
|
2199
|
+
if (!canConvertToMarkdown(element))
|
|
2200
|
+
return;
|
|
2201
|
+
path.replaceWith(_core.types.jsxText("\n"));
|
|
2202
|
+
}
|
|
2203
|
+
function convertParagraphToMarkdown(path) {
|
|
2204
|
+
const element = path.node;
|
|
2205
|
+
if (!canConvertToMarkdown(element))
|
|
2206
|
+
return;
|
|
2207
|
+
const children = element.children;
|
|
2208
|
+
if (!hasOnlyTextChildren(children))
|
|
2209
|
+
return;
|
|
2210
|
+
const textContent = extractTextContent(children);
|
|
2211
|
+
if (!textContent)
|
|
2212
|
+
return;
|
|
2213
|
+
const markdownText = `${textContent}
|
|
2214
|
+
|
|
2215
|
+
`;
|
|
2216
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2217
|
+
}
|
|
2218
|
+
function convertUnorderedListToMarkdown(path) {
|
|
2219
|
+
const element = path.node;
|
|
2220
|
+
if (element.openingElement.attributes.length > 0)
|
|
2221
|
+
return;
|
|
2222
|
+
const children = element.children;
|
|
2223
|
+
const listItems = [];
|
|
2224
|
+
for (const child of children) {
|
|
2225
|
+
if (_core.types.isJSXElement(child)) {
|
|
2226
|
+
const tagName = _core.types.isJSXIdentifier(child.openingElement.name) ? child.openingElement.name.name : null;
|
|
2227
|
+
if ((tagName == null ? void 0 : tagName.toLowerCase()) === "li" && canConvertToMarkdown(child)) {
|
|
2228
|
+
const itemText = extractTextContent(child.children);
|
|
2229
|
+
if (itemText) {
|
|
2230
|
+
listItems.push(`- ${itemText}`);
|
|
2231
|
+
}
|
|
2232
|
+
} else {
|
|
2233
|
+
return;
|
|
2234
|
+
}
|
|
2235
|
+
} else if (_core.types.isJSXText(child) && child.value.trim()) {
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
if (listItems.length === 0)
|
|
2240
|
+
return;
|
|
2241
|
+
const markdownText = listItems.join("\n") + "\n";
|
|
2242
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2243
|
+
}
|
|
2244
|
+
function convertOrderedListToMarkdown(path) {
|
|
2245
|
+
const element = path.node;
|
|
2246
|
+
if (element.openingElement.attributes.length > 0)
|
|
2247
|
+
return;
|
|
2248
|
+
const children = element.children;
|
|
2249
|
+
const listItems = [];
|
|
2250
|
+
for (const child of children) {
|
|
2251
|
+
if (_core.types.isJSXElement(child)) {
|
|
2252
|
+
const tagName = _core.types.isJSXIdentifier(child.openingElement.name) ? child.openingElement.name.name : null;
|
|
2253
|
+
if ((tagName == null ? void 0 : tagName.toLowerCase()) === "li" && canConvertToMarkdown(child)) {
|
|
2254
|
+
const itemText = extractTextContent(child.children);
|
|
2255
|
+
if (itemText) {
|
|
2256
|
+
listItems.push(`${listItems.length + 1}. ${itemText}`);
|
|
2257
|
+
}
|
|
2258
|
+
} else {
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
} else if (_core.types.isJSXText(child) && child.value.trim()) {
|
|
2262
|
+
return;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
if (listItems.length === 0)
|
|
2266
|
+
return;
|
|
2267
|
+
const markdownText = listItems.join("\n") + "\n";
|
|
2268
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2269
|
+
}
|
|
2270
|
+
function extractTextContent(children) {
|
|
2271
|
+
let text = "";
|
|
2272
|
+
for (const child of children) {
|
|
2273
|
+
if (_core.types.isJSXText(child)) {
|
|
2274
|
+
text += child.value;
|
|
2275
|
+
} else if (_core.types.isJSXExpressionContainer(child)) {
|
|
2276
|
+
return "";
|
|
2277
|
+
} else if (_core.types.isJSXElement(child)) {
|
|
2278
|
+
const nestedText = extractTextContent(child.children);
|
|
2279
|
+
if (!nestedText)
|
|
2280
|
+
return "";
|
|
2281
|
+
const tagName = _core.types.isJSXIdentifier(child.openingElement.name) ? child.openingElement.name.name.toLowerCase() : null;
|
|
2282
|
+
switch (tagName) {
|
|
2283
|
+
case "strong":
|
|
2284
|
+
case "b":
|
|
2285
|
+
text += `**${nestedText}**`;
|
|
2286
|
+
break;
|
|
2287
|
+
case "em":
|
|
2288
|
+
case "i":
|
|
2289
|
+
text += `*${nestedText}*`;
|
|
2290
|
+
break;
|
|
2291
|
+
case "u":
|
|
2292
|
+
text += `__${nestedText}__`;
|
|
2293
|
+
break;
|
|
2294
|
+
case "br":
|
|
2295
|
+
text += "\n";
|
|
2296
|
+
break;
|
|
2297
|
+
default:
|
|
2298
|
+
return "";
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
return text;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2104
2305
|
// src/compiler/plugins/jsx-preserve-newlines.ts
|
|
2105
2306
|
|
|
2106
2307
|
|
|
@@ -2137,10 +2338,71 @@ var JSXNewLines = {
|
|
|
2137
2338
|
postProcessing
|
|
2138
2339
|
};
|
|
2139
2340
|
|
|
2341
|
+
// src/compiler/plugins/jsx-undefined-vars.ts
|
|
2342
|
+
|
|
2343
|
+
function jsxUndefinedVarsPlugin() {
|
|
2344
|
+
return {
|
|
2345
|
+
name: "jsx-undefined-vars",
|
|
2346
|
+
visitor: {
|
|
2347
|
+
JSXExpressionContainer(path) {
|
|
2348
|
+
const expression = path.node.expression;
|
|
2349
|
+
if (_core.types.isJSXEmptyExpression(expression)) {
|
|
2350
|
+
return;
|
|
2351
|
+
}
|
|
2352
|
+
if (!_core.types.isIdentifier(expression)) {
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
const varName = expression.name;
|
|
2356
|
+
const knownGlobals = /* @__PURE__ */ new Set([
|
|
2357
|
+
"undefined",
|
|
2358
|
+
"null",
|
|
2359
|
+
"true",
|
|
2360
|
+
"false",
|
|
2361
|
+
"NaN",
|
|
2362
|
+
"Infinity",
|
|
2363
|
+
"console",
|
|
2364
|
+
"Math",
|
|
2365
|
+
"JSON",
|
|
2366
|
+
"Object",
|
|
2367
|
+
"Array",
|
|
2368
|
+
"String",
|
|
2369
|
+
"Number",
|
|
2370
|
+
"Boolean",
|
|
2371
|
+
"Date",
|
|
2372
|
+
"RegExp",
|
|
2373
|
+
"Error",
|
|
2374
|
+
"Promise",
|
|
2375
|
+
"Symbol"
|
|
2376
|
+
]);
|
|
2377
|
+
if (knownGlobals.has(varName)) {
|
|
2378
|
+
return;
|
|
2379
|
+
}
|
|
2380
|
+
const iife = _core.types.callExpression(
|
|
2381
|
+
_core.types.arrowFunctionExpression(
|
|
2382
|
+
[],
|
|
2383
|
+
_core.types.blockStatement([
|
|
2384
|
+
_core.types.tryStatement(
|
|
2385
|
+
_core.types.blockStatement([_core.types.returnStatement(_core.types.identifier(varName))]),
|
|
2386
|
+
_core.types.catchClause(
|
|
2387
|
+
null,
|
|
2388
|
+
// no error binding needed
|
|
2389
|
+
_core.types.blockStatement([_core.types.returnStatement(_core.types.stringLiteral(varName))])
|
|
2390
|
+
)
|
|
2391
|
+
)
|
|
2392
|
+
])
|
|
2393
|
+
),
|
|
2394
|
+
[]
|
|
2395
|
+
);
|
|
2396
|
+
path.node.expression = iife;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
};
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2140
2402
|
// src/compiler/plugins/line-tracking.ts
|
|
2141
2403
|
|
|
2142
2404
|
var LineTrackingFnIdentifier = "__track__";
|
|
2143
|
-
var lineTrackingBabelPlugin = function({ types:
|
|
2405
|
+
var lineTrackingBabelPlugin = function({ types: t3 }) {
|
|
2144
2406
|
return {
|
|
2145
2407
|
visitor: {
|
|
2146
2408
|
Program(path) {
|
|
@@ -2161,8 +2423,8 @@ var lineTrackingBabelPlugin = function({ types: t }) {
|
|
|
2161
2423
|
console.error(e);
|
|
2162
2424
|
}
|
|
2163
2425
|
};
|
|
2164
|
-
if (
|
|
2165
|
-
if (!trackedLines.has(startLine) && !
|
|
2426
|
+
if (t3.isFunctionDeclaration(node) || t3.isClassMethod(node) || t3.isReturnStatement(node) || t3.isAwaitExpression(node) || t3.isForOfStatement(node) || t3.isCallExpression(node) || t3.isUnaryExpression(node) || t3.isVariableDeclaration(node) || t3.isBlockStatement(path2.parent) || t3.isAssignmentExpression(node)) {
|
|
2427
|
+
if (!trackedLines.has(startLine) && !t3.isArrowFunctionExpression(path2.parent) && !t3.isObjectProperty(path2.parent) && !t3.isAwaitExpression(path2.parent) && !t3.isUnaryExpression(path2.parent) && !t3.isReturnStatement(path2.parent) && !t3.isForOfStatement(path2.parent) && !t3.isForStatement(path2.parent) && !t3.isForInStatement(path2.parent) && !t3.isVariableDeclaration(path2.parent) && !t3.isBinaryExpression(path2.parent) && !t3.isLogicalExpression(path2.parent)) {
|
|
2166
2428
|
track();
|
|
2167
2429
|
}
|
|
2168
2430
|
}
|
|
@@ -2177,7 +2439,7 @@ var lineTrackingBabelPlugin = function({ types: t }) {
|
|
|
2177
2439
|
// src/compiler/plugins/replace-comment.ts
|
|
2178
2440
|
var CommentFnIdentifier = "__comment__";
|
|
2179
2441
|
var replaceCommentBabelPlugin = function({
|
|
2180
|
-
types:
|
|
2442
|
+
types: t3
|
|
2181
2443
|
}) {
|
|
2182
2444
|
return {
|
|
2183
2445
|
visitor: {
|
|
@@ -2196,13 +2458,13 @@ var replaceCommentBabelPlugin = function({
|
|
|
2196
2458
|
return;
|
|
2197
2459
|
}
|
|
2198
2460
|
processed.add(comment.loc);
|
|
2199
|
-
const commentCall =
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2461
|
+
const commentCall = t3.expressionStatement(
|
|
2462
|
+
t3.callExpression(t3.identifier(CommentFnIdentifier), [
|
|
2463
|
+
t3.stringLiteral(comment.value.trim()),
|
|
2464
|
+
t3.numericLiteral(_nullishCoalesce(((_a = comment.loc) == null ? void 0 : _a.start.line), () => ( 0)))
|
|
2203
2465
|
])
|
|
2204
2466
|
);
|
|
2205
|
-
const isInsideObjectProperty =
|
|
2467
|
+
const isInsideObjectProperty = t3.isObjectProperty(node) || path2.findParent((path3) => t3.isObjectProperty(path3.node));
|
|
2206
2468
|
if (!isInsideObjectProperty) {
|
|
2207
2469
|
insertMethod(commentCall);
|
|
2208
2470
|
}
|
|
@@ -2221,7 +2483,7 @@ var replaceCommentBabelPlugin = function({
|
|
|
2221
2483
|
|
|
2222
2484
|
// src/compiler/plugins/return-async.ts
|
|
2223
2485
|
var instrumentLastLinePlugin = function({
|
|
2224
|
-
types:
|
|
2486
|
+
types: t3
|
|
2225
2487
|
}) {
|
|
2226
2488
|
return {
|
|
2227
2489
|
visitor: {
|
|
@@ -2235,14 +2497,14 @@ var instrumentLastLinePlugin = function({
|
|
|
2235
2497
|
return;
|
|
2236
2498
|
}
|
|
2237
2499
|
const lastStatement = statements[statements.length - 1];
|
|
2238
|
-
if (
|
|
2239
|
-
if (
|
|
2240
|
-
lastStatement.argument =
|
|
2500
|
+
if (t3.isReturnStatement(lastStatement)) {
|
|
2501
|
+
if (t3.isExpression(lastStatement.argument)) {
|
|
2502
|
+
lastStatement.argument = t3.awaitExpression(lastStatement.argument);
|
|
2241
2503
|
}
|
|
2242
2504
|
return;
|
|
2243
2505
|
}
|
|
2244
|
-
if (
|
|
2245
|
-
const returnStatement3 =
|
|
2506
|
+
if (t3.isExpressionStatement(lastStatement) && (t3.isCallExpression(lastStatement.expression) || t3.isAwaitExpression(lastStatement.expression))) {
|
|
2507
|
+
const returnStatement3 = t3.returnStatement(t3.awaitExpression(lastStatement.expression));
|
|
2246
2508
|
(_b = path.get("body").get("body")[statements.length - 1]) == null ? void 0 : _b.replaceWith(returnStatement3);
|
|
2247
2509
|
}
|
|
2248
2510
|
}
|
|
@@ -2460,7 +2722,7 @@ var toolCallTrackingPlugin = (calls = /* @__PURE__ */ new Map()) => function({})
|
|
|
2460
2722
|
|
|
2461
2723
|
|
|
2462
2724
|
var VariableTrackingFnIdentifier = "__var__";
|
|
2463
|
-
var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function({ types:
|
|
2725
|
+
var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function({ types: t3 }) {
|
|
2464
2726
|
let trackingStatements = [];
|
|
2465
2727
|
const trackVariable = (variableName) => {
|
|
2466
2728
|
if (variableName.startsWith("__")) {
|
|
@@ -2480,19 +2742,19 @@ var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function
|
|
|
2480
2742
|
visitor: {
|
|
2481
2743
|
FunctionDeclaration(path) {
|
|
2482
2744
|
path.node.params.forEach((param) => {
|
|
2483
|
-
if (
|
|
2745
|
+
if (t3.isIdentifier(param)) {
|
|
2484
2746
|
trackVariable(param.name);
|
|
2485
|
-
} else if (
|
|
2747
|
+
} else if (t3.isAssignmentPattern(param) && t3.isIdentifier(param.left)) {
|
|
2486
2748
|
trackVariable(param.left.name);
|
|
2487
|
-
} else if (
|
|
2749
|
+
} else if (t3.isObjectPattern(param)) {
|
|
2488
2750
|
param.properties.forEach((prop) => {
|
|
2489
|
-
if (
|
|
2751
|
+
if (t3.isObjectProperty(prop) && t3.isIdentifier(prop.value)) {
|
|
2490
2752
|
trackVariable(prop.value.name);
|
|
2491
2753
|
}
|
|
2492
2754
|
});
|
|
2493
|
-
} else if (
|
|
2755
|
+
} else if (t3.isArrayPattern(param)) {
|
|
2494
2756
|
param.elements.forEach((element) => {
|
|
2495
|
-
if (
|
|
2757
|
+
if (t3.isIdentifier(element)) {
|
|
2496
2758
|
trackVariable(element.name);
|
|
2497
2759
|
}
|
|
2498
2760
|
});
|
|
@@ -2505,19 +2767,19 @@ var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function
|
|
|
2505
2767
|
},
|
|
2506
2768
|
ArrowFunctionExpression(path) {
|
|
2507
2769
|
path.node.params.forEach((param) => {
|
|
2508
|
-
if (
|
|
2770
|
+
if (t3.isIdentifier(param)) {
|
|
2509
2771
|
trackVariable(param.name);
|
|
2510
|
-
} else if (
|
|
2772
|
+
} else if (t3.isAssignmentPattern(param) && t3.isIdentifier(param.left)) {
|
|
2511
2773
|
trackVariable(param.left.name);
|
|
2512
|
-
} else if (
|
|
2774
|
+
} else if (t3.isObjectPattern(param)) {
|
|
2513
2775
|
param.properties.forEach((prop) => {
|
|
2514
|
-
if (
|
|
2776
|
+
if (t3.isObjectProperty(prop) && t3.isIdentifier(prop.value)) {
|
|
2515
2777
|
trackVariable(prop.value.name);
|
|
2516
2778
|
}
|
|
2517
2779
|
});
|
|
2518
|
-
} else if (
|
|
2780
|
+
} else if (t3.isArrayPattern(param)) {
|
|
2519
2781
|
param.elements.forEach((element) => {
|
|
2520
|
-
if (
|
|
2782
|
+
if (t3.isIdentifier(element)) {
|
|
2521
2783
|
trackVariable(element.name);
|
|
2522
2784
|
}
|
|
2523
2785
|
});
|
|
@@ -2538,11 +2800,11 @@ var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function
|
|
|
2538
2800
|
const parent = path.parentPath;
|
|
2539
2801
|
const handleObjectPattern = (pattern) => {
|
|
2540
2802
|
pattern.properties.forEach((prop) => {
|
|
2541
|
-
if (
|
|
2803
|
+
if (t3.isObjectProperty(prop) && t3.isIdentifier(prop.value)) {
|
|
2542
2804
|
trackVariable(prop.value.name);
|
|
2543
|
-
} else if (
|
|
2805
|
+
} else if (t3.isObjectProperty(prop) && t3.isObjectPattern(prop.value)) {
|
|
2544
2806
|
handleObjectPattern(prop.value);
|
|
2545
|
-
} else if (
|
|
2807
|
+
} else if (t3.isObjectProperty(prop) && t3.isAssignmentPattern(prop.value) && t3.isIdentifier(prop.value.left)) {
|
|
2546
2808
|
trackVariable(prop.value.left.name);
|
|
2547
2809
|
}
|
|
2548
2810
|
});
|
|
@@ -2551,19 +2813,19 @@ var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function
|
|
|
2551
2813
|
if (parent.isForXStatement() || parent.isForStatement()) {
|
|
2552
2814
|
return;
|
|
2553
2815
|
}
|
|
2554
|
-
if (
|
|
2816
|
+
if (t3.isIdentifier(declarator.id)) {
|
|
2555
2817
|
trackVariable(declarator.id.name);
|
|
2556
2818
|
}
|
|
2557
|
-
if (
|
|
2819
|
+
if (t3.isObjectPattern(declarator.id)) {
|
|
2558
2820
|
handleObjectPattern(declarator.id);
|
|
2559
2821
|
}
|
|
2560
|
-
if (
|
|
2822
|
+
if (t3.isArrayPattern(declarator.id)) {
|
|
2561
2823
|
declarator.id.elements.forEach((element) => {
|
|
2562
|
-
if (
|
|
2824
|
+
if (t3.isIdentifier(element)) {
|
|
2563
2825
|
trackVariable(element.name);
|
|
2564
|
-
} else if (
|
|
2826
|
+
} else if (t3.isRestElement(element) && t3.isIdentifier(element.argument)) {
|
|
2565
2827
|
trackVariable(element.argument.name);
|
|
2566
|
-
} else if (
|
|
2828
|
+
} else if (t3.isAssignmentPattern(element) && t3.isIdentifier(element.left)) {
|
|
2567
2829
|
trackVariable(element.left.name);
|
|
2568
2830
|
}
|
|
2569
2831
|
});
|
|
@@ -2612,6 +2874,10 @@ function compile(code) {
|
|
|
2612
2874
|
presets: ["typescript"],
|
|
2613
2875
|
plugins: [
|
|
2614
2876
|
JSXNewLines.babelPlugin,
|
|
2877
|
+
htmlToMarkdownPlugin,
|
|
2878
|
+
// Convert simple HTML to markdown first
|
|
2879
|
+
jsxUndefinedVarsPlugin,
|
|
2880
|
+
// Must run BEFORE JSX transform
|
|
2615
2881
|
[
|
|
2616
2882
|
_plugintransformreactjsx2.default,
|
|
2617
2883
|
{
|
|
@@ -2801,7 +3067,6 @@ async function runAsyncFunction(context, code, traces = [], signal = null, timeo
|
|
|
2801
3067
|
};
|
|
2802
3068
|
const QuickJS = await _quickjsemscriptencore.newQuickJSWASMModuleFromVariant.call(void 0, BundledReleaseSyncVariant);
|
|
2803
3069
|
const runtime = QuickJS.newRuntime();
|
|
2804
|
-
runtime.setDebugMode(true);
|
|
2805
3070
|
runtime.setMemoryLimit(128 * 1024 * 1024);
|
|
2806
3071
|
const startTime = Date.now();
|
|
2807
3072
|
const timeoutHandler = _quickjsemscriptencore.shouldInterruptAfterDeadline.call(void 0, startTime + timeout);
|