@absolutejs/absolute 0.19.0-beta.930 → 0.19.0-beta.932

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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-IXTyqR/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-CoF2Qk/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-IXTyqR/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-CoF2Qk/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-IXTyqR/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-CoF2Qk/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
@@ -14028,16 +14028,22 @@ var setConventions = (map) => {
14028
14028
  };
14029
14029
  var isDev = () => true;
14030
14030
  var buildErrorProps = (error) => {
14031
- const message = error instanceof Error ? error.message : String(error);
14032
- const stack = isDev() && error instanceof Error ? error.stack : undefined;
14033
- return { error: { message, stack } };
14031
+ if (error instanceof Error) {
14032
+ return {
14033
+ name: error.name,
14034
+ message: error.message,
14035
+ ...isDev() && error.stack ? { stack: error.stack } : {}
14036
+ };
14037
+ }
14038
+ return { name: "Error", message: String(error) };
14034
14039
  };
14035
14040
  var renderReactError = async (conventionPath, errorProps) => {
14036
14041
  const { createElement } = await import("react");
14037
14042
  const { renderToReadableStream } = await import("react-dom/server");
14038
14043
  const mod = await import(conventionPath);
14039
- const [firstKey] = Object.keys(mod);
14040
- const ErrorComponent = mod.default ?? (firstKey ? mod[firstKey] : undefined);
14044
+ const ErrorComponent = mod.default;
14045
+ if (typeof ErrorComponent !== "function")
14046
+ return null;
14041
14047
  const element = createElement(ErrorComponent, errorProps);
14042
14048
  const stream = await renderToReadableStream(element);
14043
14049
  return new Response(stream, {
@@ -14049,6 +14055,8 @@ var renderSvelteError = async (conventionPath, errorProps) => {
14049
14055
  const { render } = await import("svelte/server");
14050
14056
  const mod = await import(conventionPath);
14051
14057
  const ErrorComponent = mod.default;
14058
+ if (!ErrorComponent)
14059
+ return null;
14052
14060
  const { head, body } = render(ErrorComponent, {
14053
14061
  props: errorProps
14054
14062
  });
@@ -14071,6 +14079,8 @@ var renderVueError = async (conventionPath, errorProps) => {
14071
14079
  const { renderToString } = await import("vue/server-renderer");
14072
14080
  const mod = await import(conventionPath);
14073
14081
  const ErrorComponent = mod.default;
14082
+ if (!ErrorComponent)
14083
+ return null;
14074
14084
  const app = createSSRApp({
14075
14085
  render: () => h(ErrorComponent, errorProps)
14076
14086
  });
@@ -14084,10 +14094,20 @@ var renderVueError = async (conventionPath, errorProps) => {
14084
14094
  };
14085
14095
  var renderAngularError = async (conventionPath, errorProps) => {
14086
14096
  const mod = await import(conventionPath);
14087
- const renderError = mod.default ?? mod.renderError;
14088
- if (typeof renderError !== "function")
14097
+ const renderFn = mod.default;
14098
+ if (typeof renderFn !== "function")
14089
14099
  return null;
14090
- const html = renderError(errorProps);
14100
+ const html = renderFn(errorProps);
14101
+ return new Response(html, {
14102
+ headers: { "Content-Type": "text/html" },
14103
+ status: 500
14104
+ });
14105
+ };
14106
+ var escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
14107
+ var replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : "");
14108
+ var renderHtmlError = async (conventionPath, errorProps) => {
14109
+ const template = await Bun.file(conventionPath).text();
14110
+ const html = replaceErrorTokens(template, errorProps);
14091
14111
  return new Response(html, {
14092
14112
  headers: { "Content-Type": "text/html" },
14093
14113
  status: 500
@@ -14106,11 +14126,12 @@ var renderEmberNotFound = async () => null;
14106
14126
  var ERROR_RENDERERS = {
14107
14127
  angular: renderAngularError,
14108
14128
  ember: renderEmberError,
14129
+ html: renderHtmlError,
14109
14130
  react: renderReactError,
14110
14131
  svelte: renderSvelteError,
14111
14132
  vue: renderVueError
14112
14133
  };
14113
- var renderConventionError = async (framework, pageName, error) => {
14134
+ var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
14114
14135
  let conventionPath = resolveErrorConventionPath(framework, pageName);
14115
14136
  if (!conventionPath && error instanceof Error && error.stack) {
14116
14137
  for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
@@ -14124,7 +14145,6 @@ var renderConventionError = async (framework, pageName, error) => {
14124
14145
  }
14125
14146
  if (!conventionPath)
14126
14147
  return null;
14127
- const errorProps = buildErrorProps(error);
14128
14148
  const renderer = ERROR_RENDERERS[framework];
14129
14149
  if (!renderer)
14130
14150
  return null;
@@ -14135,12 +14155,25 @@ var renderConventionError = async (framework, pageName, error) => {
14135
14155
  }
14136
14156
  return null;
14137
14157
  };
14158
+ var renderConventionError = async (framework, pageName, error) => {
14159
+ const errorProps = buildErrorProps(error);
14160
+ const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
14161
+ if (frameworkResponse)
14162
+ return frameworkResponse;
14163
+ if (framework !== "html") {
14164
+ const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
14165
+ if (htmlResponse)
14166
+ return htmlResponse;
14167
+ }
14168
+ return null;
14169
+ };
14138
14170
  var renderReactNotFound = async (conventionPath) => {
14139
14171
  const { createElement } = await import("react");
14140
14172
  const { renderToReadableStream } = await import("react-dom/server");
14141
14173
  const mod = await import(conventionPath);
14142
- const [nfKey] = Object.keys(mod);
14143
- const NotFoundComponent = mod.default ?? (nfKey ? mod[nfKey] : undefined);
14174
+ const NotFoundComponent = mod.default;
14175
+ if (typeof NotFoundComponent !== "function")
14176
+ return null;
14144
14177
  const element = createElement(NotFoundComponent);
14145
14178
  const stream = await renderToReadableStream(element);
14146
14179
  return new Response(stream, {
@@ -14152,6 +14185,8 @@ var renderSvelteNotFound = async (conventionPath) => {
14152
14185
  const { render } = await import("svelte/server");
14153
14186
  const mod = await import(conventionPath);
14154
14187
  const NotFoundComponent = mod.default;
14188
+ if (!NotFoundComponent)
14189
+ return null;
14155
14190
  const { head, body } = render(NotFoundComponent);
14156
14191
  const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
14157
14192
  return new Response(html, {
@@ -14164,6 +14199,8 @@ var renderVueNotFound = async (conventionPath) => {
14164
14199
  const { renderToString } = await import("vue/server-renderer");
14165
14200
  const mod = await import(conventionPath);
14166
14201
  const NotFoundComponent = mod.default;
14202
+ if (!NotFoundComponent)
14203
+ return null;
14167
14204
  const app = createSSRApp({
14168
14205
  render: () => h(NotFoundComponent)
14169
14206
  });
@@ -14177,10 +14214,17 @@ var renderVueNotFound = async (conventionPath) => {
14177
14214
  };
14178
14215
  var renderAngularNotFound = async (conventionPath) => {
14179
14216
  const mod = await import(conventionPath);
14180
- const renderNotFound = mod.default ?? mod.renderNotFound;
14181
- if (typeof renderNotFound !== "function")
14217
+ const renderFn = mod.default;
14218
+ if (typeof renderFn !== "function")
14182
14219
  return null;
14183
- const html = renderNotFound();
14220
+ const html = renderFn();
14221
+ return new Response(html, {
14222
+ headers: { "Content-Type": "text/html" },
14223
+ status: 404
14224
+ });
14225
+ };
14226
+ var renderHtmlNotFound = async (conventionPath) => {
14227
+ const html = await Bun.file(conventionPath).text();
14184
14228
  return new Response(html, {
14185
14229
  headers: { "Content-Type": "text/html" },
14186
14230
  status: 404
@@ -14189,6 +14233,7 @@ var renderAngularNotFound = async (conventionPath) => {
14189
14233
  var NOT_FOUND_RENDERERS = {
14190
14234
  angular: renderAngularNotFound,
14191
14235
  ember: renderEmberNotFound,
14236
+ html: renderHtmlNotFound,
14192
14237
  react: renderReactNotFound,
14193
14238
  svelte: renderSvelteNotFound,
14194
14239
  vue: renderVueNotFound
@@ -14211,7 +14256,8 @@ var NOT_FOUND_PRIORITY = [
14211
14256
  "react",
14212
14257
  "svelte",
14213
14258
  "vue",
14214
- "angular"
14259
+ "angular",
14260
+ "html"
14215
14261
  ];
14216
14262
  var renderFirstNotFound = async () => {
14217
14263
  const renderNext = async (frameworks) => {
@@ -14396,7 +14442,7 @@ var lowerAngularServerIslands = async (html) => {
14396
14442
  init_devRouteRegistrationCallsite();
14397
14443
 
14398
14444
  // src/angular/ssrSanitizer.ts
14399
- var escapeHtml = (str) => String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
14445
+ var escapeHtml2 = (str) => String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
14400
14446
  var bypassValue = (value) => ({
14401
14447
  changingThisBreaksApplicationSecurity: value
14402
14448
  });
@@ -14422,7 +14468,7 @@ var getSsrSanitizer = (deps) => {
14422
14468
  if (isTrustedHtml) {
14423
14469
  return strValue;
14424
14470
  }
14425
- return escapeHtml(strValue);
14471
+ return escapeHtml2(strValue);
14426
14472
  }
14427
14473
  return strValue;
14428
14474
  }
@@ -15143,5 +15189,5 @@ export {
15143
15189
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
15144
15190
  };
15145
15191
 
15146
- //# debugId=89D3B3ACE7ADB95364756E2164756E21
15192
+ //# debugId=C6BFB81ECADD55E764756E2164756E21
15147
15193
  //# sourceMappingURL=index.js.map