vue-hook-optimizer 0.0.56 → 0.0.57

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -73,7 +73,9 @@ function analyze(content) {
73
73
  if (path.node.key.type === "Identifier" && path.node.key.name === "ref") {
74
74
  if (path.node.value.type === "StringLiteral") {
75
75
  const name = path.node.value.value;
76
- name && nodes.add(name);
76
+ if (name) {
77
+ nodes.add(name);
78
+ }
77
79
  }
78
80
  }
79
81
  },
@@ -82,7 +84,9 @@ function analyze(content) {
82
84
  if (path.node.callee.type === "Identifier" && path.node.callee.name === "_resolveComponent") {
83
85
  if (path.node.arguments[0].type === "StringLiteral") {
84
86
  const name = path.node.arguments[0].value;
85
- name && nodes.add(name);
87
+ if (name) {
88
+ nodes.add(name);
89
+ }
86
90
  }
87
91
  }
88
92
  }
@@ -182,7 +186,7 @@ function getComment(node) {
182
186
  return;
183
187
  }
184
188
  if (_comment.value.trim().startsWith("*")) {
185
- comment += `${_comment.value.trim().replace(/^[\s]*\*+[\s]*\**/gm, "").trim()}
189
+ comment += `${_comment.value.trim().replace(/^\s*\*+\s*\**/gm, "").trim()}
186
190
  `;
187
191
  }
188
192
  });
@@ -191,7 +195,7 @@ function getComment(node) {
191
195
  return;
192
196
  }
193
197
  if (_comment.value.trim().startsWith("*")) {
194
- comment += `${_comment.value.trim().replace(/^[\s]*\*+[\s]*\**/gm, "").trim()}
198
+ comment += `${_comment.value.trim().replace(/^\s*\*+\s*\**/gm, "").trim()}
195
199
  `;
196
200
  } else {
197
201
  comment += `${_comment.value.trim()}
@@ -2019,7 +2023,7 @@ function findLinearPaths(graph) {
2019
2023
  const linearPaths = [];
2020
2024
  const visitedNodes = /* @__PURE__ */ new Set();
2021
2025
  for (const [node, edges] of graph.entries()) {
2022
- if (edges.size === 1 && !visitedNodes.has(node) && node.type === "fun" /* fun */) {
2026
+ if (edges.size === 1 && !visitedNodes.has(node)) {
2023
2027
  const path = [node];
2024
2028
  let nextNode = Array.from(edges)[0];
2025
2029
  visitedNodes.add(node);