@adobe/helix-html-pipeline 6.12.3 → 6.12.5

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,17 @@
1
+ ## [6.12.5](https://github.com/adobe/helix-html-pipeline/compare/v6.12.4...v6.12.5) (2024-06-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * surrogate key for static html ([#623](https://github.com/adobe/helix-html-pipeline/issues/623)) ([6d04f2d](https://github.com/adobe/helix-html-pipeline/commit/6d04f2d1daa90053dc8565f6136cebd0a80860f9))
7
+
8
+ ## [6.12.4](https://github.com/adobe/helix-html-pipeline/compare/v6.12.3...v6.12.4) (2024-06-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * rewrite meta image link ([#615](https://github.com/adobe/helix-html-pipeline/issues/615)) ([#620](https://github.com/adobe/helix-html-pipeline/issues/620)) ([132e591](https://github.com/adobe/helix-html-pipeline/commit/132e591844cfe7d27bec2c28a87d83c754dd53c8)), closes [#604](https://github.com/adobe/helix-html-pipeline/issues/604)
14
+
1
15
  ## [6.12.3](https://github.com/adobe/helix-html-pipeline/compare/v6.12.2...v6.12.3) (2024-06-09)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.12.3",
3
+ "version": "6.12.5",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -75,7 +75,7 @@
75
75
  "@semantic-release/changelog": "6.0.3",
76
76
  "@semantic-release/git": "10.0.1",
77
77
  "@semantic-release/npm": "12.0.1",
78
- "c8": "9.1.0",
78
+ "c8": "10.0.0",
79
79
  "eslint": "8.57.0",
80
80
  "eslint-import-resolver-exports": "1.0.0-beta.5",
81
81
  "eslint-plugin-header": "3.1.1",
@@ -14,7 +14,7 @@ import { toString } from 'hast-util-to-string';
14
14
  import { remove } from 'unist-util-remove';
15
15
  import { visit, EXIT, CONTINUE } from 'unist-util-visit';
16
16
  import {
17
- getAbsoluteUrl, makeCanonicalHtmlUrl, optimizeImageURL, resolveUrl,
17
+ getAbsoluteUrl, makeCanonicalHtmlUrl, optimizeImageURL, resolveUrl, rewriteUrl,
18
18
  } from './utils.js';
19
19
  import { toMetaName } from '../utils/modifiers.js';
20
20
  import { childNodes } from '../utils/hast-utils.js';
@@ -251,7 +251,9 @@ export default function extractMetaData(state, req) {
251
251
  meta.image = content.image || '/default-meta-image.png';
252
252
  }
253
253
  if (meta.image) {
254
- meta.image = getAbsoluteUrl(state, optimizeMetaImage(state.info.path, meta.image));
254
+ meta.image = rewriteUrl(state, meta.image);
255
+ meta.image = optimizeMetaImage(state.info.path, meta.image);
256
+ meta.image = getAbsoluteUrl(state, meta.image);
255
257
  }
256
258
 
257
259
  meta.imageAlt = meta['image-alt'] ?? content.imageAlt;
@@ -44,14 +44,20 @@ export default async function setXSurrogateKeyHeader(state, req, res) {
44
44
  const {
45
45
  contentBusId, owner, repo, ref,
46
46
  } = state;
47
- const hash = await getPathKey(state);
48
- const keys = [
49
- hash,
50
- `${contentBusId}_metadata`,
51
- `${ref}--${repo}--${owner}_head`,
52
- contentBusId,
53
- ];
54
47
 
48
+ const isCode = state.content.sourceBus === 'code';
49
+
50
+ const keys = [];
51
+ const hash = await getPathKey(state);
52
+ if (isCode) {
53
+ keys.push(await computeSurrogateKey(`${ref}--${repo}--${owner}${state.info.path}`));
54
+ keys.push(`${ref}--${repo}--${owner}_code`);
55
+ } else {
56
+ keys.push(hash);
57
+ keys.push(`${contentBusId}_metadata`);
58
+ keys.push(`${ref}--${repo}--${owner}_head`);
59
+ keys.push(contentBusId);
60
+ }
55
61
  // for folder-mapped resources, we also need to include the surrogate key of the mapped metadata
56
62
  if (state.mapped) {
57
63
  keys.push(`${hash}_metadata`);