@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/build.js CHANGED
@@ -44485,8 +44485,9 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44485
44485
  } catch {
44486
44486
  return false;
44487
44487
  }
44488
- }, isAngularBrowserSpecifier = (spec) => spec.startsWith("@angular/") && !SERVER_ONLY_ANGULAR_SPECIFIERS.has(spec), scanAngularSpecifiers = async (directories) => {
44489
- const found = new Set;
44488
+ }, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAngularBrowserSpecifier = (spec) => spec.startsWith("@angular/") && !SERVER_ONLY_ANGULAR_SPECIFIERS.has(spec), scanSourceImports = async (directories) => {
44489
+ const angular = new Set;
44490
+ const transitiveRoots = new Set;
44490
44491
  const transpiler4 = new Bun.Transpiler({ loader: "tsx" });
44491
44492
  const glob = new Glob6("**/*.{ts,tsx,js,jsx}");
44492
44493
  for (const dir of directories) {
@@ -44500,19 +44501,72 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44500
44501
  const content = await Bun.file(file3).text();
44501
44502
  for (const imp of transpiler4.scanImports(content)) {
44502
44503
  if (isAngularBrowserSpecifier(imp.path)) {
44503
- found.add(imp.path);
44504
+ angular.add(imp.path);
44505
+ } else if (isBareSpecifier(imp.path)) {
44506
+ transitiveRoots.add(imp.path);
44504
44507
  }
44505
44508
  }
44506
44509
  } catch {}
44507
44510
  }
44508
44511
  } catch {}
44509
44512
  }
44510
- return found;
44513
+ return { angular, transitiveRoots };
44514
+ }, collectTransitiveAngularSpecs = async (roots, angularFound) => {
44515
+ const { readFileSync: readFileSync10 } = await import("fs");
44516
+ const transpiler4 = new Bun.Transpiler({ loader: "js" });
44517
+ const visited = new Set;
44518
+ const frontier = [];
44519
+ for (const r of roots)
44520
+ frontier.push(r);
44521
+ const MAX_PASSES = 5;
44522
+ for (let pass = 0;pass < MAX_PASSES; pass++) {
44523
+ const next = [];
44524
+ for (const spec of frontier) {
44525
+ if (visited.has(spec))
44526
+ continue;
44527
+ visited.add(spec);
44528
+ let resolved;
44529
+ try {
44530
+ resolved = Bun.resolveSync(spec, process.cwd());
44531
+ } catch {
44532
+ continue;
44533
+ }
44534
+ let content;
44535
+ try {
44536
+ content = readFileSync10(resolved, "utf-8");
44537
+ } catch {
44538
+ continue;
44539
+ }
44540
+ let imports;
44541
+ try {
44542
+ imports = transpiler4.scanImports(content);
44543
+ } catch {
44544
+ continue;
44545
+ }
44546
+ for (const imp of imports) {
44547
+ const child = imp.path;
44548
+ if (!isBareSpecifier(child))
44549
+ continue;
44550
+ if (visited.has(child))
44551
+ continue;
44552
+ if (isAngularBrowserSpecifier(child)) {
44553
+ angularFound.add(child);
44554
+ }
44555
+ next.push(child);
44556
+ }
44557
+ }
44558
+ if (next.length === 0)
44559
+ break;
44560
+ frontier.length = 0;
44561
+ for (const s of next)
44562
+ frontier.push(s);
44563
+ }
44511
44564
  }, toSafeFileName2 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), resolveAngularSpecifiers = async (directories) => {
44512
- const discovered = await scanAngularSpecifiers(directories);
44565
+ const { angular, transitiveRoots } = await scanSourceImports(directories);
44513
44566
  for (const spec of REQUIRED_ANGULAR_SPECIFIERS)
44514
- discovered.add(spec);
44515
- return Array.from(discovered).filter(isResolvable2);
44567
+ angular.add(spec);
44568
+ await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
44569
+ return Array.from(angular).filter(isResolvable2);
44516
44570
  }, buildAngularVendor = async (buildDir, directories = []) => {
44517
44571
  const vendorDir = join17(buildDir, "angular", "vendor");
44518
44572
  mkdirSync7(vendorDir, { recursive: true });
@@ -49253,7 +49307,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49253
49307
  } catch {
49254
49308
  return false;
49255
49309
  }
49256
- }, 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 = (file3) => file3.includes("node_modules") || file3.includes("/build/") || file3.includes("/dist/") || file3.includes("/indexes/"), isDepSpecifier = (path2) => isBareSpecifier(path2) && !isFrameworkSpecifier(path2) && !isAbsolutePackageSpecifier(path2), isFrameworkRootCandidate = (path2) => isBareSpecifier(path2) && isFrameworkSpecifier(path2) && !isAbsolutePackageSpecifier(path2), readFileSpecifiers = async (file3, transpiler4) => {
49310
+ }, 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 = (file3) => file3.includes("node_modules") || file3.includes("/build/") || file3.includes("/dist/") || file3.includes("/indexes/"), isDepSpecifier = (path2) => isBareSpecifier2(path2) && !isFrameworkSpecifier(path2) && !isAbsolutePackageSpecifier(path2), isFrameworkRootCandidate = (path2) => isBareSpecifier2(path2) && isFrameworkSpecifier(path2) && !isAbsolutePackageSpecifier(path2), readFileSpecifiers = async (file3, transpiler4) => {
49257
49311
  const dep = [];
49258
49312
  const framework = [];
49259
49313
  try {
@@ -49339,7 +49393,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49339
49393
  }
49340
49394
  for (const imp of imports) {
49341
49395
  const child = imp.path;
49342
- if (!isBareSpecifier(child))
49396
+ if (!isBareSpecifier2(child))
49343
49397
  continue;
49344
49398
  if (isFrameworkSpecifier(child))
49345
49399
  continue;
@@ -49790,5 +49844,5 @@ export {
49790
49844
  build
49791
49845
  };
49792
49846
 
49793
- //# debugId=6C0C1D8992C0647F64756E2164756E21
49847
+ //# debugId=E0F6246E173214AB64756E2164756E21
49794
49848
  //# sourceMappingURL=build.js.map