@absolutejs/absolute 0.19.0-beta.713 → 0.19.0-beta.715

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,46 @@ 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
+ }, collectTransitiveImports = async (specs, alreadyVendored) => {
49372
+ const { readFileSync: readFileSync15 } = await import("fs");
49373
+ const transpiler4 = new Bun.Transpiler({ loader: "js" });
49374
+ const newSpecs = new Set;
49375
+ for (const spec of specs) {
49376
+ let resolved;
49377
+ try {
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
+ }
49408
+ }
49409
+ return newSpecs;
49410
+ }, buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
49379
49411
  const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
49380
49412
  const safeName = toSafeFileName5(specifier);
49381
49413
  const entryPath = join22(tmpDir, `${safeName}.ts`);
@@ -49383,7 +49415,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49383
49415
  await Bun.write(entryPath, source);
49384
49416
  return entryPath;
49385
49417
  }));
49386
- const result = await bunBuild8({
49418
+ return bunBuild8({
49387
49419
  entrypoints,
49388
49420
  external: FRAMEWORK_EXTERNALS,
49389
49421
  format: "esm",
@@ -49394,14 +49426,34 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49394
49426
  target: "browser",
49395
49427
  throw: false
49396
49428
  });
49397
- await rm9(tmpDir, { force: true, recursive: true });
49398
- if (!result.success) {
49429
+ }, MAX_VENDOR_DISCOVERY_PASSES = 5, buildDepVendor = async (buildDir, directories) => {
49430
+ const initialSpecs = await scanBareImports(directories);
49431
+ if (initialSpecs.length === 0)
49432
+ return {};
49433
+ const vendorDir = join22(buildDir, "vendor");
49434
+ mkdirSync11(vendorDir, { recursive: true });
49435
+ const tmpDir = join22(buildDir, "_dep_vendor_tmp");
49436
+ mkdirSync11(tmpDir, { recursive: true });
49437
+ const allSpecs = new Set(initialSpecs);
49438
+ let frontier = allSpecs;
49439
+ for (let pass = 0;pass < MAX_VENDOR_DISCOVERY_PASSES; pass++) {
49440
+ const additional = await collectTransitiveImports(frontier, allSpecs);
49441
+ if (additional.size === 0)
49442
+ break;
49443
+ for (const spec of additional)
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) {
49399
49450
  console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49400
49451
  }
49401
- if (result.success)
49452
+ await rm9(tmpDir, { force: true, recursive: true });
49453
+ if (success)
49402
49454
  await rewriteVendorFiles(vendorDir);
49403
49455
  const paths = {};
49404
- for (const specifier of specifiers) {
49456
+ for (const specifier of allSpecs) {
49405
49457
  paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
49406
49458
  }
49407
49459
  return paths;
@@ -58161,5 +58213,5 @@ export {
58161
58213
  ANGULAR_INIT_TIMEOUT_MS
58162
58214
  };
58163
58215
 
58164
- //# debugId=4DEFEF5281BE77E064756E2164756E21
58216
+ //# debugId=C5600232735DC36764756E2164756E21
58165
58217
  //# sourceMappingURL=index.js.map