@absolutejs/absolute 0.19.0-beta.714 → 0.19.0-beta.716

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
@@ -49368,35 +49368,43 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49368
49368
  if (rewritten !== original)
49369
49369
  writeFileSync8(filePath, rewritten);
49370
49370
  }
49371
- }, collectUnvendoredImports = async (vendorDir, alreadyVendored) => {
49372
- const { readdirSync: readdirSync2, readFileSync: readFileSync15 } = await import("fs");
49371
+ }, collectTransitiveImports = async (specs, alreadyVendored) => {
49372
+ const { readFileSync: readFileSync15 } = await import("fs");
49373
49373
  const transpiler4 = new Bun.Transpiler({ loader: "js" });
49374
49374
  const newSpecs = new Set;
49375
- let entries;
49376
- try {
49377
- entries = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
49378
- } catch {
49379
- return newSpecs;
49380
- }
49381
- for (const entry of entries) {
49375
+ for (const spec of specs) {
49376
+ let resolved;
49382
49377
  try {
49383
- const content = readFileSync15(join22(vendorDir, entry), "utf-8");
49384
- const imports = transpiler4.scanImports(content);
49385
- for (const imp of imports) {
49386
- const spec = imp.path;
49387
- if (!isBareSpecifier(spec))
49388
- continue;
49389
- if (isFrameworkSpecifier(spec))
49390
- continue;
49391
- if (isAbsolutePackageSpecifier(spec))
49392
- continue;
49393
- if (alreadyVendored.has(spec))
49394
- continue;
49395
- if (!isResolvable4(spec))
49396
- continue;
49397
- newSpecs.add(spec);
49398
- }
49399
- } catch {}
49378
+ resolved = Bun.resolveSync(spec, process.cwd());
49379
+ } catch {
49380
+ continue;
49381
+ }
49382
+ let content;
49383
+ try {
49384
+ content = readFileSync15(resolved, "utf-8");
49385
+ } catch {
49386
+ continue;
49387
+ }
49388
+ let imports;
49389
+ try {
49390
+ imports = transpiler4.scanImports(content);
49391
+ } catch {
49392
+ continue;
49393
+ }
49394
+ for (const imp of imports) {
49395
+ const child = imp.path;
49396
+ if (!isBareSpecifier(child))
49397
+ continue;
49398
+ if (isFrameworkSpecifier(child))
49399
+ continue;
49400
+ if (isAbsolutePackageSpecifier(child))
49401
+ continue;
49402
+ if (alreadyVendored.has(child))
49403
+ continue;
49404
+ if (!isResolvable4(child))
49405
+ continue;
49406
+ newSpecs.add(child);
49407
+ }
49400
49408
  }
49401
49409
  return newSpecs;
49402
49410
  }, buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
@@ -49427,19 +49435,19 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49427
49435
  const tmpDir = join22(buildDir, "_dep_vendor_tmp");
49428
49436
  mkdirSync11(tmpDir, { recursive: true });
49429
49437
  const allSpecs = new Set(initialSpecs);
49430
- let success = true;
49438
+ let frontier = allSpecs;
49431
49439
  for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
49432
- const result = await buildDepVendorPass(Array.from(allSpecs), vendorDir, tmpDir);
49433
- if (!result.success) {
49434
- console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49435
- success = false;
49436
- break;
49437
- }
49438
- const additional = await collectUnvendoredImports(vendorDir, allSpecs);
49440
+ const additional = await collectTransitiveImports(frontier, allSpecs);
49439
49441
  if (additional.size === 0)
49440
49442
  break;
49441
49443
  for (const spec of additional)
49442
49444
  allSpecs.add(spec);
49445
+ frontier = additional;
49446
+ }
49447
+ const result = await buildDepVendorPass(Array.from(allSpecs), vendorDir, tmpDir);
49448
+ const success = result.success;
49449
+ if (!success) {
49450
+ console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49443
49451
  }
49444
49452
  await rm9(tmpDir, { force: true, recursive: true });
49445
49453
  if (success)
@@ -49450,9 +49458,19 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49450
49458
  }
49451
49459
  return paths;
49452
49460
  }, computeDepVendorPaths = async (directories) => {
49453
- const specifiers = await scanBareImports(directories);
49461
+ const initialSpecs = await scanBareImports(directories);
49462
+ const allSpecs = new Set(initialSpecs);
49463
+ let frontier = allSpecs;
49464
+ for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
49465
+ const additional = await collectTransitiveImports(frontier, allSpecs);
49466
+ if (additional.size === 0)
49467
+ break;
49468
+ for (const spec of additional)
49469
+ allSpecs.add(spec);
49470
+ frontier = additional;
49471
+ }
49454
49472
  const paths = {};
49455
- for (const specifier of specifiers) {
49473
+ for (const specifier of allSpecs) {
49456
49474
  paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
49457
49475
  }
49458
49476
  return paths;
@@ -58205,5 +58223,5 @@ export {
58205
58223
  ANGULAR_INIT_TIMEOUT_MS
58206
58224
  };
58207
58225
 
58208
- //# debugId=39CB1BA32A09A31C64756E2164756E21
58226
+ //# debugId=D1EB308E743E02DD64756E2164756E21
58209
58227
  //# sourceMappingURL=index.js.map