vue-hook-optimizer 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- 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.mjs
CHANGED
@@ -86281,6 +86281,34 @@ function analyze2(content) {
|
|
86281
86281
|
traverse2(ast, {
|
86282
86282
|
VariableDeclaration(path2) {
|
86283
86283
|
path2.node.declarations.forEach((declaration2) => {
|
86284
|
+
if (declaration2.id.type === "ArrayPattern") {
|
86285
|
+
declaration2.id.elements.forEach((element) => {
|
86286
|
+
if (element?.type === "Identifier") {
|
86287
|
+
const name = element.name;
|
86288
|
+
const binding2 = path2.scope.getBinding(name);
|
86289
|
+
if (binding2 && path2.parent.type === "Program" && !(declaration2.init?.type === "CallExpression" && declaration2.init?.callee.type === "Identifier" && ["defineProps", "defineEmits"].includes(declaration2.init?.callee.name))) {
|
86290
|
+
graph.nodes.add(name);
|
86291
|
+
if (!graph.edges.get(name)) {
|
86292
|
+
graph.edges.set(name, /* @__PURE__ */ new Set());
|
86293
|
+
}
|
86294
|
+
}
|
86295
|
+
}
|
86296
|
+
});
|
86297
|
+
}
|
86298
|
+
if (declaration2.id.type === "ObjectPattern") {
|
86299
|
+
declaration2.id.properties.forEach((property) => {
|
86300
|
+
if (property.type === "ObjectProperty" && property.value.type === "Identifier") {
|
86301
|
+
const name = property.value.name;
|
86302
|
+
const binding2 = path2.scope.getBinding(name);
|
86303
|
+
if (binding2 && path2.parent.type === "Program" && !(declaration2.init?.type === "CallExpression" && declaration2.init?.callee.type === "Identifier" && ["defineProps", "defineEmits"].includes(declaration2.init?.callee.name))) {
|
86304
|
+
graph.nodes.add(name);
|
86305
|
+
if (!graph.edges.get(name)) {
|
86306
|
+
graph.edges.set(name, /* @__PURE__ */ new Set());
|
86307
|
+
}
|
86308
|
+
}
|
86309
|
+
}
|
86310
|
+
});
|
86311
|
+
}
|
86284
86312
|
if (declaration2.id?.type === "Identifier") {
|
86285
86313
|
const name = declaration2.id.name;
|
86286
86314
|
const binding2 = path2.scope.getBinding(name);
|
@@ -86322,6 +86350,40 @@ function analyze2(content) {
|
|
86322
86350
|
},
|
86323
86351
|
VariableDeclarator(path2) {
|
86324
86352
|
if (path2.node.init) {
|
86353
|
+
if (path2.node.id.type === "ArrayPattern") {
|
86354
|
+
path2.node.id.elements.forEach((element) => {
|
86355
|
+
if (element?.type === "Identifier") {
|
86356
|
+
const name = element.name;
|
86357
|
+
if (name && graph.nodes.has(name) && path2.node.init?.type === "CallExpression") {
|
86358
|
+
traverse2(path2.node.init, {
|
86359
|
+
Identifier(path1) {
|
86360
|
+
const binding2 = path1.scope.getBinding(path1.node.name);
|
86361
|
+
if (graph.nodes.has(path1.node.name) && path1.node.name !== name && binding2?.scope.block.type === "Program") {
|
86362
|
+
graph.edges.get(name)?.add(path1.node.name);
|
86363
|
+
}
|
86364
|
+
}
|
86365
|
+
}, path2.scope, path2);
|
86366
|
+
}
|
86367
|
+
}
|
86368
|
+
});
|
86369
|
+
}
|
86370
|
+
if (path2.node.id.type === "ObjectPattern") {
|
86371
|
+
path2.node.id.properties.forEach((property) => {
|
86372
|
+
if (property.type === "ObjectProperty" && property.value.type === "Identifier") {
|
86373
|
+
const name = property.value.name;
|
86374
|
+
if (name && graph.nodes.has(name) && path2.node.init) {
|
86375
|
+
traverse2(path2.node.init, {
|
86376
|
+
Identifier(path1) {
|
86377
|
+
const binding2 = path1.scope.getBinding(path1.node.name);
|
86378
|
+
if (graph.nodes.has(path1.node.name) && path1.node.name !== name && binding2?.scope.block.type === "Program") {
|
86379
|
+
graph.edges.get(name)?.add(path1.node.name);
|
86380
|
+
}
|
86381
|
+
}
|
86382
|
+
}, path2.scope, path2);
|
86383
|
+
}
|
86384
|
+
}
|
86385
|
+
});
|
86386
|
+
}
|
86325
86387
|
if ([
|
86326
86388
|
"CallExpression",
|
86327
86389
|
"ArrowFunctionExpression",
|
@@ -86329,14 +86391,14 @@ function analyze2(content) {
|
|
86329
86391
|
].includes(path2.node.init.type) && path2.node.id.type === "Identifier") {
|
86330
86392
|
const name = path2.node.id?.name;
|
86331
86393
|
if (name && graph.nodes.has(name)) {
|
86332
|
-
path2.
|
86394
|
+
traverse2(path2.node.init, {
|
86333
86395
|
Identifier(path1) {
|
86334
86396
|
const binding2 = path1.scope.getBinding(path1.node.name);
|
86335
86397
|
if (graph.nodes.has(path1.node.name) && path1.node.name !== name && binding2?.scope.block.type === "Program") {
|
86336
86398
|
graph.edges.get(name)?.add(path1.node.name);
|
86337
86399
|
}
|
86338
86400
|
}
|
86339
|
-
});
|
86401
|
+
}, path2.scope, path2);
|
86340
86402
|
}
|
86341
86403
|
}
|
86342
86404
|
}
|