@adobe/helix-md2docx 2.1.11 → 2.1.13

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
+ ## [2.1.13](https://github.com/adobe/helix-md2docx/compare/v2.1.12...v2.1.13) (2023-07-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency @adobe/helix-docx2md to v1.4.8 ([dfaf076](https://github.com/adobe/helix-md2docx/commit/dfaf076ed41dbb653a755ad8375c06e35a883ea3))
7
+
8
+ ## [2.1.12](https://github.com/adobe/helix-md2docx/compare/v2.1.11...v2.1.12) (2023-07-06)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#285](https://github.com/adobe/helix-md2docx/issues/285)) ([fa8422e](https://github.com/adobe/helix-md2docx/commit/fa8422e07746f6745314e13a5a861b413297b577))
14
+
1
15
  ## [2.1.11](https://github.com/adobe/helix-md2docx/compare/v2.1.10...v2.1.11) (2023-06-28)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-md2docx",
3
- "version": "2.1.11",
3
+ "version": "2.1.13",
4
4
  "description": "Helix Service that converts markdown to word documents",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -28,11 +28,11 @@
28
28
  "homepage": "https://github.com/adobe/helix-md2docx#readme",
29
29
  "dependencies": {
30
30
  "@adobe/fetch": "4.0.13",
31
- "@adobe/helix-docx2md": "1.4.7",
31
+ "@adobe/helix-docx2md": "1.4.8",
32
32
  "@adobe/helix-markdown-support": "6.1.3",
33
33
  "@adobe/helix-shared-process-queue": "3.0.0",
34
34
  "@adobe/remark-gridtables": "1.0.4",
35
- "docx": "8.0.4",
35
+ "docx": "8.2.0",
36
36
  "hast-util-is-element": "2.1.3",
37
37
  "hast-util-to-mdast": "9.0.0",
38
38
  "image-size": "1.0.2",
@@ -45,23 +45,23 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@adobe/eslint-config-helix": "2.0.2",
48
- "@adobe/helix-mediahandler": "2.2.2",
48
+ "@adobe/helix-mediahandler": "2.2.4",
49
49
  "@semantic-release/changelog": "6.0.3",
50
50
  "@semantic-release/exec": "6.0.3",
51
51
  "@semantic-release/git": "10.0.1",
52
52
  "c8": "8.0.0",
53
53
  "dotenv": "16.3.1",
54
- "eslint": "8.43.0",
54
+ "eslint": "8.44.0",
55
55
  "eslint-import-resolver-exports": "1.0.0-beta.5",
56
56
  "eslint-plugin-header": "3.1.1",
57
57
  "eslint-plugin-import": "2.27.5",
58
58
  "husky": "8.0.3",
59
59
  "junit-report-builder": "3.0.1",
60
- "lint-staged": "13.2.2",
60
+ "lint-staged": "13.2.3",
61
61
  "mocha": "10.2.0",
62
62
  "mocha-multi-reporters": "1.5.1",
63
63
  "nock": "13.3.1",
64
- "semantic-release": "21.0.5",
64
+ "semantic-release": "21.0.7",
65
65
  "unist-util-inspect": "7.0.2",
66
66
  "yauzl": "2.10.0"
67
67
  },
@@ -9,9 +9,7 @@
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 docx from 'docx';
13
-
14
- const { AlignmentType, convertMillimetersToTwip, LevelFormat } = docx;
12
+ import { AlignmentType, convertMillimetersToTwip, LevelFormat } from 'docx';
15
13
 
16
14
  function createLevels() {
17
15
  const levels = [];
@@ -9,9 +9,7 @@
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 docx from 'docx';
13
-
14
- const { TextRun } = docx;
12
+ import { TextRun } from 'docx';
15
13
 
16
14
  export default function brk() {
17
15
  return new TextRun({
@@ -9,9 +9,7 @@
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 docx from 'docx';
13
-
14
- const { Paragraph, TextRun } = docx;
12
+ import { Paragraph, TextRun } from 'docx';
15
13
 
16
14
  export default function code(ctx, node) {
17
15
  const children = node.value.split('\n').map((text, idx) => (
@@ -9,11 +9,9 @@
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 docx from 'docx';
12
+ import { Paragraph, Table, WidthType } from 'docx';
13
13
  import all from '../all.js';
14
14
 
15
- const { Paragraph, Table, WidthType } = docx;
16
-
17
15
  function* rowIter(node) {
18
16
  for (const child of node.children) {
19
17
  if (child.type === 'gtRow') {
@@ -9,11 +9,9 @@
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 docx from 'docx';
12
+ import { TableRow } from 'docx';
13
13
  import all from '../all.js';
14
14
 
15
- const { TableRow } = docx;
16
-
17
15
  export default async function gridTableRow(ctx, node, parent) {
18
16
  const children = await all(ctx, node);
19
17
  return new TableRow({
@@ -9,11 +9,9 @@
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 docx from 'docx';
12
+ import { HeadingLevel, Paragraph } from 'docx';
13
13
  import all from '../all.js';
14
14
 
15
- const { HeadingLevel, Paragraph } = docx;
16
-
17
15
  const DEPTHS = [
18
16
  HeadingLevel.HEADING_1,
19
17
  HeadingLevel.HEADING_2,
@@ -9,9 +9,7 @@
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 docx from 'docx';
13
-
14
- const { Paragraph, TextRun } = docx;
12
+ import { Paragraph, TextRun } from 'docx';
15
13
 
16
14
  export default function html(ctx, node, parent) {
17
15
  if (node.value === '<!---->') {
@@ -9,12 +9,10 @@
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 docx from 'docx';
13
- import { findXMLComponent } from '../utils.js';
14
-
15
- const {
12
+ import {
16
13
  Drawing, ImageRun, XmlComponent, XmlAttributeComponent,
17
- } = docx;
14
+ } from 'docx';
15
+ import { findXMLComponent } from '../utils.js';
18
16
 
19
17
  // max image width (6.5") and height (2")
20
18
  const LIMITS = {
@@ -9,9 +9,7 @@
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 docx from 'docx';
13
-
14
- const { TextRun } = docx;
12
+ import { TextRun } from 'docx';
15
13
 
16
14
  export default function inlineCode(ctx, node) {
17
15
  return new TextRun({
@@ -9,11 +9,9 @@
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 docx from 'docx';
12
+ import { ExternalHyperlink, ImageRun, TextRun } from 'docx';
13
13
  import all from '../all.js';
14
14
 
15
- const { ExternalHyperlink, ImageRun, TextRun } = docx;
16
-
17
15
  /**
18
16
  * Handles links.
19
17
  *
@@ -9,11 +9,9 @@
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 docx from 'docx';
12
+ import { Paragraph } from 'docx';
13
13
  import all from '../all.js';
14
14
 
15
- const { Paragraph } = docx;
16
-
17
15
  export default async function paragraph(ctx, node, parent) {
18
16
  // clear style
19
17
  ctx.style = {};
@@ -9,11 +9,9 @@
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 docx from 'docx';
12
+ import { Paragraph, Table, WidthType } from 'docx';
13
13
  import all from '../all.js';
14
14
 
15
- const { Paragraph, Table, WidthType } = docx;
16
-
17
15
  // see http://officeopenxml.com/WPtableWidth.php
18
16
  // Note: The 2006 version of the OOXML standard specified that the value was to be a decimal.
19
17
  // When type="pct", the value was interpreted as fifths of a percent, so 4975=99.5%,
@@ -9,14 +9,12 @@
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 docx from 'docx';
12
+ import {
13
+ AlignmentType, Paragraph, Table, TableCell, ShadingType, VerticalAlign,
14
+ } from 'docx';
13
15
  import all from '../all.js';
14
16
  import { removeUndefined } from '../utils.js';
15
17
 
16
- const {
17
- AlignmentType, Paragraph, Table, TableCell, ShadingType, VerticalAlign,
18
- } = docx;
19
-
20
18
  const ALIGN = {
21
19
  left: null,
22
20
  right: AlignmentType.RIGHT,
@@ -9,11 +9,9 @@
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 docx from 'docx';
12
+ import { TableRow } from 'docx';
13
13
  import all from '../all.js';
14
14
 
15
- const { TableRow } = docx;
16
-
17
15
  export default async function tableRow(ctx, node) {
18
16
  const children = await all(ctx, node);
19
17
  return new TableRow({
@@ -9,9 +9,7 @@
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 docx from 'docx';
13
-
14
- const { TextRun } = docx;
12
+ import { TextRun } from 'docx';
15
13
 
16
14
  export default function textNode(ctx, node) {
17
15
  return new TextRun({
@@ -9,9 +9,7 @@
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 docx from 'docx';
13
-
14
- const { Paragraph } = docx;
12
+ import { Paragraph } from 'docx';
15
13
 
16
14
  export default function thematicBreak() {
17
15
  return new Paragraph({
@@ -12,7 +12,7 @@
12
12
  import { readFile } from 'fs/promises';
13
13
  import url from 'url';
14
14
  import path from 'path';
15
- import docx from 'docx';
15
+ import { Document, Packer } from 'docx';
16
16
 
17
17
  import all from './all.js';
18
18
  import handlers from './handlers/index.js';
@@ -22,8 +22,6 @@ import sanitizeHtml from './mdast-sanitize-html.js';
22
22
  import { findXMLComponent } from './utils.js';
23
23
  import downloadImages from './mdast-download-images.js';
24
24
 
25
- const { Document, Packer } = docx;
26
-
27
25
  export default async function mdast2docx(mdast, opts = {}) {
28
26
  const {
29
27
  log = console,
@@ -100,5 +98,9 @@ export default async function mdast2docx(mdast, opts = {}) {
100
98
  });
101
99
  }
102
100
 
103
- return Packer.toBuffer(doc);
101
+ let buf = await Packer.toBuffer(doc);
102
+ if (buf instanceof Uint8Array) {
103
+ buf = Buffer.from(buf);
104
+ }
105
+ return buf;
104
106
  }