@ota-meshi/ast-token-store 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.mts CHANGED
@@ -66,6 +66,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
66
66
  * Gets the first token of the given node with options.
67
67
  */
68
68
  getFirstToken<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
69
+ /**
70
+ * Gets the first token of the given node with complex options.
71
+ */
72
+ getFirstToken<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithSkipOptionsWithoutFilter | CursorWithSkipOptionsWithFilter<Token, R & Token> | CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
69
73
  /**
70
74
  * Gets the first tokens of the given node.
71
75
  */
@@ -78,6 +82,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
78
82
  * Gets the first tokens of the given node with comment options.
79
83
  */
80
84
  getFirstTokens<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
85
+ /**
86
+ * Gets the first tokens of the given node with complex options.
87
+ */
88
+ getFirstTokens<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithCountOptionsWithoutFilter | CursorWithCountOptionsWithFilter<Token, R & Token> | CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
81
89
  /**
82
90
  * Gets the last token of the given node.
83
91
  */
@@ -94,6 +102,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
94
102
  * Gets the last token of the given node with options.
95
103
  */
96
104
  getLastToken<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
105
+ /**
106
+ * Gets the last token of the given node with complex options.
107
+ */
108
+ getLastToken<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithSkipOptionsWithoutFilter | CursorWithSkipOptionsWithFilter<Token, R & Token> | CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
97
109
  /**
98
110
  * Get the last tokens of the given node.
99
111
  */
@@ -106,6 +118,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
106
118
  * Get the last tokens of the given node with comment options.
107
119
  */
108
120
  getLastTokens<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
121
+ /**
122
+ * Get the last tokens of the given node with complex options.
123
+ */
124
+ getLastTokens<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithCountOptionsWithoutFilter | CursorWithCountOptionsWithFilter<Token, R & Token> | CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
109
125
  /**
110
126
  * Gets the token that follows a given node or token.
111
127
  */
@@ -118,6 +134,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
118
134
  * Gets the token that follows a given node or token with comment options.
119
135
  */
120
136
  getTokenAfter<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
137
+ /**
138
+ * Gets the token that follows a given node or token with complex options.
139
+ */
140
+ getTokenAfter<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithSkipOptionsWithoutFilter | CursorWithSkipOptionsWithFilter<Token, R & Token> | CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
121
141
  /**
122
142
  * Gets the `count` tokens that follows a given node or token.
123
143
  */
@@ -130,6 +150,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
130
150
  * Gets the `count` tokens that follows a given node or token with comment options.
131
151
  */
132
152
  getTokensAfter<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
153
+ /**
154
+ * Gets the `count` tokens that follows a given node or token with complex options.
155
+ */
156
+ getTokensAfter<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithCountOptionsWithoutFilter | CursorWithCountOptionsWithFilter<Token, R & Token> | CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
133
157
  /**
134
158
  * Gets the token that precedes a given node or token.
135
159
  */
@@ -142,6 +166,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
142
166
  * Gets the token that precedes a given node or token with comment options.
143
167
  */
144
168
  getTokenBefore<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
169
+ /**
170
+ * Gets the token that precedes a given node or token with complex options.
171
+ */
172
+ getTokenBefore<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithSkipOptionsWithoutFilter | CursorWithSkipOptionsWithFilter<Token, R & Token> | CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
145
173
  /**
146
174
  * Gets the `count` tokens that precedes a given node or token.
147
175
  */
@@ -154,6 +182,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
154
182
  * Gets the `count` tokens that precedes a given node or token with comment options.
155
183
  */
156
184
  getTokensBefore<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
185
+ /**
186
+ * Gets the `count` tokens that precedes a given node or token with complex options.
187
+ */
188
+ getTokensBefore<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithCountOptionsWithoutFilter | CursorWithCountOptionsWithFilter<Token, R & Token> | CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
157
189
  /**
158
190
  * Gets the first token between two non-overlapping nodes.
159
191
  */
@@ -166,6 +198,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
166
198
  * Gets the first token between two non-overlapping nodes with comment options.
167
199
  */
168
200
  getFirstTokenBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options: CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
201
+ /**
202
+ * Gets the first token between two non-overlapping nodes with complex options.
203
+ */
204
+ getFirstTokenBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options?: CursorWithSkipOptionsWithoutFilter | CursorWithSkipOptionsWithFilter<Token, R & Token> | CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
169
205
  /**
170
206
  * Gets the first tokens between two non-overlapping nodes.
171
207
  */
@@ -178,6 +214,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
178
214
  * Gets the first tokens between two non-overlapping nodes with comment options.
179
215
  */
180
216
  getFirstTokensBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options: CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
217
+ /**
218
+ * Gets the first tokens between two non-overlapping nodes with complex options.
219
+ */
220
+ getFirstTokensBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options?: CursorWithCountOptionsWithoutFilter | CursorWithCountOptionsWithFilter<Token, R & Token> | CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
181
221
  /**
182
222
  * Gets the last token between two non-overlapping nodes.
183
223
  */
@@ -190,6 +230,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
190
230
  * Gets the last token between two non-overlapping nodes with comment options.
191
231
  */
192
232
  getLastTokenBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options: CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
233
+ /**
234
+ * Gets the last token between two non-overlapping nodes with complex options.
235
+ */
236
+ getLastTokenBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options?: CursorWithSkipOptionsWithoutFilter | CursorWithSkipOptionsWithFilter<Token, R & Token> | CursorWithSkipOptionsWithComment<Token, Comment, R>): R | null;
193
237
  /**
194
238
  * Gets the last tokens between two non-overlapping nodes.
195
239
  */
@@ -202,6 +246,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
202
246
  * Gets the last tokens between two non-overlapping nodes with comment options.
203
247
  */
204
248
  getLastTokensBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options: CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
249
+ /**
250
+ * Gets the last tokens between two non-overlapping nodes with complex options.
251
+ */
252
+ getLastTokensBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options?: CursorWithCountOptionsWithoutFilter | CursorWithCountOptionsWithFilter<Token, R & Token> | CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
205
253
  /**
206
254
  * Gets all tokens that are related to the given node.
207
255
  */
@@ -214,6 +262,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
214
262
  * Gets all tokens that are related to the given node with comment options.
215
263
  */
216
264
  getTokens<R extends Token | Comment>(node: Node | Token | Comment, options: CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
265
+ /**
266
+ * Gets all tokens that are related to the given node with complex options.
267
+ */
268
+ getTokens<R extends Token | Comment>(node: Node | Token | Comment, options?: CursorWithCountOptionsWithoutFilter | CursorWithCountOptionsWithFilter<Token, R & Token> | CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
217
269
  /**
218
270
  * Gets all of the tokens between two non-overlapping nodes.
219
271
  */
@@ -226,6 +278,10 @@ declare class TokenStore<Node extends SyntaxElement, Token extends SyntaxElement
226
278
  * Gets all of the tokens between two non-overlapping nodes with comment options.
227
279
  */
228
280
  getTokensBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, options: CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
281
+ /**
282
+ * Gets all of the tokens between two non-overlapping nodes with complex options.
283
+ */
284
+ getTokensBetween<R extends Token | Comment>(left: Node | Token | Comment, right: Node | Token | Comment, paddingOrOptions?: CursorWithCountOptionsWithoutFilter | CursorWithCountOptionsWithFilter<Token, R & Token> | CursorWithCountOptionsWithComment<Token, Comment, R>): R[];
229
285
  /**
230
286
  * Gets all comment tokens inside the given node or token.
231
287
  */
package/lib/index.mjs CHANGED
@@ -446,7 +446,7 @@ var TokenStore = class {
446
446
  //#endregion
447
447
  //#region package.json
448
448
  var name$1 = "@ota-meshi/ast-token-store";
449
- var version$1 = "0.2.2";
449
+ var version$1 = "0.3.0";
450
450
 
451
451
  //#endregion
452
452
  //#region src/meta.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ota-meshi/ast-token-store",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "A class library that provides an API similar to ESLint's token store",
5
5
  "type": "module",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "mocha": "npm run ts -- ./node_modules/mocha/bin/mocha.js",
32
32
  "update": "node --experimental-strip-types --experimental-transform-types ./tools/update.ts",
33
33
  "generate:version": "npm run update && npm run lint -- --fix",
34
- "changeset:version": "changeset version && npm run generate:version && git add --all",
34
+ "changeset:version": "changeset version && npm i && npm run generate:version && git add --all",
35
35
  "changeset:publish": "npm run build && changeset publish"
36
36
  },
37
37
  "repository": {
@@ -49,15 +49,12 @@
49
49
  "url": "https://github.com/ota-meshi/ast-token-store/issues"
50
50
  },
51
51
  "homepage": "https://github.com/ota-meshi/ast-token-store/",
52
- "peerDependencies": {
53
- "eslint": ">=9.0.0"
54
- },
55
52
  "devDependencies": {
56
53
  "@changesets/changelog-github": "^0.5.1",
57
54
  "@changesets/cli": "^2.28.1",
58
55
  "@eslint/core": "^1.0.0",
59
56
  "@eslint/markdown": "^7.4.0",
60
- "@ota-meshi/eslint-plugin": "^0.19.0",
57
+ "@ota-meshi/eslint-plugin": "^0.20.0",
61
58
  "@shikijs/vitepress-twoslash": "^3.0.0",
62
59
  "@types/eslint": "^9.6.1",
63
60
  "@types/eslint-scope": "^8.0.0",
@@ -70,12 +67,12 @@
70
67
  "@types/semver": "^7.5.8",
71
68
  "assert": "^2.1.0",
72
69
  "c8": "^10.1.3",
73
- "eslint": "^9.34.0",
70
+ "eslint": "^10.0.1",
74
71
  "eslint-compat-utils": "^0.6.4",
75
72
  "eslint-config-prettier": "^10.1.1",
76
73
  "eslint-plugin-eslint-comments": "^3.2.0",
77
74
  "eslint-plugin-eslint-plugin": "^7.0.0",
78
- "eslint-plugin-jsdoc": "^55.0.0",
75
+ "eslint-plugin-jsdoc": "^62.7.0",
79
76
  "eslint-plugin-json-schema-validator": "^6.0.0",
80
77
  "eslint-plugin-jsonc": "^2.19.1",
81
78
  "eslint-plugin-markdown": "^5.1.0",
@@ -99,7 +96,7 @@
99
96
  "tsdown": "^0.19.0",
100
97
  "tsx": "^4.19.3",
101
98
  "typescript": "~5.9.0",
102
- "typescript-eslint": "^8.26.1",
99
+ "typescript-eslint": "^8.56.0",
103
100
  "vitepress": "^1.6.3",
104
101
  "vue-eslint-parser": "^10.0.0"
105
102
  },