cloudcommerce 0.8.1 → 0.8.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/.github/workflows/create-release.yml +1 -1
- package/CHANGELOG.md +22 -0
- 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/package.json +7 -7
- package/ecomplus-stores/monocard/package.json +1 -1
- package/package.json +1 -1
- 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 +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/config/firebase.json +16 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase/serve-storefront.js +51 -1
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/firebase/serve-storefront.ts +52 -0
- package/packages/storefront/dist/server/chunks/pages/{all.d97031a1.mjs → all.27c6aee2.mjs} +56 -54
- package/packages/storefront/dist/server/entry.mjs +2 -2
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/scripts/build-prod.sh +5 -5
- package/packages/storefront/src/lib/layouts/BaseBody.astro +13 -0
- package/packages/storefront/src/lib/layouts/BaseHead.astro +1 -1
- package/packages/storefront/src/serverless/Picture.runtime.astro +3 -1
- package/packages/storefront/src/serverless/get-image.ts +14 -8
- package/packages/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
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.8.3](https://github.com/ecomplus/cloud-commerce/compare/v0.8.2...v0.8.3) (2023-03-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **ssr:** Simple fallback to /_image route reading images manifest ([3fb19b0](https://github.com/ecomplus/cloud-commerce/commit/3fb19b06452082f270e9e3c853e53efe1eaa4b51))
|
|
11
|
+
* **storefront:** Add hidden icon (if set) on body with <Picture> to pre-compile [[#129](https://github.com/ecomplus/cloud-commerce/issues/129)] ([a4838f0](https://github.com/ecomplus/cloud-commerce/commit/a4838f00310674a0da747a21e596c57ad5107826))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **ssr:** Edit /_image route fallback to just return original href if no built image found ([6d38140](https://github.com/ecomplus/cloud-commerce/commit/6d381400648309b39089faa80c5c4a9d32c5b8c2))
|
|
17
|
+
* **storefront:** Prevent fatal error with unmatched built image ([b4dc6f8](https://github.com/ecomplus/cloud-commerce/commit/b4dc6f8acf47ac49e310a8b0b4377c236120e238))
|
|
18
|
+
* **storefront:** Use `STOREFRONT_BASE_DIR` if set to read images manifest files ([bee44a7](https://github.com/ecomplus/cloud-commerce/commit/bee44a73a1f56a5594458100bd42ff959bb7a462))
|
|
19
|
+
|
|
20
|
+
### [0.8.2](https://github.com/ecomplus/cloud-commerce/compare/v0.8.1...v0.8.2) (2023-03-17)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **ssr:** Prevent fatal `ERR_HTTP_HEADERS_SENT` on SSR error ([2e9c137](https://github.com/ecomplus/cloud-commerce/commit/2e9c137cf004c70050222721e3059be83be576c9))
|
|
26
|
+
|
|
5
27
|
### [0.8.1](https://github.com/ecomplus/cloud-commerce/compare/v0.8.0...v0.8.1) (2023-03-17)
|
|
6
28
|
|
|
7
29
|
## [0.8.0](https://github.com/ecomplus/cloud-commerce/compare/v0.7.1...v0.8.0) (2023-03-17)
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@astrojs/node": "
|
|
21
|
-
"@cloudcommerce/api": "^0.8.
|
|
22
|
-
"@cloudcommerce/firebase": "^0.8.
|
|
23
|
-
"@cloudcommerce/ssr": "^0.8.
|
|
20
|
+
"@astrojs/node": "5.1.0",
|
|
21
|
+
"@cloudcommerce/api": "^0.8.2",
|
|
22
|
+
"@cloudcommerce/firebase": "^0.8.2",
|
|
23
|
+
"@cloudcommerce/ssr": "^0.8.2",
|
|
24
24
|
"@vueuse/motion": "2.0.0-beta.22"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@cloudcommerce/i18n": "^0.8.
|
|
28
|
-
"@cloudcommerce/storefront": "^0.8.
|
|
29
|
-
"@cloudcommerce/types": "^0.8.
|
|
27
|
+
"@cloudcommerce/i18n": "^0.8.2",
|
|
28
|
+
"@cloudcommerce/storefront": "^0.8.2",
|
|
29
|
+
"@cloudcommerce/types": "^0.8.2",
|
|
30
30
|
"@fontsource/inter": "^4.5.15",
|
|
31
31
|
"@iconify-json/ri": "^1.1.5",
|
|
32
32
|
"@iconify-json/wpf": "^1.1.4",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.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>",
|
|
@@ -23,7 +23,22 @@
|
|
|
23
23
|
{
|
|
24
24
|
"predeploy": "npm run build -- --codebase ssr",
|
|
25
25
|
"source": "functions/ssr",
|
|
26
|
-
"codebase": "ssr"
|
|
26
|
+
"codebase": "ssr",
|
|
27
|
+
"ignore": [
|
|
28
|
+
".git",
|
|
29
|
+
".runtimeconfig.json",
|
|
30
|
+
"firebase-debug.log",
|
|
31
|
+
"firebase-debug.*.log",
|
|
32
|
+
"node_modules",
|
|
33
|
+
".turbo",
|
|
34
|
+
"_astro",
|
|
35
|
+
"dist/client",
|
|
36
|
+
"functions/ssr/dist/client",
|
|
37
|
+
"/public",
|
|
38
|
+
"functions/ssr/public",
|
|
39
|
+
"/src",
|
|
40
|
+
"functions/ssr/src"
|
|
41
|
+
]
|
|
27
42
|
}
|
|
28
43
|
],
|
|
29
44
|
"hosting": {
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { join as joinPath } from 'path';
|
|
2
2
|
import { readFile } from 'fs/promises';
|
|
3
|
+
import logger from 'firebase-functions/logger';
|
|
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
|
+
let imagesManifest;
|
|
9
|
+
const builtImages = [];
|
|
7
10
|
|
|
8
11
|
export default (req, res) => {
|
|
9
12
|
res.set('X-XSS-Protection', '1; mode=block');
|
|
10
13
|
const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
|
|
11
14
|
const setStatusAndCache = (status, defaultCache) => {
|
|
15
|
+
if (res.headersSent) return res;
|
|
12
16
|
return res.status(status)
|
|
13
17
|
.set('X-SSR-ID', `v1/${Date.now()}`)
|
|
14
18
|
.set('Cache-Control', (typeof global.cache_control === 'function' && global.cache_control(status))
|
|
@@ -26,13 +30,59 @@ export default (req, res) => {
|
|
|
26
30
|
.send(err.toString());
|
|
27
31
|
}
|
|
28
32
|
};
|
|
29
|
-
|
|
33
|
+
if (req.path === '/_image') {
|
|
34
|
+
const { href } = req.query;
|
|
35
|
+
if (typeof href === 'string' && href.length > 3) {
|
|
36
|
+
const width = Number(req.query.w);
|
|
37
|
+
const format = String(req.query.f);
|
|
38
|
+
if (width > 0 && /^(webp|avif|png|jpg|jpeg)$/.test(format)) {
|
|
39
|
+
(async () => {
|
|
40
|
+
if (!imagesManifest) {
|
|
41
|
+
const manifestFilepath = joinPath(baseDir, 'dist/server/images.dist.csv');
|
|
42
|
+
imagesManifest = await readFile(manifestFilepath, 'utf-8');
|
|
43
|
+
imagesManifest.split(/\n/).forEach((line) => {
|
|
44
|
+
const [filename, _width, height] = line.split(',');
|
|
45
|
+
builtImages.push({
|
|
46
|
+
filename,
|
|
47
|
+
width: Number(_width),
|
|
48
|
+
height: Number(height),
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
builtImages.sort((a, b) => {
|
|
52
|
+
if (a.width < b.width) return -1;
|
|
53
|
+
return 1;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const filename = href.replace(/^.*\//, '').replace(/.\w+(\?.*)?$/, '');
|
|
57
|
+
const filenameRegExp = new RegExp(`[_.][a-z0-9]+\\.${format}$`, 'i');
|
|
58
|
+
const builtImage = builtImages.find((_builtImage) => {
|
|
59
|
+
return _builtImage.width >= width
|
|
60
|
+
&& filename === _builtImage.filename.replace(filenameRegExp, '');
|
|
61
|
+
});
|
|
62
|
+
if (builtImage) {
|
|
63
|
+
return res.redirect(301, `/_astro/${builtImage.filename}`);
|
|
64
|
+
}
|
|
65
|
+
return res.redirect(302, href);
|
|
66
|
+
})();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
res.sendStatus(400);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
/*
|
|
30
74
|
https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
|
|
31
75
|
import { handler as ssrHandler } from '../dist/server/entry.mjs';
|
|
32
76
|
global.ssr_handler = ssrHandler;
|
|
33
77
|
*/
|
|
34
78
|
global.ssr_handler(req, res, async (err) => {
|
|
35
79
|
if (err) {
|
|
80
|
+
if (res.headersSent) {
|
|
81
|
+
logger.error(err);
|
|
82
|
+
res.end();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
logger.warn(err);
|
|
36
86
|
res.set('X-SSR-Error', err.message);
|
|
37
87
|
res.set('X-SSR-Error-Stack', err.stack);
|
|
38
88
|
fallback(err);
|
|
@@ -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,MAAM,MAAM,2BAA2B,CAAC;AAE/C,MAAM,EAAE,mBA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AAG,EAAE,CAAC;gBACV,OAAO;aACR;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YACpC,GAAG,CAAC,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;YACxC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACd,OAAO;SACR;QACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnC,iBAAiB,CAAC,GAAG,EAAE,kCAAkC,CAAC;iBACvD,IAAI,CAAC,IAAI,CAAC,CAAC;SACf;QAAC,OAAO,CAAC,EAAE;YACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
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 logger from 'firebase-functions/logger';
|
|
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
|
+
let imagesManifest: string;
|
|
10
|
+
type BuiltImage = { filename: string, width: number, height: number };
|
|
11
|
+
const builtImages: BuiltImage[] = [];
|
|
8
12
|
|
|
9
13
|
export default (req: Request, res: Response) => {
|
|
10
14
|
res.set('X-XSS-Protection', '1; mode=block');
|
|
11
15
|
const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
|
|
12
16
|
|
|
13
17
|
const setStatusAndCache = (status: number, defaultCache: string) => {
|
|
18
|
+
if (res.headersSent) return res;
|
|
14
19
|
return res.status(status)
|
|
15
20
|
.set('X-SSR-ID', `v1/${Date.now()}`)
|
|
16
21
|
.set(
|
|
@@ -33,6 +38,47 @@ export default (req: Request, res: Response) => {
|
|
|
33
38
|
}
|
|
34
39
|
};
|
|
35
40
|
|
|
41
|
+
if (req.path === '/_image') {
|
|
42
|
+
const { href } = req.query;
|
|
43
|
+
if (typeof href === 'string' && href.length > 3) {
|
|
44
|
+
const width = Number(req.query.w);
|
|
45
|
+
const format = String(req.query.f);
|
|
46
|
+
if (width > 0 && /^(webp|avif|png|jpg|jpeg)$/.test(format)) {
|
|
47
|
+
(async () => {
|
|
48
|
+
if (!imagesManifest) {
|
|
49
|
+
const manifestFilepath = joinPath(baseDir, 'dist/server/images.dist.csv');
|
|
50
|
+
imagesManifest = await readFile(manifestFilepath, 'utf-8');
|
|
51
|
+
imagesManifest.split(/\n/).forEach((line) => {
|
|
52
|
+
const [filename, _width, height] = line.split(',');
|
|
53
|
+
builtImages.push({
|
|
54
|
+
filename,
|
|
55
|
+
width: Number(_width),
|
|
56
|
+
height: Number(height),
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
builtImages.sort((a, b) => {
|
|
60
|
+
if (a.width < b.width) return -1;
|
|
61
|
+
return 1;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const filename = href.replace(/^.*\//, '').replace(/.\w+(\?.*)?$/, '');
|
|
65
|
+
const filenameRegExp = new RegExp(`[_.][a-z0-9]+\\.${format}$`, 'i');
|
|
66
|
+
const builtImage = builtImages.find((_builtImage) => {
|
|
67
|
+
return _builtImage.width >= width
|
|
68
|
+
&& filename === _builtImage.filename.replace(filenameRegExp, '');
|
|
69
|
+
});
|
|
70
|
+
if (builtImage) {
|
|
71
|
+
return res.redirect(301, `/_astro/${builtImage.filename}`);
|
|
72
|
+
}
|
|
73
|
+
return res.redirect(302, href);
|
|
74
|
+
})();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
res.sendStatus(400);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
36
82
|
/*
|
|
37
83
|
https://github.com/withastro/astro/blob/main/examples/ssr/server/server.mjs
|
|
38
84
|
import { handler as ssrHandler } from '../dist/server/entry.mjs';
|
|
@@ -40,6 +86,12 @@ export default (req: Request, res: Response) => {
|
|
|
40
86
|
*/
|
|
41
87
|
global.ssr_handler(req, res, async (err: any) => {
|
|
42
88
|
if (err) {
|
|
89
|
+
if (res.headersSent) {
|
|
90
|
+
logger.error(err);
|
|
91
|
+
res.end();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
logger.warn(err);
|
|
43
95
|
res.set('X-SSR-Error', err.message);
|
|
44
96
|
res.set('X-SSR-Error-Stack', err.stack);
|
|
45
97
|
fallback(err);
|
|
@@ -9,7 +9,7 @@ import 'node:os';
|
|
|
9
9
|
import sizeOf from 'image-size';
|
|
10
10
|
import 'magic-string';
|
|
11
11
|
import 'node:stream';
|
|
12
|
-
import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, d as renderComponent, u as unescapeHTML, F as Fragment, m as maybeRenderHead,
|
|
12
|
+
import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, d as renderComponent, u as unescapeHTML, F as Fragment, m as maybeRenderHead, s as spreadAttributes, e as renderSlot, f as renderHead } from '../astro.9781c0a7.mjs';
|
|
13
13
|
import api from '@cloudcommerce/api';
|
|
14
14
|
import { reactive, computed, defineComponent, inject, useSSRContext, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, resolveComponent, withModifiers, Teleport, createTextVNode, toDisplayString, setBlockTracking } from 'vue';
|
|
15
15
|
import { img, price, formatMoney, nickname, onPromotion } from '@ecomplus/utils';
|
|
@@ -489,7 +489,7 @@ const $$BaseHead = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
489
489
|
const state = apiDoc || cmsContent || {};
|
|
490
490
|
const title = state.meta_title || state.name || state.title || Astro2.props.title || settings.name;
|
|
491
491
|
const description = state.meta_description || state.short_description || settings.description;
|
|
492
|
-
const favicon = settings.icon ? `/_image?f=png&w=32&h=32&
|
|
492
|
+
const favicon = settings.icon ? `/_image?f=png&w=32&h=32&href=${encodeURIComponent(settings.icon)}&V=${({}).DEPLOY_RAND}` : "/favicon.ico";
|
|
493
493
|
const canonicalUrl = new URL(Astro2.url.pathname, Astro2.site || `https://${domain}`);
|
|
494
494
|
const cmsMetatags = await cms("metatags");
|
|
495
495
|
const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
|
|
@@ -599,56 +599,6 @@ window.storefront.context = ${JSON.stringify({
|
|
|
599
599
|
return renderTemplate(_a$1 || (_a$1 = __template$1(["<script>", '<\/script>\n<script type="application/ld+json">', "<\/script>"])), unescapeHTML(inlineClientJS), unescapeHTML(inlineJSONLd));
|
|
600
600
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseStateJson.astro");
|
|
601
601
|
|
|
602
|
-
const $$Astro$e = createAstro("https://ecom2-002.web.app");
|
|
603
|
-
const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
|
|
604
|
-
const Astro2 = $$result.createAstro($$Astro$e, $$props, $$slots);
|
|
605
|
-
Astro2.self = $$BaseBody;
|
|
606
|
-
return renderTemplate`${maybeRenderHead($$result)}<body>
|
|
607
|
-
<div id="teleported-overlap" class="relative z-50"></div>
|
|
608
|
-
<div id="teleported-top" class="relative z-0"></div>
|
|
609
|
-
${renderSlot($$result, $$slots["default"])}
|
|
610
|
-
${renderSlot($$result, $$slots["before-body-end"])}
|
|
611
|
-
<div id="teleported-bottom" class="relative z-0"></div>
|
|
612
|
-
</body>`;
|
|
613
|
-
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro");
|
|
614
|
-
|
|
615
|
-
const $$Astro$d = createAstro("https://ecom2-002.web.app");
|
|
616
|
-
const $$Base$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
617
|
-
const Astro2 = $$result.createAstro($$Astro$d, $$props, $$slots);
|
|
618
|
-
Astro2.self = $$Base$1;
|
|
619
|
-
const { pageContext, title } = Astro2.props;
|
|
620
|
-
const { cms } = pageContext;
|
|
621
|
-
const cmsCustomCode = await cms("code");
|
|
622
|
-
return renderTemplate`<head>
|
|
623
|
-
${renderComponent($$result, "BaseHead", $$BaseHead, { "pageContext": pageContext, "title": title })}
|
|
624
|
-
${renderComponent($$result, "BaseStateJson", $$BaseStateJson, { "pageContext": pageContext })}
|
|
625
|
-
${cmsCustomCode?.css && renderTemplate`<style>{cmsCustomCode.css}</style>`}
|
|
626
|
-
${cmsCustomCode?.html_head && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(cmsCustomCode.html_head)}` })}`}
|
|
627
|
-
${renderSlot($$result, $$slots["base-head-scripts"])}
|
|
628
|
-
${renderSlot($$result, $$slots["before-head-end"])}
|
|
629
|
-
${renderHead($$result)}</head>
|
|
630
|
-
${renderComponent($$result, "BaseBody", $$BaseBody, { "pageContext": pageContext }, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}${cmsCustomCode?.html_body && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(cmsCustomCode.html_body)}` })}`}${renderSlot($$result2, $$slots["base-body-scripts"])}${renderSlot($$result2, $$slots["before-body-end"])}` })}`;
|
|
631
|
-
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro");
|
|
632
|
-
|
|
633
|
-
var __freeze = Object.freeze;
|
|
634
|
-
var __defProp = Object.defineProperty;
|
|
635
|
-
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
636
|
-
var _a;
|
|
637
|
-
const $$Astro$c = createAstro("https://ecom2-002.web.app");
|
|
638
|
-
const $$InlineScripts = createComponent(async ($$result, $$props, $$slots) => {
|
|
639
|
-
const Astro2 = $$result.createAstro($$Astro$c, $$props, $$slots);
|
|
640
|
-
Astro2.self = $$InlineScripts;
|
|
641
|
-
return renderTemplate(_a || (_a = __template(["<script>\n window.firebaseConfig = {\n apiKey: 'AIzaSyCrVzemDgpyp9i6ni7Yc5ZuEVfXYwl-4J0',\n authDomain: 'ecom2-002.firebaseapp.com',\n projectId: 'ecom2-002',\n storageBucket: 'ecom2-002.appspot.com',\n messagingSenderId: '402807248219',\n appId: '1:402807248219:web:cf7d57759751e74776367e',\n measurementId: 'G-SC592CE0GB',\n };\n<\/script>"])));
|
|
642
|
-
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/scripts/InlineScripts.astro");
|
|
643
|
-
|
|
644
|
-
const $$Astro$b = createAstro("https://ecom2-002.web.app");
|
|
645
|
-
const $$Base = createComponent(async ($$result, $$props, $$slots) => {
|
|
646
|
-
const Astro2 = $$result.createAstro($$Astro$b, $$props, $$slots);
|
|
647
|
-
Astro2.self = $$Base;
|
|
648
|
-
const { pageContext, title } = Astro2.props;
|
|
649
|
-
return renderTemplate`${renderComponent($$result, "Base", $$Base$1, { "pageContext": pageContext, "title": title }, { "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}` })}`;
|
|
650
|
-
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro");
|
|
651
|
-
|
|
652
602
|
function isRemoteImage(src) {
|
|
653
603
|
return /^(https?:)?\/\//.test(src);
|
|
654
604
|
}
|
|
@@ -835,9 +785,9 @@ async function getPicture(params) {
|
|
|
835
785
|
};
|
|
836
786
|
}
|
|
837
787
|
|
|
838
|
-
const $$Astro$
|
|
788
|
+
const $$Astro$e = createAstro("https://ecom2-002.web.app");
|
|
839
789
|
const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
|
|
840
|
-
const Astro2 = $$result.createAstro($$Astro$
|
|
790
|
+
const Astro2 = $$result.createAstro($$Astro$e, $$props, $$slots);
|
|
841
791
|
Astro2.self = $$Picture;
|
|
842
792
|
const tryImageSize = (src2) => {
|
|
843
793
|
let dimensions = {};
|
|
@@ -903,6 +853,58 @@ const $$Picture = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
903
853
|
</picture>`;
|
|
904
854
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/components/Picture.astro");
|
|
905
855
|
|
|
856
|
+
const $$Astro$d = createAstro("https://ecom2-002.web.app");
|
|
857
|
+
const $$BaseBody = createComponent(async ($$result, $$props, $$slots) => {
|
|
858
|
+
const Astro2 = $$result.createAstro($$Astro$d, $$props, $$slots);
|
|
859
|
+
Astro2.self = $$BaseBody;
|
|
860
|
+
const { settings: { icon } } = Astro2.props.pageContext;
|
|
861
|
+
return renderTemplate`${maybeRenderHead($$result)}<body>
|
|
862
|
+
<div id="teleported-overlap" class="relative z-50"></div>
|
|
863
|
+
<div id="teleported-top" class="relative z-0"></div>
|
|
864
|
+
${renderSlot($$result, $$slots["default"])}
|
|
865
|
+
${renderSlot($$result, $$slots["before-body-end"])}
|
|
866
|
+
<div id="teleported-bottom" class="relative z-0"></div>
|
|
867
|
+
${icon && renderTemplate`${renderComponent($$result, "Picture", $$Picture, { "src": icon, "alt": "Icon", "widths": [32, 192, 512], "sizes": "32px", "class": "hidden absolute", "style": "bottom: -1000px" })}`}
|
|
868
|
+
</body>`;
|
|
869
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/BaseBody.astro");
|
|
870
|
+
|
|
871
|
+
const $$Astro$c = createAstro("https://ecom2-002.web.app");
|
|
872
|
+
const $$Base$1 = createComponent(async ($$result, $$props, $$slots) => {
|
|
873
|
+
const Astro2 = $$result.createAstro($$Astro$c, $$props, $$slots);
|
|
874
|
+
Astro2.self = $$Base$1;
|
|
875
|
+
const { pageContext, title } = Astro2.props;
|
|
876
|
+
const { cms } = pageContext;
|
|
877
|
+
const cmsCustomCode = await cms("code");
|
|
878
|
+
return renderTemplate`<head>
|
|
879
|
+
${renderComponent($$result, "BaseHead", $$BaseHead, { "pageContext": pageContext, "title": title })}
|
|
880
|
+
${renderComponent($$result, "BaseStateJson", $$BaseStateJson, { "pageContext": pageContext })}
|
|
881
|
+
${cmsCustomCode?.css && renderTemplate`<style>{cmsCustomCode.css}</style>`}
|
|
882
|
+
${cmsCustomCode?.html_head && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${unescapeHTML(cmsCustomCode.html_head)}` })}`}
|
|
883
|
+
${renderSlot($$result, $$slots["base-head-scripts"])}
|
|
884
|
+
${renderSlot($$result, $$slots["before-head-end"])}
|
|
885
|
+
${renderHead($$result)}</head>
|
|
886
|
+
${renderComponent($$result, "BaseBody", $$BaseBody, { "pageContext": pageContext }, { "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}${cmsCustomCode?.html_body && renderTemplate`${renderComponent($$result2, "Fragment", Fragment, {}, { "default": ($$result3) => renderTemplate`${unescapeHTML(cmsCustomCode.html_body)}` })}`}${renderSlot($$result2, $$slots["base-body-scripts"])}${renderSlot($$result2, $$slots["before-body-end"])}` })}`;
|
|
887
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/layouts/Base.astro");
|
|
888
|
+
|
|
889
|
+
var __freeze = Object.freeze;
|
|
890
|
+
var __defProp = Object.defineProperty;
|
|
891
|
+
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
892
|
+
var _a;
|
|
893
|
+
const $$Astro$b = createAstro("https://ecom2-002.web.app");
|
|
894
|
+
const $$InlineScripts = createComponent(async ($$result, $$props, $$slots) => {
|
|
895
|
+
const Astro2 = $$result.createAstro($$Astro$b, $$props, $$slots);
|
|
896
|
+
Astro2.self = $$InlineScripts;
|
|
897
|
+
return renderTemplate(_a || (_a = __template(["<script>\n window.firebaseConfig = {\n apiKey: 'AIzaSyCrVzemDgpyp9i6ni7Yc5ZuEVfXYwl-4J0',\n authDomain: 'ecom2-002.firebaseapp.com',\n projectId: 'ecom2-002',\n storageBucket: 'ecom2-002.appspot.com',\n messagingSenderId: '402807248219',\n appId: '1:402807248219:web:cf7d57759751e74776367e',\n measurementId: 'G-SC592CE0GB',\n };\n<\/script>"])));
|
|
898
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/scripts/InlineScripts.astro");
|
|
899
|
+
|
|
900
|
+
const $$Astro$a = createAstro("https://ecom2-002.web.app");
|
|
901
|
+
const $$Base = createComponent(async ($$result, $$props, $$slots) => {
|
|
902
|
+
const Astro2 = $$result.createAstro($$Astro$a, $$props, $$slots);
|
|
903
|
+
Astro2.self = $$Base;
|
|
904
|
+
const { pageContext, title } = Astro2.props;
|
|
905
|
+
return renderTemplate`${renderComponent($$result, "Base", $$Base$1, { "pageContext": pageContext, "title": title }, { "before-head-end": ($$result2) => renderTemplate`${renderComponent($$result2, "InlineScripts", $$InlineScripts, { "slot": "before-head-end" })}`, "default": ($$result2) => renderTemplate`${renderSlot($$result2, $$slots["default"])}` })}`;
|
|
906
|
+
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro");
|
|
907
|
+
|
|
906
908
|
const checkObjNotNull = (obj) => {
|
|
907
909
|
return Object.values(obj).filter((val) => val).length;
|
|
908
910
|
};
|
|
@@ -14,7 +14,7 @@ import enableDestroy from 'server-destroy';
|
|
|
14
14
|
import { defineComponent, computed, useSSRContext, mergeProps, h as h$1, createSSRApp } from 'vue';
|
|
15
15
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
16
16
|
import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
|
|
17
|
-
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.
|
|
17
|
+
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.27c6aee2.mjs';
|
|
18
18
|
import 'mime';
|
|
19
19
|
import 'cookie';
|
|
20
20
|
import 'kleur/colors';
|
|
@@ -3062,7 +3062,7 @@ const _renderer1 = {
|
|
|
3062
3062
|
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.16.0_astro@2.1.2+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5],]);
|
|
3063
3063
|
const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"astro/jsx/server.js","jsxImportSource":"astro"}, { ssr: server_default }),Object.assign({"name":"@astrojs/vue","clientEntrypoint":"@astrojs/vue/client.js","serverEntrypoint":"@astrojs/vue/server.js"}, { ssr: _renderer1 }),];
|
|
3064
3064
|
|
|
3065
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.16.0_astro@2.1.2+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css","_astro/index.0c833781.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"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,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"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,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"pageMap":null,"propagation":[],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","@@sf/components/ProductCard.vue":"_astro/ProductCard.7e891c08.js","@astrojs/vue/client.js":"_astro/client.0de2f274.js","
|
|
3065
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.16.0_astro@2.1.2+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css","_astro/index.0c833781.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"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,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"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,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.0607a6ef.css"],"scripts":[{"type":"external","value":"_astro/hoisted.721ad75d.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"pageMap":null,"propagation":[],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","@@sf/components/ProductCard.vue":"_astro/ProductCard.7e891c08.js","@astrojs/vue/client.js":"_astro/client.0de2f274.js","/astro/hoisted.js?q=0":"_astro/hoisted.721ad75d.js","~/components/PitchBar.vue":"_astro/PitchBar.db7cd775.js","~/components/Prices.vue":"_astro/Prices.55399c72.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.295a6886.js","~/components/ShopHeader.vue":"_astro/ShopHeader.e93c8274.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.72e91a3e.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/index.0c833781.css","/_astro/server.1bc2fa51.css","/_astro/_...slug_.0607a6ef.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-e0d788d4.js","/_astro/PitchBar.db7cd775.js","/_astro/Prices.55399c72.js","/_astro/ProductCard.7e891c08.js","/_astro/ShopHeader.e93c8274.js","/_astro/_plugin-vue_export-helper.77ed7c18.js","/_astro/client.0de2f274.js","/_astro/firebase-app.72e91a3e.js","/_astro/format-money.ab6b71eb.js","/_astro/hoisted.721ad75d.js","/_astro/idle-callback.889bf0ea.js","/_astro/index.16f33784.js","/_astro/modules-info.06ac0727.js","/_astro/preload-helper.101896b7.js","/_astro/runtime-dom.esm-bundler.d2f39f33.js","/_astro/session-utm.72684b84.js","/_astro/workbox-window.prod.es5.295a6886.js","/admin/config.json","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/img/icon.png","/img/large-icon.png","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/icon.png","/img/uploads/large-icon.png","/img/uploads/logo.png","/img/uploads/logo.webp","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png"]}), {
|
|
3066
3066
|
pageMap: pageMap,
|
|
3067
3067
|
renderers: renderers
|
|
3068
3068
|
});
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
BUILD_OUTPUT=static BUILD_OUT_DIR=./.cloudcommerce/sf-tmp-dist npx astro build
|
|
4
4
|
DEPLOY_RUNTIME=serverless npx astro build
|
|
5
5
|
|
|
6
|
-
mv ./.cloudcommerce/sf-tmp-dist/_astro/*.{webp,avif} ./dist/client/_astro/
|
|
6
|
+
mv ./.cloudcommerce/sf-tmp-dist/_astro/*.{png,jpg,jpeg,webp,avif,svg} ./dist/client/_astro/ 2>/dev/null
|
|
7
7
|
rm -rf ./.cloudcommerce/sf-tmp-dist
|
|
8
8
|
|
|
9
9
|
identify -format "%f,%w,%h\n" \
|
|
10
|
-
./dist/client/_astro/*.{webp,avif} > ./dist/server/images.dist.csv
|
|
10
|
+
./dist/client/_astro/*.{png,jpg,jpeg,webp,avif,svg} > ./dist/server/images.dist.csv 2>/dev/null
|
|
11
11
|
|
|
12
12
|
identify -format "assets/%f,%w,%h\n" \
|
|
13
|
-
./public/assets/*.{png,jpg,jpeg,
|
|
13
|
+
./public/assets/*.{png,jpg,jpeg,webp,avif,svg} > ./dist/server/images.src.csv 2>/dev/null
|
|
14
14
|
identify -format "img/%f,%w,%h\n" \
|
|
15
|
-
./public/img/*.{png,jpg,jpeg,
|
|
15
|
+
./public/img/*.{png,jpg,jpeg,webp,avif,svg} >> ./dist/server/images.src.csv 2>/dev/null
|
|
16
16
|
identify -format "img/uploads/%f,%w,%h\n" \
|
|
17
|
-
./public/img/uploads/*.{png,jpg,jpeg,
|
|
17
|
+
./public/img/uploads/*.{png,jpg,jpeg,webp,avif,svg} >> ./dist/server/images.src.csv 2>/dev/null
|
|
18
18
|
|
|
19
19
|
exit 0
|
|
@@ -5,10 +5,13 @@ import '@@sf/assets/base.css';
|
|
|
5
5
|
import '@@sf/assets/forms.css';
|
|
6
6
|
import '@@sf/assets/tooltip.css';
|
|
7
7
|
import 'uno.css';
|
|
8
|
+
import Picture from '@@sf/components/Picture.astro';
|
|
8
9
|
|
|
9
10
|
export interface Props {
|
|
10
11
|
pageContext: PageContext;
|
|
11
12
|
}
|
|
13
|
+
|
|
14
|
+
const { settings: { icon } } = Astro.props.pageContext;
|
|
12
15
|
---
|
|
13
16
|
|
|
14
17
|
<body>
|
|
@@ -17,4 +20,14 @@ export interface Props {
|
|
|
17
20
|
<slot />
|
|
18
21
|
<slot name="before-body-end" />
|
|
19
22
|
<div id="teleported-bottom" class="relative z-0"></div>
|
|
23
|
+
{icon &&
|
|
24
|
+
<Picture
|
|
25
|
+
src={icon}
|
|
26
|
+
alt="Icon"
|
|
27
|
+
widths={[32, 192, 512]}
|
|
28
|
+
sizes="32px"
|
|
29
|
+
class="hidden absolute"
|
|
30
|
+
style="bottom: -1000px"
|
|
31
|
+
/>
|
|
32
|
+
}
|
|
20
33
|
</body>
|
|
@@ -22,7 +22,7 @@ const state = apiDoc || cmsContent || {};
|
|
|
22
22
|
const title = state.meta_title || state.name || state.title || Astro.props.title || settings.name;
|
|
23
23
|
const description = state.meta_description || state.short_description || settings.description;
|
|
24
24
|
const favicon = settings.icon
|
|
25
|
-
? '/_image?f=png&w=32&h=32
|
|
25
|
+
? '/_image?f=png&w=32&h=32'
|
|
26
26
|
+ `&href=${encodeURIComponent(settings.icon)}&V=${import.meta.env.DEPLOY_RAND}`
|
|
27
27
|
: '/favicon.ico';
|
|
28
28
|
const canonicalUrl = new URL(Astro.url.pathname, Astro.site || `https://${domain}`);
|
|
@@ -9,9 +9,11 @@ export type Props = Omit<PictureComponentRemoteImageProps, 'aspectRatio'> & {
|
|
|
9
9
|
fetchpriority?: 'high' | 'low' | 'auto',
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
const { STOREFRONT_BASE_DIR } = process.env;
|
|
13
|
+
const baseDir = STOREFRONT_BASE_DIR || process.cwd();
|
|
12
14
|
type OriginalImage = { filepath: string, width: number, height: number };
|
|
13
15
|
const originalImages: OriginalImage[] = [];
|
|
14
|
-
const manifestFilepath = joinPath(
|
|
16
|
+
const manifestFilepath = joinPath(baseDir, 'dist/server/images.src.csv');
|
|
15
17
|
readFileSync(manifestFilepath, 'utf-8').split(/\n/).forEach((line) => {
|
|
16
18
|
const [filepath, width, height] = line.split(',');
|
|
17
19
|
originalImages.push({
|
|
@@ -2,9 +2,11 @@ import type { OutputFormat } from '@astrojs/image/dist/loaders/';
|
|
|
2
2
|
import { join as joinPath } from 'node:path';
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
4
|
|
|
5
|
+
const { STOREFRONT_BASE_DIR } = process.env;
|
|
6
|
+
const baseDir = STOREFRONT_BASE_DIR || process.cwd();
|
|
5
7
|
type BuiltImage = { filename: string, width: number, height: number };
|
|
6
8
|
const builtImages: BuiltImage[] = [];
|
|
7
|
-
const manifestFilepath = joinPath(
|
|
9
|
+
const manifestFilepath = joinPath(baseDir, 'dist/server/images.dist.csv');
|
|
8
10
|
readFileSync(manifestFilepath, 'utf-8').split(/\n/).forEach((line) => {
|
|
9
11
|
const [filename, width, height] = line.split(',');
|
|
10
12
|
builtImages.push({
|
|
@@ -25,9 +27,9 @@ type ImageOptions = Record<string, any> & {
|
|
|
25
27
|
};
|
|
26
28
|
const getImage = async ({ src, width, format }: ImageOptions) => {
|
|
27
29
|
const filename = src.replace(/^.*\//, '').replace(/.\w+(\?.*)?$/, '');
|
|
30
|
+
const filenameRegExp = new RegExp(`[_.][a-z0-9]+\\.${format}$`, 'i');
|
|
28
31
|
const matchFilename = (_builtImage: BuiltImage) => {
|
|
29
|
-
return filename === _builtImage.filename
|
|
30
|
-
.replace(new RegExp(`[_.][a-z0-9]+\\.${format}$`, 'i'), '');
|
|
32
|
+
return filename === _builtImage.filename.replace(filenameRegExp, '');
|
|
31
33
|
};
|
|
32
34
|
let builtImage = builtImages.find((_builtImage) => {
|
|
33
35
|
return _builtImage.width >= width && matchFilename(_builtImage);
|
|
@@ -35,11 +37,15 @@ const getImage = async ({ src, width, format }: ImageOptions) => {
|
|
|
35
37
|
if (!builtImage) {
|
|
36
38
|
builtImage = builtImages.find(matchFilename);
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (builtImage) {
|
|
41
|
+
return {
|
|
42
|
+
src: `/_astro/${builtImage.filename}`,
|
|
43
|
+
width: builtImage.width,
|
|
44
|
+
height: builtImage.height,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
console.warn(`Could not match built ${format} image for ${src} ${width}px`);
|
|
48
|
+
return { src, width };
|
|
43
49
|
};
|
|
44
50
|
|
|
45
51
|
export default getImage;
|