vue-hook-optimizer 0.0.53 → 0.0.54
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 +6 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
    
        package/dist/index.mjs
    CHANGED
    
    | @@ -160,6 +160,7 @@ function getComment(node) { | |
| 160 160 |  | 
| 161 161 | 
             
            // src/analyze/setupScript.ts
         | 
| 162 162 | 
             
            var traverse2 = _traverse2.default?.default || _traverse2.default || _traverse2;
         | 
| 163 | 
            +
            var ignoreFunctionsName = ["defineProps", "defineEmits", "withDefaults"];
         | 
| 163 164 | 
             
            function processSetup(ast, parentScope, parentPath, _spread, _lineOffset = 0) {
         | 
| 164 165 | 
             
              const spread = _spread || [];
         | 
| 165 166 | 
             
              const nodeCollection = new NodeCollection(_lineOffset);
         | 
| @@ -176,7 +177,7 @@ function processSetup(ast, parentScope, parentPath, _spread, _lineOffset = 0) { | |
| 176 177 | 
             
                        if (element?.type === "Identifier") {
         | 
| 177 178 | 
             
                          const name = element.name;
         | 
| 178 179 | 
             
                          const binding = path.scope.getBinding(name);
         | 
| 179 | 
            -
                          if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" &&  | 
| 180 | 
            +
                          if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" && ignoreFunctionsName.includes(declaration.init?.callee.name))) {
         | 
| 180 181 | 
             
                            graph.nodes.add(name);
         | 
| 181 182 | 
             
                            nodeCollection.addNode(name, element, {
         | 
| 182 183 | 
             
                              comment: getComment(path.node)
         | 
| @@ -189,7 +190,7 @@ function processSetup(ast, parentScope, parentPath, _spread, _lineOffset = 0) { | |
| 189 190 | 
             
                        if (element?.type === "RestElement" && element.argument.type === "Identifier") {
         | 
| 190 191 | 
             
                          const name = element.argument.name;
         | 
| 191 192 | 
             
                          const binding = path.scope.getBinding(name);
         | 
| 192 | 
            -
                          if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" &&  | 
| 193 | 
            +
                          if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" && ignoreFunctionsName.includes(declaration.init?.callee.name))) {
         | 
| 193 194 | 
             
                            graph.nodes.add(name);
         | 
| 194 195 | 
             
                            nodeCollection.addNode(name, element.argument, {
         | 
| 195 196 | 
             
                              comment: getComment(path.node)
         | 
| @@ -206,7 +207,7 @@ function processSetup(ast, parentScope, parentPath, _spread, _lineOffset = 0) { | |
| 206 207 | 
             
                        if (property.type === "ObjectProperty" && property.value.type === "Identifier") {
         | 
| 207 208 | 
             
                          const name = property.value.name;
         | 
| 208 209 | 
             
                          const binding = path.scope.getBinding(name);
         | 
| 209 | 
            -
                          if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" &&  | 
| 210 | 
            +
                          if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" && ignoreFunctionsName.includes(declaration.init?.callee.name))) {
         | 
| 210 211 | 
             
                            graph.nodes.add(name);
         | 
| 211 212 | 
             
                            nodeCollection.addNode(name, property.value, {
         | 
| 212 213 | 
             
                              comment: getComment(property)
         | 
| @@ -219,7 +220,7 @@ function processSetup(ast, parentScope, parentPath, _spread, _lineOffset = 0) { | |
| 219 220 | 
             
                        if (property.type === "RestElement" && property.argument.type === "Identifier") {
         | 
| 220 221 | 
             
                          const name = property.argument.name;
         | 
| 221 222 | 
             
                          const binding = path.scope.getBinding(name);
         | 
| 222 | 
            -
                          if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" &&  | 
| 223 | 
            +
                          if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" && ignoreFunctionsName.includes(declaration.init?.callee.name))) {
         | 
| 223 224 | 
             
                            graph.nodes.add(name);
         | 
| 224 225 | 
             
                            nodeCollection.addNode(name, property.argument, {
         | 
| 225 226 | 
             
                              comment: getComment(property)
         | 
| @@ -234,7 +235,7 @@ function processSetup(ast, parentScope, parentPath, _spread, _lineOffset = 0) { | |
| 234 235 | 
             
                    if (declaration.id?.type === "Identifier") {
         | 
| 235 236 | 
             
                      const name = declaration.id.name;
         | 
| 236 237 | 
             
                      const binding = path.scope.getBinding(name);
         | 
| 237 | 
            -
                      if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" &&  | 
| 238 | 
            +
                      if (binding && (path.parent.type === "Program" || parentPath?.type === "ObjectMethod" && parentPath.body === path.parent) && !(declaration.init?.type === "CallExpression" && declaration.init?.callee.type === "Identifier" && ignoreFunctionsName.includes(declaration.init?.callee.name))) {
         | 
| 238 239 | 
             
                        graph.nodes.add(name);
         | 
| 239 240 | 
             
                        nodeCollection.addNode(name, declaration, {
         | 
| 240 241 | 
             
                          comment: getComment(path.node)
         |