@adobe/helix-html-pipeline 5.5.1 → 5.6.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [5.6.0](https://github.com/adobe/helix-html-pipeline/compare/v5.5.2...v5.6.0) (2024-01-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * remove source-location surrogate key ([188b3d3](https://github.com/adobe/helix-html-pipeline/commit/188b3d39ced9dc0ea00b230726fb3a236f4c530c))
7
+
8
+ ## [5.5.2](https://github.com/adobe/helix-html-pipeline/compare/v5.5.1...v5.5.2) (2024-01-25)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * include surrogate keys for 404 sitemap.xml ([#513](https://github.com/adobe/helix-html-pipeline/issues/513)) ([d81798f](https://github.com/adobe/helix-html-pipeline/commit/d81798f096f6fded11f3280c0c53e4806d2bf5ee))
14
+
1
15
  ## [5.5.1](https://github.com/adobe/helix-html-pipeline/compare/v5.5.0...v5.5.1) (2024-01-23)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@adobe/helix-markdown-support": "7.1.0",
46
- "@adobe/helix-shared-utils": "3.0.0",
46
+ "@adobe/helix-shared-utils": "3.0.1",
47
47
  "@adobe/mdast-util-gridtables": "3.0.2",
48
48
  "@adobe/remark-gridtables": "2.0.2",
49
49
  "cookie": "0.6.0",
@@ -51,7 +51,7 @@ export async function sitemapPipe(state, req) {
51
51
  /** @type PipelineResponse */
52
52
  const res = new PipelineResponse('', {
53
53
  headers: {
54
- 'content-type': 'text/html; charset=utf-8',
54
+ 'content-type': 'text/plain; charset=utf-8',
55
55
  },
56
56
  });
57
57
 
@@ -81,13 +81,7 @@ export async function sitemapPipe(state, req) {
81
81
 
82
82
  if (res.error) {
83
83
  // if content loading produced an error, we're done.
84
- const level = res.status >= 500 ? 'error' : 'info';
85
- log[level](`pipeline status: ${res.status} ${res.error}`);
86
- res.headers.set('x-error', cleanupHeaderValue(res.error));
87
- if (res.status < 500) {
88
- await setCustomResponseHeaders(state, req, res);
89
- }
90
- return res;
84
+ throw new PipelineStatusError(res.status, res.error);
91
85
  }
92
86
 
93
87
  state.timer?.update('serialize');
@@ -96,16 +90,15 @@ export async function sitemapPipe(state, req) {
96
90
  await setXSurrogateKeyHeader(state, req, res);
97
91
  } catch (e) {
98
92
  res.error = e.message;
99
- if (e instanceof PipelineStatusError) {
100
- res.status = e.code;
101
- } else {
102
- res.status = 500;
103
- }
93
+ res.status = e.code || 500;
104
94
 
105
95
  const level = res.status >= 500 ? 'error' : 'info';
106
- log[level](`pipeline status: ${res.status} ${res.error}`, e);
96
+ log[level](`pipeline status: ${res.status} ${res.error}`);
107
97
  res.headers.set('x-error', cleanupHeaderValue(res.error));
98
+ if (res.status < 500) {
99
+ await setCustomResponseHeaders(state, req, res);
100
+ await setXSurrogateKeyHeader(state, req, res);
101
+ }
108
102
  }
109
-
110
103
  return res;
111
104
  }
@@ -42,19 +42,16 @@ export async function getPathKey(state) {
42
42
  */
43
43
  export default async function setXSurrogateKeyHeader(state, req, res) {
44
44
  const {
45
- content, contentBusId, owner, repo, ref,
45
+ contentBusId, owner, repo, ref,
46
46
  } = state;
47
-
48
- const keys = [];
49
- if (content.sourceLocation) {
50
- keys.push(await computeSurrogateKey(content.sourceLocation));
51
- }
52
-
53
47
  const hash = await getPathKey(state);
54
- keys.push(hash);
55
- keys.push(`${contentBusId}_metadata`);
56
- keys.push(`${ref}--${repo}--${owner}_head`);
48
+ const keys = [
49
+ hash,
50
+ `${contentBusId}_metadata`,
51
+ `${ref}--${repo}--${owner}_head`,
52
+ ];
57
53
 
54
+ // for folder-mapped resources, we also need to include the surrogate key of the mapped metadata
58
55
  if (state.mapped) {
59
56
  keys.push(`${hash}_metadata`);
60
57
  }