@absolutejs/absolute 0.19.0-beta.282 → 0.19.0-beta.284

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
@@ -174852,7 +174852,7 @@ var ssrDirty3 = false, buildDirtyResponse2 = (indexPath, props) => {
174852
174852
  return new Response(html, {
174853
174853
  headers: { "Content-Type": "text/html" }
174854
174854
  });
174855
- }, handleSveltePageRequest = async (PageComponent, pagePath, indexPath, props) => {
174855
+ }, handleSveltePageRequest = async (PageComponent, pagePath, indexPath, props, options) => {
174856
174856
  if (ssrDirty3) {
174857
174857
  return buildDirtyResponse2(indexPath, props);
174858
174858
  }
@@ -174880,8 +174880,10 @@ var ssrDirty3 = false, buildDirtyResponse2 = (indexPath, props) => {
174880
174880
  const { renderToReadableStream: renderToReadableStream2 } = await Promise.resolve().then(() => (init_renderToReadableStream(), exports_renderToReadableStream));
174881
174881
  const ImportedPageComponent = await resolvePageComponent();
174882
174882
  const stream = await renderToReadableStream2(ImportedPageComponent, props, {
174883
+ bodyContent: options?.bodyContent,
174883
174884
  bootstrapModules: indexPath ? [indexPath] : [],
174884
- bootstrapScriptContent: `window.__INITIAL_PROPS__=${JSON.stringify(props)}`
174885
+ bootstrapScriptContent: `window.__INITIAL_PROPS__=${JSON.stringify(props)}`,
174886
+ headContent: options?.headContent
174885
174887
  });
174886
174888
  return new Response(stream, {
174887
174889
  headers: { "Content-Type": "text/html" }
@@ -174906,7 +174908,24 @@ var init_pageHandler3 = __esm(() => {
174906
174908
  });
174907
174909
 
174908
174910
  // src/vue/pageHandler.ts
174909
- var ssrDirty4 = false, buildDirtyResponse3 = (headTag, indexPath, maybeProps) => {
174911
+ import { readdir as readdir3 } from "fs/promises";
174912
+ import { basename as basename9, dirname as dirname10 } from "path";
174913
+ var ssrDirty4 = false, resolveCurrentGeneratedVueModulePath = async (pagePath) => {
174914
+ const pageDirectory = dirname10(pagePath);
174915
+ const expectedPrefix = `${basename9(pagePath, ".js").split(".")[0]}.`;
174916
+ try {
174917
+ const pageEntries = await readdir3(pageDirectory, {
174918
+ withFileTypes: true
174919
+ });
174920
+ const matchingEntry = pageEntries.find((entry) => entry.isFile() && entry.name.endsWith(".js") && (entry.name === `${expectedPrefix.slice(0, -1)}.js` || entry.name.startsWith(expectedPrefix)));
174921
+ if (!matchingEntry) {
174922
+ return pagePath;
174923
+ }
174924
+ return `${pageDirectory}/${matchingEntry.name}`;
174925
+ } catch {
174926
+ return pagePath;
174927
+ }
174928
+ }, buildDirtyResponse3 = (headTag, indexPath, maybeProps) => {
174910
174929
  const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})};`;
174911
174930
  const dirtyFlag = "window.__SSR_DIRTY__=true;";
174912
174931
  const html = `<!DOCTYPE html><html>${headTag}<body><div id="root"></div>` + `<script>${propsScript}${dirtyFlag}</script>` + `<script type="module" src="${indexPath}"></script>` + `</body></html>`;
@@ -174919,7 +174938,16 @@ var ssrDirty4 = false, buildDirtyResponse3 = (headTag, indexPath, maybeProps) =>
174919
174938
  return buildDirtyResponse3(headTag, indexPath, maybeProps);
174920
174939
  }
174921
174940
  try {
174922
- const { default: ImportedPageComponent } = await import(pagePath);
174941
+ const resolvePageComponent = async () => {
174942
+ const passedPageComponent = _PageComponent;
174943
+ if (typeof passedPageComponent === "function" || typeof passedPageComponent === "object" && passedPageComponent !== null) {
174944
+ return _PageComponent;
174945
+ }
174946
+ const generatedPagePath = await resolveCurrentGeneratedVueModulePath(pagePath);
174947
+ const importedPageModule = await import(generatedPagePath);
174948
+ return importedPageModule.default ?? importedPageModule;
174949
+ };
174950
+ const ImportedPageComponent = await resolvePageComponent();
174923
174951
  const { createSSRApp, h } = await import("vue");
174924
174952
  const { renderToWebStream } = await import("vue/server-renderer");
174925
174953
  const app = createSSRApp({
@@ -175032,7 +175060,7 @@ __export(exports_moduleServer, {
175032
175060
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
175033
175061
  });
175034
175062
  import { existsSync as existsSync19, readFileSync as readFileSync11, statSync as statSync2 } from "fs";
175035
- import { basename as basename9, dirname as dirname10, extname as extname5, resolve as resolve24, relative as relative10 } from "path";
175063
+ import { basename as basename10, dirname as dirname11, extname as extname5, resolve as resolve24, relative as relative10 } from "path";
175036
175064
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
175037
175065
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
175038
175066
  const allExports = [];
@@ -175115,7 +175143,7 @@ ${stubs}
175115
175143
  };
175116
175144
  result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
175117
175145
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
175118
- const fileDir = dirname10(filePath);
175146
+ const fileDir = dirname11(filePath);
175119
175147
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
175120
175148
  result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
175121
175149
  result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
@@ -175391,7 +175419,7 @@ ${code}`;
175391
175419
  if (!vueCompiler) {
175392
175420
  vueCompiler = await import("@vue/compiler-sfc");
175393
175421
  }
175394
- const fileName = basename9(filePath, ".vue");
175422
+ const fileName = basename10(filePath, ".vue");
175395
175423
  const componentId = fileName.toLowerCase();
175396
175424
  const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
175397
175425
  const compiledScript = vueCompiler.compileScript(descriptor, {
@@ -175765,7 +175793,7 @@ var init_simpleHTMXHMR = () => {};
175765
175793
  // src/dev/rebuildTrigger.ts
175766
175794
  import { existsSync as existsSync20 } from "fs";
175767
175795
  import { rm as rm8 } from "fs/promises";
175768
- import { basename as basename10, relative as relative11, resolve as resolve27 } from "path";
175796
+ import { basename as basename11, relative as relative11, resolve as resolve27 } from "path";
175769
175797
  var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
175770
175798
  const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
175771
175799
  if (pathLineCol) {
@@ -176040,7 +176068,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176040
176068
  const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
176041
176069
  return clientRoots.length === 1 ? clientRoots[0] ?? process.cwd() : commonAncestor2(clientRoots, process.cwd());
176042
176070
  }, updateServerManifestEntry = (state, artifact) => {
176043
- const fileWithHash = basename10(artifact.path);
176071
+ const fileWithHash = basename11(artifact.path);
176044
176072
  const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
176045
176073
  if (!baseName) {
176046
176074
  return;
@@ -176080,7 +176108,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176080
176108
  await populateAssetStore(state.assetStore, clientManifest, buildDir);
176081
176109
  }, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime) => {
176082
176110
  pagesToUpdate.forEach((angularPagePath) => {
176083
- const fileName = basename10(angularPagePath);
176111
+ const fileName = basename11(angularPagePath);
176084
176112
  const baseName = fileName.replace(/\.[tj]s$/, "");
176085
176113
  const pascalName = toPascal(baseName);
176086
176114
  const cssKey = `${pascalName}CSS`;
@@ -176103,7 +176131,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176103
176131
  const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
176104
176132
  const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
176105
176133
  serverPaths.forEach((serverPath) => {
176106
- const fileBase = basename10(serverPath, ".js");
176134
+ const fileBase = basename11(serverPath, ".js");
176107
176135
  state.manifest[toPascal(fileBase)] = resolve27(serverPath);
176108
176136
  });
176109
176137
  if (clientPaths.length > 0) {
@@ -176135,7 +176163,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176135
176163
  onRebuildComplete({ hmrState: state, manifest });
176136
176164
  return manifest;
176137
176165
  }, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
176138
- const pageName = basename10(normalized, ".tsx");
176166
+ const pageName = basename11(normalized, ".tsx");
176139
176167
  const indexPath = resolve27(reactIndexesPath, `${pageName}.tsx`);
176140
176168
  if (!existsSync20(indexPath)) {
176141
176169
  return;
@@ -176147,7 +176175,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176147
176175
  if (!dep.startsWith(pagesPathResolved)) {
176148
176176
  return;
176149
176177
  }
176150
- const pageName = basename10(dep, ".tsx");
176178
+ const pageName = basename11(dep, ".tsx");
176151
176179
  const indexPath = resolve27(reactIndexesPath, `${pageName}.tsx`);
176152
176180
  if (existsSync20(indexPath) && !reactEntries.includes(indexPath)) {
176153
176181
  reactEntries.push(indexPath);
@@ -176364,7 +176392,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176364
176392
  const serverEntries = [...svelteServerPaths];
176365
176393
  const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
176366
176394
  const serverRoot = resolve27(svelteDir, "generated", "server");
176367
- const serverOutDir = resolve27(buildDir, basename10(svelteDir));
176395
+ const serverOutDir = resolve27(buildDir, basename11(svelteDir));
176368
176396
  const [serverResult, clientResult] = await Promise.all([
176369
176397
  serverEntries.length > 0 ? bunBuild7({
176370
176398
  entrypoints: serverEntries,
@@ -176397,7 +176425,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176397
176425
  const duration = Date.now() - startTime;
176398
176426
  const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
176399
176427
  broadcastFiles.forEach((sveltePagePath) => {
176400
- const fileName = basename10(sveltePagePath);
176428
+ const fileName = basename11(sveltePagePath);
176401
176429
  const baseName = fileName.replace(/\.svelte$/, "");
176402
176430
  const pascalName = toPascal(baseName);
176403
176431
  const cssKey = `${pascalName}CSS`;
@@ -176525,7 +176553,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176525
176553
  });
176526
176554
  }
176527
176555
  }, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
176528
- const scriptBaseName = basename10(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
176556
+ const scriptBaseName = basename11(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
176529
176557
  const pascalName = toPascal(scriptBaseName);
176530
176558
  const scriptPath = manifest[pascalName] || null;
176531
176559
  if (!scriptPath) {
@@ -176563,7 +176591,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176563
176591
  if (isSingle) {
176564
176592
  return resolve27(state.resolvedPaths.buildDir, "pages");
176565
176593
  }
176566
- const dirName = framework === "html" ? basename10(config.htmlDirectory ?? "html") : basename10(config.htmxDirectory ?? "htmx");
176594
+ const dirName = framework === "html" ? basename11(config.htmlDirectory ?? "html") : basename11(config.htmxDirectory ?? "htmx");
176567
176595
  return resolve27(state.resolvedPaths.buildDir, dirName, "pages");
176568
176596
  }, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
176569
176597
  try {
@@ -176599,7 +176627,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176599
176627
  const htmlPageFiles = htmlFrameworkFiles.filter((file4) => file4.endsWith(".html"));
176600
176628
  const outputHtmlPages = computeOutputPagesDir(state, config, "html");
176601
176629
  for (const pageFile of htmlPageFiles) {
176602
- const htmlPageName = basename10(pageFile);
176630
+ const htmlPageName = basename11(pageFile);
176603
176631
  const builtHtmlPagePath = resolve27(outputHtmlPages, htmlPageName);
176604
176632
  await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
176605
176633
  }
@@ -176608,7 +176636,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176608
176636
  if (!cssFile) {
176609
176637
  return;
176610
176638
  }
176611
- const cssBaseName = basename10(cssFile, ".css");
176639
+ const cssBaseName = basename11(cssFile, ".css");
176612
176640
  const cssPascalName = toPascal(cssBaseName);
176613
176641
  const cssKey = `${cssPascalName}CSS`;
176614
176642
  const cssUrl = manifest[cssKey] || null;
@@ -176657,7 +176685,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176657
176685
  type: "vue-update"
176658
176686
  });
176659
176687
  }, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
176660
- const fileName = basename10(vuePagePath);
176688
+ const fileName = basename11(vuePagePath);
176661
176689
  const baseName = fileName.replace(/\.vue$/, "");
176662
176690
  const pascalName = toPascal(baseName);
176663
176691
  const vueRoot = config.vueDirectory;
@@ -176705,7 +176733,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176705
176733
  if (!cssFile) {
176706
176734
  return;
176707
176735
  }
176708
- const cssBaseName = basename10(cssFile, ".css");
176736
+ const cssBaseName = basename11(cssFile, ".css");
176709
176737
  const cssPascalName = toPascal(cssBaseName);
176710
176738
  const cssKey = `${cssPascalName}CSS`;
176711
176739
  const cssUrl = manifest[cssKey] || null;
@@ -176723,7 +176751,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176723
176751
  });
176724
176752
  }, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
176725
176753
  try {
176726
- const fileName = basename10(sveltePagePath);
176754
+ const fileName = basename11(sveltePagePath);
176727
176755
  const baseName = fileName.replace(/\.svelte$/, "");
176728
176756
  const pascalName = toPascal(baseName);
176729
176757
  const cssKey = `${pascalName}CSS`;
@@ -176785,7 +176813,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176785
176813
  if (!cssFile) {
176786
176814
  return;
176787
176815
  }
176788
- const cssBaseName = basename10(cssFile, ".css");
176816
+ const cssBaseName = basename11(cssFile, ".css");
176789
176817
  const cssPascalName = toPascal(cssBaseName);
176790
176818
  const cssKey = `${cssPascalName}CSS`;
176791
176819
  const cssUrl = manifest[cssKey] || null;
@@ -176803,7 +176831,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176803
176831
  });
176804
176832
  }, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration) => {
176805
176833
  try {
176806
- const fileName = basename10(angularPagePath);
176834
+ const fileName = basename11(angularPagePath);
176807
176835
  const baseName = fileName.replace(/\.[tj]s$/, "");
176808
176836
  const pascalName = toPascal(baseName);
176809
176837
  const cssKey = `${pascalName}CSS`;
@@ -176898,7 +176926,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
176898
176926
  const htmxPageFiles = htmxFrameworkFiles.filter((file4) => file4.endsWith(".html"));
176899
176927
  const outputHtmxPages = computeOutputPagesDir(state, config, "htmx");
176900
176928
  for (const htmxPageFile of htmxPageFiles) {
176901
- const htmxPageName = basename10(htmxPageFile);
176929
+ const htmxPageName = basename11(htmxPageFile);
176902
176930
  const builtHtmxPagePath = resolve27(outputHtmxPages, htmxPageName);
176903
176931
  await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
176904
176932
  }
@@ -177008,7 +177036,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
177008
177036
  html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
177009
177037
  writeFs(destPath, html);
177010
177038
  }, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
177011
- const destPath = resolve27(outputDir, basename10(sourceFile));
177039
+ const destPath = resolve27(outputDir, basename11(sourceFile));
177012
177040
  const hmrScript = extractHmrScript(destPath, readFs);
177013
177041
  const source = await Bun.file(sourceFile).text();
177014
177042
  await Bun.write(destPath, source);
@@ -177369,7 +177397,7 @@ var exports_devBuild = {};
177369
177397
  __export(exports_devBuild, {
177370
177398
  devBuild: () => devBuild
177371
177399
  });
177372
- import { readdir as readdir3 } from "fs/promises";
177400
+ import { readdir as readdir4 } from "fs/promises";
177373
177401
  import { statSync as statSync3 } from "fs";
177374
177402
  import { resolve as resolve28 } from "path";
177375
177403
  var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
@@ -177509,7 +177537,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
177509
177537
  }
177510
177538
  }, loadVendorFiles = async (assetStore, vendorDir, framework) => {
177511
177539
  const emptyStringArray = [];
177512
- const entries = await readdir3(vendorDir).catch(() => emptyStringArray);
177540
+ const entries = await readdir4(vendorDir).catch(() => emptyStringArray);
177513
177541
  await Promise.all(entries.map(async (entry) => {
177514
177542
  const webPath = `/${framework}/vendor/${entry}`;
177515
177543
  const bytes = await Bun.file(resolve28(vendorDir, entry)).bytes();
@@ -207656,7 +207684,7 @@ var handleHTMLPageRequest = (pagePath) => file(pagePath);
207656
207684
  var handleHTMXPageRequest = (pagePath) => file(pagePath);
207657
207685
  // src/core/prepare.ts
207658
207686
  import { existsSync as existsSync22, readdirSync as readdirSync2, readFileSync as readFileSync13 } from "fs";
207659
- import { basename as basename11, join as join22, relative as relative12, resolve as resolve30 } from "path";
207687
+ import { basename as basename12, join as join22, relative as relative12, resolve as resolve30 } from "path";
207660
207688
 
207661
207689
  // src/utils/loadConfig.ts
207662
207690
  import { resolve } from "path";
@@ -207806,7 +207834,7 @@ var loadPrerenderMap = (prerenderDir) => {
207806
207834
  for (const entry of entries) {
207807
207835
  if (!entry.endsWith(".html"))
207808
207836
  continue;
207809
- const name = basename11(entry, ".html");
207837
+ const name = basename12(entry, ".html");
207810
207838
  const route = name === "index" ? "/" : `/${name}`;
207811
207839
  map.set(route, join22(prerenderDir, entry));
207812
207840
  }
@@ -214570,5 +214598,5 @@ export {
214570
214598
  ANGULAR_INIT_TIMEOUT_MS
214571
214599
  };
214572
214600
 
214573
- //# debugId=55612EB2BF9C746164756E2164756E21
214601
+ //# debugId=BCEAEAADE97BBAB764756E2164756E21
214574
214602
  //# sourceMappingURL=index.js.map