@tsrx/oxc 0.0.0-trusted-publishing-bootstrap → 0.8.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +141 -0
  3. package/THIRD_PARTY_NOTICES.md +49 -0
  4. package/bin/oxc-tsrx +2 -0
  5. package/bin/oxc-tsrx-fmt +2 -0
  6. package/bin/oxc-tsrx-lint +2 -0
  7. package/bin/oxc-tsrx-lsp +2 -0
  8. package/bin/oxfmt +2 -0
  9. package/bin/oxlint +2 -0
  10. package/dist/bin/oxc-tsrx-fmt.js +13 -0
  11. package/dist/bin/oxc-tsrx-lint.js +13 -0
  12. package/dist/bin/oxc-tsrx-lsp.js +13 -0
  13. package/dist/bin/oxc-tsrx.js +115 -0
  14. package/dist/bin/oxfmt.js +24 -0
  15. package/dist/bin/oxlint.js +33 -0
  16. package/dist/canonical-command.d.ts +50 -0
  17. package/dist/canonical-command.js +196 -0
  18. package/dist/compat.d.ts +149 -0
  19. package/dist/compat.js +1615 -0
  20. package/dist/editor-resolution.js +508 -0
  21. package/dist/format-cli.js +276 -0
  22. package/dist/format-invocation.js +97 -0
  23. package/dist/format.d.ts +1 -0
  24. package/dist/format.js +56 -0
  25. package/dist/index.d.ts +8 -0
  26. package/dist/index.js +16 -0
  27. package/dist/lint-cli.js +487 -0
  28. package/dist/lint-invocation.js +192 -0
  29. package/dist/lint-js-plugins.js +819 -0
  30. package/dist/lint-plugins-dev.d.ts +1 -0
  31. package/dist/lint-plugins-dev.js +2 -0
  32. package/dist/lint-prestart.js +16 -0
  33. package/dist/lint.d.ts +1 -0
  34. package/dist/lint.js +2 -0
  35. package/dist/native-targets.js +76 -0
  36. package/dist/oxlint-lsp-multiplexer.js +622 -0
  37. package/dist/package-binary.js +29 -0
  38. package/dist/parser.d.ts +216 -0
  39. package/dist/parser.js +557 -0
  40. package/dist/process.js +88 -0
  41. package/dist/provider-resolve.d.ts +160 -0
  42. package/dist/provider-resolve.js +471 -0
  43. package/dist/providers-report.js +49 -0
  44. package/dist/runtime.js +323 -0
  45. package/dist/spawn-command.d.ts +20 -0
  46. package/dist/spawn-command.js +87 -0
  47. package/dist/tsrx-core-compat/facade.js +1184 -0
  48. package/dist/tsrx-core-compat/index.d.ts +6 -0
  49. package/dist/tsrx-core-compat/index.js +9 -0
  50. package/dist/tsrx-core-compat/style.js +525 -0
  51. package/dist/tsrx-core-compat/types/estree.d.ts +20 -0
  52. package/dist/tsrx-core-compat/types/index.d.ts +50 -0
  53. package/dist/tsrx-transfer.js +352 -0
  54. package/package.json +144 -5
@@ -0,0 +1,6 @@
1
+ import type { ParseOptions } from "./types/index.js";
2
+ import type { Program } from "./types/estree.js";
3
+
4
+ export function parseModule(source: string, filename?: string, options?: ParseOptions): Program;
5
+ export function isEventAttribute(name: string): boolean;
6
+ export function normalizeEventName(name: string): string;
@@ -0,0 +1,9 @@
1
+ import { createTsrxCoreCompat } from "./facade.js";
2
+ import * as parser from "@tsrx/oxc/parser";
3
+ //#region src/index.ts
4
+ const facade = createTsrxCoreCompat(parser);
5
+ const parseModule = facade.parseModule;
6
+ const isEventAttribute = facade.isEventAttribute;
7
+ const normalizeEventName = facade.normalizeEventName;
8
+ //#endregion
9
+ export { isEventAttribute, normalizeEventName, parseModule };
@@ -0,0 +1,525 @@
1
+ import { createHash } from "node:crypto";
2
+ //#region src/style.ts
3
+ /** @import * as AST from 'estree' */
4
+ /** @import { NonEmptyString } from '../../types/helpers' */
5
+ function strong_hash(value) {
6
+ return createHash("sha256").update(value.replace(/\r/g, "")).digest("hex").slice(0, 8);
7
+ }
8
+ const REGEX_MATCHER = /^[~^$*|]?=/;
9
+ const REGEX_ATTRIBUTE_FLAGS = /^[a-zA-Z]+/;
10
+ const REGEX_COMMENT_CLOSE = /\*\//;
11
+ const REGEX_HTML_COMMENT_CLOSE = /-->/;
12
+ const REGEX_PERCENTAGE = /^\d+(\.\d+)?%/;
13
+ const REGEX_COMBINATOR = /^(\+|~|>|\|\|)/;
14
+ const REGEX_VALID_IDENTIFIER_CHAR = /[a-zA-Z0-9_-]/;
15
+ const REGEX_LEADING_HYPHEN_OR_DIGIT = /-?\d/;
16
+ const REGEX_WHITESPACE_OR_COLON = /[\s:]/;
17
+ const REGEX_NTH_OF = /^(even|odd|\+?(\d+|\d*n(\s*[+-]\s*\d+)?)|-\d*n(\s*\+\s*\d+))((?=\s*[,)])|\s+of\s+)/;
18
+ const regex_whitespace = /\s/;
19
+ var Parser = class {
20
+ index = 0;
21
+ loose;
22
+ template_untrimmed;
23
+ template;
24
+ /**
25
+ * @param {string} template
26
+ * @param {boolean} loose
27
+ */
28
+ constructor(template, loose) {
29
+ if (typeof template !== "string") throw new TypeError("Template must be a string");
30
+ this.loose = loose;
31
+ this.template_untrimmed = template;
32
+ this.template = template.trimEnd();
33
+ }
34
+ /** @param {string} str */
35
+ match(str) {
36
+ const length = str.length;
37
+ if (length === 1) return this.template[this.index] === str;
38
+ return this.template.slice(this.index, this.index + length) === str;
39
+ }
40
+ /**
41
+ * @param {string} str
42
+ * @param {boolean} required
43
+ * @param {boolean} required_in_loose
44
+ */
45
+ eat(str, required = false, required_in_loose = true) {
46
+ if (this.match(str)) {
47
+ this.index += str.length;
48
+ return true;
49
+ }
50
+ if (required && (!this.loose || required_in_loose)) throw new Error(`Expected ${str}`);
51
+ return false;
52
+ }
53
+ /**
54
+ * Match a regex at the current index
55
+ * @param {RegExp} pattern Should have a ^ anchor at the start so the regex doesn't search past the beginning, resulting in worse performance
56
+ */
57
+ match_regex(pattern) {
58
+ const match = pattern.exec(this.template.slice(this.index));
59
+ if (!match || match.index !== 0) return null;
60
+ return match[0];
61
+ }
62
+ /**
63
+ * Search for a regex starting at the current index and return the result if it matches
64
+ * @param {RegExp} pattern Should have a ^ anchor at the start so the regex doesn't search past the beginning, resulting in worse performance
65
+ */
66
+ read(pattern) {
67
+ const result = this.match_regex(pattern);
68
+ if (result) this.index += result.length;
69
+ return result;
70
+ }
71
+ allow_whitespace() {
72
+ while (this.index < this.template.length && regex_whitespace.test(this.template[this.index])) this.index++;
73
+ }
74
+ /** @param {RegExp} pattern */
75
+ read_until(pattern) {
76
+ if (this.index >= this.template.length) {
77
+ if (this.loose) return "";
78
+ throw new Error("Unexpected end of input");
79
+ }
80
+ const start = this.index;
81
+ const match = pattern.exec(this.template.slice(start));
82
+ if (match) {
83
+ this.index = start + match.index;
84
+ return this.template.slice(start, this.index);
85
+ }
86
+ this.index = this.template.length;
87
+ return this.template.slice(start);
88
+ }
89
+ };
90
+ /**
91
+ * @template {string} T
92
+ * @param {string} content
93
+ * @param {{ filename: NonEmptyString<T>, line: number, column: number }} location position of the `<style>` tag in the source file
94
+ * @param {{ loose?: boolean }} options
95
+ * @returns {AST.CSS.StyleSheet}
96
+ */
97
+ function parse_style(content, location, options) {
98
+ const parser = new Parser(content, options.loose || false);
99
+ return {
100
+ source: content,
101
+ hash: `tsrx-${strong_hash(`${location.filename}:${location.line}:${location.column}:${content}`)}`,
102
+ type: "StyleSheet",
103
+ children: read_body(parser),
104
+ start: 0,
105
+ end: content.length
106
+ };
107
+ }
108
+ /** @param {Parser} parser */
109
+ function allow_comment_or_whitespace(parser) {
110
+ parser.allow_whitespace();
111
+ while (parser.match("/*") || parser.match("<!--")) {
112
+ if (parser.eat("/*")) {
113
+ parser.read_until(REGEX_COMMENT_CLOSE);
114
+ parser.eat("*/", true);
115
+ }
116
+ if (parser.eat("<!--")) {
117
+ parser.read_until(REGEX_HTML_COMMENT_CLOSE);
118
+ parser.eat("-->", true);
119
+ }
120
+ parser.allow_whitespace();
121
+ }
122
+ }
123
+ /**
124
+ * @param {Parser} parser
125
+ * @returns {Array<AST.CSS.Rule | AST.CSS.Atrule>}
126
+ */
127
+ function read_body(parser) {
128
+ /** @type {Array<AST.CSS.Rule | AST.CSS.Atrule>} */
129
+ const children = [];
130
+ while (parser.index < parser.template.length) {
131
+ allow_comment_or_whitespace(parser);
132
+ if (parser.match("@")) children.push(read_at_rule(parser));
133
+ else children.push(read_rule(parser));
134
+ }
135
+ return children;
136
+ }
137
+ /**
138
+ * @param {Parser} parser
139
+ * @returns {AST.CSS.Atrule}
140
+ */
141
+ function read_at_rule(parser) {
142
+ const start = parser.index;
143
+ parser.eat("@", true);
144
+ const name = read_identifier(parser);
145
+ const prelude = read_value(parser);
146
+ /** @type {AST.CSS.Block | null} */
147
+ let block = null;
148
+ if (parser.match("{")) block = read_block(parser);
149
+ else parser.eat(";", true);
150
+ return {
151
+ type: "Atrule",
152
+ start,
153
+ end: parser.index,
154
+ name,
155
+ prelude,
156
+ block
157
+ };
158
+ }
159
+ /**
160
+ * @param {Parser} parser
161
+ * @returns {AST.CSS.Rule}
162
+ */
163
+ function read_rule(parser) {
164
+ const start = parser.index;
165
+ return {
166
+ type: "Rule",
167
+ prelude: read_selector_list(parser),
168
+ block: read_block(parser),
169
+ start,
170
+ end: parser.index,
171
+ metadata: {
172
+ parent_rule: null,
173
+ has_local_selectors: false,
174
+ is_global_block: false
175
+ }
176
+ };
177
+ }
178
+ /**
179
+ * @param {Parser} parser
180
+ * @returns {AST.CSS.Block}
181
+ */
182
+ function read_block(parser) {
183
+ const start = parser.index;
184
+ parser.eat("{", true);
185
+ /** @type {Array<AST.CSS.Declaration | AST.CSS.Rule | AST.CSS.Atrule>} */
186
+ const children = [];
187
+ while (parser.index < parser.template.length) {
188
+ allow_comment_or_whitespace(parser);
189
+ if (parser.match("}")) break;
190
+ else children.push(read_block_item(parser));
191
+ }
192
+ parser.eat("}", true);
193
+ return {
194
+ type: "Block",
195
+ start,
196
+ end: parser.index,
197
+ children
198
+ };
199
+ }
200
+ /**
201
+ * Reads a declaration, rule or at-rule
202
+ *
203
+ * @param {Parser} parser
204
+ * @returns {AST.CSS.Declaration | AST.CSS.Rule | AST.CSS.Atrule}
205
+ */
206
+ function read_block_item(parser) {
207
+ if (parser.match("@")) return read_at_rule(parser);
208
+ const start = parser.index;
209
+ read_value(parser);
210
+ const char = parser.template[parser.index];
211
+ parser.index = start;
212
+ return char === "{" ? read_rule(parser) : read_declaration(parser);
213
+ }
214
+ /**
215
+ * @param {Parser} parser
216
+ * @returns {AST.CSS.Declaration}
217
+ */
218
+ function read_declaration(parser) {
219
+ const start = parser.index;
220
+ const property = parser.read_until(REGEX_WHITESPACE_OR_COLON);
221
+ parser.allow_whitespace();
222
+ parser.eat(":");
223
+ parser.index;
224
+ parser.allow_whitespace();
225
+ const value = read_value(parser);
226
+ if (!value && !property.startsWith("--") && !parser.loose) throw new Error("CSS Declaration cannot be empty");
227
+ const end = parser.index;
228
+ if (!parser.match("}")) parser.eat(";", true);
229
+ return {
230
+ type: "Declaration",
231
+ start,
232
+ end,
233
+ property,
234
+ value
235
+ };
236
+ }
237
+ /**
238
+ * @param {Parser} parser
239
+ * @returns {string}
240
+ */
241
+ function read_value(parser) {
242
+ let value = "";
243
+ let escaped = false;
244
+ let in_url = false;
245
+ /** @type {null | '"' | "'"} */
246
+ let quote_mark = null;
247
+ while (parser.index < parser.template.length) {
248
+ const char = parser.template[parser.index];
249
+ if (escaped) {
250
+ value += "\\" + char;
251
+ escaped = false;
252
+ } else if (char === "\\") escaped = true;
253
+ else if (char === quote_mark) quote_mark = null;
254
+ else if (char === ")") in_url = false;
255
+ else if (quote_mark === null && (char === "\"" || char === "'")) quote_mark = char;
256
+ else if (char === "(" && value.slice(-3) === "url") in_url = true;
257
+ else if ((char === ";" || char === "{" || char === "}") && !in_url && !quote_mark) return value.trim();
258
+ value += char;
259
+ parser.index++;
260
+ }
261
+ throw new Error("Unexpected end of input");
262
+ }
263
+ /**
264
+ * @param {Parser} parser
265
+ * @param {boolean} [inside_pseudo_class]
266
+ * @returns {AST.CSS.SelectorList}
267
+ */
268
+ function read_selector_list(parser, inside_pseudo_class = false) {
269
+ /** @type {AST.CSS.ComplexSelector[]} */
270
+ const children = [];
271
+ allow_comment_or_whitespace(parser);
272
+ const start = parser.index;
273
+ while (parser.index < parser.template.length) {
274
+ children.push(read_selector(parser, inside_pseudo_class));
275
+ const end = parser.index;
276
+ allow_comment_or_whitespace(parser);
277
+ if (inside_pseudo_class ? parser.match(")") : parser.match("{")) return {
278
+ type: "SelectorList",
279
+ start,
280
+ end,
281
+ children
282
+ };
283
+ else {
284
+ parser.eat(",", true);
285
+ allow_comment_or_whitespace(parser);
286
+ }
287
+ }
288
+ throw new Error("Unexpected end of input");
289
+ }
290
+ /**
291
+ * @param {Parser} parser
292
+ * @returns {AST.CSS.Combinator | null}
293
+ */
294
+ function read_combinator(parser) {
295
+ const start = parser.index;
296
+ parser.allow_whitespace();
297
+ const index = parser.index;
298
+ const name = parser.read(REGEX_COMBINATOR);
299
+ if (name) {
300
+ const end = parser.index;
301
+ parser.allow_whitespace();
302
+ return {
303
+ type: "Combinator",
304
+ name,
305
+ start: index,
306
+ end
307
+ };
308
+ }
309
+ if (parser.index !== start) return {
310
+ type: "Combinator",
311
+ name: " ",
312
+ start,
313
+ end: parser.index
314
+ };
315
+ return null;
316
+ }
317
+ /**
318
+ * @param {Parser} parser
319
+ * @param {boolean} [inside_pseudo_class]
320
+ * @returns {AST.CSS.ComplexSelector}
321
+ */
322
+ function read_selector(parser, inside_pseudo_class = false) {
323
+ const list_start = parser.index;
324
+ /** @type {AST.CSS.RelativeSelector[]} */
325
+ const children = [];
326
+ /**
327
+ * @param {AST.CSS.Combinator | null} combinator
328
+ * @param {number} start
329
+ * @returns {AST.CSS.RelativeSelector}
330
+ */
331
+ function create_selector(combinator, start) {
332
+ return {
333
+ type: "RelativeSelector",
334
+ combinator,
335
+ selectors: [],
336
+ start,
337
+ end: -1,
338
+ metadata: {
339
+ is_global: false,
340
+ is_global_like: false,
341
+ scoped: false
342
+ }
343
+ };
344
+ }
345
+ /** @type {AST.CSS.RelativeSelector} */
346
+ let relative_selector = create_selector(null, parser.index);
347
+ while (parser.index < parser.template.length) {
348
+ let start = parser.index;
349
+ if (parser.eat("&")) relative_selector.selectors.push({
350
+ type: "NestingSelector",
351
+ name: "&",
352
+ start,
353
+ end: parser.index
354
+ });
355
+ else if (parser.eat("*")) {
356
+ let name = "*";
357
+ if (parser.eat("|")) name = read_identifier(parser);
358
+ relative_selector.selectors.push({
359
+ type: "TypeSelector",
360
+ name,
361
+ start,
362
+ end: parser.index
363
+ });
364
+ } else if (parser.eat("#")) relative_selector.selectors.push({
365
+ type: "IdSelector",
366
+ name: read_identifier(parser),
367
+ start,
368
+ end: parser.index
369
+ });
370
+ else if (parser.eat(".")) relative_selector.selectors.push({
371
+ type: "ClassSelector",
372
+ name: read_identifier(parser),
373
+ start,
374
+ end: parser.index
375
+ });
376
+ else if (parser.eat("::")) {
377
+ relative_selector.selectors.push({
378
+ type: "PseudoElementSelector",
379
+ name: read_identifier(parser),
380
+ start,
381
+ end: parser.index
382
+ });
383
+ if (parser.eat("(")) {
384
+ read_selector_list(parser, true);
385
+ parser.eat(")", true);
386
+ }
387
+ } else if (parser.eat(":")) {
388
+ const name = read_identifier(parser);
389
+ /** @type {null | AST.CSS.SelectorList} */
390
+ let args = null;
391
+ if (parser.eat("(")) {
392
+ args = read_selector_list(parser, true);
393
+ parser.eat(")", true);
394
+ }
395
+ relative_selector.selectors.push({
396
+ type: "PseudoClassSelector",
397
+ name,
398
+ args,
399
+ start,
400
+ end: parser.index
401
+ });
402
+ } else if (parser.eat("[")) {
403
+ parser.allow_whitespace();
404
+ const name = read_identifier(parser);
405
+ parser.allow_whitespace();
406
+ /** @type {string | null} */
407
+ let value = null;
408
+ const matcher = parser.read(REGEX_MATCHER);
409
+ if (matcher) {
410
+ parser.allow_whitespace();
411
+ value = read_attribute_value(parser);
412
+ }
413
+ parser.allow_whitespace();
414
+ const flags = parser.read(REGEX_ATTRIBUTE_FLAGS);
415
+ parser.allow_whitespace();
416
+ parser.eat("]", true);
417
+ relative_selector.selectors.push({
418
+ type: "AttributeSelector",
419
+ start,
420
+ end: parser.index,
421
+ name,
422
+ matcher,
423
+ value,
424
+ flags
425
+ });
426
+ } else if (inside_pseudo_class && parser.match_regex(REGEX_NTH_OF)) relative_selector.selectors.push({
427
+ type: "Nth",
428
+ value: /**@type {string} */ parser.read(REGEX_NTH_OF),
429
+ start,
430
+ end: parser.index
431
+ });
432
+ else if (parser.match_regex(REGEX_PERCENTAGE)) relative_selector.selectors.push({
433
+ type: "Percentage",
434
+ value: /** @type {string} */ parser.read(REGEX_PERCENTAGE),
435
+ start,
436
+ end: parser.index
437
+ });
438
+ else if (!parser.match_regex(REGEX_COMBINATOR)) {
439
+ let name = read_identifier(parser);
440
+ if (parser.eat("|")) name = read_identifier(parser);
441
+ relative_selector.selectors.push({
442
+ type: "TypeSelector",
443
+ name,
444
+ start,
445
+ end: parser.index
446
+ });
447
+ }
448
+ const index = parser.index;
449
+ allow_comment_or_whitespace(parser);
450
+ if (parser.match(",") || (inside_pseudo_class ? parser.match(")") : parser.match("{"))) {
451
+ parser.index = index;
452
+ relative_selector.end = index;
453
+ children.push(relative_selector);
454
+ return {
455
+ type: "ComplexSelector",
456
+ start: list_start,
457
+ end: index,
458
+ children,
459
+ metadata: {
460
+ rule: null,
461
+ used: false
462
+ }
463
+ };
464
+ }
465
+ parser.index = index;
466
+ const combinator = read_combinator(parser);
467
+ if (combinator) {
468
+ if (relative_selector.selectors.length > 0) {
469
+ relative_selector.end = index;
470
+ children.push(relative_selector);
471
+ }
472
+ relative_selector = create_selector(combinator, combinator.start);
473
+ parser.allow_whitespace();
474
+ if (parser.match(",") || (inside_pseudo_class ? parser.match(")") : parser.match("{"))) throw new Error(`Invalid selector at parser.index: ${parser.index}`);
475
+ }
476
+ }
477
+ throw new Error("Unexpected end of input");
478
+ }
479
+ /**
480
+ * Read a property that may or may not be quoted, e.g.
481
+ * `foo` or `'foo bar'` or `"foo bar"`
482
+ * @param {Parser} parser
483
+ */
484
+ function read_attribute_value(parser) {
485
+ let value = "";
486
+ let escaped = false;
487
+ const quote_mark = parser.eat("\"") ? "\"" : parser.eat("'") ? "'" : null;
488
+ while (parser.index < parser.template.length) {
489
+ const char = parser.template[parser.index];
490
+ if (escaped) {
491
+ value += "\\" + char;
492
+ escaped = false;
493
+ } else if (char === "\\") escaped = true;
494
+ else if (quote_mark ? char === quote_mark : /[\s\]]/.test(char)) {
495
+ if (quote_mark) parser.eat(quote_mark, true);
496
+ return value.trim();
497
+ } else value += char;
498
+ parser.index++;
499
+ }
500
+ throw new Error("Unexpected end of input");
501
+ }
502
+ /**
503
+ * https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
504
+ * @param {Parser} parser
505
+ */
506
+ function read_identifier(parser) {
507
+ parser.index;
508
+ let identifier = "";
509
+ if (parser.match_regex(REGEX_LEADING_HYPHEN_OR_DIGIT)) throw new Error("Unexpected CSS identifier");
510
+ let escaped = false;
511
+ while (parser.index < parser.template.length) {
512
+ const char = parser.template[parser.index];
513
+ if (escaped) {
514
+ identifier += "\\" + char;
515
+ escaped = false;
516
+ } else if (char === "\\") escaped = true;
517
+ else if (char.codePointAt(0) >= 160 || REGEX_VALID_IDENTIFIER_CHAR.test(char)) identifier += char;
518
+ else break;
519
+ parser.index++;
520
+ }
521
+ if (identifier === "") throw new Error("Expected identifier");
522
+ return identifier;
523
+ }
524
+ //#endregion
525
+ export { parse_style };
@@ -0,0 +1,20 @@
1
+ export * from "@oxc-project/types";
2
+
3
+ export interface Position {
4
+ line: number;
5
+ column: number;
6
+ }
7
+
8
+ export interface SourceLocation {
9
+ start: Position;
10
+ end: Position;
11
+ }
12
+
13
+ export interface CommentWithLocation {
14
+ type: "Line" | "Block";
15
+ value: string;
16
+ start: number;
17
+ end: number;
18
+ loc: SourceLocation;
19
+ context?: unknown | null;
20
+ }
@@ -0,0 +1,50 @@
1
+ import type { Program, CommentWithLocation, SourceLocation } from "./estree.js";
2
+
3
+ export interface CompileError extends Error {
4
+ code: string | undefined;
5
+ pos: number | undefined;
6
+ raisedAt: number | undefined;
7
+ end: number | undefined;
8
+ loc: SourceLocation | undefined;
9
+ fileName: string | null;
10
+ type: "fatal" | "usage";
11
+ }
12
+
13
+ export interface ParseOptions {
14
+ collect?: boolean;
15
+ loose?: boolean;
16
+ errors?: CompileError[];
17
+ comments?: CommentWithLocation[];
18
+ }
19
+
20
+ export interface CustomMappingData {
21
+ embeddedId?: string;
22
+ content?: string;
23
+ [key: string]: unknown;
24
+ }
25
+
26
+ export interface MappingData {
27
+ verification: boolean;
28
+ completion: boolean;
29
+ semantic: boolean;
30
+ navigation: boolean;
31
+ structure: boolean;
32
+ format: boolean;
33
+ customData: CustomMappingData;
34
+ }
35
+
36
+ export interface CodeMapping {
37
+ sourceOffsets: number[];
38
+ generatedOffsets: number[];
39
+ lengths: number[];
40
+ generatedLengths: number[];
41
+ data: MappingData;
42
+ }
43
+
44
+ export interface VolarMappingsResult {
45
+ code: string;
46
+ mappings: CodeMapping[];
47
+ cssMappings: CodeMapping[];
48
+ errors: CompileError[];
49
+ sourceAst: Program;
50
+ }