cloudcommerce 0.0.104 → 0.0.106
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 +24 -0
- package/action.yml +1 -4
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/cli/config/firebase.json +11 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/lib/config.d.ts +6 -3
- package/packages/firebase/lib/config.js +7 -6
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/firebase/src/config.ts +10 -8
- package/packages/modules/package.json +1 -1
- package/packages/passport/lib/firebase.js +1 -1
- package/packages/passport/lib/firebase.js.map +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/passport/src/firebase.ts +1 -1
- package/packages/ssr/lib/firebase/serve-feeds.js +8 -0
- package/packages/ssr/lib/firebase/serve-feeds.js.map +1 -0
- package/packages/ssr/lib/firebase/serve-storefront.js +24 -18
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/lib/firebase.js +9 -10
- package/packages/ssr/lib/firebase.js.map +1 -1
- package/packages/ssr/package.json +2 -1
- package/packages/ssr/src/firebase/serve-feeds.ts +9 -0
- package/packages/ssr/src/firebase/serve-storefront.ts +25 -19
- package/packages/ssr/src/firebase.ts +9 -13
- package/packages/storefront/dist/client/{LoginOffcanvas.6707cd95.js → LoginOffcanvas.3d5263f0.js} +1 -1
- package/packages/storefront/dist/client/chunks/LoginForm.407264cf.js +1396 -0
- package/packages/storefront/dist/client/chunks/{LoginOffcanvas.21bef0b8.js → LoginOffcanvas.111b9071.js} +1 -1
- package/packages/storefront/dist/client/hoisted.71b2f749.js +1 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/entry.mjs +4 -13
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/src/lib/layouts/BaseBody.astro +0 -11
- package/packages/storefront/src/lib/ssr-context.ts +3 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/chunks/LoginForm.aee2ceda.js +0 -1066
- package/packages/storefront/dist/client/chunks/index.esm.84a649c7.js +0 -331
- package/packages/storefront/dist/client/hoisted.054c36ac.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
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.0.106](https://github.com/ecomplus/cloud-commerce/compare/v0.0.105...v0.0.106) (2022-09-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ssr:** Change `Content-Security-Policy` header to `script-src "none"` ([51b8536](https://github.com/ecomplus/cloud-commerce/commit/51b8536cee1a70143df959e2536dd0fe0a1ee985))
|
|
11
|
+
|
|
12
|
+
### [0.0.105](https://github.com/ecomplus/cloud-commerce/compare/v0.0.104...v0.0.105) (2022-09-29)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **cli:** Update `firebase.json` with rewrites for sitemap and feeds ([019356e](https://github.com/ecomplus/cloud-commerce/commit/019356eaa6df494af898702fb89e12eb213389bb))
|
|
18
|
+
* **ssr:** Getting deploy options from config `ssrFunctionOptions` ([c795e90](https://github.com/ecomplus/cloud-commerce/commit/c795e90b2e8b9f463d571763e19b9f4508b5fd1a))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **cli:** Updating default SSR function region to `us-central1` ([9f76842](https://github.com/ecomplus/cloud-commerce/commit/9f76842356a23800c44e82e2125bd7ad1b5b0963))
|
|
24
|
+
* **passport:** Memory 128MiB option may be overwritten with `httpsFunctionOptions` ([a23fb67](https://github.com/ecomplus/cloud-commerce/commit/a23fb67100679c20103877c453c18d813fee8ac1))
|
|
25
|
+
* **ssr:** Hardset XSS/CSP security response headers ([6e20063](https://github.com/ecomplus/cloud-commerce/commit/6e200630c064fff1fa89a6cee9196b7d0165ad1d))
|
|
26
|
+
* **ssr:** Update default function deploy options ([c1d3cbd](https://github.com/ecomplus/cloud-commerce/commit/c1d3cbddaec4b5a0111dd9d0f4e9476e28aac283))
|
|
27
|
+
* **storefront:** Remove unecessary (startup time) import/start `firebase/app` ([f4b80ec](https://github.com/ecomplus/cloud-commerce/commit/f4b80ec2ab91feb40d0a00edfb19b16654661863))
|
|
28
|
+
|
|
5
29
|
### [0.0.104](https://github.com/ecomplus/cloud-commerce/compare/v0.0.103...v0.0.104) (2022-09-28)
|
|
6
30
|
|
|
7
31
|
### [0.0.103](https://github.com/ecomplus/cloud-commerce/compare/v0.0.102...v0.0.103) (2022-09-27)
|
package/action.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.106",
|
|
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>",
|
|
@@ -55,10 +55,20 @@
|
|
|
55
55
|
"function": "passport",
|
|
56
56
|
"region": "southamerica-east1"
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
"source": "/_feeds/**",
|
|
60
|
+
"function": "feeds",
|
|
61
|
+
"region": "southamerica-east1"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"source": "/sitemap.xml",
|
|
65
|
+
"function": "feeds",
|
|
66
|
+
"region": "southamerica-east1"
|
|
67
|
+
},
|
|
58
68
|
{
|
|
59
69
|
"source": "**/!(*(*.)ico|*(*.)png|*(*.)map)",
|
|
60
70
|
"function": "ssr",
|
|
61
|
-
"region": "
|
|
71
|
+
"region": "us-central1"
|
|
62
72
|
}
|
|
63
73
|
],
|
|
64
74
|
"headers": [
|
|
@@ -4,9 +4,12 @@ declare const mergeConfig: {
|
|
|
4
4
|
hello: string;
|
|
5
5
|
httpsFunctionOptions: {
|
|
6
6
|
region: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
};
|
|
8
|
+
ssrFunctionOptions: {
|
|
9
|
+
region: string;
|
|
10
|
+
memory: "128MiB" | "256MiB" | "512MiB" | "1GiB";
|
|
11
|
+
timeoutSeconds: number;
|
|
12
|
+
minInstances: number;
|
|
10
13
|
};
|
|
11
14
|
apps: {
|
|
12
15
|
discounts: {
|
|
@@ -7,17 +7,18 @@ const tinyErpEvents = [
|
|
|
7
7
|
'applications-dataSet',
|
|
8
8
|
];
|
|
9
9
|
const {
|
|
10
|
-
DEPLOY_REGION,
|
|
10
|
+
DEPLOY_REGION, SSR_DEPLOY_REGION, SSR_DEPLOY_MEMORY, SSR_DEPLOY_TIMEOUT_SECONDS, SSR_DEPLOY_MIN_INSTANCES,
|
|
11
11
|
} = process.env;
|
|
12
12
|
const mergeConfig = {
|
|
13
13
|
hello: 'from @cloudcommerce/firebase',
|
|
14
14
|
httpsFunctionOptions: {
|
|
15
15
|
region: DEPLOY_REGION || 'southamerica-east1',
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
},
|
|
17
|
+
ssrFunctionOptions: {
|
|
18
|
+
region: SSR_DEPLOY_REGION || 'us-central1',
|
|
19
|
+
memory: SSR_DEPLOY_MEMORY || '256MiB',
|
|
20
|
+
timeoutSeconds: SSR_DEPLOY_TIMEOUT_SECONDS ? Number(SSR_DEPLOY_TIMEOUT_SECONDS) : 15,
|
|
21
|
+
minInstances: SSR_DEPLOY_MIN_INSTANCES ? Number(SSR_DEPLOY_MIN_INSTANCES) : 1,
|
|
21
22
|
},
|
|
22
23
|
apps: {
|
|
23
24
|
discounts: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,MAAsB,MAAM,uBAAuB,CAAC;AAE3D,MAAM,aAAa,GAAmB;IACpC,qBAAqB;IACrB,cAAc;IACd,mBAAmB;IACnB,sBAAsB;CACvB,CAAC;AAEF,MAAM,EACJ,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,MAAsB,MAAM,uBAAuB,CAAC;AAE3D,MAAM,aAAa,GAAmB;IACpC,qBAAqB;IACrB,cAAc;IACd,mBAAmB;IACnB,sBAAsB;CACvB,CAAC;AAEF,MAAM,EACJ,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,GACzB,GAAG,OAAO,CAAC,GAAG,CAAC;AAEhB,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,8BAA8B;IACrC,oBAAoB,EAAE;QACpB,MAAM,EAAE,aAAa,IAAI,oBAAoB;KAC9C;IACD,kBAAkB,EAAE;QAClB,MAAM,EAAE,iBAAiB,IAAI,aAAa;QAC1C,MAAM,EAAG,iBAA6D,IAAI,QAAQ;QAClF,cAAc,EAAE,0BAA0B,CAAC,CAAC,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAAE;QACpF,YAAY,EAAE,wBAAwB,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;KAC9E;IACD,IAAI,EAAE;QACJ,SAAS,EAAE;YACT,KAAK,EAAE,IAAI;SACZ;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,IAAI;SACZ;QACD,cAAc,EAAE;YACd,KAAK,EAAE,IAAI;SACZ;QACD,MAAM,EAAE;YACN,KAAK,EAAE,IAAI;SACZ;QACD,OAAO,EAAE;YACP,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,aAAa;SACtB;KACF;CACF,CAAC;AACF,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAExB,eAAe,MAId,CAAC"}
|
|
@@ -10,20 +10,22 @@ const tinyErpEvents: ApiEventName[] = [
|
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
12
|
DEPLOY_REGION,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
SSR_DEPLOY_REGION,
|
|
14
|
+
SSR_DEPLOY_MEMORY,
|
|
15
|
+
SSR_DEPLOY_TIMEOUT_SECONDS,
|
|
16
|
+
SSR_DEPLOY_MIN_INSTANCES,
|
|
16
17
|
} = process.env;
|
|
17
18
|
|
|
18
19
|
const mergeConfig = {
|
|
19
20
|
hello: 'from @cloudcommerce/firebase',
|
|
20
21
|
httpsFunctionOptions: {
|
|
21
22
|
region: DEPLOY_REGION || 'southamerica-east1',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
},
|
|
24
|
+
ssrFunctionOptions: {
|
|
25
|
+
region: SSR_DEPLOY_REGION || 'us-central1',
|
|
26
|
+
memory: (SSR_DEPLOY_MEMORY as '128MiB' | '256MiB' | '512MiB' | '1GiB') || '256MiB',
|
|
27
|
+
timeoutSeconds: SSR_DEPLOY_TIMEOUT_SECONDS ? Number(SSR_DEPLOY_TIMEOUT_SECONDS) : 15,
|
|
28
|
+
minInstances: SSR_DEPLOY_MIN_INSTANCES ? Number(SSR_DEPLOY_MIN_INSTANCES) : 1,
|
|
27
29
|
},
|
|
28
30
|
apps: {
|
|
29
31
|
discounts: {
|
|
@@ -16,8 +16,8 @@ import servePassportApi from './firebase/serve-passport-api.js';
|
|
|
16
16
|
const authFirebase = getAuth();
|
|
17
17
|
const firestore = getFirestore();
|
|
18
18
|
const options = {
|
|
19
|
-
...config.get().httpsFunctionOptions,
|
|
20
19
|
memory: '128MiB',
|
|
20
|
+
...config.get().httpsFunctionOptions,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
// eslint-disable-next-line import/prefer-default-export
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,gDAAgD;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,gDAAgD;AAChD,OAAO,EAAgB,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAE7D,cAAc;AACd,8DAA8D;AAC9D,qFAAqF;AACrF,8HAA8H;AAC9H,uDAAuD;AAEvD,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAC/B,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;AAEjC,MAAM,OAAO,GAAG;IACd,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB;
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,gDAAgD;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,gDAAgD;AAChD,OAAO,EAAgB,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAE7D,cAAc;AACd,8DAA8D;AAC9D,qFAAqF;AACrF,8HAA8H;AAC9H,uDAAuD;AAEvD,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAC/B,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;AAEjC,MAAM,OAAO,GAAG;IACd,MAAM,EAAE,QAAQ;IAChB,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB;CACrB,CAAC;AAElB,wDAAwD;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACtD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;IACjC,gBAAgB,CACd,GAAG,EACH,GAAG,EACH,SAAS,EACT,YAAY,EACZ,OAAO,CACR,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -18,8 +18,8 @@ const authFirebase = getAuth();
|
|
|
18
18
|
const firestore = getFirestore();
|
|
19
19
|
|
|
20
20
|
const options = {
|
|
21
|
-
...config.get().httpsFunctionOptions,
|
|
22
21
|
memory: '128MiB',
|
|
22
|
+
...config.get().httpsFunctionOptions,
|
|
23
23
|
} as HttpsOptions;
|
|
24
24
|
|
|
25
25
|
// eslint-disable-next-line import/prefer-default-export
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-feeds.js","sourceRoot":"","sources":["../../src/firebase/serve-feeds.ts"],"names":[],"mappings":"AAEA,eAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACvB,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KAC5B;IACD,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { join as joinPath } from 'path';
|
|
2
2
|
import { readFile } from 'fs/promises';
|
|
3
|
+
import compression from 'compression';
|
|
3
4
|
|
|
4
5
|
const { STOREFRONT_BASE_DIR } = process.env;
|
|
5
6
|
const baseDir = STOREFRONT_BASE_DIR || process.cwd();
|
|
6
7
|
const clientRoot = new URL(joinPath(baseDir, 'dist/client/'), import.meta.url);
|
|
8
|
+
const compress = compression();
|
|
7
9
|
|
|
8
10
|
export default (req, res) => {
|
|
11
|
+
res.set('X-XSS-Protection', '1; mode=block');
|
|
12
|
+
res.set('Content-Security-Policy', "script-src 'none'");
|
|
9
13
|
const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
|
|
10
14
|
const setStatusAndCache = (status, defaultCache) => {
|
|
11
15
|
return res.status(status)
|
|
@@ -25,25 +29,27 @@ export default (req, res) => {
|
|
|
25
29
|
.send(err.toString());
|
|
26
30
|
}
|
|
27
31
|
};
|
|
32
|
+
compress(req, res, async () => {
|
|
28
33
|
/*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
|
|
35
|
+
import { handler as ssrHandler } from '../dist/server/entry.mjs';
|
|
36
|
+
global.ssr_handler = ssrHandler;
|
|
37
|
+
*/
|
|
38
|
+
global.ssr_handler(req, res, async (err) => {
|
|
39
|
+
if (err) {
|
|
40
|
+
res.set('X-SSR-Error', err.message);
|
|
41
|
+
fallback(err);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const local = new URL(`.${url}`, clientRoot);
|
|
45
|
+
try {
|
|
46
|
+
const data = await readFile(local);
|
|
47
|
+
setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
|
|
48
|
+
.send(data);
|
|
49
|
+
} catch {
|
|
50
|
+
fallback(err, 404);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
47
53
|
});
|
|
48
54
|
};
|
|
49
55
|
// # sourceMappingURL=serve-storefront.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve-storefront.js","sourceRoot":"","sources":["../../src/firebase/serve-storefront.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"serve-storefront.js","sourceRoot":"","sources":["../../src/firebase/serve-storefront.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,WAAW,MAAM,aAAa,CAAC;AAEtC,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAC5C,MAAM,OAAO,GAAG,mBAAmB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AACrD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/E,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AAE/B,eAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;IAC7C,GAAG,CAAC,GAAG,CAAC,yBAAyB,EAAE,mBAAmB,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAEhE,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,YAAoB,EAAE,EAAE;QACjE,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;aACtB,GAAG,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;aACnC,GAAG,CACF,eAAe,EACf,CAAC,OAAO,MAAM,CAAC,aAAa,KAAK,UAAU,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;eACvE,YAAY,CAClB,CAAC;IACN,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAE,MAAM,GAAG,GAAG,EAAE,EAAE;QAC1C,IAAI,GAAG,KAAK,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;YAC3E,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,CAAC;iBAC7C,IAAI,CAAC,cAAc;kBAChB,yCAAyC;kBACvC,wBAAwB,MAAM,QAAQ,kBAAkB,CAAC,GAAG,CAAC,KAAK;kBACpE,gBAAgB,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;SACvD;aAAM;YACL,iBAAiB,CAAC,MAAM,EAAE,mCAAmC,CAAC;iBAC3D,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;SACzB;IACH,CAAC,CAAC;IAEF,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE;QAC5B;;;;UAIE;QACF,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAQ,EAAE,EAAE;YAC9C,IAAI,GAAG,EAAE;gBACP,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;gBACpC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACd,OAAO;aACR;YACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;YAC7C,IAAI;gBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACnC,iBAAiB,CAAC,GAAG,EAAE,kCAAkC,CAAC;qBACvD,IAAI,CAAC,IAAI,CAAC,CAAC;aACf;YAAC,MAAM;gBACN,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -7,17 +7,16 @@ import { onRequest } from 'firebase-functions/v2/https';
|
|
|
7
7
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
8
8
|
import serveStorefront from './firebase/serve-storefront.js';
|
|
9
9
|
|
|
10
|
-
const {
|
|
11
|
-
httpsFunctionOptions: {
|
|
12
|
-
region, timeoutSeconds, memory, minInstances,
|
|
13
|
-
},
|
|
14
|
-
} = config.get();
|
|
10
|
+
const { httpsFunctionOptions, ssrFunctionOptions } = config.get();
|
|
15
11
|
|
|
16
|
-
export const ssr = onRequest({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
export const ssr = onRequest(ssrFunctionOptions, (req, res) => {
|
|
13
|
+
serveStorefront(req, res);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const feeds = onRequest({
|
|
17
|
+
...httpsFunctionOptions,
|
|
18
|
+
timeoutSeconds: 120,
|
|
19
|
+
memory: ssrFunctionOptions.memory,
|
|
21
20
|
}, (req, res) => {
|
|
22
21
|
serveStorefront(req, res);
|
|
23
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,aAAa,EAAE,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,MAAM,
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,aAAa,EAAE,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,MAAM,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAElE,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAC5D,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC;IAC7B,GAAG,oBAAoB;IACvB,cAAc,EAAE,GAAG;IACnB,MAAM,EAAE,kBAAkB,CAAC,MAAM;CAClC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACd,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/ssr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.106",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@ecomplus/utils": "^1.4.1",
|
|
30
30
|
"astro": "^1.3.0",
|
|
31
31
|
"color": "^4.2.3",
|
|
32
|
+
"compression": "^1.7.4",
|
|
32
33
|
"firebase-admin": "^11.0.1",
|
|
33
34
|
"firebase-functions": "^3.24.0",
|
|
34
35
|
"image-size": "^1.0.2",
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { Request, Response } from 'firebase-functions';
|
|
2
2
|
import { join as joinPath } from 'path';
|
|
3
3
|
import { readFile } from 'fs/promises';
|
|
4
|
+
import compression from 'compression';
|
|
4
5
|
|
|
5
6
|
const { STOREFRONT_BASE_DIR } = process.env;
|
|
6
7
|
const baseDir = STOREFRONT_BASE_DIR || process.cwd();
|
|
7
8
|
const clientRoot = new URL(joinPath(baseDir, 'dist/client/'), import.meta.url);
|
|
9
|
+
const compress = compression();
|
|
8
10
|
|
|
9
11
|
export default (req: Request, res: Response) => {
|
|
12
|
+
res.set('X-XSS-Protection', '1; mode=block');
|
|
13
|
+
res.set('Content-Security-Policy', "script-src 'none'");
|
|
10
14
|
const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
|
|
11
15
|
|
|
12
16
|
const setStatusAndCache = (status: number, defaultCache: string) => {
|
|
@@ -32,24 +36,26 @@ export default (req: Request, res: Response) => {
|
|
|
32
36
|
}
|
|
33
37
|
};
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
compress(req, res, async () => {
|
|
40
|
+
/*
|
|
41
|
+
https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
|
|
42
|
+
import { handler as ssrHandler } from '../dist/server/entry.mjs';
|
|
43
|
+
global.ssr_handler = ssrHandler;
|
|
44
|
+
*/
|
|
45
|
+
global.ssr_handler(req, res, async (err: any) => {
|
|
46
|
+
if (err) {
|
|
47
|
+
res.set('X-SSR-Error', err.message);
|
|
48
|
+
fallback(err);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const local = new URL(`.${url}`, clientRoot);
|
|
52
|
+
try {
|
|
53
|
+
const data = await readFile(local);
|
|
54
|
+
setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
|
|
55
|
+
.send(data);
|
|
56
|
+
} catch {
|
|
57
|
+
fallback(err, 404);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
54
60
|
});
|
|
55
61
|
};
|
|
@@ -8,20 +8,16 @@ import { onRequest } from 'firebase-functions/v2/https';
|
|
|
8
8
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
9
9
|
import serveStorefront from './firebase/serve-storefront';
|
|
10
10
|
|
|
11
|
-
const {
|
|
12
|
-
httpsFunctionOptions: {
|
|
13
|
-
region,
|
|
14
|
-
timeoutSeconds,
|
|
15
|
-
memory,
|
|
16
|
-
minInstances,
|
|
17
|
-
},
|
|
18
|
-
} = config.get();
|
|
11
|
+
const { httpsFunctionOptions, ssrFunctionOptions } = config.get();
|
|
19
12
|
|
|
20
|
-
export const ssr = onRequest({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
export const ssr = onRequest(ssrFunctionOptions, (req, res) => {
|
|
14
|
+
serveStorefront(req, res);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const feeds = onRequest({
|
|
18
|
+
...httpsFunctionOptions,
|
|
19
|
+
timeoutSeconds: 120,
|
|
20
|
+
memory: ssrFunctionOptions.memory,
|
|
25
21
|
}, (req, res) => {
|
|
26
22
|
serveStorefront(req, res);
|
|
27
23
|
});
|
package/packages/storefront/dist/client/{LoginOffcanvas.6707cd95.js → LoginOffcanvas.3d5263f0.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as i}from"./chunks/LoginOffcanvas.
|
|
1
|
+
import{_ as i}from"./chunks/LoginOffcanvas.111b9071.js";import"./chunks/preload-helper.f15ab524.js";import"./chunks/runtime-dom.esm-bundler.738639ee.js";/* empty css */export{i as default};
|