@adobe/helix-html-pipeline 3.11.5 → 3.11.7

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
+ ## [3.11.7](https://github.com/adobe/helix-html-pipeline/compare/v3.11.6...v3.11.7) (2023-05-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * folder mapping should only be applied if direct addressed resource is missing ([#307](https://github.com/adobe/helix-html-pipeline/issues/307)) ([cf9cfc0](https://github.com/adobe/helix-html-pipeline/commit/cf9cfc0f00aed7a8fd7a502d0b2c77e9aa6e710d))
7
+
8
+ ## [3.11.6](https://github.com/adobe/helix-html-pipeline/compare/v3.11.5...v3.11.6) (2023-05-13)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency @adobe/helix-markdown-support to v6.1.2 ([75bbcdb](https://github.com/adobe/helix-html-pipeline/commit/75bbcdb3db030df16b0b6c0d8695fdc1f5513e3d))
14
+
1
15
  ## [3.11.5](https://github.com/adobe/helix-html-pipeline/compare/v3.11.4...v3.11.5) (2023-05-04)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "3.11.5",
3
+ "version": "3.11.7",
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.1.1",
42
+ "@adobe/helix-markdown-support": "6.1.2",
43
43
  "@adobe/helix-shared-utils": "3.0.0",
44
44
  "@adobe/mdast-util-gridtables": "1.0.6",
45
45
  "@adobe/remark-gridtables": "1.0.2",
@@ -50,7 +50,7 @@
50
50
  "hast-util-to-html": "8.0.4",
51
51
  "hast-util-to-string": "2.0.0",
52
52
  "hastscript": "7.2.0",
53
- "jose": "4.14.3",
53
+ "jose": "4.14.4",
54
54
  "mdast-util-gfm-footnote": "1.0.2",
55
55
  "mdast-util-gfm-strikethrough": "1.0.3",
56
56
  "mdast-util-gfm-table": "1.0.7",
@@ -59,15 +59,15 @@
59
59
  "mdast-util-to-string": "3.2.0",
60
60
  "micromark-extension-gfm-footnote": "1.1.0",
61
61
  "micromark-extension-gfm-strikethrough": "1.0.5",
62
- "micromark-extension-gfm-table": "1.0.5",
62
+ "micromark-extension-gfm-table": "1.0.6",
63
63
  "micromark-extension-gfm-tagfilter": "1.0.2",
64
64
  "micromark-extension-gfm-task-list-item": "1.0.4",
65
65
  "micromark-util-combine-extensions": "1.0.0",
66
66
  "mime": "3.0.0",
67
67
  "rehype-format": "4.0.1",
68
68
  "rehype-parse": "8.0.4",
69
- "remark-parse": "10.0.1",
70
- "strip-markdown": "5.0.0",
69
+ "remark-parse": "10.0.2",
70
+ "strip-markdown": "5.0.1",
71
71
  "unified": "10.1.2",
72
72
  "unist-util-map": "3.1.3",
73
73
  "unist-util-remove": "3.1.1",
@@ -83,14 +83,14 @@
83
83
  "@semantic-release/git": "10.0.1",
84
84
  "@semantic-release/npm": "10.0.3",
85
85
  "c8": "7.13.0",
86
- "eslint": "8.39.0",
86
+ "eslint": "8.41.0",
87
87
  "eslint-import-resolver-exports": "1.0.0-beta.5",
88
88
  "eslint-plugin-header": "3.1.1",
89
89
  "eslint-plugin-import": "2.27.5",
90
- "esmock": "2.2.1",
90
+ "esmock": "2.2.3",
91
91
  "husky": "8.0.3",
92
92
  "js-yaml": "4.1.0",
93
- "jsdom": "21.1.1",
93
+ "jsdom": "22.0.0",
94
94
  "junit-report-builder": "3.0.1",
95
95
  "lint-staged": "13.2.2",
96
96
  "mocha": "10.2.0",
package/src/html-pipe.js CHANGED
@@ -82,13 +82,21 @@ export async function htmlPipe(state, req) {
82
82
  }
83
83
 
84
84
  // ...and apply the folder mapping
85
- await folderMapping(state);
85
+ state.timer?.update('content-fetch');
86
+ let contentPromise = await fetchContent(state, req, res);
87
+ // ...but only if the current resource doesn't exist
88
+ if (res.status === 404) {
89
+ await folderMapping(state);
90
+ if (state.info.unmappedPath) {
91
+ contentPromise = fetchContent(state, req, res);
92
+ }
93
+ }
86
94
 
87
95
  // load metadata and content in parallel
88
- state.timer?.update('content-fetch');
96
+ state.timer?.update('metadata-fetch');
89
97
  await Promise.all([
90
98
  fetchConfigAll(state, req, res),
91
- fetchContent(state, req, res),
99
+ contentPromise,
92
100
  fetchMappedMetadata(state),
93
101
  ]);
94
102
 
package/src/json-pipe.js CHANGED
@@ -54,6 +54,8 @@ async function fetchJsonContent(state, req, res) {
54
54
  ret = await s3Loader.getObject('helix-code-bus', `${owner}/${repo}/${ref}${path}`);
55
55
  }
56
56
  if (ret.status === 200) {
57
+ res.status = 200;
58
+ delete res.error;
57
59
  state.content.data = ret.body;
58
60
 
59
61
  // store extra source location if present
@@ -117,7 +119,6 @@ export async function jsonPipe(state, req) {
117
119
  },
118
120
  });
119
121
  }
120
- await folderMapping(state);
121
122
 
122
123
  /** @type PipelineResponse */
123
124
  const res = new PipelineResponse('', {
@@ -126,10 +127,20 @@ export async function jsonPipe(state, req) {
126
127
  },
127
128
  });
128
129
 
130
+ // apply the folder mapping if the current resource doesn't exist
129
131
  state.timer?.update('json-fetch');
132
+ let contentPromise = await fetchJsonContent(state, req, res);
133
+ if (res.status === 404) {
134
+ await folderMapping(state);
135
+ if (state.info.unmappedPath) {
136
+ contentPromise = fetchJsonContent(state, req, res);
137
+ }
138
+ }
139
+
140
+ state.timer?.update('json-metadata-fetch');
130
141
  await Promise.all([
131
142
  fetchConfigAll(state, req, res),
132
- fetchJsonContent(state, req, res),
143
+ contentPromise,
133
144
  ]);
134
145
 
135
146
  await authenticate(state, req, res);
@@ -48,6 +48,8 @@ export default async function fetchContent(state, req, res) {
48
48
  }
49
49
 
50
50
  if (ret.status === 200) {
51
+ res.status = 200;
52
+ delete res.error;
51
53
  state.content.data = ret.body;
52
54
 
53
55
  // store extra source location if present