@absolutejs/absolute 0.19.0-beta.223 → 0.19.0-beta.225

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
@@ -161,14 +161,14 @@ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-
161
161
 
162
162
  // src/utils/resolveConvention.ts
163
163
  import { basename } from "path";
164
- var conventionsMap, setConventions = (map) => {
165
- conventionsMap = map;
164
+ var CONVENTIONS_KEY = "__absoluteConventions", getMap = () => globalThis[CONVENTIONS_KEY] ?? {}, setConventions = (map) => {
165
+ globalThis[CONVENTIONS_KEY] = map;
166
166
  }, resolveErrorConventionPath = (framework, pageName) => {
167
- const fw = conventionsMap[framework];
167
+ const fw = getMap()[framework];
168
168
  if (!fw)
169
169
  return;
170
170
  return fw.pages?.[pageName]?.error ?? fw.defaults?.error;
171
- }, resolveNotFoundConventionPath = (framework) => conventionsMap[framework]?.defaults?.notFound, derivePageName = (pagePath) => {
171
+ }, resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound, derivePageName = (pagePath) => {
172
172
  const base = basename(pagePath);
173
173
  const dotIndex = base.indexOf(".");
174
174
  const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
@@ -217,8 +217,13 @@ var conventionsMap, setConventions = (map) => {
217
217
  const app = createSSRApp({
218
218
  render: () => h(ErrorComponent, errorProps)
219
219
  });
220
- const body = await renderToString(app);
221
- const html = `<!DOCTYPE html><html><head></head><body><div id="root">${body}</div></body></html>`;
220
+ let body = await renderToString(app);
221
+ let styles = "";
222
+ body = body.replace(/<style>([\s\S]*?)<\/style>/g, (_, css) => {
223
+ styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
224
+ return "";
225
+ });
226
+ const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
222
227
  return new Response(html, {
223
228
  headers: { "Content-Type": "text/html" },
224
229
  status: 500
@@ -276,8 +281,13 @@ var conventionsMap, setConventions = (map) => {
276
281
  const app = createSSRApp({
277
282
  render: () => h(NotFoundComponent)
278
283
  });
279
- const body = await renderToString(app);
280
- const html = `<!DOCTYPE html><html><head></head><body><div id="root">${body}</div></body></html>`;
284
+ let body = await renderToString(app);
285
+ let styles = "";
286
+ body = body.replace(/<style>([\s\S]*?)<\/style>/g, (_, css) => {
287
+ styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
288
+ return "";
289
+ });
290
+ const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
281
291
  return new Response(html, {
282
292
  headers: { "Content-Type": "text/html" },
283
293
  status: 404
@@ -300,7 +310,7 @@ var conventionsMap, setConventions = (map) => {
300
310
  return null;
301
311
  }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
302
312
  for (const framework of NOT_FOUND_PRIORITY) {
303
- if (!conventionsMap[framework]?.defaults?.notFound)
313
+ if (!getMap()[framework]?.defaults?.notFound)
304
314
  continue;
305
315
  const response = await renderConventionNotFound(framework);
306
316
  if (response)
@@ -309,7 +319,6 @@ var conventionsMap, setConventions = (map) => {
309
319
  return null;
310
320
  };
311
321
  var init_resolveConvention = __esm(() => {
312
- conventionsMap = {};
313
322
  NOT_FOUND_PRIORITY = [
314
323
  "react",
315
324
  "svelte",
@@ -172370,15 +172379,15 @@ ${content.slice(firstUseIdx)}`;
172370
172379
  const allSvelteEntries = svelteConventionResult.pageFiles;
172371
172380
  const allVueEntries = vueConventionResult.pageFiles;
172372
172381
  const allAngularEntries = angularConventionResult.pageFiles;
172373
- const conventionsMap2 = {};
172382
+ const conventionsMap = {};
172374
172383
  if (reactConventionResult.conventions)
172375
- conventionsMap2.react = reactConventionResult.conventions;
172384
+ conventionsMap.react = reactConventionResult.conventions;
172376
172385
  if (svelteConventionResult.conventions)
172377
- conventionsMap2.svelte = svelteConventionResult.conventions;
172386
+ conventionsMap.svelte = svelteConventionResult.conventions;
172378
172387
  if (vueConventionResult.conventions)
172379
- conventionsMap2.vue = vueConventionResult.conventions;
172388
+ conventionsMap.vue = vueConventionResult.conventions;
172380
172389
  if (angularConventionResult.conventions)
172381
- conventionsMap2.angular = angularConventionResult.conventions;
172390
+ conventionsMap.angular = angularConventionResult.conventions;
172382
172391
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
172383
172392
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
172384
172393
  if (entry.startsWith(resolve13(reactIndexesPath))) {
@@ -172418,8 +172427,8 @@ ${content.slice(firstUseIdx)}`;
172418
172427
  serverPaths: [...emptyStringArray]
172419
172428
  }
172420
172429
  ]);
172421
- const svelteConventionSources = collectConventionSourceFiles(conventionsMap2.svelte);
172422
- const vueConventionSources = collectConventionSourceFiles(conventionsMap2.vue);
172430
+ const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
172431
+ const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
172423
172432
  if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
172424
172433
  const [svelteConvResult, vueConvResult] = await Promise.all([
172425
172434
  svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: [] },
@@ -172438,8 +172447,8 @@ ${content.slice(firstUseIdx)}`;
172438
172447
  };
172439
172448
  const svelteDests = copyConventionFiles("svelte", svelteConventionSources, svelteConvResult.svelteServerPaths);
172440
172449
  const vueDests = copyConventionFiles("vue", vueConventionSources, vueConvResult.vueServerPaths);
172441
- updateConventionCompiledPaths(conventionsMap2.svelte, svelteConventionSources, svelteDests);
172442
- updateConventionCompiledPaths(conventionsMap2.vue, vueConventionSources, vueDests);
172450
+ updateConventionCompiledPaths(conventionsMap.svelte, svelteConventionSources, svelteDests);
172451
+ updateConventionCompiledPaths(conventionsMap.vue, vueConventionSources, vueDests);
172443
172452
  }
172444
172453
  const serverEntryPoints = [
172445
172454
  ...svelteServerPaths,
@@ -172807,11 +172816,11 @@ ${content.slice(firstUseIdx)}`;
172807
172816
  });
172808
172817
  if (!isIncremental) {
172809
172818
  writeFileSync4(join15(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
172810
- if (Object.keys(conventionsMap2).length > 0) {
172811
- writeFileSync4(join15(buildPath, "conventions.json"), JSON.stringify(conventionsMap2, null, "\t"));
172819
+ if (Object.keys(conventionsMap).length > 0) {
172820
+ writeFileSync4(join15(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
172812
172821
  }
172813
172822
  }
172814
- return { manifest, conventions: conventionsMap2 };
172823
+ return { manifest, conventions: conventionsMap };
172815
172824
  };
172816
172825
  var init_build = __esm(() => {
172817
172826
  init_constants();
@@ -178328,5 +178337,5 @@ export {
178328
178337
  ANGULAR_INIT_TIMEOUT_MS
178329
178338
  };
178330
178339
 
178331
- //# debugId=FE1792ADEC7373EA64756E2164756E21
178340
+ //# debugId=E6CAD30CAF93B30A64756E2164756E21
178332
178341
  //# sourceMappingURL=index.js.map