@absolutejs/absolute 0.19.0-beta.449 → 0.19.0-beta.450

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
@@ -171190,10 +171190,7 @@ var init_islandEntries = __esm(() => {
171190
171190
  });
171191
171191
 
171192
171192
  // src/core/staticStreaming.ts
171193
- import { statSync } from "fs";
171194
- import { extname as extname3 } from "path";
171195
- import { pathToFileURL } from "url";
171196
- var defineStaticStreamingSlots = (slots) => slots, STATIC_SLOT_TAG_RE, ATTRIBUTE_RE, parseAttributes = (attributeString) => {
171193
+ var STATIC_SLOT_TAG_RE, ATTRIBUTE_RE, parseAttributes = (attributeString) => {
171197
171194
  const attributes = new Map;
171198
171195
  let match = ATTRIBUTE_RE.exec(attributeString);
171199
171196
  while (match) {
@@ -171237,65 +171234,10 @@ var defineStaticStreamingSlots = (slots) => slots, STATIC_SLOT_TAG_RE, ATTRIBUTE
171237
171234
  match = tagRe.exec(html);
171238
171235
  }
171239
171236
  return tags;
171240
- }, toStaticStreamingSlotDefinition = (value) => typeof value === "function" ? { resolve: value } : value, isObjectRecord = (value) => typeof value === "object" && value !== null, isStaticStreamingSlotDefinitions = (value) => isObjectRecord(value), resolveStaticStreamingDefinitions = (moduleExports) => {
171241
- const candidate = isStaticStreamingSlotDefinitions(moduleExports.streamingSlots) ? moduleExports.streamingSlots : isStaticStreamingSlotDefinitions(moduleExports.default) ? moduleExports.default : null;
171242
- return candidate;
171243
- }, serverModuleExtensions, resolveSidecarCandidates = (pagePath) => {
171244
- const pageExt = extname3(pagePath);
171245
- if (!pageExt)
171246
- return [];
171247
- const pageStem = pagePath.slice(0, -pageExt.length);
171248
- return serverModuleExtensions.map((extension) => `${pageStem}${extension}`);
171249
- }, fileExists = async (path) => await Bun.file(path).exists(), loadStaticStreamingModule = async (pagePath) => {
171250
- for (const candidate of resolveSidecarCandidates(pagePath)) {
171251
- if (!await fileExists(candidate))
171252
- continue;
171253
- const version = statSync(candidate).mtimeMs;
171254
- const moduleUrl = new URL(pathToFileURL(candidate).href);
171255
- moduleUrl.searchParams.set("t", String(version));
171256
- const moduleExports = await import(moduleUrl.href);
171257
- const definitions = resolveStaticStreamingDefinitions(moduleExports);
171258
- if (!definitions) {
171259
- throw new Error(`Static streaming module "${candidate}" must export a default value or named "streamingSlots" object.`);
171260
- }
171261
- return definitions;
171262
- }
171263
- return null;
171264
- }, loadStaticStreamingSlots = async (pagePath, html) => {
171265
- const tagDefinitions = extractStaticStreamingTags(html);
171266
- if (tagDefinitions.length === 0) {
171267
- return [];
171268
- }
171269
- const definitions = await loadStaticStreamingModule(pagePath);
171270
- if (!definitions) {
171271
- throw new Error(`Static page "${pagePath}" uses <abs-stream-slot> but no page-adjacent server module was found. Create a sibling ".server.ts" file that exports defineStaticStreamingSlots({...}).`);
171272
- }
171273
- return tagDefinitions.map((tag) => {
171274
- const entry = definitions[tag.resolver];
171275
- if (!entry) {
171276
- throw new Error(`Static streaming resolver "${tag.resolver}" was not found for "${pagePath}".`);
171277
- }
171278
- const definition = toStaticStreamingSlotDefinition(entry);
171279
- return {
171280
- errorHtml: tag.errorHtml ?? definition.errorHtml,
171281
- fallbackHtml: tag.fallbackHtml,
171282
- id: tag.id,
171283
- resolve: definition.resolve,
171284
- timeoutMs: tag.timeoutMs ?? definition.timeoutMs
171285
- };
171286
- });
171287
171237
  };
171288
171238
  var init_staticStreaming = __esm(() => {
171289
171239
  STATIC_SLOT_TAG_RE = /<abs-stream-slot\b([^>]*?)(?:\/>|>([\s\S]*?)<\/abs-stream-slot>)/gi;
171290
171240
  ATTRIBUTE_RE = /([A-Za-z_:][-A-Za-z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
171291
- serverModuleExtensions = [
171292
- ".server.ts",
171293
- ".server.js",
171294
- ".server.mjs",
171295
- ".slots.ts",
171296
- ".slots.js",
171297
- ".slots.mjs"
171298
- ];
171299
171241
  });
171300
171242
 
171301
171243
  // src/build/staticIslandPages.ts
@@ -171775,7 +171717,7 @@ var exports_generateManifest = {};
171775
171717
  __export(exports_generateManifest, {
171776
171718
  generateManifest: () => generateManifest
171777
171719
  });
171778
- import { extname as extname4 } from "path";
171720
+ import { extname as extname3 } from "path";
171779
171721
  var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isSvelte, isAngular) => {
171780
171722
  if (folder === "indexes")
171781
171723
  return `${pascalName}Index`;
@@ -171811,7 +171753,7 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
171811
171753
  if (!baseName)
171812
171754
  return manifest;
171813
171755
  const pascalName = toPascal(baseName);
171814
- const ext = extname4(fileWithHash);
171756
+ const ext = extname3(fileWithHash);
171815
171757
  const islandIndex = segments.findIndex((seg) => seg === "islands");
171816
171758
  if (ext === ".css") {
171817
171759
  const cssKey = getCssKey(pascalName, segments);
@@ -173105,7 +173047,7 @@ import {
173105
173047
  dirname as dirname7,
173106
173048
  join as join11,
173107
173049
  basename as basename5,
173108
- extname as extname5,
173050
+ extname as extname4,
173109
173051
  resolve as resolve16,
173110
173052
  relative as relative6,
173111
173053
  sep as sep2
@@ -173346,7 +173288,7 @@ var resolveDevClientDir2 = () => {
173346
173288
  const roots = await Promise.all(entryPoints.map(build2));
173347
173289
  await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
173348
173290
  const relClientDir = dirname7(relative6(clientDir, client2));
173349
- const name = basename5(client2, extname5(client2));
173291
+ const name = basename5(client2, extname4(client2));
173350
173292
  const indexPath = join11(indexDir, relClientDir, `${name}.js`);
173351
173293
  const importRaw = relative6(dirname7(indexPath), client2).split(sep2).join("/");
173352
173294
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
@@ -175091,7 +175033,7 @@ import {
175091
175033
  mkdirSync as mkdirSync10,
175092
175034
  readFileSync as readFileSync10,
175093
175035
  rmSync as rmSync2,
175094
- statSync as statSync2,
175036
+ statSync,
175095
175037
  writeFileSync as writeFileSync7
175096
175038
  } from "fs";
175097
175039
  import { basename as basename8, dirname as dirname10, join as join18, relative as relative9, resolve as resolve19 } from "path";
@@ -175197,7 +175139,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
175197
175139
  }, SKIP_DIRS, addWorkerPathIfExists = (file4, relPath, workerPaths) => {
175198
175140
  const absPath = resolve19(file4, "..", relPath);
175199
175141
  try {
175200
- statSync2(absPath);
175142
+ statSync(absPath);
175201
175143
  workerPaths.add(absPath);
175202
175144
  } catch {}
175203
175145
  }, collectWorkerPathsFromContent = (content, pattern, file4, workerPaths) => {
@@ -175361,7 +175303,7 @@ ${content.slice(firstUseIdx)}`;
175361
175303
  for (const srcPath of urlReferencedFiles) {
175362
175304
  const rel = relative9(projectRoot, srcPath).replace(/\\/g, "/");
175363
175305
  const name = basename8(srcPath);
175364
- const mtime = Math.round(statSync2(srcPath).mtimeMs);
175306
+ const mtime = Math.round(statSync(srcPath).mtimeMs);
175365
175307
  const url = `/@src/${rel}?v=${mtime}`;
175366
175308
  urlFileMap.set(name, url);
175367
175309
  urlFileMap.set(name.replace(/\.tsx?$/, ".js"), url);
@@ -177531,8 +177473,8 @@ __export(exports_moduleServer, {
177531
177473
  createModuleServer: () => createModuleServer,
177532
177474
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
177533
177475
  });
177534
- import { existsSync as existsSync19, readFileSync as readFileSync13, statSync as statSync3 } from "fs";
177535
- import { basename as basename12, dirname as dirname12, extname as extname6, resolve as resolve26, relative as relative10 } from "path";
177476
+ import { existsSync as existsSync19, readFileSync as readFileSync13, statSync as statSync2 } from "fs";
177477
+ import { basename as basename12, dirname as dirname12, extname as extname5, resolve as resolve26, relative as relative10 } from "path";
177536
177478
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
177537
177479
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
177538
177480
  const allExports = [];
@@ -177572,7 +177514,7 @@ ${stubs}
177572
177514
  if (cached !== undefined)
177573
177515
  return `${base}?v=${buildVersion(cached, absPath)}`;
177574
177516
  try {
177575
- const mtime = Math.round(statSync3(absPath).mtimeMs);
177517
+ const mtime = Math.round(statSync2(absPath).mtimeMs);
177576
177518
  mtimeCache.set(absPath, mtime);
177577
177519
  return `${base}?v=${buildVersion(mtime, absPath)}`;
177578
177520
  } catch {
@@ -177581,9 +177523,9 @@ ${stubs}
177581
177523
  }, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
177582
177524
  const absPath = resolve26(fileDir, relPath);
177583
177525
  const rel = relative10(projectRoot, absPath);
177584
- const extension = extname6(rel);
177526
+ const extension = extname5(rel);
177585
177527
  let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
177586
- if (extname6(srcPath) === ".svelte") {
177528
+ if (extname5(srcPath) === ".svelte") {
177587
177529
  srcPath = relative10(projectRoot, resolveSvelteModulePath(resolve26(projectRoot, srcPath)));
177588
177530
  }
177589
177531
  return srcUrl(srcPath, projectRoot);
@@ -177684,7 +177626,7 @@ ${transpiled}`;
177684
177626
  return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
177685
177627
  }, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
177686
177628
  const raw = readFileSync13(filePath, "utf-8");
177687
- const ext = extname6(filePath);
177629
+ const ext = extname5(filePath);
177688
177630
  const isTS = ext === ".ts" || ext === ".tsx";
177689
177631
  const isTSX = ext === ".tsx" || ext === ".jsx";
177690
177632
  let transpiler4 = jsTranspiler2;
@@ -178074,7 +178016,7 @@ export default {};
178074
178016
  return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
178075
178017
  }, resolveSourcePath = (relPath, projectRoot) => {
178076
178018
  const filePath = resolve26(projectRoot, relPath);
178077
- const ext = extname6(filePath);
178019
+ const ext = extname5(filePath);
178078
178020
  if (ext === ".svelte")
178079
178021
  return { ext, filePath: resolveSvelteModulePath(filePath) };
178080
178022
  if (ext)
@@ -178099,18 +178041,18 @@ export default {};
178099
178041
  return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir);
178100
178042
  if (!TRANSPILABLE.has(ext))
178101
178043
  return;
178102
- const stat2 = statSync3(filePath);
178044
+ const stat2 = statSync2(filePath);
178103
178045
  const resolvedVueDir = vueDir ? resolve26(vueDir) : undefined;
178104
178046
  const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
178105
178047
  setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
178106
178048
  return jsResponse(content);
178107
178049
  }, transformAndCacheSvelte = async (filePath, projectRoot, rewriter) => {
178108
- const stat2 = statSync3(filePath);
178050
+ const stat2 = statSync2(filePath);
178109
178051
  const content = await transformSvelteFile(filePath, projectRoot, rewriter);
178110
178052
  setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
178111
178053
  return jsResponse(content);
178112
178054
  }, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir) => {
178113
- const stat2 = statSync3(filePath);
178055
+ const stat2 = statSync2(filePath);
178114
178056
  const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir);
178115
178057
  setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
178116
178058
  return jsResponse(content);
@@ -179946,7 +179888,7 @@ __export(exports_devBuild, {
179946
179888
  devBuild: () => devBuild
179947
179889
  });
179948
179890
  import { readdir as readdir5 } from "fs/promises";
179949
- import { statSync as statSync4 } from "fs";
179891
+ import { statSync as statSync3 } from "fs";
179950
179892
  import { resolve as resolve30 } from "path";
179951
179893
  var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
179952
179894
  const config = {};
@@ -180040,7 +179982,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
180040
179982
  state.fileChangeQueue.clear();
180041
179983
  }
180042
179984
  }, handleCachedReload = async () => {
180043
- const serverMtime = statSync4(resolve30(Bun.main)).mtimeMs;
179985
+ const serverMtime = statSync3(resolve30(Bun.main)).mtimeMs;
180044
179986
  const lastMtime = globalThis.__hmrServerMtime;
180045
179987
  globalThis.__hmrServerMtime = serverMtime;
180046
179988
  const cached = globalThis.__hmrDevResult;
@@ -180193,7 +180135,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
180193
180135
  manifest
180194
180136
  };
180195
180137
  globalThis.__hmrDevResult = result;
180196
- globalThis.__hmrServerMtime = statSync4(resolve30(Bun.main)).mtimeMs;
180138
+ globalThis.__hmrServerMtime = statSync3(resolve30(Bun.main)).mtimeMs;
180197
180139
  return result;
180198
180140
  };
180199
180141
  var init_devBuild = __esm(() => {
@@ -181350,19 +181292,25 @@ init_staticStreaming();
181350
181292
  var {file } = globalThis.Bun;
181351
181293
  var handleStaticPageRequest = async (pagePath, options = {}, settings = {}) => {
181352
181294
  const html = await file(pagePath).text();
181353
- const discoveredStreamingSlots = settings.enableStaticStreaming === false ? [] : await loadStaticStreamingSlots(pagePath, html);
181354
181295
  const transformedHtml = await transformCurrentStaticPageHtml(html, settings);
181355
181296
  return withStreamingSlots(new Response(injectIslandPageContext(transformedHtml), {
181356
181297
  headers: { "Content-Type": "text/html" }
181357
181298
  }), {
181358
181299
  ...options,
181359
- streamingSlots: [
181360
- ...discoveredStreamingSlots,
181361
- ...options.streamingSlots ?? []
181362
- ]
181300
+ streamingSlots: options.streamingSlots ?? []
181301
+ });
181302
+ };
181303
+ var handleHTMLPageRequest = (pagePath, options) => {
181304
+ const htmlFile = file(pagePath);
181305
+ return htmlFile.text().then((html) => {
181306
+ if (extractStaticStreamingTags(html).length > 0) {
181307
+ throw new Error(`HTML page "${pagePath}" uses <abs-stream-slot>, but HTML pages should pass explicit streamingSlots to handleHTMLPageRequest(...).`);
181308
+ }
181309
+ return handleStaticPageRequest(pagePath, options, {
181310
+ enableStaticStreaming: false
181311
+ });
181363
181312
  });
181364
181313
  };
181365
- var handleHTMLPageRequest = (pagePath, options) => handleStaticPageRequest(pagePath, options, { enableStaticStreaming: true });
181366
181314
  var handleHTMXPageRequest = async (pagePath) => {
181367
181315
  const html = await file(pagePath).text();
181368
181316
  if (extractStaticStreamingTags(html).length > 0) {
@@ -181646,7 +181594,6 @@ var prepare = async (configOrPath) => {
181646
181594
 
181647
181595
  // src/core/index.ts
181648
181596
  init_renderIslandMarkup();
181649
- init_staticStreaming();
181650
181597
  // src/plugins/networking.ts
181651
181598
  init_constants();
181652
181599
  import { argv } from "process";
@@ -188030,7 +187977,6 @@ export {
188030
187977
  pageRouterPlugin,
188031
187978
  normalizeDevtoolsWorkspaceRoot,
188032
187979
  networking,
188033
- loadStaticStreamingSlots,
188034
187980
  jsonLd2 as jsonLd,
188035
187981
  isValidHMRClientMessage,
188036
187982
  isValidAIServerMessage,
@@ -188056,10 +188002,8 @@ export {
188056
188002
  getAllNetworkIPs,
188057
188003
  generateHeadElement,
188058
188004
  generateClientScriptCode,
188059
- extractStaticStreamingTags,
188060
188005
  enhanceHtmlResponseWithStreamingSlots,
188061
188006
  devtoolsJson,
188062
- defineStaticStreamingSlots,
188063
188007
  defineIslandRegistry,
188064
188008
  defineIslandComponent,
188065
188009
  defineEnv,
@@ -188120,5 +188064,5 @@ export {
188120
188064
  ANGULAR_INIT_TIMEOUT_MS
188121
188065
  };
188122
188066
 
188123
- //# debugId=5AE2D9A956DA079764756E2164756E21
188067
+ //# debugId=10D3170AD3864C0F64756E2164756E21
188124
188068
  //# sourceMappingURL=index.js.map