@yozora/tokenizer-ecma-import 2.1.3 → 2.1.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/CHANGELOG.md +303 -0
- package/README.md +42 -42
- package/package.json +6 -6
- package/src/index.ts +0 -9
- package/src/match.ts +0 -103
- package/src/parse.ts +0 -26
- package/src/tokenizer.ts +0 -32
- package/src/types.ts +0 -16
- package/src/util.ts +0 -46
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
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
|
+
## [2.1.5](https://github.com/yozorajs/yozora/compare/v2.1.4...v2.1.5) (2023-05-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Performance Improvements
|
|
10
|
+
|
|
11
|
+
* 🔧 don't sourcemaps into tarball ([fc37aa8](https://github.com/yozorajs/yozora/commit/fc37aa8847ac4ad78ecb31f198e1cd6a85e91bcf))
|
|
12
|
+
* 📝 update CHANGELOGs ([c51b283](https://github.com/yozorajs/yozora/commit/c51b283874f8a562b6ed9fad46a0b7d578f6eb42))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 2.1.4 (2023-04-02)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Performance Improvements
|
|
22
|
+
|
|
23
|
+
* 🔧 don't pack src/ folder into tarball ([c9fac38](https://github.com/yozorajs/yozora/commit/c9fac382e9a7a8d6454452b0c4d5b57dac16455f))
|
|
24
|
+
* 🔖 publish v2.1.4 ([aa464ed](https://github.com/yozorajs/yozora/commit/aa464ed1e3cd84892773a833910cfc53a556bf5f))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## 2.1.3 (2023-03-23)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Performance Improvements
|
|
32
|
+
|
|
33
|
+
* 🔖 publish v2.1.3 ([9abaaff](https://github.com/yozorajs/yozora/commit/9abaaff74a12d0bae0f645813241ff947a0d828c))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## 2.1.2 (2023-03-11)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Performance Improvements
|
|
41
|
+
|
|
42
|
+
* 🔖 publish v2.1.2 ([992baca](https://github.com/yozorajs/yozora/commit/992bacafd173e7788e99fed34ce8b45f6ed24cfe))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 2.1.1 (2023-03-10)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Performance Improvements
|
|
50
|
+
|
|
51
|
+
* 💥 prefer shorter types ([b93307f](https://github.com/yozorajs/yozora/commit/b93307f3c2372598dd8ca4fcbf04e80ce58d903d))
|
|
52
|
+
* 🔖 publish v2.1.1 ([257a36d](https://github.com/yozorajs/yozora/commit/257a36d8dc079d4ac226405c155b238e7099bcea))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## 2.0.6 (2023-03-05)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Performance Improvements
|
|
60
|
+
|
|
61
|
+
* 🔖 publish v2.0.6 ([a263c53](https://github.com/yozorajs/yozora/commit/a263c5338103824347bac74d437051e9fbb6d791))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## 2.0.5 (2023-01-09)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Performance Improvements
|
|
69
|
+
|
|
70
|
+
* 🔖 publish v2.0.5 ([7ba3bab](https://github.com/yozorajs/yozora/commit/7ba3bab49fe65cf2f57082c0503af73da9356cf0))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 2.0.5-alpha.0 (2023-01-05)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Performance Improvements
|
|
78
|
+
|
|
79
|
+
* 🔧 fix test configuration ([f50b2d7](https://github.com/yozorajs/yozora/commit/f50b2d7600139e0ea54e042b025365d81f4518b5))
|
|
80
|
+
* 🔖 publish v2.0.5-alpha.0 ([8bf941f](https://github.com/yozorajs/yozora/commit/8bf941fe4ef82947165b0f3cc123cd493665e13b))
|
|
81
|
+
* 🔧 update package entries ([2c94f27](https://github.com/yozorajs/yozora/commit/2c94f27ffb645119a863f2ceee68a6b1b7285a67))
|
|
82
|
+
* ⬆️ upgrade devDependencies ([13059a9](https://github.com/yozorajs/yozora/commit/13059a924f3ae3b7fd69080ec9e82cde34a0f097))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 2.0.4 (2022-11-02)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Performance Improvements
|
|
90
|
+
|
|
91
|
+
* 🔖 publish v2.0.4 ([c980b95](https://github.com/yozorajs/yozora/commit/c980b95254394dcacba0cbb4bea251350b09397c))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## 2.0.3 (2022-10-11)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Performance Improvements
|
|
99
|
+
|
|
100
|
+
* 🔖 publish v2.0.3 ([8cc8f95](https://github.com/yozorajs/yozora/commit/8cc8f95cfebc8d752bc3272cdd24965f540c130b))
|
|
101
|
+
* 🔧 update build script ([d934cad](https://github.com/yozorajs/yozora/commit/d934cad21a4ab763621ca6a72379cd4294caa605))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## 2.0.2 (2022-09-24)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### Performance Improvements
|
|
109
|
+
|
|
110
|
+
* 📝 fix invalid links ([eb304c9](https://github.com/yozorajs/yozora/commit/eb304c931b2e682cf156bbceae0a20655777381e))
|
|
111
|
+
* 🔖 publish v2.0.2 ([6911295](https://github.com/yozorajs/yozora/commit/6911295e9eacfa29563fe93494704190e50625fd))
|
|
112
|
+
* 🔧 support node@16.x.x ([eda301f](https://github.com/yozorajs/yozora/commit/eda301fe1047e380de5be915ae730206a026f07b))
|
|
113
|
+
* 📝 update links ([4467fe6](https://github.com/yozorajs/yozora/commit/4467fe646e0a95fcc7206658189884f68872bc4e))
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
## 2.0.2-alpha.0 (2022-05-22)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Performance Improvements
|
|
121
|
+
|
|
122
|
+
* 🔖 publish v2.0.2-alpha.0 ([430eaab](https://github.com/yozorajs/yozora/commit/430eaabd83f4a1ee29398ee1798aa4511976c38f))
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 2.0.1 (2022-05-21)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Bug Fixes
|
|
130
|
+
|
|
131
|
+
* 🐛 fix the trailing semicolon cannot be recognized ([e0184e4](https://github.com/yozorajs/yozora/commit/e0184e45d9c78bd4236218a2588c9373c85ef45d))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Performance Improvements
|
|
135
|
+
|
|
136
|
+
* ✅ refactor test utils & rename createTester to createTokenizerTester ([7f2ce75](https://github.com/yozorajs/yozora/commit/7f2ce7571a336370d419aa01073bf8054783cfd9))
|
|
137
|
+
* 🔖 publish v2.0.1 ([3aea330](https://github.com/yozorajs/yozora/commit/3aea33091e402bd6c7754d91d549e8d648475073))
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# 2.0.0 (2022-01-15)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Performance Improvements
|
|
145
|
+
|
|
146
|
+
* 💥 [breaking] rename 'NodePoint' and 'NodePosition' ([76692a2](https://github.com/yozorajs/yozora/commit/76692a211a82260bb81acffa5e9e9d41b569f673))
|
|
147
|
+
* 🔖 publish v2.0.0 ([65e99d1](https://github.com/yozorajs/yozora/commit/65e99d1709fdd1c918465dce6b1e91de96bdab5e))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# 2.0.0-alpha.3 (2022-01-12)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Features
|
|
155
|
+
|
|
156
|
+
* 💥 [breaking] remove 'I' prefix for AST node types ([cad4b0b](https://github.com/yozorajs/yozora/commit/cad4b0b5b8061ea495f6455ef1554bb3c8f223a0))
|
|
157
|
+
* 💥 [breaking] remove 'IYastNode' prefix for AST types ([35c8fd2](https://github.com/yozorajs/yozora/commit/35c8fd2a6c27fb0bdb4020ccda5974ad05748c46))
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Performance Improvements
|
|
161
|
+
|
|
162
|
+
* 🔖 publish v2.0.0-alpha.3 ([9f274fc](https://github.com/yozorajs/yozora/commit/9f274fc7487a8c1dd213405d92508f9a7621f730))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# 2.0.0-alpha.2 (2022-01-09)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
### Performance Improvements
|
|
170
|
+
|
|
171
|
+
* 🎨 refactor removePosition ([87a974f](https://github.com/yozorajs/yozora/commit/87a974fd744ae937d5778d3cdba4b345141bcaf6))
|
|
172
|
+
* 🔖 publish v2.0.0-alpha.2 ([da59d85](https://github.com/yozorajs/yozora/commit/da59d85520455c59a117a35032ef1a035c10ea21))
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# 2.0.0-alpha.1 (2022-01-08)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
### Features
|
|
180
|
+
|
|
181
|
+
* :breaking: refactor parse-block hooks ([117104d](https://github.com/yozorajs/yozora/commit/117104de9668a0d160e9e008ee6305811e83aec6))
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
### Performance Improvements
|
|
185
|
+
|
|
186
|
+
* 🔖 publish v2.0.0-alpha.1 ([86202e1](https://github.com/yozorajs/yozora/commit/86202e1d2b03ccfc2ab030517d9d314f7aee7666))
|
|
187
|
+
* 🎨 rename IHookContext to IThis ([04d5470](https://github.com/yozorajs/yozora/commit/04d5470c9949c4acfe6239289d34a8b5c6191e71))
|
|
188
|
+
* 📝 update READMEs ([320afeb](https://github.com/yozorajs/yozora/commit/320afebd6c500cbbce5fd65c1cd184bbd2224f25))
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# 2.0.0-alpha.0 (2022-01-03)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
### Features
|
|
196
|
+
|
|
197
|
+
* 💥 [breaking] rename types with 'I' prefix ([d37d862](https://github.com/yozorajs/yozora/commit/d37d862212831dbe75ac92a6dbdadf2fa81cce8c))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### Performance Improvements
|
|
201
|
+
|
|
202
|
+
* 💥 refactor block tokenizers ([50ea4da](https://github.com/yozorajs/yozora/commit/50ea4dac5be8d7dd3d6eccf7e0ce1cfe05fe704a))
|
|
203
|
+
* 🔖 publish v2.0.0-alpha.0 ([0171501](https://github.com/yozorajs/yozora/commit/0171501339c49ffd02ed16a63447fa20a47a29a7))
|
|
204
|
+
* 🎨 rename parser hooks ([ef6cbc5](https://github.com/yozorajs/yozora/commit/ef6cbc51323e6ef9d4cd78f1c7194ae1f7819245))
|
|
205
|
+
* 🎨 set print width to 100 ([657a621](https://github.com/yozorajs/yozora/commit/657a6211cad52d5f1b183e7bcd7ea227b2aa7724))
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
# 1.3.0 (2021-10-09)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### Performance Improvements
|
|
213
|
+
|
|
214
|
+
* 🔖 publish v1.3.0 ([18c9b16](https://github.com/yozorajs/yozora/commit/18c9b167004ad97718b2f94f25139f80598cbf7a))
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.2.2 (2021-09-06)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
### Performance Improvements
|
|
222
|
+
|
|
223
|
+
* 🔖 publish v1.2.2 ([fb4b804](https://github.com/yozorajs/yozora/commit/fb4b804548592c09259aabcf9cc4dd96176bd024))
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
## 1.2.1 (2021-09-04)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
### Performance Improvements
|
|
231
|
+
|
|
232
|
+
* 🔖 publish v1.2.1 ([d98d07d](https://github.com/yozorajs/yozora/commit/d98d07d7c56dd9f6bb60149b2b0a4be2787e1046))
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
# 1.2.0 (2021-08-22)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
### Performance Improvements
|
|
240
|
+
|
|
241
|
+
* 🔖 publish v1.2.0 ([86da40e](https://github.com/yozorajs/yozora/commit/86da40e50d2fe9acace68695288e15e012e6cd0d))
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
# 1.2.0-alpha.1 (2021-08-16)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
### Performance Improvements
|
|
249
|
+
|
|
250
|
+
* 🔖 publish v1.2.0-alpha.1 ([ce3c173](https://github.com/yozorajs/yozora/commit/ce3c17330085f22404668a388f2bee6f57e6e958))
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
# 1.2.0-alpha.0 (2021-08-15)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
### Performance Improvements
|
|
258
|
+
|
|
259
|
+
* 🔖 publish v1.2.0-alpha.0 ([bd8ef45](https://github.com/yozorajs/yozora/commit/bd8ef455a22963834a70339f42178138aab28df6))
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
# 1.1.0 (2021-08-12)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
### Performance Improvements
|
|
267
|
+
|
|
268
|
+
* 🔖 publish v1.1.0 ([a8c7cff](https://github.com/yozorajs/yozora/commit/a8c7cffcbdc36930ab3c744450c8feb4395a9fac))
|
|
269
|
+
* 📝 update related references ([e2c8c7e](https://github.com/yozorajs/yozora/commit/e2c8c7e6ff8c5c1da27ca224d5c5d0eb4e5fbca7))
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
# 1.1.0-alpha.2 (2021-08-07)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
### Performance Improvements
|
|
277
|
+
|
|
278
|
+
* 🔖 publish v1.1.0-alpha.2 ([d88b8ec](https://github.com/yozorajs/yozora/commit/d88b8eca03118b9f2a8b00ac4106ea82e779bc94))
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
# 1.1.0-alpha.1 (2021-08-01)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
### Performance Improvements
|
|
286
|
+
|
|
287
|
+
* 🚚 move EcmaImport types from @yozora/tokenizer-ecma-import to @yozora/ast ([cf14076](https://github.com/yozorajs/yozora/commit/cf140769fb45f479e2440a17d688bf86a5dc8903))
|
|
288
|
+
* 🔖 publish v1.1.0-alpha.1 ([0d6aa91](https://github.com/yozorajs/yozora/commit/0d6aa91fb5a15b962b016496453dbfa7f1197126))
|
|
289
|
+
* 📝 update READMEs ([738d626](https://github.com/yozorajs/yozora/commit/738d626d76c535ea017812f674b43842ee073227))
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
# 1.1.0-alpha.0 (2021-07-31)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
### Features
|
|
297
|
+
|
|
298
|
+
* ✨ implement new tokenizer '@yozora/tokenizer-ecma-import' ([7e4a1b1](https://github.com/yozorajs/yozora/commit/7e4a1b1b1a27fbaba1040ebd4643e5da08ec766b))
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
### Performance Improvements
|
|
302
|
+
|
|
303
|
+
* 🔖 publish v1.1.0-alpha.0 ([082653e](https://github.com/yozorajs/yozora/commit/082653e421889513588492774503d8ddcc24b8f9))
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<header>
|
|
4
4
|
<h1 align="center">
|
|
5
|
-
<a href="https://github.com/yozorajs/yozora/tree/
|
|
5
|
+
<a href="https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/ecma-import#readme">@yozora/tokenizer-ecma-import</a>
|
|
6
6
|
</h1>
|
|
7
7
|
<div align="center">
|
|
8
8
|
<a href="https://www.npmjs.com/package/@yozora/tokenizer-ecma-import">
|
|
@@ -207,53 +207,53 @@ Name | Type | Required | Default
|
|
|
207
207
|
|
|
208
208
|
[live-examples]: https://yozora.guanghechen.com/docs/package/tokenizer-ecma-import#live-examples
|
|
209
209
|
[docpage]: https://yozora.guanghechen.com/docs/package/tokenizer-ecma-import
|
|
210
|
-
[homepage]: https://github.com/yozorajs/yozora/tree/
|
|
210
|
+
[homepage]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/ecma-import#readme
|
|
211
211
|
[gfm-spec]: https://github.github.com/gfm
|
|
212
212
|
[mdast-homepage]: https://github.com/syntax-tree/mdast
|
|
213
213
|
|
|
214
|
-
[@yozora/ast]: https://github.com/yozorajs/yozora/tree/
|
|
215
|
-
[@yozora/ast-util]: https://github.com/yozorajs/yozora/tree/
|
|
216
|
-
[@yozora/character]: https://github.com/yozorajs/yozora/tree/
|
|
214
|
+
[@yozora/ast]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/ast#readme
|
|
215
|
+
[@yozora/ast-util]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/ast-util#readme
|
|
216
|
+
[@yozora/character]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/character#readme
|
|
217
217
|
[@yozora/eslint-config]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/eslint-config#readme
|
|
218
|
-
[@yozora/core-parser]: https://github.com/yozorajs/yozora/tree/
|
|
219
|
-
[@yozora/core-tokenizer]: https://github.com/yozorajs/yozora/tree/
|
|
220
|
-
[@yozora/invariant]: https://github.com/yozorajs/yozora/tree/
|
|
218
|
+
[@yozora/core-parser]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/core-parser#readme
|
|
219
|
+
[@yozora/core-tokenizer]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/core-tokenizer#readme
|
|
220
|
+
[@yozora/invariant]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/invariant#readme
|
|
221
221
|
[@yozora/jest-for-tokenizer]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/jest-for-tokenizer#readme
|
|
222
|
-
[@yozora/parser]: https://github.com/yozorajs/yozora/tree/
|
|
223
|
-
[@yozora/parser-gfm]: https://github.com/yozorajs/yozora/tree/
|
|
224
|
-
[@yozora/parser-gfm-ex]: https://github.com/yozorajs/yozora/tree/
|
|
222
|
+
[@yozora/parser]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/parser#readme
|
|
223
|
+
[@yozora/parser-gfm]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/parser-gfm#readme
|
|
224
|
+
[@yozora/parser-gfm-ex]: https://github.com/yozorajs/yozora/tree/v2.1.5/packages/parser-gfm-ex#readme
|
|
225
225
|
[@yozora/template-tokenizer]: https://github.com/yozorajs/yozora/tree/release-2.x.x/packages/template-tokenizer#readme
|
|
226
|
-
[@yozora/tokenizer-admonition]: https://github.com/yozorajs/yozora/tree/
|
|
227
|
-
[@yozora/tokenizer-autolink]: https://github.com/yozorajs/yozora/tree/
|
|
228
|
-
[@yozora/tokenizer-autolink-extension]: https://github.com/yozorajs/yozora/tree/
|
|
229
|
-
[@yozora/tokenizer-blockquote]: https://github.com/yozorajs/yozora/tree/
|
|
230
|
-
[@yozora/tokenizer-break]: https://github.com/yozorajs/yozora/tree/
|
|
231
|
-
[@yozora/tokenizer-definition]: https://github.com/yozorajs/yozora/tree/
|
|
232
|
-
[@yozora/tokenizer-delete]: https://github.com/yozorajs/yozora/tree/
|
|
233
|
-
[@yozora/tokenizer-ecma-import]: https://github.com/yozorajs/yozora/tree/
|
|
234
|
-
[@yozora/tokenizer-emphasis]: https://github.com/yozorajs/yozora/tree/
|
|
235
|
-
[@yozora/tokenizer-fenced-block]: https://github.com/yozorajs/yozora/tree/
|
|
236
|
-
[@yozora/tokenizer-fenced-code]: https://github.com/yozorajs/yozora/tree/
|
|
237
|
-
[@yozora/tokenizer-footnote]: https://github.com/yozorajs/yozora/tree/
|
|
238
|
-
[@yozora/tokenizer-footnote-definition]: https://github.com/yozorajs/yozora/tree/
|
|
239
|
-
[@yozora/tokenizer-footnote-reference]: https://github.com/yozorajs/yozora/tree/
|
|
240
|
-
[@yozora/tokenizer-heading]: https://github.com/yozorajs/yozora/tree/
|
|
241
|
-
[@yozora/tokenizer-html-block]: https://github.com/yozorajs/yozora/tree/
|
|
242
|
-
[@yozora/tokenizer-html-inline]: https://github.com/yozorajs/yozora/tree/
|
|
243
|
-
[@yozora/tokenizer-image]: https://github.com/yozorajs/yozora/tree/
|
|
244
|
-
[@yozora/tokenizer-image-reference]: https://github.com/yozorajs/yozora/tree/
|
|
245
|
-
[@yozora/tokenizer-indented-code]: https://github.com/yozorajs/yozora/tree/
|
|
246
|
-
[@yozora/tokenizer-inline-code]: https://github.com/yozorajs/yozora/tree/
|
|
247
|
-
[@yozora/tokenizer-inline-math]: https://github.com/yozorajs/yozora/tree/
|
|
248
|
-
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/
|
|
249
|
-
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/
|
|
250
|
-
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/
|
|
251
|
-
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/
|
|
252
|
-
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/
|
|
253
|
-
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/
|
|
254
|
-
[@yozora/tokenizer-table]: https://github.com/yozorajs/yozora/tree/
|
|
255
|
-
[@yozora/tokenizer-text]: https://github.com/yozorajs/yozora/tree/
|
|
256
|
-
[@yozora/tokenizer-thematic-break]: https://github.com/yozorajs/yozora/tree/
|
|
226
|
+
[@yozora/tokenizer-admonition]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/admonition#readme
|
|
227
|
+
[@yozora/tokenizer-autolink]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/autolink#readme
|
|
228
|
+
[@yozora/tokenizer-autolink-extension]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/autolink-extension#readme
|
|
229
|
+
[@yozora/tokenizer-blockquote]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/blockquote#readme
|
|
230
|
+
[@yozora/tokenizer-break]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/break#readme
|
|
231
|
+
[@yozora/tokenizer-definition]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/definition#readme
|
|
232
|
+
[@yozora/tokenizer-delete]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/delete#readme
|
|
233
|
+
[@yozora/tokenizer-ecma-import]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/ecma-import#readme
|
|
234
|
+
[@yozora/tokenizer-emphasis]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/emphasis#readme
|
|
235
|
+
[@yozora/tokenizer-fenced-block]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/fenced-block#readme
|
|
236
|
+
[@yozora/tokenizer-fenced-code]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/fenced-code#readme
|
|
237
|
+
[@yozora/tokenizer-footnote]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/footnote#readme
|
|
238
|
+
[@yozora/tokenizer-footnote-definition]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/footnote-definition#readme
|
|
239
|
+
[@yozora/tokenizer-footnote-reference]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/footnote-reference#readme
|
|
240
|
+
[@yozora/tokenizer-heading]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/heading#readme
|
|
241
|
+
[@yozora/tokenizer-html-block]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/html-block#readme
|
|
242
|
+
[@yozora/tokenizer-html-inline]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/html-inline#readme
|
|
243
|
+
[@yozora/tokenizer-image]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/image#readme
|
|
244
|
+
[@yozora/tokenizer-image-reference]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/image-reference#readme
|
|
245
|
+
[@yozora/tokenizer-indented-code]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/indented-code#readme
|
|
246
|
+
[@yozora/tokenizer-inline-code]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/inline-code#readme
|
|
247
|
+
[@yozora/tokenizer-inline-math]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/inline-math#readme
|
|
248
|
+
[@yozora/tokenizer-link]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/link#readme
|
|
249
|
+
[@yozora/tokenizer-link-reference]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/link-reference#readme
|
|
250
|
+
[@yozora/tokenizer-list]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/list#readme
|
|
251
|
+
[@yozora/tokenizer-math]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/math#readme
|
|
252
|
+
[@yozora/tokenizer-paragraph]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/paragraph#readme
|
|
253
|
+
[@yozora/tokenizer-setext-heading]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/setext-heading#readme
|
|
254
|
+
[@yozora/tokenizer-table]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/table#readme
|
|
255
|
+
[@yozora/tokenizer-text]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/text#readme
|
|
256
|
+
[@yozora/tokenizer-thematic-break]: https://github.com/yozorajs/yozora/tree/v2.1.5/tokenizers/thematic-break#readme
|
|
257
257
|
|
|
258
258
|
[@yozora/react-admonition]: https://github.com/yozorajs/yozora-react/tree/main/packages/admonition#readme
|
|
259
259
|
[@yozora/react-blockquote]: https://github.com/yozorajs/yozora-react/tree/main/packages/blockquote#readme
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-ecma-import",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"lib/",
|
|
30
|
-
"
|
|
30
|
+
"!lib/**/*.map",
|
|
31
31
|
"package.json",
|
|
32
32
|
"CHANGELOG.md",
|
|
33
33
|
"LICENSE",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"test": "cross-env TS_NODE_FILES=true NODE_OPTIONS=--experimental-vm-modules jest --config ../../jest.config.mjs --rootDir ."
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@yozora/ast": "^2.1.
|
|
43
|
-
"@yozora/character": "^2.1.
|
|
44
|
-
"@yozora/core-tokenizer": "^2.1.
|
|
42
|
+
"@yozora/ast": "^2.1.5",
|
|
43
|
+
"@yozora/character": "^2.1.5",
|
|
44
|
+
"@yozora/core-tokenizer": "^2.1.5"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "4f753bcf0fd921938464802462dc48c53bbd014d"
|
|
47
47
|
}
|
package/src/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { match as ecmaImportMatch } from './match'
|
|
2
|
-
export { parse as ecmaImportParse } from './parse'
|
|
3
|
-
export { EcmaImportTokenizer, EcmaImportTokenizer as default } from './tokenizer'
|
|
4
|
-
export { uniqueName as EcmaImportTokenizerName } from './types'
|
|
5
|
-
export type {
|
|
6
|
-
IThis as ecmaImportHookContext,
|
|
7
|
-
IToken as IEcmaImportToken,
|
|
8
|
-
ITokenizerProps as IEcmaImportProps,
|
|
9
|
-
} from './types'
|
package/src/match.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import type { Position } from '@yozora/ast'
|
|
2
|
-
import { EcmaImportType } from '@yozora/ast'
|
|
3
|
-
import {
|
|
4
|
-
AsciiCodePoint,
|
|
5
|
-
calcStringFromNodePoints,
|
|
6
|
-
calcTrimBoundaryOfCodePoints,
|
|
7
|
-
} from '@yozora/character'
|
|
8
|
-
import type {
|
|
9
|
-
IMatchBlockHookCreator,
|
|
10
|
-
IPhrasingContentLine,
|
|
11
|
-
IResultOfEatOpener,
|
|
12
|
-
} from '@yozora/core-tokenizer'
|
|
13
|
-
import { calcEndPoint, calcStartPoint } from '@yozora/core-tokenizer'
|
|
14
|
-
import type { IThis, IToken, T } from './types'
|
|
15
|
-
import { regex1, regex2, regex3, resolveNameImports } from './util'
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Examples
|
|
19
|
-
*
|
|
20
|
-
* import '@yozora/parser'
|
|
21
|
-
* import Parser from '@yozora/parser'
|
|
22
|
-
* import Parser, { YozoraParserProps } from '@yozora/parser'
|
|
23
|
-
* import { YozoraParserProps } from '@yozora/parser'
|
|
24
|
-
* import { YozoraParser, YozoraParser as Parser } from '@yozora/parser'
|
|
25
|
-
*
|
|
26
|
-
* @see https://github.com/syntax-tree/mdast#strong
|
|
27
|
-
* @see https://github.github.com/gfm/#emphasis-and-strong-emphasis
|
|
28
|
-
*/
|
|
29
|
-
export const match: IMatchBlockHookCreator<T, IToken, IThis> = function () {
|
|
30
|
-
return {
|
|
31
|
-
isContainingBlock: false,
|
|
32
|
-
eatOpener,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function eatOpener(line: Readonly<IPhrasingContentLine>): IResultOfEatOpener<T, IToken> {
|
|
36
|
-
/**
|
|
37
|
-
* Four spaces are too much
|
|
38
|
-
* @see https://github.github.com/gfm/#example-180
|
|
39
|
-
*/
|
|
40
|
-
if (line.countOfPrecedeSpaces >= 4) return null
|
|
41
|
-
|
|
42
|
-
const { nodePoints, startIndex, endIndex, firstNonWhitespaceIndex } = line
|
|
43
|
-
if (firstNonWhitespaceIndex + 8 >= endIndex) return null
|
|
44
|
-
|
|
45
|
-
const i = firstNonWhitespaceIndex
|
|
46
|
-
|
|
47
|
-
if (nodePoints[i].codePoint !== AsciiCodePoint.LOWERCASE_I) return null
|
|
48
|
-
if (nodePoints[i + 1].codePoint !== AsciiCodePoint.LOWERCASE_M) return null
|
|
49
|
-
if (nodePoints[i + 2].codePoint !== AsciiCodePoint.LOWERCASE_P) return null
|
|
50
|
-
if (nodePoints[i + 3].codePoint !== AsciiCodePoint.LOWERCASE_O) return null
|
|
51
|
-
if (nodePoints[i + 4].codePoint !== AsciiCodePoint.LOWERCASE_R) return null
|
|
52
|
-
if (nodePoints[i + 5].codePoint !== AsciiCodePoint.LOWERCASE_T) return null
|
|
53
|
-
|
|
54
|
-
const [left, right] = calcTrimBoundaryOfCodePoints(
|
|
55
|
-
nodePoints,
|
|
56
|
-
firstNonWhitespaceIndex,
|
|
57
|
-
endIndex,
|
|
58
|
-
)
|
|
59
|
-
const text: string = calcStringFromNodePoints(nodePoints, left, right)
|
|
60
|
-
let m: RegExpExecArray | null
|
|
61
|
-
|
|
62
|
-
let token: IToken | null = null
|
|
63
|
-
const position = (): Position => ({
|
|
64
|
-
start: calcStartPoint(nodePoints, startIndex),
|
|
65
|
-
end: calcEndPoint(nodePoints, endIndex - 1),
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
// eslint-disable-next-line no-cond-assign
|
|
69
|
-
if ((m = regex1.exec(text)) != null) {
|
|
70
|
-
token = {
|
|
71
|
-
nodeType: EcmaImportType,
|
|
72
|
-
position: position(),
|
|
73
|
-
moduleName: m[2],
|
|
74
|
-
defaultImport: null,
|
|
75
|
-
namedImports: [],
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// eslint-disable-next-line no-cond-assign
|
|
80
|
-
else if ((m = regex2.exec(text)) != null) {
|
|
81
|
-
token = {
|
|
82
|
-
nodeType: EcmaImportType,
|
|
83
|
-
position: position(),
|
|
84
|
-
moduleName: m[3],
|
|
85
|
-
defaultImport: m[1],
|
|
86
|
-
namedImports: [],
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// eslint-disable-next-line no-cond-assign
|
|
91
|
-
else if ((m = regex3.exec(text)) != null) {
|
|
92
|
-
token = {
|
|
93
|
-
nodeType: EcmaImportType,
|
|
94
|
-
position: position(),
|
|
95
|
-
moduleName: m[4],
|
|
96
|
-
defaultImport: m[1],
|
|
97
|
-
namedImports: resolveNameImports(m[2]),
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return token === null ? null : { token, nextIndex: endIndex, saturated: true }
|
|
102
|
-
}
|
|
103
|
-
}
|
package/src/parse.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { EcmaImportType } from '@yozora/ast'
|
|
2
|
-
import type { IParseBlockHookCreator } from '@yozora/core-tokenizer'
|
|
3
|
-
import type { INode, IThis, IToken, T } from './types'
|
|
4
|
-
|
|
5
|
-
export const parse: IParseBlockHookCreator<T, IToken, INode, IThis> = function (api) {
|
|
6
|
-
return {
|
|
7
|
-
parse: tokens =>
|
|
8
|
-
tokens.map(token => {
|
|
9
|
-
const node: INode = api.shouldReservePosition
|
|
10
|
-
? {
|
|
11
|
-
type: EcmaImportType,
|
|
12
|
-
position: token.position,
|
|
13
|
-
moduleName: token.moduleName,
|
|
14
|
-
defaultImport: token.defaultImport,
|
|
15
|
-
namedImports: token.namedImports,
|
|
16
|
-
}
|
|
17
|
-
: {
|
|
18
|
-
type: EcmaImportType,
|
|
19
|
-
moduleName: token.moduleName,
|
|
20
|
-
defaultImport: token.defaultImport,
|
|
21
|
-
namedImports: token.namedImports,
|
|
22
|
-
}
|
|
23
|
-
return node
|
|
24
|
-
}),
|
|
25
|
-
}
|
|
26
|
-
}
|
package/src/tokenizer.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
IBlockTokenizer,
|
|
3
|
-
IMatchBlockHookCreator,
|
|
4
|
-
IParseBlockHookCreator,
|
|
5
|
-
} from '@yozora/core-tokenizer'
|
|
6
|
-
import { BaseBlockTokenizer, TokenizerPriority } from '@yozora/core-tokenizer'
|
|
7
|
-
import { match } from './match'
|
|
8
|
-
import { parse } from './parse'
|
|
9
|
-
import type { INode, IThis, IToken, ITokenizerProps, T } from './types'
|
|
10
|
-
import { uniqueName } from './types'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Lexical Analyzer for Ecma Import statement
|
|
14
|
-
* @see https://github.com/syntax-tree/mdast#strong
|
|
15
|
-
* @see https://github.github.com/gfm/#emphasis-and-strong-emphasis
|
|
16
|
-
*/
|
|
17
|
-
export class EcmaImportTokenizer
|
|
18
|
-
extends BaseBlockTokenizer<T, IToken, INode, IThis>
|
|
19
|
-
implements IBlockTokenizer<T, IToken, INode, IThis>
|
|
20
|
-
{
|
|
21
|
-
/* istanbul ignore next */
|
|
22
|
-
constructor(props: ITokenizerProps = {}) {
|
|
23
|
-
super({
|
|
24
|
-
name: props.name ?? uniqueName,
|
|
25
|
-
priority: props.priority ?? TokenizerPriority.ATOMIC,
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public override readonly match: IMatchBlockHookCreator<T, IToken, IThis> = match
|
|
30
|
-
|
|
31
|
-
public override readonly parse: IParseBlockHookCreator<T, IToken, INode, IThis> = parse
|
|
32
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { EcmaImport, EcmaImportType } from '@yozora/ast'
|
|
2
|
-
import type {
|
|
3
|
-
IBaseBlockTokenizerProps,
|
|
4
|
-
IPartialBlockToken,
|
|
5
|
-
ITokenizer,
|
|
6
|
-
} from '@yozora/core-tokenizer'
|
|
7
|
-
|
|
8
|
-
export type T = EcmaImportType
|
|
9
|
-
export type INode = EcmaImport
|
|
10
|
-
export const uniqueName = '@yozora/tokenizer-ecma-import'
|
|
11
|
-
|
|
12
|
-
export type IToken = IPartialBlockToken<T> & Omit<EcmaImport, 'type'>
|
|
13
|
-
|
|
14
|
-
export type IThis = ITokenizer
|
|
15
|
-
|
|
16
|
-
export type ITokenizerProps = Partial<IBaseBlockTokenizerProps>
|
package/src/util.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { IEcmaImportNamedImport } from '@yozora/ast'
|
|
2
|
-
|
|
3
|
-
const namedImportItemRegex = /^(\w+)(?:\s+as\s+(\w+))?$/
|
|
4
|
-
const namedImportRegex = /\{\s*((?:[\w]+(?:\s+as\s+[\w]+)?\s*,\s*)*[\w]+(?:\s+as\s+[\w]+)?)\s*\}\s*/
|
|
5
|
-
const endRegex = /\s*;*\s*$/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* import '@yozora.parser'
|
|
9
|
-
*/
|
|
10
|
-
export const regex1 = new RegExp(/^import\s+(['"])([^'"]+)\1/.source + endRegex.source)
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* import Parser from '@yozora/parser'
|
|
14
|
-
*/
|
|
15
|
-
export const regex2 = new RegExp(
|
|
16
|
-
/^import\s+([\w]+)\s+from\s+(['"])([^'"]+)\2/.source + endRegex.source,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* import Parser, { YozoraParser } from '@yozora/parser'
|
|
21
|
-
* import Parser, { YozoraParser as Parser } from '@yozora/parser'
|
|
22
|
-
* import Parser, { YozoraParser, YozoraParser as Parser } from '@yozora/parser'
|
|
23
|
-
* import { YozoraParser } from '@yozora/parser'
|
|
24
|
-
* import { YozoraParser as Parser } from '@yozora/parser'
|
|
25
|
-
* import { YozoraParser, YozoraParser as Parser } from '@yozora/parser'
|
|
26
|
-
*/
|
|
27
|
-
export const regex3 = new RegExp(
|
|
28
|
-
/^import\s+(?:([\w]+)\s*,\s*)?/.source +
|
|
29
|
-
namedImportRegex.source +
|
|
30
|
-
/from\s+(['"])([^'"]+)\3/.source +
|
|
31
|
-
endRegex.source,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @param text
|
|
37
|
-
*/
|
|
38
|
-
export function resolveNameImports(text: string): IEcmaImportNamedImport[] {
|
|
39
|
-
const items = text.split(/\s*,\s*/g).filter(item => item.length > 0)
|
|
40
|
-
const result: IEcmaImportNamedImport[] = []
|
|
41
|
-
for (const item of items) {
|
|
42
|
-
const [, src, alias] = namedImportItemRegex.exec(item)!
|
|
43
|
-
result.push({ src, alias: alias == null ? null : alias })
|
|
44
|
-
}
|
|
45
|
-
return result
|
|
46
|
-
}
|