@adobe/helix-html-pipeline 1.3.4 → 1.4.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 +7 -0
- package/package.json +1 -1
- package/src/steps/fetch-config.js +22 -2
- package/src/steps/folder-mapping.js +1 -1
- package/src/steps/render.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.4.0](https://github.com/adobe/helix-html-pipeline/compare/v1.3.4...v1.4.0) (2022-04-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* adjust for upcoming helix-config changes ([#37](https://github.com/adobe/helix-html-pipeline/issues/37)) ([e6d4f90](https://github.com/adobe/helix-html-pipeline/commit/e6d4f90d4bf8c9a0642e921395e5ac48aa3e53c7)), closes [#36](https://github.com/adobe/helix-html-pipeline/issues/36)
|
|
7
|
+
|
|
1
8
|
## [1.3.4](https://github.com/adobe/helix-html-pipeline/compare/v1.3.3...v1.3.4) (2022-04-11)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -30,13 +30,33 @@ export default async function fetchConfig(state, req, res) {
|
|
|
30
30
|
if (ret.status !== 200) {
|
|
31
31
|
throw new PipelineStatusError(ret.status === 404 ? 404 : 502, `unable to load /helix-config.json: ${ret.status}`);
|
|
32
32
|
}
|
|
33
|
+
let config;
|
|
33
34
|
try {
|
|
34
|
-
|
|
35
|
+
config = JSON.parse(ret.body);
|
|
35
36
|
} catch (e) {
|
|
36
37
|
log.info('failed to parse helix-config.json', e);
|
|
37
38
|
throw new PipelineStatusError(400, `Failed parsing of /helix-config.json: ${e.message}`);
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
// upgrade to version 2 if needed
|
|
42
|
+
if (config.version !== 2) {
|
|
43
|
+
Object.keys(config).forEach((name) => {
|
|
44
|
+
config[name] = {
|
|
45
|
+
data: config[name],
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
// also update last-modified
|
|
41
|
-
|
|
51
|
+
const configLastModified = extractLastModified(ret.headers);
|
|
52
|
+
|
|
53
|
+
// update last modified of fstab
|
|
54
|
+
updateLastModified(state, res, config.fstab?.lastModified || configLastModified);
|
|
55
|
+
|
|
56
|
+
// for html requests, also consider the HEAD config
|
|
57
|
+
if (state.type === 'html' && state.info.selector !== 'plain' && config.head?.lastModified) {
|
|
58
|
+
updateLastModified(state, res, config.head.lastModified);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
state.helixConfig = config;
|
|
42
62
|
}
|
|
@@ -40,7 +40,7 @@ export function mapPath(folders, path) {
|
|
|
40
40
|
* @param {PipelineState} state
|
|
41
41
|
*/
|
|
42
42
|
export default function folderMapping(state) {
|
|
43
|
-
const folders = state.helixConfig?.fstab?.folders;
|
|
43
|
+
const folders = state.helixConfig?.fstab?.data.folders;
|
|
44
44
|
if (!folders) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
package/src/steps/render.js
CHANGED
|
@@ -81,7 +81,7 @@ export default async function render(state, req, res) {
|
|
|
81
81
|
appendElement($head, createElement('link', 'rel', 'alternate', 'type', 'application/xml+atom', 'href', meta.feed, 'title', `${meta.title} feed`));
|
|
82
82
|
|
|
83
83
|
// inject head.html
|
|
84
|
-
const headHtml = state.helixConfig?.head?.html;
|
|
84
|
+
const headHtml = state.helixConfig?.head?.data.html;
|
|
85
85
|
if (headHtml) {
|
|
86
86
|
const $headHtml = await unified()
|
|
87
87
|
.use(rehypeParse, { fragment: true })
|