@adobe/helix-html-pipeline 6.5.0 → 6.6.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,10 @@
1
+ # [6.6.0](https://github.com/adobe/helix-html-pipeline/compare/v6.5.0...v6.6.0) (2024-02-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * speed up pageblock generation ([#542](https://github.com/adobe/helix-html-pipeline/issues/542)) ([34aca92](https://github.com/adobe/helix-html-pipeline/commit/34aca92e2a5161ab720ca1da2687de46f0b0dbf0))
7
+
1
8
  # [6.5.0](https://github.com/adobe/helix-html-pipeline/compare/v6.4.1...v6.5.0) (2024-02-09)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "hast-util-to-html": "9.0.0",
55
55
  "hast-util-to-string": "3.0.0",
56
56
  "hastscript": "9.0.0",
57
- "jose": "5.2.1",
57
+ "jose": "5.2.2",
58
58
  "lodash.escape": "4.0.1",
59
59
  "mdast-util-to-hast": "13.1.0",
60
60
  "mdast-util-to-string": "4.0.0",
@@ -83,14 +83,14 @@
83
83
  "eslint-plugin-header": "3.1.1",
84
84
  "eslint-plugin-import": "2.29.1",
85
85
  "esmock": "2.6.3",
86
- "husky": "9.0.10",
86
+ "husky": "9.0.11",
87
87
  "js-yaml": "4.1.0",
88
88
  "jsdom": "24.0.0",
89
89
  "junit-report-builder": "3.2.1",
90
- "lint-staged": "15.2.1",
91
- "mocha": "10.2.0",
90
+ "lint-staged": "15.2.2",
91
+ "mocha": "10.3.0",
92
92
  "mocha-multi-reporters": "1.5.1",
93
- "mocha-suppress-logs": "0.4.1",
93
+ "mocha-suppress-logs": "0.5.1",
94
94
  "semantic-release": "22.0.12"
95
95
  },
96
96
  "lint-staged": {
@@ -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');