@folijs/docx 0.0.0-stage → 0.3.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +21 -0
  3. package/README.md +141 -2
  4. package/dist/export/content.d.ts +17 -0
  5. package/dist/export/content.d.ts.map +1 -0
  6. package/dist/export/content.js +165 -0
  7. package/dist/export/content.js.map +1 -0
  8. package/dist/export/index.d.ts +14 -0
  9. package/dist/export/index.d.ts.map +1 -0
  10. package/dist/export/index.js +352 -0
  11. package/dist/export/index.js.map +1 -0
  12. package/dist/export/parts.d.ts +24 -0
  13. package/dist/export/parts.d.ts.map +1 -0
  14. package/dist/export/parts.js +413 -0
  15. package/dist/export/parts.js.map +1 -0
  16. package/dist/export/properties.d.ts +39 -0
  17. package/dist/export/properties.d.ts.map +1 -0
  18. package/dist/export/properties.js +506 -0
  19. package/dist/export/properties.js.map +1 -0
  20. package/dist/export/xmlout.d.ts +63 -0
  21. package/dist/export/xmlout.d.ts.map +1 -0
  22. package/dist/export/xmlout.js +194 -0
  23. package/dist/export/xmlout.js.map +1 -0
  24. package/dist/import/content.d.ts +35 -0
  25. package/dist/import/content.d.ts.map +1 -0
  26. package/dist/import/content.js +370 -0
  27. package/dist/import/content.js.map +1 -0
  28. package/dist/import/index.d.ts +26 -0
  29. package/dist/import/index.d.ts.map +1 -0
  30. package/dist/import/index.js +96 -0
  31. package/dist/import/index.js.map +1 -0
  32. package/dist/import/ooxml.d.ts +38 -0
  33. package/dist/import/ooxml.d.ts.map +1 -0
  34. package/dist/import/ooxml.js +70 -0
  35. package/dist/import/ooxml.js.map +1 -0
  36. package/dist/import/parts.d.ts +35 -0
  37. package/dist/import/parts.d.ts.map +1 -0
  38. package/dist/import/parts.js +365 -0
  39. package/dist/import/parts.js.map +1 -0
  40. package/dist/import/properties.d.ts +50 -0
  41. package/dist/import/properties.d.ts.map +1 -0
  42. package/dist/import/properties.js +403 -0
  43. package/dist/import/properties.js.map +1 -0
  44. package/dist/import/report.d.ts +28 -0
  45. package/dist/import/report.d.ts.map +1 -0
  46. package/dist/import/report.js +42 -0
  47. package/dist/import/report.js.map +1 -0
  48. package/dist/index.d.ts +6 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +6 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/package.d.ts +70 -0
  53. package/dist/package.d.ts.map +1 -0
  54. package/dist/package.js +259 -0
  55. package/dist/package.js.map +1 -0
  56. package/dist/xml.d.ts +79 -0
  57. package/dist/xml.d.ts.map +1 -0
  58. package/dist/xml.js +384 -0
  59. package/dist/xml.js.map +1 -0
  60. package/dist/zip.d.ts +66 -0
  61. package/dist/zip.d.ts.map +1 -0
  62. package/dist/zip.js +356 -0
  63. package/dist/zip.js.map +1 -0
  64. package/package.json +36 -3
  65. package/src/export/content.ts +229 -0
  66. package/src/export/index.ts +445 -0
  67. package/src/export/parts.ts +545 -0
  68. package/src/export/properties.ts +608 -0
  69. package/src/export/xmlout.ts +225 -0
  70. package/src/import/content.ts +413 -0
  71. package/src/import/index.ts +126 -0
  72. package/src/import/ooxml.ts +77 -0
  73. package/src/import/parts.ts +423 -0
  74. package/src/import/properties.ts +504 -0
  75. package/src/import/report.ts +64 -0
  76. package/src/index.ts +24 -0
  77. package/src/package.ts +328 -0
  78. package/src/xml.ts +443 -0
  79. package/src/zip.ts +401 -0
@@ -0,0 +1,259 @@
1
+ /**
2
+ * A `.docx` as an Open Packaging Conventions package (ECMA-376 Part 2): its parts, their
3
+ * content types and the relationships between them. Read once; written back with every part it
4
+ * was not asked to replace copied from the original file byte for byte.
5
+ */
6
+ import { parseXml } from "./xml.js";
7
+ import { deflateEntry, inflateEntry, readZip, writeZip, } from "./zip.js";
8
+ /** A file that is not a `.docx` package, or is damaged. */
9
+ export class DocxError extends Error {
10
+ name = "DocxError";
11
+ }
12
+ const CONTENT_TYPES = "/[Content_Types].xml";
13
+ const OFFICE_DOCUMENT = /\/officeDocument$/;
14
+ /** Documents, templates, and their macro-enabled kinds (ECMA-376 and MS-OFFMACRO). */
15
+ const WORD_MAIN = /^application\/vnd\.(openxmlformats-officedocument\.wordprocessingml\.(document|template)\.main\+xml|ms-word\.(document|template)\.macroEnabled(Template)?\.main\+xml)$/;
16
+ /** Reads a `.docx` (a package whose `officeDocument` is WordprocessingML). */
17
+ export async function readPackage(bytes, options = {}) {
18
+ const entries = readZip(bytes, options);
19
+ // One entry at a time: memory holds the parts read so far, never several inflations at once.
20
+ const data = [];
21
+ for (const entry of entries)
22
+ data.push(await inflateEntry(entry));
23
+ return new DocxPackage(entries, data, options);
24
+ }
25
+ export class DocxPackage {
26
+ /** Every part in the zip's order (`[Content_Types].xml` and folder entries are not parts). */
27
+ parts;
28
+ /** The main document part: the target of the package's `officeDocument` relationship. */
29
+ mainDocument;
30
+ #entries;
31
+ #options;
32
+ #byName = new Map();
33
+ #relationships = new Map();
34
+ #xml = new Map();
35
+ #defaults;
36
+ #overridden;
37
+ #contentTypesText;
38
+ /** @internal Use {@link readPackage}. */
39
+ constructor(entries, data, options) {
40
+ this.#entries = entries;
41
+ this.#options = options.maxDepth === undefined ? {} : { maxDepth: options.maxDepth };
42
+ const index = entries.findIndex((e) => key(partName(e.name)) === key(CONTENT_TYPES));
43
+ if (index === -1)
44
+ throw new DocxError("Not a .docx: no [Content_Types].xml");
45
+ const typesXml = xml(data[index], CONTENT_TYPES, this.#options);
46
+ const types = contentTypes(typesXml.root);
47
+ this.#defaults = types.defaults;
48
+ this.#overridden = new Set(types.overrides.keys());
49
+ // Rewritten as UTF-8 when parts are added: the declaration says so.
50
+ this.#contentTypesText = typesXml.source.replace(/^(<\?xml[^?]*?encoding=)(["'])[^"']*\2/, "$1$2UTF-8$2");
51
+ const parts = [];
52
+ entries.forEach((entry, i) => {
53
+ if (i === index || entry.name.endsWith("/"))
54
+ return;
55
+ const name = partName(entry.name);
56
+ const contentType = types.overrides.get(key(name)) ?? types.defaults.get(extension(name)) ?? "";
57
+ const part = { name, contentType, data: data[i] };
58
+ parts.push(part);
59
+ this.#byName.set(key(name), part);
60
+ });
61
+ this.parts = parts;
62
+ const main = this.relationships("/").find((r) => OFFICE_DOCUMENT.test(r.type) && !r.external);
63
+ const part = main?.partName ? this.part(main.partName) : undefined;
64
+ if (!part)
65
+ throw new DocxError("Not a .docx: no main document part");
66
+ if (!WORD_MAIN.test(part.contentType)) {
67
+ throw new DocxError(`Not a .docx: the main part is ${part.contentType || "untyped"}`);
68
+ }
69
+ this.mainDocument = part.name;
70
+ }
71
+ /** The part named `name`, if any. Part names compare case-insensitively and percent-decoded. */
72
+ part(name) {
73
+ return this.#byName.get(key(name));
74
+ }
75
+ /** The relationships whose source is the part `source` ("/" for the package itself). */
76
+ relationships(source) {
77
+ const known = this.#relationships.get(key(source));
78
+ if (known)
79
+ return known;
80
+ const relsName = relationshipsPart(source);
81
+ const part = this.part(relsName);
82
+ const list = part ? parseRelationships(this.xml(part.name).root, source, relsName) : [];
83
+ this.#relationships.set(key(source), list);
84
+ return list;
85
+ }
86
+ /** The part's text (UTF-8 or UTF-16 by its byte order mark), throwing on invalid bytes. */
87
+ text(name) {
88
+ const part = this.part(name);
89
+ if (!part)
90
+ throw new DocxError(`No part ${name}`);
91
+ // shortcut: the encoding and byte order mark are not reported; export (8.5) needs them to
92
+ // re-encode a part it rewrites that was not BOM-less UTF-8 (Word writes only that).
93
+ return text(part.data, part.name);
94
+ }
95
+ /** The part parsed as XML (once); every node keeps its offsets into the part's text. */
96
+ xml(name) {
97
+ const part = this.part(name);
98
+ if (!part)
99
+ throw new DocxError(`No part ${name}`);
100
+ let doc = this.#xml.get(key(part.name));
101
+ if (!doc) {
102
+ doc = xml(part.data, part.name, this.#options);
103
+ this.#xml.set(key(part.name), doc);
104
+ }
105
+ return doc;
106
+ }
107
+ /**
108
+ * The package as a `.docx` file. Parts in `replace` (by part name) get the new bytes; parts in
109
+ * `add` are new (their content type declared in `[Content_Types].xml` unless its defaults
110
+ * already give it). Every other entry, `[Content_Types].xml` included when nothing is added,
111
+ * is copied from the original file as it was stored. Entries keep their order; added ones
112
+ * come last.
113
+ */
114
+ async write(replace = new Map(), add = []) {
115
+ const pending = new Map();
116
+ for (const [name, data] of replace) {
117
+ const part = this.part(name);
118
+ if (!part)
119
+ throw new DocxError(`No part ${name} to replace`);
120
+ pending.set(key(part.name), data);
121
+ }
122
+ const overrides = [];
123
+ for (const part of add) {
124
+ if (!part.name.startsWith("/") || part.name.endsWith("/"))
125
+ throw new DocxError(`Not a part name: ${part.name}`);
126
+ if (this.part(part.name) || add.filter((p) => key(p.name) === key(part.name)).length > 1) {
127
+ throw new DocxError(`Part ${part.name} already exists`);
128
+ }
129
+ // An Override already there (a stale one, for a part the zip lacks) is not repeated.
130
+ const declared = this.#overridden.has(key(part.name));
131
+ if (part.contentType &&
132
+ !declared &&
133
+ this.#defaults.get(extension(part.name)) !== part.contentType) {
134
+ overrides.push(`<Override PartName="${escapeXml(part.name)}" ContentType="${escapeXml(part.contentType)}"/>`);
135
+ }
136
+ }
137
+ if (overrides.length) {
138
+ const types = this.#contentTypesText;
139
+ const close = types.lastIndexOf("</");
140
+ pending.set(key(CONTENT_TYPES), new TextEncoder().encode(types.slice(0, close) + overrides.join("") + types.slice(close)));
141
+ }
142
+ const entries = [];
143
+ for (const entry of this.#entries) {
144
+ const data = pending.get(key(partName(entry.name)));
145
+ entries.push(data ? await deflateEntry(entry.name, data, entry) : entry);
146
+ }
147
+ for (const part of add)
148
+ entries.push(await deflateEntry(part.name.slice(1), part.data));
149
+ return writeZip(entries);
150
+ }
151
+ }
152
+ function escapeXml(value) {
153
+ return value.replace(/[&<>"]/g, (c) => `&#${c.charCodeAt(0)};`);
154
+ }
155
+ /** `word/document.xml` (zip) → `/word/document.xml` (part name). */
156
+ function partName(entryName) {
157
+ return `/${entryName}`;
158
+ }
159
+ /**
160
+ * Part names are equivalent case-insensitively and with percent-encoding decoded (ECMA-376
161
+ * Part 2, 6.2.2). `decodeURI` leaves encoded delimiters (`%2F`) encoded: never a new segment.
162
+ */
163
+ function key(name) {
164
+ let decoded = name;
165
+ try {
166
+ decoded = decodeURI(name);
167
+ }
168
+ catch { }
169
+ return decoded.toLowerCase();
170
+ }
171
+ function extension(name) {
172
+ const slash = name.lastIndexOf("/");
173
+ const dot = name.lastIndexOf(".");
174
+ return dot > slash ? name.slice(dot + 1).toLowerCase() : "";
175
+ }
176
+ function contentTypes(root) {
177
+ const defaults = new Map();
178
+ const overrides = new Map();
179
+ if (root.local !== "Types")
180
+ throw new DocxError("Not a .docx: [Content_Types].xml has no Types");
181
+ for (const child of root.children) {
182
+ if (child.kind !== "element")
183
+ continue;
184
+ const type = attribute(child, "ContentType");
185
+ if (child.local === "Default") {
186
+ defaults.set((attribute(child, "Extension") ?? "").toLowerCase(), type ?? "");
187
+ }
188
+ else if (child.local === "Override") {
189
+ overrides.set(key(attribute(child, "PartName") ?? ""), type ?? "");
190
+ }
191
+ }
192
+ return { defaults, overrides };
193
+ }
194
+ /** `/word/document.xml` → `/word/_rels/document.xml.rels`; `/` → `/_rels/.rels`. */
195
+ function relationshipsPart(source) {
196
+ const slash = source.lastIndexOf("/");
197
+ return `${source.slice(0, slash)}/_rels/${source.slice(slash + 1)}.rels`;
198
+ }
199
+ function parseRelationships(root, source, relsName) {
200
+ if (root.local !== "Relationships")
201
+ throw new DocxError(`${relsName} has no Relationships`);
202
+ const list = [];
203
+ for (const child of root.children) {
204
+ if (child.kind !== "element" || child.local !== "Relationship")
205
+ continue;
206
+ const id = attribute(child, "Id");
207
+ const type = attribute(child, "Type");
208
+ const target = attribute(child, "Target");
209
+ if (id === undefined || type === undefined || target === undefined) {
210
+ throw new DocxError(`${relsName}: a relationship without Id, Type or Target`);
211
+ }
212
+ const external = attribute(child, "TargetMode") === "External";
213
+ // A target with a scheme (`http:`, `file:`) is not a part, whatever its mode says.
214
+ const uri = /^[a-z][a-z0-9+.-]*:/i.test(target);
215
+ list.push(external || uri
216
+ ? { id, type, target, external }
217
+ : { id, type, target, external, partName: resolveTarget(source, target) });
218
+ }
219
+ return list;
220
+ }
221
+ /** A relative target resolved against its source part's folder (RFC 3986 dot segments). */
222
+ function resolveTarget(source, target) {
223
+ const path = target.split("#")[0];
224
+ const base = path.startsWith("/") ? [] : source.split("/").slice(1, -1);
225
+ for (const segment of path.split("/")) {
226
+ if (segment === "..")
227
+ base.pop();
228
+ else if (segment !== "." && segment !== "")
229
+ base.push(segment);
230
+ }
231
+ return `/${base.join("/")}`;
232
+ }
233
+ function attribute(element, local) {
234
+ return element.attributes.find((a) => a.local === local && a.ns === "")?.value;
235
+ }
236
+ function text(data, name) {
237
+ const encoding = data[0] === 0xff && data[1] === 0xfe
238
+ ? "utf-16le"
239
+ : data[0] === 0xfe && data[1] === 0xff
240
+ ? "utf-16be"
241
+ : "utf-8";
242
+ try {
243
+ return new TextDecoder(encoding, { fatal: true }).decode(data);
244
+ }
245
+ catch {
246
+ throw new DocxError(`${name}: not valid ${encoding.toUpperCase()}`);
247
+ }
248
+ }
249
+ function xml(data, name, options) {
250
+ const source = text(data, name);
251
+ try {
252
+ return parseXml(source, options);
253
+ }
254
+ catch (error) {
255
+ // The XmlError (with its offset) stays reachable as the cause.
256
+ throw new DocxError(`${name}: ${error.message}`, { cause: error });
257
+ }
258
+ }
259
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../src/package.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAwB,QAAQ,EAAqC,MAAM,UAAU,CAAC;AAC7F,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,QAAQ,GAGT,MAAM,UAAU,CAAC;AA2BlB,2DAA2D;AAC3D,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,IAAI,GAAG,WAAW,CAAC;CAC7B;AAED,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C,MAAM,eAAe,GAAG,mBAAmB,C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D;QAC/D,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,KAAM,KAAe,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAChF,CAAC;AACH,CAAC"}
package/dist/xml.d.ts ADDED
@@ -0,0 +1,79 @@
1
+ /**
2
+ * An XML reader that keeps the exact source text: every node records where it is in the source
3
+ * string, so anything the importer does not understand is written back as the very characters
4
+ * it was read from (`source.slice(node.start, node.end)`), never re-serialized.
5
+ *
6
+ * XML 1.0 with namespaces, as OOXML uses it. No DTD (OOXML forbids one, ECMA-376 Part 2), so
7
+ * the only entities are the five predefined ones and character references.
8
+ */
9
+ export interface XmlName {
10
+ /** As written: `w:p`. */
11
+ readonly name: string;
12
+ /** `w`, or "" without a prefix. */
13
+ readonly prefix: string;
14
+ /** `p`. */
15
+ readonly local: string;
16
+ /** The namespace URI the prefix is bound to; "" for none (an unprefixed attribute, say). */
17
+ readonly ns: string;
18
+ }
19
+ export interface XmlAttribute extends XmlName {
20
+ /** The value with references decoded and whitespace normalized, as XML defines it. */
21
+ readonly value: string;
22
+ /** From the name to the closing quote. */
23
+ readonly start: number;
24
+ readonly end: number;
25
+ /** The raw value between the quotes. */
26
+ readonly valueStart: number;
27
+ readonly valueEnd: number;
28
+ }
29
+ export interface XmlElement extends XmlName {
30
+ readonly kind: "element";
31
+ readonly attributes: readonly XmlAttribute[];
32
+ readonly children: readonly XmlNode[];
33
+ /** `<` of the start tag. */
34
+ readonly start: number;
35
+ /** Just after the start tag's `>`. */
36
+ readonly openEnd: number;
37
+ /** `<` of the end tag; `openEnd` for an empty-element tag. */
38
+ readonly closeStart: number;
39
+ /** Just after the end tag (or the empty-element tag). */
40
+ readonly end: number;
41
+ }
42
+ export interface XmlText {
43
+ readonly kind: "text";
44
+ /** Character data with references decoded and line ends normalized. */
45
+ readonly text: string;
46
+ /** A `<![CDATA[...]]>` section. */
47
+ readonly cdata: boolean;
48
+ readonly start: number;
49
+ readonly end: number;
50
+ }
51
+ export interface XmlOther {
52
+ /** `<?xml ...?>`, `<?target ...?>`, `<!-- ... -->`. */
53
+ readonly kind: "declaration" | "instruction" | "comment";
54
+ readonly start: number;
55
+ readonly end: number;
56
+ }
57
+ export type XmlNode = XmlElement | XmlText | XmlOther;
58
+ export interface XmlDocument {
59
+ readonly source: string;
60
+ /** Everything at the top level in order: declaration, comments, whitespace, the root. */
61
+ readonly children: readonly XmlNode[];
62
+ readonly root: XmlElement;
63
+ }
64
+ /** Source that is not well-formed XML; `offset` is where in the source. */
65
+ export declare class XmlError extends Error {
66
+ readonly offset: number;
67
+ name: string;
68
+ constructor(message: string, offset: number);
69
+ }
70
+ export interface ParseXmlOptions {
71
+ /**
72
+ * Deepest element nesting accepted. Default 1000: Word's deepest structures (tables in
73
+ * tables, content controls) stay far below, and code walking the tree recursively is safe.
74
+ */
75
+ readonly maxDepth?: number;
76
+ }
77
+ /** Parses `source`; throws {@link XmlError} where it is not well-formed. */
78
+ export declare function parseXml(source: string, options?: ParseXmlOptions): XmlDocument;
79
+ //# sourceMappingURL=xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,OAAO;IACtB,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,WAAW;IACX,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO;IAC3C,sFAAsF;IACtF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CA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