@bernierllc/markdown-parser 1.2.5 → 1.5.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.
- package/dist/MarkdownParser.js +3 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/utils/cache.js +3 -0
- package/package.json +7 -3
- package/.eslintrc.js +0 -27
- package/CHANGELOG.md +0 -116
- package/__tests__/MarkdownParser.test.ts +0 -791
- package/__tests__/ast-utils.test.ts +0 -319
- package/__tests__/cache.test.ts +0 -243
- package/__tests__/plugins.test.ts +0 -282
- package/jest.config.cjs +0 -29
- package/src/MarkdownParser.ts +0 -517
- package/src/index.ts +0 -13
- package/src/plugins/commonmark.ts +0 -23
- package/src/plugins/gfm.ts +0 -23
- package/src/plugins/index.ts +0 -10
- package/src/types.ts +0 -114
- package/src/utils/ast-utils.ts +0 -81
- package/src/utils/cache.ts +0 -106
- package/tsconfig.json +0 -30
package/dist/MarkdownParser.js
CHANGED
|
@@ -14,6 +14,9 @@ const ast_utils_1 = require("./utils/ast-utils");
|
|
|
14
14
|
* High-performance markdown parser with caching and plugin support
|
|
15
15
|
*/
|
|
16
16
|
class MarkdownParser {
|
|
17
|
+
config;
|
|
18
|
+
cacheManager;
|
|
19
|
+
logger;
|
|
17
20
|
constructor(config) {
|
|
18
21
|
this.config = {
|
|
19
22
|
gfm: config?.gfm ?? true,
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type MarkdownParserErrorCode = 'MARKDOWN_PARSER_ERROR' | 'INVALID_INPUT' | 'OPERATION_FAILED';
|
|
2
|
+
export interface MarkdownParserErrorOptions {
|
|
3
|
+
cause?: Error;
|
|
4
|
+
code?: MarkdownParserErrorCode;
|
|
5
|
+
context?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare class MarkdownParserError extends Error {
|
|
8
|
+
readonly code: MarkdownParserErrorCode;
|
|
9
|
+
readonly context?: Record<string, unknown>;
|
|
10
|
+
constructor(message: string, options?: MarkdownParserErrorOptions);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,uBAAuB,GAC/B,uBAAuB,GACvB,eAAe,GACf,kBAAkB,CAAC;AAEvB,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,uBAAuB,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAE/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,0BAA0B;CASlE"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (c) 2025 Bernier LLC
|
|
4
|
+
|
|
5
|
+
This file is licensed to the client under a limited-use license.
|
|
6
|
+
The client may use and modify this code only within the scope of the project it was delivered for.
|
|
7
|
+
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MarkdownParserError = void 0;
|
|
11
|
+
class MarkdownParserError extends Error {
|
|
12
|
+
code;
|
|
13
|
+
context;
|
|
14
|
+
constructor(message, options) {
|
|
15
|
+
super(message, options?.cause ? { cause: options.cause } : undefined);
|
|
16
|
+
this.name = 'MarkdownParserError';
|
|
17
|
+
this.code = options?.code ?? 'MARKDOWN_PARSER_ERROR';
|
|
18
|
+
if (options?.context !== undefined) {
|
|
19
|
+
this.context = options.context;
|
|
20
|
+
}
|
|
21
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.MarkdownParserError = MarkdownParserError;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ export * from './types';
|
|
|
3
3
|
export * from './plugins';
|
|
4
4
|
export * from './utils/ast-utils';
|
|
5
5
|
export { CacheManager } from './utils/cache';
|
|
6
|
+
export { MarkdownParserError } from './errors';
|
|
7
|
+
export type { MarkdownParserErrorCode, MarkdownParserErrorOptions, } from './errors';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,YAAY,EACV,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.CacheManager = exports.MarkdownParser = void 0;
|
|
24
|
+
exports.MarkdownParserError = exports.CacheManager = exports.MarkdownParser = void 0;
|
|
25
25
|
var MarkdownParser_1 = require("./MarkdownParser");
|
|
26
26
|
Object.defineProperty(exports, "MarkdownParser", { enumerable: true, get: function () { return MarkdownParser_1.MarkdownParser; } });
|
|
27
27
|
__exportStar(require("./types"), exports);
|
|
@@ -29,3 +29,6 @@ __exportStar(require("./plugins"), exports);
|
|
|
29
29
|
__exportStar(require("./utils/ast-utils"), exports);
|
|
30
30
|
var cache_1 = require("./utils/cache");
|
|
31
31
|
Object.defineProperty(exports, "CacheManager", { enumerable: true, get: function () { return cache_1.CacheManager; } });
|
|
32
|
+
// Errors
|
|
33
|
+
var errors_1 = require("./errors");
|
|
34
|
+
Object.defineProperty(exports, "MarkdownParserError", { enumerable: true, get: function () { return errors_1.MarkdownParserError; } });
|
package/dist/utils/cache.js
CHANGED
|
@@ -13,6 +13,9 @@ const crypto_1 = require("crypto");
|
|
|
13
13
|
* Cache manager for parsed markdown AST
|
|
14
14
|
*/
|
|
15
15
|
class CacheManager {
|
|
16
|
+
cache;
|
|
17
|
+
maxSize;
|
|
18
|
+
ttl; // Time to live in seconds
|
|
16
19
|
constructor(maxSize = 1000, ttl = 3600) {
|
|
17
20
|
this.cache = new Map();
|
|
18
21
|
this.maxSize = maxSize;
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/markdown-parser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "High-performance markdown parser with CommonMark, GFM, and plugin support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
7
11
|
"keywords": [
|
|
8
12
|
"markdown",
|
|
9
13
|
"parser",
|
|
@@ -15,8 +19,8 @@
|
|
|
15
19
|
"author": "Bernier LLC",
|
|
16
20
|
"license": "SEE LICENSE IN LICENSE",
|
|
17
21
|
"dependencies": {
|
|
18
|
-
"@bernierllc/logger": "1.
|
|
19
|
-
"@bernierllc/crypto-utils": "1.
|
|
22
|
+
"@bernierllc/logger": "1.7.0",
|
|
23
|
+
"@bernierllc/crypto-utils": "1.4.0"
|
|
20
24
|
},
|
|
21
25
|
"devDependencies": {
|
|
22
26
|
"@types/jest": "^29.0.0",
|
package/.eslintrc.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2025 Bernier LLC
|
|
3
|
-
|
|
4
|
-
This file is licensed to the client under a limited-use license.
|
|
5
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
parser: '@typescript-eslint/parser',
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 2020,
|
|
13
|
-
sourceType: 'module',
|
|
14
|
-
},
|
|
15
|
-
extends: [
|
|
16
|
-
'eslint:recommended',
|
|
17
|
-
'plugin:@typescript-eslint/recommended',
|
|
18
|
-
],
|
|
19
|
-
rules: {
|
|
20
|
-
'@typescript-eslint/no-explicit-any': 'error',
|
|
21
|
-
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
22
|
-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
23
|
-
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
|
|
24
|
-
'no-regex-spaces': 'off',
|
|
25
|
-
'no-useless-escape': 'off',
|
|
26
|
-
},
|
|
27
|
-
};
|
package/CHANGELOG.md
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [1.2.5](https://github.com/bernierllc/tools/compare/@bernierllc/markdown-parser@1.2.4...@bernierllc/markdown-parser@1.2.5) (2026-05-19)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @bernierllc/markdown-parser
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [1.2.4](https://github.com/bernierllc/tools/compare/@bernierllc/markdown-parser@1.2.3...@bernierllc/markdown-parser@1.2.4) (2026-05-19)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @bernierllc/markdown-parser
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [1.2.3](https://github.com/bernierllc/tools/compare/@bernierllc/markdown-parser@1.2.2...@bernierllc/markdown-parser@1.2.3) (2026-03-30)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @bernierllc/markdown-parser
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## [1.2.2](https://github.com/bernierllc/tools/compare/@bernierllc/markdown-parser@1.2.1...@bernierllc/markdown-parser@1.2.2) (2026-03-09)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @bernierllc/markdown-parser
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## [1.2.1](https://github.com/bernierllc/tools/compare/@bernierllc/markdown-parser@1.2.0...@bernierllc/markdown-parser@1.2.1) (2026-03-03)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Bug Fixes
|
|
42
|
-
|
|
43
|
-
* set all packages to public access and fix workspace peer deps ([9b15570](https://github.com/bernierllc/tools/commit/9b15570ad8fbd6b25eef099d5dfc2e5e326ae004))
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# 1.2.0 (2025-12-25)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
### Bug Fixes
|
|
53
|
-
|
|
54
|
-
* **ci:** add lerna version step before publish ([3d20300](https://github.com/bernierllc/tools/commit/3d203002143bf353fffafe4f8a78a99009567347))
|
|
55
|
-
* **ci:** correct jest testEnvironment paths for CI ([c47144c](https://github.com/bernierllc/tools/commit/c47144c3d78aec2be1e1454066c235c2227823fd))
|
|
56
|
-
* **ci:** fix release workflow + convert internal deps to workspace:* ([01c078b](https://github.com/bernierllc/tools/commit/01c078b49d6025f7eef750f79207a1c71c8d85dc))
|
|
57
|
-
* **jest:** resolve Node.js v25+ localStorage SecurityError ([8ffc512](https://github.com/bernierllc/tools/commit/8ffc512805519bc5ba523bdbcd1c457e84998c9e))
|
|
58
|
-
* update neverhub-adapter deps to workspace:* and publish 0.1.2 ([f0e3d04](https://github.com/bernierllc/tools/commit/f0e3d04d8d4f094e3bb899ddf81e93243d16e2c2))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### Features
|
|
62
|
-
|
|
63
|
-
* **core:** add ai-response-parser and markdown-parser packages (Wave 8) ([23cb706](https://github.com/bernierllc/tools/commit/23cb70629713b68790295f47e906b67b423084ea))
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# 1.1.0 (2025-12-25)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
### Bug Fixes
|
|
73
|
-
|
|
74
|
-
* **ci:** correct jest testEnvironment paths for CI ([c47144c](https://github.com/bernierllc/tools/commit/c47144c3d78aec2be1e1454066c235c2227823fd))
|
|
75
|
-
* **ci:** fix release workflow + convert internal deps to workspace:* ([01c078b](https://github.com/bernierllc/tools/commit/01c078b49d6025f7eef750f79207a1c71c8d85dc))
|
|
76
|
-
* **jest:** resolve Node.js v25+ localStorage SecurityError ([8ffc512](https://github.com/bernierllc/tools/commit/8ffc512805519bc5ba523bdbcd1c457e84998c9e))
|
|
77
|
-
* update neverhub-adapter deps to workspace:* and publish 0.1.2 ([f0e3d04](https://github.com/bernierllc/tools/commit/f0e3d04d8d4f094e3bb899ddf81e93243d16e2c2))
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### Features
|
|
81
|
-
|
|
82
|
-
* **core:** add ai-response-parser and markdown-parser packages (Wave 8) ([23cb706](https://github.com/bernierllc/tools/commit/23cb70629713b68790295f47e906b67b423084ea))
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
# @bernierllc/markdown-parser
|
|
89
|
-
|
|
90
|
-
## 1.0.6
|
|
91
|
-
|
|
92
|
-
### Patch Changes
|
|
93
|
-
|
|
94
|
-
- Updated dependencies [[`73c1d1e`](https://github.com/bernierllc/tools/commit/73c1d1e46114cf2ccfd5b74b83743361247f4502)]:
|
|
95
|
-
- @bernierllc/logger@1.1.0
|
|
96
|
-
|
|
97
|
-
## 1.0.5
|
|
98
|
-
|
|
99
|
-
### Patch Changes
|
|
100
|
-
|
|
101
|
-
- Updated dependencies [[`24899fa`](https://github.com/bernierllc/tools/commit/24899fa4eaf80ae329f7bd74483cf97a132f5d4c)]:
|
|
102
|
-
- @bernierllc/logger@1.0.4
|
|
103
|
-
|
|
104
|
-
## 1.0.4
|
|
105
|
-
|
|
106
|
-
### Patch Changes
|
|
107
|
-
|
|
108
|
-
- Updated dependencies [[`a314763`](https://github.com/bernierllc/tools/commit/a31476336717301e410da2b0b64c8f1ee44c0e8d)]:
|
|
109
|
-
- @bernierllc/crypto-utils@1.0.4
|
|
110
|
-
|
|
111
|
-
## 1.0.3
|
|
112
|
-
|
|
113
|
-
### Patch Changes
|
|
114
|
-
|
|
115
|
-
- Updated dependencies [[`a65f28c`](https://github.com/bernierllc/tools/commit/a65f28c2a1d09da8e8c7c23dcebd8f6606d9783f)]:
|
|
116
|
-
- @bernierllc/crypto-utils@1.0.3
|