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

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,14 +49368,38 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49368
49368
  if (rewritten !== original)
49369
49369
  writeFileSync8(filePath, rewritten);
49370
49370
  }
49371
- }, buildDepVendor = async (buildDir, directories) => {
49372
- const specifiers = await scanBareImports(directories);
49373
- if (specifiers.length === 0)
49374
- return {};
49375
- const vendorDir = join22(buildDir, "vendor");
49376
- mkdirSync11(vendorDir, { recursive: true });
49377
- const tmpDir = join22(buildDir, "_dep_vendor_tmp");
49378
- mkdirSync11(tmpDir, { recursive: true });
49371
+ }, collectUnvendoredImports = async (vendorDir, alreadyVendored) => {
49372
+ const { readdirSync: readdirSync2, readFileSync: readFileSync15 } = await import("fs");
49373
+ const transpiler4 = new Bun.Transpiler({ loader: "js" });
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) {
49382
+ 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 {}
49400
+ }
49401
+ return newSpecs;
49402
+ }, buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
49379
49403
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
49380
49404
  const safeName = toSafeFileName5(specifier);
49381
49405
  const entryPath = join22(tmpDir, `${safeName}.ts`);
@@ -49383,7 +49407,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49383
49407
  await Bun.write(entryPath, source);
49384
49408
  return entryPath;
49385
49409
  }));
49386
- const result = await bunBuild8({
49410
+ return bunBuild8({
49387
49411
  entrypoints,
49388
49412
  external: FRAMEWORK_EXTERNALS,
49389
49413
  format: "esm",
@@ -49394,14 +49418,34 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49394
49418
  target: "browser",
49395
49419
  throw: false
49396
49420
  });
49397
- await rm9(tmpDir, { force: true, recursive: true });
49398
- if (!result.success) {
49399
- console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49421
+ }, MAX_VENDOR_DISCOVERY_PASSES = 5, buildDepVendor = async (buildDir, directories) => {
49422
+ const initialSpecs = await scanBareImports(directories);
49423
+ if (initialSpecs.length === 0)
49424
+ return {};
49425
+ const vendorDir = join22(buildDir, "vendor");
49426
+ mkdirSync11(vendorDir, { recursive: true });
49427
+ const tmpDir = join22(buildDir, "_dep_vendor_tmp");
49428
+ mkdirSync11(tmpDir, { recursive: true });
49429
+ const allSpecs = new Set(initialSpecs);
49430
+ let success = true;
49431
+ 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);
49439
+ if (additional.size === 0)
49440
+ break;
49441
+ for (const spec of additional)
49442
+ allSpecs.add(spec);
49400
49443
  }
49401
- if (result.success)
49444
+ await rm9(tmpDir, { force: true, recursive: true });
49445
+ if (success)
49402
49446
  await rewriteVendorFiles(vendorDir);
49403
49447
  const paths = {};
49404
- for (const specifier of specifiers) {
49448
+ for (const specifier of allSpecs) {
49405
49449
  paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
49406
49450
  }
49407
49451
  return paths;
@@ -58161,5 +58205,5 @@ export {
58161
58205
  ANGULAR_INIT_TIMEOUT_MS
58162
58206
  };
58163
58207
 
58164
- //# debugId=4DEFEF5281BE77E064756E2164756E21
58208
+ //# debugId=39CB1BA32A09A31C64756E2164756E21
58165
58209
  //# sourceMappingURL=index.js.map