@coraltravelcenter/b2c-landing-builder 2.2.0 → 2.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coraltravelcenter/b2c-landing-builder",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "CLI and build toolkit for B2C landing projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,6 +51,18 @@ export function rewriteCssImageUrls(cssText, options) {
51
51
  );
52
52
  }
53
53
 
54
+ export function rewriteJsImageUrls(jsText, options) {
55
+ if (!jsText || typeof jsText !== "string") return jsText;
56
+
57
+ return jsText.replace(
58
+ /(['"`])(\/(?!\/)[^'"`\s]+\.(?:avif|gif|jpe?g|png|svg|webp)(?:[?#][^'"`\s]*)?)\1/gi,
59
+ (match, quote, url) => {
60
+ const nextUrl = rewriteImageAssetUrl(url, options);
61
+ return nextUrl === url ? match : `${quote}${nextUrl}${quote}`;
62
+ }
63
+ );
64
+ }
65
+
54
66
  export function rewriteHtmlImageAssets(html, options) {
55
67
  if (!html || typeof html !== "string") return html;
56
68
 
@@ -81,5 +93,10 @@ export function rewriteHtmlImageAssets(html, options) {
81
93
  return nextCss === css ? match : match.replace(css, nextCss);
82
94
  });
83
95
 
96
+ output = output.replace(/<script\b(?![^>]*\bsrc=)[^>]*>([\s\S]*?)<\/script>/gi, (match, js) => {
97
+ const nextJs = rewriteJsImageUrls(js, options);
98
+ return nextJs === js ? match : match.replace(js, nextJs);
99
+ });
100
+
84
101
  return output;
85
102
  }
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  id: "sunmar",
3
3
  domain: "www.sunmar.ru",
4
- assetsBase: null,
4
+ assetsBase: "https://b2ccdn.sunmar.ru/content",
5
5
  };