@absolutejs/absolute 0.20.0-beta.76 → 0.20.0-beta.78

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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-bJOuIS/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-DfqLns/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-bJOuIS/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-DfqLns/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-bJOuIS/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-DfqLns/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
package/dist/build.js CHANGED
@@ -30950,6 +30950,7 @@ __export(exports_moduleServer, {
30950
30950
  SRC_URL_PREFIX: () => SRC_URL_PREFIX2,
30951
30951
  createDevPageWarmer: () => createDevPageWarmer,
30952
30952
  createModuleServer: () => createModuleServer,
30953
+ importedBindingNames: () => importedBindingNames,
30953
30954
  invalidateModule: () => invalidateModule,
30954
30955
  isReactFastRefreshSupported: () => isReactFastRefreshSupported,
30955
30956
  runOnDemandPageBuild: () => runOnDemandPageBuild,
@@ -30993,6 +30994,12 @@ ${stubs}
30993
30994
  } catch {
30994
30995
  return null;
30995
30996
  }
30997
+ }, importedBindingNames = (clause) => {
30998
+ const braces = /\{([^}]*)\}/u.exec(clause);
30999
+ const inner = braces?.[1];
31000
+ if (inner === undefined)
31001
+ return [];
31002
+ return inner.split(",").map((part) => part.trim()).filter((part) => part.length > 0).map((part) => part.replace(/^type\s+/u, "").split(/\s+as\s+/u)[0] ?? "").map((name) => name.trim()).filter((name) => /^[A-Za-z_$][\w$]*$/u.test(name));
30996
31003
  }, buildImportRewriter = (vendorPaths) => {
30997
31004
  const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
30998
31005
  if (entries.length === 0)
@@ -31082,7 +31089,9 @@ ${stubs}
31082
31089
  if (resolved) {
31083
31090
  return `${prefix}${srcUrl(resolved, projectRoot)}${suffix}`;
31084
31091
  }
31085
- return `${prefix}/@stub/${encodeURIComponent(specifier)}${suffix}`;
31092
+ const requested = importedBindingNames(prefix);
31093
+ const namesSegment = requested.length > 0 ? `/${encodeURIComponent(requested.join(","))}` : "";
31094
+ return `${prefix}/@stub/${encodeURIComponent(specifier)}${namesSegment}${suffix}`;
31086
31095
  };
31087
31096
  result = result.replace(/^((?:import\s+[^"'`;]+?\s+from|export\s+[^"'`;]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
31088
31097
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
@@ -31539,8 +31548,10 @@ ${code2}`;
31539
31548
  ].join(`
31540
31549
  `);
31541
31550
  }, handleStubRequest = async (pathname) => {
31542
- const specifier = decodeURIComponent(pathname.slice("/@stub/".length));
31543
- const stubCode = await buildStubCode(specifier);
31551
+ const [encodedSpecifier = "", encodedNames] = pathname.slice("/@stub/".length).split("/");
31552
+ const specifier = decodeURIComponent(encodedSpecifier);
31553
+ const requested = encodedNames === undefined ? [] : decodeURIComponent(encodedNames).split(",").filter((name) => name.length > 0);
31554
+ const stubCode = await buildStubCode(specifier, requested);
31544
31555
  return new Response(stubCode, {
31545
31556
  headers: {
31546
31557
  "Cache-Control": "no-cache",
@@ -31552,22 +31563,17 @@ ${code2}`;
31552
31563
  "Cache-Control": "no-cache",
31553
31564
  "Content-Type": "application/javascript"
31554
31565
  }
31555
- }), buildStubCode = async (specifier) => {
31556
- try {
31557
- const mod = await import(specifier);
31558
- const names = Object.keys(mod).filter((key) => key !== "default" && key !== "__esModule");
31559
- if (names.length === 0)
31560
- return `export default {};
31566
+ }), buildStubCode = async (specifier, requested = []) => {
31567
+ const discovered = await import(specifier).then((mod) => Object.keys(mod).filter((key) => key !== "default" && key !== "__esModule"), () => []);
31568
+ const names = [...new Set([...discovered, ...requested])];
31569
+ if (names.length === 0)
31570
+ return `export default {};
31561
31571
  `;
31562
- const noops = names.map((n) => `export const ${n} = () => {};`).join(`
31572
+ const noops = names.map((name) => `export const ${name} = () => {};`).join(`
31563
31573
  `);
31564
- return `${noops}
31574
+ return `${noops}
31565
31575
  export default {};
31566
31576
  `;
31567
- } catch {
31568
- return `export default {};
31569
- `;
31570
- }
31571
31577
  }, handleHmrBootstrap = (pathname, vendorPaths) => {
31572
31578
  const rest = pathname.slice("/@hmr/".length);
31573
31579
  const slashIdx = rest.indexOf("/");
@@ -34957,6 +34963,7 @@ var init_rebuildTrigger = __esm(() => {
34957
34963
  var exports_buildDepVendor = {};
34958
34964
  __export(exports_buildDepVendor, {
34959
34965
  buildDepVendor: () => buildDepVendor,
34966
+ collectTransitiveImports: () => collectTransitiveImports,
34960
34967
  computeDepVendorPaths: () => computeDepVendorPaths
34961
34968
  });
34962
34969
  import { mkdirSync as mkdirSync16 } from "fs";
@@ -35067,20 +35074,29 @@ var toSafeFileName6 = (specifier) => {
35067
35074
  }
35068
35075
  }
35069
35076
  return Array.from(bareOut);
35070
- }, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
35077
+ }, MAX_DISCOVERY_FILES = 2000, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
35078
+ const { dirname: dirname36 } = await import("path");
35071
35079
  const transpiler7 = new Bun.Transpiler({ loader: "js" });
35072
35080
  const newSpecs = new Set;
35073
- for (const spec of specs) {
35074
- if (alreadyScanned.has(spec))
35081
+ const queue = [...specs].map((spec) => ({ from: process.cwd(), spec }));
35082
+ let visited = 0;
35083
+ while (queue.length > 0 && visited < MAX_DISCOVERY_FILES) {
35084
+ const next = queue.shift();
35085
+ if (!next)
35086
+ break;
35087
+ const key = `${next.from}\x00${next.spec}`;
35088
+ if (alreadyScanned.has(key))
35075
35089
  continue;
35076
- alreadyScanned.add(spec);
35090
+ alreadyScanned.add(key);
35077
35091
  let resolved;
35078
35092
  try {
35079
- resolved = Bun.resolveSync(spec, process.cwd());
35093
+ resolved = Bun.resolveSync(next.spec, next.from);
35080
35094
  } catch {
35081
35095
  continue;
35082
35096
  }
35097
+ visited += 1;
35083
35098
  const bareImports = await collectBareImportsFromFile(resolved, transpiler7);
35099
+ const importerDirectory = dirname36(resolved);
35084
35100
  for (const child of bareImports) {
35085
35101
  if (!isBareSpecifier3(child))
35086
35102
  continue;
@@ -35090,11 +35106,9 @@ var toSafeFileName6 = (specifier) => {
35090
35106
  continue;
35091
35107
  if (isAbsolutePackageSpecifier(child))
35092
35108
  continue;
35093
- if (alreadyVendored.has(child))
35094
- continue;
35095
- if (!isResolvable3(child))
35096
- continue;
35097
- newSpecs.add(child);
35109
+ if (!alreadyVendored.has(child) && isResolvable3(child))
35110
+ newSpecs.add(child);
35111
+ queue.push({ from: importerDirectory, spec: child });
35098
35112
  }
35099
35113
  }
35100
35114
  return newSpecs;
@@ -35977,5 +35991,5 @@ export {
35977
35991
  devBuild
35978
35992
  };
35979
35993
 
35980
- //# debugId=1AE50D17EEF6199A64756E2164756E21
35994
+ //# debugId=D7DC1464FBC5F8A564756E2164756E21
35981
35995
  //# sourceMappingURL=build.js.map