@absolutejs/absolute 0.19.0-beta.731 → 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
@@ -44955,6 +44955,7 @@ var init_buildSvelteVendor = __esm(() => {
44955
44955
  // src/build/rewriteImports.ts
44956
44956
  var exports_rewriteImports = {};
44957
44957
  __export(exports_rewriteImports, {
44958
+ rewriteVendorDirectories: () => rewriteVendorDirectories,
44958
44959
  rewriteImports: () => rewriteImports
44959
44960
  });
44960
44961
  var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
@@ -44982,6 +44983,19 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
44982
44983
  await Bun.write(filePath, content);
44983
44984
  }
44984
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);
44985
44999
  };
44986
45000
  var init_rewriteImports = __esm(() => {
44987
45001
  init_nativeRewrite();
@@ -49429,24 +49443,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49429
49443
  framework: Array.from(framework).filter(isResolvable4)
49430
49444
  };
49431
49445
  }, generateEntrySource2 = (specifier) => `export * from '${specifier}';
49432
- `, rewriteVendorFiles = async (vendorDir) => {
49433
- const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync8 } = await import("fs");
49434
- const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
49435
- const reactPaths = Object.entries(computeVendorPaths2());
49436
- const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
49437
- const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
49438
- const re2 = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
49439
- return acc.replace(re2, `$1${webPath}$2`);
49440
- }, content);
49441
- const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
49442
- for (const file4 of files) {
49443
- const filePath = join22(vendorDir, file4);
49444
- const original = readFileSync15(filePath, "utf-8");
49445
- const rewritten = rewriteContent(original);
49446
- if (rewritten !== original)
49447
- writeFileSync8(filePath, rewritten);
49448
- }
49449
- }, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49446
+ `, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49450
49447
  const { readFileSync: readFileSync15 } = await import("fs");
49451
49448
  const transpiler4 = new Bun.Transpiler({ loader: "js" });
49452
49449
  const newSpecs = new Set;
@@ -49534,8 +49531,6 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49534
49531
  console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49535
49532
  }
49536
49533
  await rm9(tmpDir, { force: true, recursive: true });
49537
- if (success)
49538
- await rewriteVendorFiles(vendorDir);
49539
49534
  const paths = {};
49540
49535
  for (const specifier of allSpecs) {
49541
49536
  paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
@@ -49826,46 +49821,54 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49826
49821
  cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
49827
49822
  recordStep("populate asset store", stepStartedAt);
49828
49823
  stepStartedAt = performance.now();
49829
- const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
49830
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "react", "vendor");
49831
- await loadVendorFiles(state.assetStore, vendorDir, "react");
49832
- if (!globalThis.__reactModuleRef) {
49833
- globalThis.__reactModuleRef = await import("react");
49834
- }
49835
- return true;
49836
- }) : undefined;
49837
- const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs).then(async (specs) => {
49838
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "angular", "vendor");
49839
- await loadVendorFiles(state.assetStore, vendorDir, "angular");
49840
- globalThis.__angularVendorSpecifiers = specs;
49841
- return true;
49842
- }) : undefined;
49843
- const buildSvelteVendorTask = config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir).then(async () => {
49844
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "svelte", "vendor");
49845
- await loadVendorFiles(state.assetStore, vendorDir, "svelte");
49846
- return true;
49847
- }) : undefined;
49848
- const buildVueVendorTask = config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir).then(async () => {
49849
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "vue", "vendor");
49850
- await loadVendorFiles(state.assetStore, vendorDir, "vue");
49851
- return true;
49852
- }) : 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");
49853
49829
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49854
- const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
49855
- const vendorDir = resolve34(state.resolvedPaths.buildDir, "vendor");
49856
- await loadVendorFiles(state.assetStore, vendorDir, "vendor");
49857
- globalThis.__depVendorPaths = depPaths;
49858
- return true;
49859
- });
49860
- await Promise.all([
49861
- buildReactVendorTask,
49862
- buildAngularVendorTask,
49863
- buildSvelteVendorTask,
49864
- buildVueVendorTask,
49865
- 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)
49866
49836
  ]);
49837
+ if (angularSpecs)
49838
+ globalThis.__angularVendorSpecifiers = angularSpecs;
49839
+ globalThis.__depVendorPaths = depPaths;
49867
49840
  recordStep("build vendor bundles", stepStartedAt);
49868
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();
49869
49872
  const { warmCompilers: warmCompilers2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
49870
49873
  await warmCompilers2({
49871
49874
  svelte: Boolean(config.svelteDirectory),
@@ -58308,5 +58311,5 @@ export {
58308
58311
  ANGULAR_INIT_TIMEOUT_MS
58309
58312
  };
58310
58313
 
58311
- //# debugId=2E2BAC3D0031B92D64756E2164756E21
58314
+ //# debugId=F4D0A34F69D98D4064756E2164756E21
58312
58315
  //# sourceMappingURL=index.js.map