@adobe/helix-html-pipeline 4.1.0 → 4.1.2
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 +14 -0
- package/package.json +6 -6
- package/src/steps/fetch-config-all.js +6 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [4.1.2](https://github.com/adobe/helix-html-pipeline/compare/v4.1.1...v4.1.2) (2023-08-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove legacy loading of metadata.json ([#373](https://github.com/adobe/helix-html-pipeline/issues/373)) ([90b665f](https://github.com/adobe/helix-html-pipeline/commit/90b665f18128a7924b32ea3526ccb24342a09a41))
|
|
7
|
+
|
|
8
|
+
## [4.1.1](https://github.com/adobe/helix-html-pipeline/compare/v4.1.0...v4.1.1) (2023-07-27)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-markdown-support to v6.3.0 ([6c40c95](https://github.com/adobe/helix-html-pipeline/commit/6c40c95c067eb40d51dfe14abdacbc3283f4f789))
|
|
14
|
+
|
|
1
15
|
# [4.1.0](https://github.com/adobe/helix-html-pipeline/compare/v4.0.3...v4.1.0) (2023-07-25)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=16.x"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@adobe/helix-markdown-support": "6.
|
|
42
|
+
"@adobe/helix-markdown-support": "6.3.0",
|
|
43
43
|
"@adobe/helix-shared-utils": "3.0.0",
|
|
44
44
|
"@adobe/mdast-util-gridtables": "2.0.2",
|
|
45
45
|
"@adobe/remark-gridtables": "1.0.4",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
"@semantic-release/changelog": "6.0.3",
|
|
73
73
|
"@semantic-release/git": "10.0.1",
|
|
74
74
|
"@semantic-release/npm": "10.0.4",
|
|
75
|
-
"c8": "8.0.
|
|
76
|
-
"eslint": "8.
|
|
75
|
+
"c8": "8.0.1",
|
|
76
|
+
"eslint": "8.46.0",
|
|
77
77
|
"eslint-import-resolver-exports": "1.0.0-beta.5",
|
|
78
78
|
"eslint-plugin-header": "3.1.1",
|
|
79
|
-
"eslint-plugin-import": "2.
|
|
80
|
-
"esmock": "2.3.
|
|
79
|
+
"eslint-plugin-import": "2.28.0",
|
|
80
|
+
"esmock": "2.3.5",
|
|
81
81
|
"husky": "8.0.3",
|
|
82
82
|
"js-yaml": "4.1.0",
|
|
83
83
|
"jsdom": "22.1.0",
|
|
@@ -12,60 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
import { PipelineStatusError } from '../PipelineStatusError.js';
|
|
14
14
|
import { extractLastModified, updateLastModified } from '../utils/last-modified.js';
|
|
15
|
-
import {
|
|
15
|
+
import { globToRegExp, Modifiers } from '../utils/modifiers.js';
|
|
16
16
|
import { getOriginalHost } from './utils.js';
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Loads the metadata.json from the content-bus and stores it in `state.metadata` and
|
|
20
|
-
* `state.headers` in modifier form.
|
|
21
|
-
* this is to be backward compatible and can be removed in the future.
|
|
22
|
-
*
|
|
23
|
-
* @type PipelineStep
|
|
24
|
-
* @param {PipelineState} state
|
|
25
|
-
* @param {PipelineRequest} req
|
|
26
|
-
* @param {PipelineResponse} res
|
|
27
|
-
* @returns {Promise<void>}
|
|
28
|
-
*/
|
|
29
|
-
async function fetchMetadata(state, req, res) {
|
|
30
|
-
const { contentBusId, partition } = state;
|
|
31
|
-
const key = `${contentBusId}/${partition}/metadata.json`;
|
|
32
|
-
const ret = await state.s3Loader.getObject('helix-content-bus', key);
|
|
33
|
-
if (ret.status === 200) {
|
|
34
|
-
let json;
|
|
35
|
-
try {
|
|
36
|
-
json = JSON.parse(ret.body);
|
|
37
|
-
} catch (e) {
|
|
38
|
-
throw new PipelineStatusError(500, `failed parsing of /metadata.json: ${e.message}`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const { data } = json.default ?? json;
|
|
42
|
-
if (!Array.isArray(data)) {
|
|
43
|
-
throw new PipelineStatusError(500, 'failed loading of /metadata.json: data must be an array');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
state.metadata = Modifiers.fromModifierSheet(
|
|
47
|
-
data,
|
|
48
|
-
(name) => !ALLOWED_RESPONSE_HEADERS.includes(name),
|
|
49
|
-
);
|
|
50
|
-
state.headers = Modifiers.fromModifierSheet(
|
|
51
|
-
data,
|
|
52
|
-
(name) => ALLOWED_RESPONSE_HEADERS.includes(name),
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
if (state.type === 'html' && state.info.selector !== 'plain') {
|
|
56
|
-
// also update last-modified (only for extensionless html pipeline)
|
|
57
|
-
updateLastModified(state, res, extractLastModified(ret.headers));
|
|
58
|
-
}
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (ret.status !== 404) {
|
|
63
|
-
throw new PipelineStatusError(502, `failed to load /metadata.json: ${ret.status}`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ignore 404
|
|
67
|
-
}
|
|
68
|
-
|
|
69
18
|
/**
|
|
70
19
|
* Computes the routes from the given config value.
|
|
71
20
|
* @param {string|string[]|undefined} value
|
|
@@ -129,11 +78,12 @@ export default async function fetchConfigAll(state, req, res) {
|
|
|
129
78
|
// set custom preview and live hosts
|
|
130
79
|
state.previewHost = replaceParams(state.config.cdn?.preview?.host, state);
|
|
131
80
|
state.liveHost = replaceParams(state.config.cdn?.live?.host, state);
|
|
132
|
-
} else if (ret.status
|
|
133
|
-
|
|
81
|
+
} else if (ret.status === 404) {
|
|
82
|
+
state.config = {};
|
|
83
|
+
state.metadata = new Modifiers({});
|
|
84
|
+
state.headers = new Modifiers({});
|
|
134
85
|
} else {
|
|
135
|
-
|
|
136
|
-
await fetchMetadata(state, req, res);
|
|
86
|
+
throw new PipelineStatusError(502, `failed to load /.helix/config-all.json: ${ret.status}`);
|
|
137
87
|
}
|
|
138
88
|
|
|
139
89
|
// compute host and routes
|