@adobe/helix-html-pipeline 5.7.1 → 5.8.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [5.8.0](https://github.com/adobe/helix-html-pipeline/compare/v5.7.2...v5.8.0) (2024-02-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * speed up pageblock generation ([#543](https://github.com/adobe/helix-html-pipeline/issues/543)) ([632da6f](https://github.com/adobe/helix-html-pipeline/commit/632da6f676d47778fd259f2187464369e87e5c57))
7
+
8
+ ## [5.7.2](https://github.com/adobe/helix-html-pipeline/compare/v5.7.1...v5.7.2) (2024-02-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * handle sitemap auth in hlx.page ([#533](https://github.com/adobe/helix-html-pipeline/issues/533)) ([bc95dae](https://github.com/adobe/helix-html-pipeline/commit/bc95daecbdc0a806b61cd00360e68100beb28ece))
14
+
1
15
  ## [5.7.1](https://github.com/adobe/helix-html-pipeline/compare/v5.7.0...v5.7.1) (2024-02-08)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "5.7.1",
3
+ "version": "5.8.0",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -53,7 +53,7 @@
53
53
  "hast-util-to-html": "9.0.0",
54
54
  "hast-util-to-string": "3.0.0",
55
55
  "hastscript": "9.0.0",
56
- "jose": "5.2.1",
56
+ "jose": "5.2.2",
57
57
  "lodash.escape": "4.0.1",
58
58
  "mdast-util-to-hast": "13.1.0",
59
59
  "mdast-util-to-string": "4.0.0",
@@ -82,14 +82,14 @@
82
82
  "eslint-plugin-header": "3.1.1",
83
83
  "eslint-plugin-import": "2.29.1",
84
84
  "esmock": "2.6.3",
85
- "husky": "9.0.10",
85
+ "husky": "9.0.11",
86
86
  "js-yaml": "4.1.0",
87
87
  "jsdom": "24.0.0",
88
88
  "junit-report-builder": "3.2.1",
89
- "lint-staged": "15.2.1",
90
- "mocha": "10.2.0",
89
+ "lint-staged": "15.2.2",
90
+ "mocha": "10.3.0",
91
91
  "mocha-multi-reporters": "1.5.1",
92
- "mocha-suppress-logs": "0.4.1",
92
+ "mocha-suppress-logs": "0.5.1",
93
93
  "semantic-release": "22.0.12"
94
94
  },
95
95
  "lint-staged": {
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import escape from 'lodash.escape';
13
13
  import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
14
- import { authenticate, requireProject } from './steps/authenticate.js';
14
+ import { requireProject } from './steps/authenticate.js';
15
15
  import fetchConfig from './steps/fetch-config.js';
16
16
  import fetchContent from './steps/fetch-content.js';
17
17
  import fetchConfigAll from './steps/fetch-config-all.js';
@@ -21,9 +21,9 @@ import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
21
21
  import { PipelineStatusError } from './PipelineStatusError.js';
22
22
  import { PipelineResponse } from './PipelineResponse.js';
23
23
 
24
- async function generateSitemap(state, partition) {
24
+ async function generateSitemap(state) {
25
25
  const {
26
- owner, repo, ref, contentBusId, s3Loader, log,
26
+ owner, repo, ref, contentBusId, s3Loader, log, partition,
27
27
  previewHost, liveHost, config: { host: prodCDN } = {},
28
28
  } = state;
29
29
  const ret = await s3Loader.getObject('helix-content-bus', `${contentBusId}/live/sitemap.json`);
@@ -74,12 +74,9 @@ async function generateSitemap(state, partition) {
74
74
  * @returns {PipelineResponse}
75
75
  */
76
76
  export async function sitemapPipe(state, req) {
77
- const { partition, log } = state;
77
+ const { log } = state;
78
78
  state.type = 'sitemap';
79
79
 
80
- // force loading from preview
81
- state.partition = 'preview';
82
-
83
80
  if (state.info?.path !== '/sitemap.xml') {
84
81
  // this should not happen as it would mean that the caller used the wrong route. so we respond
85
82
  // with a 500 to indicate that something is wrong.
@@ -98,8 +95,6 @@ export async function sitemapPipe(state, req) {
98
95
  },
99
96
  });
100
97
 
101
- // check if .auth request
102
-
103
98
  try { // fetch config first, since we need to compute the content-bus-id from the fstab ...
104
99
  state.timer?.update('config-fetch');
105
100
  await fetchConfig(state, req, res);
@@ -118,11 +113,9 @@ export async function sitemapPipe(state, req) {
118
113
  ]);
119
114
 
120
115
  await requireProject(state, req, res);
121
- if (res.error !== 401) {
122
- await authenticate(state, req, res);
123
- }
116
+ // authentication is handled in hlx.page vcl
124
117
  if (res.status === 404) {
125
- const ret = await generateSitemap(state, partition);
118
+ const ret = await generateSitemap(state);
126
119
  if (ret.status === 200) {
127
120
  res.status = 200;
128
121
  delete res.error;
@@ -10,10 +10,11 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  import { h } from 'hastscript';
13
- import { selectAll, select } from 'hast-util-select';
13
+ import { select } from 'hast-util-select';
14
14
  import { toString } from 'hast-util-to-string';
15
+ import { CONTINUE, SKIP, visit } from 'unist-util-visit';
15
16
  import { toBlockCSSClassNames } from './utils.js';
16
- import { replace, childNodes } from '../utils/hast-utils.js';
17
+ import { childNodes } from '../utils/hast-utils.js';
17
18
 
18
19
  /**
19
20
  * Creates a "DIV representation" of a table.
@@ -74,9 +75,11 @@ function tableToDivs($table) {
74
75
  */
75
76
  export default function createPageBlocks({ content }) {
76
77
  const { hast } = content;
77
- selectAll('div > table', hast).forEach(($table) => {
78
- const $div = tableToDivs($table);
79
- // replace child in parent
80
- replace(hast, $table, $div);
78
+ visit(hast, (node, idx, parent) => {
79
+ if (node.tagName === 'table' && parent.tagName === 'div') {
80
+ parent.children[idx] = tableToDivs(node);
81
+ return SKIP;
82
+ }
83
+ return CONTINUE;
81
84
  });
82
85
  }
@@ -9,16 +9,6 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- import { EXIT, visit } from 'unist-util-visit';
13
-
14
- export function replace(tree, oldNode, newNode) {
15
- // $table.parentNode.replaceChild($div, $table);
16
- // replace child in parent
17
- visit(tree, oldNode, (node, idx, parent) => {
18
- parent.children[idx] = newNode;
19
- return EXIT;
20
- });
21
- }
22
12
 
23
13
  export function childNodes(node) {
24
14
  return node.children.filter((n) => n.type === 'element');