@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/build.js CHANGED
@@ -49291,35 +49291,43 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49291
49291
  if (rewritten !== original)
49292
49292
  writeFileSync8(filePath, rewritten);
49293
49293
  }
49294
- }, collectUnvendoredImports = async (vendorDir, alreadyVendored) => {
49295
- const { readdirSync: readdirSync2, readFileSync: readFileSync15 } = await import("fs");
49294
+ }, collectTransitiveImports = async (specs, alreadyVendored) => {
49295
+ const { readFileSync: readFileSync15 } = await import("fs");
49296
49296
  const transpiler4 = new Bun.Transpiler({ loader: "js" });
49297
49297
  const newSpecs = new Set;
49298
- let entries;
49299
- try {
49300
- entries = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
49301
- } catch {
49302
- return newSpecs;
49303
- }
49304
- for (const entry of entries) {
49298
+ for (const spec of specs) {
49299
+ let resolved;
49305
49300
  try {
49306
- const content = readFileSync15(join22(vendorDir, entry), "utf-8");
49307
- const imports = transpiler4.scanImports(content);
49308
- for (const imp of imports) {
49309
- const spec = imp.path;
49310
- if (!isBareSpecifier(spec))
49311
- continue;
49312
- if (isFrameworkSpecifier(spec))
49313
- continue;
49314
- if (isAbsolutePackageSpecifier(spec))
49315
- continue;
49316
- if (alreadyVendored.has(spec))
49317
- continue;
49318
- if (!isResolvable4(spec))
49319
- continue;
49320
- newSpecs.add(spec);
49321
- }
49322
- } catch {}
49301
+ resolved = Bun.resolveSync(spec, process.cwd());
49302
+ } catch {
49303
+ continue;
49304
+ }
49305
+ let content;
49306
+ try {
49307
+ content = readFileSync15(resolved, "utf-8");
49308
+ } catch {
49309
+ continue;
49310
+ }
49311
+ let imports;
49312
+ try {
49313
+ imports = transpiler4.scanImports(content);
49314
+ } catch {
49315
+ continue;
49316
+ }
49317
+ for (const imp of imports) {
49318
+ const child = imp.path;
49319
+ if (!isBareSpecifier(child))
49320
+ continue;
49321
+ if (isFrameworkSpecifier(child))
49322
+ continue;
49323
+ if (isAbsolutePackageSpecifier(child))
49324
+ continue;
49325
+ if (alreadyVendored.has(child))
49326
+ continue;
49327
+ if (!isResolvable4(child))
49328
+ continue;
49329
+ newSpecs.add(child);
49330
+ }
49323
49331
  }
49324
49332
  return newSpecs;
49325
49333
  }, buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
@@ -49350,19 +49358,19 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49350
49358
  const tmpDir = join22(buildDir, "_dep_vendor_tmp");
49351
49359
  mkdirSync11(tmpDir, { recursive: true });
49352
49360
  const allSpecs = new Set(initialSpecs);
49353
- let success = true;
49361
+ let frontier = allSpecs;
49354
49362
  for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
49355
- const result = await buildDepVendorPass(Array.from(allSpecs), vendorDir, tmpDir);
49356
- if (!result.success) {
49357
- console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49358
- success = false;
49359
- break;
49360
- }
49361
- const additional = await collectUnvendoredImports(vendorDir, allSpecs);
49363
+ const additional = await collectTransitiveImports(frontier, allSpecs);
49362
49364
  if (additional.size === 0)
49363
49365
  break;
49364
49366
  for (const spec of additional)
49365
49367
  allSpecs.add(spec);
49368
+ frontier = additional;
49369
+ }
49370
+ const result = await buildDepVendorPass(Array.from(allSpecs), vendorDir, tmpDir);
49371
+ const success = result.success;
49372
+ if (!success) {
49373
+ console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49366
49374
  }
49367
49375
  await rm9(tmpDir, { force: true, recursive: true });
49368
49376
  if (success)
@@ -49373,9 +49381,19 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49373
49381
  }
49374
49382
  return paths;
49375
49383
  }, computeDepVendorPaths = async (directories) => {
49376
- const specifiers = await scanBareImports(directories);
49384
+ const initialSpecs = await scanBareImports(directories);
49385
+ const allSpecs = new Set(initialSpecs);
49386
+ let frontier = allSpecs;
49387
+ for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
49388
+ const additional = await collectTransitiveImports(frontier, allSpecs);
49389
+ if (additional.size === 0)
49390
+ break;
49391
+ for (const spec of additional)
49392
+ allSpecs.add(spec);
49393
+ frontier = additional;
49394
+ }
49377
49395
  const paths = {};
49378
- for (const specifier of specifiers) {
49396
+ for (const specifier of allSpecs) {
49379
49397
  paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
49380
49398
  }
49381
49399
  return paths;
@@ -49745,5 +49763,5 @@ export {
49745
49763
  build
49746
49764
  };
49747
49765
 
49748
- //# debugId=E7551863E14CA1D564756E2164756E21
49766
+ //# debugId=9E5578DF152AD2CB64756E2164756E21
49749
49767
  //# sourceMappingURL=build.js.map