@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.
@@ -59,7 +59,10 @@ const installAngularHmrShim = (): AngularHmrBus => {
59
59
  try {
60
60
  cb(data);
61
61
  } catch (err) {
62
- console.error('[absolutejs] angular HMR listener threw', err);
62
+ console.error(
63
+ '[absolutejs] angular HMR listener threw',
64
+ err
65
+ );
63
66
  }
64
67
  }
65
68
  }
@@ -226,8 +226,8 @@ const copyInputsFromOldToNew = (
226
226
  newInstance: unknown
227
227
  ): void => {
228
228
  if (!oldInstance || !newInstance) return;
229
- const def = (newInstance as { constructor?: { ɵcmp?: unknown } }).constructor
230
- ?.ɵcmp as { inputs?: Record<string, unknown> } | undefined;
229
+ const def = (newInstance as { constructor?: { ɵcmp?: unknown } })
230
+ .constructor?.ɵcmp as { inputs?: Record<string, unknown> } | undefined;
231
231
  const inputs = def?.inputs;
232
232
  if (!inputs) return;
233
233
 
@@ -6,10 +6,7 @@ import type {} from '../../../types/globals';
6
6
  * else is generic, so the implementation is shared rather than baked
7
7
  * into every component bundle. */
8
8
 
9
- import {
10
- remountComponentClass,
11
- type RemountResult
12
- } from './angularRemount';
9
+ import { remountComponentClass, type RemountResult } from './angularRemount';
13
10
 
14
11
  declare global {
15
12
  // eslint-disable-next-line no-var
@@ -68,8 +68,10 @@ export const replaceLViewInTree = (
68
68
  break;
69
69
  }
70
70
  }
71
- if (parentLView[CHILD_HEAD] === oldLView) parentLView[CHILD_HEAD] = newLView;
72
- if (parentLView[CHILD_TAIL] === oldLView) parentLView[CHILD_TAIL] = newLView;
71
+ if (parentLView[CHILD_HEAD] === oldLView)
72
+ parentLView[CHILD_HEAD] = newLView;
73
+ if (parentLView[CHILD_TAIL] === oldLView)
74
+ parentLView[CHILD_TAIL] = newLView;
73
75
  newLView[NEXT] = oldLView[NEXT];
74
76
  oldLView[NEXT] = null;
75
77
  parentLView[index] = newLView;
@@ -105,7 +107,9 @@ export const executeOnDestroys = (tView: TView, lView: LView): void => {
105
107
  for (let j = 0; j < toCall.length; j += 2) {
106
108
  const propKey = toCall[j] as string;
107
109
  const hook = toCall[j + 1] as () => void;
108
- const callContext = (context as Record<string, unknown>)[propKey];
110
+ const callContext = (context as Record<string, unknown>)[
111
+ propKey
112
+ ];
109
113
  try {
110
114
  hook.call(callContext);
111
115
  } catch (err) {
@@ -170,9 +174,7 @@ export const processCleanups = (tView: TView, lView: LView): void => {
170
174
  lView[CLEANUP] = null;
171
175
  }
172
176
 
173
- const onDestroyHooks = lView[ON_DESTROY_HOOKS] as
174
- | Array<() => void>
175
- | null;
177
+ const onDestroyHooks = lView[ON_DESTROY_HOOKS] as Array<() => void> | null;
176
178
  if (onDestroyHooks !== null) {
177
179
  lView[ON_DESTROY_HOOKS] = null;
178
180
  for (const hook of onDestroyHooks) {
package/dist/index.js CHANGED
@@ -15006,6 +15006,7 @@ ${content.slice(firstUseIdx)}`;
15006
15006
  vueConventionResult,
15007
15007
  angularConventionResult,
15008
15008
  emberConventionResult,
15009
+ htmlConventionResult,
15009
15010
  allGlobalCssEntries
15010
15011
  ] = await Promise.all([
15011
15012
  tailwindPromise,
@@ -15016,6 +15017,7 @@ ${content.slice(firstUseIdx)}`;
15016
15017
  vuePagesPath ? tracePhase("scan/vue-conventions", () => scanConventions(vuePagesPath, "*.vue")) : emptyConventionResult,
15017
15018
  angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "*.ts")) : emptyConventionResult,
15018
15019
  emberPagesPath ? tracePhase("scan/ember-conventions", () => scanConventions(emberPagesPath, "*.{gjs,gts,ts}")) : emptyConventionResult,
15020
+ htmlPagesPath ? tracePhase("scan/html-conventions", () => scanConventions(htmlPagesPath, "*.html")) : emptyConventionResult,
15019
15021
  stylesDir ? tracePhase("scan/css", () => scanCssEntryPoints(stylesDir, stylesIgnore)) : []
15020
15022
  ]);
15021
15023
  const allSvelteEntries = svelteConventionResult.pageFiles;
@@ -15033,7 +15035,29 @@ ${content.slice(firstUseIdx)}`;
15033
15035
  conventionsMap.angular = angularConventionResult.conventions;
15034
15036
  if (emberConventionResult.conventions)
15035
15037
  conventionsMap.ember = emberConventionResult.conventions;
15036
- const notFoundFrameworks = ["react", "svelte", "vue", "angular", "ember"].filter((framework) => conventionsMap[framework]?.defaults?.notFound);
15038
+ if (htmlConventionResult.conventions && htmlDir && htmlPagesPath) {
15039
+ const outputHtmlPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmlDir), "pages");
15040
+ const remap = (sourcePath) => join26(outputHtmlPages, relative12(htmlPagesPath, sourcePath));
15041
+ const htmlConventions = htmlConventionResult.conventions;
15042
+ if (htmlConventions.defaults) {
15043
+ if (htmlConventions.defaults.error)
15044
+ htmlConventions.defaults.error = remap(htmlConventions.defaults.error);
15045
+ if (htmlConventions.defaults.notFound)
15046
+ htmlConventions.defaults.notFound = remap(htmlConventions.defaults.notFound);
15047
+ if (htmlConventions.defaults.loading)
15048
+ htmlConventions.defaults.loading = remap(htmlConventions.defaults.loading);
15049
+ }
15050
+ if (htmlConventions.pages) {
15051
+ for (const page of Object.values(htmlConventions.pages)) {
15052
+ if (page.error)
15053
+ page.error = remap(page.error);
15054
+ if (page.loading)
15055
+ page.loading = remap(page.loading);
15056
+ }
15057
+ }
15058
+ conventionsMap.html = htmlConventions;
15059
+ }
15060
+ const notFoundFrameworks = ["react", "svelte", "vue", "angular", "ember", "html"].filter((framework) => conventionsMap[framework]?.defaults?.notFound);
15037
15061
  if (notFoundFrameworks.length > 1) {
15038
15062
  logWarn(`Multiple frameworks define not-found convention files: ${notFoundFrameworks.join(", ")}. Only one will be used (priority: ${notFoundFrameworks[0]}). Remove not-found files from other frameworks to avoid ambiguity.`);
15039
15063
  }
@@ -18286,7 +18310,9 @@ class ExpressionTranslatorVisitor {
18286
18310
  return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
18287
18311
  }
18288
18312
  visitLocalizedString(ast, context) {
18289
- const elements = [createTemplateElement(ast.serializeI18nHead())];
18313
+ const elements = [
18314
+ createTemplateElement(ast.serializeI18nHead())
18315
+ ];
18290
18316
  const expressions = [];
18291
18317
  for (let i = 0;i < ast.expressions.length; i++) {
18292
18318
  const placeholder = this.setSourceMapRange(ast.expressions[i].visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
@@ -18294,7 +18320,10 @@ class ExpressionTranslatorVisitor {
18294
18320
  elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
18295
18321
  }
18296
18322
  const localizeTag = this.factory.createIdentifier("$localize");
18297
- return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, { elements, expressions }), ast.sourceSpan);
18323
+ return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, {
18324
+ elements,
18325
+ expressions
18326
+ }), ast.sourceSpan);
18298
18327
  }
18299
18328
  visitBuiltinType(ast) {
18300
18329
  let builtInType;
@@ -18351,7 +18380,10 @@ class ExpressionTranslatorVisitor {
18351
18380
  cooked.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.cooked), element.range));
18352
18381
  raw.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.raw), element.range));
18353
18382
  }
18354
- const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [this.factory.createArrayLiteral(cooked), this.factory.createArrayLiteral(raw)], false);
18383
+ const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [
18384
+ this.factory.createArrayLiteral(cooked),
18385
+ this.factory.createArrayLiteral(raw)
18386
+ ], false);
18355
18387
  return this.factory.createCallExpression(tagHandler, [templateHelperCall, ...expressions], false);
18356
18388
  }
18357
18389
  visitExternalExpr(ast, _context) {
@@ -18381,7 +18413,9 @@ class ExpressionTranslatorVisitor {
18381
18413
  visitDynamicImportExpr(ast, context) {
18382
18414
  const urlExpression = typeof ast.url === "string" ? this.factory.createLiteral(ast.url) : ast.url.visitExpression(this, context);
18383
18415
  if (ast.urlComment) {
18384
- this.factory.attachComments(urlExpression, [o.leadingComment(ast.urlComment, true)]);
18416
+ this.factory.attachComments(urlExpression, [
18417
+ o.leadingComment(ast.urlComment, true)
18418
+ ]);
18385
18419
  }
18386
18420
  return this.factory.createDynamicImport(urlExpression);
18387
18421
  }
@@ -18665,7 +18699,9 @@ class TypeScriptAstFactory {
18665
18699
  createElementAccess = ts6.factory.createElementAccessExpression;
18666
18700
  createExpressionStatement = ts6.factory.createExpressionStatement;
18667
18701
  createDynamicImport(url) {
18668
- return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [typeof url === "string" ? ts6.factory.createStringLiteral(url) : url]);
18702
+ return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [
18703
+ typeof url === "string" ? ts6.factory.createStringLiteral(url) : url
18704
+ ]);
18669
18705
  }
18670
18706
  createFunctionDeclaration(functionName, parameters, body) {
18671
18707
  if (!ts6.isBlock(body)) {
@@ -19688,7 +19724,10 @@ var fail = (reason, detail, location) => ({
19688
19724
  try {
19689
19725
  source = readFileSync20(filePath, "utf-8");
19690
19726
  } catch {
19691
- childComponentInfoCache.set(cacheKey2, { info: null, mtimeMs: stat3.mtimeMs });
19727
+ childComponentInfoCache.set(cacheKey2, {
19728
+ info: null,
19729
+ mtimeMs: stat3.mtimeMs
19730
+ });
19692
19731
  return null;
19693
19732
  }
19694
19733
  const sf = ts7.createSourceFile(filePath, source, ts7.ScriptTarget.Latest, true);
@@ -20451,12 +20490,7 @@ ${block}
20451
20490
  if (!className_)
20452
20491
  return fail("class-not-found", "anonymous class");
20453
20492
  const wrappedClass = new compiler.WrappedNodeExpr(className_);
20454
- const {
20455
- inputs,
20456
- outputs,
20457
- hasDecoratorIO,
20458
- hasSignalIO
20459
- } = extractInputsAndOutputs(classNode, compiler);
20493
+ const { inputs, outputs, hasDecoratorIO, hasSignalIO } = extractInputsAndOutputs(classNode, compiler);
20460
20494
  const projectRelPath = relative14(projectRoot, componentFilePath).replace(/\\/g, "/");
20461
20495
  const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
20462
20496
  const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
@@ -20660,11 +20694,7 @@ var init_fastHmrCompiler = __esm(() => {
20660
20694
  fingerprintCache = new Map;
20661
20695
  pendingModuleCache = new Map;
20662
20696
  entityFingerprintCache = new Map;
20663
- ENTITY_DECORATOR_NAMES = new Set([
20664
- "Pipe",
20665
- "Directive",
20666
- "Injectable"
20667
- ]);
20697
+ ENTITY_DECORATOR_NAMES = new Set(["Pipe", "Directive", "Injectable"]);
20668
20698
  VIEW_ENCAPSULATION_VALUES = {
20669
20699
  Emulated: 0,
20670
20700
  ExperimentalIsolatedShadowDom: 4,
@@ -24845,16 +24875,22 @@ var setConventions = (map) => {
24845
24875
  };
24846
24876
  var isDev = () => true;
24847
24877
  var buildErrorProps = (error) => {
24848
- const message = error instanceof Error ? error.message : String(error);
24849
- const stack = isDev() && error instanceof Error ? error.stack : undefined;
24850
- return { error: { message, stack } };
24878
+ if (error instanceof Error) {
24879
+ return {
24880
+ name: error.name,
24881
+ message: error.message,
24882
+ ...isDev() && error.stack ? { stack: error.stack } : {}
24883
+ };
24884
+ }
24885
+ return { name: "Error", message: String(error) };
24851
24886
  };
24852
24887
  var renderReactError = async (conventionPath, errorProps) => {
24853
24888
  const { createElement } = await import("react");
24854
24889
  const { renderToReadableStream } = await import("react-dom/server");
24855
24890
  const mod = await import(conventionPath);
24856
- const [firstKey] = Object.keys(mod);
24857
- const ErrorComponent = mod.default ?? (firstKey ? mod[firstKey] : undefined);
24891
+ const ErrorComponent = mod.default;
24892
+ if (typeof ErrorComponent !== "function")
24893
+ return null;
24858
24894
  const element = createElement(ErrorComponent, errorProps);
24859
24895
  const stream = await renderToReadableStream(element);
24860
24896
  return new Response(stream, {
@@ -24866,6 +24902,8 @@ var renderSvelteError = async (conventionPath, errorProps) => {
24866
24902
  const { render } = await import("svelte/server");
24867
24903
  const mod = await import(conventionPath);
24868
24904
  const ErrorComponent = mod.default;
24905
+ if (!ErrorComponent)
24906
+ return null;
24869
24907
  const { head, body } = render(ErrorComponent, {
24870
24908
  props: errorProps
24871
24909
  });
@@ -24888,6 +24926,8 @@ var renderVueError = async (conventionPath, errorProps) => {
24888
24926
  const { renderToString } = await import("vue/server-renderer");
24889
24927
  const mod = await import(conventionPath);
24890
24928
  const ErrorComponent = mod.default;
24929
+ if (!ErrorComponent)
24930
+ return null;
24891
24931
  const app = createSSRApp({
24892
24932
  render: () => h2(ErrorComponent, errorProps)
24893
24933
  });
@@ -24901,10 +24941,20 @@ var renderVueError = async (conventionPath, errorProps) => {
24901
24941
  };
24902
24942
  var renderAngularError = async (conventionPath, errorProps) => {
24903
24943
  const mod = await import(conventionPath);
24904
- const renderError = mod.default ?? mod.renderError;
24905
- if (typeof renderError !== "function")
24944
+ const renderFn = mod.default;
24945
+ if (typeof renderFn !== "function")
24906
24946
  return null;
24907
- const html = renderError(errorProps);
24947
+ const html = renderFn(errorProps);
24948
+ return new Response(html, {
24949
+ headers: { "Content-Type": "text/html" },
24950
+ status: 500
24951
+ });
24952
+ };
24953
+ var escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
24954
+ 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) : "");
24955
+ var renderHtmlError = async (conventionPath, errorProps) => {
24956
+ const template = await Bun.file(conventionPath).text();
24957
+ const html = replaceErrorTokens(template, errorProps);
24908
24958
  return new Response(html, {
24909
24959
  headers: { "Content-Type": "text/html" },
24910
24960
  status: 500
@@ -24923,11 +24973,12 @@ var renderEmberNotFound = async () => null;
24923
24973
  var ERROR_RENDERERS = {
24924
24974
  angular: renderAngularError,
24925
24975
  ember: renderEmberError,
24976
+ html: renderHtmlError,
24926
24977
  react: renderReactError,
24927
24978
  svelte: renderSvelteError,
24928
24979
  vue: renderVueError
24929
24980
  };
24930
- var renderConventionError = async (framework, pageName, error) => {
24981
+ var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
24931
24982
  let conventionPath = resolveErrorConventionPath(framework, pageName);
24932
24983
  if (!conventionPath && error instanceof Error && error.stack) {
24933
24984
  for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
@@ -24941,7 +24992,6 @@ var renderConventionError = async (framework, pageName, error) => {
24941
24992
  }
24942
24993
  if (!conventionPath)
24943
24994
  return null;
24944
- const errorProps = buildErrorProps(error);
24945
24995
  const renderer = ERROR_RENDERERS[framework];
24946
24996
  if (!renderer)
24947
24997
  return null;
@@ -24952,12 +25002,25 @@ var renderConventionError = async (framework, pageName, error) => {
24952
25002
  }
24953
25003
  return null;
24954
25004
  };
25005
+ var renderConventionError = async (framework, pageName, error) => {
25006
+ const errorProps = buildErrorProps(error);
25007
+ const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
25008
+ if (frameworkResponse)
25009
+ return frameworkResponse;
25010
+ if (framework !== "html") {
25011
+ const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
25012
+ if (htmlResponse)
25013
+ return htmlResponse;
25014
+ }
25015
+ return null;
25016
+ };
24955
25017
  var renderReactNotFound = async (conventionPath) => {
24956
25018
  const { createElement } = await import("react");
24957
25019
  const { renderToReadableStream } = await import("react-dom/server");
24958
25020
  const mod = await import(conventionPath);
24959
- const [nfKey] = Object.keys(mod);
24960
- const NotFoundComponent = mod.default ?? (nfKey ? mod[nfKey] : undefined);
25021
+ const NotFoundComponent = mod.default;
25022
+ if (typeof NotFoundComponent !== "function")
25023
+ return null;
24961
25024
  const element = createElement(NotFoundComponent);
24962
25025
  const stream = await renderToReadableStream(element);
24963
25026
  return new Response(stream, {
@@ -24969,6 +25032,8 @@ var renderSvelteNotFound = async (conventionPath) => {
24969
25032
  const { render } = await import("svelte/server");
24970
25033
  const mod = await import(conventionPath);
24971
25034
  const NotFoundComponent = mod.default;
25035
+ if (!NotFoundComponent)
25036
+ return null;
24972
25037
  const { head, body } = render(NotFoundComponent);
24973
25038
  const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
24974
25039
  return new Response(html, {
@@ -24981,6 +25046,8 @@ var renderVueNotFound = async (conventionPath) => {
24981
25046
  const { renderToString } = await import("vue/server-renderer");
24982
25047
  const mod = await import(conventionPath);
24983
25048
  const NotFoundComponent = mod.default;
25049
+ if (!NotFoundComponent)
25050
+ return null;
24984
25051
  const app = createSSRApp({
24985
25052
  render: () => h2(NotFoundComponent)
24986
25053
  });
@@ -24994,10 +25061,17 @@ var renderVueNotFound = async (conventionPath) => {
24994
25061
  };
24995
25062
  var renderAngularNotFound = async (conventionPath) => {
24996
25063
  const mod = await import(conventionPath);
24997
- const renderNotFound = mod.default ?? mod.renderNotFound;
24998
- if (typeof renderNotFound !== "function")
25064
+ const renderFn = mod.default;
25065
+ if (typeof renderFn !== "function")
24999
25066
  return null;
25000
- const html = renderNotFound();
25067
+ const html = renderFn();
25068
+ return new Response(html, {
25069
+ headers: { "Content-Type": "text/html" },
25070
+ status: 404
25071
+ });
25072
+ };
25073
+ var renderHtmlNotFound = async (conventionPath) => {
25074
+ const html = await Bun.file(conventionPath).text();
25001
25075
  return new Response(html, {
25002
25076
  headers: { "Content-Type": "text/html" },
25003
25077
  status: 404
@@ -25006,6 +25080,7 @@ var renderAngularNotFound = async (conventionPath) => {
25006
25080
  var NOT_FOUND_RENDERERS = {
25007
25081
  angular: renderAngularNotFound,
25008
25082
  ember: renderEmberNotFound,
25083
+ html: renderHtmlNotFound,
25009
25084
  react: renderReactNotFound,
25010
25085
  svelte: renderSvelteNotFound,
25011
25086
  vue: renderVueNotFound
@@ -25028,7 +25103,8 @@ var NOT_FOUND_PRIORITY = [
25028
25103
  "react",
25029
25104
  "svelte",
25030
25105
  "vue",
25031
- "angular"
25106
+ "angular",
25107
+ "html"
25032
25108
  ];
25033
25109
  var renderFirstNotFound = async () => {
25034
25110
  const renderNext = async (frameworks2) => {
@@ -25558,6 +25634,9 @@ var pageRouterPlugin = () => {
25558
25634
  init_devtoolsJson();
25559
25635
  // src/utils/defineConfig.ts
25560
25636
  var defineConfig = (config) => config;
25637
+ // src/utils/defineConvention.ts
25638
+ var defineRenderErrorPage = (fn2) => fn2;
25639
+ var defineRenderNotFoundPage = (fn2) => fn2;
25561
25640
  // src/utils/generateHeadElement.ts
25562
25641
  var renderRobotsContent = (robots) => {
25563
25642
  const directives = [];
@@ -31888,6 +31967,8 @@ export {
31888
31967
  enhanceHtmlResponseWithStreamingSlots,
31889
31968
  disposeTailwindCompiler,
31890
31969
  devtoolsJson,
31970
+ defineRenderNotFoundPage,
31971
+ defineRenderErrorPage,
31891
31972
  defineIslandRegistry,
31892
31973
  defineIslandComponent,
31893
31974
  defineEnv,
@@ -31981,5 +32062,5 @@ export {
31981
32062
  ANGULAR_INIT_TIMEOUT_MS
31982
32063
  };
31983
32064
 
31984
- //# debugId=A2D4D12BDB3411EB64756E2164756E21
32065
+ //# debugId=1D5D4C42226608CC64756E2164756E21
31985
32066
  //# sourceMappingURL=index.js.map