vue-hook-optimizer 0.0.54 → 0.0.55

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -513,7 +513,24 @@ function processSetup(ast, parentScope, parentPath, _spread, _lineOffset = 0) {
513
513
  return;
514
514
  }
515
515
  const watchArgs = /* @__PURE__ */ new Set();
516
- if (hookName === "watch") {
516
+ if (hookName === "provide") {
517
+ traverse2(path.node.expression, {
518
+ Identifier(path1) {
519
+ const binding = path1.scope.getBinding(path1.node.name);
520
+ 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)) {
521
+ const _node = nodeCollection.getNode(path1.node.name);
522
+ if (_node?.info?.used) {
523
+ _node?.info?.used?.add(hookName);
524
+ } else if (_node) {
525
+ _node.info = {
526
+ ..._node?.info,
527
+ used: /* @__PURE__ */ new Set([hookName])
528
+ };
529
+ }
530
+ }
531
+ }
532
+ }, path.scope, path);
533
+ } else if (hookName === "watch") {
517
534
  if (path.node.expression.arguments[0].type === "Identifier") {
518
535
  const binding = path.scope.getBinding(path.node.expression.arguments[0].name);
519
536
  if (graph.nodes.has(path.node.expression.arguments[0].name) && (binding?.scope.block.type === "Program" || parentScope === binding?.scope)) {
@@ -611,7 +628,8 @@ var vueLifeCycleHooks = [
611
628
  "deactivated",
612
629
  "errorCaptured",
613
630
  "renderTracked",
614
- "renderTriggered"
631
+ "renderTriggered",
632
+ "provide"
615
633
  ];
616
634
  function analyze3(content, lineOffset = 0, jsx = false) {
617
635
  const ast = (0, import_compiler_sfc3.babelParse)(content, { sourceType: "module", plugins: [