mod-build 4.0.94 → 4.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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.95
4
+
5
+ - Fix lazy-load HTML transform that treated `data-img-class="lazy"` as a `class="lazy"` match and rewrote `data-img-src` to `data-img-data-src`; now only real `class`, `src`, `srcset`, and `href` attributes are affected
6
+
3
7
  ## 4.0.94
4
8
 
5
9
  - Prefer site config `brandedSiteIdentifiers.publicKey` over the remote branded-site-identifiers lookup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.94",
3
+ "version": "4.0.95",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
package/vite.config.js CHANGED
@@ -107,8 +107,8 @@ export default defineConfig((config) => ({
107
107
  if (!config.replaceImgSrcWithDataSrc) {
108
108
  return html;
109
109
  }
110
- return html.replace(/<[^>]*class\s*=\s*["'][^"']*\b(?:lazy)\b[^"']*["'][^>]*>/gi, tag => {
111
- return tag.replace(/\b(src|srcset|href)=["']([^"']+)["']/gi, (match, attr, url) => {
110
+ return html.replace(/<[^>]*(?<![-\w])class\s*=\s*["'][^"']*\b(?:lazy)\b[^"']*["'][^>]*>/gi, tag => {
111
+ return tag.replace(/(?<![-\w])(src|srcset|href)\s*=\s*["']([^"']+)["']/gi, (match, attr, url) => {
112
112
  return `data-${attr}="${url}"`;
113
113
  });
114
114
  });