vue-hook-optimizer 0.0.8 → 0.0.9
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 +64 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -86291,6 +86291,34 @@ function analyze2(content) {
|
|
86291
86291
|
traverse2(ast, {
|
86292
86292
|
VariableDeclaration(path2) {
|
86293
86293
|
path2.node.declarations.forEach((declaration2) => {
|
86294
|
+
if (declaration2.id.type === "ArrayPattern") {
|
86295
|
+
declaration2.id.elements.forEach((element) => {
|
86296
|
+
if (element?.type === "Identifier") {
|
86297
|
+
const name = element.name;
|
86298
|
+
const binding2 = path2.scope.getBinding(name);
|
86299
|
+
if (binding2 && path2.parent.type === "Program" && !(declaration2.init?.type === "CallExpression" && declaration2.init?.callee.type === "Identifier" && ["defineProps", "defineEmits"].includes(declaration2.init?.callee.name))) {
|
86300
|
+
graph.nodes.add(name);
|
86301
|
+
if (!graph.edges.get(name)) {
|
86302
|
+
graph.edges.set(name, /* @__PURE__ */ new Set());
|
86303
|
+
}
|
86304
|
+
}
|
86305
|
+
}
|
86306
|
+
});
|
86307
|
+
}
|
86308
|
+
if (declaration2.id.type === "ObjectPattern") {
|
86309
|
+
declaration2.id.properties.forEach((property) => {
|
86310
|
+
if (property.type === "ObjectProperty" && property.value.type === "Identifier") {
|
86311
|
+
const name = property.value.name;
|
86312
|
+
const binding2 = path2.scope.getBinding(name);
|
86313
|
+
if (binding2 && path2.parent.type === "Program" && !(declaration2.init?.type === "CallExpression" && declaration2.init?.callee.type === "Identifier" && ["defineProps", "defineEmits"].includes(declaration2.init?.callee.name))) {
|
86314
|
+
graph.nodes.add(name);
|
86315
|
+
if (!graph.edges.get(name)) {
|
86316
|
+
graph.edges.set(name, /* @__PURE__ */ new Set());
|
86317
|
+
}
|
86318
|
+
}
|
86319
|
+
}
|
86320
|
+
});
|
86321
|
+
}
|
86294
86322
|
if (declaration2.id?.type === "Identifier") {
|
86295
86323
|
const name = declaration2.id.name;
|
86296
86324
|
const binding2 = path2.scope.getBinding(name);
|
@@ -86332,6 +86360,40 @@ function analyze2(content) {
|
|
86332
86360
|
},
|
86333
86361
|
VariableDeclarator(path2) {
|
86334
86362
|
if (path2.node.init) {
|
86363
|
+
if (path2.node.id.type === "ArrayPattern") {
|
86364
|
+
path2.node.id.elements.forEach((element) => {
|
86365
|
+
if (element?.type === "Identifier") {
|
86366
|
+
const name = element.name;
|
86367
|
+
if (name && graph.nodes.has(name) && path2.node.init?.type === "CallExpression") {
|
86368
|
+
traverse2(path2.node.init, {
|
86369
|
+
Identifier(path1) {
|
86370
|
+
const binding2 = path1.scope.getBinding(path1.node.name);
|
86371
|
+
if (graph.nodes.has(path1.node.name) && path1.node.name !== name && binding2?.scope.block.type === "Program") {
|
86372
|
+
graph.edges.get(name)?.add(path1.node.name);
|
86373
|
+
}
|
86374
|
+
}
|
86375
|
+
}, path2.scope, path2);
|
86376
|
+
}
|
86377
|
+
}
|
86378
|
+
});
|
86379
|
+
}
|
86380
|
+
if (path2.node.id.type === "ObjectPattern") {
|
86381
|
+
path2.node.id.properties.forEach((property) => {
|
86382
|
+
if (property.type === "ObjectProperty" && property.value.type === "Identifier") {
|
86383
|
+
const name = property.value.name;
|
86384
|
+
if (name && graph.nodes.has(name) && path2.node.init) {
|
86385
|
+
traverse2(path2.node.init, {
|
86386
|
+
Identifier(path1) {
|
86387
|
+
const binding2 = path1.scope.getBinding(path1.node.name);
|
86388
|
+
if (graph.nodes.has(path1.node.name) && path1.node.name !== name && binding2?.scope.block.type === "Program") {
|
86389
|
+
graph.edges.get(name)?.add(path1.node.name);
|
86390
|
+
}
|
86391
|
+
}
|
86392
|
+
}, path2.scope, path2);
|
86393
|
+
}
|
86394
|
+
}
|
86395
|
+
});
|
86396
|
+
}
|
86335
86397
|
if ([
|
86336
86398
|
"CallExpression",
|
86337
86399
|
"ArrowFunctionExpression",
|
@@ -86339,14 +86401,14 @@ function analyze2(content) {
|
|
86339
86401
|
].includes(path2.node.init.type) && path2.node.id.type === "Identifier") {
|
86340
86402
|
const name = path2.node.id?.name;
|
86341
86403
|
if (name && graph.nodes.has(name)) {
|
86342
|
-
path2.
|
86404
|
+
traverse2(path2.node.init, {
|
86343
86405
|
Identifier(path1) {
|
86344
86406
|
const binding2 = path1.scope.getBinding(path1.node.name);
|
86345
86407
|
if (graph.nodes.has(path1.node.name) && path1.node.name !== name && binding2?.scope.block.type === "Program") {
|
86346
86408
|
graph.edges.get(name)?.add(path1.node.name);
|
86347
86409
|
}
|
86348
86410
|
}
|
86349
|
-
});
|
86411
|
+
}, path2.scope, path2);
|
86350
86412
|
}
|
86351
86413
|
}
|
86352
86414
|
}
|