satorigear 0.0.4 → 0.0.6

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 CHANGED
@@ -41,6 +41,7 @@ const parser = createParser({
41
41
  attributes: true,
42
42
  binding: true,
43
43
  component: true,
44
+ emoji: true,
44
45
  footnote: true,
45
46
  frontmatter: true,
46
47
  math: true,
@@ -59,7 +60,7 @@ document.edit([
59
60
  { start: 66, end: 66, text: ":" },
60
61
  { start: 67, end: 67, text: "nuxt-img" },
61
62
  ]);
62
- const mdast = document.snapthot();
63
+ const mdast = document.tree;
63
64
  ```
64
65
 
65
66
  ## Performance
@@ -68,7 +69,7 @@ Benchmarked against Sätteri and Remark, which also produce MDAST, with feature
68
69
 
69
70
  <!-- benchmark:start environment -->
70
71
 
71
- > Median of 5 isolated mean-time runs at commit [`deacb94`](https://github.com/KazariEX/satorigear/commit/deacb94abb22839aa84f32374cf348cfa27332e1) on Apple M3, node 26.5.0, arm64-darwin. SatoriGear and Sätteri run in paired AB/BA order; comparisons are normalized to SatoriGear (↑ faster, ↓ slower). Lower time and higher throughput are better.
72
+ > Median of 5 isolated mean-time runs at commit [`ed5362d`](https://github.com/KazariEX/satorigear/commit/ed5362d7e1ff096c6ac5c8c8fd9933a4316379fe) on Apple M3, node 26.5.0, arm64-darwin. SatoriGear and Sätteri run in paired AB/BA order; comparisons are normalized to SatoriGear (↑ faster, ↓ slower). Lower time and higher throughput are better.
72
73
 
73
74
  <!-- benchmark:end -->
74
75
 
@@ -83,17 +84,17 @@ Benchmarked against Sätteri and Remark, which also produce MDAST, with feature
83
84
 
84
85
  | Engine | Mean time | vs. SatoriGear | Throughput |
85
86
  | --- | ---: | ---: | ---: |
86
- | **SatoriGear** | 2.32 ms | baseline | 84.2 MiB/s |
87
- | Sätteri | 1.12 ms | ↑ 2.07× | 174 MiB/s |
88
- | Remark | 62.8 ms | ↓ 26.86× | 3.11 MiB/s |
87
+ | **SatoriGear** | 1.35 ms | baseline | 145 MiB/s |
88
+ | Sätteri | 1.12 ms | ↑ 1.20× | 174 MiB/s |
89
+ | Remark | 62.4 ms | ↓ 46.33× | 3.13 MiB/s |
89
90
 
90
91
  ##### CommonMark 0.31.2 examples, 14919 bytes, 652 documents
91
92
 
92
93
  | Engine | Mean time | vs. SatoriGear | Throughput |
93
94
  | --- | ---: | ---: | ---: |
94
- | **SatoriGear** | 1.03 ms | baseline | 13.9 MiB/s |
95
- | Sätteri | 2.71 ms | ↓ 2.64× | 5.25 MiB/s |
96
- | Remark | 26.6 ms | ↓ 25.96× | 0.53 MiB/s |
95
+ | **SatoriGear** | 913 µs | baseline | 15.6 MiB/s |
96
+ | Sätteri | 2.69 ms | ↓ 2.95× | 5.28 MiB/s |
97
+ | Remark | 26.2 ms | ↓ 28.75× | 0.54 MiB/s |
97
98
 
98
99
  #### Built-in features
99
100
 
@@ -101,15 +102,15 @@ Benchmarked against Sätteri and Remark, which also produce MDAST, with feature
101
102
 
102
103
  | Engine | Mean time | vs. SatoriGear | Throughput |
103
104
  | --- | ---: | ---: | ---: |
104
- | **SatoriGear** | 21.9 ms | baseline | 39.6 MiB/s |
105
- | Sätteri | 26.7 ms | ↓ 1.22× | 32.5 MiB/s |
105
+ | **SatoriGear** | 17.9 ms | baseline | 48.6 MiB/s |
106
+ | Sätteri | 26.5 ms | ↓ 1.48× | 32.7 MiB/s |
106
107
 
107
108
  ##### Public APIs README, 232580 bytes, 1 document
108
109
 
109
110
  | Engine | Mean time | vs. SatoriGear | Throughput |
110
111
  | --- | ---: | ---: | ---: |
111
- | **SatoriGear** | 5.49 ms | baseline | 40.4 MiB/s |
112
- | Sätteri | 2.40 ms | ↑ 2.28× | 92.4 MiB/s |
112
+ | **SatoriGear** | 3.96 ms | baseline | 56.1 MiB/s |
113
+ | Sätteri | 2.40 ms | ↑ 1.65× | 92.5 MiB/s |
113
114
 
114
115
  </details>
115
116
 
@@ -126,17 +127,17 @@ Benchmarked against Sätteri and Remark, which also produce MDAST, with feature
126
127
 
127
128
  | Engine | Mean time | vs. SatoriGear | Throughput |
128
129
  | --- | ---: | ---: | ---: |
129
- | **SatoriGear** | 2.34 ms | baseline | 83.4 MiB/s |
130
- | Sätteri | 5.47 ms | ↓ 2.33× | 35.7 MiB/s |
131
- | Remark | 59.9 ms | ↓ 25.53× | 3.27 MiB/s |
130
+ | **SatoriGear** | 1.42 ms | baseline | 138 MiB/s |
131
+ | Sätteri | 5.48 ms | ↓ 3.86× | 35.7 MiB/s |
132
+ | Remark | 60.0 ms | ↓ 42.40× | 3.26 MiB/s |
132
133
 
133
134
  ##### CommonMark 0.31.2 examples, 14919 bytes, 652 documents
134
135
 
135
136
  | Engine | Mean time | vs. SatoriGear | Throughput |
136
137
  | --- | ---: | ---: | ---: |
137
- | **SatoriGear** | 1.05 ms | baseline | 13.6 MiB/s |
138
- | Sätteri | 5.92 ms | ↓ 5.57× | 2.41 MiB/s |
139
- | Remark | 26.3 ms | ↓ 25.07× | 0.54 MiB/s |
138
+ | **SatoriGear** | 940 µs | baseline | 15.1 MiB/s |
139
+ | Sätteri | 5.88 ms | ↓ 6.27× | 2.42 MiB/s |
140
+ | Remark | 26.1 ms | ↓ 27.80× | 0.54 MiB/s |
140
141
 
141
142
  #### Built-in features
142
143
 
@@ -144,15 +145,15 @@ Benchmarked against Sätteri and Remark, which also produce MDAST, with feature
144
145
 
145
146
  | Engine | Mean time | vs. SatoriGear | Throughput |
146
147
  | --- | ---: | ---: | ---: |
147
- | **SatoriGear** | 22.1 ms | baseline | 39.2 MiB/s |
148
- | Sätteri | 79.5 ms | ↓ 3.59× | 10.9 MiB/s |
148
+ | **SatoriGear** | 18.8 ms | baseline | 46.1 MiB/s |
149
+ | Sätteri | 79.6 ms | ↓ 4.23× | 10.9 MiB/s |
149
150
 
150
151
  ##### Public APIs README, 232580 bytes, 1 document
151
152
 
152
153
  | Engine | Mean time | vs. SatoriGear | Throughput |
153
154
  | --- | ---: | ---: | ---: |
154
- | **SatoriGear** | 5.76 ms | baseline | 38.5 MiB/s |
155
- | Sätteri | 21.0 ms | ↓ 3.63× | 10.6 MiB/s |
155
+ | **SatoriGear** | 4.36 ms | baseline | 50.8 MiB/s |
156
+ | Sätteri | 20.7 ms | ↓ 4.75× | 10.7 MiB/s |
156
157
 
157
158
  </details>
158
159
 
package/dist/index.d.mts CHANGED
@@ -4,18 +4,19 @@ interface SourceSpan {
4
4
  end: number;
5
5
  start: number;
6
6
  }
7
+ //#endregion
8
+ //#region src/document.d.ts
7
9
  interface TextEdit extends SourceSpan {
8
10
  text: string;
9
11
  }
10
- //#endregion
11
- //#region src/document.d.ts
12
12
  interface EditResult {
13
13
  changedSpan: SourceSpan;
14
14
  }
15
15
  interface Document {
16
16
  readonly source: string;
17
+ /** The document-owned tree. Edits mutate this value; callers must not morph it. */
18
+ readonly tree: Root;
17
19
  edit: (edits: readonly TextEdit[]) => EditResult;
18
- snapshot: () => Root;
19
20
  }
20
21
  //#endregion
21
22
  //#region src/profile/features/formatting.d.ts
@@ -58,6 +59,7 @@ interface FeatureOptions {
58
59
  attributes?: boolean;
59
60
  binding?: boolean;
60
61
  component?: boolean;
62
+ emoji?: boolean;
61
63
  footnote?: boolean;
62
64
  frontmatter?: boolean | FrontmatterOptions;
63
65
  math?: boolean | MathOptions;
@@ -113,4 +115,19 @@ declare module "mdast" {
113
115
  }
114
116
  }
115
117
  //#endregion
116
- export { type AttributeValue, type Attributes, type BlockComponent, type Document, type EditResult, type FeatureOptions, type FrontmatterMarker, type FrontmatterOptions, type InlineComponent, type InlineMath, type Math, type MathOptions, Parser, ParserOptions, type StrikethroughOptions, type TextEdit, createParser };
118
+ //#region src/profile/features/emoji/types.d.ts
119
+ interface Emoji extends Literal {
120
+ type: "emoji";
121
+ /** Complete shortcode source, including both colons. */
122
+ value: string;
123
+ }
124
+ declare module "mdast" {
125
+ interface PhrasingContentMap {
126
+ emoji: Emoji;
127
+ }
128
+ interface RootContentMap {
129
+ emoji: Emoji;
130
+ }
131
+ }
132
+ //#endregion
133
+ export { type AttributeValue, type Attributes, type BlockComponent, type Document, type EditResult, type Emoji, type FeatureOptions, type FrontmatterMarker, type FrontmatterOptions, type InlineComponent, type InlineMath, type Math, type MathOptions, Parser, ParserOptions, type StrikethroughOptions, type TextEdit, createParser };