@adeu/core 1.6.2 → 1.6.5

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/src/index.test.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { identifyEngine } from './index.js';
3
-
4
- describe('Core Engine', () => {
5
- it('should identify as adeu-core-node', () => {
6
- expect(identifyEngine()).toBe('adeu-core-node');
7
- });
1
+ import { describe, it, expect } from 'vitest';
2
+ import { identifyEngine } from './index.js';
3
+
4
+ describe('Core Engine', () => {
5
+ it('should identify as adeu-core-node', () => {
6
+ expect(identifyEngine()).toBe('adeu-core-node');
7
+ });
8
8
  });
package/src/index.ts CHANGED
@@ -1,14 +1,14 @@
1
- /**
2
- * @adeu/core
3
- * Cross-platform XML Redlining Engine
4
- */
5
- export const identifyEngine = () => 'adeu-core-node';
6
-
7
- export { extractTextFromBuffer } from './ingest.js';
8
- export { DocumentObject } from './docx/bridge.js';
9
- export { DocumentMapper, TextSpan } from './mapper.js';
10
- export { RedlineEngine, BatchValidationError } from './engine.js';
11
- export { generate_edits_from_text, trim_common_context } from './diff.js';
12
- export { apply_edits_to_markdown } from './markup.js';
13
- export { paginate, split_structural_appendix, PaginationResult, PageInfo } from './pagination.js';
1
+ /**
2
+ * @adeu/core
3
+ * Cross-platform XML Redlining Engine
4
+ */
5
+ export const identifyEngine = () => 'adeu-core-node';
6
+
7
+ export { extractTextFromBuffer } from './ingest.js';
8
+ export { DocumentObject } from './docx/bridge.js';
9
+ export { DocumentMapper, TextSpan } from './mapper.js';
10
+ export { RedlineEngine, BatchValidationError } from './engine.js';
11
+ export { generate_edits_from_text, trim_common_context } from './diff.js';
12
+ export { apply_edits_to_markdown } from './markup.js';
13
+ export { paginate, split_structural_appendix, PaginationResult, PageInfo } from './pagination.js';
14
14
  export { extract_outline, OutlineNode } from './outline.js';
@@ -1,44 +1,44 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { readFileSync } from 'node:fs';
3
- import { fileURLToPath } from 'node:url';
4
- import { dirname, resolve } from 'node:path';
5
- import { extractTextFromBuffer } from './ingest.js';
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
-
10
- describe('Ingestion Engine (Node.js Port)', () => {
11
- it('should successfully extract text and markup from golden.docx', async () => {
12
- // Resolve path across the monorepo boundary to the shared fixtures
13
- const fixturePath = resolve(__dirname, '../../../../shared/fixtures/golden.docx');
14
-
15
- // Read the physical file into a Node Buffer
16
- const buf = readFileSync(fixturePath);
17
-
18
- // Execute the ported Node extraction pipeline
19
- const markdown = await extractTextFromBuffer(buf);
20
-
21
- // Basic structural assertions
22
- expect(typeof markdown).toBe('string');
23
- expect(markdown.length).toBeGreaterThan(0);
24
-
25
- // Assert exact parity with the Python engine's CriticMarkup generation
26
- expect(markdown).toBe('This is the {--initial --}{++golden ++}{>>[Chg:3 delete] Mikko Korpela\n[Chg:4 insert] Mikko Korpela\n[Com:0] Mikko Korpela @ 2026-01-23T07:25:00Z: Start of comment thread\n[Com:1] Mikko Korpela @ 2026-01-23T07:25:00Z: Second comment\n[Com:2] Mikko Korpela @ 2026-01-23T07:26:00Z: Third comment in the thread<<}document');
27
- });
28
-
29
- it('should execute in cleanView mode without failing', async () => {
30
- const fixturePath = resolve(__dirname, '../../../../shared/fixtures/golden.docx');
31
- const buf = readFileSync(fixturePath);
32
-
33
- // Execute extraction simulating "Accept All Changes"
34
- const cleanMarkdown = await extractTextFromBuffer(buf, true);
35
-
36
- expect(typeof cleanMarkdown).toBe('string');
37
- // cleanView should not output raw CriticMarkup tracking markers
38
- expect(cleanMarkdown).not.toContain('{++');
39
- expect(cleanMarkdown).not.toContain('{--');
40
-
41
- // It should simulate "Accept All Changes" (initial -> golden)
42
- expect(cleanMarkdown).toBe('This is the golden document');
43
- });
1
+ import { describe, it, expect } from 'vitest';
2
+ import { readFileSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { dirname, resolve } from 'node:path';
5
+ import { extractTextFromBuffer } from './ingest.js';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ describe('Ingestion Engine (Node.js Port)', () => {
11
+ it('should successfully extract text and markup from golden.docx', async () => {
12
+ // Resolve path across the monorepo boundary to the shared fixtures
13
+ const fixturePath = resolve(__dirname, '../../../../shared/fixtures/golden.docx');
14
+
15
+ // Read the physical file into a Node Buffer
16
+ const buf = readFileSync(fixturePath);
17
+
18
+ // Execute the ported Node extraction pipeline
19
+ const markdown = await extractTextFromBuffer(buf);
20
+
21
+ // Basic structural assertions
22
+ expect(typeof markdown).toBe('string');
23
+ expect(markdown.length).toBeGreaterThan(0);
24
+
25
+ // Assert exact parity with the Python engine's CriticMarkup generation
26
+ expect(markdown).toBe('This is the {--initial --}{++golden ++}{>>[Chg:3 delete] Mikko Korpela\n[Chg:4 insert] Mikko Korpela\n[Com:0] Mikko Korpela @ 2026-01-23T07:25:00Z: Start of comment thread\n[Com:1] Mikko Korpela @ 2026-01-23T07:25:00Z: Second comment\n[Com:2] Mikko Korpela @ 2026-01-23T07:26:00Z: Third comment in the thread<<}document');
27
+ });
28
+
29
+ it('should execute in cleanView mode without failing', async () => {
30
+ const fixturePath = resolve(__dirname, '../../../../shared/fixtures/golden.docx');
31
+ const buf = readFileSync(fixturePath);
32
+
33
+ // Execute extraction simulating "Accept All Changes"
34
+ const cleanMarkdown = await extractTextFromBuffer(buf, true);
35
+
36
+ expect(typeof cleanMarkdown).toBe('string');
37
+ // cleanView should not output raw CriticMarkup tracking markers
38
+ expect(cleanMarkdown).not.toContain('{++');
39
+ expect(cleanMarkdown).not.toContain('{--');
40
+
41
+ // It should simulate "Accept All Changes" (initial -> golden)
42
+ expect(cleanMarkdown).toBe('This is the golden document');
43
+ });
44
44
  });