@adobe/helix-html-pipeline 1.5.1 → 1.5.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.5.2](https://github.com/adobe/helix-html-pipeline/compare/v1.5.1...v1.5.2) (2022-05-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * respect x-source-last-modified for json ([#51](https://github.com/adobe/helix-html-pipeline/issues/51)) ([094f22b](https://github.com/adobe/helix-html-pipeline/commit/094f22b4bc86306a3727472bdb1f03c65fe67012))
7
+
1
8
  ## [1.5.1](https://github.com/adobe/helix-html-pipeline/compare/v1.5.0...v1.5.1) (2022-05-06)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -59,7 +59,7 @@
59
59
  "remark-parse": "10.0.1",
60
60
  "strip-markdown": "5.0.0",
61
61
  "unified": "10.1.2",
62
- "unist-util-map": "3.0.1",
62
+ "unist-util-map": "3.1.1",
63
63
  "unist-util-remove": "3.1.0",
64
64
  "unist-util-remove-position": "4.0.1",
65
65
  "unist-util-select": "4.0.1",
@@ -67,6 +67,7 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@adobe/eslint-config-helix": "1.3.2",
70
+ "@adobe/semantic-release-coralogix": "1.1.1",
70
71
  "@markedjs/html-differ": "4.0.2",
71
72
  "@semantic-release/changelog": "6.0.1",
72
73
  "@semantic-release/git": "10.0.1",
@@ -76,7 +77,7 @@
76
77
  "codecov": "3.8.3",
77
78
  "commitizen": "4.2.4",
78
79
  "cz-conventional-changelog": "3.3.0",
79
- "eslint": "8.14.0",
80
+ "eslint": "8.15.0",
80
81
  "eslint-plugin-header": "3.1.1",
81
82
  "eslint-plugin-import": "2.26.0",
82
83
  "esmock": "1.7.5",
package/src/json-pipe.js CHANGED
@@ -13,7 +13,7 @@ import fetchMetadata from './steps/fetch-metadata.js';
13
13
  import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
14
14
  import { PipelineResponse } from './PipelineResponse.js';
15
15
  import jsonFilter from './utils/json-filter.js';
16
- import { updateLastModified } from './utils/last-modified.js';
16
+ import { extractLastModified, updateLastModified } from './utils/last-modified.js';
17
17
 
18
18
  /**
19
19
  * Runs the default pipeline and returns the response.
@@ -73,7 +73,7 @@ export async function jsonPipe(state, req) {
73
73
  });
74
74
 
75
75
  // set last-modified
76
- updateLastModified(state, response, dataResponse.headers.get('last-modified'));
76
+ updateLastModified(state, response, extractLastModified(dataResponse.headers));
77
77
 
78
78
  // set surrogate key
79
79
  response.headers.set('x-surrogate-key', `${contentBusId}${path}`.replace(/\//g, '_'));
@@ -39,8 +39,8 @@ export default async function fetchMetadata(state, req, res) {
39
39
  }
40
40
  state.metadata = data;
41
41
 
42
- if (state.type === 'html') {
43
- // also update last-modified (only for html pipeline)
42
+ if (state.type === 'html' && state.info.selector !== 'plain') {
43
+ // also update last-modified (only for extensionless html pipeline)
44
44
  updateLastModified(state, res, extractLastModified(ret.headers));
45
45
  }
46
46
  return;
@@ -41,7 +41,8 @@ export function updateLastModified(state, res, httpDate) {
41
41
  /**
42
42
  * Returns the last modified date from response headers, giving 'x-amz-meta-x-source-last-modified'
43
43
  * preference.
44
- * @param {object} headers
44
+ * @param {Map<string, string>} headers
45
+ * @return {string} the last modified date
45
46
  */
46
47
  export function extractLastModified(headers) {
47
48
  return headers.get('x-amz-meta-x-source-last-modified') ?? headers.get('last-modified');