@adobe/helix-html-pipeline 6.14.4 → 6.14.6

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.14.6](https://github.com/adobe/helix-html-pipeline/compare/v6.14.5...v6.14.6) (2024-09-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * set code and content surrogate keys for json 404 ([#692](https://github.com/adobe/helix-html-pipeline/issues/692)) ([6a947a3](https://github.com/adobe/helix-html-pipeline/commit/6a947a3484aba60bb511f04bd611c949036889d9)), closes [#688](https://github.com/adobe/helix-html-pipeline/issues/688)
7
+
8
+ ## [6.14.5](https://github.com/adobe/helix-html-pipeline/compare/v6.14.4...v6.14.5) (2024-09-17)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * only rewrite url for proper helix hosts ([#691](https://github.com/adobe/helix-html-pipeline/issues/691)) ([6e6bc37](https://github.com/adobe/helix-html-pipeline/commit/6e6bc375aea9fbb11b38a13da796543dede492ef))
14
+
1
15
  ## [6.14.4](https://github.com/adobe/helix-html-pipeline/compare/v6.14.3...v6.14.4) (2024-09-04)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.14.4",
3
+ "version": "6.14.6",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -70,8 +70,8 @@
70
70
  "unist-util-visit-parents": "6.0.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@adobe/eslint-config-helix": "2.0.6",
74
- "@markedjs/html-differ": "4.0.2",
73
+ "@adobe/eslint-config-helix": "2.0.7",
74
+ "@markedjs/html-differ": "5.0.1",
75
75
  "@semantic-release/changelog": "6.0.3",
76
76
  "@semantic-release/git": "10.0.1",
77
77
  "@semantic-release/npm": "12.0.1",
@@ -79,17 +79,17 @@
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",
82
- "eslint-plugin-import": "2.29.1",
82
+ "eslint-plugin-import": "2.30.0",
83
83
  "esmock": "2.6.7",
84
- "husky": "9.1.5",
84
+ "husky": "9.1.6",
85
85
  "js-yaml": "4.1.0",
86
86
  "jsdom": "25.0.0",
87
87
  "junit-report-builder": "5.0.0",
88
- "lint-staged": "15.2.9",
88
+ "lint-staged": "15.2.10",
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.0"
92
+ "semantic-release": "24.1.1"
93
93
  },
94
94
  "lint-staged": {
95
95
  "*.js": "eslint",
package/src/json-pipe.js CHANGED
@@ -85,7 +85,8 @@ async function fetchJsonContent(state, req, res) {
85
85
 
86
86
  updateLastModified(state, res, extractLastModified(ret.headers));
87
87
  } else {
88
- state.content.sourceBus = 'content';
88
+ // also add code surrogate key in case json is later added to code bus (#688)
89
+ state.content.sourceBus = 'code|content';
89
90
  res.status = ret.status === 404 ? 404 : 502;
90
91
  res.error = `failed to load ${state.info.resourcePath}: ${ret.status}`;
91
92
  }
@@ -93,19 +94,18 @@ async function fetchJsonContent(state, req, res) {
93
94
 
94
95
  async function computeSurrogateKeys(state) {
95
96
  const keys = [];
96
- const pathKey = state.content?.sourceBus === 'code'
97
- ? `${state.ref}--${state.repo}--${state.owner}${state.info.path}`
98
- : `${state.contentBusId}${state.info.path}`;
99
-
100
97
  if (state.info.path === '/config.json') {
101
98
  keys.push(await computeSurrogateKey(`${state.site}--${state.org}_config.json`));
102
99
  }
103
- keys.push(await computeSurrogateKey(pathKey));
104
- if (state.content?.sourceBus === 'content') {
105
- keys.push(state.contentBusId);
106
- } else {
100
+ if (state.content.sourceBus.includes('code')) {
101
+ keys.push(await computeSurrogateKey(`${state.ref}--${state.repo}--${state.owner}${state.info.path}`));
107
102
  keys.push(`${state.ref}--${state.repo}--${state.owner}_code`);
108
103
  }
104
+ if (state.content.sourceBus.includes('content')) {
105
+ keys.push(await computeSurrogateKey(`${state.contentBusId}${state.info.path}`));
106
+ keys.push(state.contentBusId);
107
+ }
108
+
109
109
  return keys;
110
110
  }
111
111
 
@@ -14,7 +14,7 @@ const AZURE_BLOB_REGEXP = /^https:\/\/hlx\.blob\.core\.windows\.net\/external\//
14
14
 
15
15
  const MEDIA_BLOB_REGEXP = /^https:\/\/.*\.(aem|hlx3?)\.(live|page)\/media_.*/;
16
16
 
17
- const HELIX_URL_REGEXP = /^https:\/\/(?!admin\.|www\.)[^.]+\.(aem|hlx3?)\.(live|page)\/?.*/;
17
+ const HELIX_URL_REGEXP = /^https:\/\/.*\.(aem|hlx3?)\.(live|page)\/?.*/;
18
18
 
19
19
  /**
20
20
  * Returns the original host name from the request to the outer CDN.
@@ -208,7 +208,7 @@ export function rewriteUrl(state, url) {
208
208
  return `.${pathname}${hash}`;
209
209
  }
210
210
 
211
- if (HELIX_URL_REGEXP.test(url)
211
+ if ((host.includes('--') && HELIX_URL_REGEXP.test(url))
212
212
  || host === state.previewHost
213
213
  || host === state.liveHost) {
214
214
  if (hash && pathname === state.info?.path) {