@absolutejs/absolute 0.19.0-beta.729 → 0.19.0-beta.730

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 CHANGED
@@ -44677,8 +44677,9 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44677
44677
  } catch {
44678
44678
  return false;
44679
44679
  }
44680
- }, isAngularBrowserSpecifier = (spec) => spec.startsWith("@angular/") && !SERVER_ONLY_ANGULAR_SPECIFIERS.has(spec), scanAngularSpecifiers = async (directories) => {
44681
- const found = new Set;
44680
+ }, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAngularBrowserSpecifier = (spec) => spec.startsWith("@angular/") && !SERVER_ONLY_ANGULAR_SPECIFIERS.has(spec), scanSourceImports = async (directories) => {
44681
+ const angular = new Set;
44682
+ const transitiveRoots = new Set;
44682
44683
  const transpiler4 = new Bun.Transpiler({ loader: "tsx" });
44683
44684
  const glob = new Glob6("**/*.{ts,tsx,js,jsx}");
44684
44685
  for (const dir of directories) {
@@ -44692,19 +44693,72 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44692
44693
  const content = await Bun.file(file4).text();
44693
44694
  for (const imp of transpiler4.scanImports(content)) {
44694
44695
  if (isAngularBrowserSpecifier(imp.path)) {
44695
- found.add(imp.path);
44696
+ angular.add(imp.path);
44697
+ } else if (isBareSpecifier(imp.path)) {
44698
+ transitiveRoots.add(imp.path);
44696
44699
  }
44697
44700
  }
44698
44701
  } catch {}
44699
44702
  }
44700
44703
  } catch {}
44701
44704
  }
44702
- return found;
44705
+ return { angular, transitiveRoots };
44706
+ }, collectTransitiveAngularSpecs = async (roots, angularFound) => {
44707
+ const { readFileSync: readFileSync11 } = await import("fs");
44708
+ const transpiler4 = new Bun.Transpiler({ loader: "js" });
44709
+ const visited = new Set;
44710
+ const frontier = [];
44711
+ for (const r of roots)
44712
+ frontier.push(r);
44713
+ const MAX_PASSES = 5;
44714
+ for (let pass = 0;pass < MAX_PASSES; pass++) {
44715
+ const next = [];
44716
+ for (const spec of frontier) {
44717
+ if (visited.has(spec))
44718
+ continue;
44719
+ visited.add(spec);
44720
+ let resolved;
44721
+ try {
44722
+ resolved = Bun.resolveSync(spec, process.cwd());
44723
+ } catch {
44724
+ continue;
44725
+ }
44726
+ let content;
44727
+ try {
44728
+ content = readFileSync11(resolved, "utf-8");
44729
+ } catch {
44730
+ continue;
44731
+ }
44732
+ let imports;
44733
+ try {
44734
+ imports = transpiler4.scanImports(content);
44735
+ } catch {
44736
+ continue;
44737
+ }
44738
+ for (const imp of imports) {
44739
+ const child = imp.path;
44740
+ if (!isBareSpecifier(child))
44741
+ continue;
44742
+ if (visited.has(child))
44743
+ continue;
44744
+ if (isAngularBrowserSpecifier(child)) {
44745
+ angularFound.add(child);
44746
+ }
44747
+ next.push(child);
44748
+ }
44749
+ }
44750
+ if (next.length === 0)
44751
+ break;
44752
+ frontier.length = 0;
44753
+ for (const s of next)
44754
+ frontier.push(s);
44755
+ }
44703
44756
  }, toSafeFileName2 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), resolveAngularSpecifiers = async (directories) => {
44704
- const discovered = await scanAngularSpecifiers(directories);
44757
+ const { angular, transitiveRoots } = await scanSourceImports(directories);
44705
44758
  for (const spec of REQUIRED_ANGULAR_SPECIFIERS)
44706
- discovered.add(spec);
44707
- return Array.from(discovered).filter(isResolvable2);
44759
+ angular.add(spec);
44760
+ await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
44761
+ return Array.from(angular).filter(isResolvable2);
44708
44762
  }, buildAngularVendor = async (buildDir, directories = []) => {
44709
44763
  const vendorDir = join17(buildDir, "angular", "vendor");
44710
44764
  mkdirSync7(vendorDir, { recursive: true });
@@ -49330,7 +49384,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49330
49384
  } catch {
49331
49385
  return false;
49332
49386
  }
49333
- }, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, FRAMEWORK_NAMESPACE_PREFIXES, isFrameworkSpecifier = (spec) => FRAMEWORK_SPECIFIERS.has(spec) || FRAMEWORK_NAMESPACE_PREFIXES.some((prefix) => spec.startsWith(prefix)), FRAMEWORK_EXTERNALS, isSkippedFile = (file4) => file4.includes("node_modules") || file4.includes("/build/") || file4.includes("/dist/") || file4.includes("/indexes/"), isDepSpecifier = (path2) => isBareSpecifier(path2) && !isFrameworkSpecifier(path2) && !isAbsolutePackageSpecifier(path2), isFrameworkRootCandidate = (path2) => isBareSpecifier(path2) && isFrameworkSpecifier(path2) && !isAbsolutePackageSpecifier(path2), readFileSpecifiers = async (file4, transpiler4) => {
49387
+ }, isBareSpecifier2 = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, FRAMEWORK_NAMESPACE_PREFIXES, isFrameworkSpecifier = (spec) => FRAMEWORK_SPECIFIERS.has(spec) || FRAMEWORK_NAMESPACE_PREFIXES.some((prefix) => spec.startsWith(prefix)), FRAMEWORK_EXTERNALS, isSkippedFile = (file4) => file4.includes("node_modules") || file4.includes("/build/") || file4.includes("/dist/") || file4.includes("/indexes/"), isDepSpecifier = (path2) => isBareSpecifier2(path2) && !isFrameworkSpecifier(path2) && !isAbsolutePackageSpecifier(path2), isFrameworkRootCandidate = (path2) => isBareSpecifier2(path2) && isFrameworkSpecifier(path2) && !isAbsolutePackageSpecifier(path2), readFileSpecifiers = async (file4, transpiler4) => {
49334
49388
  const dep = [];
49335
49389
  const framework = [];
49336
49390
  try {
@@ -49416,7 +49470,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49416
49470
  }
49417
49471
  for (const imp of imports) {
49418
49472
  const child = imp.path;
49419
- if (!isBareSpecifier(child))
49473
+ if (!isBareSpecifier2(child))
49420
49474
  continue;
49421
49475
  if (isFrameworkSpecifier(child))
49422
49476
  continue;
@@ -58250,5 +58304,5 @@ export {
58250
58304
  ANGULAR_INIT_TIMEOUT_MS
58251
58305
  };
58252
58306
 
58253
- //# debugId=47C754471691344664756E2164756E21
58307
+ //# debugId=426CE55C1D8D8B1C64756E2164756E21
58254
58308
  //# sourceMappingURL=index.js.map