@adobe/helix-html-pipeline 2.1.0 → 2.1.1

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,3 +1,10 @@
1
+ ## [2.1.1](https://github.com/adobe/helix-html-pipeline/compare/v2.1.0...v2.1.1) (2022-06-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Lazy images ([#73](https://github.com/adobe/helix-html-pipeline/issues/73)) ([7442a5e](https://github.com/adobe/helix-html-pipeline/commit/7442a5e0720699d974332a2f5659fdddd27b0dc6))
7
+
1
8
  # [2.1.0](https://github.com/adobe/helix-html-pipeline/compare/v2.0.4...v2.1.0) (2022-06-02)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -18,7 +18,7 @@ const BREAK_POINTS = [
18
18
  { width: '750' },
19
19
  ];
20
20
 
21
- export function createOptimizedPicture(src, alt = '', eager = false) {
21
+ export function createOptimizedPicture(src, alt = '') {
22
22
  const url = new URL(src, 'https://localhost/');
23
23
  const { pathname, hash = '' } = url;
24
24
  const props = new URLSearchParams(hash.substring(1));
@@ -53,7 +53,7 @@ export function createOptimizedPicture(src, alt = '', eager = false) {
53
53
  });
54
54
  }
55
55
  return h('img', {
56
- loading: eager ? 'eager' : 'lazy',
56
+ loading: 'lazy',
57
57
  alt,
58
58
  type: v.type,
59
59
  src: srcset,
@@ -77,11 +77,9 @@ function isMediaImage(node) {
77
77
  export default async function createPictures({ content }) {
78
78
  const { hast } = content;
79
79
 
80
- let first = true;
81
80
  visitParents(hast, isMediaImage, (img, parents) => {
82
81
  const { src, alt } = img.properties;
83
- const picture = createOptimizedPicture(src, alt, first);
84
- first = false;
82
+ const picture = createOptimizedPicture(src, alt);
85
83
 
86
84
  // check if parent has style and unwrap if needed
87
85
  const parent = parents[parents.length - 1];
@@ -21,8 +21,8 @@ import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
21
21
  */
22
22
  export default function setCustomResponseHeaders(state, req, res) {
23
23
  Object.entries(state.headers.getModifiers(state.info.path)).forEach(([name, value]) => {
24
- // don't use `link` header for non-html pipeline
25
- if (name !== 'link' || state.type === 'html') {
24
+ // only use `link` header for extensionless pipeline
25
+ if (name !== 'link' || (state.type === 'html' && state.info.selector === '')) {
26
26
  res.headers.set(name, cleanupHeaderValue(value));
27
27
  }
28
28
  });