cloudcommerce 0.23.1 → 0.23.3
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 +19 -0
- package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
- package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barra-doce/package.json +2 -2
- package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
- package/ecomplus-stores/iluminim/functions/ssr/package.json +6 -6
- package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/iluminim/package.json +2 -2
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/apps/affilate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/cloudflare/swr-worker.js +6 -6
- package/packages/ssr/lib/firebase/serve-storefront.js +30 -23
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/cloudflare/swr-worker.ts +8 -8
- package/packages/ssr/src/cloudflare/tsconfig.json +2 -1
- package/packages/ssr/src/firebase/serve-storefront.ts +33 -23
- package/packages/storefront/dist/client/_astro/ShopHeader.2400b065.js +4 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{_...d3f15170.mjs → _...c5a36021.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{account@_@astro.38a725e7.mjs → account@_@astro.3e90f29a.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{endpoint@_@js.a92a4584.mjs → endpoint@_@js.b79eed3b.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{fallback@_@astro.4e98328e.mjs → fallback@_@astro.9f73db0f.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{index@_@astro.2dda826c.mjs → index@_@astro.0221a7bd.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{index@_@astro.db07fb09.mjs → index@_@astro.66b84ac2.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.88866aae.mjs → _...slug_.astro.501582b9.mjs} +5 -4
- package/packages/storefront/dist/server/chunks/pages/{endpoint.js.a11da4ad.mjs → endpoint.js.4c130895.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{fallback.astro.c1fd06ab.mjs → fallback.astro.8d1c6076.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{index.astro.c45cc893.mjs → index.astro.f1104ab2.mjs} +1 -1
- package/packages/storefront/dist/server/entry.mjs +8 -8
- package/packages/storefront/dist/server/renderers.mjs +1 -1
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/src/lib/composables/use-sticky-header.ts +7 -3
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.7ecb7597.js +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.23.3](https://github.com/ecomplus/cloud-commerce/compare/v0.23.2...v0.23.3) (2023-08-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ssr:** Fix CSS filepath at Link header (early hints) ([2761642](https://github.com/ecomplus/cloud-commerce/commit/2761642d4cf0f4b5dab983c5fa0434e5ee4af5a7))
|
|
11
|
+
|
|
12
|
+
### [0.23.2](https://github.com/ecomplus/cloud-commerce/compare/v0.23.1...v0.23.2) (2023-08-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **ssr:** Add new `X-Style-Link` header for custom CDN layer early hints ([390d54a](https://github.com/ecomplus/cloud-commerce/commit/390d54aed024838fb36633d5c2a4429b4633b6f6))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **ssr:** Prevent erro with undefined `cacheControl` on SWR worker ([b926936](https://github.com/ecomplus/cloud-commerce/commit/b926936908a9628a62d13603660d8a87fc7e8ddf))
|
|
23
|
+
|
|
5
24
|
### [0.23.1](https://github.com/ecomplus/cloud-commerce/compare/v0.23.0...v0.23.1) (2023-08-08)
|
|
6
25
|
|
|
7
26
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/feeds": "^0.23.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.23.
|
|
20
|
-
"@cloudcommerce/passport": "^0.23.
|
|
18
|
+
"@cloudcommerce/feeds": "^0.23.2",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.23.2",
|
|
20
|
+
"@cloudcommerce/passport": "^0.23.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@cloudcommerce/api": "^0.23.
|
|
21
|
-
"@cloudcommerce/firebase": "^0.23.
|
|
22
|
-
"@cloudcommerce/ssr": "^0.23.
|
|
20
|
+
"@cloudcommerce/api": "^0.23.2",
|
|
21
|
+
"@cloudcommerce/firebase": "^0.23.2",
|
|
22
|
+
"@cloudcommerce/ssr": "^0.23.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@cloudcommerce/i18n": "^0.23.
|
|
26
|
-
"@cloudcommerce/storefront": "^0.23.
|
|
27
|
-
"@cloudcommerce/types": "^0.23.
|
|
25
|
+
"@cloudcommerce/i18n": "^0.23.2",
|
|
26
|
+
"@cloudcommerce/storefront": "^0.23.2",
|
|
27
|
+
"@cloudcommerce/types": "^0.23.2",
|
|
28
28
|
"@fontsource/croissant-one": "^5.0.5",
|
|
29
29
|
"@iconify-json/mingcute": "^1.1.7"
|
|
30
30
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/events": "^0.23.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.23.
|
|
20
|
-
"@cloudcommerce/modules": "^0.23.
|
|
18
|
+
"@cloudcommerce/events": "^0.23.2",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.23.2",
|
|
20
|
+
"@cloudcommerce/modules": "^0.23.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cloudcommerce/cli": "^0.23.
|
|
26
|
+
"@cloudcommerce/cli": "^0.23.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudcommerce/eslint": "^0.
|
|
29
|
+
"@cloudcommerce/eslint": "^0.23.2"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/feeds": "^0.23.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.23.
|
|
20
|
-
"@cloudcommerce/passport": "^0.23.
|
|
18
|
+
"@cloudcommerce/feeds": "^0.23.2",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.23.2",
|
|
20
|
+
"@cloudcommerce/passport": "^0.23.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@cloudcommerce/api": "^0.23.
|
|
21
|
-
"@cloudcommerce/firebase": "^0.23.
|
|
22
|
-
"@cloudcommerce/ssr": "^0.23.
|
|
20
|
+
"@cloudcommerce/api": "^0.23.2",
|
|
21
|
+
"@cloudcommerce/firebase": "^0.23.2",
|
|
22
|
+
"@cloudcommerce/ssr": "^0.23.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@cloudcommerce/i18n": "^0.23.
|
|
26
|
-
"@cloudcommerce/storefront": "^0.23.
|
|
27
|
-
"@cloudcommerce/types": "^0.23.
|
|
25
|
+
"@cloudcommerce/i18n": "^0.23.2",
|
|
26
|
+
"@cloudcommerce/storefront": "^0.23.2",
|
|
27
|
+
"@cloudcommerce/types": "^0.23.2",
|
|
28
28
|
"@fontsource-variable/heebo": "^5.0.5",
|
|
29
29
|
"@iconify-json/carbon": "^1.1.18"
|
|
30
30
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/events": "^0.23.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.23.
|
|
20
|
-
"@cloudcommerce/modules": "^0.23.
|
|
18
|
+
"@cloudcommerce/events": "^0.23.2",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.23.2",
|
|
20
|
+
"@cloudcommerce/modules": "^0.23.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cloudcommerce/cli": "^0.23.
|
|
26
|
+
"@cloudcommerce/cli": "^0.23.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudcommerce/eslint": "^0.
|
|
29
|
+
"@cloudcommerce/eslint": "^0.23.2"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.23.
|
|
4
|
+
"version": "0.23.3",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"vite": "^4.4.9",
|
|
31
31
|
"vitest": "^0.33.0",
|
|
32
32
|
"zx": "^7.2.3",
|
|
33
|
-
"@cloudcommerce/eslint": "0.23.
|
|
33
|
+
"@cloudcommerce/eslint": "0.23.3"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"fix-install": "bash scripts/pre-install.sh && pnpm i",
|
|
@@ -5,7 +5,7 @@ const HEADER_SSR_TOOK = 'X-Load-Took';
|
|
|
5
5
|
const HEADER_STALE_AT = 'X-Edge-Stale-At';
|
|
6
6
|
const resolveCacheControl = (response) => {
|
|
7
7
|
const cacheControl = response.headers.get(HEADER_CACHE_CONTROL);
|
|
8
|
-
if (!response.headers.get(HEADER_SSR_TOOK)) {
|
|
8
|
+
if (!cacheControl || !response.headers.get(HEADER_SSR_TOOK)) {
|
|
9
9
|
return { cacheControl };
|
|
10
10
|
}
|
|
11
11
|
const parts = cacheControl.replace(/ +/g, '').split(',');
|
|
@@ -14,11 +14,11 @@ const resolveCacheControl = (response) => {
|
|
|
14
14
|
result[key] = Number(value) || 0;
|
|
15
15
|
return result;
|
|
16
16
|
}, {});
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
17
|
+
const cdnMaxAge = typeof sMaxAge === 'number' ? sMaxAge : maxAge;
|
|
18
|
+
if (!cdnMaxAge || cdnMaxAge <= 1 || !staleMaxAge || staleMaxAge <= cdnMaxAge) {
|
|
19
19
|
return { cacheControl };
|
|
20
20
|
}
|
|
21
|
-
const staleAt = Date.now() + (
|
|
21
|
+
const staleAt = Date.now() + (cdnMaxAge * 1000);
|
|
22
22
|
return {
|
|
23
23
|
cacheControl: `public, max-age=${maxAge}, must-revalidate`
|
|
24
24
|
+ `, s-maxage=${staleMaxAge}`,
|
|
@@ -40,7 +40,7 @@ const addHeaders = (response, headers) => {
|
|
|
40
40
|
return res;
|
|
41
41
|
};
|
|
42
42
|
const toCacheRes = (response, cacheControl, staleAt) => {
|
|
43
|
-
if (
|
|
43
|
+
if (cacheControl === undefined) {
|
|
44
44
|
const parsedCacheControl = resolveCacheControl(response);
|
|
45
45
|
cacheControl = parsedCacheControl.cacheControl;
|
|
46
46
|
staleAt = parsedCacheControl.staleAt;
|
|
@@ -66,7 +66,7 @@ const swr = async (event) => {
|
|
|
66
66
|
}
|
|
67
67
|
const [uri] = event.request.url.split('?', 2);
|
|
68
68
|
const request = new Request(`${uri}?t=${Date.now()}`, event.request);
|
|
69
|
-
const cacheKey = new Request(`${uri}?v=
|
|
69
|
+
const cacheKey = new Request(`${uri}?v=30`, {
|
|
70
70
|
method: event.request.method,
|
|
71
71
|
});
|
|
72
72
|
const cachedRes = await caches.default.match(cacheKey);
|
|
@@ -6,22 +6,24 @@ const { STOREFRONT_BASE_DIR, SSR_PROXY_DEBUG, SSR_PROXY_TIMEOUT } = process.env;
|
|
|
6
6
|
const baseDir = STOREFRONT_BASE_DIR || process.cwd();
|
|
7
7
|
let imagesManifest;
|
|
8
8
|
const builtImages = [];
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
let cssFilepath;
|
|
10
|
+
readFile(joinPath(baseDir, 'dist/server/stylesheets.csv'), 'utf-8')
|
|
11
|
+
.then((stylesManifest) => {
|
|
12
|
+
const cssFiles = [];
|
|
13
|
+
stylesManifest.split(/\n/).forEach((line) => {
|
|
14
|
+
const [filename] = line.split(',');
|
|
15
|
+
if (filename) cssFiles.push(filename);
|
|
16
|
+
});
|
|
17
|
+
if (cssFiles.length === 1) {
|
|
18
|
+
cssFilepath = cssFiles[0]?.replace('./dist/client/', '/');
|
|
19
|
+
if (cssFilepath
|
|
20
|
+
&& cssFilepath.charAt(0) !== '/'
|
|
21
|
+
&& !cssFilepath.startsWith('https://')) {
|
|
22
|
+
cssFilepath = `/${cssFilepath}`;
|
|
20
23
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
.catch(logger.warn);
|
|
25
27
|
const isProxyDebug = SSR_PROXY_DEBUG ? String(SSR_PROXY_DEBUG).toLowerCase() === 'true' : false;
|
|
26
28
|
const proxyTimeout = SSR_PROXY_TIMEOUT ? Number(SSR_PROXY_TIMEOUT) : 3000;
|
|
27
29
|
const proxy = async (req, res) => {
|
|
@@ -167,15 +169,20 @@ export default async (req, res) => {
|
|
|
167
169
|
res.sendStatus(400);
|
|
168
170
|
return;
|
|
169
171
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
/*
|
|
173
|
+
Check Response methods used by Astro Node.js integration:
|
|
174
|
+
https://github.com/withastro/astro/blob/main/packages/integrations/node/src/nodeMiddleware.ts
|
|
175
|
+
*/
|
|
176
|
+
const _writeHead = res.writeHead;
|
|
177
|
+
/* eslint-disable prefer-rest-params */
|
|
178
|
+
// @ts-ignore
|
|
179
|
+
res.writeHead = function writeHead(status, headers) {
|
|
180
|
+
if (status === 200 && headers && cssFilepath) {
|
|
181
|
+
// https://community.cloudflare.com/t/early-hints-need-more-data-before-switching-over/342888/21
|
|
182
|
+
headers.Link = `<${cssFilepath}>; rel=preload; as=style`;
|
|
177
183
|
}
|
|
178
|
-
|
|
184
|
+
_writeHead.apply(res, [status, headers]);
|
|
185
|
+
};
|
|
179
186
|
/*
|
|
180
187
|
https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
|
|
181
188
|
import { handler as renderStorefront } from '../dist/server/entry.mjs';
|