@adobe/helix-html-pipeline 6.12.4 → 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,10 @@
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
+
1
8
  ## [6.12.4](https://github.com/adobe/helix-html-pipeline/compare/v6.12.3...v6.12.4) (2024-06-10)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.12.4",
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",
@@ -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`);