@gem-sdk/pages 1.41.1 → 1.41.9

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.
@@ -68,7 +68,16 @@ async function getFonts(fonts, option, isImportFontByUrl = true) {
68
68
  getFontForUA(url, IE_UA),
69
69
  getFontForUA(url, CHROME_UA)
70
70
  ]);
71
- return ie + chrome;
71
+ const maxSize = 100; // 100KB
72
+ const value = ie + chrome;
73
+ if (maxSize) {
74
+ const textEncoder = new TextEncoder();
75
+ const size = value ? textEncoder.encode(value).length : 0;
76
+ if (Math.ceil(size / 1024) >= maxSize) {
77
+ return `@import url('${url}');`;
78
+ }
79
+ }
80
+ return value;
72
81
  } catch (e) {
73
82
  return '';
74
83
  }
@@ -66,7 +66,16 @@ async function getFonts(fonts, option, isImportFontByUrl = true) {
66
66
  getFontForUA(url, IE_UA),
67
67
  getFontForUA(url, CHROME_UA)
68
68
  ]);
69
- return ie + chrome;
69
+ const maxSize = 100; // 100KB
70
+ const value = ie + chrome;
71
+ if (maxSize) {
72
+ const textEncoder = new TextEncoder();
73
+ const size = value ? textEncoder.encode(value).length : 0;
74
+ if (Math.ceil(size / 1024) >= maxSize) {
75
+ return `@import url('${url}');`;
76
+ }
77
+ }
78
+ return value;
70
79
  } catch (e) {
71
80
  return '';
72
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.41.1",
3
+ "version": "1.41.9",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,7 +26,7 @@
26
26
  "next": "latest"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "1.41.1",
29
+ "@gem-sdk/core": "1.41.3",
30
30
  "@gem-sdk/plugin-cookie-bar": "1.40.0",
31
31
  "@gem-sdk/plugin-quick-view": "1.40.0",
32
32
  "@gem-sdk/plugin-sticky-add-to-cart": "1.40.0"