@adobe/helix-importer 1.2.0 → 1.2.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,10 @@
1
+ ## [1.2.1](https://github.com/adobe/helix-importer/compare/v1.2.0...v1.2.1) (2022-01-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * export MemoryHandler ([#12](https://github.com/adobe/helix-importer/issues/12)) ([3a83a16](https://github.com/adobe/helix-importer/commit/3a83a1620b0eb4752698ee9b994e8b0fd7ce085f))
7
+
1
8
  # [1.2.0](https://github.com/adobe/helix-importer/compare/v1.1.0...v1.2.0) (2022-01-20)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-importer",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Helix Importer tool: create md / docx from html",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -10,37 +10,53 @@
10
10
  },
11
11
  "scripts": {
12
12
  "lint": "eslint .",
13
- "test": "mocha test/**/*.spec.js",
14
- "semantic-release": "semantic-release"
13
+ "test": "c8 mocha",
14
+ "test-ci": "c8 mocha && codecov",
15
+ "semantic-release": "semantic-release",
16
+ "prepare": "npx husky install"
17
+ },
18
+ "mocha": {
19
+ "recursive": "true",
20
+ "spec": "test/**/*.spec.js",
21
+ "reporter": "mocha-multi-reporters",
22
+ "reporter-options": "configFile=.mocha-multi.json"
23
+ },
24
+ "lint-staged": {
25
+ "*.js": "eslint"
15
26
  },
16
27
  "devDependencies": {
17
28
  "@adobe/eslint-config-helix": "1.3.2",
18
- "@adobe/helix-docx2md": "1.0.5",
19
- "@adobe/helix-mediahandler": "1.0.1",
29
+ "@adobe/helix-docx2md": "1.0.6",
30
+ "@adobe/helix-mediahandler": "1.0.2",
20
31
  "@semantic-release/changelog": "6.0.1",
21
32
  "@semantic-release/exec": "6.0.3",
22
33
  "@semantic-release/git": "10.0.1",
23
- "eslint": "8.6.0",
34
+ "eslint": "8.7.0",
24
35
  "eslint-plugin-header": "3.1.1",
25
36
  "eslint-plugin-import": "2.25.4",
26
- "mocha": "9.1.4",
27
- "mock-fs": "4.13.0",
37
+ "mocha": "9.2.0",
38
+ "mock-fs": "5.1.2",
39
+ "c8": "7.11.0",
40
+ "codecov": "3.8.3",
41
+ "husky": "7.0.4",
42
+ "lint-staged": "12.3.1",
43
+ "mocha-multi-reporters": "1.5.1",
28
44
  "semantic-release": "19.0.2"
29
45
  },
30
46
  "author": "",
31
47
  "license": "Apache-2.0",
32
48
  "dependencies": {
33
- "@adobe/helix-md2docx": "1.2.0",
49
+ "@adobe/helix-md2docx": "1.2.2",
34
50
  "form-data": "4.0.0",
35
51
  "fs-extra": "10.0.0",
36
52
  "hast-util-to-html": "8.0.3",
37
53
  "hast-util-to-mdast": "8.3.0",
38
54
  "jsdom": "19.0.0",
39
- "node-fetch": "3.1.1",
40
- "rehype-parse": "7.0.1",
41
- "rehype-remark": "8.0.0",
42
- "remark-stringify": "8.1.1",
55
+ "node-fetch": "3.2.0",
56
+ "rehype-parse": "8.0.3",
57
+ "rehype-remark": "9.1.2",
58
+ "remark-stringify": "10.0.2",
43
59
  "sanitize-filename": "1.6.3",
44
- "unified": "9.2.0"
60
+ "unified": "10.1.1"
45
61
  }
46
62
  }
@@ -15,7 +15,7 @@
15
15
  import { JSDOM } from 'jsdom';
16
16
 
17
17
  import path from 'path';
18
- import unified from 'unified';
18
+ import { unified } from 'unified';
19
19
  import parse from 'rehype-parse';
20
20
  import { toHtml } from 'hast-util-to-html';
21
21
  import rehype2remark from 'rehype-remark';
@@ -50,7 +50,7 @@ export default class PageImporter {
50
50
  const { name } = resource;
51
51
  const { directory } = resource;
52
52
  const sanitizedName = FileUtils.sanitizeFilename(name);
53
- this.logger.log(`Computing Markdonw for ${directory}/${sanitizedName}`);
53
+ this.logger.log(`Computing Markdown for ${directory}/${sanitizedName}`);
54
54
 
55
55
  const processor = unified()
56
56
  .use(parse, { emitParseErrors: true })
@@ -73,36 +73,36 @@ export default class PageImporter {
73
73
  .use(() => {
74
74
  // use custom tag and rendering because text is always encoded by default
75
75
  // we need the raw url
76
- processor.Compiler.prototype.visitors.hlxembed = (node) => node.value;
76
+ // processor.Compiler.prototype.visitors.hlxembed = (node) => node.value;
77
77
  })
78
78
  .use(() => {
79
- processor.Compiler.prototype.visitors.table = (node) => node.value;
79
+ // processor.Compiler.prototype.visitors.table = (node) => node.value;
80
80
  })
81
81
  .use(() => {
82
- processor.Compiler.prototype.visitors.u = (node) => {
83
- // u handling: remove the u is the first element is a link
84
- if (node.children && node.children.length > 0) {
85
- const children = node.children.map((child) => processor.stringify(child));
86
- if (node.children[0].type === 'link') {
87
- // first element in the <u> is a link: remove the <u> - unsupported case
88
- return `${children.join()}`;
89
- }
90
- return `<u>${children.join()}</u>`;
91
- }
92
- return '';
93
- };
82
+ // processor.Compiler.prototype.visitors.u = (node) => {
83
+ // // u handling: remove the u is the first element is a link
84
+ // if (node.children && node.children.length > 0) {
85
+ // const children = node.children.map((child) => processor.stringify(child));
86
+ // if (node.children[0].type === 'link') {
87
+ // // first element in the <u> is a link: remove the <u> - unsupported case
88
+ // return `${children.join()}`;
89
+ // }
90
+ // return `<u>${children.join()}</u>`;
91
+ // }
92
+ // return '';
93
+ // };
94
94
  })
95
95
  .use(() => {
96
- const originalEmphasis = processor.Compiler.prototype.visitors.emphasis;
97
- processor.Compiler.prototype.visitors.emphasis = (node) => {
98
- // @ts-ignore
99
- const ori = originalEmphasis.apply(processor.Compiler(), [node]);
100
- return ori;
101
- };
96
+ // const originalEmphasis = processor.Compiler.prototype.visitors.emphasis;
97
+ // processor.Compiler.prototype.visitors.emphasis = (node) => {
98
+ // // @ts-ignore
99
+ // const ori = originalEmphasis.apply(processor.Compiler(), [node]);
100
+ // return ori;
101
+ // };
102
102
  });
103
103
 
104
104
  const file = await processor.process(resource.document.innerHTML);
105
- let contents = file.contents.toString();
105
+ let contents = String(file);
106
106
 
107
107
  // process image links
108
108
  const { document } = resource;
package/src/index.js CHANGED
@@ -17,6 +17,7 @@ import PageImporterParams from './importer/PageImporterParams.js';
17
17
  import PageImporterResource from './importer/PageImporterResource.js';
18
18
 
19
19
  import FSHandler from './storage/FSHandler.js';
20
+ import MemoryHandler from './storage/MemoryHandler.js';
20
21
 
21
22
  import Blocks from './utils/Blocks.js';
22
23
  import CSV from './utils/CSV.js';
@@ -36,6 +37,7 @@ export {
36
37
  PageImporterParams,
37
38
  PageImporterResource,
38
39
  FSHandler,
40
+ MemoryHandler,
39
41
  Blocks,
40
42
  CSV,
41
43
  DOMUtils,
package/renovate.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": ["github>adobe/helix-shared"]
3
- }