vue-hook-optimizer 0.0.54 → 0.0.55

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.mjs CHANGED
@@ -471,7 +471,24 @@ function processSetup(ast, parentScope, parentPath, _spread, _lineOffset = 0) {
471
471
  return;
472
472
  }
473
473
  const watchArgs = /* @__PURE__ */ new Set();
474
- if (hookName === "watch") {
474
+ if (hookName === "provide") {
475
+ traverse2(path.node.expression, {
476
+ Identifier(path1) {
477
+ const binding = path1.scope.getBinding(path1.node.name);
478
+ if (graph.nodes.has(path1.node.name) && (path1.parent.type !== "MemberExpression" && path1.parent.type !== "OptionalMemberExpression" || path1.parent.object === path1.node) && (binding?.scope.block.type === "Program" || parentScope === binding?.scope)) {
479
+ const _node = nodeCollection.getNode(path1.node.name);
480
+ if (_node?.info?.used) {
481
+ _node?.info?.used?.add(hookName);
482
+ } else if (_node) {
483
+ _node.info = {
484
+ ..._node?.info,
485
+ used: /* @__PURE__ */ new Set([hookName])
486
+ };
487
+ }
488
+ }
489
+ }
490
+ }, path.scope, path);
491
+ } else if (hookName === "watch") {
475
492
  if (path.node.expression.arguments[0].type === "Identifier") {
476
493
  const binding = path.scope.getBinding(path.node.expression.arguments[0].name);
477
494
  if (graph.nodes.has(path.node.expression.arguments[0].name) && (binding?.scope.block.type === "Program" || parentScope === binding?.scope)) {
@@ -569,7 +586,8 @@ var vueLifeCycleHooks = [
569
586
  "deactivated",
570
587
  "errorCaptured",
571
588
  "renderTracked",
572
- "renderTriggered"
589
+ "renderTriggered",
590
+ "provide"
573
591
  ];
574
592
  function analyze3(content, lineOffset = 0, jsx = false) {
575
593
  const ast = babelParse3(content, { sourceType: "module", plugins: [