@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,216 @@
1
+ import type { Program } from "@oxc-project/types";
2
+
3
+ export * from "@oxc-project/types";
4
+
5
+ export type Language = "js" | "jsx" | "ts" | "tsx" | "dts" | "tsrx";
6
+ export type SourceType = "script" | "module" | "commonjs" | "unambiguous";
7
+ export type AstType = "js" | "ts";
8
+
9
+ export interface ParserOptions {
10
+ lang?: Language;
11
+ sourceType?: SourceType | undefined;
12
+ astType?: AstType;
13
+ range?: boolean;
14
+ preserveParens?: boolean;
15
+ showSemanticErrors?: boolean;
16
+ recovery?: "none" | "editor";
17
+ }
18
+
19
+ export interface Span {
20
+ start: number;
21
+ end: number;
22
+ }
23
+
24
+ export interface ValueSpan extends Span {
25
+ value: string;
26
+ }
27
+
28
+ export interface Comment extends Span {
29
+ type: "Line" | "Block";
30
+ value: string;
31
+ }
32
+
33
+ export interface ErrorLabel extends Span {
34
+ message: string | null;
35
+ }
36
+
37
+ export declare const enum Severity {
38
+ Error = "Error",
39
+ Warning = "Warning",
40
+ Advice = "Advice",
41
+ }
42
+
43
+ export interface OxcError {
44
+ severity: Severity;
45
+ message: string;
46
+ labels: ErrorLabel[];
47
+ helpMessage: string | null;
48
+ codeframe: string | null;
49
+ }
50
+
51
+ export declare const enum ImportNameKind {
52
+ Name = "Name",
53
+ NamespaceObject = "NamespaceObject",
54
+ Default = "Default",
55
+ }
56
+
57
+ export interface ImportName {
58
+ kind: ImportNameKind;
59
+ name: string | null;
60
+ start: number | null;
61
+ end: number | null;
62
+ }
63
+
64
+ export interface StaticImportEntry {
65
+ importName: ImportName;
66
+ localName: ValueSpan;
67
+ isType: boolean;
68
+ }
69
+
70
+ export interface StaticImport extends Span {
71
+ moduleRequest: ValueSpan;
72
+ entries: StaticImportEntry[];
73
+ }
74
+
75
+ export declare const enum ExportImportNameKind {
76
+ Name = "Name",
77
+ All = "All",
78
+ AllButDefault = "AllButDefault",
79
+ None = "None",
80
+ }
81
+
82
+ export declare const enum ExportExportNameKind {
83
+ Name = "Name",
84
+ Default = "Default",
85
+ None = "None",
86
+ }
87
+
88
+ export declare const enum ExportLocalNameKind {
89
+ Name = "Name",
90
+ Default = "Default",
91
+ None = "None",
92
+ }
93
+
94
+ export interface ExportImportName {
95
+ kind: ExportImportNameKind;
96
+ name: string | null;
97
+ start: number | null;
98
+ end: number | null;
99
+ }
100
+
101
+ export interface ExportExportName {
102
+ kind: ExportExportNameKind;
103
+ name: string | null;
104
+ start: number | null;
105
+ end: number | null;
106
+ }
107
+
108
+ export interface ExportLocalName {
109
+ kind: ExportLocalNameKind;
110
+ name: string | null;
111
+ start: number | null;
112
+ end: number | null;
113
+ }
114
+
115
+ export interface StaticExportEntry extends Span {
116
+ moduleRequest: ValueSpan | null;
117
+ importName: ExportImportName;
118
+ exportName: ExportExportName;
119
+ localName: ExportLocalName;
120
+ isType: boolean;
121
+ }
122
+
123
+ export interface StaticExport extends Span {
124
+ entries: StaticExportEntry[];
125
+ }
126
+
127
+ export interface DynamicImport extends Span {
128
+ moduleRequest: Span;
129
+ }
130
+
131
+ export interface EcmaScriptModule {
132
+ hasModuleSyntax: boolean;
133
+ staticImports: StaticImport[];
134
+ staticExports: StaticExport[];
135
+ dynamicImports: DynamicImport[];
136
+ importMetas: Span[];
137
+ }
138
+
139
+ export interface ParseResult {
140
+ readonly program: Program | null;
141
+ readonly module: EcmaScriptModule | null;
142
+ readonly comments: Comment[];
143
+ readonly errors: OxcError[];
144
+ }
145
+
146
+ /**
147
+ * What the installed native build supports. Every flag here answers a question
148
+ * about *this build*, never about the language or the AST in general: the
149
+ * canonical build and the compatibility build set them differently, and each
150
+ * flag is the discriminator for one option the two builds disagree about.
151
+ */
152
+ export interface ParserCapabilities {
153
+ readonly apiVersion: 1;
154
+ readonly languages: readonly Language[];
155
+ readonly target: string;
156
+ readonly nodeApi: number;
157
+ readonly nodeEngine: "^20.19.0 || >=22.12.0";
158
+ readonly oxcRevision: string;
159
+ readonly lazy: true;
160
+ readonly async: true;
161
+ /**
162
+ * Whether `recovery: "editor"` is available. `false` means that one option is
163
+ * refused with `ERR_TSRX_CAPABILITY_RECOVERY`; a file that does not parse
164
+ * still reports every error it found in `result.errors`, as it always does.
165
+ */
166
+ readonly editorRecovery: boolean;
167
+ /**
168
+ * Whether the CSS inside a `<style>` element is materialized down to its
169
+ * individual components. **`false` does not mean there is no CSS tree.** The
170
+ * canonical build always gives a `<style>` element a `css` string and a
171
+ * `StyleSheet` child holding a `Rule` per rule, each with a `SelectorList`
172
+ * prelude of `ComplexSelector` nodes and a `Block`, all carrying exact
173
+ * offsets relative to the CSS payload. That is enough to scope selectors, and
174
+ * consumers do it today.
175
+ *
176
+ * What `false` withholds is the level below that: the `ComplexSelector` and
177
+ * `Block` children arrays are empty, so there are no compound-selector parts
178
+ * and no per-declaration nodes. Read those out of the `source`/`css` text, or
179
+ * hand it to a CSS parser. The compatibility build reports `true` and
180
+ * materializes them.
181
+ */
182
+ readonly cssMaterialization: false;
183
+ readonly rawTransfer: boolean;
184
+ }
185
+
186
+ export type ParserOperationalErrorCode =
187
+ | "ERR_TSRX_INVALID_ARGUMENT"
188
+ | "ERR_TSRX_UNSUPPORTED_TARGET"
189
+ | "ERR_TSRX_NATIVE_NOT_INSTALLED"
190
+ | "ERR_TSRX_NATIVE_INTEGRITY"
191
+ | "ERR_TSRX_NATIVE_VERSION"
192
+ | "ERR_TSRX_CAPABILITY_RECOVERY"
193
+ | "ERR_TSRX_CAPABILITY_CSS"
194
+ | "ERR_TSRX_CAPABILITY_RAW_TRANSFER"
195
+ | "ERR_TSRX_RESOURCE_EXHAUSTED"
196
+ | "ERR_TSRX_CANCELLED";
197
+
198
+ export class ParserOperationalError extends Error {
199
+ readonly name: "ParserOperationalError";
200
+ readonly code: ParserOperationalErrorCode;
201
+ constructor(code: ParserOperationalErrorCode, message: string, options?: ErrorOptions);
202
+ }
203
+
204
+ export const capabilities: Readonly<ParserCapabilities>;
205
+
206
+ export function parseSync(
207
+ filename: string,
208
+ sourceText: string,
209
+ options?: Readonly<ParserOptions> | undefined | null,
210
+ ): ParseResult;
211
+
212
+ export function parse(
213
+ filename: string,
214
+ sourceText: string,
215
+ options?: Readonly<ParserOptions> | undefined | null,
216
+ ): Promise<ParseResult>;