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

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
@@ -49330,14 +49330,19 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49330
49330
  } catch {
49331
49331
  return false;
49332
49332
  }
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), readFileSpecifiers = async (file4, transpiler4) => {
49334
- const empty = [];
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) => {
49334
+ const dep = [];
49335
+ const framework = [];
49335
49336
  try {
49336
49337
  const content = await Bun.file(file4).text();
49337
- return transpiler4.scanImports(content).map((imp) => imp.path).filter(isDepSpecifier);
49338
- } catch {
49339
- return empty;
49340
- }
49338
+ for (const imp of transpiler4.scanImports(content)) {
49339
+ if (isDepSpecifier(imp.path))
49340
+ dep.push(imp.path);
49341
+ else if (isFrameworkRootCandidate(imp.path))
49342
+ framework.push(imp.path);
49343
+ }
49344
+ } catch {}
49345
+ return { dep, framework };
49341
49346
  }, scanDirFiles = async (dir) => {
49342
49347
  const empty = [];
49343
49348
  const glob = new Glob9("**/*.{ts,tsx,js,jsx}");
@@ -49347,17 +49352,24 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49347
49352
  } catch {
49348
49353
  return empty;
49349
49354
  }
49350
- }, collectDirSpecifiers = async (dir, transpiler4, specifiers) => {
49355
+ }, collectDirSpecifiers = async (dir, transpiler4, dep, framework) => {
49351
49356
  const files = await scanDirFiles(dir);
49352
49357
  const results = await Promise.all(files.map((file4) => readFileSpecifiers(file4, transpiler4)));
49353
- for (const spec of results.flat()) {
49354
- specifiers.add(spec);
49358
+ for (const result of results) {
49359
+ for (const spec of result.dep)
49360
+ dep.add(spec);
49361
+ for (const spec of result.framework)
49362
+ framework.add(spec);
49355
49363
  }
49356
49364
  }, scanBareImports = async (directories) => {
49357
- const specifiers = new Set;
49365
+ const dep = new Set;
49366
+ const framework = new Set;
49358
49367
  const transpiler4 = new Bun.Transpiler({ loader: "tsx" });
49359
- await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler4, specifiers)));
49360
- return Array.from(specifiers).filter(isResolvable4);
49368
+ await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler4, dep, framework)));
49369
+ return {
49370
+ dep: Array.from(dep).filter(isResolvable4),
49371
+ framework: Array.from(framework).filter(isResolvable4)
49372
+ };
49361
49373
  }, generateEntrySource2 = (specifier) => `export * from '${specifier}';
49362
49374
  `, rewriteVendorFiles = async (vendorDir) => {
49363
49375
  const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync8 } = await import("fs");
@@ -49376,11 +49388,14 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49376
49388
  if (rewritten !== original)
49377
49389
  writeFileSync8(filePath, rewritten);
49378
49390
  }
49379
- }, collectTransitiveImports = async (specs, alreadyVendored) => {
49391
+ }, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49380
49392
  const { readFileSync: readFileSync15 } = await import("fs");
49381
49393
  const transpiler4 = new Bun.Transpiler({ loader: "js" });
49382
49394
  const newSpecs = new Set;
49383
49395
  for (const spec of specs) {
49396
+ if (alreadyScanned.has(spec))
49397
+ continue;
49398
+ alreadyScanned.add(spec);
49384
49399
  let resolved;
49385
49400
  try {
49386
49401
  resolved = Bun.resolveSync(spec, process.cwd());
@@ -49435,23 +49450,26 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49435
49450
  throw: false
49436
49451
  });
49437
49452
  }, MAX_VENDOR_DISCOVERY_PASSES = 5, buildDepVendor = async (buildDir, directories) => {
49438
- const initialSpecs = await scanBareImports(directories);
49439
- if (initialSpecs.length === 0)
49453
+ const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
49454
+ if (initialSpecs.length === 0 && frameworkRoots.length === 0)
49440
49455
  return {};
49441
49456
  const vendorDir = join22(buildDir, "vendor");
49442
49457
  mkdirSync11(vendorDir, { recursive: true });
49443
49458
  const tmpDir = join22(buildDir, "_dep_vendor_tmp");
49444
49459
  mkdirSync11(tmpDir, { recursive: true });
49445
49460
  const allSpecs = new Set(initialSpecs);
49446
- let frontier = allSpecs;
49461
+ const alreadyScanned = new Set;
49462
+ let frontier = [...allSpecs, ...frameworkRoots];
49447
49463
  for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
49448
- const additional = await collectTransitiveImports(frontier, allSpecs);
49464
+ const additional = await collectTransitiveImports(frontier, allSpecs, alreadyScanned);
49449
49465
  if (additional.size === 0)
49450
49466
  break;
49451
49467
  for (const spec of additional)
49452
49468
  allSpecs.add(spec);
49453
49469
  frontier = additional;
49454
49470
  }
49471
+ if (allSpecs.size === 0)
49472
+ return {};
49455
49473
  const result = await buildDepVendorPass(Array.from(allSpecs), vendorDir, tmpDir);
49456
49474
  const success = result.success;
49457
49475
  if (!success) {
@@ -49466,11 +49484,12 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49466
49484
  }
49467
49485
  return paths;
49468
49486
  }, computeDepVendorPaths = async (directories) => {
49469
- const initialSpecs = await scanBareImports(directories);
49487
+ const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
49470
49488
  const allSpecs = new Set(initialSpecs);
49471
- let frontier = allSpecs;
49489
+ const alreadyScanned = new Set;
49490
+ let frontier = [...allSpecs, ...frameworkRoots];
49472
49491
  for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
49473
- const additional = await collectTransitiveImports(frontier, allSpecs);
49492
+ const additional = await collectTransitiveImports(frontier, allSpecs, alreadyScanned);
49474
49493
  if (additional.size === 0)
49475
49494
  break;
49476
49495
  for (const spec of additional)
@@ -58231,5 +58250,5 @@ export {
58231
58250
  ANGULAR_INIT_TIMEOUT_MS
58232
58251
  };
58233
58252
 
58234
- //# debugId=E52A7C5A1A64CF7564756E2164756E21
58253
+ //# debugId=47C754471691344664756E2164756E21
58235
58254
  //# sourceMappingURL=index.js.map