@absolutejs/absolute 0.19.0-beta.1055 → 0.19.0-beta.1057

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/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";
@@ -176817,7 +176829,19 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176817
176829
  return false;
176818
176830
  }
176819
176831
  return true;
176820
- }), tryReadNodePackageJson = (packageDir) => {
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;
176844
+ }, tryReadNodePackageJson = (packageDir) => {
176821
176845
  try {
176822
176846
  return JSON.parse(readFileSync33(join31(packageDir, "package.json"), "utf-8"));
176823
176847
  } catch {
@@ -177596,6 +177620,7 @@ console.log(\`
177596
177620
  ABSOLUTE_VERSION: absoluteVersion,
177597
177621
  FORCE_COLOR: "0",
177598
177622
  NODE_ENV: "production",
177623
+ ...resolveCompileNativeAssetEnv(buildConfig),
177599
177624
  ...configPath2 ? { ABSOLUTE_CONFIG: configPath2 } : {}
177600
177625
  });
177601
177626
  const prerenderMap = prerenderResult.routes;
@@ -177674,6 +177699,7 @@ var init_compile = __esm(() => {
177674
177699
  ]);
177675
177700
  jsxDevRuntimeCompatPath2 = resolveJsxDevRuntimeCompatPath2();
177676
177701
  ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
177702
+ requireForCompile = createRequire2(import.meta.url);
177677
177703
  RUNTIME_JS_EXTENSIONS = [".js", ".mjs", ".cjs"];
177678
177704
  MODULE_SPECIFIER_RE = /(from\s*|import\s*|import\(\s*|require\(\s*)(["'])([^"']+)\2/g;
177679
177705
  FRAMEWORK_EXTERNALS = [
package/dist/index.js CHANGED
@@ -31207,7 +31207,8 @@ ${content.slice(firstUseIdx)}`;
31207
31207
  const childArtifact = serverJsByPascalName.get(childName);
31208
31208
  if (!childArtifact)
31209
31209
  return [];
31210
- const cssPath = childArtifact.path.replace(/\.js$/, ".css");
31210
+ const absoluteCssPath = childArtifact.path.replace(/\.js$/, ".css");
31211
+ const cssPath = relative14(dirname20(parentArtifact.path), absoluteCssPath);
31211
31212
  return [{ cssPath, path }];
31212
31213
  });
31213
31214
  if (entries.length === 0)
@@ -38110,7 +38111,7 @@ __export(exports_prerender, {
38110
38111
  });
38111
38112
  import { mkdirSync as mkdirSync16, readFileSync as readFileSync32 } from "fs";
38112
38113
  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) => {
38114
+ 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
38115
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
38115
38116
  await Bun.write(metaPath, String(Date.now()));
38116
38117
  }, readTimestamp = (htmlPath) => {
@@ -38133,7 +38134,9 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38133
38134
  }
38134
38135
  return links;
38135
38136
  }, fetchRoute = async (baseUrl, path) => {
38136
- const res = await fetch(`${baseUrl}${path}`, { redirect: "manual" });
38137
+ const res = await fetchWithTimeout(`${baseUrl}${path}`, {
38138
+ redirect: "manual"
38139
+ });
38137
38140
  if (!res.ok)
38138
38141
  return null;
38139
38142
  const contentType = res.headers.get("content-type") ?? "";
@@ -38167,7 +38170,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38167
38170
  return routes;
38168
38171
  }, rerenderRoute = async (route, port, prerenderDir) => {
38169
38172
  try {
38170
- const res = await fetch(`http://localhost:${port}${route}`, {
38173
+ const res = await fetchWithTimeout(`http://localhost:${port}${route}`, {
38171
38174
  headers: { [PRERENDER_BYPASS_HEADER]: "1" },
38172
38175
  redirect: "manual"
38173
38176
  });
@@ -38183,7 +38186,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38183
38186
  return false;
38184
38187
  }
38185
38188
  }, prerenderRoute = async (baseUrl, route, prerenderDir, result, log2) => {
38186
- const res = await fetch(`${baseUrl}${route}`, {
38189
+ const res = await fetchWithTimeout(`${baseUrl}${route}`, {
38187
38190
  redirect: "manual"
38188
38191
  }).catch(() => null);
38189
38192
  if (!res) {
@@ -38227,7 +38230,14 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38227
38230
  const rawTimeout = Bun.env.ABSOLUTE_PRERENDER_STARTUP_TIMEOUT_MS;
38228
38231
  const parsedTimeout = rawTimeout ? Number(rawTimeout) : NaN;
38229
38232
  return Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : DEFAULT_STARTUP_TIMEOUT_MS;
38230
- }, waitForServerReady = async (port) => {
38233
+ }, getFetchTimeoutMs = () => {
38234
+ const rawTimeout = Bun.env.ABSOLUTE_PRERENDER_FETCH_TIMEOUT_MS;
38235
+ const parsedTimeout = rawTimeout ? Number(rawTimeout) : NaN;
38236
+ return Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : DEFAULT_FETCH_TIMEOUT_MS;
38237
+ }, fetchWithTimeout = (url2, init = {}) => fetch(url2, {
38238
+ ...init,
38239
+ signal: init.signal ?? AbortSignal.timeout(getFetchTimeoutMs())
38240
+ }), waitForServerReady = async (port) => {
38231
38241
  const deadline = performance.now() + getStartupTimeoutMs();
38232
38242
  const pollServer = async () => {
38233
38243
  if (performance.now() >= deadline) {
@@ -38241,7 +38251,9 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
38241
38251
  };
38242
38252
  return pollServer();
38243
38253
  }, probePrerenderServer = async (port) => {
38244
- const res = await fetch(`http://localhost:${port}/`).catch(() => null);
38254
+ const res = await fetchWithTimeout(`http://localhost:${port}/`, {
38255
+ signal: AbortSignal.timeout(Math.min(getFetchTimeoutMs(), 1000))
38256
+ }).catch(() => null);
38245
38257
  if (!res) {
38246
38258
  return false;
38247
38259
  }
@@ -46561,5 +46573,5 @@ export {
46561
46573
  ANGULAR_INIT_TIMEOUT_MS
46562
46574
  };
46563
46575
 
46564
- //# debugId=741893954B715E8C64756E2164756E21
46576
+ //# debugId=3A647B9E0B0A845E64756E2164756E21
46565
46577
  //# sourceMappingURL=index.js.map