@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/index.js CHANGED
@@ -44663,6 +44663,7 @@ var init_buildReactVendor = __esm(() => {
44663
44663
  // src/build/buildAngularVendor.ts
44664
44664
  var exports_buildAngularVendor = {};
44665
44665
  __export(exports_buildAngularVendor, {
44666
+ computeAngularVendorPathsAsync: () => computeAngularVendorPathsAsync,
44666
44667
  computeAngularVendorPaths: () => computeAngularVendorPaths,
44667
44668
  buildAngularVendor: () => buildAngularVendor
44668
44669
  });
@@ -44794,6 +44795,9 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
44794
44795
  paths[specifier] = `/angular/vendor/${toSafeFileName2(specifier)}.js`;
44795
44796
  }
44796
44797
  return paths;
44798
+ }, computeAngularVendorPathsAsync = async (directories = []) => {
44799
+ const specifiers = await resolveAngularSpecifiers(directories);
44800
+ return computeAngularVendorPaths(specifiers);
44797
44801
  };
44798
44802
  var init_buildAngularVendor = __esm(() => {
44799
44803
  init_angularLinkerPlugin();
@@ -44951,6 +44955,7 @@ var init_buildSvelteVendor = __esm(() => {
44951
44955
  // src/build/rewriteImports.ts
44952
44956
  var exports_rewriteImports = {};
44953
44957
  __export(exports_rewriteImports, {
44958
+ rewriteVendorDirectories: () => rewriteVendorDirectories,
44954
44959
  rewriteImports: () => rewriteImports
44955
44960
  });
44956
44961
  var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
@@ -44978,6 +44983,19 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
44978
44983
  await Bun.write(filePath, content);
44979
44984
  }
44980
44985
  }));
44986
+ }, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
44987
+ if (Object.keys(vendorPaths).length === 0)
44988
+ return;
44989
+ const { readdirSync } = await import("fs");
44990
+ const { join: join20 } = await import("path");
44991
+ const allFiles = [];
44992
+ for (const dir of vendorDirs) {
44993
+ try {
44994
+ const files = readdirSync(dir).filter((f) => f.endsWith(".js")).map((f) => join20(dir, f));
44995
+ allFiles.push(...files);
44996
+ } catch {}
44997
+ }
44998
+ await rewriteImports(allFiles, vendorPaths);
44981
44999
  };
44982
45000
  var init_rewriteImports = __esm(() => {
44983
45001
  init_nativeRewrite();
@@ -49425,24 +49443,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49425
49443
  framework: Array.from(framework).filter(isResolvable4)
49426
49444
  };
49427
49445
  }, generateEntrySource2 = (specifier) => `export * from '${specifier}';
49428
- `, rewriteVendorFiles = async (vendorDir) => {
49429
- const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync8 } = await import("fs");
49430
- const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
49431
- const reactPaths = Object.entries(computeVendorPaths2());
49432
- const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
49433
- const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
49434
- const re2 = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
49435
- return acc.replace(re2, `$1${webPath}$2`);
49436
- }, content);
49437
- const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
49438
- for (const file4 of files) {
49439
- const filePath = join22(vendorDir, file4);
49440
- const original = readFileSync15(filePath, "utf-8");
49441
- const rewritten = rewriteContent(original);
49442
- if (rewritten !== original)
49443
- writeFileSync8(filePath, rewritten);
49444
- }
49445
- }, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49446
+ `, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49446
49447
  const { readFileSync: readFileSync15 } = await import("fs");
49447
49448
  const transpiler4 = new Bun.Transpiler({ loader: "js" });
49448
49449
  const newSpecs = new Set;
@@ -49530,8 +49531,6 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49530
49531
  console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49531
49532
  }
49532
49533
  await rm9(tmpDir, { force: true, recursive: true });
49533
- if (success)
49534
- await rewriteVendorFiles(vendorDir);
49535
49534
  const paths = {};
49536
49535
  for (const specifier of allSpecs) {
49537
49536
  paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
@@ -49705,7 +49704,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49705
49704
  setDevVendorPaths(computeVendorPaths());
49706
49705
  }
49707
49706
  if (cached?.hmrState.config.angularDirectory) {
49708
- setAngularVendorPaths(computeAngularVendorPaths());
49707
+ setAngularVendorPaths(computeAngularVendorPaths(globalThis.__angularVendorSpecifiers));
49709
49708
  }
49710
49709
  if (cached?.hmrState.config.svelteDirectory) {
49711
49710
  setSvelteVendorPaths(computeSvelteVendorPaths());
@@ -49786,9 +49785,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49786
49785
  if (config.reactDirectory) {
49787
49786
  setDevVendorPaths(computeVendorPaths());
49788
49787
  }
49789
- if (config.angularDirectory) {
49790
- setAngularVendorPaths(computeAngularVendorPaths());
49791
- }
49792
49788
  if (config.svelteDirectory) {
49793
49789
  setSvelteVendorPaths(computeSvelteVendorPaths());
49794
49790
  }
@@ -49796,6 +49792,9 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49796
49792
  setVueVendorPaths(computeVueVendorPaths());
49797
49793
  }
49798
49794
  const sourceDirs = collectDepVendorSourceDirs(config);
49795
+ if (config.angularDirectory) {
49796
+ setAngularVendorPaths(await computeAngularVendorPathsAsync(sourceDirs));
49797
+ }
49799
49798
  const { computeDepVendorPaths: computeDepVendorPaths2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49800
49799
  globalThis.__depVendorPaths = await computeDepVendorPaths2(sourceDirs);
49801
49800
  recordStep("prepare vendor paths", stepStartedAt);
@@ -49822,46 +49821,54 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49822
49821
  cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
49823
49822
  recordStep("populate asset store", stepStartedAt);
49824
49823
  stepStartedAt = performance.now();
49825
- const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
49826
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "react", "vendor");
49827
- await loadVendorFiles(state.assetStore, vendorDir, "react");
49828
- if (!globalThis.__reactModuleRef) {
49829
- globalThis.__reactModuleRef = await import("react");
49830
- }
49831
- return true;
49832
- }) : undefined;
49833
- const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs).then(async (specs) => {
49834
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "angular", "vendor");
49835
- await loadVendorFiles(state.assetStore, vendorDir, "angular");
49836
- globalThis.__angularVendorSpecifiers = specs;
49837
- return true;
49838
- }) : undefined;
49839
- const buildSvelteVendorTask = config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir).then(async () => {
49840
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "svelte", "vendor");
49841
- await loadVendorFiles(state.assetStore, vendorDir, "svelte");
49842
- return true;
49843
- }) : undefined;
49844
- const buildVueVendorTask = config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir).then(async () => {
49845
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "vue", "vendor");
49846
- await loadVendorFiles(state.assetStore, vendorDir, "vue");
49847
- return true;
49848
- }) : undefined;
49824
+ const reactVendorDir = resolve34(state.resolvedPaths.buildDir, "react", "vendor");
49825
+ const angularVendorDir = resolve34(state.resolvedPaths.buildDir, "angular", "vendor");
49826
+ const svelteVendorDir = resolve34(state.resolvedPaths.buildDir, "svelte", "vendor");
49827
+ const vueVendorDir = resolve34(state.resolvedPaths.buildDir, "vue", "vendor");
49828
+ const depVendorDir = resolve34(state.resolvedPaths.buildDir, "vendor");
49849
49829
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49850
- const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
49851
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "vendor");
49852
- await loadVendorFiles(state.assetStore, vendorDir, "vendor");
49853
- globalThis.__depVendorPaths = depPaths;
49854
- return true;
49855
- });
49856
- await Promise.all([
49857
- buildReactVendorTask,
49858
- buildAngularVendorTask,
49859
- buildSvelteVendorTask,
49860
- buildVueVendorTask,
49861
- buildDepVendorTask
49830
+ const [, angularSpecs, , , depPaths] = await Promise.all([
49831
+ config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49832
+ config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs) : Promise.resolve(undefined),
49833
+ config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49834
+ config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
49835
+ buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs)
49862
49836
  ]);
49837
+ if (angularSpecs)
49838
+ globalThis.__angularVendorSpecifiers = angularSpecs;
49839
+ globalThis.__depVendorPaths = depPaths;
49863
49840
  recordStep("build vendor bundles", stepStartedAt);
49864
49841
  stepStartedAt = performance.now();
49842
+ const combinedVendorPaths = {
49843
+ ...getDevVendorPaths() ?? {},
49844
+ ...getAngularVendorPaths() ?? {},
49845
+ ...getSvelteVendorPaths() ?? {},
49846
+ ...getVueVendorPaths() ?? {},
49847
+ ...depPaths
49848
+ };
49849
+ const activeVendorDirs = [
49850
+ config.reactDirectory ? reactVendorDir : null,
49851
+ config.angularDirectory ? angularVendorDir : null,
49852
+ config.svelteDirectory ? svelteVendorDir : null,
49853
+ config.vueDirectory ? vueVendorDir : null,
49854
+ depVendorDir
49855
+ ].filter((d) => d !== null);
49856
+ const { rewriteVendorDirectories: rewriteVendorDirectories2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
49857
+ await rewriteVendorDirectories2(activeVendorDirs, combinedVendorPaths);
49858
+ recordStep("rewrite vendor cross-references", stepStartedAt);
49859
+ stepStartedAt = performance.now();
49860
+ await Promise.all([
49861
+ config.reactDirectory ? loadVendorFiles(state.assetStore, reactVendorDir, "react") : Promise.resolve(),
49862
+ config.angularDirectory ? loadVendorFiles(state.assetStore, angularVendorDir, "angular") : Promise.resolve(),
49863
+ config.svelteDirectory ? loadVendorFiles(state.assetStore, svelteVendorDir, "svelte") : Promise.resolve(),
49864
+ config.vueDirectory ? loadVendorFiles(state.assetStore, vueVendorDir, "vue") : Promise.resolve(),
49865
+ loadVendorFiles(state.assetStore, depVendorDir, "vendor")
49866
+ ]);
49867
+ if (config.reactDirectory && !globalThis.__reactModuleRef) {
49868
+ globalThis.__reactModuleRef = await import("react");
49869
+ }
49870
+ recordStep("load vendor files", stepStartedAt);
49871
+ stepStartedAt = performance.now();
49865
49872
  const { warmCompilers: warmCompilers2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
49866
49873
  await warmCompilers2({
49867
49874
  svelte: Boolean(config.svelteDirectory),
@@ -58304,5 +58311,5 @@ export {
58304
58311
  ANGULAR_INIT_TIMEOUT_MS
58305
58312
  };
58306
58313
 
58307
- //# debugId=426CE55C1D8D8B1C64756E2164756E21
58314
+ //# debugId=F4D0A34F69D98D4064756E2164756E21
58308
58315
  //# sourceMappingURL=index.js.map