@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/build.js CHANGED
@@ -44763,6 +44763,7 @@ var init_buildSvelteVendor = __esm(() => {
44763
44763
  // src/build/rewriteImports.ts
44764
44764
  var exports_rewriteImports = {};
44765
44765
  __export(exports_rewriteImports, {
44766
+ rewriteVendorDirectories: () => rewriteVendorDirectories,
44766
44767
  rewriteImports: () => rewriteImports
44767
44768
  });
44768
44769
  var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
@@ -44790,6 +44791,19 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
44790
44791
  await Bun.write(filePath, content);
44791
44792
  }
44792
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);
44793
44807
  };
44794
44808
  var init_rewriteImports = __esm(() => {
44795
44809
  init_nativeRewrite();
@@ -49352,24 +49366,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49352
49366
  framework: Array.from(framework).filter(isResolvable4)
49353
49367
  };
49354
49368
  }, generateEntrySource2 = (specifier) => `export * from '${specifier}';
49355
- `, rewriteVendorFiles = async (vendorDir) => {
49356
- const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync8 } = await import("fs");
49357
- const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
49358
- const reactPaths = Object.entries(computeVendorPaths2());
49359
- const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
49360
- const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
49361
- const re2 = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
49362
- return acc.replace(re2, `$1${webPath}$2`);
49363
- }, content);
49364
- const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
49365
- for (const file3 of files) {
49366
- const filePath = join22(vendorDir, file3);
49367
- const original = readFileSync15(filePath, "utf-8");
49368
- const rewritten = rewriteContent(original);
49369
- if (rewritten !== original)
49370
- writeFileSync8(filePath, rewritten);
49371
- }
49372
- }, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49369
+ `, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
49373
49370
  const { readFileSync: readFileSync15 } = await import("fs");
49374
49371
  const transpiler4 = new Bun.Transpiler({ loader: "js" });
49375
49372
  const newSpecs = new Set;
@@ -49457,8 +49454,6 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
49457
49454
  console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
49458
49455
  }
49459
49456
  await rm9(tmpDir, { force: true, recursive: true });
49460
- if (success)
49461
- await rewriteVendorFiles(vendorDir);
49462
49457
  const paths = {};
49463
49458
  for (const specifier of allSpecs) {
49464
49459
  paths[specifier] = `/vendor/${toSafeFileName5(specifier)}.js`;
@@ -49749,46 +49744,54 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
49749
49744
  cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
49750
49745
  recordStep("populate asset store", stepStartedAt);
49751
49746
  stepStartedAt = performance.now();
49752
- const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
49753
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "react", "vendor");
49754
- await loadVendorFiles(state.assetStore, vendorDir, "react");
49755
- if (!globalThis.__reactModuleRef) {
49756
- globalThis.__reactModuleRef = await import("react");
49757
- }
49758
- return true;
49759
- }) : undefined;
49760
- const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs).then(async (specs) => {
49761
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "angular", "vendor");
49762
- await loadVendorFiles(state.assetStore, vendorDir, "angular");
49763
- globalThis.__angularVendorSpecifiers = specs;
49764
- return true;
49765
- }) : undefined;
49766
- const buildSvelteVendorTask = config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir).then(async () => {
49767
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "svelte", "vendor");
49768
- await loadVendorFiles(state.assetStore, vendorDir, "svelte");
49769
- return true;
49770
- }) : undefined;
49771
- const buildVueVendorTask = config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir).then(async () => {
49772
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "vue", "vendor");
49773
- await loadVendorFiles(state.assetStore, vendorDir, "vue");
49774
- return true;
49775
- }) : 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");
49776
49752
  const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
49777
- const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
49778
- const vendorDir = resolve32(state.resolvedPaths.buildDir, "vendor");
49779
- await loadVendorFiles(state.assetStore, vendorDir, "vendor");
49780
- globalThis.__depVendorPaths = depPaths;
49781
- return true;
49782
- });
49783
- await Promise.all([
49784
- buildReactVendorTask,
49785
- buildAngularVendorTask,
49786
- buildSvelteVendorTask,
49787
- buildVueVendorTask,
49788
- 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)
49789
49759
  ]);
49760
+ if (angularSpecs)
49761
+ globalThis.__angularVendorSpecifiers = angularSpecs;
49762
+ globalThis.__depVendorPaths = depPaths;
49790
49763
  recordStep("build vendor bundles", stepStartedAt);
49791
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();
49792
49795
  const { warmCompilers: warmCompilers2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
49793
49796
  await warmCompilers2({
49794
49797
  svelte: Boolean(config.svelteDirectory),
@@ -49848,5 +49851,5 @@ export {
49848
49851
  build
49849
49852
  };
49850
49853
 
49851
- //# debugId=9A9BE3B8E3FB90C564756E2164756E21
49854
+ //# debugId=6EC71B2CE51C6EE164756E2164756E21
49852
49855
  //# sourceMappingURL=build.js.map