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.mjs CHANGED
@@ -30,7 +30,9 @@ function analyze(content) {
30
30
  if (path.node.key.type === "Identifier" && path.node.key.name === "ref") {
31
31
  if (path.node.value.type === "StringLiteral") {
32
32
  const name = path.node.value.value;
33
- name && nodes.add(name);
33
+ if (name) {
34
+ nodes.add(name);
35
+ }
34
36
  }
35
37
  }
36
38
  },
@@ -39,7 +41,9 @@ function analyze(content) {
39
41
  if (path.node.callee.type === "Identifier" && path.node.callee.name === "_resolveComponent") {
40
42
  if (path.node.arguments[0].type === "StringLiteral") {
41
43
  const name = path.node.arguments[0].value;
42
- name && nodes.add(name);
44
+ if (name) {
45
+ nodes.add(name);
46
+ }
43
47
  }
44
48
  }
45
49
  }
@@ -139,7 +143,7 @@ function getComment(node) {
139
143
  return;
140
144
  }
141
145
  if (_comment.value.trim().startsWith("*")) {
142
- comment += `${_comment.value.trim().replace(/^[\s]*\*+[\s]*\**/gm, "").trim()}
146
+ comment += `${_comment.value.trim().replace(/^\s*\*+\s*\**/gm, "").trim()}
143
147
  `;
144
148
  }
145
149
  });
@@ -148,7 +152,7 @@ function getComment(node) {
148
152
  return;
149
153
  }
150
154
  if (_comment.value.trim().startsWith("*")) {
151
- comment += `${_comment.value.trim().replace(/^[\s]*\*+[\s]*\**/gm, "").trim()}
155
+ comment += `${_comment.value.trim().replace(/^\s*\*+\s*\**/gm, "").trim()}
152
156
  `;
153
157
  } else {
154
158
  comment += `${_comment.value.trim()}
@@ -1976,7 +1980,7 @@ function findLinearPaths(graph) {
1976
1980
  const linearPaths = [];
1977
1981
  const visitedNodes = /* @__PURE__ */ new Set();
1978
1982
  for (const [node, edges] of graph.entries()) {
1979
- if (edges.size === 1 && !visitedNodes.has(node) && node.type === "fun" /* fun */) {
1983
+ if (edges.size === 1 && !visitedNodes.has(node)) {
1980
1984
  const path = [node];
1981
1985
  let nextNode = Array.from(edges)[0];
1982
1986
  visitedNodes.add(node);