@immense/vue-pom-generator 1.0.67 → 1.0.68

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
@@ -3522,6 +3522,14 @@ function safeRealpath(value) {
3522
3522
  const resolvedParent = safeRealpath(parent);
3523
3523
  return resolvedParent === parent ? value : path.join(resolvedParent, path.basename(value));
3524
3524
  }
3525
+ function normalizeScopePath(value, pathImpl = path) {
3526
+ return pathImpl.normalize(value);
3527
+ }
3528
+ function isNormalizedPathWithinDir(filePathAbs, dirPathAbs, pathImpl = path) {
3529
+ const normalizedFileAbs = normalizeScopePath(filePathAbs, pathImpl);
3530
+ const normalizedDirAbs = normalizeScopePath(dirPathAbs, pathImpl);
3531
+ return normalizedFileAbs === normalizedDirAbs || normalizedFileAbs.startsWith(`${normalizedDirAbs}${pathImpl.sep}`);
3532
+ }
3525
3533
  function isPathWithinDir(filePathAbs, dirPathAbs) {
3526
3534
  const fileAbs = path.resolve(filePathAbs);
3527
3535
  const dirAbs = path.resolve(dirPathAbs);
@@ -3551,6 +3559,43 @@ function resolveComponentNameFromPath(options) {
3551
3559
  }
3552
3560
  return toPascalCase(path.parse(normalizedAbsFilename).name);
3553
3561
  }
3562
+ function isFileInConfiguredSourceScope(options) {
3563
+ const { filename, projectRoot, viewsDirAbs, sourceDirs, extraRoots = [], pathImpl = path } = options;
3564
+ if (!filename) {
3565
+ return false;
3566
+ }
3567
+ const cleanFilename = filename.includes("?") ? filename.substring(0, filename.indexOf("?")) : filename;
3568
+ const normalizedProjectRoot = normalizeScopePath(projectRoot, pathImpl);
3569
+ const normalizedAbsFilename = normalizeScopePath(
3570
+ pathImpl.isAbsolute(cleanFilename) ? cleanFilename : pathImpl.resolve(normalizedProjectRoot, cleanFilename),
3571
+ pathImpl
3572
+ );
3573
+ if (normalizedAbsFilename.includes(`${pathImpl.sep}node_modules${pathImpl.sep}`) || normalizedAbsFilename.includes("/node_modules/")) {
3574
+ return false;
3575
+ }
3576
+ const normalizedViewsDirAbs = normalizeScopePath(viewsDirAbs, pathImpl);
3577
+ if (isNormalizedPathWithinDir(normalizedAbsFilename, normalizedViewsDirAbs, pathImpl)) {
3578
+ return true;
3579
+ }
3580
+ const rootsToTry = Array.from(/* @__PURE__ */ new Set([
3581
+ normalizedProjectRoot,
3582
+ ...extraRoots.map((root) => normalizeScopePath(root, pathImpl))
3583
+ ]));
3584
+ return sourceDirs.some((dir) => {
3585
+ return rootsToTry.some((root) => {
3586
+ const normalizedAbsDir = normalizeScopePath(pathImpl.resolve(root, dir), pathImpl);
3587
+ if (isNormalizedPathWithinDir(normalizedAbsFilename, normalizedAbsDir, pathImpl)) {
3588
+ return true;
3589
+ }
3590
+ if (dir.startsWith("app/") && pathImpl.basename(root) === "app") {
3591
+ const relativeDir = dir.substring(4);
3592
+ const normalizedAbsDirAlt = normalizeScopePath(pathImpl.resolve(root, relativeDir), pathImpl);
3593
+ return isNormalizedPathWithinDir(normalizedAbsFilename, normalizedAbsDirAlt, pathImpl);
3594
+ }
3595
+ return false;
3596
+ });
3597
+ });
3598
+ }
3554
3599
  let routerIntrospectionQueue = Promise.resolve();
3555
3600
  async function runRouterIntrospectionExclusive(fn) {
3556
3601
  const prev = routerIntrospectionQueue.catch(() => void 0);
@@ -8966,27 +9011,15 @@ function createVuePluginWithTestIds(options) {
8966
9011
  return false;
8967
9012
  const cleanPath = filename.includes("?") ? filename.substring(0, filename.indexOf("?")) : filename;
8968
9013
  const projectRoot = getProjectRoot();
8969
- const absFilename = path.isAbsolute(cleanPath) ? cleanPath : path.resolve(projectRoot, cleanPath);
8970
- if (absFilename.includes(`${path.sep}node_modules${path.sep}`) || absFilename.includes("/node_modules/"))
8971
- return false;
8972
- const viewsDirAbs = getViewsDirAbs();
8973
- if (absFilename.startsWith(viewsDirAbs + path.sep) || absFilename === viewsDirAbs)
8974
- return true;
8975
- const rootsToTry = [projectRoot, process.cwd()];
8976
- const matched = getSourceDirs().some((dir) => {
8977
- return rootsToTry.some((root) => {
8978
- const absDir = path.resolve(root, dir);
8979
- if (absFilename.startsWith(absDir + path.sep) || absFilename === absDir)
8980
- return true;
8981
- if (dir.startsWith("app/") && root.endsWith("/app")) {
8982
- const relativeDir = dir.substring(4);
8983
- const absDirAlt = path.resolve(root, relativeDir);
8984
- return absFilename.startsWith(absDirAlt + path.sep) || absFilename === absDirAlt;
8985
- }
8986
- return false;
8987
- });
9014
+ const matched = isFileInConfiguredSourceScope({
9015
+ filename,
9016
+ projectRoot,
9017
+ viewsDirAbs: getViewsDirAbs(),
9018
+ sourceDirs: getSourceDirs(),
9019
+ extraRoots: [process.cwd()]
8988
9020
  });
8989
9021
  if (cleanPath.endsWith(".vue") && !matched) {
9022
+ const absFilename = path.normalize(path.isAbsolute(cleanPath) ? cleanPath : path.resolve(projectRoot, cleanPath));
8990
9023
  loggerRef.current.debug(`[isFileInScope] REJECTED: ${absFilename} (Clean: ${cleanPath})`);
8991
9024
  }
8992
9025
  return matched;