@absolutejs/absolute 0.19.0-beta.730 → 0.19.0-beta.732

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
@@ -44471,6 +44471,7 @@ var init_buildReactVendor = __esm(() => {
44471
44471
  // src/build/buildAngularVendor.ts
44472
44472
  var exports_buildAngularVendor = {};
44473
44473
  __export(exports_buildAngularVendor, {
44474
+ computeAngularVendorPathsAsync: () => computeAngularVendorPathsAsync,
44474
44475
  computeAngularVendorPaths: () => computeAngularVendorPaths,
44475
44476
  buildAngularVendor: () => buildAngularVendor
44476
44477
  });
@@ -44602,6 +44603,9 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44602
44603
  paths[specifier] = `/angular/vendor/${toSafeFileName2(specifier)}.js`;
44603
44604
  }
44604
44605
  return paths;
44606
+ }, computeAngularVendorPathsAsync = async (directories = []) => {
44607
+ const specifiers = await resolveAngularSpecifiers(directories);
44608
+ return computeAngularVendorPaths(specifiers);
44605
44609
  };
44606
44610
  var init_buildAngularVendor = __esm(() => {
44607
44611
  init_angularLinkerPlugin();
@@ -44759,6 +44763,7 @@ var init_buildSvelteVendor = __esm(() => {
44759
44763
  // src/build/rewriteImports.ts
44760
44764
  var exports_rewriteImports = {};
44761
44765
  __export(exports_rewriteImports, {
44766
+ rewriteVendorDirectories: () => rewriteVendorDirectories,
44762
44767
  rewriteImports: () => rewriteImports
44763
44768
  });
44764
44769
  var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
@@ -44786,6 +44791,19 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
44786
44791
  await Bun.write(filePath, content);
44787
44792
  }
44788
44793
  }));
44794
+ }, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
44795
+ if (Object.keys(vendorPaths).length === 0)
44796
+ return;
44797
+ const { readdirSync } = await import("fs");
44798
+ const { join: join20 } = await import("path");
44799
+ const allFiles = [];
44800
+ for (const dir of vendorDirs) {
44801
+ try {
44802
+ const files = readdirSync(dir).filter((f) => f.endsWith(".js")).map((f) => join20(dir, f));
44803
+ allFiles.push(...files);
44804
+ } catch {}
44805
+ }
44806
+ await rewriteImports(allFiles, vendorPaths);
44789
44807
  };
44790
44808
  var init_rewriteImports = __esm(() => {
44791
44809
  init_nativeRewrite();
@@ -49348,24 +49366,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49348
49366
  framework: Array.from(framework).filter(isResolvable4)
49349
49367
  };
49350
49368
  }, generateEntrySource2 = (specifier) => `export * from '${specifier}';
49351
- `, rewriteVendorFiles = async (vendorDir) => {
49352
- const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync8 } = await import("fs");
49353
- const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
49354
- const reactPaths = Object.entries(computeVendorPaths2());
49355
- const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
49356
- const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
49357
- const re2 = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
49358
- return acc.replace(re2, `$1${webPath}$2`);
49359
- }, content);
49360
- const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
49361
- for (const file3 of files) {
49362
- const filePath = join22(vendorDir, file3);
49363
- const original = readFileSync15(filePath, "utf-8");
49364
- const rewritten = rewriteContent(original);
49365
- if (rewritten !== original)
49366
- writeFileSync8(filePath, rewritten);
49367
- }
49368
- }, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49369
+ `, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49369
49370
  const { readFileSync: readFileSync15 } = await import("fs");
49370
49371
  const transpiler4 = new Bun.Transpiler({ loader: "js" });
49371
49372
  const newSpecs = new Set;
@@ -49453,8 +49454,6 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49453
49454
  console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49454
49455
  }
49455
49456
  await rm9(tmpDir, { force: true, recursive: true });
49456
- if (success)
49457
- await rewriteVendorFiles(vendorDir);
49458
49457
  const paths = {};
49459
49458
  for (const specifier of allSpecs) {
49460
49459
  paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
@@ -49628,7 +49627,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49628
49627
  setDevVendorPaths(computeVendorPaths());
49629
49628
  }
49630
49629
  if (cached?.hmrState.config.angularDirectory) {
49631
- setAngularVendorPaths(computeAngularVendorPaths());
49630
+ setAngularVendorPaths(computeAngularVendorPaths(globalThis.__angularVendorSpecifiers));
49632
49631
  }
49633
49632
  if (cached?.hmrState.config.svelteDirectory) {
49634
49633
  setSvelteVendorPaths(computeSvelteVendorPaths());
@@ -49709,9 +49708,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49709
49708
  if (config.reactDirectory) {
49710
49709
  setDevVendorPaths(computeVendorPaths());
49711
49710
  }
49712
- if (config.angularDirectory) {
49713
- setAngularVendorPaths(computeAngularVendorPaths());
49714
- }
49715
49711
  if (config.svelteDirectory) {
49716
49712
  setSvelteVendorPaths(computeSvelteVendorPaths());
49717
49713
  }
@@ -49719,6 +49715,9 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49719
49715
  setVueVendorPaths(computeVueVendorPaths());
49720
49716
  }
49721
49717
  const sourceDirs = collectDepVendorSourceDirs(config);
49718
+ if (config.angularDirectory) {
49719
+ setAngularVendorPaths(await computeAngularVendorPathsAsync(sourceDirs));
49720
+ }
49722
49721
  const { computeDepVendorPaths: computeDepVendorPaths2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49723
49722
  globalThis.__depVendorPaths = await computeDepVendorPaths2(sourceDirs);
49724
49723
  recordStep("prepare vendor paths", stepStartedAt);
@@ -49745,46 +49744,54 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49745
49744
  cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
49746
49745
  recordStep("populate asset store", stepStartedAt);
49747
49746
  stepStartedAt = performance.now();
49748
- const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
49749
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "react", "vendor");
49750
- await loadVendorFiles(state.assetStore, vendorDir, "react");
49751
- if (!globalThis.__reactModuleRef) {
49752
- globalThis.__reactModuleRef = await import("react");
49753
- }
49754
- return true;
49755
- }) : undefined;
49756
- const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs).then(async (specs) => {
49757
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "angular", "vendor");
49758
- await loadVendorFiles(state.assetStore, vendorDir, "angular");
49759
- globalThis.__angularVendorSpecifiers = specs;
49760
- return true;
49761
- }) : undefined;
49762
- const buildSvelteVendorTask = config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir).then(async () => {
49763
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "svelte", "vendor");
49764
- await loadVendorFiles(state.assetStore, vendorDir, "svelte");
49765
- return true;
49766
- }) : undefined;
49767
- const buildVueVendorTask = config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir).then(async () => {
49768
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "vue", "vendor");
49769
- await loadVendorFiles(state.assetStore, vendorDir, "vue");
49770
- return true;
49771
- }) : undefined;
49747
+ const reactVendorDir = resolve32(state.resolvedPaths.buildDir, "react", "vendor");
49748
+ const angularVendorDir = resolve32(state.resolvedPaths.buildDir, "angular", "vendor");
49749
+ const svelteVendorDir = resolve32(state.resolvedPaths.buildDir, "svelte", "vendor");
49750
+ const vueVendorDir = resolve32(state.resolvedPaths.buildDir, "vue", "vendor");
49751
+ const depVendorDir = resolve32(state.resolvedPaths.buildDir, "vendor");
49772
49752
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49773
- const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
49774
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "vendor");
49775
- await loadVendorFiles(state.assetStore, vendorDir, "vendor");
49776
- globalThis.__depVendorPaths = depPaths;
49777
- return true;
49778
- });
49779
- await Promise.all([
49780
- buildReactVendorTask,
49781
- buildAngularVendorTask,
49782
- buildSvelteVendorTask,
49783
- buildVueVendorTask,
49784
- buildDepVendorTask
49753
+ const [, angularSpecs, , , depPaths] = await Promise.all([
49754
+ config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49755
+ config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs) : Promise.resolve(undefined),
49756
+ config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49757
+ config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49758
+ buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs)
49785
49759
  ]);
49760
+ if (angularSpecs)
49761
+ globalThis.__angularVendorSpecifiers = angularSpecs;
49762
+ globalThis.__depVendorPaths = depPaths;
49786
49763
  recordStep("build vendor bundles", stepStartedAt);
49787
49764
  stepStartedAt = performance.now();
49765
+ const combinedVendorPaths = {
49766
+ ...getDevVendorPaths() ?? {},
49767
+ ...getAngularVendorPaths() ?? {},
49768
+ ...getSvelteVendorPaths() ?? {},
49769
+ ...getVueVendorPaths() ?? {},
49770
+ ...depPaths
49771
+ };
49772
+ const activeVendorDirs = [
49773
+ config.reactDirectory ? reactVendorDir : null,
49774
+ config.angularDirectory ? angularVendorDir : null,
49775
+ config.svelteDirectory ? svelteVendorDir : null,
49776
+ config.vueDirectory ? vueVendorDir : null,
49777
+ depVendorDir
49778
+ ].filter((d) => d !== null);
49779
+ const { rewriteVendorDirectories: rewriteVendorDirectories2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
49780
+ await rewriteVendorDirectories2(activeVendorDirs, combinedVendorPaths);
49781
+ recordStep("rewrite vendor cross-references", stepStartedAt);
49782
+ stepStartedAt = performance.now();
49783
+ await Promise.all([
49784
+ config.reactDirectory ? loadVendorFiles(state.assetStore, reactVendorDir, "react") : Promise.resolve(),
49785
+ config.angularDirectory ? loadVendorFiles(state.assetStore, angularVendorDir, "angular") : Promise.resolve(),
49786
+ config.svelteDirectory ? loadVendorFiles(state.assetStore, svelteVendorDir, "svelte") : Promise.resolve(),
49787
+ config.vueDirectory ? loadVendorFiles(state.assetStore, vueVendorDir, "vue") : Promise.resolve(),
49788
+ loadVendorFiles(state.assetStore, depVendorDir, "vendor")
49789
+ ]);
49790
+ if (config.reactDirectory && !globalThis.__reactModuleRef) {
49791
+ globalThis.__reactModuleRef = await import("react");
49792
+ }
49793
+ recordStep("load vendor files", stepStartedAt);
49794
+ stepStartedAt = performance.now();
49788
49795
  const { warmCompilers: warmCompilers2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
49789
49796
  await warmCompilers2({
49790
49797
  svelte: Boolean(config.svelteDirectory),
@@ -49844,5 +49851,5 @@ export {
49844
49851
  build
49845
49852
  };
49846
49853
 
49847
- //# debugId=E0F6246E173214AB64756E2164756E21
49854
+ //# debugId=6EC71B2CE51C6EE164756E2164756E21
49848
49855
  //# sourceMappingURL=build.js.map