@absolutejs/absolute 0.19.0-beta.1054 → 0.19.0-beta.1056

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-u9gKxb/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-0bH20h/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-u9gKxb/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-0bH20h/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-u9gKxb/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-0bH20h/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/cli/index.js CHANGED
@@ -170390,7 +170390,7 @@ __export(exports_prerender, {
170390
170390
  });
170391
170391
  import { mkdirSync as mkdirSync5, readFileSync as readFileSync10 } from "fs";
170392
170392
  import { join as join9 } from "path";
170393
- var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
170393
+ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, DEFAULT_FETCH_TIMEOUT_MS = 1e4, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
170394
170394
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
170395
170395
  await Bun.write(metaPath, String(Date.now()));
170396
170396
  }, readTimestamp = (htmlPath) => {
@@ -170413,7 +170413,9 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
170413
170413
  }
170414
170414
  return links;
170415
170415
  }, fetchRoute = async (baseUrl, path) => {
170416
- const res = await fetch(`${baseUrl}${path}`, { redirect: "manual" });
170416
+ const res = await fetchWithTimeout(`${baseUrl}${path}`, {
170417
+ redirect: "manual"
170418
+ });
170417
170419
  if (!res.ok)
170418
170420
  return null;
170419
170421
  const contentType = res.headers.get("content-type") ?? "";
@@ -170447,7 +170449,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
170447
170449
  return routes;
170448
170450
  }, rerenderRoute = async (route, port, prerenderDir) => {
170449
170451
  try {
170450
- const res = await fetch(`http://localhost:${port}${route}`, {
170452
+ const res = await fetchWithTimeout(`http://localhost:${port}${route}`, {
170451
170453
  headers: { [PRERENDER_BYPASS_HEADER]: "1" },
170452
170454
  redirect: "manual"
170453
170455
  });
@@ -170463,7 +170465,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
170463
170465
  return false;
170464
170466
  }
170465
170467
  }, prerenderRoute = async (baseUrl, route, prerenderDir, result, log) => {
170466
- const res = await fetch(`${baseUrl}${route}`, {
170468
+ const res = await fetchWithTimeout(`${baseUrl}${route}`, {
170467
170469
  redirect: "manual"
170468
170470
  }).catch(() => null);
170469
170471
  if (!res) {
@@ -170507,7 +170509,14 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
170507
170509
  const rawTimeout = Bun.env.ABSOLUTE_PRERENDER_STARTUP_TIMEOUT_MS;
170508
170510
  const parsedTimeout = rawTimeout ? Number(rawTimeout) : NaN;
170509
170511
  return Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : DEFAULT_STARTUP_TIMEOUT_MS;
170510
- }, waitForServerReady = async (port) => {
170512
+ }, getFetchTimeoutMs = () => {
170513
+ const rawTimeout = Bun.env.ABSOLUTE_PRERENDER_FETCH_TIMEOUT_MS;
170514
+ const parsedTimeout = rawTimeout ? Number(rawTimeout) : NaN;
170515
+ return Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : DEFAULT_FETCH_TIMEOUT_MS;
170516
+ }, fetchWithTimeout = (url, init = {}) => fetch(url, {
170517
+ ...init,
170518
+ signal: init.signal ?? AbortSignal.timeout(getFetchTimeoutMs())
170519
+ }), waitForServerReady = async (port) => {
170511
170520
  const deadline = performance.now() + getStartupTimeoutMs();
170512
170521
  const pollServer = async () => {
170513
170522
  if (performance.now() >= deadline) {
@@ -170521,7 +170530,9 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
170521
170530
  };
170522
170531
  return pollServer();
170523
170532
  }, probePrerenderServer = async (port) => {
170524
- const res = await fetch(`http://localhost:${port}/`).catch(() => null);
170533
+ const res = await fetchWithTimeout(`http://localhost:${port}/`, {
170534
+ signal: AbortSignal.timeout(Math.min(getFetchTimeoutMs(), 1000))
170535
+ }).catch(() => null);
170525
170536
  if (!res) {
170526
170537
  return false;
170527
170538
  }
@@ -176659,6 +176670,7 @@ import {
176659
176670
  unlinkSync as unlinkSync4,
176660
176671
  writeFileSync as writeFileSync18
176661
176672
  } from "fs";
176673
+ import { createRequire as createRequire2 } from "module";
176662
176674
  import { basename as basename7, dirname as dirname14, join as join31, relative as relative11, resolve as resolve21 } from "path";
176663
176675
  var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
176664
176676
  const resolvedVersion = version2 || "unknown";
@@ -176805,6 +176817,30 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176805
176817
  if (relativePath.includes("/server/"))
176806
176818
  return false;
176807
176819
  return true;
176820
+ }, ENV_NAME_RE, resolveCompileNativeAssets = (buildConfig) => (buildConfig.compile?.nativeAssets ?? []).filter((asset) => {
176821
+ if (!asset || typeof asset !== "object")
176822
+ return false;
176823
+ if (typeof asset.import !== "string" || asset.import.length === 0) {
176824
+ console.warn(cliTag4("\x1B[33m", "Ignoring compile.nativeAssets entry with missing import."));
176825
+ return false;
176826
+ }
176827
+ if (typeof asset.env !== "string" || !ENV_NAME_RE.test(asset.env)) {
176828
+ console.warn(cliTag4("\x1B[33m", `Ignoring compile.nativeAssets entry for ${asset.import}: env must be a valid environment variable name.`));
176829
+ return false;
176830
+ }
176831
+ return true;
176832
+ }), requireForCompile, resolveNativeAssetForRuntime = (specifier) => {
176833
+ if (specifier.startsWith("."))
176834
+ return resolve21(process.cwd(), specifier);
176835
+ if (specifier.startsWith("/"))
176836
+ return specifier;
176837
+ return requireForCompile.resolve(specifier, { paths: [process.cwd()] });
176838
+ }, resolveCompileNativeAssetEnv = (buildConfig) => {
176839
+ const env6 = {};
176840
+ for (const asset of resolveCompileNativeAssets(buildConfig)) {
176841
+ env6[asset.env] = resolveNativeAssetForRuntime(asset.import);
176842
+ }
176843
+ return env6;
176808
176844
  }, tryReadNodePackageJson = (packageDir) => {
176809
176845
  try {
176810
176846
  return JSON.parse(readFileSync33(join31(packageDir, "package.json"), "utf-8"));
@@ -177020,9 +177056,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
177020
177056
  });
177021
177057
  const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(relative11(distDir, file), assetSkip));
177022
177058
  const imports = [];
177059
+ const nativeImports = [];
177060
+ const nativeMappings = [];
177023
177061
  const embeddedMappings = [];
177024
177062
  const mappings = [];
177025
177063
  const embeddedVarMap = new Map;
177064
+ const nativeAssets = resolveCompileNativeAssets(buildConfig);
177065
+ nativeAssets.forEach((asset, idx) => {
177066
+ const varName = `__native${idx}`;
177067
+ const importSpecifier = asset.import.startsWith(".") ? resolve21(process.cwd(), asset.import) : asset.import;
177068
+ nativeImports.push(`import ${varName} from ${JSON.stringify(importSpecifier)} with { type: "file" };`);
177069
+ nativeMappings.push(` [${JSON.stringify(asset.env)}, resolveNativeAssetPath(${varName})],`);
177070
+ });
177026
177071
  embeddedFiles.forEach((filePath, idx) => {
177027
177072
  const rel = relative11(distDir, filePath).replace(/\\/g, "/");
177028
177073
  const varName = `__a${idx}`;
@@ -177055,6 +177100,10 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
177055
177100
  const runtimeBuildId = `${version2}-${Date.now().toString(36)}`;
177056
177101
  const runtimeConfigSource = JSON.stringify(buildConfig, (_key, value) => typeof value === "function" || typeof value === "symbol" ? undefined : value, 2);
177057
177102
  return `// Auto-generated compile entrypoint
177103
+ // \u2500\u2500 Native asset imports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
177104
+ ${nativeImports.join(`
177105
+ `)}
177106
+
177058
177107
  // \u2500\u2500 Embedded asset imports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
177059
177108
  ${imports.join(`
177060
177109
  `)}
@@ -177065,7 +177114,7 @@ import { basename, dirname, join } from "node:path";
177065
177114
  import { homedir, tmpdir } from "node:os";
177066
177115
  import { createHash } from "node:crypto";
177067
177116
  import { readFileSync, writeFileSync } from "node:fs";
177068
- import { pathToFileURL } from "node:url";
177117
+ import { fileURLToPath, pathToFileURL } from "node:url";
177069
177118
  // Elysia's WebSocket dispatcher (stateless: routes every event through
177070
177119
  // ws.data.*). Wiring it into Bun.serve below is what lets compiled servers
177071
177120
  // serve .ws() routes \u2014 without it every upgrade falls through to a 404.
@@ -177077,6 +177126,19 @@ const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
177077
177126
  const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve21(distDir))};
177078
177127
  const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
177079
177128
 
177129
+ const resolveNativeAssetPath = (assetPath: string) => {
177130
+ try {
177131
+ return fileURLToPath(new URL(assetPath, import.meta.url));
177132
+ } catch {
177133
+ return assetPath;
177134
+ }
177135
+ };
177136
+
177137
+ const NATIVE_ASSETS: Array<[string, string]> = [
177138
+ ${nativeMappings.join(`
177139
+ `)}
177140
+ ];
177141
+
177080
177142
  // \u2500\u2500 Asset URL \u2192 embedded path map \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
177081
177143
  const ASSETS: Record<string, string> = {
177082
177144
  ${mappings.join(`
@@ -177211,6 +177273,9 @@ const rewriteRuntimeJsonPaths = (runtimeDir: string, fileName: string) => {
177211
177273
 
177212
177274
  const resolveRuntimeFetch = async () => {
177213
177275
  const { configPath, runtimeDir } = await materializeRuntimeFiles();
177276
+ for (const [envName, assetPath] of NATIVE_ASSETS) {
177277
+ process.env[envName] = assetPath;
177278
+ }
177214
177279
  process.env.ABSOLUTE_BUILD_DIR = runtimeDir;
177215
177280
  process.env.ABSOLUTE_CONFIG = configPath;
177216
177281
  process.env.ABSOLUTE_COMPILED_RUNTIME = "1";
@@ -177555,6 +177620,7 @@ console.log(\`
177555
177620
  ABSOLUTE_VERSION: absoluteVersion,
177556
177621
  FORCE_COLOR: "0",
177557
177622
  NODE_ENV: "production",
177623
+ ...resolveCompileNativeAssetEnv(buildConfig),
177558
177624
  ...configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {}
177559
177625
  });
177560
177626
  const prerenderMap = prerenderResult.routes;
@@ -177632,6 +177698,8 @@ var init_compile = __esm(() => {
177632
177698
  "node_modules"
177633
177699
  ]);
177634
177700
  jsxDevRuntimeCompatPath2 = resolveJsxDevRuntimeCompatPath2();
177701
+ ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
177702
+ requireForCompile = createRequire2(import.meta.url);
177635
177703
  RUNTIME_JS_EXTENSIONS = [".js", ".mjs", ".cjs"];
177636
177704
  MODULE_SPECIFIER_RE = /(from\s*|import\s*|import\(\s*|require\(\s*)(["'])([^"']+)\2/g;
177637
177705
  FRAMEWORK_EXTERNALS = [
package/dist/index.js CHANGED
@@ -38110,7 +38110,7 @@ __export(exports_prerender, {
38110
38110
  });
38111
38111
  import { mkdirSync as mkdirSync16, readFileSync as readFileSync32 } from "fs";
38112
38112
  import { join as join48 } from "path";
38113
- var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
38113
+ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, DEFAULT_FETCH_TIMEOUT_MS = 1e4, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
38114
38114
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
38115
38115
  await Bun.write(metaPath, String(Date.now()));
38116
38116
  }, readTimestamp = (htmlPath) => {
@@ -38133,7 +38133,9 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38133
38133
  }
38134
38134
  return links;
38135
38135
  }, fetchRoute = async (baseUrl, path) => {
38136
- const res = await fetch(`${baseUrl}${path}`, { redirect: "manual" });
38136
+ const res = await fetchWithTimeout(`${baseUrl}${path}`, {
38137
+ redirect: "manual"
38138
+ });
38137
38139
  if (!res.ok)
38138
38140
  return null;
38139
38141
  const contentType = res.headers.get("content-type") ?? "";
@@ -38167,7 +38169,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38167
38169
  return routes;
38168
38170
  }, rerenderRoute = async (route, port, prerenderDir) => {
38169
38171
  try {
38170
- const res = await fetch(`http://localhost:${port}${route}`, {
38172
+ const res = await fetchWithTimeout(`http://localhost:${port}${route}`, {
38171
38173
  headers: { [PRERENDER_BYPASS_HEADER]: "1" },
38172
38174
  redirect: "manual"
38173
38175
  });
@@ -38183,7 +38185,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38183
38185
  return false;
38184
38186
  }
38185
38187
  }, prerenderRoute = async (baseUrl, route, prerenderDir, result, log2) => {
38186
- const res = await fetch(`${baseUrl}${route}`, {
38188
+ const res = await fetchWithTimeout(`${baseUrl}${route}`, {
38187
38189
  redirect: "manual"
38188
38190
  }).catch(() => null);
38189
38191
  if (!res) {
@@ -38227,7 +38229,14 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38227
38229
  const rawTimeout = Bun.env.ABSOLUTE_PRERENDER_STARTUP_TIMEOUT_MS;
38228
38230
  const parsedTimeout = rawTimeout ? Number(rawTimeout) : NaN;
38229
38231
  return Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : DEFAULT_STARTUP_TIMEOUT_MS;
38230
- }, waitForServerReady = async (port) => {
38232
+ }, getFetchTimeoutMs = () => {
38233
+ const rawTimeout = Bun.env.ABSOLUTE_PRERENDER_FETCH_TIMEOUT_MS;
38234
+ const parsedTimeout = rawTimeout ? Number(rawTimeout) : NaN;
38235
+ return Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : DEFAULT_FETCH_TIMEOUT_MS;
38236
+ }, fetchWithTimeout = (url2, init = {}) => fetch(url2, {
38237
+ ...init,
38238
+ signal: init.signal ?? AbortSignal.timeout(getFetchTimeoutMs())
38239
+ }), waitForServerReady = async (port) => {
38231
38240
  const deadline = performance.now() + getStartupTimeoutMs();
38232
38241
  const pollServer = async () => {
38233
38242
  if (performance.now() >= deadline) {
@@ -38241,7 +38250,9 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38241
38250
  };
38242
38251
  return pollServer();
38243
38252
  }, probePrerenderServer = async (port) => {
38244
- const res = await fetch(`http://localhost:${port}/`).catch(() => null);
38253
+ const res = await fetchWithTimeout(`http://localhost:${port}/`, {
38254
+ signal: AbortSignal.timeout(Math.min(getFetchTimeoutMs(), 1000))
38255
+ }).catch(() => null);
38245
38256
  if (!res) {
38246
38257
  return false;
38247
38258
  }
@@ -46561,5 +46572,5 @@ export {
46561
46572
  ANGULAR_INIT_TIMEOUT_MS
46562
46573
  };
46563
46574
 
46564
- //# debugId=741893954B715E8C64756E2164756E21
46575
+ //# debugId=750C6572D2856D9964756E2164756E21
46565
46576
  //# sourceMappingURL=index.js.map