@ansonlai/docx-redline-js 0.1.0 → 0.1.3
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/ARCHITECTURE.md +5 -8
- package/README.md +2 -2
- package/dist/docx-redline-js.esm.js +1 -1
- package/package.json +6 -6
- package/services/standalone-operation-runner.js +11 -11
- package/standalone.js +0 -5
package/ARCHITECTURE.md
CHANGED
|
@@ -40,14 +40,12 @@ No Word add-in entrypoints or host-specific integration layers are part of this
|
|
|
40
40
|
│ ├── numbering-helpers.js
|
|
41
41
|
│ ├── standalone-docx-plumbing.js
|
|
42
42
|
│ └── standalone-operation-runner.js
|
|
43
|
-
|
|
44
|
-
└── standalone.js
|
|
43
|
+
└── index.js
|
|
45
44
|
```
|
|
46
45
|
|
|
47
46
|
## Entry Points
|
|
48
47
|
|
|
49
|
-
- `index.js
|
|
50
|
-
- `standalone.js`: compatibility alias that re-exports from `index.js` (deprecated for new imports).
|
|
48
|
+
- `index.js` (Root exports containing the reconciliation logic)
|
|
51
49
|
|
|
52
50
|
## Module Responsibilities
|
|
53
51
|
|
|
@@ -76,7 +74,7 @@ No Word add-in entrypoints or host-specific integration layers are part of this
|
|
|
76
74
|
|
|
77
75
|
## End-to-End Flow
|
|
78
76
|
|
|
79
|
-
1. Caller imports from `index.js
|
|
77
|
+
1. Caller imports from `index.js`.
|
|
80
78
|
2. Caller configures XML provider/logger/defaults when needed via `adapters/*`.
|
|
81
79
|
3. Caller invokes reconciliation APIs (`applyRedlineToOxml`, operation runner, ingestion/export helpers).
|
|
82
80
|
4. `engine/oxml-engine.js` routes to format, table, list, surgical, or reconstruction flows.
|
|
@@ -86,9 +84,8 @@ No Word add-in entrypoints or host-specific integration layers are part of this
|
|
|
86
84
|
## Public Surfaces
|
|
87
85
|
|
|
88
86
|
- Primary: `index.js`
|
|
89
|
-
|
|
87
|
+
Keep exports centralized through `index.js`.
|
|
90
88
|
|
|
91
|
-
Keep exports centralized through `index.js`; maintain `standalone.js` only for backward compatibility.
|
|
92
89
|
|
|
93
90
|
## Build Output
|
|
94
91
|
|
|
@@ -118,4 +115,4 @@ Use this sequence to understand or modify behavior without reading everything:
|
|
|
118
115
|
2. Follow exports into `engine/oxml-engine.js` or relevant `services/*` module.
|
|
119
116
|
3. For targeting bugs, inspect `core/paragraph-targeting.js`, `core/list-targeting.js`, and `core/table-targeting.js`.
|
|
120
117
|
4. For package wiring issues, inspect `services/standalone-docx-plumbing.js`.
|
|
121
|
-
5. For numbering/list issues, inspect `services/numbering-helpers.js` and orchestration list-fallback modules.
|
|
118
|
+
5. For numbering/list issues, inspect `services/numbering-helpers.js` and orchestration list-fallback modules.
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Or use the pre-bundled file (no import map needed, `diff-match-patch` is inlined
|
|
|
43
43
|
### Local git clone
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
git clone https://github.com/
|
|
46
|
+
git clone https://github.com/AnsonLai/docx-redline-js.git
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
```js
|
|
@@ -174,4 +174,4 @@ const output = await zip.generateAsync({ type: 'nodebuffer' });
|
|
|
174
174
|
|
|
175
175
|
See [ARCHITECTURE.md](./ARCHITECTURE.md) for module layout, data flow, and contributor guidance.
|
|
176
176
|
|
|
177
|
-
See [AGENTS.md](./AGENTS.md) for a concise reference for AI coding agents.
|
|
177
|
+
See [AGENTS.md](./AGENTS.md) for a concise reference for AI coding agents.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @ansonlai/docx-redline-js v0.1.
|
|
1
|
+
// @ansonlai/docx-redline-js v0.1.3 — https://github.com/AnsonLai/docx-redline-js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ansonlai/docx-redline-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Host-independent OOXML reconciliation engine for .docx manipulation with track changes",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"import": "./index.js",
|
|
12
12
|
"default": "./index.js"
|
|
13
13
|
},
|
|
14
|
-
"./standalone": "./standalone.js",
|
|
14
|
+
"./standalone-runner": "./services/standalone-operation-runner.js",
|
|
15
|
+
"./redline-operation-converter": "./orchestration/redline-operation-converter.js",
|
|
15
16
|
"./adapters/*": "./adapters/*",
|
|
16
17
|
"./core/*": "./core/*",
|
|
17
18
|
"./engine/*": "./engine/*",
|
|
@@ -27,7 +28,6 @@
|
|
|
27
28
|
"services/",
|
|
28
29
|
"orchestration/",
|
|
29
30
|
"index.js",
|
|
30
|
-
"standalone.js",
|
|
31
31
|
"dist/",
|
|
32
32
|
"ARCHITECTURE.md",
|
|
33
33
|
"AGENTS.md",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "node scripts/build.mjs",
|
|
54
54
|
"test": "node scripts/run-tests.mjs",
|
|
55
|
-
"test:isolation": "node tests/
|
|
55
|
+
"test:isolation": "node tests/no_word_api_index_check.mjs && node tests/core_dependency_graph_check.mjs",
|
|
56
56
|
"prepublishOnly": "npm run test:isolation && npm run build"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
],
|
|
69
69
|
"repository": {
|
|
70
70
|
"type": "git",
|
|
71
|
-
"url": "https://github.com/
|
|
71
|
+
"url": "https://github.com/AnsonLai/docx-redline-js.git"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=18.0.0"
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
resolveParagraphRangeByRefs,
|
|
38
38
|
extractReplacementNodesFromOoxml,
|
|
39
39
|
normalizeBodySectionOrderStandalone
|
|
40
|
-
} from '../
|
|
40
|
+
} from '../index.js';
|
|
41
41
|
|
|
42
42
|
const NS_W = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
|
|
43
43
|
|
|
@@ -46,8 +46,8 @@ function getParagraphText(paragraph) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function resolveTargetParagraph(xmlDoc, targetText, targetRef, opType, runtimeContext = null, options = {}) {
|
|
49
|
-
const onInfo = typeof options?.onInfo === 'function' ? options.onInfo : () => {};
|
|
50
|
-
const onWarn = typeof options?.onWarn === 'function' ? options.onWarn : () => {};
|
|
49
|
+
const onInfo = typeof options?.onInfo === 'function' ? options.onInfo : () => { };
|
|
50
|
+
const onWarn = typeof options?.onWarn === 'function' ? options.onWarn : () => { };
|
|
51
51
|
return resolveTargetParagraphWithSnapshotShared(xmlDoc, {
|
|
52
52
|
targetText,
|
|
53
53
|
targetRef,
|
|
@@ -536,7 +536,7 @@ async function tryExplicitDecimalHeaderListConversion({
|
|
|
536
536
|
author,
|
|
537
537
|
runtimeContext,
|
|
538
538
|
generateRedlines = true,
|
|
539
|
-
onInfo = () => {}
|
|
539
|
+
onInfo = () => { }
|
|
540
540
|
}) {
|
|
541
541
|
if (!targetParagraph) return null;
|
|
542
542
|
const scopedParagraphOxml = serializer.serializeToString(targetParagraph);
|
|
@@ -644,7 +644,7 @@ async function trySingleParagraphListStructuralFallback({
|
|
|
644
644
|
author,
|
|
645
645
|
runtimeContext,
|
|
646
646
|
generateRedlines = true,
|
|
647
|
-
onInfo = () => {}
|
|
647
|
+
onInfo = () => { }
|
|
648
648
|
}) {
|
|
649
649
|
if (!targetParagraph) return null;
|
|
650
650
|
|
|
@@ -767,8 +767,8 @@ async function trySingleParagraphListStructuralFallback({
|
|
|
767
767
|
|
|
768
768
|
async function applyToParagraphByExactText(documentXml, targetText, modifiedText, author, targetRef = null, targetEndRef = null, runtimeContext = null, options = {}) {
|
|
769
769
|
const generateRedlines = options.generateRedlines !== false;
|
|
770
|
-
const onInfo = typeof options?.onInfo === 'function' ? options.onInfo : () => {};
|
|
771
|
-
const onWarn = typeof options?.onWarn === 'function' ? options.onWarn : () => {};
|
|
770
|
+
const onInfo = typeof options?.onInfo === 'function' ? options.onInfo : () => { };
|
|
771
|
+
const onWarn = typeof options?.onWarn === 'function' ? options.onWarn : () => { };
|
|
772
772
|
const parser = createParser();
|
|
773
773
|
const serializer = createSerializer();
|
|
774
774
|
const xmlDoc = parser.parseFromString(documentXml, 'application/xml');
|
|
@@ -1079,8 +1079,8 @@ async function applyToParagraphByExactText(documentXml, targetText, modifiedText
|
|
|
1079
1079
|
|
|
1080
1080
|
async function applyHighlightToParagraphByExactText(documentXml, targetText, textToHighlight, color, author, targetRef = null, runtimeContext = null, options = {}) {
|
|
1081
1081
|
const generateRedlines = options.generateRedlines !== false;
|
|
1082
|
-
const onInfo = typeof options?.onInfo === 'function' ? options.onInfo : () => {};
|
|
1083
|
-
const onWarn = typeof options?.onWarn === 'function' ? options.onWarn : () => {};
|
|
1082
|
+
const onInfo = typeof options?.onInfo === 'function' ? options.onInfo : () => { };
|
|
1083
|
+
const onWarn = typeof options?.onWarn === 'function' ? options.onWarn : () => { };
|
|
1084
1084
|
const parser = createParser();
|
|
1085
1085
|
const serializer = createSerializer();
|
|
1086
1086
|
const xmlDoc = parser.parseFromString(documentXml, 'application/xml');
|
|
@@ -1098,8 +1098,8 @@ async function applyHighlightToParagraphByExactText(documentXml, targetText, tex
|
|
|
1098
1098
|
}
|
|
1099
1099
|
|
|
1100
1100
|
async function applyCommentToParagraphByExactText(documentXml, targetText, textToComment, commentContent, author, targetRef = null, runtimeContext = null, options = {}) {
|
|
1101
|
-
const onInfo = typeof options?.onInfo === 'function' ? options.onInfo : () => {};
|
|
1102
|
-
const onWarn = typeof options?.onWarn === 'function' ? options.onWarn : () => {};
|
|
1101
|
+
const onInfo = typeof options?.onInfo === 'function' ? options.onInfo : () => { };
|
|
1102
|
+
const onWarn = typeof options?.onWarn === 'function' ? options.onWarn : () => { };
|
|
1103
1103
|
const parser = createParser();
|
|
1104
1104
|
const serializer = createSerializer();
|
|
1105
1105
|
const xmlDoc = parser.parseFromString(documentXml, 'application/xml');
|