@hymarkx/ast 0.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/LICENSE-APACHE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The HyMarkX Authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @hymarkx/ast
2
+
3
+ **Shared AST types, diagnostics, and attribute handling**
4
+
5
+ The node types every other package speaks. No parsing, no rendering — types, spans, diagnostic construction, and the attribute rules that keep a document from reaching Object.prototype.
6
+
7
+ ```sh
8
+ npm install @hymarkx/ast
9
+ ```
10
+
11
+ Part of [HyMarkX](https://github.com/NAME0x0/HyMarkX) — a Markdown-compatible language that
12
+ stays Markdown until you ask it not to. A document containing no HMX construct renders as
13
+ CommonMark + GFM; that is enforced by a 692-example conformance suite and a compatibility
14
+ suite over real documents.
15
+
16
+ - [Documentation](https://github.com/NAME0x0/HyMarkX#readme)
17
+ - [Language specification](https://github.com/NAME0x0/HyMarkX/blob/main/SPEC.md)
18
+ - [Security policy](https://github.com/NAME0x0/HyMarkX/blob/main/SECURITY.md)
19
+
20
+ **Status: pre-release.** The syntax may change without a migration path, and HyMarkX must not
21
+ be used to render untrusted content in production yet.
22
+
23
+ Licensed under MIT OR Apache-2.0.
@@ -0,0 +1,12 @@
1
+ import type { Attribute, AttributeList } from './types.js';
2
+ /** Returns the last attribute with the requested name. */
3
+ export declare function getAttribute(list: AttributeList, name: string): Attribute | undefined;
4
+ /** Returns the last matching attribute's value while preserving bare attributes as `null`. */
5
+ export declare function getAttributeValue(list: AttributeList, name: string): string | null | undefined;
6
+ /** Reports whether an attribute name occurs at least once. */
7
+ export declare function hasAttribute(list: AttributeList, name: string): boolean;
8
+ /** Reports whether a name could target JavaScript object prototype machinery. */
9
+ export declare function isForbiddenAttributeName(name: string): boolean;
10
+ /** Converts attributes to a null-prototype record, with last occurrence winning. */
11
+ export declare function toAttributeRecord(list: AttributeList): Record<string, string | null>;
12
+ //# sourceMappingURL=attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1D,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CASrF;AAED,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAE9F;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAUpF"}
@@ -0,0 +1,33 @@
1
+ /** Returns the last attribute with the requested name. */
2
+ export function getAttribute(list, name) {
3
+ for (let index = list.length - 1; index >= 0; index -= 1) {
4
+ const attribute = list[index];
5
+ if (attribute?.name === name) {
6
+ return attribute;
7
+ }
8
+ }
9
+ return undefined;
10
+ }
11
+ /** Returns the last matching attribute's value while preserving bare attributes as `null`. */
12
+ export function getAttributeValue(list, name) {
13
+ return getAttribute(list, name)?.value;
14
+ }
15
+ /** Reports whether an attribute name occurs at least once. */
16
+ export function hasAttribute(list, name) {
17
+ return getAttribute(list, name) !== undefined;
18
+ }
19
+ /** Reports whether a name could target JavaScript object prototype machinery. */
20
+ export function isForbiddenAttributeName(name) {
21
+ return name === '__proto__' || name === 'constructor' || name === 'prototype';
22
+ }
23
+ /** Converts attributes to a null-prototype record, with last occurrence winning. */
24
+ export function toAttributeRecord(list) {
25
+ const record = Object.create(null);
26
+ for (const attribute of list) {
27
+ if (!isForbiddenAttributeName(attribute.name)) {
28
+ record[attribute.name] = attribute.value;
29
+ }
30
+ }
31
+ return record;
32
+ }
33
+ //# sourceMappingURL=attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.js","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAEA,0DAA0D;AAC1D,MAAM,UAAU,YAAY,CAAC,IAAmB,EAAE,IAAY;IAC5D,KAAK,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;QAC7B,IAAI,SAAS,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,iBAAiB,CAAC,IAAmB,EAAE,IAAY;IACjE,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,CAAA;AACxC,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,YAAY,CAAC,IAAmB,EAAE,IAAY;IAC5D,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,SAAS,CAAA;AAC/C,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,WAAW,CAAA;AAC/E,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,iBAAiB,CAAC,IAAmB;IACnD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAkC,CAAA;IAEnE,KAAK,MAAM,SAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,CAAA;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { AttributeList, BlockContent, Blockquote, Break, Code, ContainerDirective, Definition, Delete, Emphasis, Heading, Html, Image, ImageReference, InlineCode, Interpolation, LeafDirective, Link, LinkReference, List, ListItem, Paragraph, PhrasingContent, Root, Span, Strong, Table, TableCell, TableRow, Text, TextDirective, ThematicBreak, Yaml } from './types.js';
2
+ /** Creates a document root node. */
3
+ export declare function root(hmxVersion: string, children: Root['children'], position?: Span): Root;
4
+ /** Creates a YAML frontmatter node without parsing its value. */
5
+ export declare function yaml(value: string, position?: Span): Yaml;
6
+ /** Creates a paragraph node. */
7
+ export declare function paragraph(children: PhrasingContent[], position?: Span): Paragraph;
8
+ /** Creates a heading node. */
9
+ export declare function heading(depth: Heading['depth'], children: PhrasingContent[], position?: Span): Heading;
10
+ /** Creates a thematic-break node. */
11
+ export declare function thematicBreak(position?: Span): ThematicBreak;
12
+ /** Creates a block-quote node. */
13
+ export declare function blockquote(children: Array<BlockContent | Definition>, position?: Span): Blockquote;
14
+ /** Creates an ordered or unordered list node. */
15
+ export declare function list(ordered: boolean, start: number | null, spread: boolean, children: ListItem[], position?: Span): List;
16
+ /** Creates a list-item node. */
17
+ export declare function listItem(spread: boolean, checked: boolean | null, children: Array<BlockContent | Definition>, position?: Span): ListItem;
18
+ /** Creates a code-block node. */
19
+ export declare function code(lang: string | null, meta: string | null, value: string, position?: Span): Code;
20
+ /** Creates a raw-HTML node. */
21
+ export declare function html(value: string, position?: Span): Html;
22
+ /** Creates a plain-text node. */
23
+ export declare function text(value: string, position?: Span): Text;
24
+ /** Creates a raw compile-time interpolation node. */
25
+ export declare function interpolation(value: string, position?: Span): Interpolation;
26
+ /** Creates an emphasis node. */
27
+ export declare function emphasis(children: PhrasingContent[], position?: Span): Emphasis;
28
+ /** Creates a strong-emphasis node. */
29
+ export declare function strong(children: PhrasingContent[], position?: Span): Strong;
30
+ /** Creates a GFM strikethrough node. */
31
+ declare const createDelete: (children: PhrasingContent[], position?: Span) => Delete;
32
+ /** Creates an inline-code node. */
33
+ export declare function inlineCode(value: string, position?: Span): InlineCode;
34
+ /** Creates a hard-line-break node. */
35
+ declare const createBreak: (position?: Span) => Break;
36
+ /** Creates a link node. */
37
+ export declare function link(url: string, title: string | null, children: PhrasingContent[], position?: Span): Link;
38
+ /** Creates an image node. */
39
+ export declare function image(url: string, title: string | null, alt: string | null, position?: Span): Image;
40
+ /** Creates a link or image definition node. */
41
+ export declare function definition(identifier: string, label: string | null, url: string, title: string | null, position?: Span): Definition;
42
+ /** Creates a definition-backed link node. */
43
+ export declare function linkReference(identifier: string, label: string | null, referenceType: LinkReference['referenceType'], children: PhrasingContent[], position?: Span): LinkReference;
44
+ /** Creates a definition-backed image node. */
45
+ export declare function imageReference(identifier: string, label: string | null, referenceType: ImageReference['referenceType'], alt: string | null, position?: Span): ImageReference;
46
+ /** Creates a GFM table node. */
47
+ export declare function table(align: Table['align'], children: TableRow[], position?: Span): Table;
48
+ /** Creates a GFM table-row node. */
49
+ export declare function tableRow(children: TableCell[], position?: Span): TableRow;
50
+ /** Creates a GFM table-cell node. */
51
+ export declare function tableCell(children: PhrasingContent[], position?: Span): TableCell;
52
+ /** Creates an inline HMX directive node. */
53
+ export declare function textDirective(name: string, attributes: AttributeList, children: PhrasingContent[], position?: Span): TextDirective;
54
+ /** Creates a leaf HMX directive node. */
55
+ export declare function leafDirective(name: string, attributes: AttributeList, label?: PhrasingContent[] | undefined, position?: Span): LeafDirective;
56
+ /** Creates a container HMX directive node. */
57
+ export declare function containerDirective(name: string, attributes: AttributeList, label: PhrasingContent[] | undefined, children: BlockContent[], position?: Span): ContainerDirective;
58
+ export { createBreak as break, createDelete as delete };
59
+ //# sourceMappingURL=builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,KAAK,EACL,IAAI,EACJ,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,IAAI,EACJ,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,eAAe,EACf,IAAI,EACJ,IAAI,EACJ,MAA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,GAAE,IAAqB,GAC9B,aAAa,CAEf;AAED,yCAAyC;AACzC,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,aAAa,EACzB,KAAK,GAAE,eAAe,EAAE,GAAG,SAAqB,EAChD,QAAQ,GAAE,IAAqB,GAC9B,aAAa,CAMf;AAED,8CAA8C;AAC9C,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,aAAa,EACzB,KAAK,EAAE,eAAe,EAAE,GAAG,SAAS,EACpC,QAAQ,EAAE,YAAY,EAAE,EACxB,QAAQ,GAAE,IAAqB,GAC9B,kBAAkB,CAMpB;AAED,OAAO,EAAE,WAAW,IAAI,KAAK,EAAE,YAAY,IAAI,MAAM,EAAE,CAAA"}
@@ -0,0 +1,124 @@
1
+ import { SYNTHETIC_SPAN } from './spans.js';
2
+ /** Creates a document root node. */
3
+ export function root(hmxVersion, children, position = SYNTHETIC_SPAN) {
4
+ return { type: 'root', hmxVersion, children, position };
5
+ }
6
+ /** Creates a YAML frontmatter node without parsing its value. */
7
+ export function yaml(value, position = SYNTHETIC_SPAN) {
8
+ return { type: 'yaml', value, position };
9
+ }
10
+ /** Creates a paragraph node. */
11
+ export function paragraph(children, position = SYNTHETIC_SPAN) {
12
+ return { type: 'paragraph', children, position };
13
+ }
14
+ /** Creates a heading node. */
15
+ export function heading(depth, children, position = SYNTHETIC_SPAN) {
16
+ return { type: 'heading', depth, children, position };
17
+ }
18
+ /** Creates a thematic-break node. */
19
+ export function thematicBreak(position = SYNTHETIC_SPAN) {
20
+ return { type: 'thematicBreak', position };
21
+ }
22
+ /** Creates a block-quote node. */
23
+ export function blockquote(children, position = SYNTHETIC_SPAN) {
24
+ return { type: 'blockquote', children, position };
25
+ }
26
+ /** Creates an ordered or unordered list node. */
27
+ export function list(ordered, start, spread, children, position = SYNTHETIC_SPAN) {
28
+ return { type: 'list', ordered, start, spread, children, position };
29
+ }
30
+ /** Creates a list-item node. */
31
+ export function listItem(spread, checked, children, position = SYNTHETIC_SPAN) {
32
+ return { type: 'listItem', spread, checked, children, position };
33
+ }
34
+ /** Creates a code-block node. */
35
+ export function code(lang, meta, value, position = SYNTHETIC_SPAN) {
36
+ return { type: 'code', lang, meta, value, position };
37
+ }
38
+ /** Creates a raw-HTML node. */
39
+ export function html(value, position = SYNTHETIC_SPAN) {
40
+ return { type: 'html', value, position };
41
+ }
42
+ /** Creates a plain-text node. */
43
+ export function text(value, position = SYNTHETIC_SPAN) {
44
+ return { type: 'text', value, position };
45
+ }
46
+ /** Creates a raw compile-time interpolation node. */
47
+ export function interpolation(value, position = SYNTHETIC_SPAN) {
48
+ return { type: 'interpolation', value, position };
49
+ }
50
+ /** Creates an emphasis node. */
51
+ export function emphasis(children, position = SYNTHETIC_SPAN) {
52
+ return { type: 'emphasis', children, position };
53
+ }
54
+ /** Creates a strong-emphasis node. */
55
+ export function strong(children, position = SYNTHETIC_SPAN) {
56
+ return { type: 'strong', children, position };
57
+ }
58
+ /** Creates a GFM strikethrough node. */
59
+ const createDelete = (children, position = SYNTHETIC_SPAN) => ({
60
+ type: 'delete',
61
+ children,
62
+ position,
63
+ });
64
+ /** Creates an inline-code node. */
65
+ export function inlineCode(value, position = SYNTHETIC_SPAN) {
66
+ return { type: 'inlineCode', value, position };
67
+ }
68
+ /** Creates a hard-line-break node. */
69
+ const createBreak = (position = SYNTHETIC_SPAN) => ({
70
+ type: 'break',
71
+ position,
72
+ });
73
+ /** Creates a link node. */
74
+ export function link(url, title, children, position = SYNTHETIC_SPAN) {
75
+ return { type: 'link', url, title, children, position };
76
+ }
77
+ /** Creates an image node. */
78
+ export function image(url, title, alt, position = SYNTHETIC_SPAN) {
79
+ return { type: 'image', url, title, alt, position };
80
+ }
81
+ /** Creates a link or image definition node. */
82
+ export function definition(identifier, label, url, title, position = SYNTHETIC_SPAN) {
83
+ return { type: 'definition', identifier, label, url, title, position };
84
+ }
85
+ /** Creates a definition-backed link node. */
86
+ export function linkReference(identifier, label, referenceType, children, position = SYNTHETIC_SPAN) {
87
+ return { type: 'linkReference', identifier, label, referenceType, children, position };
88
+ }
89
+ /** Creates a definition-backed image node. */
90
+ export function imageReference(identifier, label, referenceType, alt, position = SYNTHETIC_SPAN) {
91
+ return { type: 'imageReference', identifier, label, referenceType, alt, position };
92
+ }
93
+ /** Creates a GFM table node. */
94
+ export function table(align, children, position = SYNTHETIC_SPAN) {
95
+ return { type: 'table', align, children, position };
96
+ }
97
+ /** Creates a GFM table-row node. */
98
+ export function tableRow(children, position = SYNTHETIC_SPAN) {
99
+ return { type: 'tableRow', children, position };
100
+ }
101
+ /** Creates a GFM table-cell node. */
102
+ export function tableCell(children, position = SYNTHETIC_SPAN) {
103
+ return { type: 'tableCell', children, position };
104
+ }
105
+ /** Creates an inline HMX directive node. */
106
+ export function textDirective(name, attributes, children, position = SYNTHETIC_SPAN) {
107
+ return { type: 'textDirective', name, attributes, children, position };
108
+ }
109
+ /** Creates a leaf HMX directive node. */
110
+ export function leafDirective(name, attributes, label = undefined, position = SYNTHETIC_SPAN) {
111
+ if (label === undefined) {
112
+ return { type: 'leafDirective', name, attributes, position };
113
+ }
114
+ return { type: 'leafDirective', name, attributes, label, position };
115
+ }
116
+ /** Creates a container HMX directive node. */
117
+ export function containerDirective(name, attributes, label, children, position = SYNTHETIC_SPAN) {
118
+ if (label === undefined) {
119
+ return { type: 'containerDirective', name, attributes, children, position };
120
+ }
121
+ return { type: 'containerDirective', name, attributes, label, children, position };
122
+ }
123
+ export { createBreak as break, createDelete as delete };
124
+ //# sourceMappingURL=builders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.js","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAoC3C,oCAAoC;AACpC,MAAM,UAAU,IAAI,CAClB,UAAkB,EAClB,QAA0B,EAC1B,QAAQ,GAAS,cAAc;IAE/B,OAAO,EAAE,IAAI,EAA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E,UAAU,EAAE,QAAQ,EAAE,CAAA;IAC9D,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;AACrE,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,kBAAkB,CAChC,IAAY,EACZ,UAAyB,EACzB,KAAoC,EACpC,QAAwB,EACxB,QAAQ,GAAS,cAAc;IAE/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;IAC7E,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AACpF,CAAC;AAED,OAAO,EAAE,WAAW,IAAI,KAAK,EAAE,YAAY,IAAI,MAAM,EAAE,CAAA"}
@@ -0,0 +1,30 @@
1
+ import type { Span } from './types.js';
2
+ /** The importance assigned to a diagnostic. */
3
+ export type Severity = 'error' | 'warning' | 'info';
4
+ /** Additional source context associated with a diagnostic. */
5
+ export interface RelatedSpan {
6
+ readonly message: string;
7
+ readonly span: Span;
8
+ }
9
+ /** A machine-applicable source replacement suggested by a diagnostic. */
10
+ export interface Suggestion {
11
+ readonly message: string;
12
+ readonly span: Span;
13
+ readonly replacement: string;
14
+ }
15
+ /** A stable, source-located parser or compiler message. */
16
+ export interface Diagnostic {
17
+ readonly code: string;
18
+ readonly severity: Severity;
19
+ readonly message: string;
20
+ readonly span: Span;
21
+ readonly expected?: string;
22
+ readonly suggestion?: Suggestion;
23
+ readonly related?: readonly RelatedSpan[];
24
+ readonly url?: string;
25
+ }
26
+ /** Validates and returns a diagnostic supplied by a parser or compiler stage. */
27
+ export declare const createDiagnostic: (diagnostic: Diagnostic) => Diagnostic;
28
+ /** Reports whether a diagnostic list contains at least one error. */
29
+ export declare const hasErrors: (diagnostics: readonly Diagnostic[]) => boolean;
30
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,+CAA+C;AAC/C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAEnD,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CACpB;AAED,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAA;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAA;IACzC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACtB;AAID,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,eAAgB,UAAU,KAAG,UAMzD,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,SAAS,gBAAiB,SAAS,UAAU,EAAE,KAAG,OACI,CAAA"}
@@ -0,0 +1,11 @@
1
+ const DIAGNOSTIC_CODE_PATTERN = /^HMX[1-5]\d{3}$/;
2
+ /** Validates and returns a diagnostic supplied by a parser or compiler stage. */
3
+ export const createDiagnostic = (diagnostic) => {
4
+ if (diagnostic.code.length !== 7 || !DIAGNOSTIC_CODE_PATTERN.test(diagnostic.code)) {
5
+ throw new TypeError(`Invalid diagnostic code: ${diagnostic.code}`);
6
+ }
7
+ return diagnostic;
8
+ };
9
+ /** Reports whether a diagnostic list contains at least one error. */
10
+ export const hasErrors = (diagnostics) => diagnostics.some((diagnostic) => diagnostic.severity === 'error');
11
+ //# sourceMappingURL=diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AA8BA,MAAM,uBAAuB,GAAG,iBAAiB,CAAA;AAEjD,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,UAAsB,EAAc,EAAE;IACrE,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACnF,MAAM,IAAI,SAAS,CAAC,4BAA4B,UAAU,CAAC,IAAI,EAAE,CAAC,CAAA;IACpE,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,qEAAqE;AACrE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,WAAkC,EAAW,EAAE,CACvE,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ export { blockquote, break, code, containerDirective, definition, delete, emphasis, heading, html, image, imageReference, inlineCode, interpolation, leafDirective, link, linkReference, list, listItem, paragraph, root, strong, table, tableCell, tableRow, text, textDirective, thematicBreak, yaml, } from './builders.js';
2
+ export { getAttribute, getAttributeValue, hasAttribute, isForbiddenAttributeName, toAttributeRecord, } from './attributes.js';
3
+ export { createDiagnostic, hasErrors } from './diagnostics.js';
4
+ export type { Diagnostic, RelatedSpan, Severity, Suggestion } from './diagnostics.js';
5
+ export { containsPoint, isSyntheticSpan, mergeSpans, pointToString, spanToString, SYNTHETIC_SPAN, } from './spans.js';
6
+ export type { Attribute, AttributeList, BlockContent, Blockquote, Break, Code, ContainerDirective, Definition, Delete, Emphasis, Heading, Html, Image, ImageReference, InlineCode, Interpolation, LeafDirective, Link, LinkReference, List, ListItem, Node, NodeBase, NodeMap, Paragraph, PhrasingContent, Point, Root, RootContent, Span, Strong, Table, TableCell, TableRow, Text, TextDirective, ThematicBreak, Yaml, } from './types.js';
7
+ export { EXIT, SKIP, visit, visitOf } from './visit.js';
8
+ export type { VisitorResult } from './visit.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,IAAI,EACJ,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,IAAI,EACJ,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,MAAM,EACN,KAAK,EACL,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,aAAa,EACb,IAAI,GACL,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC9D,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrF,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,EACV,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,UAAU,EACV,KAAK,EACL,IAAI,EACJ,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,IAAI,EACJ,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,SAAS,EACT,eAAe,EACf,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,MAAM,EACN,KAAK,EACL,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,aAAa,EACb,IAAI,GACL,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { blockquote, break, code, containerDirective, definition, delete, emphasis, heading, html, image, imageReference, inlineCode, interpolation, leafDirective, link, linkReference, list, listItem, paragraph, root, strong, table, tableCell, tableRow, text, textDirective, thematicBreak, yaml, } from './builders.js';
2
+ export { getAttribute, getAttributeValue, hasAttribute, isForbiddenAttributeName, toAttributeRecord, } from './attributes.js';
3
+ export { createDiagnostic, hasErrors } from './diagnostics.js';
4
+ export { containsPoint, isSyntheticSpan, mergeSpans, pointToString, spanToString, SYNTHETIC_SPAN, } from './spans.js';
5
+ export { EXIT, SKIP, visit, visitOf } from './visit.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,IAAI,EACJ,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,IAAI,EACJ,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,MAAM,EACN,KAAK,EACL,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,aAAa,EACb,IAAI,GACL,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE9D,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,EACV,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAA;AAyCnB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { Point, Span } from './types.js';
2
+ /** A zero-length span for builders and tests that do not have source text. */
3
+ export declare const SYNTHETIC_SPAN: Span;
4
+ /** Formats a source point as `line:column`. */
5
+ export declare function pointToString(point: Point): string;
6
+ /** Formats a source span as `startLine:startColumn-endLine:endColumn`. */
7
+ export declare function spanToString(span: Span): string;
8
+ /** Reports whether a point's offset lies within a span, including both boundaries. */
9
+ export declare function containsPoint(span: Span, point: Point): boolean;
10
+ /** Returns the smallest span containing both input spans. */
11
+ export declare function mergeSpans(a: Span, b: Span): Span;
12
+ /** Reports whether every coordinate in a span is zero. */
13
+ export declare function isSyntheticSpan(span: Span): boolean;
14
+ //# sourceMappingURL=spans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spans.d.ts","sourceRoot":"","sources":["../src/spans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAE7C,8EAA8E;AAC9E,eAAO,MAAM,cAAc,EAAE,IAG5B,CAAA;AAED,+CAA+C;AAC/C,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAElD;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE/C;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAE/D;AAED,6DAA6D;AAC7D,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAKjD;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CASnD"}
package/dist/spans.js ADDED
@@ -0,0 +1,34 @@
1
+ /** A zero-length span for builders and tests that do not have source text. */
2
+ export const SYNTHETIC_SPAN = {
3
+ start: { line: 0, column: 0, offset: 0 },
4
+ end: { line: 0, column: 0, offset: 0 },
5
+ };
6
+ /** Formats a source point as `line:column`. */
7
+ export function pointToString(point) {
8
+ return `${point.line}:${point.column}`;
9
+ }
10
+ /** Formats a source span as `startLine:startColumn-endLine:endColumn`. */
11
+ export function spanToString(span) {
12
+ return `${pointToString(span.start)}-${pointToString(span.end)}`;
13
+ }
14
+ /** Reports whether a point's offset lies within a span, including both boundaries. */
15
+ export function containsPoint(span, point) {
16
+ return point.offset >= span.start.offset && point.offset <= span.end.offset;
17
+ }
18
+ /** Returns the smallest span containing both input spans. */
19
+ export function mergeSpans(a, b) {
20
+ return {
21
+ start: a.start.offset <= b.start.offset ? a.start : b.start,
22
+ end: a.end.offset >= b.end.offset ? a.end : b.end,
23
+ };
24
+ }
25
+ /** Reports whether every coordinate in a span is zero. */
26
+ export function isSyntheticSpan(span) {
27
+ return (span.start.line === 0 &&
28
+ span.start.column === 0 &&
29
+ span.start.offset === 0 &&
30
+ span.end.line === 0 &&
31
+ span.end.column === 0 &&
32
+ span.end.offset === 0);
33
+ }
34
+ //# sourceMappingURL=spans.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spans.js","sourceRoot":"","sources":["../src/spans.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;IACxC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;CACvC,CAAA;AAED,+CAA+C;AAC/C,MAAM,UAAU,aAAa,CAAC,KAAY;IACxC,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,CAAA;AACxC,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAAC,IAAU;IACrC,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;AAClE,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,KAAY;IACpD,OAAO,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAA;AAC7E,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,UAAU,CAAC,CAAO,EAAE,CAAO;IACzC,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;QAC3D,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;KAClD,CAAA;AACH,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,CACtB,CAAA;AACH,CAAC"}
@@ -0,0 +1,213 @@
1
+ /** A location in the source text. */
2
+ export interface Point {
3
+ readonly line: number;
4
+ readonly column: number;
5
+ readonly offset: number;
6
+ }
7
+ /** A source range delimited by start and end points. */
8
+ export interface Span {
9
+ readonly start: Point;
10
+ readonly end: Point;
11
+ }
12
+ /** Fields shared by every HMX syntax tree node. */
13
+ export interface NodeBase {
14
+ readonly type: string;
15
+ /** Source range. Required: dropping spans is a bug (CLAUDE.md invariant 3). */
16
+ readonly position: Span;
17
+ /** Set on nodes produced by transforms; `position` then refers to the origin. */
18
+ readonly synthetic?: true;
19
+ }
20
+ /** The document root. */
21
+ export interface Root extends NodeBase {
22
+ type: 'root';
23
+ readonly hmxVersion: string;
24
+ children: RootContent[];
25
+ }
26
+ /** A frontmatter block. Only valid as the first child of the root. */
27
+ export interface Yaml extends NodeBase {
28
+ type: 'yaml';
29
+ /** Raw text between the delimiters, excluding them. Unparsed. */
30
+ value: string;
31
+ }
32
+ /** A paragraph containing phrasing content. */
33
+ export interface Paragraph extends NodeBase {
34
+ type: 'paragraph';
35
+ children: PhrasingContent[];
36
+ }
37
+ /** An ATX or setext heading. */
38
+ export interface Heading extends NodeBase {
39
+ type: 'heading';
40
+ depth: 1 | 2 | 3 | 4 | 5 | 6;
41
+ children: PhrasingContent[];
42
+ }
43
+ /** A thematic break. */
44
+ export interface ThematicBreak extends NodeBase {
45
+ type: 'thematicBreak';
46
+ }
47
+ /** A block quote containing block content. */
48
+ export interface Blockquote extends NodeBase {
49
+ type: 'blockquote';
50
+ children: Array<BlockContent | Definition>;
51
+ }
52
+ /** An ordered or unordered list. */
53
+ export interface List extends NodeBase {
54
+ type: 'list';
55
+ ordered: boolean;
56
+ start: number | null;
57
+ spread: boolean;
58
+ children: ListItem[];
59
+ }
60
+ /** A single list item, optionally carrying a GFM task state. */
61
+ export interface ListItem extends NodeBase {
62
+ type: 'listItem';
63
+ spread: boolean;
64
+ checked: boolean | null;
65
+ children: Array<BlockContent | Definition>;
66
+ }
67
+ /** A fenced or indented code block. */
68
+ export interface Code extends NodeBase {
69
+ type: 'code';
70
+ lang: string | null;
71
+ meta: string | null;
72
+ value: string;
73
+ }
74
+ /** Raw HTML appearing in block or phrasing content. */
75
+ export interface Html extends NodeBase {
76
+ type: 'html';
77
+ value: string;
78
+ }
79
+ /** Plain source text. */
80
+ export interface Text extends NodeBase {
81
+ type: 'text';
82
+ value: string;
83
+ }
84
+ /** A `{{ expr }}` interpolation. The expression is unparsed at this stage. */
85
+ export interface Interpolation extends NodeBase {
86
+ type: 'interpolation';
87
+ /** Raw expression text between the braces, trimmed. */
88
+ value: string;
89
+ }
90
+ /** Emphasized phrasing content. */
91
+ export interface Emphasis extends NodeBase {
92
+ type: 'emphasis';
93
+ children: PhrasingContent[];
94
+ }
95
+ /** Strongly emphasized phrasing content. */
96
+ export interface Strong extends NodeBase {
97
+ type: 'strong';
98
+ children: PhrasingContent[];
99
+ }
100
+ /** GFM strikethrough phrasing content. */
101
+ export interface Delete extends NodeBase {
102
+ type: 'delete';
103
+ children: PhrasingContent[];
104
+ }
105
+ /** Inline code text. */
106
+ export interface InlineCode extends NodeBase {
107
+ type: 'inlineCode';
108
+ value: string;
109
+ }
110
+ /** A hard line break. */
111
+ export interface Break extends NodeBase {
112
+ type: 'break';
113
+ }
114
+ /** A link with inline destination data. */
115
+ export interface Link extends NodeBase {
116
+ type: 'link';
117
+ url: string;
118
+ title: string | null;
119
+ children: PhrasingContent[];
120
+ }
121
+ /** An image with inline destination data. */
122
+ export interface Image extends NodeBase {
123
+ type: 'image';
124
+ url: string;
125
+ title: string | null;
126
+ alt: string | null;
127
+ }
128
+ /** A link or image destination definition. */
129
+ export interface Definition extends NodeBase {
130
+ type: 'definition';
131
+ identifier: string;
132
+ label: string | null;
133
+ url: string;
134
+ title: string | null;
135
+ }
136
+ /** A link that resolves through a definition. */
137
+ export interface LinkReference extends NodeBase {
138
+ type: 'linkReference';
139
+ identifier: string;
140
+ label: string | null;
141
+ referenceType: 'shortcut' | 'collapsed' | 'full';
142
+ children: PhrasingContent[];
143
+ }
144
+ /** An image that resolves through a definition. */
145
+ export interface ImageReference extends NodeBase {
146
+ type: 'imageReference';
147
+ identifier: string;
148
+ label: string | null;
149
+ referenceType: 'shortcut' | 'collapsed' | 'full';
150
+ alt: string | null;
151
+ }
152
+ /** A GFM table. */
153
+ export interface Table extends NodeBase {
154
+ type: 'table';
155
+ align: Array<'left' | 'right' | 'center' | null>;
156
+ children: TableRow[];
157
+ }
158
+ /** A row in a GFM table. */
159
+ export interface TableRow extends NodeBase {
160
+ type: 'tableRow';
161
+ children: TableCell[];
162
+ }
163
+ /** A cell in a GFM table. */
164
+ export interface TableCell extends NodeBase {
165
+ type: 'tableCell';
166
+ children: PhrasingContent[];
167
+ }
168
+ /** A parsed directive attribute and its precise source ranges. */
169
+ export interface Attribute {
170
+ readonly name: string;
171
+ /** `null` for a bare attribute (`{disabled}`), distinct from `''` (`{a=""}`). */
172
+ readonly value: string | null;
173
+ readonly position: Span;
174
+ readonly nameSpan: Span;
175
+ readonly valueSpan?: Span;
176
+ }
177
+ /** An ordered, duplicate-preserving directive attribute list. */
178
+ export type AttributeList = readonly Attribute[];
179
+ /** An inline HMX directive. */
180
+ export interface TextDirective extends NodeBase {
181
+ type: 'textDirective';
182
+ name: string;
183
+ attributes: AttributeList;
184
+ children: PhrasingContent[];
185
+ }
186
+ /** A block HMX directive without block children. */
187
+ export interface LeafDirective extends NodeBase {
188
+ type: 'leafDirective';
189
+ name: string;
190
+ attributes: AttributeList;
191
+ label?: PhrasingContent[];
192
+ }
193
+ /** A block HMX directive containing block content. */
194
+ export interface ContainerDirective extends NodeBase {
195
+ type: 'containerDirective';
196
+ name: string;
197
+ attributes: AttributeList;
198
+ label?: PhrasingContent[];
199
+ children: BlockContent[];
200
+ }
201
+ /** Any node accepted as block-level content. */
202
+ export type BlockContent = Blockquote | Code | ContainerDirective | Heading | Html | LeafDirective | List | Paragraph | Table | ThematicBreak;
203
+ /** Any node accepted as inline phrasing content. */
204
+ export type PhrasingContent = Break | Delete | Emphasis | Html | Image | ImageReference | InlineCode | Interpolation | Link | LinkReference | Strong | Text | TextDirective;
205
+ /** Any node accepted directly under the document root. */
206
+ export type RootContent = BlockContent | Definition | Yaml;
207
+ /** Any node in an HMX syntax tree. */
208
+ export type Node = Root | RootContent | ListItem | TableRow | TableCell | PhrasingContent;
209
+ /** A lookup from a node discriminant to its concrete node interface. */
210
+ export type NodeMap = {
211
+ [CurrentNode in Node as CurrentNode['type']]: CurrentNode;
212
+ };
213
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,wDAAwD;AACxD,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CA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,WAAW,aAAc,SAAQ,QAAQ;IAC7C,IAAI,EAAE,eAAe,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,aAAa,CAAA;IACzB,KAAK,CAAC,EAAE,eAAe,EAAE,CAAA;CAC1B;AAED,sDAAsD;AACtD,MAAM,WAAW,kBAAmB,SAAQ,QAAQ;IAClD,IAAI,EAAE,oBAAoB,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,aAAa,CAAA;IACzB,KAAK,CAAC,EAAE,eAAe,EAAE,CAAA;IACzB,QAAQ,EAAE,YAAY,EAAE,CAAA;CACzB;AAED,gDAAgD;AAChD,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,IAAI,GACJ,kBAAkB,GAClB,OAAO,GACP,IAAI,GACJ,aAAa,GACb,IAAI,GACJ,SAAS,GACT,KAAK,GACL,aAAa,CAAA;AAEjB,oDAAoD;AACpD,MAAM,MAAM,eAAe,GACvB,KAAK,GACL,MAAM,GACN,QAAQ,GACR,IAAI,GACJ,KAAK,GACL,cAAc,GACd,UAAU,GACV,aAAa,GACb,IAAI,GACJ,aAAa,GACb,MAAM,GACN,IAAI,GACJ,aAAa,CAAA;AAEjB,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,IAAI,CAAA;AAE1D,sCAAsC;AACtC,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,eAAe,CAAA;AAEzF,wEAAwE;AACxE,MAAM,MAAM,OAAO,GAAG;KACnB,WAAW,IAAI,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW;CAC1D,CAAA"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { Node, NodeMap } from './types.js';
2
+ /** A visitor result that prevents descent into the current node. */
3
+ export declare const SKIP: unique symbol;
4
+ /** A visitor result that stops the entire traversal immediately. */
5
+ export declare const EXIT: unique symbol;
6
+ /** A control result returned by an AST visitor callback. */
7
+ export type VisitorResult = void | typeof SKIP | typeof EXIT;
8
+ type Visitor = (node: Node, parent: Node | undefined, index: number) => VisitorResult;
9
+ /**
10
+ * Visits a tree depth-first in pre-order without recursion.
11
+ *
12
+ * An optional exit callback runs after a node's descendants, or immediately after an
13
+ * enter callback returns {@link SKIP}.
14
+ */
15
+ export declare function visit(tree: Node, enter: Visitor, exit?: Visitor): void;
16
+ /** Visits only nodes whose discriminant matches the requested type. */
17
+ export declare function visitOf<T extends Node['type']>(tree: Node, type: T, fn: (node: NodeMap[T], parent: Node | undefined, index: number) => VisitorResult): void;
18
+ export {};
19
+ //# sourceMappingURL=visit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../src/visit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE/C,oEAAoE;AACpE,eAAO,MAAM,IAAI,EAAE,OAAO,MAAuB,CAAA;AAEjD,oEAAoE;AACpE,eAAO,MAAM,IAAI,EAAE,OAAO,MAAuB,CAAA;AAEjD,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,OAAO,IAAI,GAAG,OAAO,IAAI,CAAA;AAE5D,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,aAAa,CAAA;AA2DrF;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAgDtE;AAMD,uEAAuE;AACvE,wBAAgB,OAAO,CAAC,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,CAAC,EACP,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,aAAa,GAC/E,IAAI,CAMN"}
package/dist/visit.js ADDED
@@ -0,0 +1,112 @@
1
+ /** A visitor result that prevents descent into the current node. */
2
+ export const SKIP = Symbol('skip');
3
+ /** A visitor result that stops the entire traversal immediately. */
4
+ export const EXIT = Symbol('exit');
5
+ function childrenOf(node) {
6
+ switch (node.type) {
7
+ case 'root':
8
+ case 'paragraph':
9
+ case 'heading':
10
+ case 'blockquote':
11
+ case 'list':
12
+ case 'listItem':
13
+ case 'emphasis':
14
+ case 'strong':
15
+ case 'delete':
16
+ case 'link':
17
+ case 'linkReference':
18
+ case 'table':
19
+ case 'tableRow':
20
+ case 'tableCell':
21
+ case 'textDirective':
22
+ return node.children;
23
+ case 'leafDirective':
24
+ return node.label;
25
+ case 'containerDirective':
26
+ // A container has two child arrays, so the `index` reported for its descendants
27
+ // is a position in this concatenation, not in `children`. Read-only passes are
28
+ // unaffected; do not use `index` to splice a container's children until the label
29
+ // representation is settled in Phase 2. Tracked as P1 in BACKLOG.md.
30
+ return node.label === undefined ? node.children : [...node.label, ...node.children];
31
+ case 'thematicBreak':
32
+ case 'yaml':
33
+ case 'code':
34
+ case 'html':
35
+ case 'text':
36
+ case 'interpolation':
37
+ case 'inlineCode':
38
+ case 'break':
39
+ case 'image':
40
+ case 'definition':
41
+ case 'imageReference':
42
+ return undefined;
43
+ default:
44
+ // Exhaustiveness guard. Adding a node type without a case here would otherwise
45
+ // make traversal silently skip its children — a bug that produces wrong output
46
+ // with no error anywhere. This turns it into a compile failure.
47
+ return assertNeverNode(node);
48
+ }
49
+ }
50
+ function assertNeverNode(node) {
51
+ throw new TypeError(`Unhandled node type in childrenOf: ${JSON.stringify(node)}`);
52
+ }
53
+ /**
54
+ * Visits a tree depth-first in pre-order without recursion.
55
+ *
56
+ * An optional exit callback runs after a node's descendants, or immediately after an
57
+ * enter callback returns {@link SKIP}.
58
+ */
59
+ export function visit(tree, enter, exit) {
60
+ const stack = [
61
+ {
62
+ node: tree,
63
+ parent: undefined,
64
+ index: 0,
65
+ exiting: false,
66
+ },
67
+ ];
68
+ while (stack.length > 0) {
69
+ const frame = stack.pop();
70
+ if (frame === undefined) {
71
+ continue;
72
+ }
73
+ if (frame.exiting) {
74
+ if (exit?.(frame.node, frame.parent, frame.index) === EXIT) {
75
+ return;
76
+ }
77
+ continue;
78
+ }
79
+ const result = enter(frame.node, frame.parent, frame.index);
80
+ if (result === EXIT) {
81
+ return;
82
+ }
83
+ if (exit !== undefined) {
84
+ stack.push({ ...frame, exiting: true });
85
+ }
86
+ if (result === SKIP) {
87
+ continue;
88
+ }
89
+ const children = childrenOf(frame.node);
90
+ if (children === undefined) {
91
+ continue;
92
+ }
93
+ for (let index = children.length - 1; index >= 0; index -= 1) {
94
+ const child = children[index];
95
+ if (child !== undefined) {
96
+ stack.push({ node: child, parent: frame.node, index, exiting: false });
97
+ }
98
+ }
99
+ }
100
+ }
101
+ function isNodeOfType(node, type) {
102
+ return node.type === type;
103
+ }
104
+ /** Visits only nodes whose discriminant matches the requested type. */
105
+ export function visitOf(tree, type, fn) {
106
+ visit(tree, (node, parent, index) => {
107
+ if (isNodeOfType(node, type)) {
108
+ return fn(node, parent, index);
109
+ }
110
+ });
111
+ }
112
+ //# sourceMappingURL=visit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visit.js","sourceRoot":"","sources":["../src/visit.ts"],"names":[],"mappings":"AAEA,oEAAoE;AACpE,MAAM,CAAC,MAAM,IAAI,GAAkB,MAAM,CAAC,MAAM,CAAC,CAAA;AAEjD,oEAAoE;AACpE,MAAM,CAAC,MAAM,IAAI,GAAkB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,KAAK,IAAI,KAAK,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;YAC7B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;YACxE,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAyB,IAAU,EAAE,IAAO;IAC/D,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAA;AAC3B,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,OAAO,CACrB,IAAU,EACV,IAAO,EACP,EAAgF;IAEhF,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;QAClC,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;QAChC,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@hymarkx/ast",
3
+ "version": "0.0.2",
4
+ "description": "Core node types, source spans, and diagnostics for the HyMarkX (HMX) language.",
5
+ "license": "MIT OR Apache-2.0",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/NAME0x0/HyMarkX.git",
12
+ "directory": "packages/ast"
13
+ },
14
+ "homepage": "https://github.com/NAME0x0/HyMarkX#readme",
15
+ "bugs": "https://github.com/NAME0x0/HyMarkX/issues",
16
+ "type": "module",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE-MIT",
27
+ "LICENSE-APACHE"
28
+ ],
29
+ "engines": {
30
+ "node": ">=22"
31
+ }
32
+ }