@adobe/helix-html-pipeline 1.3.3 → 1.4.1

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,24 @@
1
+ ## [1.4.1](https://github.com/adobe/helix-html-pipeline/compare/v1.4.0...v1.4.1) (2022-04-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency @adobe/helix-shared-utils to v2.0.8 ([9c7e30d](https://github.com/adobe/helix-html-pipeline/commit/9c7e30daccfab99e0dc5861f7105c0eee6c88ca5))
7
+
8
+ # [1.4.0](https://github.com/adobe/helix-html-pipeline/compare/v1.3.4...v1.4.0) (2022-04-12)
9
+
10
+
11
+ ### Features
12
+
13
+ * 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)
14
+
15
+ ## [1.3.4](https://github.com/adobe/helix-html-pipeline/compare/v1.3.3...v1.3.4) (2022-04-11)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **deps:** update dependency @adobe/helix-shared-utils to v2.0.7 ([e8a293c](https://github.com/adobe/helix-html-pipeline/commit/e8a293c54ac8617d5457692e780bc60c9358c0ee))
21
+
1
22
  ## [1.3.3](https://github.com/adobe/helix-html-pipeline/compare/v1.3.2...v1.3.3) (2022-04-06)
2
23
 
3
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "1.3.3",
3
+ "version": "1.4.1",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@adobe/helix-markdown-support": "3.1.2",
36
- "@adobe/helix-shared-utils": "2.0.6",
36
+ "@adobe/helix-shared-utils": "2.0.8",
37
37
  "github-slugger": "1.4.0",
38
38
  "hast-util-raw": "7.2.1",
39
39
  "hast-util-select": "5.0.1",
@@ -76,16 +76,16 @@
76
76
  "codecov": "3.8.3",
77
77
  "commitizen": "4.2.4",
78
78
  "cz-conventional-changelog": "3.3.0",
79
- "eslint": "8.12.0",
79
+ "eslint": "8.13.0",
80
80
  "eslint-plugin-header": "3.1.1",
81
- "eslint-plugin-import": "2.25.4",
81
+ "eslint-plugin-import": "2.26.0",
82
82
  "esmock": "1.7.5",
83
83
  "husky": "7.0.4",
84
84
  "js-yaml": "4.1.0",
85
85
  "jsdoc-to-markdown": "7.1.1",
86
86
  "jsdom": "19.0.0",
87
87
  "junit-report-builder": "3.0.0",
88
- "lint-staged": "12.3.7",
88
+ "lint-staged": "12.3.8",
89
89
  "mocha": "9.2.2",
90
90
  "mocha-multi-reporters": "1.5.1",
91
91
  "remark-gfm": "3.0.1",
@@ -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
- state.helixConfig = JSON.parse(ret.body);
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
- updateLastModified(state, res, extractLastModified(ret.headers));
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
  }
@@ -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 })