cloudcommerce 2.3.0 → 2.3.1
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/.github/workflows/test-apps.yml +3 -3
- package/CHANGELOG.md +12 -0
- package/action.yml +6 -6
- package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
- package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barra-doce/package.json +2 -2
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/apps/affiliate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mandae/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/pagarme-v5/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/ci/bunny-config-base.sh +4 -2
- package/packages/cli/config/firestore.rules +3 -0
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/lib/cron-ssr-save-views.js +11 -5
- package/packages/ssr/lib/lib/cron-ssr-save-views.js.map +1 -1
- package/packages/ssr/package.json +3 -3
- package/packages/ssr/src/lib/cron-ssr-save-views.ts +11 -8
- package/packages/storefront/dist/client/_astro/AccountPage.3-eqV6OR.js +1 -0
- package/packages/storefront/dist/client/_astro/CartSidebar.-Gy6eqIy.js +1 -0
- package/packages/storefront/dist/client/_astro/HeroSlider.ju9TsLrJ.js +1 -0
- package/packages/storefront/dist/client/_astro/PitchBar.yqD9ycx5.js +1 -0
- package/packages/storefront/dist/client/_astro/Prices.xI1rdM1e.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductDetails.ATGXfGhG.js +7 -0
- package/packages/storefront/dist/client/_astro/ProductShelf.b77WjhZZ.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductShelf.qbTNzuvn.js +1 -0
- package/packages/storefront/dist/client/_astro/QuantitySelector.v7L8EYOR.js +1 -0
- package/packages/storefront/dist/client/_astro/SearchModal.WzDMBjqi.js +1 -0
- package/packages/storefront/dist/client/_astro/SearchShowcase.9gIA4Cq0.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.Ee4OJr3q.js +7 -0
- package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.SO-0jCqa.js → _plugin-vue_export-helper.xATGHWd9.js} +2 -2
- package/packages/storefront/dist/client/_astro/{_slug_.4W7qhV-L.css → _slug_.WkuZ8tvp.css} +1 -1
- package/packages/storefront/dist/client/_astro/afetch.OifQZgwR.js +1 -0
- package/packages/storefront/dist/client/_astro/client.YJ00ta5M.js +1 -0
- package/packages/storefront/dist/client/_astro/customer-session.dSYHWdP4.js +7 -0
- package/packages/storefront/dist/client/_astro/format-money.1_HtF5S2.js +1 -0
- package/packages/storefront/dist/client/_astro/grid-title.pK2Nn3i-.js +1 -0
- package/packages/storefront/dist/client/_astro/hoisted.d2SGwVMl.js +1 -0
- package/packages/storefront/dist/client/_astro/hoisted.x1b7VHef.js +1 -0
- package/packages/storefront/dist/client/_astro/hoisted.xTPkED8g.js +1 -0
- package/packages/storefront/dist/client/_astro/i18n.zhlBzJt8.js +1 -0
- package/packages/storefront/dist/client/_astro/img.AnjeGdy_.js +1 -0
- package/packages/storefront/dist/client/_astro/index.KfrHdfOH.js +1 -0
- package/packages/storefront/dist/client/_astro/index.ShNlAyu1.js +1 -0
- package/packages/storefront/dist/client/_astro/modules-info.HP6478mG.js +1 -0
- package/packages/storefront/dist/client/_astro/name.VA3MEpe0.js +1 -0
- package/packages/storefront/dist/client/_astro/server-data.4C60Esyt.js +1 -0
- package/packages/storefront/dist/client/_astro/sf-utils.c42cbZ9W.js +13 -0
- package/packages/storefront/dist/client/_astro/shopping-cart.v-dB3kHB.js +1 -0
- package/packages/storefront/dist/client/_astro/use-analytics._ef6TM4P.js +1 -0
- package/packages/storefront/dist/client/_astro/use-product-card.nNtSJVtB.js +1 -0
- package/packages/storefront/dist/client/_astro/use-text-value.0OP9HCfP.js +4 -0
- package/packages/storefront/dist/client/{~fallback/index.html → ~fallback.html} +5 -5
- package/packages/storefront/dist/client/{index.html → ~index.html} +7 -7
- package/packages/storefront/dist/server/_noop-middleware.mjs +3 -0
- package/packages/storefront/dist/server/chunks/{CartSidebar_yYIzwp_R.mjs → CartSidebar_blvgfFa-.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{SearchModal_GvRUZ6ce.mjs → SearchModal_Sktaq643.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/_.._yTK2xBRC.mjs +5 -0
- package/packages/storefront/dist/server/chunks/_page__9PfWVh79.mjs +5 -0
- package/packages/storefront/dist/server/chunks/account_R4bpY7O1.mjs +5 -0
- package/packages/storefront/dist/server/chunks/astro/{assets-service_yXRChsFH.mjs → assets-service_oQ4-9MNg.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{astro_F4pl3toV.mjs → astro_ECsNQeA2.mjs} +18 -14
- package/packages/storefront/dist/server/chunks/index__PeYBuja.mjs +5 -0
- package/packages/storefront/dist/server/chunks/node_njrZIjT6.mjs +5 -0
- package/packages/storefront/dist/server/chunks/pages/{__z8Igc_-f.mjs → __XOsz50la.mjs} +994 -922
- package/packages/storefront/dist/server/chunks/pages/{_page__-V1Q-Ymk.mjs → _page__cIw_KTpN.mjs} +14 -12
- package/packages/storefront/dist/server/chunks/pages/{account_frSUn7gD.mjs → account_l-FHyDJd.mjs} +3 -2
- package/packages/storefront/dist/server/chunks/pages/{index_QqJiJpFy.mjs → index_KP7Gn0ld.mjs} +3 -2
- package/packages/storefront/dist/server/chunks/pages/{node_FoDIj_f7.mjs → node_FoLtkdH1.mjs} +4 -4
- package/packages/storefront/dist/server/chunks/pages/{~fallback_t0lNhRm9.mjs → ~fallback_KPp6Nh_p.mjs} +3 -2
- package/packages/storefront/dist/server/chunks/~fallback_p7P7NIL5.mjs +5 -0
- package/packages/storefront/dist/server/entry.mjs +289 -166
- package/packages/storefront/dist/server/manifest_E6KbHQrT.mjs +202 -0
- package/packages/storefront/dist/server/renderers.mjs +1 -1
- package/packages/storefront/dist/server/static-builds.csv +34 -34
- package/packages/storefront/package.json +3 -3
- package/packages/storefront/src/lib/scripts/git-cms-auth.ts +3 -0
- package/packages/storefront/src/lib/scripts/push-analytics-events.ts +6 -1
- package/packages/storefront/src/lib/scripts/sso-ecom.ts +0 -0
- package/packages/storefront/src/lib/ssr-context.ts +3 -1
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/AccountPage.HcKW6HTE.js +0 -1
- package/packages/storefront/dist/client/_astro/CartSidebar.osvr0MUo.js +0 -1
- package/packages/storefront/dist/client/_astro/HeroSlider.I5mC8JdX.js +0 -1
- package/packages/storefront/dist/client/_astro/PitchBar.xC4J7MDy.js +0 -1
- package/packages/storefront/dist/client/_astro/Prices.Jt09rVKv.js +0 -1
- package/packages/storefront/dist/client/_astro/ProductDetails.oouZY3cL.js +0 -7
- package/packages/storefront/dist/client/_astro/ProductShelf.dYlXuNId.js +0 -1
- package/packages/storefront/dist/client/_astro/ProductShelf.vGE0E3Qf.js +0 -1
- package/packages/storefront/dist/client/_astro/QuantitySelector.OL4MN-C_.js +0 -1
- package/packages/storefront/dist/client/_astro/SearchModal.d8lbvLay.js +0 -1
- package/packages/storefront/dist/client/_astro/SearchShowcase.ynowXX4j.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.l4KJGvUd.js +0 -7
- package/packages/storefront/dist/client/_astro/afetch.5c8VmT0-.js +0 -1
- package/packages/storefront/dist/client/_astro/client.ZhEmw4hZ.js +0 -1
- package/packages/storefront/dist/client/_astro/customer-session.TRPGDX3c.js +0 -7
- package/packages/storefront/dist/client/_astro/format-money.iK5LGydz.js +0 -1
- package/packages/storefront/dist/client/_astro/grid-title.vGKBy72g.js +0 -1
- package/packages/storefront/dist/client/_astro/hoisted.8pwSenCN.js +0 -1
- package/packages/storefront/dist/client/_astro/hoisted.SLwcAI01.js +0 -1
- package/packages/storefront/dist/client/_astro/hoisted.gqV7f6f3.js +0 -1
- package/packages/storefront/dist/client/_astro/i18n.Lxnz1oF-.js +0 -1
- package/packages/storefront/dist/client/_astro/img.WnsidxCx.js +0 -1
- package/packages/storefront/dist/client/_astro/index.R7A-Pg5V.js +0 -1
- package/packages/storefront/dist/client/_astro/index.q6KIyKlJ.js +0 -1
- package/packages/storefront/dist/client/_astro/modules-info.WWsUqEPZ.js +0 -1
- package/packages/storefront/dist/client/_astro/name.urFqJ5yn.js +0 -1
- package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.XTSAdOlw.js +0 -13
- package/packages/storefront/dist/client/_astro/sf-utils.luvTU5uS.js +0 -1
- package/packages/storefront/dist/client/_astro/shopping-cart.ATTXCPd0.js +0 -1
- package/packages/storefront/dist/client/_astro/use-analytics.WpkjGsWi.js +0 -1
- package/packages/storefront/dist/client/_astro/use-product-card.BhUXhJIp.js +0 -1
- package/packages/storefront/dist/client/_astro/use-text-value.XE_A2nDM.js +0 -4
- package/packages/storefront/dist/client/app/account/index.html +0 -58
- package/packages/storefront/dist/client/app/index.html +0 -98
- package/packages/storefront/dist/client/blog/1/index.html +0 -86
- package/packages/storefront/dist/client/macbook-apple-pro-15.4-intel-core-i7-2.6ghz-ram-16gb-ssd-512gb-mr972ll/a-prata/index.html +0 -93
- package/packages/storefront/dist/client/monitores-gamer/index.html +0 -95
- package/packages/storefront/dist/client/mouse-gamer-corsair-optico-harpoon-rgb-ch-9301011-na/index.html +0 -93
- package/packages/storefront/dist/client/p/contato/index.html +0 -90
- package/packages/storefront/dist/client/p/terms/index.html +0 -101
- package/packages/storefront/dist/client/posts/3/index.html +0 -101
- package/packages/storefront/dist/client/posts/4/index.html +0 -101
- package/packages/storefront/dist/server/_empty-middleware.mjs +0 -3
- package/packages/storefront/dist/server/chunks/_.._Lq3r7hpv.mjs +0 -6
- package/packages/storefront/dist/server/chunks/_page__LqbeNfr1.mjs +0 -6
- package/packages/storefront/dist/server/chunks/account_4n4rpirV.mjs +0 -6
- package/packages/storefront/dist/server/chunks/index_SwXtE1IM.mjs +0 -6
- package/packages/storefront/dist/server/chunks/node_Nzz44v5l.mjs +0 -6
- package/packages/storefront/dist/server/chunks/~fallback_EWqi0UyU.mjs +0 -6
- package/packages/storefront/dist/server/manifest_ZHJUD8_m.mjs +0 -196
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { renderers } from './renderers.mjs';
|
|
2
|
+
import { l as levels, g as getEventPrefix, L as Logger, A as AstroIntegrationLogger, manifest } from './manifest_E6KbHQrT.mjs';
|
|
1
3
|
import fs from 'node:fs';
|
|
2
|
-
import { appendForwardSlash as appendForwardSlash$1, joinPaths, trimSlashes, slash, prependForwardSlash, removeTrailingForwardSlash, collapseDuplicateSlashes } from '@astrojs/internal-helpers/path';
|
|
4
|
+
import { appendForwardSlash as appendForwardSlash$1, joinPaths, trimSlashes, slash, prependForwardSlash as prependForwardSlash$1, removeTrailingForwardSlash, collapseDuplicateSlashes } from '@astrojs/internal-helpers/path';
|
|
5
|
+
import { R as ROUTE_DATA_SYMBOL, A as AstroError, n as ResponseSentError, o as MiddlewareNoDataOrNextCalled, p as MiddlewareNotAResponse, G as GetStaticPathsRequired, q as InvalidGetStaticPathsReturn, t as InvalidGetStaticPathsEntry, v as GetStaticPathsExpectedParams, w as GetStaticPathsInvalidRouteParam, P as PageNumberParamNotFound, N as NoMatchingStaticPathFound, x as PrerenderDynamicEndpointPathCollide, y as LocalsNotAnObject, z as ASTRO_VERSION, C as ClientAddressNotAvailable, S as StaticClientAddressNotAvailable, B as renderEndpoint, D as ReservedSlotName, g as renderSlotToString, H as renderJSX, J as chunkToString, K as CantRenderPage, O as renderPage$1, Q as REROUTE_DIRECTIVE_HEADER } from './chunks/astro_ECsNQeA2.mjs';
|
|
3
6
|
import { serialize, parse } from 'cookie';
|
|
4
|
-
import { A as AstroError, R as ResponseSentError, n as MiddlewareNoDataOrNextCalled, o as MiddlewareNotAResponse, G as GetStaticPathsRequired, p as InvalidGetStaticPathsReturn, q as InvalidGetStaticPathsEntry, t as GetStaticPathsExpectedParams, v as GetStaticPathsInvalidRouteParam, P as PageNumberParamNotFound, N as NoMatchingStaticPathFound, w as PrerenderDynamicEndpointPathCollide, x as LocalsNotAnObject, y as ASTRO_VERSION, C as ClientAddressNotAvailable, S as StaticClientAddressNotAvailable, z as renderEndpoint, B as ReservedSlotName, g as renderSlotToString, D as renderJSX, H as chunkToString, J as CantRenderPage, K as renderPage$1 } from './chunks/astro_F4pl3toV.mjs';
|
|
5
|
-
import { l as levels, g as getEventPrefix, L as Logger, A as AstroIntegrationLogger, manifest } from './manifest_ZHJUD8_m.mjs';
|
|
6
7
|
import 'kleur/colors';
|
|
7
8
|
import 'clsx';
|
|
9
|
+
import 'cssesc';
|
|
8
10
|
import buffer from 'node:buffer';
|
|
9
11
|
import crypto from 'node:crypto';
|
|
10
12
|
import http from 'node:http';
|
|
@@ -15,7 +17,25 @@ import url from 'node:url';
|
|
|
15
17
|
import send from 'send';
|
|
16
18
|
import os from 'node:os';
|
|
17
19
|
import https from 'node:https';
|
|
18
|
-
import {
|
|
20
|
+
import { onRequest } from './_noop-middleware.mjs';
|
|
21
|
+
|
|
22
|
+
function shouldAppendForwardSlash(trailingSlash, buildFormat) {
|
|
23
|
+
switch (trailingSlash) {
|
|
24
|
+
case "always":
|
|
25
|
+
return true;
|
|
26
|
+
case "never":
|
|
27
|
+
return false;
|
|
28
|
+
case "ignore": {
|
|
29
|
+
switch (buildFormat) {
|
|
30
|
+
case "directory":
|
|
31
|
+
return true;
|
|
32
|
+
case "preserve":
|
|
33
|
+
case "file":
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
19
39
|
|
|
20
40
|
function getPathByLocale(locale, locales) {
|
|
21
41
|
for (const loopLocale of locales) {
|
|
@@ -31,6 +51,7 @@ function getPathByLocale(locale, locales) {
|
|
|
31
51
|
}
|
|
32
52
|
}
|
|
33
53
|
}
|
|
54
|
+
throw new Unreachable();
|
|
34
55
|
}
|
|
35
56
|
function normalizeTheLocale(locale) {
|
|
36
57
|
return locale.replaceAll("_", "-").toLowerCase();
|
|
@@ -48,8 +69,15 @@ function toCodes(locales) {
|
|
|
48
69
|
}
|
|
49
70
|
return codes;
|
|
50
71
|
}
|
|
72
|
+
class Unreachable extends Error {
|
|
73
|
+
constructor() {
|
|
74
|
+
super(
|
|
75
|
+
"Astro encountered an unexpected line of code.\nIn most cases, this is not your fault, but a bug in astro code.\nIf there isn't one already, please create an issue.\nhttps://astro.build/issues"
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
51
79
|
|
|
52
|
-
const routeDataSymbol = Symbol.for(
|
|
80
|
+
const routeDataSymbol$1 = Symbol.for(ROUTE_DATA_SYMBOL);
|
|
53
81
|
function pathnameHasLocale(pathname, locales) {
|
|
54
82
|
const segments = pathname.split("/");
|
|
55
83
|
for (const segment of segments) {
|
|
@@ -65,60 +93,104 @@ function pathnameHasLocale(pathname, locales) {
|
|
|
65
93
|
}
|
|
66
94
|
return false;
|
|
67
95
|
}
|
|
68
|
-
function createI18nMiddleware(i18n, base, trailingSlash) {
|
|
69
|
-
if (!i18n)
|
|
96
|
+
function createI18nMiddleware(i18n, base, trailingSlash, buildFormat) {
|
|
97
|
+
if (!i18n)
|
|
98
|
+
return (_, next) => next();
|
|
99
|
+
const prefixAlways = (url, response, context) => {
|
|
100
|
+
if (url.pathname === base + "/" || url.pathname === base) {
|
|
101
|
+
if (shouldAppendForwardSlash(trailingSlash, buildFormat)) {
|
|
102
|
+
return context.redirect(`${appendForwardSlash$1(joinPaths(base, i18n.defaultLocale))}`);
|
|
103
|
+
} else {
|
|
104
|
+
return context.redirect(`${joinPaths(base, i18n.defaultLocale)}`);
|
|
105
|
+
}
|
|
106
|
+
} else if (!pathnameHasLocale(url.pathname, i18n.locales)) {
|
|
107
|
+
return new Response(null, {
|
|
108
|
+
status: 404,
|
|
109
|
+
headers: response.headers
|
|
110
|
+
});
|
|
111
|
+
}
|
|
70
112
|
return void 0;
|
|
71
|
-
}
|
|
113
|
+
};
|
|
114
|
+
const prefixOtherLocales = (url, response) => {
|
|
115
|
+
const pathnameContainsDefaultLocale = url.pathname.includes(`/${i18n.defaultLocale}`);
|
|
116
|
+
if (pathnameContainsDefaultLocale) {
|
|
117
|
+
const newLocation = url.pathname.replace(`/${i18n.defaultLocale}`, "");
|
|
118
|
+
response.headers.set("Location", newLocation);
|
|
119
|
+
return new Response(null, {
|
|
120
|
+
status: 404,
|
|
121
|
+
headers: response.headers
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return void 0;
|
|
125
|
+
};
|
|
126
|
+
const prefixAlwaysNoRedirect = (url, response) => {
|
|
127
|
+
const isRoot = url.pathname === base + "/" || url.pathname === base;
|
|
128
|
+
if (!(isRoot || pathnameHasLocale(url.pathname, i18n.locales))) {
|
|
129
|
+
return new Response(null, {
|
|
130
|
+
status: 404,
|
|
131
|
+
headers: response.headers
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return void 0;
|
|
135
|
+
};
|
|
72
136
|
return async (context, next) => {
|
|
73
|
-
|
|
137
|
+
const routeData = Reflect.get(context.request, routeDataSymbol$1);
|
|
138
|
+
if (routeData?.type !== "page" && routeData?.type !== "fallback") {
|
|
74
139
|
return await next();
|
|
75
140
|
}
|
|
76
|
-
const
|
|
77
|
-
if (routeData) {
|
|
78
|
-
if (routeData.type !== "page" && routeData.type !== "fallback") {
|
|
79
|
-
return await next();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
141
|
+
const currentLocale = context.currentLocale;
|
|
82
142
|
const url = context.url;
|
|
83
143
|
const { locales, defaultLocale, fallback, routing } = i18n;
|
|
84
144
|
const response = await next();
|
|
85
145
|
if (response instanceof Response) {
|
|
86
|
-
const pathnameContainsDefaultLocale = url.pathname.includes(`/${defaultLocale}`);
|
|
87
146
|
switch (i18n.routing) {
|
|
147
|
+
case "domains-prefix-other-locales": {
|
|
148
|
+
if (localeHasntDomain(i18n, currentLocale)) {
|
|
149
|
+
const result = prefixOtherLocales(url, response);
|
|
150
|
+
if (result) {
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
88
156
|
case "pathname-prefix-other-locales": {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
157
|
+
const result = prefixOtherLocales(url, response);
|
|
158
|
+
if (result) {
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
case "domains-prefix-other-no-redirect": {
|
|
164
|
+
if (localeHasntDomain(i18n, currentLocale)) {
|
|
165
|
+
const result = prefixAlwaysNoRedirect(url, response);
|
|
166
|
+
if (result) {
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
96
169
|
}
|
|
97
170
|
break;
|
|
98
171
|
}
|
|
99
172
|
case "pathname-prefix-always-no-redirect": {
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
102
|
-
return
|
|
103
|
-
status: 404,
|
|
104
|
-
headers: response.headers
|
|
105
|
-
});
|
|
173
|
+
const result = prefixAlwaysNoRedirect(url, response);
|
|
174
|
+
if (result) {
|
|
175
|
+
return result;
|
|
106
176
|
}
|
|
107
177
|
break;
|
|
108
178
|
}
|
|
109
179
|
case "pathname-prefix-always": {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
180
|
+
const result = prefixAlways(url, response, context);
|
|
181
|
+
if (result) {
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
case "domains-prefix-always": {
|
|
187
|
+
if (localeHasntDomain(i18n, currentLocale)) {
|
|
188
|
+
const result = prefixAlways(url, response, context);
|
|
189
|
+
if (result) {
|
|
190
|
+
return result;
|
|
115
191
|
}
|
|
116
|
-
} else if (!pathnameHasLocale(url.pathname, i18n.locales)) {
|
|
117
|
-
return new Response(null, {
|
|
118
|
-
status: 404,
|
|
119
|
-
headers: response.headers
|
|
120
|
-
});
|
|
121
192
|
}
|
|
193
|
+
break;
|
|
122
194
|
}
|
|
123
195
|
}
|
|
124
196
|
if (response.status >= 300 && fallback) {
|
|
@@ -153,8 +225,16 @@ function createI18nMiddleware(i18n, base, trailingSlash) {
|
|
|
153
225
|
};
|
|
154
226
|
}
|
|
155
227
|
const i18nPipelineHook = (ctx) => {
|
|
156
|
-
Reflect.set(ctx.request, routeDataSymbol, ctx.route);
|
|
228
|
+
Reflect.set(ctx.request, routeDataSymbol$1, ctx.route);
|
|
157
229
|
};
|
|
230
|
+
function localeHasntDomain(i18n, currentLocale) {
|
|
231
|
+
for (const domainLocale of Object.values(i18n.domainLookupTable)) {
|
|
232
|
+
if (domainLocale === currentLocale) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
158
238
|
|
|
159
239
|
const DELETED_EXPIRATION = /* @__PURE__ */ new Date(0);
|
|
160
240
|
const DELETED_VALUE = "deleted";
|
|
@@ -748,6 +828,7 @@ function validatePrerenderEndpointCollision(route, mod, params) {
|
|
|
748
828
|
}
|
|
749
829
|
|
|
750
830
|
const clientLocalsSymbol$1 = Symbol.for("astro.locals");
|
|
831
|
+
const routeDataSymbol = Symbol.for(ROUTE_DATA_SYMBOL);
|
|
751
832
|
async function createRenderContext(options) {
|
|
752
833
|
const request = options.request;
|
|
753
834
|
const pathname = options.pathname ?? new URL(request.url).pathname;
|
|
@@ -894,8 +975,11 @@ function computePreferredLocaleList(request, locales) {
|
|
|
894
975
|
return result;
|
|
895
976
|
}
|
|
896
977
|
function computeCurrentLocale(request, locales, routingStrategy, defaultLocale) {
|
|
897
|
-
const
|
|
898
|
-
|
|
978
|
+
const routeData = Reflect.get(request, routeDataSymbol);
|
|
979
|
+
if (!routeData) {
|
|
980
|
+
return defaultLocale;
|
|
981
|
+
}
|
|
982
|
+
for (const segment of routeData.route.split("/")) {
|
|
899
983
|
for (const locale of locales) {
|
|
900
984
|
if (typeof locale === "string") {
|
|
901
985
|
if (normalizeTheLocale(locale) === normalizeTheLocale(segment)) {
|
|
@@ -908,7 +992,7 @@ function computeCurrentLocale(request, locales, routingStrategy, defaultLocale)
|
|
|
908
992
|
}
|
|
909
993
|
}
|
|
910
994
|
}
|
|
911
|
-
if (routingStrategy === "pathname-prefix-other-locales") {
|
|
995
|
+
if (routingStrategy === "pathname-prefix-other-locales" || routingStrategy === "domains-prefix-other-locales") {
|
|
912
996
|
return defaultLocale;
|
|
913
997
|
}
|
|
914
998
|
return void 0;
|
|
@@ -1069,7 +1153,7 @@ function createAssetLink(href, base, assetsPrefix) {
|
|
|
1069
1153
|
if (assetsPrefix) {
|
|
1070
1154
|
return joinPaths(assetsPrefix, slash(href));
|
|
1071
1155
|
} else if (base) {
|
|
1072
|
-
return prependForwardSlash(joinPaths(base, slash(href)));
|
|
1156
|
+
return prependForwardSlash$1(joinPaths(base, slash(href)));
|
|
1073
1157
|
} else {
|
|
1074
1158
|
return href;
|
|
1075
1159
|
}
|
|
@@ -1385,11 +1469,6 @@ class Pipeline {
|
|
|
1385
1469
|
#hooks = {
|
|
1386
1470
|
before: []
|
|
1387
1471
|
};
|
|
1388
|
-
/**
|
|
1389
|
-
* The handler accepts the *original* `Request` and result returned by the endpoint.
|
|
1390
|
-
* It must return a `Response`.
|
|
1391
|
-
*/
|
|
1392
|
-
#endpointHandler;
|
|
1393
1472
|
/**
|
|
1394
1473
|
* When creating a pipeline, an environment is mandatory.
|
|
1395
1474
|
* The environment won't change for the whole lifetime of the pipeline.
|
|
@@ -1399,14 +1478,6 @@ class Pipeline {
|
|
|
1399
1478
|
}
|
|
1400
1479
|
setEnvironment() {
|
|
1401
1480
|
}
|
|
1402
|
-
/**
|
|
1403
|
-
* When rendering a route, an "endpoint" will a type that needs to be handled and transformed into a `Response`.
|
|
1404
|
-
*
|
|
1405
|
-
* Each consumer might have different needs; use this function to set up the handler.
|
|
1406
|
-
*/
|
|
1407
|
-
setEndpointHandler(handler) {
|
|
1408
|
-
this.#endpointHandler = handler;
|
|
1409
|
-
}
|
|
1410
1481
|
/**
|
|
1411
1482
|
* A middleware function that will be called before each request.
|
|
1412
1483
|
*/
|
|
@@ -1432,22 +1503,7 @@ class Pipeline {
|
|
|
1432
1503
|
for (const hook of this.#hooks.before) {
|
|
1433
1504
|
hook(renderContext, componentInstance);
|
|
1434
1505
|
}
|
|
1435
|
-
|
|
1436
|
-
renderContext,
|
|
1437
|
-
this.env,
|
|
1438
|
-
componentInstance,
|
|
1439
|
-
this.#onRequest
|
|
1440
|
-
);
|
|
1441
|
-
if (renderContext.route.type === "endpoint") {
|
|
1442
|
-
if (!this.#endpointHandler) {
|
|
1443
|
-
throw new Error(
|
|
1444
|
-
"You created a pipeline that does not know how to handle the result coming from an endpoint."
|
|
1445
|
-
);
|
|
1446
|
-
}
|
|
1447
|
-
return this.#endpointHandler(renderContext.request, result);
|
|
1448
|
-
} else {
|
|
1449
|
-
return result;
|
|
1450
|
-
}
|
|
1506
|
+
return await this.#tryRenderRoute(renderContext, this.env, componentInstance, this.#onRequest);
|
|
1451
1507
|
}
|
|
1452
1508
|
/**
|
|
1453
1509
|
* It attempts to render a route. A route can be a:
|
|
@@ -1508,25 +1564,7 @@ class Pipeline {
|
|
|
1508
1564
|
}
|
|
1509
1565
|
}
|
|
1510
1566
|
|
|
1511
|
-
class EndpointNotFoundError extends Error {
|
|
1512
|
-
originalResponse;
|
|
1513
|
-
constructor(originalResponse) {
|
|
1514
|
-
super();
|
|
1515
|
-
this.originalResponse = originalResponse;
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
1567
|
class SSRRoutePipeline extends Pipeline {
|
|
1519
|
-
constructor(env) {
|
|
1520
|
-
super(env);
|
|
1521
|
-
this.setEndpointHandler(this.#ssrEndpointHandler);
|
|
1522
|
-
}
|
|
1523
|
-
// This function is responsible for handling the result coming from an endpoint.
|
|
1524
|
-
async #ssrEndpointHandler(request, response) {
|
|
1525
|
-
if (response.headers.get("X-Astro-Response") === "Not-Found") {
|
|
1526
|
-
throw new EndpointNotFoundError(response);
|
|
1527
|
-
}
|
|
1528
|
-
return response;
|
|
1529
|
-
}
|
|
1530
1568
|
}
|
|
1531
1569
|
|
|
1532
1570
|
const localsSymbol = Symbol.for("astro.locals");
|
|
@@ -1610,19 +1648,69 @@ class App {
|
|
|
1610
1648
|
}
|
|
1611
1649
|
#getPathnameFromRequest(request) {
|
|
1612
1650
|
const url = new URL(request.url);
|
|
1613
|
-
const pathname = prependForwardSlash(this.removeBase(url.pathname));
|
|
1651
|
+
const pathname = prependForwardSlash$1(this.removeBase(url.pathname));
|
|
1614
1652
|
return pathname;
|
|
1615
1653
|
}
|
|
1616
1654
|
match(request) {
|
|
1617
1655
|
const url = new URL(request.url);
|
|
1618
1656
|
if (this.#manifest.assets.has(url.pathname))
|
|
1619
1657
|
return void 0;
|
|
1620
|
-
|
|
1621
|
-
|
|
1658
|
+
let pathname = this.#computePathnameFromDomain(request);
|
|
1659
|
+
if (!pathname) {
|
|
1660
|
+
pathname = prependForwardSlash$1(this.removeBase(url.pathname));
|
|
1661
|
+
}
|
|
1662
|
+
let routeData = matchRoute(pathname, this.#manifestData);
|
|
1622
1663
|
if (!routeData || routeData.prerender)
|
|
1623
1664
|
return void 0;
|
|
1624
1665
|
return routeData;
|
|
1625
1666
|
}
|
|
1667
|
+
#computePathnameFromDomain(request) {
|
|
1668
|
+
let pathname = void 0;
|
|
1669
|
+
const url = new URL(request.url);
|
|
1670
|
+
if (this.#manifest.i18n && (this.#manifest.i18n.routing === "domains-prefix-always" || this.#manifest.i18n.routing === "domains-prefix-other-locales" || this.#manifest.i18n.routing === "domains-prefix-other-no-redirect")) {
|
|
1671
|
+
let host = request.headers.get("X-Forwarded-Host");
|
|
1672
|
+
let protocol = request.headers.get("X-Forwarded-Proto");
|
|
1673
|
+
if (protocol) {
|
|
1674
|
+
protocol = protocol + ":";
|
|
1675
|
+
} else {
|
|
1676
|
+
protocol = url.protocol;
|
|
1677
|
+
}
|
|
1678
|
+
if (!host) {
|
|
1679
|
+
host = request.headers.get("Host");
|
|
1680
|
+
}
|
|
1681
|
+
if (host && protocol) {
|
|
1682
|
+
host = host.split(":")[0];
|
|
1683
|
+
try {
|
|
1684
|
+
let locale;
|
|
1685
|
+
const hostAsUrl = new URL(`${protocol}//${host}`);
|
|
1686
|
+
for (const [domainKey, localeValue] of Object.entries(
|
|
1687
|
+
this.#manifest.i18n.domainLookupTable
|
|
1688
|
+
)) {
|
|
1689
|
+
const domainKeyAsUrl = new URL(domainKey);
|
|
1690
|
+
if (hostAsUrl.host === domainKeyAsUrl.host && hostAsUrl.protocol === domainKeyAsUrl.protocol) {
|
|
1691
|
+
locale = localeValue;
|
|
1692
|
+
break;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
if (locale) {
|
|
1696
|
+
pathname = prependForwardSlash$1(
|
|
1697
|
+
joinPaths(normalizeTheLocale(locale), this.removeBase(url.pathname))
|
|
1698
|
+
);
|
|
1699
|
+
if (url.pathname.endsWith("/")) {
|
|
1700
|
+
pathname = appendForwardSlash$1(pathname);
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
} catch (e) {
|
|
1704
|
+
this.#logger.error(
|
|
1705
|
+
"router",
|
|
1706
|
+
`Astro tried to parse ${protocol}//${host} as an URL, but it threw a parsing error. Check the X-Forwarded-Host and X-Forwarded-Proto headers.`
|
|
1707
|
+
);
|
|
1708
|
+
this.#logger.error("router", `Error: ${e}`);
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
return pathname;
|
|
1713
|
+
}
|
|
1626
1714
|
async render(request, routeDataOrOptions, maybeLocals) {
|
|
1627
1715
|
let routeData;
|
|
1628
1716
|
let locals;
|
|
@@ -1680,36 +1768,28 @@ class App {
|
|
|
1680
1768
|
const i18nMiddleware = createI18nMiddleware(
|
|
1681
1769
|
this.#manifest.i18n,
|
|
1682
1770
|
this.#manifest.base,
|
|
1683
|
-
this.#manifest.trailingSlash
|
|
1771
|
+
this.#manifest.trailingSlash,
|
|
1772
|
+
this.#manifest.buildFormat
|
|
1684
1773
|
);
|
|
1685
1774
|
if (i18nMiddleware) {
|
|
1686
|
-
|
|
1687
|
-
this.#pipeline.setMiddlewareFunction(sequence(i18nMiddleware, mod.onRequest));
|
|
1688
|
-
} else {
|
|
1689
|
-
this.#pipeline.setMiddlewareFunction(i18nMiddleware);
|
|
1690
|
-
}
|
|
1775
|
+
this.#pipeline.setMiddlewareFunction(sequence(i18nMiddleware, this.#manifest.middleware));
|
|
1691
1776
|
this.#pipeline.onBeforeRenderRoute(i18nPipelineHook);
|
|
1692
1777
|
} else {
|
|
1693
|
-
|
|
1694
|
-
this.#pipeline.setMiddlewareFunction(mod.onRequest);
|
|
1695
|
-
}
|
|
1778
|
+
this.#pipeline.setMiddlewareFunction(this.#manifest.middleware);
|
|
1696
1779
|
}
|
|
1697
1780
|
response = await this.#pipeline.renderRoute(renderContext, pageModule);
|
|
1698
1781
|
} catch (err) {
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
} else {
|
|
1702
|
-
this.#logger.error(null, err.stack || err.message || String(err));
|
|
1703
|
-
return this.#renderError(request, { status: 500 });
|
|
1704
|
-
}
|
|
1782
|
+
this.#logger.error(null, err.stack || err.message || String(err));
|
|
1783
|
+
return this.#renderError(request, { status: 500 });
|
|
1705
1784
|
}
|
|
1706
|
-
if (
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1785
|
+
if (REROUTABLE_STATUS_CODES.has(response.status) && response.headers.get(REROUTE_DIRECTIVE_HEADER) !== "no") {
|
|
1786
|
+
return this.#renderError(request, {
|
|
1787
|
+
response,
|
|
1788
|
+
status: response.status
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
if (response.headers.has(REROUTE_DIRECTIVE_HEADER)) {
|
|
1792
|
+
response.headers.delete(REROUTE_DIRECTIVE_HEADER);
|
|
1713
1793
|
}
|
|
1714
1794
|
if (addCookieHeader) {
|
|
1715
1795
|
for (const setCookieHeaderValue of App.getSetCookieFromResponse(response)) {
|
|
@@ -1763,7 +1843,7 @@ class App {
|
|
|
1763
1843
|
defaultLocale: this.#manifest.i18n?.defaultLocale
|
|
1764
1844
|
});
|
|
1765
1845
|
} else {
|
|
1766
|
-
const pathname = prependForwardSlash(this.removeBase(url.pathname));
|
|
1846
|
+
const pathname = prependForwardSlash$1(this.removeBase(url.pathname));
|
|
1767
1847
|
const info = this.#routeDataToRouteInfo.get(routeData);
|
|
1768
1848
|
const links = /* @__PURE__ */ new Set();
|
|
1769
1849
|
const styles = createStylesheetElementSet(info.styles);
|
|
@@ -1827,8 +1907,8 @@ class App {
|
|
|
1827
1907
|
status
|
|
1828
1908
|
);
|
|
1829
1909
|
const page = await mod.page();
|
|
1830
|
-
if (skipMiddleware === false
|
|
1831
|
-
this.#pipeline.setMiddlewareFunction(
|
|
1910
|
+
if (skipMiddleware === false) {
|
|
1911
|
+
this.#pipeline.setMiddlewareFunction(this.#manifest.middleware);
|
|
1832
1912
|
}
|
|
1833
1913
|
if (skipMiddleware) {
|
|
1834
1914
|
this.#pipeline.unsetMiddlewareFunction();
|
|
@@ -1836,7 +1916,7 @@ class App {
|
|
|
1836
1916
|
const response2 = await this.#pipeline.renderRoute(newRenderContext, page);
|
|
1837
1917
|
return this.#mergeResponses(response2, originalResponse);
|
|
1838
1918
|
} catch {
|
|
1839
|
-
if (skipMiddleware === false
|
|
1919
|
+
if (skipMiddleware === false) {
|
|
1840
1920
|
return this.#renderError(request, {
|
|
1841
1921
|
status,
|
|
1842
1922
|
response: originalResponse,
|
|
@@ -2014,27 +2094,27 @@ class NodeApp extends App {
|
|
|
2014
2094
|
static async writeResponse(source, destination) {
|
|
2015
2095
|
const { status, headers, body } = source;
|
|
2016
2096
|
destination.writeHead(status, createOutgoingHttpHeaders(headers));
|
|
2017
|
-
if (body)
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2097
|
+
if (!body)
|
|
2098
|
+
return destination.end();
|
|
2099
|
+
try {
|
|
2100
|
+
const reader = body.getReader();
|
|
2101
|
+
destination.on("close", () => {
|
|
2102
|
+
reader.cancel().catch((err) => {
|
|
2103
|
+
console.error(
|
|
2104
|
+
`There was an uncaught error in the middle of the stream while rendering ${destination.req.url}.`,
|
|
2105
|
+
err
|
|
2106
|
+
);
|
|
2027
2107
|
});
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
} catch {
|
|
2034
|
-
destination.write("Internal server error");
|
|
2108
|
+
});
|
|
2109
|
+
let result = await reader.read();
|
|
2110
|
+
while (!result.done) {
|
|
2111
|
+
destination.write(result.value);
|
|
2112
|
+
result = await reader.read();
|
|
2035
2113
|
}
|
|
2114
|
+
destination.end();
|
|
2115
|
+
} catch {
|
|
2116
|
+
destination.end("Internal server error");
|
|
2036
2117
|
}
|
|
2037
|
-
destination.end();
|
|
2038
2118
|
}
|
|
2039
2119
|
}
|
|
2040
2120
|
function makeRequestHeaders(req) {
|
|
@@ -2104,8 +2184,44 @@ function createStaticHandler(app, options) {
|
|
|
2104
2184
|
const client = resolveClientDir(options);
|
|
2105
2185
|
return (req, res, ssr) => {
|
|
2106
2186
|
if (req.url) {
|
|
2107
|
-
|
|
2108
|
-
|
|
2187
|
+
const [urlPath, urlQuery] = req.url.split("?");
|
|
2188
|
+
const filePath = path.join(client, app.removeBase(urlPath));
|
|
2189
|
+
let pathname;
|
|
2190
|
+
let isDirectory = false;
|
|
2191
|
+
try {
|
|
2192
|
+
isDirectory = fs.lstatSync(filePath).isDirectory();
|
|
2193
|
+
} catch {
|
|
2194
|
+
}
|
|
2195
|
+
const { trailingSlash = "ignore" } = options;
|
|
2196
|
+
const hasSlash = urlPath.endsWith("/");
|
|
2197
|
+
switch (trailingSlash) {
|
|
2198
|
+
case "never":
|
|
2199
|
+
if (isDirectory && urlPath != "/" && hasSlash) {
|
|
2200
|
+
pathname = urlPath.slice(0, -1) + (urlQuery ? "?" + urlQuery : "");
|
|
2201
|
+
res.statusCode = 301;
|
|
2202
|
+
res.setHeader("Location", pathname);
|
|
2203
|
+
return res.end();
|
|
2204
|
+
} else
|
|
2205
|
+
pathname = urlPath;
|
|
2206
|
+
case "ignore":
|
|
2207
|
+
{
|
|
2208
|
+
if (isDirectory && !hasSlash) {
|
|
2209
|
+
pathname = urlPath + "/index.html";
|
|
2210
|
+
} else
|
|
2211
|
+
pathname = urlPath;
|
|
2212
|
+
}
|
|
2213
|
+
break;
|
|
2214
|
+
case "always":
|
|
2215
|
+
if (!hasSlash) {
|
|
2216
|
+
pathname = urlPath + "/" + (urlQuery ? "?" + urlQuery : "");
|
|
2217
|
+
res.statusCode = 301;
|
|
2218
|
+
res.setHeader("Location", pathname);
|
|
2219
|
+
return res.end();
|
|
2220
|
+
} else
|
|
2221
|
+
pathname = urlPath;
|
|
2222
|
+
break;
|
|
2223
|
+
}
|
|
2224
|
+
pathname = prependForwardSlash(app.removeBase(pathname));
|
|
2109
2225
|
const stream = send(req, pathname, {
|
|
2110
2226
|
root: client,
|
|
2111
2227
|
dotfiles: pathname.startsWith("/.well-known/") ? "allow" : "deny"
|
|
@@ -2125,18 +2241,6 @@ function createStaticHandler(app, options) {
|
|
|
2125
2241
|
_res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
|
|
2126
2242
|
}
|
|
2127
2243
|
});
|
|
2128
|
-
stream.on("directory", () => {
|
|
2129
|
-
let location;
|
|
2130
|
-
if (req.url.includes("?")) {
|
|
2131
|
-
const [url1 = "", search] = req.url.split("?");
|
|
2132
|
-
location = `${url1}/?${search}`;
|
|
2133
|
-
} else {
|
|
2134
|
-
location = appendForwardSlash(req.url);
|
|
2135
|
-
}
|
|
2136
|
-
res.statusCode = 301;
|
|
2137
|
-
res.setHeader("Location", location);
|
|
2138
|
-
res.end(location);
|
|
2139
|
-
});
|
|
2140
2244
|
stream.on("file", () => {
|
|
2141
2245
|
forwardError = true;
|
|
2142
2246
|
});
|
|
@@ -2155,6 +2259,9 @@ function resolveClientDir(options) {
|
|
|
2155
2259
|
const client = url.fileURLToPath(clientURL);
|
|
2156
2260
|
return client;
|
|
2157
2261
|
}
|
|
2262
|
+
function prependForwardSlash(pth) {
|
|
2263
|
+
return pth.startsWith("/") ? pth : "/" + pth;
|
|
2264
|
+
}
|
|
2158
2265
|
function appendForwardSlash(pth) {
|
|
2159
2266
|
return pth.endsWith("/") ? pth : pth + "/";
|
|
2160
2267
|
}
|
|
@@ -2308,6 +2415,7 @@ function createMiddleware(app) {
|
|
|
2308
2415
|
apply();
|
|
2309
2416
|
function createExports(manifest, options) {
|
|
2310
2417
|
const app = new NodeApp(manifest);
|
|
2418
|
+
options.trailingSlash = manifest.trailingSlash;
|
|
2311
2419
|
return {
|
|
2312
2420
|
options,
|
|
2313
2421
|
handler: options.mode === "middleware" ? createMiddleware(app) : createStandaloneHandler(app, options),
|
|
@@ -2322,32 +2430,47 @@ function start(manifest, options) {
|
|
|
2322
2430
|
standalone(app, options);
|
|
2323
2431
|
}
|
|
2324
2432
|
|
|
2325
|
-
const
|
|
2433
|
+
const serverEntrypointModule = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2326
2434
|
__proto__: null,
|
|
2327
2435
|
createExports,
|
|
2328
2436
|
start
|
|
2329
2437
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2330
2438
|
|
|
2331
|
-
const _page0
|
|
2332
|
-
const _page1
|
|
2333
|
-
const _page2
|
|
2334
|
-
const _page3
|
|
2335
|
-
const _page4
|
|
2336
|
-
const _page5
|
|
2439
|
+
const _page0 = () => import('./chunks/node_njrZIjT6.mjs');
|
|
2440
|
+
const _page1 = () => import('./chunks/~fallback_p7P7NIL5.mjs');
|
|
2441
|
+
const _page2 = () => import('./chunks/index__PeYBuja.mjs');
|
|
2442
|
+
const _page3 = () => import('./chunks/account_R4bpY7O1.mjs');
|
|
2443
|
+
const _page4 = () => import('./chunks/_page__9PfWVh79.mjs');
|
|
2444
|
+
const _page5 = () => import('./chunks/_.._yTK2xBRC.mjs');
|
|
2445
|
+
const pageMap = new Map([
|
|
2446
|
+
["../../node_modules/.pnpm/astro@4.3.1_@types+node@18.19.10_typescript@5.2.2/node_modules/astro/dist/assets/endpoint/node.js", _page0],
|
|
2447
|
+
["src/pages/~fallback.astro", _page1],
|
|
2448
|
+
["src/pages/app/index.astro", _page2],
|
|
2449
|
+
["src/pages/app/account.astro", _page3],
|
|
2450
|
+
["src/pages/blog/[page].astro", _page4],
|
|
2451
|
+
["src/pages/[...slug].astro", _page5]
|
|
2452
|
+
]);
|
|
2453
|
+
|
|
2337
2454
|
const _manifest = Object.assign(manifest, {
|
|
2338
|
-
|
|
2339
|
-
|
|
2455
|
+
pageMap,
|
|
2456
|
+
renderers,
|
|
2457
|
+
middleware: onRequest
|
|
2340
2458
|
});
|
|
2341
|
-
const _args = {
|
|
2342
|
-
|
|
2459
|
+
const _args = {
|
|
2460
|
+
"mode": "middleware",
|
|
2461
|
+
"client": "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/client/",
|
|
2462
|
+
"server": "file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/server/",
|
|
2463
|
+
"host": false,
|
|
2464
|
+
"port": 4321,
|
|
2465
|
+
"assets": "_astro"
|
|
2466
|
+
};
|
|
2343
2467
|
const _exports = createExports(_manifest, _args);
|
|
2344
2468
|
const handler = _exports['handler'];
|
|
2345
2469
|
const startServer = _exports['startServer'];
|
|
2346
2470
|
const options = _exports['options'];
|
|
2347
|
-
|
|
2348
2471
|
const _start = 'start';
|
|
2349
|
-
if(_start in
|
|
2350
|
-
|
|
2472
|
+
if (_start in serverEntrypointModule) {
|
|
2473
|
+
serverEntrypointModule[_start](_manifest, _args);
|
|
2351
2474
|
}
|
|
2352
2475
|
|
|
2353
2476
|
export { handler, options, pageMap, startServer };
|