cloudcommerce 0.0.93 → 0.0.95
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 +14 -0
- 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 +6 -3
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase.js +5 -3
- package/packages/ssr/lib/firebase.js.map +1 -1
- package/packages/ssr/package.json +1 -4
- package/packages/ssr/src/firebase.ts +6 -3
- package/packages/storefront/astro.config.mjs +4 -9
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/entry.mjs +23 -348
- package/packages/storefront/package.json +1 -2
- package/packages/storefront/src/lib/helpers/image.ts +16 -29
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +2 -5
- package/packages/storefront/storefront.config.mjs +7 -7
- package/packages/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.95](https://github.com/ecomplus/cloud-commerce/compare/v0.0.94...v0.0.95) (2022-09-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **storefront:** Prevent error with undefined `import.meta.env` on config ([19ffb5b](https://github.com/ecomplus/cloud-commerce/commit/19ffb5bcc859d972d17ba45e4d0ad739333d38ad))
|
|
11
|
+
|
|
12
|
+
### [0.0.94](https://github.com/ecomplus/cloud-commerce/compare/v0.0.93...v0.0.94) (2022-09-24)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **storefront:** Properly resolve base dir with `STOREFRONT_BASE_DIR` env from cwd ([0ae3512](https://github.com/ecomplus/cloud-commerce/commit/0ae35122d757ce7bd1381d7b5262f55f330e79c7))
|
|
18
|
+
|
|
5
19
|
### [0.0.93](https://github.com/ecomplus/cloud-commerce/compare/v0.0.92...v0.0.93) (2022-09-24)
|
|
6
20
|
|
|
7
21
|
|
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.95",
|
|
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>",
|
|
@@ -29,10 +29,13 @@
|
|
|
29
29
|
"source": "functions/ssr",
|
|
30
30
|
"codebase": "ssr",
|
|
31
31
|
"ignore": [
|
|
32
|
-
"storefront
|
|
32
|
+
"storefront/!(dist|content|public)/**",
|
|
33
33
|
"storefront/dist/client/**",
|
|
34
|
-
"
|
|
35
|
-
"functions/ssr/storefront
|
|
34
|
+
"storefront/*",
|
|
35
|
+
"functions/ssr/storefront/!(dist|content|public)/**",
|
|
36
|
+
"functions/ssr/storefront/dist/client/**",
|
|
37
|
+
"functions/ssr/storefront/*",
|
|
38
|
+
"**/*.ts"
|
|
36
39
|
]
|
|
37
40
|
}
|
|
38
41
|
],
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
import '@cloudcommerce/
|
|
3
|
-
|
|
1
|
+
/* eslint-disable import/prefer-default-export, import/no-unresolved, import/first */
|
|
2
|
+
import '@cloudcommerce/api/fetch-polyfill';
|
|
3
|
+
import { initializeApp } from 'firebase-admin/app';
|
|
4
|
+
|
|
5
|
+
initializeApp();
|
|
4
6
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
7
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
6
8
|
import serveStorefront from './firebase/serve-storefront.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,
|
|
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,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC;IAC3B,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,QAAQ;IAChB,mBAAmB;IACnB,GAAG,oBAAoB;CACxB,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.95",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -37,9 +37,6 @@
|
|
|
37
37
|
"mime": "^3.0.0",
|
|
38
38
|
"path-browserify": "^1.0.1",
|
|
39
39
|
"path-to-regexp": "^6.2.1",
|
|
40
|
-
"sharp": "^0.31.0",
|
|
41
|
-
"slash": "^4.0.0",
|
|
42
|
-
"source-map-support": "^0.5.21",
|
|
43
40
|
"string-width": "^5.1.2",
|
|
44
41
|
"vue": "^3.2.39"
|
|
45
42
|
},
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
import '@cloudcommerce/
|
|
3
|
-
|
|
1
|
+
/* eslint-disable import/prefer-default-export, import/no-unresolved, import/first */
|
|
2
|
+
import '@cloudcommerce/api/fetch-polyfill';
|
|
3
|
+
import { initializeApp } from 'firebase-admin/app';
|
|
4
|
+
|
|
5
|
+
initializeApp();
|
|
6
|
+
|
|
4
7
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
8
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
6
9
|
import serveStorefront from './firebase/serve-storefront';
|
|
@@ -4,7 +4,6 @@ import * as dotenv from 'dotenv';
|
|
|
4
4
|
import { defineConfig } from 'astro/config';
|
|
5
5
|
import node from '@astrojs/node';
|
|
6
6
|
import vue from '@astrojs/vue';
|
|
7
|
-
import image from '@astrojs/image';
|
|
8
7
|
import partytown from '@astrojs/partytown';
|
|
9
8
|
import prefetch from '@astrojs/prefetch';
|
|
10
9
|
import sitemap from '@astrojs/sitemap';
|
|
@@ -65,15 +64,12 @@ const _vitePWAOptions = {
|
|
|
65
64
|
cacheName: 'assets',
|
|
66
65
|
},
|
|
67
66
|
}, {
|
|
68
|
-
urlPattern:
|
|
67
|
+
urlPattern: settings.logo
|
|
68
|
+
? new RegExp(`^${(settings.mini_logo ? `(?:${settings.mini_logo}|${settings.logo})` : settings.logo)}$`)
|
|
69
|
+
: /^\/(?:img\/uploads\/|img\/)?logo\.(?:png|jpg|jpeg|webp|avif|svg)$/,
|
|
69
70
|
handler: 'StaleWhileRevalidate',
|
|
70
71
|
options: {
|
|
71
|
-
cacheName: '
|
|
72
|
-
expiration: {
|
|
73
|
-
maxEntries: 50,
|
|
74
|
-
maxAgeSeconds: 60 * 60 * 24 * 30, // 30 days
|
|
75
|
-
purgeOnQuotaError: true,
|
|
76
|
-
},
|
|
72
|
+
cacheName: 'logo',
|
|
77
73
|
},
|
|
78
74
|
}, {
|
|
79
75
|
urlPattern: /^\/img\/uploads\/.*\.(?:png|jpg|jpeg|webp|avif|svg|gif)$/,
|
|
@@ -130,7 +126,6 @@ const genAstroConfig = ({
|
|
|
130
126
|
adapter: node(),
|
|
131
127
|
integrations: [
|
|
132
128
|
vue(),
|
|
133
|
-
image(),
|
|
134
129
|
partytown(),
|
|
135
130
|
prefetch(),
|
|
136
131
|
sitemap(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,
|
|
1
|
+
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,o)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let a={};const t=e=>n(e,r),c={module:{uri:r},exports:a,require:t};s[r]=Promise.all(i.map((e=>c[e]||t(e)))).then((e=>(o(...e),a)))}}define(["./workbox-6f0d1f78"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"chunks/workbox-window.prod.es5.4b654ae6.js",revision:null},{url:"client.80baece3.js",revision:null},{url:"hoisted.46e058d2.js",revision:null},{url:"page.3aa82516.js",revision:null},{url:"img/icon.png",revision:"791be7ee6538f26bb57bc31243a6e17e"},{url:"img/large-icon.png",revision:"0b35db516cfa7475b1c2f8c081e8d54d"},{url:"manifest.webmanifest",revision:"f3f24fe1b3d542152ca2f18813168ad6"}],{ignoreURLParametersMatching:[/.*/]}),e.cleanupOutdatedCaches(),e.registerRoute(/^\/$/,new e.NetworkFirst,"GET"),e.registerRoute(/\/((?!(?:admin|assets|img)(\/|$))[^.]+)(\.(?!js|css|xml|txt|png|jpg|jpeg|webp|avif|svg|gif)[^.]+)*$/,new e.NetworkFirst({cacheName:"pages",plugins:[new e.ExpirationPlugin({maxEntries:50,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^\/assets\//,new e.StaleWhileRevalidate({cacheName:"assets",plugins:[]}),"GET"),e.registerRoute(/^\/img\/uploads\/logo.webp$/,new e.StaleWhileRevalidate({cacheName:"logo",plugins:[]}),"GET"),e.registerRoute(/^\/img\/uploads\/.*\.(?:png|jpg|jpeg|webp|avif|svg|gif)$/,new e.StaleWhileRevalidate({cacheName:"cms-images",plugins:[new e.ExpirationPlugin({maxEntries:20,maxAgeSeconds:2592e3,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/ecomplus\.io/,new e.NetworkFirst({cacheName:"store-api",plugins:[new e.ExpirationPlugin({maxEntries:50,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/(((\w+\.)?ecoms\d)|(ecom[\w-]+(\.\w+)*\.digitaloceanspaces))\.com.*\/imgs\/normal\//,new e.CacheFirst({cacheName:"product-thumbnails",plugins:[new e.ExpirationPlugin({maxEntries:100,maxAgeSeconds:2592e3,purgeOnQuotaError:!0})]}),"GET"),e.registerRoute(/^https:\/\/(((\w+\.)?ecoms\d)|(ecom[\w-]+(\.\w+)*\.digitaloceanspaces))\.com.*\/imgs\/big\//,new e.CacheFirst({cacheName:"product-pictures",plugins:[new e.ExpirationPlugin({maxEntries:10,maxAgeSeconds:604800,purgeOnQuotaError:!0})]}),"GET")}));
|
|
@@ -2,8 +2,6 @@ import * as adapter from '@astrojs/node/server.js';
|
|
|
2
2
|
import { defineComponent, h, createSSRApp, mergeProps, createVNode as createVNode$1, resolveDynamicComponent, withCtx, createTextVNode, toDisplayString, useSSRContext } from 'vue';
|
|
3
3
|
import { renderToString as renderToString$1, ssrRenderAttrs, ssrRenderSlot, ssrRenderVNode, ssrInterpolate, ssrRenderClass, ssrRenderList, ssrRenderAttr } from 'vue/server-renderer';
|
|
4
4
|
import { escape } from 'html-escaper';
|
|
5
|
-
import mime from 'mime';
|
|
6
|
-
import sharp$1 from 'sharp';
|
|
7
5
|
/* empty css */import { fileURLToPath } from 'url';
|
|
8
6
|
import fs from 'fs';
|
|
9
7
|
import { resolve } from 'path';
|
|
@@ -12,15 +10,9 @@ import * as $$module1$5 from '@ecomplus/utils';
|
|
|
12
10
|
import $$module1__default from '@ecomplus/utils';
|
|
13
11
|
/* empty css */import * as $$module1$6 from 'color';
|
|
14
12
|
import $$module1__default$1 from 'color';
|
|
15
|
-
import
|
|
13
|
+
import imageSize from 'image-size';
|
|
14
|
+
import 'mime';
|
|
16
15
|
import 'kleur/colors';
|
|
17
|
-
import 'node:fs/promises';
|
|
18
|
-
import 'node:os';
|
|
19
|
-
import 'node:path';
|
|
20
|
-
import 'node:url';
|
|
21
|
-
import 'magic-string';
|
|
22
|
-
import 'node:stream';
|
|
23
|
-
import 'slash';
|
|
24
16
|
import 'string-width';
|
|
25
17
|
import 'path-browserify';
|
|
26
18
|
import { compile } from 'path-to-regexp';
|
|
@@ -1416,208 +1408,6 @@ var server_default = {
|
|
|
1416
1408
|
renderToStaticMarkup
|
|
1417
1409
|
};
|
|
1418
1410
|
|
|
1419
|
-
function isOutputFormat(value) {
|
|
1420
|
-
return ["avif", "jpeg", "png", "webp"].includes(value);
|
|
1421
|
-
}
|
|
1422
|
-
function isOutputFormatSupportsAlpha(value) {
|
|
1423
|
-
return ["avif", "png", "webp"].includes(value);
|
|
1424
|
-
}
|
|
1425
|
-
function isAspectRatioString(value) {
|
|
1426
|
-
return /^\d*:\d*$/.test(value);
|
|
1427
|
-
}
|
|
1428
|
-
function parseAspectRatio(aspectRatio) {
|
|
1429
|
-
if (!aspectRatio) {
|
|
1430
|
-
return void 0;
|
|
1431
|
-
}
|
|
1432
|
-
if (typeof aspectRatio === "number") {
|
|
1433
|
-
return aspectRatio;
|
|
1434
|
-
} else {
|
|
1435
|
-
const [width, height] = aspectRatio.split(":");
|
|
1436
|
-
return parseInt(width) / parseInt(height);
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
|
-
function isSSRService(service) {
|
|
1440
|
-
return "transform" in service;
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
class SharpService {
|
|
1444
|
-
async getImageAttributes(transform) {
|
|
1445
|
-
const { width, height, src, format, quality, aspectRatio, fit, position, background, ...rest } = transform;
|
|
1446
|
-
return {
|
|
1447
|
-
...rest,
|
|
1448
|
-
width,
|
|
1449
|
-
height
|
|
1450
|
-
};
|
|
1451
|
-
}
|
|
1452
|
-
serializeTransform(transform) {
|
|
1453
|
-
const searchParams = new URLSearchParams();
|
|
1454
|
-
if (transform.quality) {
|
|
1455
|
-
searchParams.append("q", transform.quality.toString());
|
|
1456
|
-
}
|
|
1457
|
-
if (transform.format) {
|
|
1458
|
-
searchParams.append("f", transform.format);
|
|
1459
|
-
}
|
|
1460
|
-
if (transform.width) {
|
|
1461
|
-
searchParams.append("w", transform.width.toString());
|
|
1462
|
-
}
|
|
1463
|
-
if (transform.height) {
|
|
1464
|
-
searchParams.append("h", transform.height.toString());
|
|
1465
|
-
}
|
|
1466
|
-
if (transform.aspectRatio) {
|
|
1467
|
-
searchParams.append("ar", transform.aspectRatio.toString());
|
|
1468
|
-
}
|
|
1469
|
-
if (transform.fit) {
|
|
1470
|
-
searchParams.append("fit", transform.fit);
|
|
1471
|
-
}
|
|
1472
|
-
if (transform.background) {
|
|
1473
|
-
searchParams.append("bg", transform.background);
|
|
1474
|
-
}
|
|
1475
|
-
if (transform.position) {
|
|
1476
|
-
searchParams.append("p", encodeURI(transform.position));
|
|
1477
|
-
}
|
|
1478
|
-
return { searchParams };
|
|
1479
|
-
}
|
|
1480
|
-
parseTransform(searchParams) {
|
|
1481
|
-
let transform = { src: searchParams.get("href") };
|
|
1482
|
-
if (searchParams.has("q")) {
|
|
1483
|
-
transform.quality = parseInt(searchParams.get("q"));
|
|
1484
|
-
}
|
|
1485
|
-
if (searchParams.has("f")) {
|
|
1486
|
-
const format = searchParams.get("f");
|
|
1487
|
-
if (isOutputFormat(format)) {
|
|
1488
|
-
transform.format = format;
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
if (searchParams.has("w")) {
|
|
1492
|
-
transform.width = parseInt(searchParams.get("w"));
|
|
1493
|
-
}
|
|
1494
|
-
if (searchParams.has("h")) {
|
|
1495
|
-
transform.height = parseInt(searchParams.get("h"));
|
|
1496
|
-
}
|
|
1497
|
-
if (searchParams.has("ar")) {
|
|
1498
|
-
const ratio = searchParams.get("ar");
|
|
1499
|
-
if (isAspectRatioString(ratio)) {
|
|
1500
|
-
transform.aspectRatio = ratio;
|
|
1501
|
-
} else {
|
|
1502
|
-
transform.aspectRatio = parseFloat(ratio);
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
if (searchParams.has("fit")) {
|
|
1506
|
-
transform.fit = searchParams.get("fit");
|
|
1507
|
-
}
|
|
1508
|
-
if (searchParams.has("p")) {
|
|
1509
|
-
transform.position = decodeURI(searchParams.get("p"));
|
|
1510
|
-
}
|
|
1511
|
-
if (searchParams.has("bg")) {
|
|
1512
|
-
transform.background = searchParams.get("bg");
|
|
1513
|
-
}
|
|
1514
|
-
return transform;
|
|
1515
|
-
}
|
|
1516
|
-
async transform(inputBuffer, transform) {
|
|
1517
|
-
const sharpImage = sharp$1(inputBuffer, { failOnError: false, pages: -1 });
|
|
1518
|
-
sharpImage.rotate();
|
|
1519
|
-
if (transform.width || transform.height) {
|
|
1520
|
-
const width = transform.width && Math.round(transform.width);
|
|
1521
|
-
const height = transform.height && Math.round(transform.height);
|
|
1522
|
-
sharpImage.resize({
|
|
1523
|
-
width,
|
|
1524
|
-
height,
|
|
1525
|
-
fit: transform.fit,
|
|
1526
|
-
position: transform.position,
|
|
1527
|
-
background: transform.background
|
|
1528
|
-
});
|
|
1529
|
-
}
|
|
1530
|
-
if (transform.format) {
|
|
1531
|
-
sharpImage.toFormat(transform.format, { quality: transform.quality });
|
|
1532
|
-
if (transform.background && !isOutputFormatSupportsAlpha(transform.format)) {
|
|
1533
|
-
sharpImage.flatten({ background: transform.background });
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
const { data, info } = await sharpImage.toBuffer({ resolveWithObject: true });
|
|
1537
|
-
return {
|
|
1538
|
-
data,
|
|
1539
|
-
format: info.format
|
|
1540
|
-
};
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
const service = new SharpService();
|
|
1544
|
-
var sharp_default = service;
|
|
1545
|
-
|
|
1546
|
-
const sharp = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1547
|
-
__proto__: null,
|
|
1548
|
-
default: sharp_default
|
|
1549
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1550
|
-
|
|
1551
|
-
const fnv1a52 = (str) => {
|
|
1552
|
-
const len = str.length;
|
|
1553
|
-
let i = 0, t0 = 0, v0 = 8997, t1 = 0, v1 = 33826, t2 = 0, v2 = 40164, t3 = 0, v3 = 52210;
|
|
1554
|
-
while (i < len) {
|
|
1555
|
-
v0 ^= str.charCodeAt(i++);
|
|
1556
|
-
t0 = v0 * 435;
|
|
1557
|
-
t1 = v1 * 435;
|
|
1558
|
-
t2 = v2 * 435;
|
|
1559
|
-
t3 = v3 * 435;
|
|
1560
|
-
t2 += v0 << 8;
|
|
1561
|
-
t3 += v1 << 8;
|
|
1562
|
-
t1 += t0 >>> 16;
|
|
1563
|
-
v0 = t0 & 65535;
|
|
1564
|
-
t2 += t1 >>> 16;
|
|
1565
|
-
v1 = t1 & 65535;
|
|
1566
|
-
v3 = t3 + (t2 >>> 16) & 65535;
|
|
1567
|
-
v2 = t2 & 65535;
|
|
1568
|
-
}
|
|
1569
|
-
return (v3 & 15) * 281474976710656 + v2 * 4294967296 + v1 * 65536 + (v0 ^ v3 >> 4);
|
|
1570
|
-
};
|
|
1571
|
-
const etag = (payload, weak = false) => {
|
|
1572
|
-
const prefix = weak ? 'W/"' : '"';
|
|
1573
|
-
return prefix + fnv1a52(payload).toString(36) + payload.length.toString(36) + '"';
|
|
1574
|
-
};
|
|
1575
|
-
|
|
1576
|
-
function isRemoteImage(src) {
|
|
1577
|
-
return /^http(s?):\/\//.test(src);
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
async function loadRemoteImage(src) {
|
|
1581
|
-
try {
|
|
1582
|
-
const res = await fetch(src);
|
|
1583
|
-
if (!res.ok) {
|
|
1584
|
-
return void 0;
|
|
1585
|
-
}
|
|
1586
|
-
return Buffer.from(await res.arrayBuffer());
|
|
1587
|
-
} catch {
|
|
1588
|
-
return void 0;
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
const get$1 = async ({ request }) => {
|
|
1592
|
-
try {
|
|
1593
|
-
const url = new URL(request.url);
|
|
1594
|
-
const transform = sharp_default.parseTransform(url.searchParams);
|
|
1595
|
-
let inputBuffer = void 0;
|
|
1596
|
-
const sourceUrl = isRemoteImage(transform.src) ? new URL(transform.src) : new URL(transform.src, url.origin);
|
|
1597
|
-
inputBuffer = await loadRemoteImage(sourceUrl);
|
|
1598
|
-
if (!inputBuffer) {
|
|
1599
|
-
return new Response("Not Found", { status: 404 });
|
|
1600
|
-
}
|
|
1601
|
-
const { data, format } = await sharp_default.transform(inputBuffer, transform);
|
|
1602
|
-
return new Response(data, {
|
|
1603
|
-
status: 200,
|
|
1604
|
-
headers: {
|
|
1605
|
-
"Content-Type": mime.getType(format) || "",
|
|
1606
|
-
"Cache-Control": "public, max-age=31536000",
|
|
1607
|
-
ETag: etag(data.toString()),
|
|
1608
|
-
Date: new Date().toUTCString()
|
|
1609
|
-
}
|
|
1610
|
-
});
|
|
1611
|
-
} catch (err) {
|
|
1612
|
-
return new Response(`Server Error: ${err}`, { status: 500 });
|
|
1613
|
-
}
|
|
1614
|
-
};
|
|
1615
|
-
|
|
1616
|
-
const _page0 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1617
|
-
__proto__: null,
|
|
1618
|
-
get: get$1
|
|
1619
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1620
|
-
|
|
1621
1411
|
if (!globalThis.__apiCache) {
|
|
1622
1412
|
globalThis.__apiCache = {};
|
|
1623
1413
|
}
|
|
@@ -2304,150 +2094,38 @@ const $$module1$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.definePropert
|
|
|
2304
2094
|
url: $$url$9
|
|
2305
2095
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2306
2096
|
|
|
2307
|
-
function resolveSize(transform) {
|
|
2308
|
-
if (transform.width && transform.height) {
|
|
2309
|
-
return transform;
|
|
2310
|
-
}
|
|
2311
|
-
if (!transform.width && !transform.height) {
|
|
2312
|
-
throw new Error(`"width" and "height" cannot both be undefined`);
|
|
2313
|
-
}
|
|
2314
|
-
if (!transform.aspectRatio) {
|
|
2315
|
-
throw new Error(
|
|
2316
|
-
`"aspectRatio" must be included if only "${transform.width ? "width" : "height"}" is provided`
|
|
2317
|
-
);
|
|
2318
|
-
}
|
|
2319
|
-
let aspectRatio;
|
|
2320
|
-
if (typeof transform.aspectRatio === "number") {
|
|
2321
|
-
aspectRatio = transform.aspectRatio;
|
|
2322
|
-
} else {
|
|
2323
|
-
const [width, height] = transform.aspectRatio.split(":");
|
|
2324
|
-
aspectRatio = Number.parseInt(width) / Number.parseInt(height);
|
|
2325
|
-
}
|
|
2326
|
-
if (transform.width) {
|
|
2327
|
-
return {
|
|
2328
|
-
...transform,
|
|
2329
|
-
width: transform.width,
|
|
2330
|
-
height: Math.round(transform.width / aspectRatio)
|
|
2331
|
-
};
|
|
2332
|
-
} else if (transform.height) {
|
|
2333
|
-
return {
|
|
2334
|
-
...transform,
|
|
2335
|
-
width: Math.round(transform.height * aspectRatio),
|
|
2336
|
-
height: transform.height
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
return transform;
|
|
2340
|
-
}
|
|
2341
|
-
async function resolveTransform(input) {
|
|
2342
|
-
if (typeof input.src === "string") {
|
|
2343
|
-
return resolveSize(input);
|
|
2344
|
-
}
|
|
2345
|
-
const metadata = "then" in input.src ? (await input.src).default : input.src;
|
|
2346
|
-
let { width, height, aspectRatio, background, format = metadata.format, ...rest } = input;
|
|
2347
|
-
if (!width && !height) {
|
|
2348
|
-
width = metadata.width;
|
|
2349
|
-
height = metadata.height;
|
|
2350
|
-
} else if (width) {
|
|
2351
|
-
let ratio = parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
|
|
2352
|
-
height = height || Math.round(width / ratio);
|
|
2353
|
-
} else if (height) {
|
|
2354
|
-
let ratio = parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
|
|
2355
|
-
width = width || Math.round(height * ratio);
|
|
2356
|
-
}
|
|
2357
|
-
return {
|
|
2358
|
-
...rest,
|
|
2359
|
-
src: metadata.src,
|
|
2360
|
-
width,
|
|
2361
|
-
height,
|
|
2362
|
-
aspectRatio,
|
|
2363
|
-
format,
|
|
2364
|
-
background
|
|
2365
|
-
};
|
|
2366
|
-
}
|
|
2367
|
-
async function getImage$1(transform) {
|
|
2368
|
-
var _a, _b, _c;
|
|
2369
|
-
if (!transform.src) {
|
|
2370
|
-
throw new Error("[@astrojs/image] `src` is required");
|
|
2371
|
-
}
|
|
2372
|
-
let loader = (_a = globalThis.astroImage) == null ? void 0 : _a.loader;
|
|
2373
|
-
if (!loader) {
|
|
2374
|
-
const { default: mod } = await Promise.resolve().then(() => sharp).catch(() => {
|
|
2375
|
-
throw new Error(
|
|
2376
|
-
"[@astrojs/image] Builtin image loader not found. (Did you remember to add the integration to your Astro config?)"
|
|
2377
|
-
);
|
|
2378
|
-
});
|
|
2379
|
-
loader = mod;
|
|
2380
|
-
globalThis.astroImage = globalThis.astroImage || {};
|
|
2381
|
-
globalThis.astroImage.loader = loader;
|
|
2382
|
-
}
|
|
2383
|
-
const resolved = await resolveTransform(transform);
|
|
2384
|
-
const attributes = await loader.getImageAttributes(resolved);
|
|
2385
|
-
const isDev = (_b = (Object.assign({"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true},{SSR:true,}))) == null ? void 0 : _b.DEV;
|
|
2386
|
-
const isLocalImage = !isRemoteImage(resolved.src);
|
|
2387
|
-
const _loader = isDev && isLocalImage ? sharp_default : loader;
|
|
2388
|
-
if (!_loader) {
|
|
2389
|
-
throw new Error("@astrojs/image: loader not found!");
|
|
2390
|
-
}
|
|
2391
|
-
const { searchParams } = isSSRService(_loader) ? _loader.serializeTransform(resolved) : sharp_default.serializeTransform(resolved);
|
|
2392
|
-
let src;
|
|
2393
|
-
if (/^[\/\\]?@astroimage/.test(resolved.src)) {
|
|
2394
|
-
src = `${resolved.src}?${searchParams.toString()}`;
|
|
2395
|
-
} else {
|
|
2396
|
-
searchParams.set("href", resolved.src);
|
|
2397
|
-
src = `/_image?${searchParams.toString()}`;
|
|
2398
|
-
}
|
|
2399
|
-
if ((_c = globalThis.astroImage) == null ? void 0 : _c.addStaticImage) {
|
|
2400
|
-
src = globalThis.astroImage.addStaticImage(resolved);
|
|
2401
|
-
}
|
|
2402
|
-
return {
|
|
2403
|
-
...attributes,
|
|
2404
|
-
src
|
|
2405
|
-
};
|
|
2406
|
-
}
|
|
2407
|
-
|
|
2408
2097
|
const tryImageSize = (src) => {
|
|
2409
2098
|
let dimensions = {};
|
|
2410
2099
|
if (typeof src === "string" && src.startsWith("/")) {
|
|
2411
2100
|
try {
|
|
2412
|
-
dimensions =
|
|
2101
|
+
dimensions = imageSize(`public${src}`);
|
|
2413
2102
|
} catch (e) {
|
|
2414
2103
|
dimensions = {};
|
|
2415
2104
|
}
|
|
2416
2105
|
}
|
|
2417
2106
|
return dimensions;
|
|
2418
2107
|
};
|
|
2419
|
-
const
|
|
2420
|
-
if (
|
|
2421
|
-
|
|
2422
|
-
} else if (options.height) {
|
|
2423
|
-
options.height *= 2;
|
|
2424
|
-
}
|
|
2425
|
-
if (typeof options.src === "string" && !options.aspectRatio && (!options.width || !options.height)) {
|
|
2426
|
-
const { width, height } = tryImageSize(options.src);
|
|
2108
|
+
const getImageAttrs = async (attrs) => {
|
|
2109
|
+
if (!attrs.width || !attrs.height) {
|
|
2110
|
+
const { width, height } = tryImageSize(attrs.src);
|
|
2427
2111
|
if (width) {
|
|
2428
|
-
|
|
2429
|
-
|
|
2112
|
+
const aspectRatio = height ? width / height : 1;
|
|
2113
|
+
if (!attrs.width) {
|
|
2114
|
+
attrs.width = attrs.height ? Math.round(attrs.height * aspectRatio) : width;
|
|
2115
|
+
}
|
|
2116
|
+
if (!attrs.height) {
|
|
2117
|
+
attrs.height = Math.round(attrs.width / aspectRatio);
|
|
2430
2118
|
}
|
|
2431
|
-
options.aspectRatio = height ? width / height : 1;
|
|
2432
2119
|
}
|
|
2433
2120
|
}
|
|
2434
|
-
|
|
2435
|
-
imgAttrs.src += imgAttrs.src.includes("?") ? "&" : "?";
|
|
2436
|
-
imgAttrs.src += `V=${{"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}.DEPLOY_RAND || "_"}`;
|
|
2437
|
-
if (typeof imgAttrs.width === "number") {
|
|
2438
|
-
imgAttrs.width /= 2;
|
|
2439
|
-
}
|
|
2440
|
-
if (typeof imgAttrs.height === "number") {
|
|
2441
|
-
imgAttrs.height /= 2;
|
|
2442
|
-
}
|
|
2443
|
-
return imgAttrs;
|
|
2121
|
+
return attrs;
|
|
2444
2122
|
};
|
|
2445
2123
|
|
|
2446
2124
|
const $$module1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2447
2125
|
__proto__: null,
|
|
2448
|
-
default:
|
|
2126
|
+
default: getImageAttrs,
|
|
2449
2127
|
tryImageSize,
|
|
2450
|
-
|
|
2128
|
+
getImageAttrs
|
|
2451
2129
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2452
2130
|
|
|
2453
2131
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
@@ -2653,12 +2331,9 @@ const $$PagesHeader = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
2653
2331
|
contacts,
|
|
2654
2332
|
...topBarProps
|
|
2655
2333
|
};
|
|
2656
|
-
const logoWebpAttrs = await
|
|
2334
|
+
const logoWebpAttrs = await getImageAttrs({
|
|
2657
2335
|
src: settings.logo,
|
|
2658
|
-
width: 150
|
|
2659
|
-
format: "webp",
|
|
2660
|
-
quality: 90,
|
|
2661
|
-
...logoTransform
|
|
2336
|
+
width: 150
|
|
2662
2337
|
});
|
|
2663
2338
|
return renderTemplate`${renderSlot($$result, $$slots["top-bar"], renderTemplate`
|
|
2664
2339
|
${renderComponent($$result, "TopBar", _sfc_main$1, { ...globalThis.TopBarProps })}
|
|
@@ -2753,7 +2428,7 @@ ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment,
|
|
|
2753
2428
|
const $$file$5 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro";
|
|
2754
2429
|
const $$url$5 = "";
|
|
2755
2430
|
|
|
2756
|
-
const
|
|
2431
|
+
const _page0 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2757
2432
|
__proto__: null,
|
|
2758
2433
|
$$metadata: $$metadata$5,
|
|
2759
2434
|
default: $$Index$1,
|
|
@@ -2805,7 +2480,7 @@ ${renderComponent($$result, "PagesLayout", $$Pages, { "pageContext": pageContext
|
|
|
2805
2480
|
const $$file$3 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro";
|
|
2806
2481
|
const $$url$3 = "/fallback";
|
|
2807
2482
|
|
|
2808
|
-
const
|
|
2483
|
+
const _page1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2809
2484
|
__proto__: null,
|
|
2810
2485
|
$$metadata: $$metadata$3,
|
|
2811
2486
|
default: $$Fallback,
|
|
@@ -2824,7 +2499,7 @@ const $$Index = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
2824
2499
|
const $$file$2 = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/app/index.astro";
|
|
2825
2500
|
const $$url$2 = "/app";
|
|
2826
2501
|
|
|
2827
|
-
const
|
|
2502
|
+
const _page2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2828
2503
|
__proto__: null,
|
|
2829
2504
|
$$metadata: $$metadata$2,
|
|
2830
2505
|
default: $$Index,
|
|
@@ -2890,7 +2565,7 @@ ${loadError && renderTemplate`${renderComponent($$result, "Fragment", Fragment,
|
|
|
2890
2565
|
const $$file = "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro";
|
|
2891
2566
|
const $$url = "/[...slug]";
|
|
2892
2567
|
|
|
2893
|
-
const
|
|
2568
|
+
const _page3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2894
2569
|
__proto__: null,
|
|
2895
2570
|
$$metadata,
|
|
2896
2571
|
default: $$,
|
|
@@ -2898,7 +2573,7 @@ const _page4 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
2898
2573
|
url: $$url
|
|
2899
2574
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2900
2575
|
|
|
2901
|
-
const pageMap = new Map([['
|
|
2576
|
+
const pageMap = new Map([['src/pages/index.astro', _page0],['src/pages/fallback.astro', _page1],['src/pages/app/index.astro', _page2],['src/pages/[...slug].astro', _page3],]);
|
|
2902
2577
|
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 }),];
|
|
2903
2578
|
|
|
2904
2579
|
if (typeof process !== "undefined") {
|
|
@@ -2970,7 +2645,7 @@ function deserializeManifest(serializedManifest) {
|
|
|
2970
2645
|
};
|
|
2971
2646
|
}
|
|
2972
2647
|
|
|
2973
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.7.1/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css"],"scripts":[{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","_meta":{"trailingSlash":"ignore"}}}],"site":"https://storefront-demo.e-com.plus/","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"extendDefaultPlugins":false,"isAstroFlavoredMd":false},"pageMap":null,"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"entry.mjs","@astrojs/vue/client.js":"client.80baece3.js","/astro/hoisted.js?q=0":"hoisted.46e058d2.js","astro:scripts/page.js":"page.3aa82516.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/.pnpm/workbox-window@6.5.4/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"chunks/workbox-window.prod.es5.4b654ae6.js","astro:scripts/before-hydration.js":""},"assets":["/assets/_...73e01db2.css","/assets/_...ee104f19.css","/manifest.webmanifest","/registerSW.js","/client.80baece3.js","/hoisted.46e058d2.js","/page.3aa82516.js","/robots.txt","/sw.js","/workbox-6f0d1f78.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","/chunks/workbox-window.prod.es5.4b654ae6.js","/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","/assets/icons/bootstrap-icons/font/storefront-icons.woff2","/assets/icons/feather-icons/font/storefront-icons.woff2","/assets/icons/font-awesome/font/storefront-icons.woff2","/assets/icons/line-awesome/font/storefront-icons.woff2","/assets/icons/tabler-icons/font/storefront-icons.woff2","/page.3aa82516.js","/~partytown/partytown-atomics.js","/~partytown/partytown-media.js","/~partytown/partytown-sw.js","/~partytown/partytown.js"]}), {
|
|
2648
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css"],"scripts":[{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["assets/_...ee104f19.css","assets/_...73e01db2.css"],"scripts":[{"type":"external","value":"hoisted.46e058d2.js"},{"type":"external","value":"page.3aa82516.js"},{"stage":"head-inline","children":"!(function(w,p,f,c){c=w[p]=Object.assign(w[p]||{},{\"lib\":\"/~partytown/\",\"debug\":false});c[f]=(c[f]||[])})(window,'partytown','forward');/* Partytown 0.4.5 - MIT builder.io */\n!function(t,e,n,i,r,o,a,d,s,c,p,l){function u(){l||(l=1,\"/\"==(a=(o.lib||\"/~partytown/\")+(o.debug?\"debug/\":\"\"))[0]&&(s=e.querySelectorAll('script[type=\"text/partytown\"]'),i!=t?i.dispatchEvent(new CustomEvent(\"pt1\",{detail:t})):(d=setTimeout(w,1e4),e.addEventListener(\"pt0\",f),r?h(1):n.serviceWorker?n.serviceWorker.register(a+(o.swPath||\"partytown-sw.js\"),{scope:a}).then((function(t){t.active?h():t.installing&&t.installing.addEventListener(\"statechange\",(function(t){\"activated\"==t.target.state&&h()}))}),console.error):w())))}function h(t){c=e.createElement(t?\"script\":\"iframe\"),t||(c.setAttribute(\"style\",\"display:block;width:0;height:0;border:0;visibility:hidden\"),c.setAttribute(\"aria-hidden\",!0)),c.src=a+\"partytown-\"+(t?\"atomics.js?v=0.4.5\":\"sandbox-sw.html?\"+Date.now()),e.body.appendChild(c)}function w(t,n){for(f(),t=0;t<s.length;t++)(n=e.createElement(\"script\")).innerHTML=s[t].innerHTML,e.head.appendChild(n);c&&c.parentNode.removeChild(c)}function f(){clearTimeout(d)}o=t.partytown||{},i==t&&(o.forward||[]).map((function(e){p=t,e.split(\".\").map((function(e,n,i){p=p[i[n]]=n+1<i.length?\"push\"==i[n+1]?[]:p[i[n]]||{}:function(){(t._ptf=t._ptf||[]).push(i,arguments)}}))})),\"complete\"==e.readyState?u():(t.addEventListener(\"DOMContentLoaded\",u),t.addEventListener(\"load\",u))}(window,document,navigator,top,window.crossOriginIsolated);"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","_meta":{"trailingSlash":"ignore"}}}],"site":"https://storefront-demo.e-com.plus/","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"extendDefaultPlugins":false,"isAstroFlavoredMd":false},"pageMap":null,"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"entry.mjs","@astrojs/vue/client.js":"client.80baece3.js","/astro/hoisted.js?q=0":"hoisted.46e058d2.js","astro:scripts/page.js":"page.3aa82516.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/.pnpm/workbox-window@6.5.4/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"chunks/workbox-window.prod.es5.4b654ae6.js","astro:scripts/before-hydration.js":""},"assets":["/assets/_...73e01db2.css","/assets/_...ee104f19.css","/manifest.webmanifest","/registerSW.js","/client.80baece3.js","/hoisted.46e058d2.js","/page.3aa82516.js","/robots.txt","/sw.js","/workbox-6f0d1f78.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","/chunks/workbox-window.prod.es5.4b654ae6.js","/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","/assets/icons/bootstrap-icons/font/storefront-icons.woff2","/assets/icons/feather-icons/font/storefront-icons.woff2","/assets/icons/font-awesome/font/storefront-icons.woff2","/assets/icons/line-awesome/font/storefront-icons.woff2","/assets/icons/tabler-icons/font/storefront-icons.woff2","/page.3aa82516.js","/~partytown/partytown-atomics.js","/~partytown/partytown-media.js","/~partytown/partytown-sw.js","/~partytown/partytown.js"]}), {
|
|
2974
2649
|
pageMap: pageMap,
|
|
2975
2650
|
renderers: renderers
|
|
2976
2651
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.95",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"prerelease": "sh scripts/prerelease.sh"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@astrojs/image": "^0.7.1",
|
|
29
28
|
"@astrojs/node": "^1.0.1",
|
|
30
29
|
"@astrojs/partytown": "^1.0.0",
|
|
31
30
|
"@astrojs/prefetch": "^0.0.7",
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import imageSize from 'image-size';
|
|
2
|
-
// eslint-disable-next-line import/no-unresolved
|
|
3
|
-
import { getImage as _getImage } from '@astrojs/image';
|
|
4
2
|
|
|
5
3
|
const tryImageSize = (src: string) => {
|
|
6
4
|
let dimensions: { width?: number, height?: number } = {};
|
|
@@ -14,37 +12,26 @@ const tryImageSize = (src: string) => {
|
|
|
14
12
|
return dimensions;
|
|
15
13
|
};
|
|
16
14
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
typeof options.src === 'string'
|
|
25
|
-
&& !options.aspectRatio
|
|
26
|
-
&& (!options.width || !options.height)
|
|
27
|
-
) {
|
|
28
|
-
const { width, height } = tryImageSize(options.src);
|
|
15
|
+
const getImageAttrs = async (attrs: {
|
|
16
|
+
src: string,
|
|
17
|
+
width?: number,
|
|
18
|
+
height?: number,
|
|
19
|
+
}) => {
|
|
20
|
+
if (!attrs.width || !attrs.height) {
|
|
21
|
+
const { width, height } = tryImageSize(attrs.src);
|
|
29
22
|
if (width) {
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
const aspectRatio = height ? width / height : 1;
|
|
24
|
+
if (!attrs.width) {
|
|
25
|
+
attrs.width = attrs.height ? Math.round(attrs.height * aspectRatio) : width;
|
|
26
|
+
}
|
|
27
|
+
if (!attrs.height) {
|
|
28
|
+
attrs.height = Math.round(attrs.width / aspectRatio);
|
|
32
29
|
}
|
|
33
|
-
options.aspectRatio = height ? width / height : 1;
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
|
-
|
|
37
|
-
imgAttrs.src += imgAttrs.src.includes('?') ? '&' : '?';
|
|
38
|
-
imgAttrs.src += `V=${import.meta.env.DEPLOY_RAND || '_'}`;
|
|
39
|
-
if (typeof imgAttrs.width === 'number') {
|
|
40
|
-
imgAttrs.width /= 2;
|
|
41
|
-
}
|
|
42
|
-
if (typeof imgAttrs.height === 'number') {
|
|
43
|
-
imgAttrs.height /= 2;
|
|
44
|
-
}
|
|
45
|
-
return imgAttrs;
|
|
32
|
+
return attrs;
|
|
46
33
|
};
|
|
47
34
|
|
|
48
|
-
export default
|
|
35
|
+
export default getImageAttrs;
|
|
49
36
|
|
|
50
|
-
export { tryImageSize,
|
|
37
|
+
export { tryImageSize, getImageAttrs };
|
|
@@ -3,7 +3,7 @@ import type { Categories } from '@cloudcommerce/api/types';
|
|
|
3
3
|
import type CmsHeader from '../../types/cms-header';
|
|
4
4
|
import type CmsContacts from '../../types/cms-contacts';
|
|
5
5
|
import type { PageContext } from '../ssr-context';
|
|
6
|
-
import
|
|
6
|
+
import { getImageAttrs } from '../helpers/image';
|
|
7
7
|
import TopBar, { Props as TopBarProps } from '../components/TopBar.vue';
|
|
8
8
|
import TheHeader from '../components/TheHeader.vue';
|
|
9
9
|
|
|
@@ -73,12 +73,9 @@ globalThis.TopBarProps = {
|
|
|
73
73
|
...topBarProps,
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
const logoWebpAttrs = await
|
|
76
|
+
const logoWebpAttrs = await getImageAttrs({
|
|
77
77
|
src: settings.logo,
|
|
78
78
|
width: 150,
|
|
79
|
-
format: 'webp',
|
|
80
|
-
quality: 90,
|
|
81
|
-
...logoTransform,
|
|
82
79
|
});
|
|
83
80
|
---
|
|
84
81
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { fileURLToPath } from 'url';
|
|
2
1
|
import fs from 'fs';
|
|
3
2
|
import { resolve as resolvePath } from 'path';
|
|
4
3
|
import config from '@cloudcommerce/config';
|
|
5
4
|
|
|
5
|
+
const getEnvVar = (name) => {
|
|
6
|
+
return import.meta.env?.[name] || process.env[name];
|
|
7
|
+
};
|
|
8
|
+
|
|
6
9
|
export default () => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
VITE_ECOM_STORE_ID,
|
|
10
|
-
} = import.meta.env || process.env;
|
|
10
|
+
const STOREFRONT_BASE_DIR = getEnvVar('STOREFRONT_BASE_DIR');
|
|
11
|
+
const VITE_ECOM_STORE_ID = getEnvVar('VITE_ECOM_STORE_ID');
|
|
11
12
|
|
|
12
13
|
let baseDir;
|
|
13
14
|
if (STOREFRONT_BASE_DIR) {
|
|
14
|
-
|
|
15
|
-
baseDir = resolvePath(currentDir, STOREFRONT_BASE_DIR);
|
|
15
|
+
baseDir = resolvePath(process.cwd(), STOREFRONT_BASE_DIR);
|
|
16
16
|
} else {
|
|
17
17
|
baseDir = process.cwd();
|
|
18
18
|
}
|