@oddo/lang 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4559,7 +4559,7 @@ function convertExpressionStatement2(stmt) {
|
|
|
4559
4559
|
if (stmt.expression) {
|
|
4560
4560
|
const isPlainExpr = stmt.expression.type !== "variableDeclaration" && stmt.expression.type !== "assignment" && stmt.expression.type !== "arraySliceAssignment";
|
|
4561
4561
|
if (isPlainExpr) {
|
|
4562
|
-
const allIdentifiers = collectOddoIdentifiersOnly(stmt.expression);
|
|
4562
|
+
const allIdentifiers = collectOddoIdentifiersOnly(stmt.expression, /* @__PURE__ */ new Set(), false, true);
|
|
4563
4563
|
const reactiveDeps = allIdentifiers.filter((id) => isReactive(id));
|
|
4564
4564
|
if (reactiveDeps.length > 0) {
|
|
4565
4565
|
const savedScope = currentScope;
|
|
@@ -4832,20 +4832,23 @@ function convertReactiveContainer(expr) {
|
|
|
4832
4832
|
currentScope = savedScope;
|
|
4833
4833
|
return t.functionExpression(null, params, body);
|
|
4834
4834
|
}
|
|
4835
|
-
function collectOddoIdentifiersOnly(node, names = /* @__PURE__ */ new Set(), stopAtJsxExpressions = false) {
|
|
4835
|
+
function collectOddoIdentifiersOnly(node, names = /* @__PURE__ */ new Set(), stopAtJsxExpressions = false, stopAtArrowFunctions = false) {
|
|
4836
4836
|
if (!node || typeof node !== "object") return Array.from(names);
|
|
4837
4837
|
if (stopAtJsxExpressions && node.type === "jsxExpression") {
|
|
4838
4838
|
return Array.from(names);
|
|
4839
4839
|
}
|
|
4840
|
+
if (stopAtArrowFunctions && node.type === "arrowFunction") {
|
|
4841
|
+
return Array.from(names);
|
|
4842
|
+
}
|
|
4840
4843
|
if (node.type === "identifier") {
|
|
4841
4844
|
names.add(node.name);
|
|
4842
4845
|
}
|
|
4843
4846
|
if (node.type === "property") {
|
|
4844
4847
|
if (node.computed && node.key) {
|
|
4845
|
-
collectOddoIdentifiersOnly(node.key, names, stopAtJsxExpressions);
|
|
4848
|
+
collectOddoIdentifiersOnly(node.key, names, stopAtJsxExpressions, stopAtArrowFunctions);
|
|
4846
4849
|
}
|
|
4847
4850
|
if (node.value) {
|
|
4848
|
-
collectOddoIdentifiersOnly(node.value, names, stopAtJsxExpressions);
|
|
4851
|
+
collectOddoIdentifiersOnly(node.value, names, stopAtJsxExpressions, stopAtArrowFunctions);
|
|
4849
4852
|
}
|
|
4850
4853
|
return Array.from(names);
|
|
4851
4854
|
}
|
|
@@ -4853,9 +4856,9 @@ function collectOddoIdentifiersOnly(node, names = /* @__PURE__ */ new Set(), sto
|
|
|
4853
4856
|
if (key === "type") continue;
|
|
4854
4857
|
const val = node[key];
|
|
4855
4858
|
if (Array.isArray(val)) {
|
|
4856
|
-
val.forEach((item) => collectOddoIdentifiersOnly(item, names, stopAtJsxExpressions));
|
|
4859
|
+
val.forEach((item) => collectOddoIdentifiersOnly(item, names, stopAtJsxExpressions, stopAtArrowFunctions));
|
|
4857
4860
|
} else if (val && typeof val === "object") {
|
|
4858
|
-
collectOddoIdentifiersOnly(val, names, stopAtJsxExpressions);
|
|
4861
|
+
collectOddoIdentifiersOnly(val, names, stopAtJsxExpressions, stopAtArrowFunctions);
|
|
4859
4862
|
}
|
|
4860
4863
|
}
|
|
4861
4864
|
return Array.from(names);
|