diff --git a/.gitignore b/.gitignore index be38787..523ce2d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ vrt/screenshot/actual vrt/screenshot/diff vrt/report.html reg.json -docx-core/tests/output/*.docx \ No newline at end of file +docx-core/tests/output/*.docx +docx-wasm/*.tgz \ No newline at end of file diff --git a/README.md b/README.md index 91be639..048028a 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,23 @@ ## Installation +### Rust + ``` [dependencies] docx-rs = "0.2.0" ``` +### Browser + +``` +yarn add docx-wasm +``` + ## Example +### Rust + ```rust use docx_rs::*; @@ -31,6 +41,22 @@ pub fn hello() -> Result<(), DocxError> { } ``` +### Browser + +```javascript +import { saveAs } from "file-saver"; + +// // Note that a dynamic `import` statement here is required due to webpack/webpack#6615, +import("docx-wasm").then(w => { + const buf = new w.Docx() + .addParagraph( + new w.Paragraph().addRun(new w.Run().addText("Hello world!!")) + ) + .build(); + saveAs(new Blob([buf]), "hello.docx"); +}); +``` + ### More examples - [Minimum](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/hello.rs) diff --git a/docx-wasm/example/index.ts b/docx-wasm/example/index.ts new file mode 100644 index 0000000..e4383a0 --- /dev/null +++ b/docx-wasm/example/index.ts @@ -0,0 +1,16 @@ +import { saveAs } from "file-saver"; + +import("../js").then(w => { + const buf = new w.Docx() + .addParagraph( + new w.Paragraph().addRun(new w.Run().addText("Hello ")).addRun( + new w.Run() + .addText("World!!") + .bold() + .highlight("yellow") + .color("FF0000") + ) + ) + .build(); + saveAs(new Blob([buf]), "hello.docx"); +}); diff --git a/docx-wasm/js/bookmark-end.ts b/docx-wasm/js/bookmark-end.ts new file mode 100644 index 0000000..9ffb2e2 --- /dev/null +++ b/docx-wasm/js/bookmark-end.ts @@ -0,0 +1,6 @@ +export class BookmarkEnd { + id: string; + constructor(id: string) { + this.id = id; + } +} diff --git a/docx-wasm/js/bookmark-start.ts b/docx-wasm/js/bookmark-start.ts new file mode 100644 index 0000000..1ae6634 --- /dev/null +++ b/docx-wasm/js/bookmark-start.ts @@ -0,0 +1,8 @@ +export class BookmarkStart { + id: string; + name: string; + constructor(id: string, name: string) { + this.id = id; + this.name = name; + } +} diff --git a/docx-wasm/js/break.ts b/docx-wasm/js/break.ts new file mode 100644 index 0000000..3385125 --- /dev/null +++ b/docx-wasm/js/break.ts @@ -0,0 +1,8 @@ +export type BreakType = "page" | "column" | "textWrapping"; + +export class Break { + type: BreakType; + constructor(type: BreakType) { + this.type = type; + } +} diff --git a/docx-wasm/js/comment-end.ts b/docx-wasm/js/comment-end.ts new file mode 100644 index 0000000..4065e7c --- /dev/null +++ b/docx-wasm/js/comment-end.ts @@ -0,0 +1,6 @@ +export class CommentEnd { + id: number; + constructor(id: number) { + this.id = id; + } +} diff --git a/docx-wasm/js/comment.ts b/docx-wasm/js/comment.ts new file mode 100644 index 0000000..deb823f --- /dev/null +++ b/docx-wasm/js/comment.ts @@ -0,0 +1,27 @@ +import { Paragraph } from "./paragraph"; + +export class Comment { + id: number; + _author: string; + _date: string; + _paragraph: Paragraph; + + constructor(id: number) { + this.id = id; + } + + author(author: string) { + this._author = author; + return this; + } + + date(date: string) { + this._date = date; + return this; + } + + paragraph(p: Paragraph) { + this._paragraph = p; + return this; + } +} diff --git a/docx-wasm/js/delete-text.ts b/docx-wasm/js/delete-text.ts new file mode 100644 index 0000000..8d406d7 --- /dev/null +++ b/docx-wasm/js/delete-text.ts @@ -0,0 +1,7 @@ +export class DeleteText { + text: string; + + constructor(text: string) { + this.text = text; + } +} diff --git a/docx-wasm/js/delete.ts b/docx-wasm/js/delete.ts new file mode 100644 index 0000000..14392ff --- /dev/null +++ b/docx-wasm/js/delete.ts @@ -0,0 +1,22 @@ +import { Run } from "./run"; + +export class Delete { + run: Run; + + _author: string | null = null; + _date: string | null = null; + + constructor(run: Run) { + this.run = run; + } + + author(author: string) { + this._author = author; + return this; + } + + date(date: string) { + this._date = date; + return this; + } +} diff --git a/docx-wasm/js/index.ts b/docx-wasm/js/index.ts new file mode 100644 index 0000000..f749050 --- /dev/null +++ b/docx-wasm/js/index.ts @@ -0,0 +1,291 @@ +import { Paragraph } from "./paragraph"; +import { Insert } from "./insert"; +import { Delete } from "./delete"; +import { DeleteText } from "./delete-text"; +import { Table } from "./table"; +import { TableCell } from "./table-cell"; +import { Run } from "./run"; +import { Text } from "./text"; +import { Tab } from "./tab"; +import { Break } from "./break"; +import { Comment } from "./comment"; +import { CommentEnd } from "./comment-end"; +import { Numbering } from "./numbering"; +import { BookmarkStart } from "./bookmark-start"; +import { BookmarkEnd } from "./bookmark-end"; + +import * as wasm from "../pkg"; + +export class Docx { + children: (Paragraph | Table)[] = []; + numberings: Numbering[] = []; + + addParagraph(p: Paragraph) { + this.children.push(p); + return this; + } + + addTable(t: Table) { + this.children.push(t); + return this; + } + + addNumbering(num: Numbering) { + this.numberings.push(num); + return this; + } + + buildRun(r: Run) { + let run = wasm.createRun(); + r.children.forEach(child => { + if (child instanceof Text) { + run = run.add_text(child.text); + } else if (child instanceof DeleteText) { + run = run.add_delete_text(child.text); + } else if (child instanceof Tab) { + run = run.add_tab(); + } else if (child instanceof Break) { + if (child.type === "column") { + run = run.add_break(wasm.BreakType.Column); + } else if (child.type === "page") { + run = run.add_break(wasm.BreakType.Page); + } else if (child.type === "textWrapping") { + run = run.add_break(wasm.BreakType.TextWrapping); + } + } + }); + + if (typeof r.property.size !== "undefined") { + run = run.size(r.property.size); + } + + if (r.property.color) { + run = run.color(r.property.color); + } + + if (r.property.highlight) { + run = run.highlight(r.property.highlight); + } + + if (r.property.bold) { + run = run.bold(); + } + + if (r.property.italic) { + run = run.italic(); + } + + if (r.property.underline) { + run = run.underline(r.property.underline); + } + + if (r.property.vanish) { + run = run.vanish(); + } + + return run; + } + + buildInsert(i: Insert) { + const run = this.buildRun(i.run); + let insert = wasm.createInsert(run); + if (i._author) { + insert = insert.author(i._author); + } + if (i._date) { + insert = insert.date(i._date); + } + return insert; + } + + buildDelete(d: Delete) { + const run = this.buildRun(d.run); + let insert = wasm.createInsert(run); + if (d._author) { + insert = insert.author(d._author); + } + if (d._date) { + insert = insert.date(d._date); + } + return insert; + } + + buildComment(c: Comment) { + let comment = wasm.createComment(c.id); + if (c._paragraph) { + comment = comment.paragraph(this.buildParagraph(c._paragraph)); + } + if (c._author) { + comment = comment.author(c._author); + } + if (c._date) { + comment = comment.date(c._date); + } + return comment; + } + + buildParagraph(p: Paragraph) { + let paragraph = wasm.createParagraph(); + p.children.forEach(child => { + if (child instanceof Run) { + const run = this.buildRun(child); + paragraph = paragraph.add_run(run); + } else if (child instanceof Insert) { + const insert = this.buildInsert(child); + paragraph = paragraph.add_insert(insert); + } else if (child instanceof Delete) { + const del = this.buildDelete(child); + paragraph = paragraph.add_delete(del); + } else if (child instanceof BookmarkStart) { + paragraph = paragraph.add_bookmark_start(child.id, child.name); + } else if (child instanceof BookmarkEnd) { + paragraph = paragraph.add_bookmark_end(child.id); + } else if (child instanceof Comment) { + const comment = this.buildComment(child); + paragraph = paragraph.add_comment_start(comment); + } else if (child instanceof CommentEnd) { + paragraph = paragraph.add_comment_end(child.id); + } + }); + + switch (p.property.align) { + case "center": { + paragraph = paragraph.align(wasm.AlignmentType.Center); + break; + } + case "right": { + paragraph = paragraph.align(wasm.AlignmentType.Right); + break; + } + case "justified": { + paragraph = paragraph.align(wasm.AlignmentType.Justified); + break; + } + case "left": { + paragraph = paragraph.align(wasm.AlignmentType.Left); + break; + } + } + + if (typeof p.property.indent !== "undefined") { + const { indent } = p.property; + let kind; + switch (p.property.indent.specialIndentKind) { + case "firstLine": { + kind = wasm.SpecialIndentKind.FirstLine; + break; + } + case "hanging": { + paragraph = paragraph.align(wasm.SpecialIndentKind.Hanging); + break; + } + } + paragraph = paragraph.indent(indent.left, kind, indent.specialIndentSize); + } + + if (typeof p.property.numbering !== "undefined") { + const { numbering } = p.property; + paragraph = paragraph.numbering(numbering.id, numbering.level); + } + + if (typeof p.property.styleId !== "undefined") { + paragraph = paragraph.style(p.property.styleId); + } + + return paragraph; + } + + buildTable(t: Table) { + let table = wasm.createTable(); + t.rows.forEach(r => { + let row = wasm.createTableRow(); + r.cells.forEach(c => { + const cell = this.buildCell(c); + row = row.add_cell(cell); + }); + }); + table = table.set_grid(new Uint32Array(t.grid)); + + switch (t.property.align) { + case "center": { + table = table.align(wasm.TableAlignmentType.Center); + break; + } + case "right": { + table = table.align(wasm.TableAlignmentType.Right); + break; + } + case "left": { + table = table.align(wasm.TableAlignmentType.Left); + break; + } + } + return table; + } + + buildCell(c: TableCell) { + let cell = wasm.createTableCell(); + c.children.forEach(p => { + const paragraph = this.buildParagraph(p); + cell = cell.add_paragraph(paragraph); + }); + + if (c.property.verticalMerge === "continue") { + cell = cell.vertical_merge(wasm.VMergeType.Continue); + } else if (c.property.verticalMerge === "restart") { + cell = cell.vertical_merge(wasm.VMergeType.Restart); + } + + if (typeof c.property.gridSpan !== "undefined") { + cell = cell.grid_span(c.property.gridSpan); + } + + if (typeof c.property.width !== "undefined") { + cell = cell.width(c.property.width); + } + return cell; + } + + build() { + let docx = wasm.createDocx(); + this.children.forEach(child => { + if (child instanceof Paragraph) { + let p = this.buildParagraph(child); + docx = docx.add_paragraph(p); + } else if (child instanceof Table) { + let t = this.buildTable(child); + docx = docx.add_table(t); + } + }); + + this.numberings.forEach(n => { + let num = wasm.createNumbering(n.id); + n.levels.forEach(l => { + const level = wasm.createLevel(l.id, l.start, l.format, l.text, l.jc); + num = num.add_level(level); + }); + docx = docx.add_numbering(num); + }); + const buf = docx.build(); + docx.free(); + return buf; + } +} + +export * from "./paragraph"; +export * from "./insert"; +export * from "./delete"; +export * from "./table"; +export * from "./table-cell"; +export * from "./table-row"; +export * from "./run"; +export * from "./text"; +export * from "./comment"; +export * from "./comment-end"; +export * from "./numbering"; +export * from "./bookmark-start"; +export * from "./bookmark-end"; +export * from "./break"; +export * from "./delete-text"; +export * from "./level"; +export * from "./tab"; diff --git a/docx-wasm/js/insert.ts b/docx-wasm/js/insert.ts new file mode 100644 index 0000000..546c9d8 --- /dev/null +++ b/docx-wasm/js/insert.ts @@ -0,0 +1,20 @@ +import { Run } from "./run"; + +export class Insert { + run: Run; + _author: string | null = null; + _date: string | null = null; + constructor(run: Run) { + this.run = run; + } + + author(author: string) { + this._author = author; + return this; + } + + date(date: string) { + this._date = date; + return this; + } +} diff --git a/docx-wasm/js/level.ts b/docx-wasm/js/level.ts new file mode 100644 index 0000000..1a0f94c --- /dev/null +++ b/docx-wasm/js/level.ts @@ -0,0 +1,37 @@ +import { ParagraphProperty, SpecialIndentKind } from "./paragraph"; + +export class Level { + id: number; + start: number; + format: string; + text: string; + jc: string; + paragraphProperty: ParagraphProperty = {}; + + constructor( + id: number, + start: number, + format: string, + text: string, + jc: string + ) { + this.id = id; + this.start = start; + this.format = format; + this.text = text; + this.jc = jc; + } + + indent( + left: number, + specialIndentKind?: SpecialIndentKind, + specialIndentSize?: number + ) { + this.paragraphProperty.indent = { + left, + specialIndentKind, + specialIndentSize + }; + return this; + } +} diff --git a/docx-wasm/js/numbering.ts b/docx-wasm/js/numbering.ts new file mode 100644 index 0000000..580d712 --- /dev/null +++ b/docx-wasm/js/numbering.ts @@ -0,0 +1,13 @@ +import { Level } from "./level"; + +export class Numbering { + id: number; + levels: Level[]; + constructor(id: number) { + this.id = id; + } + addLevel(level: Level) { + this.levels.push(level); + return this; + } +} diff --git a/docx-wasm/js/paragraph.ts b/docx-wasm/js/paragraph.ts new file mode 100644 index 0000000..c6d883f --- /dev/null +++ b/docx-wasm/js/paragraph.ts @@ -0,0 +1,98 @@ +import { Run } from "./run"; +import { Insert } from "./insert"; +import { Delete } from "./delete"; +import { BookmarkStart } from "./bookmark-start"; +import { BookmarkEnd } from "./bookmark-end"; +import { Comment } from "./comment"; +import { CommentEnd } from "./comment-end"; + +export type ParagraphChild = + | Run + | Insert + | Delete + | BookmarkStart + | BookmarkEnd + | Comment + | CommentEnd; + +export type AlignmentType = "center" | "left" | "right" | "justified"; + +export type SpecialIndentKind = "firstLine" | "hanging"; + +export type ParagraphProperty = { + align?: AlignmentType; + styleId?: string; + indent?: { + left: number; + specialIndentKind?: SpecialIndentKind; + specialIndentSize?: number; + }; + numbering?: { + id: number; + level: number; + }; +}; + +export class Paragraph { + children: ParagraphChild[] = []; + property: ParagraphProperty = {}; + + addRun(run: Run) { + this.children.push(run); + return this; + } + + addInsert(ins: Insert) { + this.children.push(ins); + return this; + } + + addDelete(del: Delete) { + this.children.push(del); + return this; + } + + addBookmarkStart(id: string, name: string) { + this.children.push(new BookmarkStart(id, name)); + return this; + } + + addBookmarkEnd(id: string) { + this.children.push(new BookmarkEnd(id)); + return this; + } + + addCommentStart(comment: Comment) { + this.children.push(comment); + return this; + } + + addCommentEnd(end: CommentEnd) { + this.children.push(end); + return this; + } + + align(type: AlignmentType) { + this.property.align = type; + return this; + } + + style(id: string) { + this.property.styleId = id; + return this; + } + + indent( + left: number, + specialIndentKind?: SpecialIndentKind, + specialIndentSize?: number + ) { + this.property.indent = { left, specialIndentKind, specialIndentSize }; + return this; + } + + numbering(id: number, level: number) { + this.property.numbering = { id, level }; + return this; + } +} diff --git a/docx-wasm/js/run.ts b/docx-wasm/js/run.ts new file mode 100644 index 0000000..89113da --- /dev/null +++ b/docx-wasm/js/run.ts @@ -0,0 +1,76 @@ +import { Text } from "./text"; +import { DeleteText } from "./delete-text"; +import { Tab } from "./tab"; +import { Break, BreakType } from "./break"; + +export type RunChild = Text | DeleteText | Tab | Break; + +export type RunProperty = { + size?: number; + color?: string; + highlight?: string; + bold?: boolean; + italic?: boolean; + underline?: string; + vanish?: boolean; +}; + +export class Run { + children: RunChild[] = []; + property: RunProperty = {}; + + addText(text: string) { + this.children.push(new Text(text)); + return this; + } + + addDeleteText(text: string) { + this.children.push(new DeleteText(text)); + return this; + } + + addTab() { + this.children.push(new Tab()); + return this; + } + + addBreak(type: BreakType) { + this.children.push(new Break(type)); + return this; + } + + size(size: number) { + this.property.size = size; + return this; + } + + color(color: string) { + this.property.color = color; + return this; + } + + highlight(color: string) { + this.property.highlight = color; + return this; + } + + bold() { + this.property.bold = true; + return this; + } + + italic() { + this.property.italic = true; + return this; + } + + underline(type: string) { + this.property.underline = type; + return this; + } + + vanish() { + this.property.vanish = true; + return this; + } +} diff --git a/docx-wasm/js/tab.ts b/docx-wasm/js/tab.ts new file mode 100644 index 0000000..e995160 --- /dev/null +++ b/docx-wasm/js/tab.ts @@ -0,0 +1 @@ +export class Tab {} diff --git a/docx-wasm/js/table-cell.ts b/docx-wasm/js/table-cell.ts new file mode 100644 index 0000000..cc5cd14 --- /dev/null +++ b/docx-wasm/js/table-cell.ts @@ -0,0 +1,34 @@ +import { Paragraph } from "./paragraph"; + +export type VMergeType = "restart" | "continue"; + +export type CellProperty = { + verticalMerge?: VMergeType; + gridSpan?: number; + width?: number; +}; + +export class TableCell { + children: Paragraph[] = []; + property: CellProperty; + + addParagraph(p: Paragraph) { + this.children.push(p); + return this; + } + + verticalMerge(t: VMergeType) { + this.property.verticalMerge = t; + return this; + } + + gridSpan(v: number) { + this.property.gridSpan = v; + return this; + } + + width(v: number) { + this.property.width = v; + return this; + } +} diff --git a/docx-wasm/js/table-row.ts b/docx-wasm/js/table-row.ts new file mode 100644 index 0000000..1f12b25 --- /dev/null +++ b/docx-wasm/js/table-row.ts @@ -0,0 +1,10 @@ +import { TableCell } from "./table-cell"; + +export class TableRow { + cells: TableCell[] = []; + + addCell(cell: TableCell) { + this.cells.push(cell); + this; + } +} diff --git a/docx-wasm/js/table.ts b/docx-wasm/js/table.ts new file mode 100644 index 0000000..d30a983 --- /dev/null +++ b/docx-wasm/js/table.ts @@ -0,0 +1,40 @@ +import { TableRow } from "./table-row"; + +export type TableAlignmentType = "center" | "left" | "right"; + +export type TableProperty = { + indent?: number; + align?: TableAlignmentType; + width?: number; +}; + +export class Table { + rows: TableRow[] = []; + grid: number[] = []; + property: TableProperty; + + addRow(row: TableRow) { + this.rows.push(row); + return this; + } + + setGrid(grid: number[]) { + this.grid = grid; + return this; + } + + indent(v: number) { + this.property.indent = v; + return this; + } + + align(v: TableAlignmentType) { + this.property.align = v; + return this; + } + + width(w: number) { + this.property.width = w; + return this; + } +} diff --git a/docx-wasm/js/text.ts b/docx-wasm/js/text.ts new file mode 100644 index 0000000..0c5a248 --- /dev/null +++ b/docx-wasm/js/text.ts @@ -0,0 +1,7 @@ +export class Text { + text = ""; + + constructor(text: string) { + this.text = text; + } +} diff --git a/docx-wasm/package.json b/docx-wasm/package.json index 3f1fb50..5a23b79 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,12 +1,12 @@ { - "name": "docx-rs", - "version": "1.0.0", - "main": "index.js", + "name": "docx-wasm", + "version": "0.0.11", + "main": "dist/index.js", "author": "bokuweb ", "license": "MIT", "scripts": { - "build": "webpack", - "serve": "webpack-dev-server" + "build": "tsc -p .", + "serve": "webpack-dev-server --open --config webpack.dev.js" }, "resolutions": { "**/serialize-javascript": "2.1.2" @@ -15,8 +15,23 @@ "@wasm-tool/wasm-pack-plugin": "1.0.1", "html-webpack-plugin": "^3.2.0", "text-encoding": "^0.7.0", + "ts-loader": "^6.2.1", + "typescript": "^3.7.5", "webpack": "^4.29.4", "webpack-cli": "^3.1.1", "webpack-dev-server": "^3.1.0" + }, + "files": [ + "dist", + "pkg/docx_wasm_bg.d.ts", + "pkg/docx_wasm_bg.wasm", + "pkg/docx_wasm.d.ts", + "pkg/docx_wasm.js" + ], + "module": "dist/index.js", + "types": "dist/index.d.ts", + "dependencies": { + "@bokuweb/docx-wasm": "0.1.0", + "docx-wasm": "0.0.10" } } diff --git a/docx-wasm/pkg/docx_rs.d.ts b/docx-wasm/pkg/docx_rs.d.ts deleted file mode 100644 index a41339b..0000000 --- a/docx-wasm/pkg/docx_rs.d.ts +++ /dev/null @@ -1,405 +0,0 @@ -/* tslint:disable */ -/** -* @param {number} id -* @param {number} start -* @param {string} format -* @param {string} text -* @param {string} jc -* @returns {Level} -*/ -export function createLevel(id: number, start: number, format: string, text: string, jc: string): Level; -/** -* @param {Run} run -* @returns {Insert} -*/ -export function createInsert(run: Run): Insert; -/** -* @returns {Docx} -*/ -export function createDocx(): Docx; -/** -* @param {Run} run -* @returns {Delete} -*/ -export function createDelete(run: Run): Delete; -/** -* @returns {Table} -*/ -export function createTable(): Table; -/** -* @returns {Paragraph} -*/ -export function createParagraph(): Paragraph; -/** -* @param {number} id -* @returns {Numbering} -*/ -export function createNumbering(id: number): Numbering; -/** -* @returns {TableRow} -*/ -export function createTableRow(): TableRow; -/** -* @returns {Run} -*/ -export function createRun(): Run; -/** -* @param {number} id -* @returns {Comment} -*/ -export function createComment(id: number): Comment; -/** -* @returns {TableCell} -*/ -export function createTableCell(): TableCell; -export enum StyleType { - Paragraph, - Character, -} -/** -*/ -export enum VMergeType { - Continue, - Restart, -} -/** -*/ -export enum WidthType { - DXA, - Auto, -} -/** -*/ -export enum BorderType { - None, - Single, - Thick, - Double, - Dotted, - Dashed, - DotDash, - DotDotDash, - Triple, -} -/** -*/ -export enum AlignmentType { - Center, - Left, - Right, - Justified, -} -/** -*/ -export enum BreakType { - Page, - Column, - TextWrapping, -} -/** -*/ -export enum FontPitchType { - Default, - Fixed, - Variable, -} -/** -*/ -export enum TableAlignmentType { - Center, - Left, - Right, -} -/** -*/ -export enum SpecialIndentKind { - FirstLine, - Hanging, -} -/** -*/ -/** -*/ -export class Comment { - free(): void; -/** -* @param {string} author -* @returns {Comment} -*/ - author(author: string): Comment; -/** -* @param {string} date -* @returns {Comment} -*/ - date(date: string): Comment; -/** -* @param {Paragraph} p -* @returns {Comment} -*/ - paragraph(p: Paragraph): Comment; -/** -* @returns {number} -*/ - id(): number; -} -/** -*/ -export class Delete { - free(): void; -/** -* @param {string} author -* @returns {Delete} -*/ - author(author: string): Delete; -/** -* @param {string} date -* @returns {Delete} -*/ - date(date: string): Delete; -} -/** -*/ -export class Docx { - free(): void; -/** -* @param {Paragraph} p -* @returns {Docx} -*/ - add_paragraph(p: Paragraph): Docx; -/** -* @param {Table} t -* @returns {Docx} -*/ - add_table(t: Table): Docx; -/** -* @param {Numbering} num -* @returns {Docx} -*/ - add_numbering(num: Numbering): Docx; -/** -* @returns {Uint8Array} -*/ - build(): Uint8Array; -} -/** -*/ -export class Insert { - free(): void; -/** -* @param {string} author -* @returns {Insert} -*/ - author(author: string): Insert; -/** -* @param {string} date -* @returns {Insert} -*/ - date(date: string): Insert; -} -/** -*/ -export class Level { - free(): void; -/** -* @param {number} left -* @param {number | undefined} special_indent_kind -* @param {number | undefined} special_indent_size -* @returns {Level} -*/ - indent(left: number, special_indent_kind?: number, special_indent_size?: number): Level; -} -/** -*/ -export class Numbering { - free(): void; -/** -* @param {Level} level -* @returns {Numbering} -*/ - add_level(level: Level): Numbering; -} -/** -*/ -export class Paragraph { - free(): void; -/** -* @param {Run} run -* @returns {Paragraph} -*/ - add_run(run: Run): Paragraph; -/** -* @param {Insert} i -* @returns {Paragraph} -*/ - add_insert(i: Insert): Paragraph; -/** -* @param {Delete} d -* @returns {Paragraph} -*/ - add_delete(d: Delete): Paragraph; -/** -* @param {string} id -* @param {string} name -* @returns {Paragraph} -*/ - add_bookmark_start(id: string, name: string): Paragraph; -/** -* @param {string} id -* @returns {Paragraph} -*/ - add_bookmark_end(id: string): Paragraph; -/** -* @param {Comment} comment -* @returns {Paragraph} -*/ - add_comment_start(comment: Comment): Paragraph; -/** -* @param {number} id -* @returns {Paragraph} -*/ - add_comment_end(id: number): Paragraph; -/** -* @param {number} alignment_type -* @returns {Paragraph} -*/ - align(alignment_type: number): Paragraph; -/** -* @param {string} style_id -* @returns {Paragraph} -*/ - style(style_id: string): Paragraph; -/** -* @param {number} left -* @param {number | undefined} special_indent_kind -* @param {number | undefined} special_indent_size -* @returns {Paragraph} -*/ - indent(left: number, special_indent_kind?: number, special_indent_size?: number): Paragraph; -/** -* @param {number} id -* @param {number} level -* @returns {Paragraph} -*/ - numbering(id: number, level: number): Paragraph; -} -/** -*/ -export class Run { - free(): void; -/** -* @param {string} text -* @returns {Run} -*/ - add_text(text: string): Run; -/** -* @param {string} text -* @returns {Run} -*/ - add_delete_text(text: string): Run; -/** -* @returns {Run} -*/ - add_tab(): Run; -/** -* @param {number} break_type -* @returns {Run} -*/ - add_break(break_type: number): Run; -/** -* @param {number} size -* @returns {Run} -*/ - size(size: number): Run; -/** -* @param {string} color -* @returns {Run} -*/ - color(color: string): Run; -/** -* @param {string} color -* @returns {Run} -*/ - highlight(color: string): Run; -/** -* @returns {Run} -*/ - bold(): Run; -/** -* @returns {Run} -*/ - italic(): Run; -/** -* @param {string} line_type -* @returns {Run} -*/ - underline(line_type: string): Run; -/** -* @returns {Run} -*/ - vanish(): Run; -} -/** -*/ -export class Table { - free(): void; -/** -* @param {TableRow} row -* @returns {Table} -*/ - add_row(row: TableRow): Table; -/** -* @param {Uint32Array} grid -* @returns {Table} -*/ - set_grid(grid: Uint32Array): Table; -/** -* @param {number} v -* @returns {Table} -*/ - indent(v: number): Table; -/** -* @param {number} v -* @returns {Table} -*/ - align(v: number): Table; -/** -* @param {number} w -* @returns {Table} -*/ - width(w: number): Table; -} -/** -*/ -export class TableCell { - free(): void; -/** -* @param {Paragraph} p -* @returns {TableCell} -*/ - add_paragraph(p: Paragraph): TableCell; -/** -* @param {number} t -* @returns {TableCell} -*/ - vertical_merge(t: number): TableCell; -/** -* @param {number} v -* @returns {TableCell} -*/ - grid_span(v: number): TableCell; -/** -* @param {number} v -* @returns {TableCell} -*/ - width(v: number): TableCell; -} -/** -*/ -export class TableRow { - free(): void; -/** -* @param {TableCell} cell -* @returns {TableRow} -*/ - add_cell(cell: TableCell): TableRow; -} diff --git a/docx-wasm/pkg/docx_rs.js b/docx-wasm/pkg/docx_rs.js deleted file mode 100644 index 1fa8a6e..0000000 --- a/docx-wasm/pkg/docx_rs.js +++ /dev/null @@ -1,967 +0,0 @@ -import * as wasm from './docx_rs_bg.wasm'; - -let WASM_VECTOR_LEN = 0; - -let cachedTextEncoder = new TextEncoder('utf-8'); - -const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' - ? function (arg, view) { - return cachedTextEncoder.encodeInto(arg, view); -} - : function (arg, view) { - const buf = cachedTextEncoder.encode(arg); - view.set(buf); - return { - read: arg.length, - written: buf.length - }; -}); - -let cachegetUint8Memory = null; -function getUint8Memory() { - if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) { - cachegetUint8Memory = new Uint8Array(wasm.memory.buffer); - } - return cachegetUint8Memory; -} - -function passStringToWasm(arg) { - - let len = arg.length; - let ptr = wasm.__wbindgen_malloc(len); - - const mem = getUint8Memory(); - - let offset = 0; - - for (; offset < len; offset++) { - const code = arg.charCodeAt(offset); - if (code > 0x7F) break; - mem[ptr + offset] = code; - } - - if (offset !== len) { - if (offset !== 0) { - arg = arg.slice(offset); - } - ptr = wasm.__wbindgen_realloc(ptr, len, len = offset + arg.length * 3); - const view = getUint8Memory().subarray(ptr + offset, ptr + len); - const ret = encodeString(arg, view); - - offset += ret.written; - } - - WASM_VECTOR_LEN = offset; - return ptr; -} -/** -* @param {number} id -* @param {number} start -* @param {string} format -* @param {string} text -* @param {string} jc -* @returns {Level} -*/ -export function createLevel(id, start, format, text, jc) { - const ret = wasm.createLevel(id, start, passStringToWasm(format), WASM_VECTOR_LEN, passStringToWasm(text), WASM_VECTOR_LEN, passStringToWasm(jc), WASM_VECTOR_LEN); - return Level.__wrap(ret); -} - -function isLikeNone(x) { - return x === undefined || x === null; -} - -function _assertClass(instance, klass) { - if (!(instance instanceof klass)) { - throw new Error(`expected instance of ${klass.name}`); - } - return instance.ptr; -} -/** -* @param {Run} run -* @returns {Insert} -*/ -export function createInsert(run) { - _assertClass(run, Run); - const ptr0 = run.ptr; - run.ptr = 0; - const ret = wasm.createInsert(ptr0); - return Insert.__wrap(ret); -} - -/** -* @returns {Docx} -*/ -export function createDocx() { - const ret = wasm.createDocx(); - return Docx.__wrap(ret); -} - -let cachegetInt32Memory = null; -function getInt32Memory() { - if (cachegetInt32Memory === null || cachegetInt32Memory.buffer !== wasm.memory.buffer) { - cachegetInt32Memory = new Int32Array(wasm.memory.buffer); - } - return cachegetInt32Memory; -} - -function getArrayU8FromWasm(ptr, len) { - return getUint8Memory().subarray(ptr / 1, ptr / 1 + len); -} -/** -* @param {Run} run -* @returns {Delete} -*/ -export function createDelete(run) { - _assertClass(run, Run); - const ptr0 = run.ptr; - run.ptr = 0; - const ret = wasm.createDelete(ptr0); - return Delete.__wrap(ret); -} - -/** -* @returns {Table} -*/ -export function createTable() { - const ret = wasm.createTable(); - return Table.__wrap(ret); -} - -let cachegetUint32Memory = null; -function getUint32Memory() { - if (cachegetUint32Memory === null || cachegetUint32Memory.buffer !== wasm.memory.buffer) { - cachegetUint32Memory = new Uint32Array(wasm.memory.buffer); - } - return cachegetUint32Memory; -} - -function passArray32ToWasm(arg) { - const ptr = wasm.__wbindgen_malloc(arg.length * 4); - getUint32Memory().set(arg, ptr / 4); - WASM_VECTOR_LEN = arg.length; - return ptr; -} -/** -* @returns {Paragraph} -*/ -export function createParagraph() { - const ret = wasm.createParagraph(); - return Paragraph.__wrap(ret); -} - -/** -* @param {number} id -* @returns {Numbering} -*/ -export function createNumbering(id) { - const ret = wasm.createNumbering(id); - return Numbering.__wrap(ret); -} - -/** -* @returns {TableRow} -*/ -export function createTableRow() { - const ret = wasm.createTableRow(); - return TableRow.__wrap(ret); -} - -/** -* @returns {Run} -*/ -export function createRun() { - const ret = wasm.createRun(); - return Run.__wrap(ret); -} - -/** -* @param {number} id -* @returns {Comment} -*/ -export function createComment(id) { - const ret = wasm.createComment(id); - return Comment.__wrap(ret); -} - -/** -* @returns {TableCell} -*/ -export function createTableCell() { - const ret = wasm.createTableCell(); - return TableCell.__wrap(ret); -} - -let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -function getStringFromWasm(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory().subarray(ptr, ptr + len)); -} - -const heap = new Array(32); - -heap.fill(undefined); - -heap.push(undefined, null, true, false); - -let heap_next = heap.length; - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function getObject(idx) { return heap[idx]; } - -function dropObject(idx) { - if (idx < 36) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} -/** -*/ -export const StyleType = Object.freeze({ Paragraph:0,Character:1, }); -/** -*/ -export const VMergeType = Object.freeze({ Continue:0,Restart:1, }); -/** -*/ -export const WidthType = Object.freeze({ DXA:0,Auto:1, }); -/** -*/ -export const BorderType = Object.freeze({ None:0,Single:1,Thick:2,Double:3,Dotted:4,Dashed:5,DotDash:6,DotDotDash:7,Triple:8, }); -/** -*/ -export const AlignmentType = Object.freeze({ Center:0,Left:1,Right:2,Justified:3, }); -/** -*/ -export const BreakType = Object.freeze({ Page:0,Column:1,TextWrapping:2, }); -/** -*/ -export const FontPitchType = Object.freeze({ Default:0,Fixed:1,Variable:2, }); -/** -*/ -export const TableAlignmentType = Object.freeze({ Center:0,Left:1,Right:2, }); -/** -*/ -export const SpecialIndentKind = Object.freeze({ FirstLine:0,Hanging:1, }); -/** -*/ -export class Comment { - - static __wrap(ptr) { - const obj = Object.create(Comment.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_comment_free(ptr); - } - /** - * @param {string} author - * @returns {Comment} - */ - author(author) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.comment_author(ptr, passStringToWasm(author), WASM_VECTOR_LEN); - return Comment.__wrap(ret); - } - /** - * @param {string} date - * @returns {Comment} - */ - date(date) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.comment_date(ptr, passStringToWasm(date), WASM_VECTOR_LEN); - return Comment.__wrap(ret); - } - /** - * @param {Paragraph} p - * @returns {Comment} - */ - paragraph(p) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(p, Paragraph); - const ptr0 = p.ptr; - p.ptr = 0; - const ret = wasm.comment_paragraph(ptr, ptr0); - return Comment.__wrap(ret); - } - /** - * @returns {number} - */ - id() { - const ret = wasm.comment_id(this.ptr); - return ret >>> 0; - } -} -/** -*/ -export class Delete { - - static __wrap(ptr) { - const obj = Object.create(Delete.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_delete_free(ptr); - } - /** - * @param {string} author - * @returns {Delete} - */ - author(author) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.delete_author(ptr, passStringToWasm(author), WASM_VECTOR_LEN); - return Delete.__wrap(ret); - } - /** - * @param {string} date - * @returns {Delete} - */ - date(date) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.delete_date(ptr, passStringToWasm(date), WASM_VECTOR_LEN); - return Delete.__wrap(ret); - } -} -/** -*/ -export class Docx { - - static __wrap(ptr) { - const obj = Object.create(Docx.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_docx_free(ptr); - } - /** - * @param {Paragraph} p - * @returns {Docx} - */ - add_paragraph(p) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(p, Paragraph); - const ptr0 = p.ptr; - p.ptr = 0; - const ret = wasm.docx_add_paragraph(ptr, ptr0); - return Docx.__wrap(ret); - } - /** - * @param {Table} t - * @returns {Docx} - */ - add_table(t) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(t, Table); - const ptr0 = t.ptr; - t.ptr = 0; - const ret = wasm.docx_add_table(ptr, ptr0); - return Docx.__wrap(ret); - } - /** - * @param {Numbering} num - * @returns {Docx} - */ - add_numbering(num) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(num, Numbering); - const ptr0 = num.ptr; - num.ptr = 0; - const ret = wasm.docx_add_numbering(ptr, ptr0); - return Docx.__wrap(ret); - } - /** - * @returns {Uint8Array} - */ - build() { - const retptr = 8; - const ret = wasm.docx_build(retptr, this.ptr); - const memi32 = getInt32Memory(); - const v0 = getArrayU8FromWasm(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1]).slice(); - wasm.__wbindgen_free(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1] * 1); - return v0; - } -} -/** -*/ -export class Insert { - - static __wrap(ptr) { - const obj = Object.create(Insert.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_insert_free(ptr); - } - /** - * @param {string} author - * @returns {Insert} - */ - author(author) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.insert_author(ptr, passStringToWasm(author), WASM_VECTOR_LEN); - return Insert.__wrap(ret); - } - /** - * @param {string} date - * @returns {Insert} - */ - date(date) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.insert_date(ptr, passStringToWasm(date), WASM_VECTOR_LEN); - return Insert.__wrap(ret); - } -} -/** -*/ -export class Level { - - static __wrap(ptr) { - const obj = Object.create(Level.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_level_free(ptr); - } - /** - * @param {number} left - * @param {number | undefined} special_indent_kind - * @param {number | undefined} special_indent_size - * @returns {Level} - */ - indent(left, special_indent_kind, special_indent_size) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.level_indent(ptr, left, isLikeNone(special_indent_kind) ? 2 : special_indent_kind, !isLikeNone(special_indent_size), isLikeNone(special_indent_size) ? 0 : special_indent_size); - return Level.__wrap(ret); - } -} -/** -*/ -export class Numbering { - - static __wrap(ptr) { - const obj = Object.create(Numbering.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_numbering_free(ptr); - } - /** - * @param {Level} level - * @returns {Numbering} - */ - add_level(level) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(level, Level); - const ptr0 = level.ptr; - level.ptr = 0; - const ret = wasm.numbering_add_level(ptr, ptr0); - return Numbering.__wrap(ret); - } -} -/** -*/ -export class Paragraph { - - static __wrap(ptr) { - const obj = Object.create(Paragraph.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_paragraph_free(ptr); - } - /** - * @param {Run} run - * @returns {Paragraph} - */ - add_run(run) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(run, Run); - const ptr0 = run.ptr; - run.ptr = 0; - const ret = wasm.paragraph_add_run(ptr, ptr0); - return Paragraph.__wrap(ret); - } - /** - * @param {Insert} i - * @returns {Paragraph} - */ - add_insert(i) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(i, Insert); - const ptr0 = i.ptr; - i.ptr = 0; - const ret = wasm.paragraph_add_insert(ptr, ptr0); - return Paragraph.__wrap(ret); - } - /** - * @param {Delete} d - * @returns {Paragraph} - */ - add_delete(d) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(d, Delete); - const ptr0 = d.ptr; - d.ptr = 0; - const ret = wasm.paragraph_add_delete(ptr, ptr0); - return Paragraph.__wrap(ret); - } - /** - * @param {string} id - * @param {string} name - * @returns {Paragraph} - */ - add_bookmark_start(id, name) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.paragraph_add_bookmark_start(ptr, passStringToWasm(id), WASM_VECTOR_LEN, passStringToWasm(name), WASM_VECTOR_LEN); - return Paragraph.__wrap(ret); - } - /** - * @param {string} id - * @returns {Paragraph} - */ - add_bookmark_end(id) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.paragraph_add_bookmark_end(ptr, passStringToWasm(id), WASM_VECTOR_LEN); - return Paragraph.__wrap(ret); - } - /** - * @param {Comment} comment - * @returns {Paragraph} - */ - add_comment_start(comment) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(comment, Comment); - const ptr0 = comment.ptr; - comment.ptr = 0; - const ret = wasm.paragraph_add_comment_start(ptr, ptr0); - return Paragraph.__wrap(ret); - } - /** - * @param {number} id - * @returns {Paragraph} - */ - add_comment_end(id) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.paragraph_add_comment_end(ptr, id); - return Paragraph.__wrap(ret); - } - /** - * @param {number} alignment_type - * @returns {Paragraph} - */ - align(alignment_type) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.paragraph_align(ptr, alignment_type); - return Paragraph.__wrap(ret); - } - /** - * @param {string} style_id - * @returns {Paragraph} - */ - style(style_id) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.paragraph_style(ptr, passStringToWasm(style_id), WASM_VECTOR_LEN); - return Paragraph.__wrap(ret); - } - /** - * @param {number} left - * @param {number | undefined} special_indent_kind - * @param {number | undefined} special_indent_size - * @returns {Paragraph} - */ - indent(left, special_indent_kind, special_indent_size) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.paragraph_indent(ptr, left, isLikeNone(special_indent_kind) ? 2 : special_indent_kind, !isLikeNone(special_indent_size), isLikeNone(special_indent_size) ? 0 : special_indent_size); - return Paragraph.__wrap(ret); - } - /** - * @param {number} id - * @param {number} level - * @returns {Paragraph} - */ - numbering(id, level) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.paragraph_numbering(ptr, id, level); - return Paragraph.__wrap(ret); - } -} -/** -*/ -export class Run { - - static __wrap(ptr) { - const obj = Object.create(Run.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_run_free(ptr); - } - /** - * @param {string} text - * @returns {Run} - */ - add_text(text) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_add_text(ptr, passStringToWasm(text), WASM_VECTOR_LEN); - return Run.__wrap(ret); - } - /** - * @param {string} text - * @returns {Run} - */ - add_delete_text(text) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_add_delete_text(ptr, passStringToWasm(text), WASM_VECTOR_LEN); - return Run.__wrap(ret); - } - /** - * @returns {Run} - */ - add_tab() { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_add_tab(ptr); - return Run.__wrap(ret); - } - /** - * @param {number} break_type - * @returns {Run} - */ - add_break(break_type) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_add_break(ptr, break_type); - return Run.__wrap(ret); - } - /** - * @param {number} size - * @returns {Run} - */ - size(size) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_size(ptr, size); - return Run.__wrap(ret); - } - /** - * @param {string} color - * @returns {Run} - */ - color(color) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_color(ptr, passStringToWasm(color), WASM_VECTOR_LEN); - return Run.__wrap(ret); - } - /** - * @param {string} color - * @returns {Run} - */ - highlight(color) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_highlight(ptr, passStringToWasm(color), WASM_VECTOR_LEN); - return Run.__wrap(ret); - } - /** - * @returns {Run} - */ - bold() { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_bold(ptr); - return Run.__wrap(ret); - } - /** - * @returns {Run} - */ - italic() { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_italic(ptr); - return Run.__wrap(ret); - } - /** - * @param {string} line_type - * @returns {Run} - */ - underline(line_type) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_underline(ptr, passStringToWasm(line_type), WASM_VECTOR_LEN); - return Run.__wrap(ret); - } - /** - * @returns {Run} - */ - vanish() { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.run_vanish(ptr); - return Run.__wrap(ret); - } -} -/** -*/ -export class Table { - - static __wrap(ptr) { - const obj = Object.create(Table.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_table_free(ptr); - } - /** - * @param {TableRow} row - * @returns {Table} - */ - add_row(row) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(row, TableRow); - const ptr0 = row.ptr; - row.ptr = 0; - const ret = wasm.table_add_row(ptr, ptr0); - return Table.__wrap(ret); - } - /** - * @param {Uint32Array} grid - * @returns {Table} - */ - set_grid(grid) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.table_set_grid(ptr, passArray32ToWasm(grid), WASM_VECTOR_LEN); - return Table.__wrap(ret); - } - /** - * @param {number} v - * @returns {Table} - */ - indent(v) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.table_indent(ptr, v); - return Table.__wrap(ret); - } - /** - * @param {number} v - * @returns {Table} - */ - align(v) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.table_align(ptr, v); - return Table.__wrap(ret); - } - /** - * @param {number} w - * @returns {Table} - */ - width(w) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.table_width(ptr, w); - return Table.__wrap(ret); - } -} -/** -*/ -export class TableCell { - - static __wrap(ptr) { - const obj = Object.create(TableCell.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_tablecell_free(ptr); - } - /** - * @param {Paragraph} p - * @returns {TableCell} - */ - add_paragraph(p) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(p, Paragraph); - const ptr0 = p.ptr; - p.ptr = 0; - const ret = wasm.tablecell_add_paragraph(ptr, ptr0); - return TableCell.__wrap(ret); - } - /** - * @param {number} t - * @returns {TableCell} - */ - vertical_merge(t) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.tablecell_vertical_merge(ptr, t); - return TableCell.__wrap(ret); - } - /** - * @param {number} v - * @returns {TableCell} - */ - grid_span(v) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.tablecell_grid_span(ptr, v); - return TableCell.__wrap(ret); - } - /** - * @param {number} v - * @returns {TableCell} - */ - width(v) { - const ptr = this.ptr; - this.ptr = 0; - const ret = wasm.tablecell_width(ptr, v); - return TableCell.__wrap(ret); - } -} -/** -*/ -export class TableRow { - - static __wrap(ptr) { - const obj = Object.create(TableRow.prototype); - obj.ptr = ptr; - - return obj; - } - - free() { - const ptr = this.ptr; - this.ptr = 0; - - wasm.__wbg_tablerow_free(ptr); - } - /** - * @param {TableCell} cell - * @returns {TableRow} - */ - add_cell(cell) { - const ptr = this.ptr; - this.ptr = 0; - _assertClass(cell, TableCell); - const ptr0 = cell.ptr; - cell.ptr = 0; - const ret = wasm.tablerow_add_cell(ptr, ptr0); - return TableRow.__wrap(ret); - } -} - -export const __wbindgen_string_new = function(arg0, arg1) { - const ret = getStringFromWasm(arg0, arg1); - return addHeapObject(ret); -}; - -export const __wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm(arg0, arg1)); -}; - -export const __wbindgen_rethrow = function(arg0) { - throw takeObject(arg0); -}; - diff --git a/docx-wasm/pkg/docx_rs_bg.d.ts b/docx-wasm/pkg/docx_rs_bg.d.ts deleted file mode 100644 index 9d3c686..0000000 --- a/docx-wasm/pkg/docx_rs_bg.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* tslint:disable */ -export const memory: WebAssembly.Memory; -export function __wbg_level_free(a: number): void; -export function createLevel(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; -export function level_indent(a: number, b: number, c: number, d: number, e: number): number; -export function __wbg_insert_free(a: number): void; -export function createInsert(a: number): number; -export function insert_author(a: number, b: number, c: number): number; -export function insert_date(a: number, b: number, c: number): number; -export function __wbg_docx_free(a: number): void; -export function createDocx(): number; -export function docx_add_paragraph(a: number, b: number): number; -export function docx_add_table(a: number, b: number): number; -export function docx_add_numbering(a: number, b: number): number; -export function docx_build(a: number, b: number): void; -export function __wbg_delete_free(a: number): void; -export function createDelete(a: number): number; -export function delete_author(a: number, b: number, c: number): number; -export function delete_date(a: number, b: number, c: number): number; -export function __wbg_table_free(a: number): void; -export function createTable(): number; -export function table_add_row(a: number, b: number): number; -export function table_set_grid(a: number, b: number, c: number): number; -export function table_indent(a: number, b: number): number; -export function table_align(a: number, b: number): number; -export function table_width(a: number, b: number): number; -export function __wbg_paragraph_free(a: number): void; -export function createParagraph(): number; -export function paragraph_add_run(a: number, b: number): number; -export function paragraph_add_insert(a: number, b: number): number; -export function paragraph_add_delete(a: number, b: number): number; -export function paragraph_add_bookmark_start(a: number, b: number, c: number, d: number, e: number): number; -export function paragraph_add_bookmark_end(a: number, b: number, c: number): number; -export function paragraph_add_comment_start(a: number, b: number): number; -export function paragraph_add_comment_end(a: number, b: number): number; -export function paragraph_align(a: number, b: number): number; -export function paragraph_style(a: number, b: number, c: number): number; -export function paragraph_indent(a: number, b: number, c: number, d: number, e: number): number; -export function paragraph_numbering(a: number, b: number, c: number): number; -export function __wbg_numbering_free(a: number): void; -export function createNumbering(a: number): number; -export function numbering_add_level(a: number, b: number): number; -export function __wbg_tablerow_free(a: number): void; -export function createTableRow(): number; -export function tablerow_add_cell(a: number, b: number): number; -export function __wbg_run_free(a: number): void; -export function createRun(): number; -export function run_add_text(a: number, b: number, c: number): number; -export function run_add_delete_text(a: number, b: number, c: number): number; -export function run_add_tab(a: number): number; -export function run_add_break(a: number, b: number): number; -export function run_size(a: number, b: number): number; -export function run_color(a: number, b: number, c: number): number; -export function run_highlight(a: number, b: number, c: number): number; -export function run_bold(a: number): number; -export function run_italic(a: number): number; -export function run_underline(a: number, b: number, c: number): number; -export function run_vanish(a: number): number; -export function __wbg_comment_free(a: number): void; -export function createComment(a: number): number; -export function comment_author(a: number, b: number, c: number): number; -export function comment_date(a: number, b: number, c: number): number; -export function comment_paragraph(a: number, b: number): number; -export function comment_id(a: number): number; -export function __wbg_tablecell_free(a: number): void; -export function createTableCell(): number; -export function tablecell_add_paragraph(a: number, b: number): number; -export function tablecell_vertical_merge(a: number, b: number): number; -export function tablecell_grid_span(a: number, b: number): number; -export function tablecell_width(a: number, b: number): number; -export function __wbindgen_malloc(a: number): number; -export function __wbindgen_realloc(a: number, b: number, c: number): number; -export function __wbindgen_free(a: number, b: number): void; diff --git a/docx-wasm/pkg/docx_rs_bg.wasm b/docx-wasm/pkg/docx_rs_bg.wasm deleted file mode 100644 index 9686989..0000000 Binary files a/docx-wasm/pkg/docx_rs_bg.wasm and /dev/null differ diff --git a/docx-wasm/pkg/package.json b/docx-wasm/pkg/package.json index 5503474..b9190a8 100644 --- a/docx-wasm/pkg/package.json +++ b/docx-wasm/pkg/package.json @@ -1,15 +1,15 @@ { - "name": "docx-rs", + "name": "docx-wasm", "collaborators": [ "bokuweb " ], "version": "0.1.0", "files": [ - "docx_rs_bg.wasm", - "docx_rs.js", - "docx_rs.d.ts" + "index_bg.wasm", + "index.js", + "index.d.ts" ], - "module": "docx_rs.js", - "types": "docx_rs.d.ts", + "module": "index.js", + "types": "index.d.ts", "sideEffects": "false" } \ No newline at end of file diff --git a/docx-wasm/tsconfig.json b/docx-wasm/tsconfig.json new file mode 100644 index 0000000..c45030d --- /dev/null +++ b/docx-wasm/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "module": "esNext", + "moduleResolution": "node", + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noEmitOnError": true, + "strictNullChecks": true, + "target": "es6", + "sourceMap": true, + "esModuleInterop": true, + "outDir": "dist", + "declaration": true + } +} diff --git a/docx-wasm/webpack.common.js b/docx-wasm/webpack.common.js new file mode 100644 index 0000000..84fa624 --- /dev/null +++ b/docx-wasm/webpack.common.js @@ -0,0 +1,24 @@ +const path = require("path"); +const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); + +module.exports = { + entry: "./example/index.ts", + output: { + path: path.resolve(__dirname, "dist"), + filename: "index.js" + }, + module: { + rules: [ + { + test: /\.ts$/, + use: "ts-loader", + exclude: /node_modules/ + } + ] + }, + resolve: { + extensions: [".ts", ".js"] + }, + plugins: [], + mode: "development" +}; diff --git a/docx-wasm/webpack.config.js b/docx-wasm/webpack.config.js deleted file mode 100644 index c7f59b1..0000000 --- a/docx-wasm/webpack.config.js +++ /dev/null @@ -1,25 +0,0 @@ -const path = require("path"); -const HtmlWebpackPlugin = require("html-webpack-plugin"); -const webpack = require("webpack"); -const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); - -module.exports = { - entry: "./index.js", - output: { - path: path.resolve(__dirname, "dist"), - filename: "index.js" - }, - plugins: [ - new HtmlWebpackPlugin({ template: "assets/template.html" }), - new WasmPackPlugin({ - crateDirectory: path.resolve(__dirname, ".") - }), - // Have this example work in Edge which doesn't ship `TextEncoder` or - // `TextDecoder` at this time. - new webpack.ProvidePlugin({ - TextDecoder: ["text-encoding", "TextDecoder"], - TextEncoder: ["text-encoding", "TextEncoder"] - }) - ], - mode: "development" -}; diff --git a/docx-wasm/webpack.dev.js b/docx-wasm/webpack.dev.js new file mode 100644 index 0000000..6b094f7 --- /dev/null +++ b/docx-wasm/webpack.dev.js @@ -0,0 +1,15 @@ +const path = require("path"); +const merge = require("webpack-merge"); +const common = require("./webpack.common.js"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); + +module.exports = merge(common, { + plugins: [ + ...common.plugins, + new HtmlWebpackPlugin({ template: "assets/template.html" }) + // new WasmPackPlugin({ + // crateDirectory: path.resolve(__dirname, ".") + // }) + ] +}); diff --git a/docx-wasm/webpack.prod.js b/docx-wasm/webpack.prod.js new file mode 100644 index 0000000..14b3f73 --- /dev/null +++ b/docx-wasm/webpack.prod.js @@ -0,0 +1,13 @@ +const path = require("path"); +const merge = require("webpack-merge"); +const common = require("./webpack.common.js"); +const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); + +module.exports = merge(common, { + mode: "production", + plugins: [ + new WasmPackPlugin({ + crateDirectory: path.resolve(__dirname, ".") + }) + ] +}); diff --git a/docx-wasm/yarn.lock b/docx-wasm/yarn.lock index 25d9603..ece228c 100644 --- a/docx-wasm/yarn.lock +++ b/docx-wasm/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@bokuweb/docx-wasm@0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@bokuweb/docx-wasm/-/docx-wasm-0.1.0.tgz#ab6ea97aa31d9166fac53908a91da618deabd39d" + integrity sha512-37IeYZVtO8o99zrCR95Owvx624q2LZ0or80ZrrJ5VJFLEoIn9jJngL1783983ZRYYRYSKQv6kh3qUzNUj6K9mg== + "@types/events@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" @@ -476,6 +481,13 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" +braces@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" @@ -628,7 +640,7 @@ camelcase@^5.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -chalk@2.4.2, chalk@^2.4.1: +chalk@2.4.2, chalk@^2.3.0, chalk@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1116,6 +1128,21 @@ dns-txt@^2.0.2: dependencies: buffer-indexof "^1.0.0" +docx-wasm@0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/docx-wasm/-/docx-wasm-0.0.10.tgz#d32b217ac7cbe7c0cda075c2e1788db23296e88b" + integrity sha512-559IyPaKI+PKbXifJMr9qVVqs1fzIs+awhIuDkinl/5zpFdVrHyqfj43h55eNFxMmbZ1x6tijruLlAcNgcKHTw== + dependencies: + "@bokuweb/docx-wasm" "0.1.0" + docx-wasm "^0.0.9" + +docx-wasm@^0.0.9: + version "0.0.9" + resolved "https://registry.yarnpkg.com/docx-wasm/-/docx-wasm-0.0.9.tgz#ddd47229087e8bbcdfac492f80e4110f71502935" + integrity sha512-HMu2gCcXhSaGUYByOP1ZgjttgGHfFh/nOGL7c58aYoEsSvRXePJHefYCDd1gAZLe7Bf0qsfpsylRfRJLir9dLQ== + dependencies: + "@bokuweb/docx-wasm" "0.1.0" + dom-converter@^0.2: version "0.2.0" resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" @@ -1228,6 +1255,15 @@ enhanced-resolve@4.1.0, enhanced-resolve@^4.1.0: memory-fs "^0.4.0" tapable "^1.0.0" +enhanced-resolve@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz#2937e2b8066cd0fe7ce0990a98f0d71a35189f66" + integrity sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA== + dependencies: + graceful-fs "^4.1.2" + memory-fs "^0.5.0" + tapable "^1.0.0" + entities@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" @@ -1467,6 +1503,13 @@ fill-range@^4.0.0: repeat-string "^1.6.1" to-regex-range "^2.1.0" +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + finalhandler@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" @@ -2144,6 +2187,11 @@ is-number@^3.0.0: dependencies: kind-of "^3.0.2" +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-path-cwd@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" @@ -2289,7 +2337,7 @@ loader-runner@^2.4.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== -loader-utils@1.2.3, loader-utils@^1.2.3: +loader-utils@1.2.3, loader-utils@^1.0.2, loader-utils@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7" integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA== @@ -2401,6 +2449,14 @@ memory-fs@^0.4.0, memory-fs@^0.4.1: errno "^0.1.3" readable-stream "^2.0.1" +memory-fs@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.5.0.tgz#324c01288b88652966d161db77838720845a8e3c" + integrity sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA== + dependencies: + errno "^0.1.3" + readable-stream "^2.0.1" + merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" @@ -2430,6 +2486,14 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" +micromatch@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" + integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + dependencies: + braces "^3.0.1" + picomatch "^2.0.5" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -3009,6 +3073,11 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" +picomatch@^2.0.5: + version "2.2.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.1.tgz#21bac888b6ed8601f831ce7816e335bc779f0a4a" + integrity sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA== + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -3407,7 +3476,7 @@ semver@^5.3.0, semver@^5.5.0, semver@^5.6.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.3.0: +semver@^6.0.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -3873,6 +3942,13 @@ to-regex-range@^2.1.0: is-number "^3.0.0" repeat-string "^1.6.1" +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" @@ -3893,6 +3969,17 @@ toposort@^1.0.0: resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" integrity sha1-LmhELZ9k7HILjMieZEOsbKqVACk= +ts-loader@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.2.1.tgz#67939d5772e8a8c6bdaf6277ca023a4812da02ef" + integrity sha512-Dd9FekWuABGgjE1g0TlQJ+4dFUfYGbYcs52/HQObE0ZmUNjQlmLAS7xXsSzy23AMaMwipsx5sNHvoEpT2CZq1g== + dependencies: + chalk "^2.3.0" + enhanced-resolve "^4.0.0" + loader-utils "^1.0.2" + micromatch "^4.0.0" + semver "^6.0.0" + tslib@^1.9.0: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" @@ -3916,6 +4003,11 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= +typescript@^3.7.5: + version "3.7.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" + integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== + uglify-js@3.4.x: version "3.4.10" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f"