cloudcommerce 0.37.1 → 0.38.0

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.
Files changed (142) hide show
  1. package/.github/workflows/test-apps.yml +2 -2
  2. package/.vscode/settings.json +1 -1
  3. package/CHANGELOG.md +36 -0
  4. package/action.yml +2 -2
  5. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  6. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  7. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  8. package/ecomplus-stores/barra-doce/package.json +2 -2
  9. package/package.json +7 -7
  10. package/packages/api/lib/api.d.ts +2 -2
  11. package/packages/api/package.json +1 -1
  12. package/packages/api/types.d.ts +4 -1
  13. package/packages/apps/affilate-program/package.json +1 -1
  14. package/packages/apps/correios/package.json +1 -1
  15. package/packages/apps/custom-payment/package.json +1 -1
  16. package/packages/apps/custom-shipping/package.json +1 -1
  17. package/packages/apps/datafrete/package.json +1 -1
  18. package/packages/apps/discounts/package.json +1 -1
  19. package/packages/apps/emails/package.json +1 -1
  20. package/packages/apps/fb-conversions/package.json +1 -1
  21. package/packages/apps/flash-courier/package.json +1 -1
  22. package/packages/apps/frenet/package.json +1 -1
  23. package/packages/apps/galaxpay/package.json +1 -1
  24. package/packages/apps/google-analytics/package.json +1 -1
  25. package/packages/apps/jadlog/package.json +1 -1
  26. package/packages/apps/loyalty-points/package.json +1 -1
  27. package/packages/apps/mandae/package.json +1 -1
  28. package/packages/apps/melhor-envio/package.json +1 -1
  29. package/packages/apps/mercadopago/package.json +1 -1
  30. package/packages/apps/pagarme/package.json +1 -1
  31. package/packages/apps/pagarme-v5/package.json +1 -1
  32. package/packages/apps/paghiper/package.json +1 -1
  33. package/packages/apps/pix/package.json +1 -1
  34. package/packages/apps/tiny-erp/package.json +1 -1
  35. package/packages/apps/webhooks/package.json +1 -1
  36. package/packages/cli/config/firestore.rules +4 -1
  37. package/packages/cli/lib/cli.js +30 -9
  38. package/packages/cli/package.json +2 -1
  39. package/packages/cli/src/cli.ts +37 -9
  40. package/packages/config/package.json +1 -1
  41. package/packages/emails/package.json +1 -1
  42. package/packages/eslint/package.json +3 -3
  43. package/packages/events/package.json +1 -1
  44. package/packages/feeds/package.json +1 -1
  45. package/packages/firebase/package.json +1 -1
  46. package/packages/i18n/package.json +1 -1
  47. package/packages/modules/package.json +1 -1
  48. package/packages/passport/package.json +1 -1
  49. package/packages/ssr/package.json +5 -5
  50. package/packages/storefront/.auto-imports.d.ts +1 -0
  51. package/packages/storefront/client.d.ts +1 -0
  52. package/packages/storefront/config/storefront.tailwind.cjs +21 -20
  53. package/packages/storefront/config/storefront.unocss.cjs +11 -0
  54. package/packages/storefront/dist/client/_astro/{AccountPage.700be123.js → AccountPage.j0C5JBLY.js} +1 -1
  55. package/packages/storefront/dist/client/_astro/{CartSidebar.430b55df.js → CartSidebar.1kUFk9Xn.js} +1 -1
  56. package/packages/storefront/dist/client/_astro/HeroSlider.tR1dVXyu.js +1 -0
  57. package/packages/storefront/dist/client/_astro/{PitchBar.06e0f831.js → PitchBar.FelC04wE.js} +1 -1
  58. package/packages/storefront/dist/client/_astro/{Prices.0e829c31.js → Prices.PuQc6C7F.js} +1 -1
  59. package/packages/storefront/dist/client/_astro/ProductCard.ephJafAE.js +1 -0
  60. package/packages/storefront/dist/client/_astro/ProductDetails.B6Ih5MGf.js +7 -0
  61. package/packages/storefront/dist/client/_astro/ProductShelf.GESxuPZ_.js +1 -0
  62. package/packages/storefront/dist/client/_astro/{QuantitySelector.ebf60845.js → QuantitySelector.YNmWjN8y.js} +1 -1
  63. package/packages/storefront/dist/client/_astro/SearchContainer.BzixfU3R.js +1 -0
  64. package/packages/storefront/dist/client/_astro/SearchModal.F7vbwxIv.js +1 -0
  65. package/packages/storefront/dist/client/_astro/ShopHeader.5vR1LgSW.js +10 -0
  66. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.sk5AFsEV.js +1 -0
  67. package/packages/storefront/dist/client/_astro/_slug_.r8QHNfdw.css +1 -0
  68. package/packages/storefront/dist/client/_astro/client.RF8UxjZd.js +1 -0
  69. package/packages/storefront/dist/client/_astro/customer-session._VkzXnXT.js +7 -0
  70. package/packages/storefront/dist/client/_astro/ecom-utils.gJYgRPRz.js +1 -0
  71. package/packages/storefront/dist/client/_astro/{firebase-app.992a296f.js → firebase-app.cPMfoOsn.js} +1 -1
  72. package/packages/storefront/dist/client/_astro/{format-money.9cf6b04d.js → format-money.FMQXgKHB.js} +1 -1
  73. package/packages/storefront/dist/client/_astro/{hoisted.c90fc6ab.js → hoisted.B6fKrLPR.js} +1 -1
  74. package/packages/storefront/dist/client/_astro/{hoisted.54eaab04.js → hoisted._FbzheVm.js} +1 -1
  75. package/packages/storefront/dist/client/_astro/{i18n.29216eeb.js → i18n.m7SpISxy.js} +1 -1
  76. package/packages/storefront/dist/client/_astro/{img.4f23a3dd.js → img.zh-Drf-O.js} +1 -1
  77. package/packages/storefront/dist/client/_astro/{index-61e5ac61.bdc8d0cd.js → index-dd468b12.D5s8VdAL.js} +92 -107
  78. package/packages/storefront/dist/client/_astro/{index.570b84fe.js → index.5PN-EYMS.js} +1 -1
  79. package/packages/storefront/dist/client/_astro/index.XrHFaN2F.js +1 -0
  80. package/packages/storefront/dist/client/_astro/{modules-info.55780599.js → modules-info.sD0tdb2b.js} +1 -1
  81. package/packages/storefront/dist/client/_astro/name.HU5l7TJo.js +1 -0
  82. package/packages/storefront/dist/client/_astro/{photoswipe-lightbox.esm.c157838f.js → photoswipe-lightbox.esm.dZBqKD9u.js} +1 -1
  83. package/packages/storefront/dist/client/_astro/{photoswipe.01431ec7.js → photoswipe.0V7m2jWu.js} +1 -2
  84. package/packages/storefront/dist/client/_astro/{photoswipe.esm.92c2d901.js → photoswipe.esm.Ylh9TGkz.js} +1 -1
  85. package/packages/storefront/dist/client/_astro/sf-utils.5t7r9A2G.js +1 -0
  86. package/packages/storefront/dist/client/_astro/{shopping-cart.d9f601dd.js → shopping-cart.A-1jhlKi.js} +1 -1
  87. package/packages/storefront/dist/client/_astro/use-analytics.1EVxbrS7.js +1 -0
  88. package/packages/storefront/dist/client/_astro/{use-product-card.437911bb.js → use-product-card.erbOV6Fv.js} +1 -1
  89. package/packages/storefront/dist/client/robots.txt +1 -0
  90. package/packages/storefront/dist/server/chunks/{CartSidebar_eab28771.mjs → CartSidebar_hAgJQJgm.mjs} +1 -1
  91. package/packages/storefront/dist/server/chunks/SearchModal_eWb5SdQM.mjs +351 -0
  92. package/packages/storefront/dist/server/chunks/{_.._5a781fb3.mjs → _.._S7DDBn_b.mjs} +1 -1
  93. package/packages/storefront/dist/server/chunks/{account_519edb70.mjs → account_3ySmGzMc.mjs} +1 -1
  94. package/packages/storefront/dist/server/chunks/astro/{assets-service_a9d9ab5f.mjs → assets-service_QlOZG8ov.mjs} +1 -1
  95. package/packages/storefront/dist/server/chunks/{astro_d98f7186.mjs → astro_zcC1GStV.mjs} +17 -34
  96. package/packages/storefront/dist/server/chunks/{index_5e3ed8a0.mjs → index_nIwq11oA.mjs} +1 -1
  97. package/packages/storefront/dist/server/chunks/{index_10e14f85.mjs → index_uAR5ZV4d.mjs} +1 -1
  98. package/packages/storefront/dist/server/chunks/{node_1119b0d1.mjs → node_2VvC7trl.mjs} +1 -1
  99. package/packages/storefront/dist/server/chunks/pages/{__93ade2dd.mjs → __MSibDuuV.mjs} +652 -255
  100. package/packages/storefront/dist/server/chunks/pages/{account_e5d410a7.mjs → account_iG-YqJ5q.mjs} +3 -2
  101. package/packages/storefront/dist/server/chunks/pages/{index_7e25afc1.mjs → index_BtDyKPh_.mjs} +3 -2
  102. package/packages/storefront/dist/server/chunks/pages/{node_bd378ac0.mjs → node_bKqL47eZ.mjs} +2 -2
  103. package/packages/storefront/dist/server/chunks/pages/{~fallback_73578d2f.mjs → ~fallback_73R5VA6j.mjs} +3 -2
  104. package/packages/storefront/dist/server/chunks/{photoswipe_9528923e.mjs → photoswipe_IcWDJiwc.mjs} +1 -1
  105. package/packages/storefront/dist/server/chunks/{~fallback_41122b9b.mjs → ~fallback_7q1dqY4e.mjs} +1 -1
  106. package/packages/storefront/dist/server/entry.mjs +970 -93
  107. package/packages/storefront/dist/server/manifest_dSwvaOdW.mjs +195 -0
  108. package/packages/storefront/dist/server/renderers.mjs +2 -2
  109. package/packages/storefront/package.json +12 -12
  110. package/packages/storefront/src/helpers/sf-utils.ts +29 -1
  111. package/packages/storefront/src/lib/composables/use-search-container.ts +48 -0
  112. package/packages/storefront/src/lib/composables/use-search-modal.ts +1 -1
  113. package/packages/storefront/src/lib/composables/use-shop-header.ts +14 -5
  114. package/packages/storefront/src/lib/composables/use-sticky-header.ts +2 -0
  115. package/packages/storefront/src/lib/layouts/BaseHead.astro +8 -1
  116. package/packages/storefront/src/lib/layouts/use-page-main.ts +15 -0
  117. package/packages/storefront/src/lib/scripts/firestore.ts +27 -0
  118. package/packages/storefront/src/lib/ssr-context.ts +14 -0
  119. package/packages/storefront/src/lib/state/search-engine.ts +62 -25
  120. package/packages/storefront/src/lib/state/use-analytics.ts +9 -10
  121. package/packages/test-base/package.json +1 -1
  122. package/packages/types/package.json +1 -1
  123. package/packages/storefront/dist/client/_astro/HeroSlider.bd684ed8.js +0 -1
  124. package/packages/storefront/dist/client/_astro/ProductDetails.06da998d.js +0 -1
  125. package/packages/storefront/dist/client/_astro/ProductShelf.3f4f38b5.js +0 -1
  126. package/packages/storefront/dist/client/_astro/ProductShelf.bf82838b.js +0 -1
  127. package/packages/storefront/dist/client/_astro/SearchModal.b6aa5ef7.js +0 -1
  128. package/packages/storefront/dist/client/_astro/ShopHeader.2d6e361a.js +0 -4
  129. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.f75743ee.js +0 -1
  130. package/packages/storefront/dist/client/_astro/_slug_.e7cac999.css +0 -1
  131. package/packages/storefront/dist/client/_astro/client.41b42098.js +0 -1
  132. package/packages/storefront/dist/client/_astro/customer-session.5ab9ab1a.js +0 -1
  133. package/packages/storefront/dist/client/_astro/ecom-utils.5cbfb95e.js +0 -1
  134. package/packages/storefront/dist/client/_astro/index.8ac1db99.js +0 -1
  135. package/packages/storefront/dist/client/_astro/name.01410784.js +0 -1
  136. package/packages/storefront/dist/client/_astro/sf-utils.b04e1813.js +0 -1
  137. package/packages/storefront/dist/client/_astro/use-analytics.cc95e346.js +0 -1
  138. package/packages/storefront/dist/server/chunks/SearchModal_f66549d4.mjs +0 -147
  139. package/packages/storefront/dist/server/manifest_221d806b.mjs +0 -1069
  140. /package/packages/storefront/dist/client/_astro/{afetch.f4507208.js → afetch.5c8VmT0-.js} +0 -0
  141. /package/packages/storefront/dist/client/_astro/{img-sizes.41e0efe4.js → img-sizes.gxAI9JNh.js} +0 -0
  142. /package/packages/storefront/dist/client/_astro/{price.04ceb6c4.js → price.Easct8WC.js} +0 -0
@@ -1,1069 +0,0 @@
1
- import { trimSlashes } from '@astrojs/internal-helpers/path';
2
- import { serialize, parse } from 'cookie';
3
- import { bold } from 'kleur/colors';
4
- import 'string-width';
5
- import mime from 'mime';
6
- import { A as AstroError, q as ResponseSentError, w as MiddlewareNoDataOrNextCalled, x as MiddlewareNotAResponse, G as GetStaticPathsRequired, y as InvalidGetStaticPathsReturn, z as InvalidGetStaticPathsEntry, B as GetStaticPathsExpectedParams, D as GetStaticPathsInvalidRouteParam, P as PageNumberParamNotFound, H as GetStaticPathsRemovedRSSHelper, N as NoMatchingStaticPathFound, J as PrerenderDynamicEndpointPathCollide, K as LocalsNotAnObject, O as ASTRO_VERSION, C as ClientAddressNotAvailable, S as StaticClientAddressNotAvailable, Q as renderEndpoint } from './chunks/astro_d98f7186.mjs';
7
- import 'clsx';
8
- import { compile } from 'path-to-regexp';
9
-
10
- const DELETED_EXPIRATION = /* @__PURE__ */ new Date(0);
11
- const DELETED_VALUE = "deleted";
12
- const responseSentSymbol = Symbol.for("astro.responseSent");
13
- class AstroCookie {
14
- constructor(value) {
15
- this.value = value;
16
- }
17
- json() {
18
- if (this.value === void 0) {
19
- throw new Error(`Cannot convert undefined to an object.`);
20
- }
21
- return JSON.parse(this.value);
22
- }
23
- number() {
24
- return Number(this.value);
25
- }
26
- boolean() {
27
- if (this.value === "false")
28
- return false;
29
- if (this.value === "0")
30
- return false;
31
- return Boolean(this.value);
32
- }
33
- }
34
- class AstroCookies {
35
- #request;
36
- #requestValues;
37
- #outgoing;
38
- constructor(request) {
39
- this.#request = request;
40
- this.#requestValues = null;
41
- this.#outgoing = null;
42
- }
43
- /**
44
- * Astro.cookies.delete(key) is used to delete a cookie. Using this method will result
45
- * in a Set-Cookie header added to the response.
46
- * @param key The cookie to delete
47
- * @param options Options related to this deletion, such as the path of the cookie.
48
- */
49
- delete(key, options) {
50
- const serializeOptions = {
51
- expires: DELETED_EXPIRATION
52
- };
53
- if (options?.domain) {
54
- serializeOptions.domain = options.domain;
55
- }
56
- if (options?.path) {
57
- serializeOptions.path = options.path;
58
- }
59
- this.#ensureOutgoingMap().set(key, [
60
- DELETED_VALUE,
61
- serialize(key, DELETED_VALUE, serializeOptions),
62
- false
63
- ]);
64
- }
65
- /**
66
- * Astro.cookies.get(key) is used to get a cookie value. The cookie value is read from the
67
- * request. If you have set a cookie via Astro.cookies.set(key, value), the value will be taken
68
- * from that set call, overriding any values already part of the request.
69
- * @param key The cookie to get.
70
- * @returns An object containing the cookie value as well as convenience methods for converting its value.
71
- */
72
- get(key) {
73
- if (this.#outgoing?.has(key)) {
74
- let [serializedValue, , isSetValue] = this.#outgoing.get(key);
75
- if (isSetValue) {
76
- return new AstroCookie(serializedValue);
77
- } else {
78
- return void 0;
79
- }
80
- }
81
- const values = this.#ensureParsed();
82
- if (key in values) {
83
- const value = values[key];
84
- return new AstroCookie(value);
85
- }
86
- }
87
- /**
88
- * Astro.cookies.has(key) returns a boolean indicating whether this cookie is either
89
- * part of the initial request or set via Astro.cookies.set(key)
90
- * @param key The cookie to check for.
91
- * @returns
92
- */
93
- has(key) {
94
- if (this.#outgoing?.has(key)) {
95
- let [, , isSetValue] = this.#outgoing.get(key);
96
- return isSetValue;
97
- }
98
- const values = this.#ensureParsed();
99
- return !!values[key];
100
- }
101
- /**
102
- * Astro.cookies.set(key, value) is used to set a cookie's value. If provided
103
- * an object it will be stringified via JSON.stringify(value). Additionally you
104
- * can provide options customizing how this cookie will be set, such as setting httpOnly
105
- * in order to prevent the cookie from being read in client-side JavaScript.
106
- * @param key The name of the cookie to set.
107
- * @param value A value, either a string or other primitive or an object.
108
- * @param options Options for the cookie, such as the path and security settings.
109
- */
110
- set(key, value, options) {
111
- let serializedValue;
112
- if (typeof value === "string") {
113
- serializedValue = value;
114
- } else {
115
- let toStringValue = value.toString();
116
- if (toStringValue === Object.prototype.toString.call(value)) {
117
- serializedValue = JSON.stringify(value);
118
- } else {
119
- serializedValue = toStringValue;
120
- }
121
- }
122
- const serializeOptions = {};
123
- if (options) {
124
- Object.assign(serializeOptions, options);
125
- }
126
- this.#ensureOutgoingMap().set(key, [
127
- serializedValue,
128
- serialize(key, serializedValue, serializeOptions),
129
- true
130
- ]);
131
- if (this.#request[responseSentSymbol]) {
132
- throw new AstroError({
133
- ...ResponseSentError
134
- });
135
- }
136
- }
137
- /**
138
- * Astro.cookies.header() returns an iterator for the cookies that have previously
139
- * been set by either Astro.cookies.set() or Astro.cookies.delete().
140
- * This method is primarily used by adapters to set the header on outgoing responses.
141
- * @returns
142
- */
143
- *headers() {
144
- if (this.#outgoing == null)
145
- return;
146
- for (const [, value] of this.#outgoing) {
147
- yield value[1];
148
- }
149
- }
150
- #ensureParsed() {
151
- if (!this.#requestValues) {
152
- this.#parse();
153
- }
154
- if (!this.#requestValues) {
155
- this.#requestValues = {};
156
- }
157
- return this.#requestValues;
158
- }
159
- #ensureOutgoingMap() {
160
- if (!this.#outgoing) {
161
- this.#outgoing = /* @__PURE__ */ new Map();
162
- }
163
- return this.#outgoing;
164
- }
165
- #parse() {
166
- const raw = this.#request.headers.get("cookie");
167
- if (!raw) {
168
- return;
169
- }
170
- this.#requestValues = parse(raw);
171
- }
172
- }
173
-
174
- const astroCookiesSymbol = Symbol.for("astro.cookies");
175
- function attachCookiesToResponse(response, cookies) {
176
- Reflect.set(response, astroCookiesSymbol, cookies);
177
- }
178
- function responseHasCookies(response) {
179
- return Reflect.has(response, astroCookiesSymbol);
180
- }
181
- function getFromResponse(response) {
182
- let cookies = Reflect.get(response, astroCookiesSymbol);
183
- if (cookies != null) {
184
- return cookies;
185
- } else {
186
- return void 0;
187
- }
188
- }
189
- function* getSetCookiesFromResponse(response) {
190
- const cookies = getFromResponse(response);
191
- if (!cookies) {
192
- return [];
193
- }
194
- for (const headerValue of cookies.headers()) {
195
- yield headerValue;
196
- }
197
- return [];
198
- }
199
-
200
- const dateTimeFormat = new Intl.DateTimeFormat([], {
201
- hour: "2-digit",
202
- minute: "2-digit",
203
- second: "2-digit"
204
- });
205
- const levels = {
206
- debug: 20,
207
- info: 30,
208
- warn: 40,
209
- error: 50,
210
- silent: 90
211
- };
212
- function log(opts, level, label, message) {
213
- const logLevel = opts.level;
214
- const dest = opts.dest;
215
- const event = {
216
- label,
217
- level,
218
- message
219
- };
220
- if (levels[logLevel] > levels[level]) {
221
- return;
222
- }
223
- dest.write(event);
224
- }
225
- function info(opts, label, message) {
226
- return log(opts, "info", label, message);
227
- }
228
- function warn(opts, label, message) {
229
- return log(opts, "warn", label, message);
230
- }
231
- function error(opts, label, message) {
232
- return log(opts, "error", label, message);
233
- }
234
- function debug(...args) {
235
- if ("_astroGlobalDebug" in globalThis) {
236
- globalThis._astroGlobalDebug(...args);
237
- }
238
- }
239
- if (typeof process !== "undefined") {
240
- let proc = process;
241
- if ("argv" in proc && Array.isArray(proc.argv)) {
242
- if (proc.argv.includes("--verbose")) ; else if (proc.argv.includes("--silent")) ; else ;
243
- }
244
- }
245
- class Logger {
246
- options;
247
- constructor(options) {
248
- this.options = options;
249
- }
250
- info(label, message) {
251
- info(this.options, label, message);
252
- }
253
- warn(label, message) {
254
- warn(this.options, label, message);
255
- }
256
- error(label, message) {
257
- error(this.options, label, message);
258
- }
259
- debug(label, ...messages) {
260
- debug(label, ...messages);
261
- }
262
- level() {
263
- return this.options.level;
264
- }
265
- forkIntegrationLogger(label) {
266
- return new AstroIntegrationLogger(this.options, label);
267
- }
268
- }
269
- class AstroIntegrationLogger {
270
- options;
271
- label;
272
- constructor(logging, label) {
273
- this.options = logging;
274
- this.label = label;
275
- }
276
- /**
277
- * Creates a new logger instance with a new label, but the same log options.
278
- */
279
- fork(label) {
280
- return new AstroIntegrationLogger(this.options, label);
281
- }
282
- info(message) {
283
- info(this.options, this.label, message);
284
- }
285
- warn(message) {
286
- warn(this.options, this.label, message);
287
- }
288
- error(message) {
289
- error(this.options, this.label, message);
290
- }
291
- debug(message) {
292
- debug(this.label, message);
293
- }
294
- }
295
-
296
- async function callMiddleware(logger, onRequest, apiContext, responseFunction) {
297
- let nextCalled = false;
298
- let responseFunctionPromise = void 0;
299
- const next = async () => {
300
- nextCalled = true;
301
- responseFunctionPromise = responseFunction();
302
- return responseFunctionPromise;
303
- };
304
- let middlewarePromise = onRequest(apiContext, next);
305
- return await Promise.resolve(middlewarePromise).then(async (value) => {
306
- if (isEndpointOutput(value)) {
307
- logger.warn(
308
- "middleware",
309
- `Using simple endpoints can cause unexpected issues in the chain of middleware functions.
310
- It's strongly suggested to use full ${bold("Response")} objects.`
311
- );
312
- }
313
- if (nextCalled) {
314
- if (typeof value !== "undefined") {
315
- if (value instanceof Response === false) {
316
- throw new AstroError(MiddlewareNotAResponse);
317
- }
318
- return ensureCookiesAttached(apiContext, value);
319
- } else {
320
- if (responseFunctionPromise) {
321
- return responseFunctionPromise;
322
- } else {
323
- throw new AstroError(MiddlewareNotAResponse);
324
- }
325
- }
326
- } else if (typeof value === "undefined") {
327
- throw new AstroError(MiddlewareNoDataOrNextCalled);
328
- } else if (value instanceof Response === false) {
329
- throw new AstroError(MiddlewareNotAResponse);
330
- } else {
331
- return ensureCookiesAttached(apiContext, value);
332
- }
333
- });
334
- }
335
- function ensureCookiesAttached(apiContext, response) {
336
- if (apiContext.cookies !== void 0 && !responseHasCookies(response)) {
337
- attachCookiesToResponse(response, apiContext.cookies);
338
- }
339
- return response;
340
- }
341
- function isEndpointOutput(endpointResult) {
342
- return !(endpointResult instanceof Response) && typeof endpointResult === "object" && typeof endpointResult.body === "string";
343
- }
344
-
345
- function normalizeTheLocale(locale) {
346
- return locale.replaceAll("_", "-").toLowerCase();
347
- }
348
-
349
- function routeIsRedirect(route) {
350
- return route?.type === "redirect";
351
- }
352
- function routeIsFallback(route) {
353
- return route?.type === "fallback";
354
- }
355
- function redirectRouteGenerate(redirectRoute, data) {
356
- const routeData = redirectRoute.redirectRoute;
357
- const route = redirectRoute.redirect;
358
- if (typeof routeData !== "undefined") {
359
- return routeData?.generate(data) || routeData?.pathname || "/";
360
- } else if (typeof route === "string") {
361
- return route;
362
- } else if (typeof route === "undefined") {
363
- return "/";
364
- }
365
- return route.destination;
366
- }
367
- function redirectRouteStatus(redirectRoute, method = "GET") {
368
- const routeData = redirectRoute.redirectRoute;
369
- if (typeof routeData?.redirect === "object") {
370
- return routeData.redirect.status;
371
- } else if (method !== "GET") {
372
- return 308;
373
- }
374
- return 301;
375
- }
376
-
377
- const VALID_PARAM_TYPES = ["string", "number", "undefined"];
378
- function validateGetStaticPathsParameter([key, value], route) {
379
- if (!VALID_PARAM_TYPES.includes(typeof value)) {
380
- throw new AstroError({
381
- ...GetStaticPathsInvalidRouteParam,
382
- message: GetStaticPathsInvalidRouteParam.message(key, value, typeof value),
383
- location: {
384
- file: route
385
- }
386
- });
387
- }
388
- }
389
- function validateDynamicRouteModule(mod, {
390
- ssr,
391
- route
392
- }) {
393
- if ((!ssr || route.prerender) && !mod.getStaticPaths) {
394
- throw new AstroError({
395
- ...GetStaticPathsRequired,
396
- location: { file: route.component }
397
- });
398
- }
399
- }
400
- function validateGetStaticPathsResult(result, logger, route) {
401
- if (!Array.isArray(result)) {
402
- throw new AstroError({
403
- ...InvalidGetStaticPathsReturn,
404
- message: InvalidGetStaticPathsReturn.message(typeof result),
405
- location: {
406
- file: route.component
407
- }
408
- });
409
- }
410
- result.forEach((pathObject) => {
411
- if (typeof pathObject === "object" && Array.isArray(pathObject) || pathObject === null) {
412
- throw new AstroError({
413
- ...InvalidGetStaticPathsEntry,
414
- message: InvalidGetStaticPathsEntry.message(
415
- Array.isArray(pathObject) ? "array" : typeof pathObject
416
- )
417
- });
418
- }
419
- if (pathObject.params === void 0 || pathObject.params === null || pathObject.params && Object.keys(pathObject.params).length === 0) {
420
- throw new AstroError({
421
- ...GetStaticPathsExpectedParams,
422
- location: {
423
- file: route.component
424
- }
425
- });
426
- }
427
- for (const [key, val] of Object.entries(pathObject.params)) {
428
- if (!(typeof val === "undefined" || typeof val === "string" || typeof val === "number")) {
429
- logger.warn(
430
- "getStaticPaths",
431
- `invalid path param: ${key}. A string, number or undefined value was expected, but got \`${JSON.stringify(
432
- val
433
- )}\`.`
434
- );
435
- }
436
- if (typeof val === "string" && val === "") {
437
- logger.warn(
438
- "getStaticPaths",
439
- `invalid path param: ${key}. \`undefined\` expected for an optional param, but got empty string.`
440
- );
441
- }
442
- }
443
- });
444
- }
445
-
446
- function getParams(array) {
447
- const fn = (match) => {
448
- const params = {};
449
- array.forEach((key, i) => {
450
- if (key.startsWith("...")) {
451
- params[key.slice(3)] = match[i + 1] ? decodeURIComponent(match[i + 1]) : void 0;
452
- } else {
453
- params[key] = decodeURIComponent(match[i + 1]);
454
- }
455
- });
456
- return params;
457
- };
458
- return fn;
459
- }
460
- function stringifyParams(params, route) {
461
- const validatedParams = Object.entries(params).reduce((acc, next) => {
462
- validateGetStaticPathsParameter(next, route.component);
463
- const [key, value] = next;
464
- if (value !== void 0) {
465
- acc[key] = typeof value === "string" ? trimSlashes(value) : value.toString();
466
- }
467
- return acc;
468
- }, {});
469
- return JSON.stringify(route.generate(validatedParams));
470
- }
471
-
472
- function generatePaginateFunction(routeMatch) {
473
- return function paginateUtility(data, args = {}) {
474
- let { pageSize: _pageSize, params: _params, props: _props } = args;
475
- const pageSize = _pageSize || 10;
476
- const paramName = "page";
477
- const additionalParams = _params || {};
478
- const additionalProps = _props || {};
479
- let includesFirstPageNumber;
480
- if (routeMatch.params.includes(`...${paramName}`)) {
481
- includesFirstPageNumber = false;
482
- } else if (routeMatch.params.includes(`${paramName}`)) {
483
- includesFirstPageNumber = true;
484
- } else {
485
- throw new AstroError({
486
- ...PageNumberParamNotFound,
487
- message: PageNumberParamNotFound.message(paramName)
488
- });
489
- }
490
- const lastPage = Math.max(1, Math.ceil(data.length / pageSize));
491
- const result = [...Array(lastPage).keys()].map((num) => {
492
- const pageNum = num + 1;
493
- const start = pageSize === Infinity ? 0 : (pageNum - 1) * pageSize;
494
- const end = Math.min(start + pageSize, data.length);
495
- const params = {
496
- ...additionalParams,
497
- [paramName]: includesFirstPageNumber || pageNum > 1 ? String(pageNum) : void 0
498
- };
499
- const current = correctIndexRoute(routeMatch.generate({ ...params }));
500
- const next = pageNum === lastPage ? void 0 : correctIndexRoute(routeMatch.generate({ ...params, page: String(pageNum + 1) }));
501
- const prev = pageNum === 1 ? void 0 : correctIndexRoute(
502
- routeMatch.generate({
503
- ...params,
504
- page: !includesFirstPageNumber && pageNum - 1 === 1 ? void 0 : String(pageNum - 1)
505
- })
506
- );
507
- return {
508
- params,
509
- props: {
510
- ...additionalProps,
511
- page: {
512
- data: data.slice(start, end),
513
- start,
514
- end: end - 1,
515
- size: pageSize,
516
- total: data.length,
517
- currentPage: pageNum,
518
- lastPage,
519
- url: { current, next, prev }
520
- }
521
- }
522
- };
523
- });
524
- return result;
525
- };
526
- }
527
- function correctIndexRoute(route) {
528
- if (route === "") {
529
- return "/";
530
- }
531
- return route;
532
- }
533
-
534
- async function callGetStaticPaths({
535
- mod,
536
- route,
537
- routeCache,
538
- logger,
539
- ssr
540
- }) {
541
- const cached = routeCache.get(route);
542
- if (!mod) {
543
- throw new Error("This is an error caused by Astro and not your code. Please file an issue.");
544
- }
545
- if (cached?.staticPaths) {
546
- return cached.staticPaths;
547
- }
548
- validateDynamicRouteModule(mod, { ssr, route });
549
- if (ssr && !route.prerender) {
550
- const entry = Object.assign([], { keyed: /* @__PURE__ */ new Map() });
551
- routeCache.set(route, { ...cached, staticPaths: entry });
552
- return entry;
553
- }
554
- let staticPaths = [];
555
- if (!mod.getStaticPaths) {
556
- throw new Error("Unexpected Error.");
557
- }
558
- staticPaths = await mod.getStaticPaths({
559
- // Q: Why the cast?
560
- // A: So users downstream can have nicer typings, we have to make some sacrifice in our internal typings, which necessitate a cast here
561
- paginate: generatePaginateFunction(route),
562
- rss() {
563
- throw new AstroError(GetStaticPathsRemovedRSSHelper);
564
- }
565
- });
566
- validateGetStaticPathsResult(staticPaths, logger, route);
567
- const keyedStaticPaths = staticPaths;
568
- keyedStaticPaths.keyed = /* @__PURE__ */ new Map();
569
- for (const sp of keyedStaticPaths) {
570
- const paramsKey = stringifyParams(sp.params, route);
571
- keyedStaticPaths.keyed.set(paramsKey, sp);
572
- }
573
- routeCache.set(route, { ...cached, staticPaths: keyedStaticPaths });
574
- return keyedStaticPaths;
575
- }
576
- class RouteCache {
577
- logger;
578
- cache = {};
579
- mode;
580
- constructor(logger, mode = "production") {
581
- this.logger = logger;
582
- this.mode = mode;
583
- }
584
- /** Clear the cache. */
585
- clearAll() {
586
- this.cache = {};
587
- }
588
- set(route, entry) {
589
- if (this.mode === "production" && this.cache[route.component]?.staticPaths) {
590
- this.logger.warn(
591
- "routeCache",
592
- `Internal Warning: route cache overwritten. (${route.component})`
593
- );
594
- }
595
- this.cache[route.component] = entry;
596
- }
597
- get(route) {
598
- return this.cache[route.component];
599
- }
600
- }
601
- function findPathItemByKey(staticPaths, params, route, logger) {
602
- const paramsKey = stringifyParams(params, route);
603
- const matchedStaticPath = staticPaths.keyed.get(paramsKey);
604
- if (matchedStaticPath) {
605
- return matchedStaticPath;
606
- }
607
- logger.debug("findPathItemByKey", `Unexpected cache miss looking for ${paramsKey}`);
608
- }
609
-
610
- async function getParamsAndProps(opts) {
611
- const { logger, mod, route, routeCache, pathname, ssr } = opts;
612
- if (!route || route.pathname) {
613
- return [{}, {}];
614
- }
615
- const params = getRouteParams(route, pathname) ?? {};
616
- if (routeIsRedirect(route) || routeIsFallback(route)) {
617
- return [params, {}];
618
- }
619
- if (mod) {
620
- validatePrerenderEndpointCollision(route, mod, params);
621
- }
622
- const staticPaths = await callGetStaticPaths({
623
- mod,
624
- route,
625
- routeCache,
626
- logger,
627
- ssr
628
- });
629
- const matchedStaticPath = findPathItemByKey(staticPaths, params, route, logger);
630
- if (!matchedStaticPath && (ssr ? route.prerender : true)) {
631
- throw new AstroError({
632
- ...NoMatchingStaticPathFound,
633
- message: NoMatchingStaticPathFound.message(pathname),
634
- hint: NoMatchingStaticPathFound.hint([route.component])
635
- });
636
- }
637
- const props = matchedStaticPath?.props ? { ...matchedStaticPath.props } : {};
638
- return [params, props];
639
- }
640
- function getRouteParams(route, pathname) {
641
- if (route.params.length) {
642
- const paramsMatch = route.pattern.exec(decodeURIComponent(pathname));
643
- if (paramsMatch) {
644
- return getParams(route.params)(paramsMatch);
645
- }
646
- }
647
- }
648
- function validatePrerenderEndpointCollision(route, mod, params) {
649
- if (route.type === "endpoint" && mod.getStaticPaths) {
650
- const lastSegment = route.segments[route.segments.length - 1];
651
- const paramValues = Object.values(params);
652
- const lastParam = paramValues[paramValues.length - 1];
653
- if (lastSegment.length === 1 && lastSegment[0].dynamic && lastParam === void 0) {
654
- throw new AstroError({
655
- ...PrerenderDynamicEndpointPathCollide,
656
- message: PrerenderDynamicEndpointPathCollide.message(route.route),
657
- hint: PrerenderDynamicEndpointPathCollide.hint(route.component),
658
- location: {
659
- file: route.component
660
- }
661
- });
662
- }
663
- }
664
- }
665
-
666
- const clientLocalsSymbol$1 = Symbol.for("astro.locals");
667
- async function createRenderContext(options) {
668
- const request = options.request;
669
- const pathname = options.pathname ?? new URL(request.url).pathname;
670
- const [params, props] = await getParamsAndProps({
671
- mod: options.mod,
672
- route: options.route,
673
- routeCache: options.env.routeCache,
674
- pathname,
675
- logger: options.env.logger,
676
- ssr: options.env.ssr
677
- });
678
- const context = {
679
- ...options,
680
- pathname,
681
- params,
682
- props,
683
- locales: options.locales,
684
- routingStrategy: options.routingStrategy,
685
- defaultLocale: options.defaultLocale
686
- };
687
- Object.defineProperty(context, "locals", {
688
- enumerable: true,
689
- get() {
690
- return Reflect.get(request, clientLocalsSymbol$1);
691
- },
692
- set(val) {
693
- if (typeof val !== "object") {
694
- throw new AstroError(LocalsNotAnObject);
695
- } else {
696
- Reflect.set(request, clientLocalsSymbol$1, val);
697
- }
698
- }
699
- });
700
- return context;
701
- }
702
- function parseLocale(header) {
703
- if (header === "*") {
704
- return [{ locale: header, qualityValue: void 0 }];
705
- }
706
- const result = [];
707
- const localeValues = header.split(",").map((str) => str.trim());
708
- for (const localeValue of localeValues) {
709
- const split = localeValue.split(";").map((str) => str.trim());
710
- const localeName = split[0];
711
- const qualityValue = split[1];
712
- if (!split) {
713
- continue;
714
- }
715
- if (qualityValue && qualityValue.startsWith("q=")) {
716
- const qualityValueAsFloat = Number.parseFloat(qualityValue.slice("q=".length));
717
- if (Number.isNaN(qualityValueAsFloat) || qualityValueAsFloat > 1) {
718
- result.push({
719
- locale: localeName,
720
- qualityValue: void 0
721
- });
722
- } else {
723
- result.push({
724
- locale: localeName,
725
- qualityValue: qualityValueAsFloat
726
- });
727
- }
728
- } else {
729
- result.push({
730
- locale: localeName,
731
- qualityValue: void 0
732
- });
733
- }
734
- }
735
- return result;
736
- }
737
- function sortAndFilterLocales(browserLocaleList, locales) {
738
- const normalizedLocales = locales.map(normalizeTheLocale);
739
- return browserLocaleList.filter((browserLocale) => {
740
- if (browserLocale.locale !== "*") {
741
- return normalizedLocales.includes(normalizeTheLocale(browserLocale.locale));
742
- }
743
- return true;
744
- }).sort((a, b) => {
745
- if (a.qualityValue && b.qualityValue) {
746
- if (a.qualityValue > b.qualityValue) {
747
- return -1;
748
- } else if (a.qualityValue < b.qualityValue) {
749
- return 1;
750
- }
751
- }
752
- return 0;
753
- });
754
- }
755
- function computePreferredLocale(request, locales) {
756
- const acceptHeader = request.headers.get("Accept-Language");
757
- let result = void 0;
758
- if (acceptHeader) {
759
- const browserLocaleList = sortAndFilterLocales(parseLocale(acceptHeader), locales);
760
- const firstResult = browserLocaleList.at(0);
761
- if (firstResult) {
762
- if (firstResult.locale !== "*") {
763
- result = locales.find(
764
- (locale) => normalizeTheLocale(locale) === normalizeTheLocale(firstResult.locale)
765
- );
766
- }
767
- }
768
- }
769
- return result;
770
- }
771
- function computePreferredLocaleList(request, locales) {
772
- const acceptHeader = request.headers.get("Accept-Language");
773
- let result = [];
774
- if (acceptHeader) {
775
- const browserLocaleList = sortAndFilterLocales(parseLocale(acceptHeader), locales);
776
- if (browserLocaleList.length === 1 && browserLocaleList.at(0).locale === "*") {
777
- return locales;
778
- } else if (browserLocaleList.length > 0) {
779
- for (const browserLocale of browserLocaleList) {
780
- const found = locales.find(
781
- (l) => normalizeTheLocale(l) === normalizeTheLocale(browserLocale.locale)
782
- );
783
- if (found) {
784
- result.push(found);
785
- }
786
- }
787
- }
788
- }
789
- return result;
790
- }
791
- function computeCurrentLocale(request, locales, routingStrategy, defaultLocale) {
792
- const requestUrl = new URL(request.url);
793
- for (const segment of requestUrl.pathname.split("/")) {
794
- for (const locale of locales) {
795
- if (normalizeTheLocale(locale) === normalizeTheLocale(segment)) {
796
- return locale;
797
- }
798
- }
799
- }
800
- if (routingStrategy === "prefix-other-locales") {
801
- return defaultLocale;
802
- }
803
- return void 0;
804
- }
805
-
806
- const encoder = new TextEncoder();
807
- const clientAddressSymbol = Symbol.for("astro.clientAddress");
808
- const clientLocalsSymbol = Symbol.for("astro.locals");
809
- function createAPIContext({
810
- request,
811
- params,
812
- site,
813
- props,
814
- adapterName,
815
- locales,
816
- routingStrategy,
817
- defaultLocale
818
- }) {
819
- let preferredLocale = void 0;
820
- let preferredLocaleList = void 0;
821
- let currentLocale = void 0;
822
- const context = {
823
- cookies: new AstroCookies(request),
824
- request,
825
- params,
826
- site: site ? new URL(site) : void 0,
827
- generator: `Astro v${ASTRO_VERSION}`,
828
- props,
829
- redirect(path, status) {
830
- return new Response(null, {
831
- status: status || 302,
832
- headers: {
833
- Location: path
834
- }
835
- });
836
- },
837
- ResponseWithEncoding,
838
- get preferredLocale() {
839
- if (preferredLocale) {
840
- return preferredLocale;
841
- }
842
- if (locales) {
843
- preferredLocale = computePreferredLocale(request, locales);
844
- return preferredLocale;
845
- }
846
- return void 0;
847
- },
848
- get preferredLocaleList() {
849
- if (preferredLocaleList) {
850
- return preferredLocaleList;
851
- }
852
- if (locales) {
853
- preferredLocaleList = computePreferredLocaleList(request, locales);
854
- return preferredLocaleList;
855
- }
856
- return void 0;
857
- },
858
- get currentLocale() {
859
- if (currentLocale) {
860
- return currentLocale;
861
- }
862
- if (locales) {
863
- currentLocale = computeCurrentLocale(request, locales, routingStrategy, defaultLocale);
864
- }
865
- return currentLocale;
866
- },
867
- url: new URL(request.url),
868
- get clientAddress() {
869
- if (clientAddressSymbol in request) {
870
- return Reflect.get(request, clientAddressSymbol);
871
- }
872
- if (adapterName) {
873
- throw new AstroError({
874
- ...ClientAddressNotAvailable,
875
- message: ClientAddressNotAvailable.message(adapterName)
876
- });
877
- } else {
878
- throw new AstroError(StaticClientAddressNotAvailable);
879
- }
880
- },
881
- get locals() {
882
- let locals = Reflect.get(request, clientLocalsSymbol);
883
- if (locals === void 0) {
884
- locals = {};
885
- Reflect.set(request, clientLocalsSymbol, locals);
886
- }
887
- if (typeof locals !== "object") {
888
- throw new AstroError(LocalsNotAnObject);
889
- }
890
- return locals;
891
- },
892
- // We define a custom property, so we can check the value passed to locals
893
- set locals(val) {
894
- if (typeof val !== "object") {
895
- throw new AstroError(LocalsNotAnObject);
896
- } else {
897
- Reflect.set(request, clientLocalsSymbol, val);
898
- }
899
- }
900
- };
901
- return context;
902
- }
903
- class ResponseWithEncoding extends Response {
904
- constructor(body, init, encoding) {
905
- if (typeof body === "string") {
906
- if (typeof Buffer !== "undefined" && Buffer.from) {
907
- body = Buffer.from(body, encoding);
908
- } else if (encoding == null || encoding === "utf8" || encoding === "utf-8") {
909
- body = encoder.encode(body);
910
- }
911
- }
912
- super(body, init);
913
- if (encoding) {
914
- this.headers.set("X-Astro-Encoding", encoding);
915
- }
916
- }
917
- }
918
- async function callEndpoint(mod, env, ctx, onRequest) {
919
- const context = createAPIContext({
920
- request: ctx.request,
921
- params: ctx.params,
922
- props: ctx.props,
923
- site: env.site,
924
- adapterName: env.adapterName,
925
- routingStrategy: ctx.routingStrategy,
926
- defaultLocale: ctx.defaultLocale,
927
- locales: ctx.locales
928
- });
929
- let response;
930
- if (onRequest) {
931
- response = await callMiddleware(
932
- env.logger,
933
- onRequest,
934
- context,
935
- async () => {
936
- return await renderEndpoint(mod, context, env.ssr, env.logger);
937
- }
938
- );
939
- } else {
940
- response = await renderEndpoint(mod, context, env.ssr, env.logger);
941
- }
942
- const isEndpointSSR = env.ssr && !ctx.route?.prerender;
943
- if (response instanceof Response) {
944
- if (isEndpointSSR && response.headers.get("X-Astro-Encoding")) {
945
- env.logger.warn(
946
- "ssr",
947
- "`ResponseWithEncoding` is ignored in SSR. Please return an instance of Response. See https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes for more information."
948
- );
949
- }
950
- attachCookiesToResponse(response, context.cookies);
951
- return response;
952
- }
953
- env.logger.warn(
954
- "astro",
955
- `${ctx.route.component} returns a simple object which is deprecated. Please return an instance of Response. See https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes for more information.`
956
- );
957
- if (isEndpointSSR) {
958
- if (response.hasOwnProperty("headers")) {
959
- env.logger.warn(
960
- "ssr",
961
- "Setting headers is not supported when returning an object. Please return an instance of Response. See https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes for more information."
962
- );
963
- }
964
- if (response.encoding) {
965
- env.logger.warn(
966
- "ssr",
967
- "`encoding` is ignored in SSR. To return a charset other than UTF-8, please return an instance of Response. See https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes for more information."
968
- );
969
- }
970
- }
971
- let body;
972
- const headers = new Headers();
973
- const pathname = ctx.route ? (
974
- // Try the static route `pathname`
975
- ctx.route.pathname ?? // Dynamic routes don't include `pathname`, so synthesize a path for these (e.g. 'src/pages/[slug].svg')
976
- ctx.route.segments.map((s) => s.map((p) => p.content).join("")).join("/")
977
- ) : (
978
- // Fallback to pathname of the request
979
- ctx.pathname
980
- );
981
- const mimeType = mime.getType(pathname) || "text/plain";
982
- headers.set("Content-Type", `${mimeType};charset=utf-8`);
983
- if (response.encoding) {
984
- headers.set("X-Astro-Encoding", response.encoding);
985
- }
986
- if (response.body instanceof Uint8Array) {
987
- body = response.body;
988
- headers.set("Content-Length", body.byteLength.toString());
989
- } else if (typeof Buffer !== "undefined" && Buffer.from) {
990
- body = Buffer.from(response.body, response.encoding);
991
- headers.set("Content-Length", body.byteLength.toString());
992
- } else if (response.encoding == null || response.encoding === "utf8" || response.encoding === "utf-8") {
993
- body = encoder.encode(response.body);
994
- headers.set("Content-Length", body.byteLength.toString());
995
- } else {
996
- body = response.body;
997
- }
998
- response = new Response(body, {
999
- status: 200,
1000
- headers
1001
- });
1002
- attachCookiesToResponse(response, context.cookies);
1003
- return response;
1004
- }
1005
-
1006
- function getRouteGenerator(segments, addTrailingSlash) {
1007
- const template = segments.map((segment) => {
1008
- return "/" + segment.map((part) => {
1009
- if (part.spread) {
1010
- return `:${part.content.slice(3)}(.*)?`;
1011
- } else if (part.dynamic) {
1012
- return `:${part.content}`;
1013
- } else {
1014
- return part.content.normalize().replace(/\?/g, "%3F").replace(/#/g, "%23").replace(/%5B/g, "[").replace(/%5D/g, "]").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1015
- }
1016
- }).join("");
1017
- }).join("");
1018
- let trailing = "";
1019
- if (addTrailingSlash === "always" && segments.length) {
1020
- trailing = "/";
1021
- }
1022
- const toPath = compile(template + trailing);
1023
- return toPath;
1024
- }
1025
-
1026
- function deserializeRouteData(rawRouteData) {
1027
- return {
1028
- route: rawRouteData.route,
1029
- type: rawRouteData.type,
1030
- pattern: new RegExp(rawRouteData.pattern),
1031
- params: rawRouteData.params,
1032
- component: rawRouteData.component,
1033
- generate: getRouteGenerator(rawRouteData.segments, rawRouteData._meta.trailingSlash),
1034
- pathname: rawRouteData.pathname || void 0,
1035
- segments: rawRouteData.segments,
1036
- prerender: rawRouteData.prerender,
1037
- redirect: rawRouteData.redirect,
1038
- redirectRoute: rawRouteData.redirectRoute ? deserializeRouteData(rawRouteData.redirectRoute) : void 0,
1039
- fallbackRoutes: rawRouteData.fallbackRoutes.map((fallback) => {
1040
- return deserializeRouteData(fallback);
1041
- })
1042
- };
1043
- }
1044
-
1045
- function deserializeManifest(serializedManifest) {
1046
- const routes = [];
1047
- for (const serializedRoute of serializedManifest.routes) {
1048
- routes.push({
1049
- ...serializedRoute,
1050
- routeData: deserializeRouteData(serializedRoute.routeData)
1051
- });
1052
- const route = serializedRoute;
1053
- route.routeData = deserializeRouteData(serializedRoute.routeData);
1054
- }
1055
- const assets = new Set(serializedManifest.assets);
1056
- const componentMetadata = new Map(serializedManifest.componentMetadata);
1057
- const clientDirectives = new Map(serializedManifest.clientDirectives);
1058
- return {
1059
- ...serializedManifest,
1060
- assets,
1061
- componentMetadata,
1062
- clientDirectives,
1063
- routes
1064
- };
1065
- }
1066
-
1067
- const manifest = deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/astro@3.6.0/node_modules/astro/dist/assets/endpoint/node.js","pathname":"/_image","prerender":false,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.54eaab04.js"}],"styles":[{"type":"external","src":"/_astro/_slug_.e7cac999.css"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.54eaab04.js"}],"styles":[{"type":"external","src":"/_astro/_slug_.e7cac999.css"}],"routeData":{"route":"/~fallback","type":"page","pattern":"^\\/~fallback\\/?$","segments":[[{"content":"~fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/~fallback.astro","pathname":"/~fallback","prerender":false,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.c90fc6ab.js"}],"styles":[{"type":"external","src":"/_astro/_slug_.e7cac999.css"}],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.54eaab04.js"}],"styles":[{"type":"external","src":"/_astro/_slug_.e7cac999.css"}],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","prerender":false,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.54eaab04.js"}],"styles":[{"type":"external","src":"/_astro/_slug_.e7cac999.css"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"fallbackRoutes":[],"_meta":{"trailingSlash":"ignore"}}}],"site":"https://demo.ecomplus.app","base":"/","trailingSlash":"ignore","compressHTML":false,"componentMetadata":[["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseHead.astro",{"propagation":"in-tree","containsHead":false}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro",{"propagation":"in-tree","containsHead":false}],["\u0000@astro-page:src/pages/[...slug]@_@astro",{"propagation":"in-tree","containsHead":false}],["\u0000@astrojs-ssr-virtual-entry",{"propagation":"in-tree","containsHead":false}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/account.astro",{"propagation":"in-tree","containsHead":false}],["\u0000@astro-page:src/pages/app/account@_@astro",{"propagation":"in-tree","containsHead":false}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro",{"propagation":"in-tree","containsHead":false}],["\u0000@astro-page:src/pages/app/index@_@astro",{"propagation":"in-tree","containsHead":false}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro",{"propagation":"in-tree","containsHead":false}],["\u0000@astro-page:src/pages/index@_@astro",{"propagation":"in-tree","containsHead":false}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/~fallback.astro",{"propagation":"in-tree","containsHead":false}],["\u0000@astro-page:src/pages/~fallback@_@astro",{"propagation":"in-tree","containsHead":false}]],"renderers":[],"clientDirectives":[["idle","(()=>{var i=t=>{let e=async()=>{await(await t())()};\"requestIdleCallback\"in window?window.requestIdleCallback(e):setTimeout(e,200)};(self.Astro||(self.Astro={})).idle=i;window.dispatchEvent(new Event(\"astro:idle\"));})();"],["load","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event(\"astro:load\"));})();"],["media","(()=>{var s=(i,t)=>{let a=async()=>{await(await i())()};if(t.value){let e=matchMedia(t.value);e.matches?a():e.addEventListener(\"change\",a,{once:!0})}};(self.Astro||(self.Astro={})).media=s;window.dispatchEvent(new Event(\"astro:media\"));})();"],["only","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event(\"astro:only\"));})();"],["visible","(()=>{var r=(i,c,s)=>{let n=async()=>{await(await i())()},t=new IntersectionObserver(e=>{for(let o of e)if(o.isIntersecting){t.disconnect(),n();break}});for(let e of s.children)t.observe(e)};(self.Astro||(self.Astro={})).visible=r;window.dispatchEvent(new Event(\"astro:visible\"));})();"],["context","(()=>{var n=(d,i)=>{let t=async()=>{await(await d())()},e=()=>{if(i.value===\"idle\"){if(typeof window.requestIdleCallback==\"function\"){setTimeout(()=>window.requestIdleCallback(t),9);return}setTimeout(t,200);return}t()},o=window.$storefront?.apiContext?.doc._id||null;if(window._firstLoadContextId===o&&window._emitedContextId===o){console.log(\"[ctx] first load\"),e(),document.addEventListener(\"astro:beforeload\",()=>{delete window._firstLoadContextId},{once:!0});return}window.addEventListener(\"storefront:apiContext\",e,{once:!0})};(self.Astro||(self.Astro={})).context=n;window.dispatchEvent(new Event(\"astro:context\"));})();\n"]],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"entry.mjs","\u0000@astro-renderers":"renderers.mjs","\u0000empty-middleware":"_empty-middleware.mjs","/src/pages/app/account.astro":"chunks/pages/account_e5d410a7.mjs","/../../node_modules/.pnpm/astro@3.6.0/node_modules/astro/dist/assets/endpoint/node.js":"chunks/pages/node_bd378ac0.mjs","/src/pages/~fallback.astro":"chunks/pages/~fallback_73578d2f.mjs","\u0000@astrojs-manifest":"manifest_221d806b.mjs","\u0000@astro-page:../../node_modules/.pnpm/astro@3.6.0/node_modules/astro/dist/assets/endpoint/node@_@js":"chunks/node_1119b0d1.mjs","\u0000@astro-page:src/pages/index@_@astro":"chunks/index_5e3ed8a0.mjs","\u0000@astro-page:src/pages/~fallback@_@astro":"chunks/~fallback_41122b9b.mjs","\u0000@astro-page:src/pages/app/index@_@astro":"chunks/index_10e14f85.mjs","\u0000@astro-page:src/pages/app/account@_@astro":"chunks/account_519edb70.mjs","\u0000@astro-page:src/pages/[...slug]@_@astro":"chunks/_.._5a781fb3.mjs","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/components/SearchModal.vue":"_astro/SearchModal.b6aa5ef7.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/components/CartSidebar.vue":"_astro/CartSidebar.430b55df.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/photoswipe/dist/photoswipe.css?used&inline":"_astro/photoswipe.01431ec7.js","~/components/ProductShelf.vue":"_astro/ProductShelf.bf82838b.js","~/components/PitchBar.vue":"_astro/PitchBar.06e0f831.js","@astrojs/vue/client.js":"_astro/client.41b42098.js","/astro/hoisted.js?q=0":"_astro/hoisted.c90fc6ab.js","~/components/AccountPage.vue":"_astro/AccountPage.700be123.js","~/components/HeroSlider.vue":"_astro/HeroSlider.bd684ed8.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/photoswipe/dist/photoswipe-lightbox.esm.js":"_astro/photoswipe-lightbox.esm.c157838f.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.992a296f.js","~/components/ShopHeader.vue":"_astro/ShopHeader.2d6e361a.js","/astro/hoisted.js?q=1":"_astro/hoisted.54eaab04.js","~/components/ProductDetails.vue":"_astro/ProductDetails.06da998d.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/photoswipe/dist/photoswipe.esm.js":"_astro/photoswipe.esm.92c2d901.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/_slug_.e7cac999.css","/robots.txt","/_astro/AccountPage.700be123.js","/_astro/CartSidebar.430b55df.js","/_astro/HeroSlider.bd684ed8.js","/_astro/PitchBar.06e0f831.js","/_astro/Prices.0e829c31.js","/_astro/ProductDetails.06da998d.js","/_astro/ProductShelf.3f4f38b5.js","/_astro/ProductShelf.bf82838b.js","/_astro/QuantitySelector.ebf60845.js","/_astro/SearchModal.b6aa5ef7.js","/_astro/ShopHeader.2d6e361a.js","/_astro/_plugin-vue_export-helper.f75743ee.js","/_astro/afetch.f4507208.js","/_astro/client.41b42098.js","/_astro/customer-session.5ab9ab1a.js","/_astro/ecom-utils.5cbfb95e.js","/_astro/firebase-app.992a296f.js","/_astro/format-money.9cf6b04d.js","/_astro/hoisted.54eaab04.js","/_astro/hoisted.c90fc6ab.js","/_astro/i18n.29216eeb.js","/_astro/img-sizes.41e0efe4.js","/_astro/img.4f23a3dd.js","/_astro/index-61e5ac61.bdc8d0cd.js","/_astro/index.570b84fe.js","/_astro/index.8ac1db99.js","/_astro/modules-info.55780599.js","/_astro/name.01410784.js","/_astro/photoswipe-lightbox.esm.c157838f.js","/_astro/photoswipe.01431ec7.js","/_astro/photoswipe.esm.92c2d901.js","/_astro/price.04ceb6c4.js","/_astro/sf-utils.b04e1813.js","/_astro/shopping-cart.d9f601dd.js","/_astro/use-analytics.cc95e346.js","/_astro/use-product-card.437911bb.js","/img/icon.png","/img/large-icon.png","/img/uploads/banner2.webp","/img/uploads/ecom-icon.png","/img/uploads/headphone.webp","/img/uploads/logo.png","/img/uploads/og-image.png","/img/uploads/passion.webp","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.webp"]});
1068
-
1069
- export { AstroCookies as A, Logger as L, RouteCache as R, computePreferredLocaleList as a, computeCurrentLocale as b, computePreferredLocale as c, dateTimeFormat as d, redirectRouteStatus as e, redirectRouteGenerate as f, routeIsFallback as g, attachCookiesToResponse as h, createAPIContext as i, callEndpoint as j, callMiddleware as k, levels as l, AstroIntegrationLogger as m, manifest, getSetCookiesFromResponse as n, createRenderContext as o, routeIsRedirect as r };