@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.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +65 -19
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +65 -19
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +49 -19
- package/dist/build.js.map +14 -14
- package/dist/dev/client/handlers/angularHmrShim.ts +4 -1
- package/dist/dev/client/handlers/angularRemount.ts +2 -2
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -4
- package/dist/dev/client/vendor/lview/lViewOps.ts +8 -6
- package/dist/index.js +116 -35
- package/dist/index.js.map +19 -18
- package/dist/islands/index.js.map +2 -2
- package/dist/react/index.js +63 -17
- package/dist/react/index.js.map +4 -4
- package/dist/react/server.js +63 -17
- package/dist/react/server.js.map +3 -3
- package/dist/src/utils/defineConvention.d.ts +3 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/svelte/index.js +63 -17
- package/dist/svelte/index.js.map +4 -4
- package/dist/svelte/server.js +63 -17
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/conventions.d.ts +5 -0
- package/dist/vue/index.js +63 -17
- package/dist/vue/index.js.map +4 -4
- package/dist/vue/server.js +63 -17
- package/dist/vue/server.js.map +3 -3
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -3415,16 +3415,22 @@ var setConventions = (map) => {
|
|
|
3415
3415
|
};
|
|
3416
3416
|
var isDev = () => true;
|
|
3417
3417
|
var buildErrorProps = (error) => {
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3418
|
+
if (error instanceof Error) {
|
|
3419
|
+
return {
|
|
3420
|
+
name: error.name,
|
|
3421
|
+
message: error.message,
|
|
3422
|
+
...isDev() && error.stack ? { stack: error.stack } : {}
|
|
3423
|
+
};
|
|
3424
|
+
}
|
|
3425
|
+
return { name: "Error", message: String(error) };
|
|
3421
3426
|
};
|
|
3422
3427
|
var renderReactError = async (conventionPath, errorProps) => {
|
|
3423
3428
|
const { createElement } = await import("react");
|
|
3424
3429
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
3425
3430
|
const mod = await import(conventionPath);
|
|
3426
|
-
const
|
|
3427
|
-
|
|
3431
|
+
const ErrorComponent = mod.default;
|
|
3432
|
+
if (typeof ErrorComponent !== "function")
|
|
3433
|
+
return null;
|
|
3428
3434
|
const element = createElement(ErrorComponent, errorProps);
|
|
3429
3435
|
const stream = await renderToReadableStream(element);
|
|
3430
3436
|
return new Response(stream, {
|
|
@@ -3436,6 +3442,8 @@ var renderSvelteError = async (conventionPath, errorProps) => {
|
|
|
3436
3442
|
const { render } = await import("svelte/server");
|
|
3437
3443
|
const mod = await import(conventionPath);
|
|
3438
3444
|
const ErrorComponent = mod.default;
|
|
3445
|
+
if (!ErrorComponent)
|
|
3446
|
+
return null;
|
|
3439
3447
|
const { head, body } = render(ErrorComponent, {
|
|
3440
3448
|
props: errorProps
|
|
3441
3449
|
});
|
|
@@ -3458,6 +3466,8 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
3458
3466
|
const { renderToString } = await import("vue/server-renderer");
|
|
3459
3467
|
const mod = await import(conventionPath);
|
|
3460
3468
|
const ErrorComponent = mod.default;
|
|
3469
|
+
if (!ErrorComponent)
|
|
3470
|
+
return null;
|
|
3461
3471
|
const app = createSSRApp({
|
|
3462
3472
|
render: () => h(ErrorComponent, errorProps)
|
|
3463
3473
|
});
|
|
@@ -3471,10 +3481,20 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
3471
3481
|
};
|
|
3472
3482
|
var renderAngularError = async (conventionPath, errorProps) => {
|
|
3473
3483
|
const mod = await import(conventionPath);
|
|
3474
|
-
const
|
|
3475
|
-
if (typeof
|
|
3484
|
+
const renderFn = mod.default;
|
|
3485
|
+
if (typeof renderFn !== "function")
|
|
3476
3486
|
return null;
|
|
3477
|
-
const html =
|
|
3487
|
+
const html = renderFn(errorProps);
|
|
3488
|
+
return new Response(html, {
|
|
3489
|
+
headers: { "Content-Type": "text/html" },
|
|
3490
|
+
status: 500
|
|
3491
|
+
});
|
|
3492
|
+
};
|
|
3493
|
+
var escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3494
|
+
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) : "");
|
|
3495
|
+
var renderHtmlError = async (conventionPath, errorProps) => {
|
|
3496
|
+
const template = await Bun.file(conventionPath).text();
|
|
3497
|
+
const html = replaceErrorTokens(template, errorProps);
|
|
3478
3498
|
return new Response(html, {
|
|
3479
3499
|
headers: { "Content-Type": "text/html" },
|
|
3480
3500
|
status: 500
|
|
@@ -3493,11 +3513,12 @@ var renderEmberNotFound = async () => null;
|
|
|
3493
3513
|
var ERROR_RENDERERS = {
|
|
3494
3514
|
angular: renderAngularError,
|
|
3495
3515
|
ember: renderEmberError,
|
|
3516
|
+
html: renderHtmlError,
|
|
3496
3517
|
react: renderReactError,
|
|
3497
3518
|
svelte: renderSvelteError,
|
|
3498
3519
|
vue: renderVueError
|
|
3499
3520
|
};
|
|
3500
|
-
var
|
|
3521
|
+
var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
|
|
3501
3522
|
let conventionPath = resolveErrorConventionPath(framework, pageName);
|
|
3502
3523
|
if (!conventionPath && error instanceof Error && error.stack) {
|
|
3503
3524
|
for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
@@ -3511,7 +3532,6 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
3511
3532
|
}
|
|
3512
3533
|
if (!conventionPath)
|
|
3513
3534
|
return null;
|
|
3514
|
-
const errorProps = buildErrorProps(error);
|
|
3515
3535
|
const renderer = ERROR_RENDERERS[framework];
|
|
3516
3536
|
if (!renderer)
|
|
3517
3537
|
return null;
|
|
@@ -3522,12 +3542,25 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
3522
3542
|
}
|
|
3523
3543
|
return null;
|
|
3524
3544
|
};
|
|
3545
|
+
var renderConventionError = async (framework, pageName, error) => {
|
|
3546
|
+
const errorProps = buildErrorProps(error);
|
|
3547
|
+
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
3548
|
+
if (frameworkResponse)
|
|
3549
|
+
return frameworkResponse;
|
|
3550
|
+
if (framework !== "html") {
|
|
3551
|
+
const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
|
|
3552
|
+
if (htmlResponse)
|
|
3553
|
+
return htmlResponse;
|
|
3554
|
+
}
|
|
3555
|
+
return null;
|
|
3556
|
+
};
|
|
3525
3557
|
var renderReactNotFound = async (conventionPath) => {
|
|
3526
3558
|
const { createElement } = await import("react");
|
|
3527
3559
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
3528
3560
|
const mod = await import(conventionPath);
|
|
3529
|
-
const
|
|
3530
|
-
|
|
3561
|
+
const NotFoundComponent = mod.default;
|
|
3562
|
+
if (typeof NotFoundComponent !== "function")
|
|
3563
|
+
return null;
|
|
3531
3564
|
const element = createElement(NotFoundComponent);
|
|
3532
3565
|
const stream = await renderToReadableStream(element);
|
|
3533
3566
|
return new Response(stream, {
|
|
@@ -3539,6 +3572,8 @@ var renderSvelteNotFound = async (conventionPath) => {
|
|
|
3539
3572
|
const { render } = await import("svelte/server");
|
|
3540
3573
|
const mod = await import(conventionPath);
|
|
3541
3574
|
const NotFoundComponent = mod.default;
|
|
3575
|
+
if (!NotFoundComponent)
|
|
3576
|
+
return null;
|
|
3542
3577
|
const { head, body } = render(NotFoundComponent);
|
|
3543
3578
|
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
3544
3579
|
return new Response(html, {
|
|
@@ -3551,6 +3586,8 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
3551
3586
|
const { renderToString } = await import("vue/server-renderer");
|
|
3552
3587
|
const mod = await import(conventionPath);
|
|
3553
3588
|
const NotFoundComponent = mod.default;
|
|
3589
|
+
if (!NotFoundComponent)
|
|
3590
|
+
return null;
|
|
3554
3591
|
const app = createSSRApp({
|
|
3555
3592
|
render: () => h(NotFoundComponent)
|
|
3556
3593
|
});
|
|
@@ -3564,10 +3601,17 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
3564
3601
|
};
|
|
3565
3602
|
var renderAngularNotFound = async (conventionPath) => {
|
|
3566
3603
|
const mod = await import(conventionPath);
|
|
3567
|
-
const
|
|
3568
|
-
if (typeof
|
|
3604
|
+
const renderFn = mod.default;
|
|
3605
|
+
if (typeof renderFn !== "function")
|
|
3569
3606
|
return null;
|
|
3570
|
-
const html =
|
|
3607
|
+
const html = renderFn();
|
|
3608
|
+
return new Response(html, {
|
|
3609
|
+
headers: { "Content-Type": "text/html" },
|
|
3610
|
+
status: 404
|
|
3611
|
+
});
|
|
3612
|
+
};
|
|
3613
|
+
var renderHtmlNotFound = async (conventionPath) => {
|
|
3614
|
+
const html = await Bun.file(conventionPath).text();
|
|
3571
3615
|
return new Response(html, {
|
|
3572
3616
|
headers: { "Content-Type": "text/html" },
|
|
3573
3617
|
status: 404
|
|
@@ -3576,6 +3620,7 @@ var renderAngularNotFound = async (conventionPath) => {
|
|
|
3576
3620
|
var NOT_FOUND_RENDERERS = {
|
|
3577
3621
|
angular: renderAngularNotFound,
|
|
3578
3622
|
ember: renderEmberNotFound,
|
|
3623
|
+
html: renderHtmlNotFound,
|
|
3579
3624
|
react: renderReactNotFound,
|
|
3580
3625
|
svelte: renderSvelteNotFound,
|
|
3581
3626
|
vue: renderVueNotFound
|
|
@@ -3598,7 +3643,8 @@ var NOT_FOUND_PRIORITY = [
|
|
|
3598
3643
|
"react",
|
|
3599
3644
|
"svelte",
|
|
3600
3645
|
"vue",
|
|
3601
|
-
"angular"
|
|
3646
|
+
"angular",
|
|
3647
|
+
"html"
|
|
3602
3648
|
];
|
|
3603
3649
|
var renderFirstNotFound = async () => {
|
|
3604
3650
|
const renderNext = async (frameworks) => {
|
|
@@ -3886,5 +3932,5 @@ export {
|
|
|
3886
3932
|
Island
|
|
3887
3933
|
};
|
|
3888
3934
|
|
|
3889
|
-
//# debugId=
|
|
3935
|
+
//# debugId=1094272B47C7C77164756E2164756E21
|
|
3890
3936
|
//# sourceMappingURL=index.js.map
|