@immense/vue-pom-generator 1.0.72 → 1.0.74

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
@@ -2616,10 +2616,28 @@ function tryGetExistingElementDataTestId(node, attributeName = "data-testid") {
2616
2616
  }
2617
2617
  const directive = existing;
2618
2618
  const exp = directive.exp;
2619
- if (!exp || exp.type !== NodeTypes.SIMPLE_EXPRESSION) {
2619
+ if (!exp) {
2620
+ return null;
2621
+ }
2622
+ let simpleExp;
2623
+ if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {
2624
+ simpleExp = exp;
2625
+ } else if (exp.type === NodeTypes.COMPOUND_EXPRESSION) {
2626
+ const compoundExp = exp;
2627
+ const source = compoundExp.loc?.source;
2628
+ if (!source) {
2629
+ return null;
2630
+ }
2631
+ simpleExp = {
2632
+ type: NodeTypes.SIMPLE_EXPRESSION,
2633
+ content: source,
2634
+ isStatic: false,
2635
+ constType: 0,
2636
+ loc: compoundExp.loc
2637
+ };
2638
+ } else {
2620
2639
  return null;
2621
2640
  }
2622
- const simpleExp = exp;
2623
2641
  const ast = tryGetVueExpressionAst(simpleExp, {
2624
2642
  preferredViews: ["content", "loc", "compiled"],
2625
2643
  plugins: ["typescript"]
@@ -5632,7 +5650,7 @@ function prepareViewObjectModelClass(componentName, dependencies, componentHiera
5632
5650
  }
5633
5651
  return match;
5634
5652
  };
5635
- const rawComponentRefsForInstances = isView ? usedComponentSet?.size ? usedComponentSet : childrenComponentSet : childrenComponentSet;
5653
+ const rawComponentRefsForInstances = usedComponentSet?.size ? usedComponentSet : childrenComponentSet;
5636
5654
  const componentRefsForInstances = /* @__PURE__ */ new Set();
5637
5655
  for (const ref of rawComponentRefsForInstances) {
5638
5656
  const resolvedRef = resolveTrackedComponentRef(ref) ?? normalizeTrackedComponentRef(ref);
@@ -7293,6 +7311,11 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
7293
7311
  }
7294
7312
  const element = node;
7295
7313
  const parentIsRoot = context?.parent?.type === NodeTypes.ROOT;
7314
+ {
7315
+ element.props.find(
7316
+ (p) => p.type === NodeTypes.DIRECTIVE && p.name === "bind" && p.arg?.type === NodeTypes.SIMPLE_EXPRESSION && p.arg.content === testIdAttribute && !!p.exp
7317
+ );
7318
+ }
7296
7319
  const parentElement = !parentIsRoot && context?.parent?.type === NodeTypes.ELEMENT ? context.parent : null;
7297
7320
  hierarchyMap.set(element, parentElement);
7298
7321
  const normalizeFilePath = (filePath) => path.normalize(safeRealpath2(path.resolve(filePath)));
@@ -8294,12 +8317,10 @@ function createDevProcessorPlugin(options) {
8294
8317
  regenerationSequence = currentRun.then(() => void 0, () => void 0);
8295
8318
  return currentRun;
8296
8319
  };
8297
- const watchedVueGlobs = getSourceDirRoots().map((scanDirAbs) => path.resolve(scanDirAbs, "**", "*.vue"));
8298
- const watchedPluginGlob = path.resolve(projectRootRef.current, "vite-plugins", "vue-pom-generator", "**", "*.ts");
8299
8320
  const runtimeDir = path.dirname(basePageClassPath);
8321
+ const localPluginDir = path.resolve(projectRootRef.current, "vite-plugins", "vue-pom-generator");
8300
8322
  server.watcher.add([
8301
- ...watchedVueGlobs,
8302
- watchedPluginGlob,
8323
+ ...fs.existsSync(localPluginDir) ? [localPluginDir] : [],
8303
8324
  basePageClassPath,
8304
8325
  path.resolve(runtimeDir, "pointer.ts"),
8305
8326
  path.resolve(runtimeDir, "callout.ts"),