@absolutejs/absolute 0.19.0-beta.222 → 0.19.0-beta.224

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;
@@ -300,7 +300,7 @@ var conventionsMap, setConventions = (map) => {
300
300
  return null;
301
301
  }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
302
302
  for (const framework of NOT_FOUND_PRIORITY) {
303
- if (!conventionsMap[framework]?.defaults?.notFound)
303
+ if (!getMap()[framework]?.defaults?.notFound)
304
304
  continue;
305
305
  const response = await renderConventionNotFound(framework);
306
306
  if (response)
@@ -309,7 +309,6 @@ var conventionsMap, setConventions = (map) => {
309
309
  return null;
310
310
  };
311
311
  var init_resolveConvention = __esm(() => {
312
- conventionsMap = {};
313
312
  NOT_FOUND_PRIORITY = [
314
313
  "react",
315
314
  "svelte",
@@ -172370,15 +172369,15 @@ ${content.slice(firstUseIdx)}`;
172370
172369
  const allSvelteEntries = svelteConventionResult.pageFiles;
172371
172370
  const allVueEntries = vueConventionResult.pageFiles;
172372
172371
  const allAngularEntries = angularConventionResult.pageFiles;
172373
- const conventionsMap2 = {};
172372
+ const conventionsMap = {};
172374
172373
  if (reactConventionResult.conventions)
172375
- conventionsMap2.react = reactConventionResult.conventions;
172374
+ conventionsMap.react = reactConventionResult.conventions;
172376
172375
  if (svelteConventionResult.conventions)
172377
- conventionsMap2.svelte = svelteConventionResult.conventions;
172376
+ conventionsMap.svelte = svelteConventionResult.conventions;
172378
172377
  if (vueConventionResult.conventions)
172379
- conventionsMap2.vue = vueConventionResult.conventions;
172378
+ conventionsMap.vue = vueConventionResult.conventions;
172380
172379
  if (angularConventionResult.conventions)
172381
- conventionsMap2.angular = angularConventionResult.conventions;
172380
+ conventionsMap.angular = angularConventionResult.conventions;
172382
172381
  const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
172383
172382
  const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
172384
172383
  if (entry.startsWith(resolve13(reactIndexesPath))) {
@@ -172418,25 +172417,33 @@ ${content.slice(firstUseIdx)}`;
172418
172417
  serverPaths: [...emptyStringArray]
172419
172418
  }
172420
172419
  ]);
172421
- const svelteConventionSources = collectConventionSourceFiles(conventionsMap2.svelte);
172422
- const vueConventionSources = collectConventionSourceFiles(conventionsMap2.vue);
172420
+ const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
172421
+ const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
172423
172422
  if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
172424
172423
  const [svelteConvResult, vueConvResult] = await Promise.all([
172425
172424
  svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: [] },
172426
172425
  vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: [] }
172427
172426
  ]);
172428
- updateConventionCompiledPaths(conventionsMap2.svelte, svelteConventionSources, svelteConvResult.svelteServerPaths);
172429
- updateConventionCompiledPaths(conventionsMap2.vue, vueConventionSources, vueConvResult.vueServerPaths);
172427
+ const copyConventionFiles = (framework, sources, compiledPaths) => {
172428
+ const destDir = join15(buildPath, "conventions", framework);
172429
+ mkdirSync9(destDir, { recursive: true });
172430
+ const destPaths = [];
172431
+ for (const compiledPath of compiledPaths) {
172432
+ const dest = join15(destDir, basename7(compiledPath));
172433
+ copyFileSync(compiledPath, dest);
172434
+ destPaths.push(dest);
172435
+ }
172436
+ return destPaths;
172437
+ };
172438
+ const svelteDests = copyConventionFiles("svelte", svelteConventionSources, svelteConvResult.svelteServerPaths);
172439
+ const vueDests = copyConventionFiles("vue", vueConventionSources, vueConvResult.vueServerPaths);
172440
+ updateConventionCompiledPaths(conventionsMap.svelte, svelteConventionSources, svelteDests);
172441
+ updateConventionCompiledPaths(conventionsMap.vue, vueConventionSources, vueDests);
172430
172442
  }
172431
- const conventionServerPaths = [
172432
- ...collectConventionSourceFiles(conventionsMap2.svelte),
172433
- ...collectConventionSourceFiles(conventionsMap2.vue)
172434
- ];
172435
172443
  const serverEntryPoints = [
172436
172444
  ...svelteServerPaths,
172437
172445
  ...vueServerPaths,
172438
- ...angularServerPaths,
172439
- ...conventionServerPaths
172446
+ ...angularServerPaths
172440
172447
  ];
172441
172448
  const reactClientEntryPoints = [...reactEntries];
172442
172449
  const allFrameworkDirs = [
@@ -172677,44 +172684,22 @@ ${content.slice(firstUseIdx)}`;
172677
172684
  ...cssLogs
172678
172685
  ];
172679
172686
  outputLogs(allLogs);
172680
- const conventionBaseNames = new Set(conventionServerPaths.map((p) => basename7(p).replace(/\.[^.]+$/, "")));
172681
- const pageServerOutputs = serverOutputs.filter((artifact) => {
172682
- const fileWithHash = basename7(artifact.path);
172683
- const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
172684
- return !baseName || !conventionBaseNames.has(baseName);
172685
- });
172686
172687
  const manifest = {
172687
172688
  ...options?.baseManifest || {},
172688
172689
  ...generateManifest([
172689
- ...pageServerOutputs,
172690
+ ...serverOutputs,
172690
172691
  ...reactClientOutputs,
172691
172692
  ...nonReactClientOutputs,
172692
172693
  ...cssOutputs
172693
172694
  ], buildPath)
172694
172695
  };
172695
- const conventionCompiledToBundled = new Map;
172696
172696
  for (const artifact of serverOutputs) {
172697
172697
  const fileWithHash = basename7(artifact.path);
172698
172698
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
172699
172699
  if (!baseName)
172700
172700
  continue;
172701
- if (conventionBaseNames.has(baseName)) {
172702
- for (const compiledPath of conventionServerPaths) {
172703
- const compiledBase = basename7(compiledPath).replace(/\.[^.]+$/, "");
172704
- if (compiledBase === baseName) {
172705
- conventionCompiledToBundled.set(compiledPath, artifact.path);
172706
- }
172707
- }
172708
- continue;
172709
- }
172710
172701
  manifest[toPascal(baseName)] = artifact.path;
172711
172702
  }
172712
- if (conventionCompiledToBundled.size > 0) {
172713
- const compiledPaths = [...conventionCompiledToBundled.keys()];
172714
- const bundledPaths = compiledPaths.map((p) => conventionCompiledToBundled.get(p) ?? p);
172715
- updateConventionCompiledPaths(conventionsMap2.svelte, compiledPaths, bundledPaths);
172716
- updateConventionCompiledPaths(conventionsMap2.vue, compiledPaths, bundledPaths);
172717
- }
172718
172703
  const htmlOrHtmlCssChanged = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
172719
172704
  const htmxOrHtmxCssChanged = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/htmx/") && (f.endsWith(".html") || f.endsWith(".css")));
172720
172705
  const shouldCopyHtml = htmlOrHtmlCssChanged;
@@ -172821,11 +172806,11 @@ ${content.slice(firstUseIdx)}`;
172821
172806
  });
172822
172807
  if (!isIncremental) {
172823
172808
  writeFileSync4(join15(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
172824
- if (Object.keys(conventionsMap2).length > 0) {
172825
- writeFileSync4(join15(buildPath, "conventions.json"), JSON.stringify(conventionsMap2, null, "\t"));
172809
+ if (Object.keys(conventionsMap).length > 0) {
172810
+ writeFileSync4(join15(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
172826
172811
  }
172827
172812
  }
172828
- return { manifest, conventions: conventionsMap2 };
172813
+ return { manifest, conventions: conventionsMap };
172829
172814
  };
172830
172815
  var init_build = __esm(() => {
172831
172816
  init_constants();
@@ -178342,5 +178327,5 @@ export {
178342
178327
  ANGULAR_INIT_TIMEOUT_MS
178343
178328
  };
178344
178329
 
178345
- //# debugId=F79A191A33B743E564756E2164756E21
178330
+ //# debugId=2DBD112ED081E22264756E2164756E21
178346
178331
  //# sourceMappingURL=index.js.map