cloudcommerce 0.6.13 → 0.7.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/CHANGELOG.md +28 -0
- package/action.yml +2 -2
- package/ecomplus-stores/monocard/functions/core/package.json +1 -1
- package/ecomplus-stores/monocard/functions/events/package.json +2 -2
- package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
- package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/content/settings.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/package.json +8 -8
- package/ecomplus-stores/monocard/functions/ssr/public/img/uploads/card-phone.png +0 -0
- package/ecomplus-stores/monocard/functions/ssr/public/img/uploads/qrcode-camera.png +0 -0
- package/ecomplus-stores/monocard/functions/ssr/src/components/CasesGrid.astro +1 -1
- package/ecomplus-stores/monocard/functions/ssr/src/components/FeatureTabs.astro +23 -0
- package/ecomplus-stores/monocard/functions/ssr/src/components/FeatureTabs.vue +225 -0
- package/ecomplus-stores/monocard/functions/ssr/src/components/ShopHeaderMenu.vue +2 -2
- package/ecomplus-stores/monocard/functions/ssr/src/layouts/Base.astro +1 -0
- package/ecomplus-stores/monocard/functions/ssr/src/layouts/Pages.astro +0 -1
- package/ecomplus-stores/monocard/functions/ssr/src/main/Home.astro +3 -3
- package/ecomplus-stores/monocard/package.json +1 -1
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/PagesHeader.astro +0 -11
- package/package.json +6 -6
- package/packages/api/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/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/infinitepay/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/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 +2 -2
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js +2 -2
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js +4 -3
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js +19 -19
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js +5 -3
- package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js +11 -11
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js +19 -10
- package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/tiny-erp/src/integration/after-tiny-queue.ts +2 -2
- package/packages/apps/tiny-erp/src/integration/import-order-from-tiny.ts +4 -3
- package/packages/apps/tiny-erp/src/integration/import-product-from-tiny.ts +18 -18
- package/packages/apps/tiny-erp/src/integration/parsers/order-to-tiny.ts +5 -3
- package/packages/apps/tiny-erp/src/integration/parsers/product-from-tiny.ts +11 -11
- package/packages/apps/tiny-erp/src/integration/parsers/product-to-tiny.ts +21 -11
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/config/firebase.json +24 -6
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +2 -2
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +2 -2
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +5 -5
- package/packages/storefront/.base.eslintrc.cjs +1 -1
- package/packages/storefront/astro.config.mjs +1 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.e93c8274.js +4 -0
- package/packages/storefront/dist/client/_astro/{firebase-app.7ce2ebb1.js → firebase-app.72e91a3e.js} +72 -72
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{astro.2e59789d.mjs → astro.9781c0a7.mjs} +217 -272
- package/packages/storefront/dist/server/chunks/{image-pool.78b6d784.mjs → image-pool.c24d15b2.mjs} +1202 -1202
- package/packages/storefront/dist/server/chunks/pages/{all.f49a350f.mjs → all.3a2f4354.mjs} +218 -289
- package/packages/storefront/dist/server/entry.mjs +16 -363
- package/packages/storefront/package.json +11 -11
- package/packages/storefront/scripts/build-prod.sh +7 -0
- package/packages/storefront/src/lib/components/Picture.astro +94 -0
- package/packages/storefront/src/lib/layouts/BaseHead.astro +2 -8
- package/packages/storefront/ssr-runtime/Picture.ssr.astro +0 -0
- package/packages/storefront/ssr-runtime/get-image.ts +4 -0
- package/packages/storefront/ssr-runtime/get-picture.ts +126 -0
- package/packages/types/package.json +1 -1
- package/ecomplus-stores/monocard/functions/ssr/src/components/UsageSteps.astro +0 -21
- package/ecomplus-stores/monocard/functions/ssr/src/components/UsageSteps.vue +0 -155
- package/packages/storefront/dist/client/_astro/ShopHeader.301e109b.js +0 -4
- package/packages/storefront/src/lib/ssr/Picture.astro +0 -27
- package/packages/storefront/src/lib/ssr/image.ts +0 -68
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { compile } from 'path-to-regexp';
|
|
2
|
+
import { serialize, parse } from 'cookie';
|
|
2
3
|
import 'fs';
|
|
3
4
|
import { TLSSocket } from 'tls';
|
|
4
5
|
import mime from 'mime';
|
|
5
|
-
import { serialize, parse } from 'cookie';
|
|
6
6
|
import { yellow, dim, bold, cyan, red, reset } from 'kleur/colors';
|
|
7
7
|
import 'string-width';
|
|
8
8
|
import slashify from 'slash';
|
|
@@ -62,29 +62,6 @@ function deserializeManifest(serializedManifest) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
var __accessCheck$3 = (obj, member, msg) => {
|
|
66
|
-
if (!member.has(obj))
|
|
67
|
-
throw TypeError("Cannot " + msg);
|
|
68
|
-
};
|
|
69
|
-
var __privateGet$3 = (obj, member, getter) => {
|
|
70
|
-
__accessCheck$3(obj, member, "read from private field");
|
|
71
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
72
|
-
};
|
|
73
|
-
var __privateAdd$3 = (obj, member, value) => {
|
|
74
|
-
if (member.has(obj))
|
|
75
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
76
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
77
|
-
};
|
|
78
|
-
var __privateSet$3 = (obj, member, value, setter) => {
|
|
79
|
-
__accessCheck$3(obj, member, "write to private field");
|
|
80
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
81
|
-
return value;
|
|
82
|
-
};
|
|
83
|
-
var __privateMethod$1 = (obj, member, method) => {
|
|
84
|
-
__accessCheck$3(obj, member, "access private method");
|
|
85
|
-
return method;
|
|
86
|
-
};
|
|
87
|
-
var _request, _requestValues, _outgoing, _ensureParsed, ensureParsed_fn, _ensureOutgoingMap, ensureOutgoingMap_fn, _parse, parse_fn;
|
|
88
65
|
const DELETED_EXPIRATION = new Date(0);
|
|
89
66
|
const DELETED_VALUE = "deleted";
|
|
90
67
|
class AstroCookie {
|
|
@@ -109,16 +86,13 @@ class AstroCookie {
|
|
|
109
86
|
}
|
|
110
87
|
}
|
|
111
88
|
class AstroCookies {
|
|
89
|
+
#request;
|
|
90
|
+
#requestValues;
|
|
91
|
+
#outgoing;
|
|
112
92
|
constructor(request) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
__privateAdd$3(this, _request, void 0);
|
|
117
|
-
__privateAdd$3(this, _requestValues, void 0);
|
|
118
|
-
__privateAdd$3(this, _outgoing, void 0);
|
|
119
|
-
__privateSet$3(this, _request, request);
|
|
120
|
-
__privateSet$3(this, _requestValues, null);
|
|
121
|
-
__privateSet$3(this, _outgoing, null);
|
|
93
|
+
this.#request = request;
|
|
94
|
+
this.#requestValues = null;
|
|
95
|
+
this.#outgoing = null;
|
|
122
96
|
}
|
|
123
97
|
delete(key, options) {
|
|
124
98
|
const serializeOptions = {
|
|
@@ -130,31 +104,31 @@ class AstroCookies {
|
|
|
130
104
|
if (options == null ? void 0 : options.path) {
|
|
131
105
|
serializeOptions.path = options.path;
|
|
132
106
|
}
|
|
133
|
-
|
|
107
|
+
this.#ensureOutgoingMap().set(key, [
|
|
134
108
|
DELETED_VALUE,
|
|
135
109
|
serialize(key, DELETED_VALUE, serializeOptions),
|
|
136
110
|
false
|
|
137
111
|
]);
|
|
138
112
|
}
|
|
139
113
|
get(key) {
|
|
140
|
-
if (
|
|
141
|
-
let [serializedValue, , isSetValue] =
|
|
114
|
+
if (this.#outgoing !== null && this.#outgoing.has(key)) {
|
|
115
|
+
let [serializedValue, , isSetValue] = this.#outgoing.get(key);
|
|
142
116
|
if (isSetValue) {
|
|
143
117
|
return new AstroCookie(serializedValue);
|
|
144
118
|
} else {
|
|
145
119
|
return new AstroCookie(void 0);
|
|
146
120
|
}
|
|
147
121
|
}
|
|
148
|
-
const values =
|
|
122
|
+
const values = this.#ensureParsed();
|
|
149
123
|
const value = values[key];
|
|
150
124
|
return new AstroCookie(value);
|
|
151
125
|
}
|
|
152
126
|
has(key) {
|
|
153
|
-
if (
|
|
154
|
-
let [, , isSetValue] =
|
|
127
|
+
if (this.#outgoing !== null && this.#outgoing.has(key)) {
|
|
128
|
+
let [, , isSetValue] = this.#outgoing.get(key);
|
|
155
129
|
return isSetValue;
|
|
156
130
|
}
|
|
157
|
-
const values =
|
|
131
|
+
const values = this.#ensureParsed();
|
|
158
132
|
return !!values[key];
|
|
159
133
|
}
|
|
160
134
|
set(key, value, options) {
|
|
@@ -173,48 +147,42 @@ class AstroCookies {
|
|
|
173
147
|
if (options) {
|
|
174
148
|
Object.assign(serializeOptions, options);
|
|
175
149
|
}
|
|
176
|
-
|
|
150
|
+
this.#ensureOutgoingMap().set(key, [
|
|
177
151
|
serializedValue,
|
|
178
152
|
serialize(key, serializedValue, serializeOptions),
|
|
179
153
|
true
|
|
180
154
|
]);
|
|
181
155
|
}
|
|
182
156
|
*headers() {
|
|
183
|
-
if (
|
|
157
|
+
if (this.#outgoing == null)
|
|
184
158
|
return;
|
|
185
|
-
for (const [, value] of
|
|
159
|
+
for (const [, value] of this.#outgoing) {
|
|
186
160
|
yield value[1];
|
|
187
161
|
}
|
|
188
162
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
if (!__privateGet$3(this, _requestValues)) {
|
|
199
|
-
__privateSet$3(this, _requestValues, {});
|
|
163
|
+
#ensureParsed() {
|
|
164
|
+
if (!this.#requestValues) {
|
|
165
|
+
this.#parse();
|
|
166
|
+
}
|
|
167
|
+
if (!this.#requestValues) {
|
|
168
|
+
this.#requestValues = {};
|
|
169
|
+
}
|
|
170
|
+
return this.#requestValues;
|
|
200
171
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
__privateSet$3(this, _outgoing, /* @__PURE__ */ new Map());
|
|
172
|
+
#ensureOutgoingMap() {
|
|
173
|
+
if (!this.#outgoing) {
|
|
174
|
+
this.#outgoing = /* @__PURE__ */ new Map();
|
|
175
|
+
}
|
|
176
|
+
return this.#outgoing;
|
|
207
177
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
return;
|
|
178
|
+
#parse() {
|
|
179
|
+
const raw = this.#request.headers.get("cookie");
|
|
180
|
+
if (!raw) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
this.#requestValues = parse(raw);
|
|
215
184
|
}
|
|
216
|
-
|
|
217
|
-
};
|
|
185
|
+
}
|
|
218
186
|
|
|
219
187
|
const astroCookiesSymbol = Symbol.for("astro.cookies");
|
|
220
188
|
function attachToResponse(response, cookies) {
|
|
@@ -386,6 +354,31 @@ Expected \`true\` value but got \`${suffix}\`.`;
|
|
|
386
354
|
message: (paramName) => `[paginate()] page number param \`${paramName}\` not found in your filepath.`,
|
|
387
355
|
hint: "Rename your file to `[page].astro` or `[...page].astro`."
|
|
388
356
|
},
|
|
357
|
+
ImageMissingAlt: {
|
|
358
|
+
title: "Missing alt property",
|
|
359
|
+
code: 3022,
|
|
360
|
+
message: "The alt property is required.",
|
|
361
|
+
hint: "The `alt` property is important for the purpose of accessibility, without it users using screen readers or other assistive technologies won't be able to understand what your image is supposed to represent. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-alt for more information."
|
|
362
|
+
},
|
|
363
|
+
InvalidImageService: {
|
|
364
|
+
title: "Error while loading image service",
|
|
365
|
+
code: 3023,
|
|
366
|
+
message: "There was an error loading the configured image service. Please see the stack trace for more information."
|
|
367
|
+
},
|
|
368
|
+
MissingImageDimension: {
|
|
369
|
+
title: "Missing image dimensions",
|
|
370
|
+
code: 3024,
|
|
371
|
+
message: (missingDimension, imageURL) => `Missing ${missingDimension === "both" ? "width and height attributes" : `${missingDimension} attribute`} for ${imageURL}. When using remote images, both dimensions are always required in order to avoid CLS.`,
|
|
372
|
+
hint: "If your image is inside your `src` folder, you probably meant to import it instead. See [the Imports guide for more information](https://docs.astro.build/en/guides/imports/#other-assets)."
|
|
373
|
+
},
|
|
374
|
+
UnsupportedImageFormat: {
|
|
375
|
+
title: "Unsupported image format",
|
|
376
|
+
code: 3025,
|
|
377
|
+
message: (format, imagePath, supportedFormats) => `Received unsupported format \`${format}\` from \`${imagePath}\`. Currently only ${supportedFormats.join(
|
|
378
|
+
", "
|
|
379
|
+
)} are supported for optimization.`,
|
|
380
|
+
hint: "If you do not need optimization, using an `img` tag directly instead of the `Image` component might be what you're looking for."
|
|
381
|
+
},
|
|
389
382
|
UnknownViteError: {
|
|
390
383
|
title: "Unknown Vite Error.",
|
|
391
384
|
code: 4e3
|
|
@@ -618,7 +611,7 @@ function createComponent(arg1, moduleId) {
|
|
|
618
611
|
}
|
|
619
612
|
}
|
|
620
613
|
|
|
621
|
-
const ASTRO_VERSION = "2.
|
|
614
|
+
const ASTRO_VERSION = "2.1.2";
|
|
622
615
|
|
|
623
616
|
function createAstroGlobFn() {
|
|
624
617
|
const globHandler = (importMetaGlobResult, globValue) => {
|
|
@@ -1799,10 +1792,17 @@ Did you forget to import the component or is it possible there is a typo?`);
|
|
|
1799
1792
|
async function renderElement(result, tag, { children, ...props }) {
|
|
1800
1793
|
return markHTMLString(
|
|
1801
1794
|
`<${tag}${spreadAttributes(props)}${markHTMLString(
|
|
1802
|
-
(children == null || children == "") && voidElementNames.test(tag) ? `/>` : `>${children == null ? "" : await renderJSX(result, children)}</${tag}>`
|
|
1795
|
+
(children == null || children == "") && voidElementNames.test(tag) ? `/>` : `>${children == null ? "" : await renderJSX(result, prerenderElementChildren(tag, children))}</${tag}>`
|
|
1803
1796
|
)}`
|
|
1804
1797
|
);
|
|
1805
1798
|
}
|
|
1799
|
+
function prerenderElementChildren(tag, children) {
|
|
1800
|
+
if (typeof children === "string" && (tag === "style" || tag === "script")) {
|
|
1801
|
+
return markHTMLString(children);
|
|
1802
|
+
} else {
|
|
1803
|
+
return children;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
1806
|
function useConsoleFilter() {
|
|
1807
1807
|
consoleFilterRefs++;
|
|
1808
1808
|
if (!originalConsoleError) {
|
|
@@ -1976,7 +1976,7 @@ Did you forget to import the component or is it possible there is a typo?`
|
|
|
1976
1976
|
break;
|
|
1977
1977
|
}
|
|
1978
1978
|
} catch (e) {
|
|
1979
|
-
error
|
|
1979
|
+
error ??= e;
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
1982
|
if (!renderer && error) {
|
|
@@ -2189,44 +2189,25 @@ function renderComponentToIterable(result, displayName, Component, props, slots
|
|
|
2189
2189
|
return renderResult;
|
|
2190
2190
|
}
|
|
2191
2191
|
|
|
2192
|
-
var __accessCheck$2 = (obj, member, msg) => {
|
|
2193
|
-
if (!member.has(obj))
|
|
2194
|
-
throw TypeError("Cannot " + msg);
|
|
2195
|
-
};
|
|
2196
|
-
var __privateGet$2 = (obj, member, getter) => {
|
|
2197
|
-
__accessCheck$2(obj, member, "read from private field");
|
|
2198
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
2199
|
-
};
|
|
2200
|
-
var __privateAdd$2 = (obj, member, value) => {
|
|
2201
|
-
if (member.has(obj))
|
|
2202
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
2203
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2204
|
-
};
|
|
2205
|
-
var __privateSet$2 = (obj, member, value, setter) => {
|
|
2206
|
-
__accessCheck$2(obj, member, "write to private field");
|
|
2207
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
2208
|
-
return value;
|
|
2209
|
-
};
|
|
2210
2192
|
const isNodeJS = typeof process === "object" && Object.prototype.toString.call(process) === "[object process]";
|
|
2211
2193
|
let StreamingCompatibleResponse;
|
|
2212
2194
|
function createResponseClass() {
|
|
2213
|
-
|
|
2214
|
-
|
|
2195
|
+
StreamingCompatibleResponse = class extends Response {
|
|
2196
|
+
#isStream;
|
|
2197
|
+
#body;
|
|
2215
2198
|
constructor(body, init) {
|
|
2216
2199
|
let isStream = body instanceof ReadableStream;
|
|
2217
2200
|
super(isStream ? null : body, init);
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
__privateSet$2(this, _isStream, isStream);
|
|
2221
|
-
__privateSet$2(this, _body, body);
|
|
2201
|
+
this.#isStream = isStream;
|
|
2202
|
+
this.#body = body;
|
|
2222
2203
|
}
|
|
2223
2204
|
get body() {
|
|
2224
|
-
return
|
|
2205
|
+
return this.#body;
|
|
2225
2206
|
}
|
|
2226
2207
|
async text() {
|
|
2227
|
-
if (
|
|
2208
|
+
if (this.#isStream && isNodeJS) {
|
|
2228
2209
|
let decoder = new TextDecoder();
|
|
2229
|
-
let body =
|
|
2210
|
+
let body = this.#body;
|
|
2230
2211
|
let out = "";
|
|
2231
2212
|
for await (let chunk of streamAsyncIterator(body)) {
|
|
2232
2213
|
out += decoder.decode(chunk);
|
|
@@ -2236,8 +2217,8 @@ function createResponseClass() {
|
|
|
2236
2217
|
return super.text();
|
|
2237
2218
|
}
|
|
2238
2219
|
async arrayBuffer() {
|
|
2239
|
-
if (
|
|
2240
|
-
let body =
|
|
2220
|
+
if (this.#isStream && isNodeJS) {
|
|
2221
|
+
let body = this.#body;
|
|
2241
2222
|
let chunks = [];
|
|
2242
2223
|
let len = 0;
|
|
2243
2224
|
for await (let chunk of streamAsyncIterator(body)) {
|
|
@@ -2254,7 +2235,7 @@ function createResponseClass() {
|
|
|
2254
2235
|
}
|
|
2255
2236
|
return super.arrayBuffer();
|
|
2256
2237
|
}
|
|
2257
|
-
}
|
|
2238
|
+
};
|
|
2258
2239
|
return StreamingCompatibleResponse;
|
|
2259
2240
|
}
|
|
2260
2241
|
const createResponse = isNodeJS ? (body, init) => {
|
|
@@ -2565,25 +2546,6 @@ function stringifyParams(params, routeComponent) {
|
|
|
2565
2546
|
return JSON.stringify(validatedParams, Object.keys(params).sort());
|
|
2566
2547
|
}
|
|
2567
2548
|
|
|
2568
|
-
var __accessCheck$1 = (obj, member, msg) => {
|
|
2569
|
-
if (!member.has(obj))
|
|
2570
|
-
throw TypeError("Cannot " + msg);
|
|
2571
|
-
};
|
|
2572
|
-
var __privateGet$1 = (obj, member, getter) => {
|
|
2573
|
-
__accessCheck$1(obj, member, "read from private field");
|
|
2574
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
2575
|
-
};
|
|
2576
|
-
var __privateAdd$1 = (obj, member, value) => {
|
|
2577
|
-
if (member.has(obj))
|
|
2578
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
2579
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2580
|
-
};
|
|
2581
|
-
var __privateSet$1 = (obj, member, value, setter) => {
|
|
2582
|
-
__accessCheck$1(obj, member, "write to private field");
|
|
2583
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
2584
|
-
return value;
|
|
2585
|
-
};
|
|
2586
|
-
var _result, _slots, _loggingOpts;
|
|
2587
2549
|
const clientAddressSymbol$2 = Symbol.for("astro.clientAddress");
|
|
2588
2550
|
function onlyAvailableInSSR(name) {
|
|
2589
2551
|
return function _onlyAvailableInSSR() {
|
|
@@ -2602,13 +2564,13 @@ function getFunctionExpression(slot) {
|
|
|
2602
2564
|
return slot.expressions[0];
|
|
2603
2565
|
}
|
|
2604
2566
|
class Slots {
|
|
2567
|
+
#result;
|
|
2568
|
+
#slots;
|
|
2569
|
+
#loggingOpts;
|
|
2605
2570
|
constructor(result, slots, logging) {
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
__privateSet$1(this, _result, result);
|
|
2610
|
-
__privateSet$1(this, _slots, slots);
|
|
2611
|
-
__privateSet$1(this, _loggingOpts, logging);
|
|
2571
|
+
this.#result = result;
|
|
2572
|
+
this.#slots = slots;
|
|
2573
|
+
this.#loggingOpts = logging;
|
|
2612
2574
|
if (slots) {
|
|
2613
2575
|
for (const key of Object.keys(slots)) {
|
|
2614
2576
|
if (this[key] !== void 0) {
|
|
@@ -2627,22 +2589,22 @@ class Slots {
|
|
|
2627
2589
|
}
|
|
2628
2590
|
}
|
|
2629
2591
|
has(name) {
|
|
2630
|
-
if (!
|
|
2592
|
+
if (!this.#slots)
|
|
2631
2593
|
return false;
|
|
2632
|
-
return Boolean(
|
|
2594
|
+
return Boolean(this.#slots[name]);
|
|
2633
2595
|
}
|
|
2634
2596
|
async render(name, args = []) {
|
|
2635
|
-
if (!
|
|
2597
|
+
if (!this.#slots || !this.has(name))
|
|
2636
2598
|
return;
|
|
2637
|
-
const scoped = createScopedResult(
|
|
2599
|
+
const scoped = createScopedResult(this.#result, ScopeFlags.RenderSlot);
|
|
2638
2600
|
if (!Array.isArray(args)) {
|
|
2639
2601
|
warn(
|
|
2640
|
-
|
|
2602
|
+
this.#loggingOpts,
|
|
2641
2603
|
"Astro.slots.render",
|
|
2642
2604
|
`Expected second parameter to be an array, received a ${typeof args}. If you're trying to pass an array as a single argument and getting unexpected results, make sure you're passing your array as a item of an array. Ex: Astro.slots.render('default', [["Hello", "World"]])`
|
|
2643
2605
|
);
|
|
2644
2606
|
} else if (args.length > 0) {
|
|
2645
|
-
const slotValue =
|
|
2607
|
+
const slotValue = this.#slots[name];
|
|
2646
2608
|
const component = typeof slotValue === "function" ? await slotValue(scoped) : await slotValue;
|
|
2647
2609
|
const expression = getFunctionExpression(component);
|
|
2648
2610
|
if (expression) {
|
|
@@ -2655,14 +2617,11 @@ class Slots {
|
|
|
2655
2617
|
);
|
|
2656
2618
|
}
|
|
2657
2619
|
}
|
|
2658
|
-
const content = await renderSlot(scoped,
|
|
2620
|
+
const content = await renderSlot(scoped, this.#slots[name]);
|
|
2659
2621
|
const outHTML = stringifyChunk(scoped, content);
|
|
2660
2622
|
return outHTML;
|
|
2661
2623
|
}
|
|
2662
2624
|
}
|
|
2663
|
-
_result = new WeakMap();
|
|
2664
|
-
_slots = new WeakMap();
|
|
2665
|
-
_loggingOpts = new WeakMap();
|
|
2666
2625
|
let renderMarkdown = null;
|
|
2667
2626
|
function createResult(args) {
|
|
2668
2627
|
const { markdown, params, pathname, renderers, request, resolve } = args;
|
|
@@ -3011,7 +2970,7 @@ function createAPIContext({
|
|
|
3011
2970
|
}
|
|
3012
2971
|
};
|
|
3013
2972
|
}
|
|
3014
|
-
async function call(mod, env, ctx) {
|
|
2973
|
+
async function call(mod, env, ctx, logging) {
|
|
3015
2974
|
var _a, _b;
|
|
3016
2975
|
const paramsAndPropsResp = await getParamsAndProps({
|
|
3017
2976
|
mod,
|
|
@@ -3044,6 +3003,22 @@ async function call(mod, env, ctx) {
|
|
|
3044
3003
|
response
|
|
3045
3004
|
};
|
|
3046
3005
|
}
|
|
3006
|
+
if (env.ssr && !mod.prerender) {
|
|
3007
|
+
if (response.hasOwnProperty("headers")) {
|
|
3008
|
+
warn(
|
|
3009
|
+
logging,
|
|
3010
|
+
"ssr",
|
|
3011
|
+
"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."
|
|
3012
|
+
);
|
|
3013
|
+
}
|
|
3014
|
+
if (response.encoding) {
|
|
3015
|
+
warn(
|
|
3016
|
+
logging,
|
|
3017
|
+
"ssr",
|
|
3018
|
+
"`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."
|
|
3019
|
+
);
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3047
3022
|
return {
|
|
3048
3023
|
type: "simple",
|
|
3049
3024
|
body: response.body,
|
|
@@ -3175,52 +3150,27 @@ function matchRoute(pathname, manifest) {
|
|
|
3175
3150
|
return manifest.routes.find((route) => route.pattern.test(decodeURI(pathname)));
|
|
3176
3151
|
}
|
|
3177
3152
|
|
|
3178
|
-
var __accessCheck = (obj, member, msg) => {
|
|
3179
|
-
if (!member.has(obj))
|
|
3180
|
-
throw TypeError("Cannot " + msg);
|
|
3181
|
-
};
|
|
3182
|
-
var __privateGet = (obj, member, getter) => {
|
|
3183
|
-
__accessCheck(obj, member, "read from private field");
|
|
3184
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
3185
|
-
};
|
|
3186
|
-
var __privateAdd = (obj, member, value) => {
|
|
3187
|
-
if (member.has(obj))
|
|
3188
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
3189
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
3190
|
-
};
|
|
3191
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
3192
|
-
__accessCheck(obj, member, "write to private field");
|
|
3193
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
3194
|
-
return value;
|
|
3195
|
-
};
|
|
3196
|
-
var __privateMethod = (obj, member, method) => {
|
|
3197
|
-
__accessCheck(obj, member, "access private method");
|
|
3198
|
-
return method;
|
|
3199
|
-
};
|
|
3200
|
-
var _env, _manifest, _manifestData, _routeDataToRouteInfo, _encoder, _logging, _base, _baseWithoutTrailingSlash, _renderPage, renderPage_fn, _callEndpoint, callEndpoint_fn;
|
|
3201
3153
|
class App {
|
|
3154
|
+
#env;
|
|
3155
|
+
#manifest;
|
|
3156
|
+
#manifestData;
|
|
3157
|
+
#routeDataToRouteInfo;
|
|
3158
|
+
#encoder = new TextEncoder();
|
|
3159
|
+
#logging = {
|
|
3160
|
+
dest: consoleLogDestination,
|
|
3161
|
+
level: "info"
|
|
3162
|
+
};
|
|
3163
|
+
#base;
|
|
3164
|
+
#baseWithoutTrailingSlash;
|
|
3202
3165
|
constructor(manifest, streaming = true) {
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
__privateAdd(this, _env, void 0);
|
|
3206
|
-
__privateAdd(this, _manifest, void 0);
|
|
3207
|
-
__privateAdd(this, _manifestData, void 0);
|
|
3208
|
-
__privateAdd(this, _routeDataToRouteInfo, void 0);
|
|
3209
|
-
__privateAdd(this, _encoder, new TextEncoder());
|
|
3210
|
-
__privateAdd(this, _logging, {
|
|
3211
|
-
dest: consoleLogDestination,
|
|
3212
|
-
level: "info"
|
|
3213
|
-
});
|
|
3214
|
-
__privateAdd(this, _base, void 0);
|
|
3215
|
-
__privateAdd(this, _baseWithoutTrailingSlash, void 0);
|
|
3216
|
-
__privateSet(this, _manifest, manifest);
|
|
3217
|
-
__privateSet(this, _manifestData, {
|
|
3166
|
+
this.#manifest = manifest;
|
|
3167
|
+
this.#manifestData = {
|
|
3218
3168
|
routes: manifest.routes.map((route) => route.routeData)
|
|
3219
|
-
}
|
|
3220
|
-
|
|
3221
|
-
|
|
3169
|
+
};
|
|
3170
|
+
this.#routeDataToRouteInfo = new Map(manifest.routes.map((route) => [route.routeData, route]));
|
|
3171
|
+
this.#env = createEnvironment({
|
|
3222
3172
|
adapterName: manifest.adapterName,
|
|
3223
|
-
logging:
|
|
3173
|
+
logging: this.#logging,
|
|
3224
3174
|
markdown: manifest.markdown,
|
|
3225
3175
|
mode: "production",
|
|
3226
3176
|
renderers: manifest.renderers,
|
|
@@ -3239,33 +3189,33 @@ class App {
|
|
|
3239
3189
|
}
|
|
3240
3190
|
}
|
|
3241
3191
|
},
|
|
3242
|
-
routeCache: new RouteCache(
|
|
3243
|
-
site:
|
|
3192
|
+
routeCache: new RouteCache(this.#logging),
|
|
3193
|
+
site: this.#manifest.site,
|
|
3244
3194
|
ssr: true,
|
|
3245
3195
|
streaming
|
|
3246
|
-
})
|
|
3247
|
-
|
|
3248
|
-
|
|
3196
|
+
});
|
|
3197
|
+
this.#base = this.#manifest.base || "/";
|
|
3198
|
+
this.#baseWithoutTrailingSlash = removeTrailingForwardSlash(this.#base);
|
|
3249
3199
|
}
|
|
3250
3200
|
removeBase(pathname) {
|
|
3251
|
-
if (pathname.startsWith(
|
|
3252
|
-
return pathname.slice(
|
|
3201
|
+
if (pathname.startsWith(this.#base)) {
|
|
3202
|
+
return pathname.slice(this.#baseWithoutTrailingSlash.length + 1);
|
|
3253
3203
|
}
|
|
3254
3204
|
return pathname;
|
|
3255
3205
|
}
|
|
3256
3206
|
match(request, { matchNotFound = false } = {}) {
|
|
3257
3207
|
const url = new URL(request.url);
|
|
3258
|
-
if (
|
|
3208
|
+
if (this.#manifest.assets.has(url.pathname)) {
|
|
3259
3209
|
return void 0;
|
|
3260
3210
|
}
|
|
3261
3211
|
let pathname = "/" + this.removeBase(url.pathname);
|
|
3262
|
-
let routeData = matchRoute(pathname,
|
|
3212
|
+
let routeData = matchRoute(pathname, this.#manifestData);
|
|
3263
3213
|
if (routeData) {
|
|
3264
3214
|
if (routeData.prerender)
|
|
3265
3215
|
return void 0;
|
|
3266
3216
|
return routeData;
|
|
3267
3217
|
} else if (matchNotFound) {
|
|
3268
|
-
return matchRoute("/404",
|
|
3218
|
+
return matchRoute("/404", this.#manifestData);
|
|
3269
3219
|
} else {
|
|
3270
3220
|
return void 0;
|
|
3271
3221
|
}
|
|
@@ -3288,15 +3238,20 @@ class App {
|
|
|
3288
3238
|
if (routeData.route === "/404") {
|
|
3289
3239
|
defaultStatus = 404;
|
|
3290
3240
|
}
|
|
3291
|
-
let mod =
|
|
3241
|
+
let mod = this.#manifest.pageMap.get(routeData.component);
|
|
3292
3242
|
if (routeData.type === "page") {
|
|
3293
|
-
let response = await
|
|
3243
|
+
let response = await this.#renderPage(request, routeData, mod, defaultStatus);
|
|
3294
3244
|
if (response.status === 500) {
|
|
3295
|
-
const fiveHundredRouteData = matchRoute("/500",
|
|
3245
|
+
const fiveHundredRouteData = matchRoute("/500", this.#manifestData);
|
|
3296
3246
|
if (fiveHundredRouteData) {
|
|
3297
|
-
mod =
|
|
3247
|
+
mod = this.#manifest.pageMap.get(fiveHundredRouteData.component);
|
|
3298
3248
|
try {
|
|
3299
|
-
let fiveHundredResponse = await
|
|
3249
|
+
let fiveHundredResponse = await this.#renderPage(
|
|
3250
|
+
request,
|
|
3251
|
+
fiveHundredRouteData,
|
|
3252
|
+
mod,
|
|
3253
|
+
500
|
|
3254
|
+
);
|
|
3300
3255
|
return fiveHundredResponse;
|
|
3301
3256
|
} catch {
|
|
3302
3257
|
}
|
|
@@ -3304,7 +3259,7 @@ class App {
|
|
|
3304
3259
|
}
|
|
3305
3260
|
return response;
|
|
3306
3261
|
} else if (routeData.type === "endpoint") {
|
|
3307
|
-
return
|
|
3262
|
+
return this.#callEndpoint(request, routeData, mod, defaultStatus);
|
|
3308
3263
|
} else {
|
|
3309
3264
|
throw new Error(`Unsupported route type [${routeData.type}].`);
|
|
3310
3265
|
}
|
|
@@ -3312,96 +3267,86 @@ class App {
|
|
|
3312
3267
|
setCookieHeaders(response) {
|
|
3313
3268
|
return getSetCookiesFromResponse(response);
|
|
3314
3269
|
}
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
for (const script of info.scripts) {
|
|
3332
|
-
if ("stage" in script) {
|
|
3333
|
-
if (script.stage === "head-inline") {
|
|
3334
|
-
scripts.add({
|
|
3335
|
-
props: {},
|
|
3336
|
-
children: script.children
|
|
3337
|
-
});
|
|
3270
|
+
async #renderPage(request, routeData, mod, status = 200) {
|
|
3271
|
+
const url = new URL(request.url);
|
|
3272
|
+
const pathname = "/" + this.removeBase(url.pathname);
|
|
3273
|
+
const info = this.#routeDataToRouteInfo.get(routeData);
|
|
3274
|
+
const links = createLinkStylesheetElementSet(info.links);
|
|
3275
|
+
let scripts = /* @__PURE__ */ new Set();
|
|
3276
|
+
for (const script of info.scripts) {
|
|
3277
|
+
if ("stage" in script) {
|
|
3278
|
+
if (script.stage === "head-inline") {
|
|
3279
|
+
scripts.add({
|
|
3280
|
+
props: {},
|
|
3281
|
+
children: script.children
|
|
3282
|
+
});
|
|
3283
|
+
}
|
|
3284
|
+
} else {
|
|
3285
|
+
scripts.add(createModuleScriptElement(script));
|
|
3338
3286
|
}
|
|
3339
|
-
}
|
|
3340
|
-
|
|
3287
|
+
}
|
|
3288
|
+
try {
|
|
3289
|
+
const ctx = createRenderContext({
|
|
3290
|
+
request,
|
|
3291
|
+
origin: url.origin,
|
|
3292
|
+
pathname,
|
|
3293
|
+
propagation: this.#manifest.propagation,
|
|
3294
|
+
scripts,
|
|
3295
|
+
links,
|
|
3296
|
+
route: routeData,
|
|
3297
|
+
status
|
|
3298
|
+
});
|
|
3299
|
+
const response = await renderPage(mod, ctx, this.#env);
|
|
3300
|
+
return response;
|
|
3301
|
+
} catch (err) {
|
|
3302
|
+
error(this.#logging, "ssr", err.stack || err.message || String(err));
|
|
3303
|
+
return new Response(null, {
|
|
3304
|
+
status: 500,
|
|
3305
|
+
statusText: "Internal server error"
|
|
3306
|
+
});
|
|
3341
3307
|
}
|
|
3342
3308
|
}
|
|
3343
|
-
|
|
3309
|
+
async #callEndpoint(request, routeData, mod, status = 200) {
|
|
3310
|
+
const url = new URL(request.url);
|
|
3311
|
+
const pathname = "/" + this.removeBase(url.pathname);
|
|
3312
|
+
const handler = mod;
|
|
3344
3313
|
const ctx = createRenderContext({
|
|
3345
3314
|
request,
|
|
3346
3315
|
origin: url.origin,
|
|
3347
3316
|
pathname,
|
|
3348
|
-
propagation: __privateGet(this, _manifest).propagation,
|
|
3349
|
-
scripts,
|
|
3350
|
-
links,
|
|
3351
3317
|
route: routeData,
|
|
3352
3318
|
status
|
|
3353
3319
|
});
|
|
3354
|
-
const
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
}
|
|
3363
|
-
};
|
|
3364
|
-
_callEndpoint = new WeakSet();
|
|
3365
|
-
callEndpoint_fn = async function(request, routeData, mod, status = 200) {
|
|
3366
|
-
const url = new URL(request.url);
|
|
3367
|
-
const pathname = "/" + this.removeBase(url.pathname);
|
|
3368
|
-
const handler = mod;
|
|
3369
|
-
const ctx = createRenderContext({
|
|
3370
|
-
request,
|
|
3371
|
-
origin: url.origin,
|
|
3372
|
-
pathname,
|
|
3373
|
-
route: routeData,
|
|
3374
|
-
status
|
|
3375
|
-
});
|
|
3376
|
-
const result = await call(handler, __privateGet(this, _env), ctx);
|
|
3377
|
-
if (result.type === "response") {
|
|
3378
|
-
if (result.response.headers.get("X-Astro-Response") === "Not-Found") {
|
|
3379
|
-
const fourOhFourRequest = new Request(new URL("/404", request.url));
|
|
3380
|
-
const fourOhFourRouteData = this.match(fourOhFourRequest);
|
|
3381
|
-
if (fourOhFourRouteData) {
|
|
3382
|
-
return this.render(fourOhFourRequest, fourOhFourRouteData);
|
|
3320
|
+
const result = await call(handler, this.#env, ctx, this.#logging);
|
|
3321
|
+
if (result.type === "response") {
|
|
3322
|
+
if (result.response.headers.get("X-Astro-Response") === "Not-Found") {
|
|
3323
|
+
const fourOhFourRequest = new Request(new URL("/404", request.url));
|
|
3324
|
+
const fourOhFourRouteData = this.match(fourOhFourRequest);
|
|
3325
|
+
if (fourOhFourRouteData) {
|
|
3326
|
+
return this.render(fourOhFourRequest, fourOhFourRouteData);
|
|
3327
|
+
}
|
|
3383
3328
|
}
|
|
3384
|
-
|
|
3385
|
-
return result.response;
|
|
3386
|
-
} else {
|
|
3387
|
-
const body = result.body;
|
|
3388
|
-
const headers = new Headers();
|
|
3389
|
-
const mimeType = mime.getType(url.pathname);
|
|
3390
|
-
if (mimeType) {
|
|
3391
|
-
headers.set("Content-Type", `${mimeType};charset=utf-8`);
|
|
3329
|
+
return result.response;
|
|
3392
3330
|
} else {
|
|
3393
|
-
|
|
3331
|
+
const body = result.body;
|
|
3332
|
+
const headers = new Headers();
|
|
3333
|
+
const mimeType = mime.getType(url.pathname);
|
|
3334
|
+
if (mimeType) {
|
|
3335
|
+
headers.set("Content-Type", `${mimeType};charset=utf-8`);
|
|
3336
|
+
} else {
|
|
3337
|
+
headers.set("Content-Type", "text/plain;charset=utf-8");
|
|
3338
|
+
}
|
|
3339
|
+
const bytes = this.#encoder.encode(body);
|
|
3340
|
+
headers.set("Content-Length", bytes.byteLength.toString());
|
|
3341
|
+
const response = new Response(bytes, {
|
|
3342
|
+
status: 200,
|
|
3343
|
+
headers
|
|
3344
|
+
});
|
|
3345
|
+
attachToResponse(response, result.cookies);
|
|
3346
|
+
return response;
|
|
3394
3347
|
}
|
|
3395
|
-
const bytes = __privateGet(this, _encoder).encode(body);
|
|
3396
|
-
headers.set("Content-Length", bytes.byteLength.toString());
|
|
3397
|
-
const response = new Response(bytes, {
|
|
3398
|
-
status: 200,
|
|
3399
|
-
headers
|
|
3400
|
-
});
|
|
3401
|
-
attachToResponse(response, result.cookies);
|
|
3402
|
-
return response;
|
|
3403
3348
|
}
|
|
3404
|
-
}
|
|
3349
|
+
}
|
|
3405
3350
|
|
|
3406
3351
|
const clientAddressSymbol = Symbol.for("astro.clientAddress");
|
|
3407
3352
|
function createRequestFromNodeRequest(req, body) {
|