@adobe/helix-html-pipeline 6.15.1 → 6.15.3

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.15.3](https://github.com/adobe/helix-html-pipeline/compare/v6.15.2...v6.15.3) (2024-10-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * provide either (prefixed) preview or (unprefixed) live content keys ([5e29919](https://github.com/adobe/helix-html-pipeline/commit/5e29919973bddfef1b9bfd7ebdcb7fde535226ad))
7
+
8
+ ## [6.15.2](https://github.com/adobe/helix-html-pipeline/compare/v6.15.1...v6.15.2) (2024-10-12)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency hast-util-select to v6.0.3 ([ef6927d](https://github.com/adobe/helix-html-pipeline/commit/ef6927dc9654200f223cf25b85910d6435e4493b))
14
+
1
15
  ## [6.15.1](https://github.com/adobe/helix-html-pipeline/compare/v6.15.0...v6.15.1) (2024-10-10)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.15.1",
3
+ "version": "6.15.3",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  "@adobe/remark-gridtables": "3.0.6",
50
50
  "github-slugger": "2.0.0",
51
51
  "hast-util-raw": "9.0.4",
52
- "hast-util-select": "6.0.2",
52
+ "hast-util-select": "6.0.3",
53
53
  "hast-util-to-html": "9.0.3",
54
54
  "hast-util-to-string": "3.0.1",
55
55
  "hastscript": "9.0.0",
@@ -80,7 +80,7 @@
80
80
  "eslint-import-resolver-exports": "1.0.0-beta.5",
81
81
  "eslint-plugin-header": "3.1.1",
82
82
  "eslint-plugin-import": "2.31.0",
83
- "esmock": "2.6.7",
83
+ "esmock": "2.6.9",
84
84
  "husky": "9.1.6",
85
85
  "js-yaml": "4.1.0",
86
86
  "jsdom": "25.0.1",
@@ -89,7 +89,7 @@
89
89
  "mocha": "10.7.3",
90
90
  "mocha-multi-reporters": "1.5.1",
91
91
  "mocha-suppress-logs": "0.5.1",
92
- "semantic-release": "24.1.2"
92
+ "semantic-release": "24.1.3"
93
93
  },
94
94
  "lint-staged": {
95
95
  "*.js": "eslint",
package/src/json-pipe.js CHANGED
@@ -63,15 +63,10 @@ async function fetchJsonContent(state, req, res) {
63
63
  res.headers.set('location', redirectLocation);
64
64
  const keys = [];
65
65
  if (state.content.sourceBus === 'content') {
66
- keys.push(await computeSurrogateKey(`${contentBusId}${info.path}`));
67
- keys.push(contentBusId);
66
+ // provide either (prefixed) preview or (unprefixed) live content keys
68
67
  const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
69
- if (partition === 'preview') {
70
- // temporarily provide additional preview content keys
71
- // TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
72
- keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${contentBusId}${info.path}`)}`);
73
- keys.push(`${contentKeyPrefix}${contentBusId}`);
74
- }
68
+ keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${contentBusId}${info.path}`)}`);
69
+ keys.push(`${contentKeyPrefix}${contentBusId}`);
75
70
  } else {
76
71
  keys.push(`${ref}--${repo}--${owner}_code`);
77
72
  keys.push(await computeSurrogateKey(`${ref}--${repo}--${owner}${info.path}`));
@@ -109,15 +104,10 @@ async function computeSurrogateKeys(state) {
109
104
  keys.push(`${state.ref}--${state.repo}--${state.owner}_code`);
110
105
  }
111
106
  if (state.content.sourceBus.includes('content')) {
112
- keys.push(await computeSurrogateKey(`${state.contentBusId}${state.info.path}`));
113
- keys.push(state.contentBusId);
107
+ // provide either (prefixed) preview or (unprefixed) live content keys
114
108
  const contentKeyPrefix = state.partition === 'preview' ? 'p_' : '';
115
- if (state.partition === 'preview') {
116
- // temporarily provide additional preview content keys
117
- // TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
118
- keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${state.contentBusId}${state.info.path}`)}`);
119
- keys.push(`${contentKeyPrefix}${state.contentBusId}`);
120
- }
109
+ keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${state.contentBusId}${state.info.path}`)}`);
110
+ keys.push(`${contentKeyPrefix}${state.contentBusId}`);
121
111
  }
122
112
 
123
113
  return keys;
@@ -40,31 +40,21 @@ export default async function fetch404(state, req, res) {
40
40
 
41
41
  // set 404 keys in any case
42
42
  const pathKey = await getPathKey(state);
43
+ // provide either (prefixed) preview or (unprefixed) live content keys
44
+ const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
43
45
  const keys = [
44
- pathKey,
45
- contentBusId,
46
+ `${contentKeyPrefix}${pathKey}`,
47
+ `${contentKeyPrefix}${contentBusId}`,
46
48
  `${ref}--${repo}--${owner}_404`,
47
49
  `${ref}--${repo}--${owner}_code`,
48
50
  ];
49
- const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
50
- if (partition === 'preview') {
51
- // temporarily provide additional preview content keys
52
- // TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
53
- keys.push(`${contentKeyPrefix}${pathKey}`);
54
- keys.push(`${contentKeyPrefix}${contentBusId}`);
55
- }
56
51
 
57
52
  if (state.info.unmappedPath) {
58
53
  const unmappedPathKey = await getPathKey({
59
54
  contentBusId,
60
55
  info: { path: state.info.unmappedPath },
61
56
  });
62
- keys.push(unmappedPathKey);
63
- if (partition === 'preview') {
64
- // temporarily provide additional preview content key
65
- // TODO: eventually provide either (prefixed) preview or (unprefixed) live content key
66
- keys.push(`${contentKeyPrefix}${unmappedPathKey}`);
67
- }
57
+ keys.push(`${contentKeyPrefix}${unmappedPathKey}`);
68
58
  }
69
59
 
70
60
  res.headers.set('x-surrogate-key', keys.join(' '));
@@ -46,15 +46,10 @@ export default async function fetchContent(state, req, res) {
46
46
  keys.push(await computeSurrogateKey(`${ref}--${repo}--${owner}${info.path}`));
47
47
  keys.push(`${ref}--${repo}--${owner}_code`);
48
48
  } else {
49
- keys.push(await computeSurrogateKey(`${contentBusId}${info.path}`));
50
- keys.push(contentBusId);
49
+ // provide either (prefixed) preview or (unprefixed) live content keys
51
50
  const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
52
- if (partition === 'preview') {
53
- // temporarily provide additional preview content keys
54
- // TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
55
- keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${contentBusId}${info.path}`)}`);
56
- keys.push(`${contentKeyPrefix}${contentBusId}`);
57
- }
51
+ keys.push(`${contentKeyPrefix}${await computeSurrogateKey(`${contentBusId}${info.path}`)}`);
52
+ keys.push(`${contentKeyPrefix}${contentBusId}`);
58
53
  }
59
54
  res.headers.set('x-surrogate-key', keys.join(' '));
60
55
  res.error = 'moved';
@@ -47,6 +47,7 @@ export default async function setXSurrogateKeyHeader(state, req, res) {
47
47
 
48
48
  const isCode = state.content.sourceBus === 'code';
49
49
 
50
+ // provide either (prefixed) preview or (unprefixed) live content keys
50
51
  const contentKeyPrefix = partition === 'preview' ? 'p_' : '';
51
52
  const keys = [];
52
53
  const hash = await getPathKey(state);
@@ -54,37 +55,19 @@ export default async function setXSurrogateKeyHeader(state, req, res) {
54
55
  keys.push(await computeSurrogateKey(`${ref}--${repo}--${owner}${state.info.path}`));
55
56
  keys.push(`${ref}--${repo}--${owner}_code`);
56
57
  } else {
57
- keys.push(hash);
58
- keys.push(`${contentBusId}_metadata`);
58
+ keys.push(`${contentKeyPrefix}${hash}`);
59
+ keys.push(`${contentKeyPrefix}${contentBusId}_metadata`);
59
60
  keys.push(`${ref}--${repo}--${owner}_head`);
60
- keys.push(contentBusId);
61
- if (partition === 'preview') {
62
- // temporarily provide additional preview content keys
63
- // TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
64
- keys.push(`${contentKeyPrefix}${hash}`);
65
- keys.push(`${contentKeyPrefix}${contentBusId}_metadata`);
66
- keys.push(`${contentKeyPrefix}${contentBusId}`);
67
- }
61
+ keys.push(`${contentKeyPrefix}${contentBusId}`);
68
62
  }
69
63
  // for folder-mapped resources, we also need to include the surrogate key of the mapped metadata
70
64
  if (state.mapped) {
71
- keys.push(`${hash}_metadata`);
65
+ keys.push(`${contentKeyPrefix}${hash}_metadata`);
72
66
  if (state.info.unmappedPath) {
73
- keys.push(await getPathKey({
67
+ keys.push(`${contentKeyPrefix}${await getPathKey({
74
68
  contentBusId,
75
69
  info: { path: state.info.unmappedPath },
76
- }));
77
- }
78
- if (partition === 'preview') {
79
- // temporarily provide additional preview content keys
80
- // TODO: eventually provide either (prefixed) preview or (unprefixed) live content keys
81
- keys.push(`${contentKeyPrefix}${hash}_metadata`);
82
- if (state.info.unmappedPath) {
83
- keys.push(`${contentKeyPrefix}${await getPathKey({
84
- contentBusId,
85
- info: { path: state.info.unmappedPath },
86
- })}`);
87
- }
70
+ })}`);
88
71
  }
89
72
  }
90
73
  res.headers.set('x-surrogate-key', keys.join(' '));