@bernierllc/markdown-parser 1.0.0 → 1.0.2
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/README.md +18 -3
- package/__tests__/MarkdownParser.test.ts +10 -6
- package/__tests__/ast-utils.test.ts +4 -4
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/src/MarkdownParser.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/plugins/commonmark.ts.html +1 -1
- package/coverage/lcov-report/src/plugins/gfm.ts.html +1 -1
- package/coverage/lcov-report/src/plugins/index.html +1 -1
- package/coverage/lcov-report/src/plugins/index.ts.html +1 -1
- package/coverage/lcov-report/src/utils/ast-utils.ts.html +1 -1
- package/coverage/lcov-report/src/utils/cache.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/jest.config.cjs +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -295,9 +295,24 @@ console.log('Speedup:', result1.metadata.parseTime / result2.metadata.parseTime,
|
|
|
295
295
|
|
|
296
296
|
## Integration Status
|
|
297
297
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
### Logger Integration
|
|
299
|
+
**Status**: Integrated
|
|
300
|
+
|
|
301
|
+
**Justification**: This package uses `@bernierllc/logger` for debug output during markdown parsing operations. Logging includes parse timing, cache hits/misses, and error details to help with debugging and performance monitoring.
|
|
302
|
+
|
|
303
|
+
**Pattern**: Direct integration - logger is a required dependency for this package.
|
|
304
|
+
|
|
305
|
+
### NeverHub Integration
|
|
306
|
+
**Status**: Not applicable
|
|
307
|
+
|
|
308
|
+
**Justification**: This is a core utility package that performs markdown parsing. It does not participate in service discovery, event publishing, or service mesh operations. Markdown parsing is a stateless utility operation that doesn't require service registration or discovery.
|
|
309
|
+
|
|
310
|
+
**Pattern**: Core utility - no service mesh integration needed.
|
|
311
|
+
|
|
312
|
+
### Docs-Suite Integration
|
|
313
|
+
**Status**: Ready
|
|
314
|
+
|
|
315
|
+
**Format**: TypeDoc-compatible JSDoc comments are included throughout the source code. All public APIs are documented with examples and type information.
|
|
301
316
|
|
|
302
317
|
## Performance
|
|
303
318
|
|
|
@@ -674,8 +674,10 @@ describe('MarkdownParser', () => {
|
|
|
674
674
|
const parser = new MarkdownParser();
|
|
675
675
|
|
|
676
676
|
// Mock parseToAST to throw error
|
|
677
|
-
|
|
678
|
-
|
|
677
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
678
|
+
const parserWithPrivate = parser as any;
|
|
679
|
+
const originalParseToAST = parserWithPrivate.parseToAST.bind(parser);
|
|
680
|
+
parserWithPrivate.parseToAST = jest.fn().mockRejectedValue(new Error('Parse failed'));
|
|
679
681
|
|
|
680
682
|
const result = await parser.parse('# Test');
|
|
681
683
|
|
|
@@ -684,15 +686,17 @@ describe('MarkdownParser', () => {
|
|
|
684
686
|
expect(result.ast).toBeUndefined();
|
|
685
687
|
|
|
686
688
|
// Restore original method
|
|
687
|
-
|
|
689
|
+
parserWithPrivate.parseToAST = originalParseToAST;
|
|
688
690
|
});
|
|
689
691
|
|
|
690
692
|
it('should handle unknown errors', async () => {
|
|
691
693
|
const parser = new MarkdownParser();
|
|
692
694
|
|
|
693
695
|
// Mock parseToAST to throw non-Error
|
|
694
|
-
|
|
695
|
-
|
|
696
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
697
|
+
const parserWithPrivate = parser as any;
|
|
698
|
+
const originalParseToAST = parserWithPrivate.parseToAST.bind(parser);
|
|
699
|
+
parserWithPrivate.parseToAST = jest.fn().mockRejectedValue('String error');
|
|
696
700
|
|
|
697
701
|
const result = await parser.parse('# Test');
|
|
698
702
|
|
|
@@ -700,7 +704,7 @@ describe('MarkdownParser', () => {
|
|
|
700
704
|
expect(result.error).toBe('Unknown parse error');
|
|
701
705
|
|
|
702
706
|
// Restore original method
|
|
703
|
-
|
|
707
|
+
parserWithPrivate.parseToAST = originalParseToAST;
|
|
704
708
|
});
|
|
705
709
|
});
|
|
706
710
|
|
|
@@ -232,18 +232,18 @@ describe('AST Utilities', () => {
|
|
|
232
232
|
|
|
233
233
|
it('should not affect original when modifying clone', () => {
|
|
234
234
|
const cloned = cloneNode(sampleAST);
|
|
235
|
-
(cloned as
|
|
235
|
+
(cloned as unknown as { type: string }).type = 'modified';
|
|
236
236
|
|
|
237
237
|
expect(sampleAST.type).toBe('root');
|
|
238
|
-
expect((cloned as
|
|
238
|
+
expect((cloned as unknown as { type: string }).type).toBe('modified');
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
it('should clone children deeply', () => {
|
|
242
242
|
const cloned = cloneNode(sampleAST);
|
|
243
|
-
(cloned.children![0] as
|
|
243
|
+
(cloned.children![0] as unknown as { type: string }).type = 'modified';
|
|
244
244
|
|
|
245
245
|
expect(sampleAST.children![0].type).toBe('heading');
|
|
246
|
-
expect((cloned.children![0] as
|
|
246
|
+
expect((cloned.children![0] as unknown as { type: string }).type).toBe('modified');
|
|
247
247
|
});
|
|
248
248
|
|
|
249
249
|
it('should clone attributes', () => {
|
package/coverage/clover.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
2
|
+
<coverage generated="1764635760703" clover="3.2.0">
|
|
3
|
+
<project timestamp="1764635760703" name="All files">
|
|
4
4
|
<metrics statements="250" coveredstatements="244" conditionals="91" coveredconditionals="87" methods="31" coveredmethods="30" elements="372" coveredelements="361" complexity="0" loc="250" ncloc="250" packages="3" files="6" classes="6"/>
|
|
5
5
|
<package name="src">
|
|
6
6
|
<metrics statements="188" coveredstatements="185" conditionals="74" coveredconditionals="72" methods="15" coveredmethods="15"/>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
132
132
|
Code coverage generated by
|
|
133
133
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
134
|
-
at 2025-
|
|
134
|
+
at 2025-12-02T00:36:00.696Z
|
|
135
135
|
</div>
|
|
136
136
|
<script src="prettify.js"></script>
|
|
137
137
|
<script>
|
|
@@ -1621,7 +1621,7 @@ export class MarkdownParser {
|
|
|
1621
1621
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1622
1622
|
Code coverage generated by
|
|
1623
1623
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1624
|
-
at 2025-
|
|
1624
|
+
at 2025-12-02T00:36:00.696Z
|
|
1625
1625
|
</div>
|
|
1626
1626
|
<script src="../prettify.js"></script>
|
|
1627
1627
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2025-
|
|
104
|
+
at 2025-12-02T00:36:00.696Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -139,7 +139,7 @@ export const commonmarkPlugin: MarkdownPlugin = {
|
|
|
139
139
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
140
140
|
Code coverage generated by
|
|
141
141
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
142
|
-
at 2025-
|
|
142
|
+
at 2025-12-02T00:36:00.696Z
|
|
143
143
|
</div>
|
|
144
144
|
<script src="../../prettify.js"></script>
|
|
145
145
|
<script>
|
|
@@ -139,7 +139,7 @@ export const gfmPlugin: MarkdownPlugin = {
|
|
|
139
139
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
140
140
|
Code coverage generated by
|
|
141
141
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
142
|
-
at 2025-
|
|
142
|
+
at 2025-12-02T00:36:00.696Z
|
|
143
143
|
</div>
|
|
144
144
|
<script src="../../prettify.js"></script>
|
|
145
145
|
<script>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
132
132
|
Code coverage generated by
|
|
133
133
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
134
|
-
at 2025-
|
|
134
|
+
at 2025-12-02T00:36:00.696Z
|
|
135
135
|
</div>
|
|
136
136
|
<script src="../../prettify.js"></script>
|
|
137
137
|
<script>
|
|
@@ -100,7 +100,7 @@ Redistribution or use in other products or commercial offerings is not permitted
|
|
|
100
100
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
101
101
|
Code coverage generated by
|
|
102
102
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
103
|
-
at 2025-
|
|
103
|
+
at 2025-12-02T00:36:00.696Z
|
|
104
104
|
</div>
|
|
105
105
|
<script src="../../prettify.js"></script>
|
|
106
106
|
<script>
|
|
@@ -313,7 +313,7 @@ export function cloneNode(node: ASTNode): ASTNode {
|
|
|
313
313
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
314
314
|
Code coverage generated by
|
|
315
315
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
316
|
-
at 2025-
|
|
316
|
+
at 2025-12-02T00:36:00.696Z
|
|
317
317
|
</div>
|
|
318
318
|
<script src="../../prettify.js"></script>
|
|
319
319
|
<script>
|
|
@@ -388,7 +388,7 @@ export class CacheManager {
|
|
|
388
388
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
389
389
|
Code coverage generated by
|
|
390
390
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
391
|
-
at 2025-
|
|
391
|
+
at 2025-12-02T00:36:00.696Z
|
|
392
392
|
</div>
|
|
393
393
|
<script src="../../prettify.js"></script>
|
|
394
394
|
<script>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2025-
|
|
119
|
+
at 2025-12-02T00:36:00.696Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="../../prettify.js"></script>
|
|
122
122
|
<script>
|
package/jest.config.cjs
CHANGED
|
@@ -8,7 +8,8 @@ Redistribution or use in other products or commercial offerings is not permitted
|
|
|
8
8
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
preset: 'ts-jest',
|
|
11
|
-
|
|
11
|
+
// Use fixed environment to handle Node.js v25+ localStorage issue
|
|
12
|
+
testEnvironment: '<rootDir>/../../../../jest-environment-node-fixed.cjs',
|
|
12
13
|
collectCoverageFrom: [
|
|
13
14
|
'src/**/*.{ts,tsx}',
|
|
14
15
|
'!src/**/*.d.ts',
|