oxlint-react-compiler-experimental 0.0.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/README.md +59 -0
- package/bin/oxlint +3 -0
- package/configuration_schema.json +800 -0
- package/dist/bindings.js +404 -0
- package/dist/cli.js +84 -0
- package/dist/config.js +16 -0
- package/dist/index.d.ts +735 -0
- package/dist/index.js +2 -0
- package/dist/js_config.js +66 -0
- package/dist/lint.js +22559 -0
- package/dist/oxlint.darwin-arm64.node +0 -0
- package/dist/plugins-dev.d.ts +4203 -0
- package/dist/plugins-dev.js +866 -0
- package/dist/plugins.js +23 -0
- package/dist/utils.js +44 -0
- package/dist/workspace.js +2 -0
- package/dist/workspace2.js +35 -0
- package/package.json +66 -0
package/dist/bindings.js
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region src-js/bindings.js
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
new URL(".", import.meta.url).pathname;
|
|
5
|
+
const { readFileSync } = require("node:fs");
|
|
6
|
+
let nativeBinding = null;
|
|
7
|
+
const loadErrors = [], isMusl = () => {
|
|
8
|
+
let musl = !1;
|
|
9
|
+
return process.platform === "linux" && (musl = isMuslFromFilesystem(), musl === null && (musl = isMuslFromReport()), musl === null && (musl = isMuslFromChildProcess())), musl;
|
|
10
|
+
}, isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-"), isMuslFromFilesystem = () => {
|
|
11
|
+
try {
|
|
12
|
+
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}, isMuslFromReport = () => {
|
|
17
|
+
let report = null;
|
|
18
|
+
return typeof process.report?.getReport == "function" && (process.report.excludeNetwork = !0, report = process.report.getReport()), report ? report.header && report.header.glibcVersionRuntime ? !1 : !!(Array.isArray(report.sharedObjects) && report.sharedObjects.some(isFileMusl)) : null;
|
|
19
|
+
}, isMuslFromChildProcess = () => {
|
|
20
|
+
try {
|
|
21
|
+
return require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
|
|
22
|
+
} catch {
|
|
23
|
+
return !1;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function requireNative() {
|
|
27
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
|
|
28
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
29
|
+
} catch (err) {
|
|
30
|
+
loadErrors.push(err);
|
|
31
|
+
}
|
|
32
|
+
else if (process.platform === "android") if (process.arch === "arm64") {
|
|
33
|
+
try {
|
|
34
|
+
return require("./oxlint.android-arm64.node");
|
|
35
|
+
} catch (e) {
|
|
36
|
+
loadErrors.push(e);
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
let binding = require("@oxlint/binding-android-arm64"), bindingPackageVersion = require("@oxlint/binding-android-arm64/package.json").version;
|
|
40
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
41
|
+
return binding;
|
|
42
|
+
} catch (e) {
|
|
43
|
+
loadErrors.push(e);
|
|
44
|
+
}
|
|
45
|
+
} else if (process.arch === "arm") {
|
|
46
|
+
try {
|
|
47
|
+
return require("./oxlint.android-arm-eabi.node");
|
|
48
|
+
} catch (e) {
|
|
49
|
+
loadErrors.push(e);
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
let binding = require("@oxlint/binding-android-arm-eabi"), bindingPackageVersion = require("@oxlint/binding-android-arm-eabi/package.json").version;
|
|
53
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
54
|
+
return binding;
|
|
55
|
+
} catch (e) {
|
|
56
|
+
loadErrors.push(e);
|
|
57
|
+
}
|
|
58
|
+
} else loadErrors.push(/* @__PURE__ */ Error(`Unsupported architecture on Android ${process.arch}`));
|
|
59
|
+
else if (process.platform === "win32") if (process.arch === "x64") if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
|
|
60
|
+
try {
|
|
61
|
+
return require("./oxlint.win32-x64-gnu.node");
|
|
62
|
+
} catch (e) {
|
|
63
|
+
loadErrors.push(e);
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
let binding = require("@oxlint/binding-win32-x64-gnu"), bindingPackageVersion = require("@oxlint/binding-win32-x64-gnu/package.json").version;
|
|
67
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
68
|
+
return binding;
|
|
69
|
+
} catch (e) {
|
|
70
|
+
loadErrors.push(e);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
try {
|
|
74
|
+
return require("./oxlint.win32-x64-msvc.node");
|
|
75
|
+
} catch (e) {
|
|
76
|
+
loadErrors.push(e);
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
let binding = require("@oxlint/binding-win32-x64-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-x64-msvc/package.json").version;
|
|
80
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
81
|
+
return binding;
|
|
82
|
+
} catch (e) {
|
|
83
|
+
loadErrors.push(e);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (process.arch === "ia32") {
|
|
87
|
+
try {
|
|
88
|
+
return require("./oxlint.win32-ia32-msvc.node");
|
|
89
|
+
} catch (e) {
|
|
90
|
+
loadErrors.push(e);
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
let binding = require("@oxlint/binding-win32-ia32-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-ia32-msvc/package.json").version;
|
|
94
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
95
|
+
return binding;
|
|
96
|
+
} catch (e) {
|
|
97
|
+
loadErrors.push(e);
|
|
98
|
+
}
|
|
99
|
+
} else if (process.arch === "arm64") {
|
|
100
|
+
try {
|
|
101
|
+
return require("./oxlint.win32-arm64-msvc.node");
|
|
102
|
+
} catch (e) {
|
|
103
|
+
loadErrors.push(e);
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
let binding = require("@oxlint/binding-win32-arm64-msvc"), bindingPackageVersion = require("@oxlint/binding-win32-arm64-msvc/package.json").version;
|
|
107
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
108
|
+
return binding;
|
|
109
|
+
} catch (e) {
|
|
110
|
+
loadErrors.push(e);
|
|
111
|
+
}
|
|
112
|
+
} else loadErrors.push(/* @__PURE__ */ Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
113
|
+
else if (process.platform === "darwin") {
|
|
114
|
+
try {
|
|
115
|
+
return require("./oxlint.darwin-universal.node");
|
|
116
|
+
} catch (e) {
|
|
117
|
+
loadErrors.push(e);
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
let binding = require("@oxlint/binding-darwin-universal"), bindingPackageVersion = require("@oxlint/binding-darwin-universal/package.json").version;
|
|
121
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
122
|
+
return binding;
|
|
123
|
+
} catch (e) {
|
|
124
|
+
loadErrors.push(e);
|
|
125
|
+
}
|
|
126
|
+
if (process.arch === "x64") {
|
|
127
|
+
try {
|
|
128
|
+
return require("./oxlint.darwin-x64.node");
|
|
129
|
+
} catch (e) {
|
|
130
|
+
loadErrors.push(e);
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
let binding = require("@oxlint/binding-darwin-x64"), bindingPackageVersion = require("@oxlint/binding-darwin-x64/package.json").version;
|
|
134
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
135
|
+
return binding;
|
|
136
|
+
} catch (e) {
|
|
137
|
+
loadErrors.push(e);
|
|
138
|
+
}
|
|
139
|
+
} else if (process.arch === "arm64") {
|
|
140
|
+
try {
|
|
141
|
+
return require("./oxlint.darwin-arm64.node");
|
|
142
|
+
} catch (e) {
|
|
143
|
+
loadErrors.push(e);
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
let binding = require("@oxlint/binding-darwin-arm64"), bindingPackageVersion = require("@oxlint/binding-darwin-arm64/package.json").version;
|
|
147
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
148
|
+
return binding;
|
|
149
|
+
} catch (e) {
|
|
150
|
+
loadErrors.push(e);
|
|
151
|
+
}
|
|
152
|
+
} else loadErrors.push(/* @__PURE__ */ Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
153
|
+
} else if (process.platform === "freebsd") if (process.arch === "x64") {
|
|
154
|
+
try {
|
|
155
|
+
return require("./oxlint.freebsd-x64.node");
|
|
156
|
+
} catch (e) {
|
|
157
|
+
loadErrors.push(e);
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
let binding = require("@oxlint/binding-freebsd-x64"), bindingPackageVersion = require("@oxlint/binding-freebsd-x64/package.json").version;
|
|
161
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
162
|
+
return binding;
|
|
163
|
+
} catch (e) {
|
|
164
|
+
loadErrors.push(e);
|
|
165
|
+
}
|
|
166
|
+
} else if (process.arch === "arm64") {
|
|
167
|
+
try {
|
|
168
|
+
return require("./oxlint.freebsd-arm64.node");
|
|
169
|
+
} catch (e) {
|
|
170
|
+
loadErrors.push(e);
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
let binding = require("@oxlint/binding-freebsd-arm64"), bindingPackageVersion = require("@oxlint/binding-freebsd-arm64/package.json").version;
|
|
174
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
175
|
+
return binding;
|
|
176
|
+
} catch (e) {
|
|
177
|
+
loadErrors.push(e);
|
|
178
|
+
}
|
|
179
|
+
} else loadErrors.push(/* @__PURE__ */ Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
180
|
+
else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
|
|
181
|
+
try {
|
|
182
|
+
return require("./oxlint.linux-x64-musl.node");
|
|
183
|
+
} catch (e) {
|
|
184
|
+
loadErrors.push(e);
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
let binding = require("@oxlint/binding-linux-x64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-x64-musl/package.json").version;
|
|
188
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
189
|
+
return binding;
|
|
190
|
+
} catch (e) {
|
|
191
|
+
loadErrors.push(e);
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
try {
|
|
195
|
+
return require("./oxlint.linux-x64-gnu.node");
|
|
196
|
+
} catch (e) {
|
|
197
|
+
loadErrors.push(e);
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
let binding = require("@oxlint/binding-linux-x64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-x64-gnu/package.json").version;
|
|
201
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
202
|
+
return binding;
|
|
203
|
+
} catch (e) {
|
|
204
|
+
loadErrors.push(e);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else if (process.arch === "arm64") if (isMusl()) {
|
|
208
|
+
try {
|
|
209
|
+
return require("./oxlint.linux-arm64-musl.node");
|
|
210
|
+
} catch (e) {
|
|
211
|
+
loadErrors.push(e);
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
let binding = require("@oxlint/binding-linux-arm64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-arm64-musl/package.json").version;
|
|
215
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
216
|
+
return binding;
|
|
217
|
+
} catch (e) {
|
|
218
|
+
loadErrors.push(e);
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
try {
|
|
222
|
+
return require("./oxlint.linux-arm64-gnu.node");
|
|
223
|
+
} catch (e) {
|
|
224
|
+
loadErrors.push(e);
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
let binding = require("@oxlint/binding-linux-arm64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-arm64-gnu/package.json").version;
|
|
228
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
229
|
+
return binding;
|
|
230
|
+
} catch (e) {
|
|
231
|
+
loadErrors.push(e);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else if (process.arch === "arm") if (isMusl()) {
|
|
235
|
+
try {
|
|
236
|
+
return require("./oxlint.linux-arm-musleabihf.node");
|
|
237
|
+
} catch (e) {
|
|
238
|
+
loadErrors.push(e);
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
let binding = require("@oxlint/binding-linux-arm-musleabihf"), bindingPackageVersion = require("@oxlint/binding-linux-arm-musleabihf/package.json").version;
|
|
242
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
243
|
+
return binding;
|
|
244
|
+
} catch (e) {
|
|
245
|
+
loadErrors.push(e);
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
try {
|
|
249
|
+
return require("./oxlint.linux-arm-gnueabihf.node");
|
|
250
|
+
} catch (e) {
|
|
251
|
+
loadErrors.push(e);
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
let binding = require("@oxlint/binding-linux-arm-gnueabihf"), bindingPackageVersion = require("@oxlint/binding-linux-arm-gnueabihf/package.json").version;
|
|
255
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
256
|
+
return binding;
|
|
257
|
+
} catch (e) {
|
|
258
|
+
loadErrors.push(e);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else if (process.arch === "loong64") if (isMusl()) {
|
|
262
|
+
try {
|
|
263
|
+
return require("./oxlint.linux-loong64-musl.node");
|
|
264
|
+
} catch (e) {
|
|
265
|
+
loadErrors.push(e);
|
|
266
|
+
}
|
|
267
|
+
try {
|
|
268
|
+
let binding = require("@oxlint/binding-linux-loong64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-loong64-musl/package.json").version;
|
|
269
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
270
|
+
return binding;
|
|
271
|
+
} catch (e) {
|
|
272
|
+
loadErrors.push(e);
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
try {
|
|
276
|
+
return require("./oxlint.linux-loong64-gnu.node");
|
|
277
|
+
} catch (e) {
|
|
278
|
+
loadErrors.push(e);
|
|
279
|
+
}
|
|
280
|
+
try {
|
|
281
|
+
let binding = require("@oxlint/binding-linux-loong64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-loong64-gnu/package.json").version;
|
|
282
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
283
|
+
return binding;
|
|
284
|
+
} catch (e) {
|
|
285
|
+
loadErrors.push(e);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
else if (process.arch === "riscv64") if (isMusl()) {
|
|
289
|
+
try {
|
|
290
|
+
return require("./oxlint.linux-riscv64-musl.node");
|
|
291
|
+
} catch (e) {
|
|
292
|
+
loadErrors.push(e);
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
let binding = require("@oxlint/binding-linux-riscv64-musl"), bindingPackageVersion = require("@oxlint/binding-linux-riscv64-musl/package.json").version;
|
|
296
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
297
|
+
return binding;
|
|
298
|
+
} catch (e) {
|
|
299
|
+
loadErrors.push(e);
|
|
300
|
+
}
|
|
301
|
+
} else {
|
|
302
|
+
try {
|
|
303
|
+
return require("./oxlint.linux-riscv64-gnu.node");
|
|
304
|
+
} catch (e) {
|
|
305
|
+
loadErrors.push(e);
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
let binding = require("@oxlint/binding-linux-riscv64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-riscv64-gnu/package.json").version;
|
|
309
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
310
|
+
return binding;
|
|
311
|
+
} catch (e) {
|
|
312
|
+
loadErrors.push(e);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else if (process.arch === "ppc64") {
|
|
316
|
+
try {
|
|
317
|
+
return require("./oxlint.linux-ppc64-gnu.node");
|
|
318
|
+
} catch (e) {
|
|
319
|
+
loadErrors.push(e);
|
|
320
|
+
}
|
|
321
|
+
try {
|
|
322
|
+
let binding = require("@oxlint/binding-linux-ppc64-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-ppc64-gnu/package.json").version;
|
|
323
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
324
|
+
return binding;
|
|
325
|
+
} catch (e) {
|
|
326
|
+
loadErrors.push(e);
|
|
327
|
+
}
|
|
328
|
+
} else if (process.arch === "s390x") {
|
|
329
|
+
try {
|
|
330
|
+
return require("./oxlint.linux-s390x-gnu.node");
|
|
331
|
+
} catch (e) {
|
|
332
|
+
loadErrors.push(e);
|
|
333
|
+
}
|
|
334
|
+
try {
|
|
335
|
+
let binding = require("@oxlint/binding-linux-s390x-gnu"), bindingPackageVersion = require("@oxlint/binding-linux-s390x-gnu/package.json").version;
|
|
336
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
337
|
+
return binding;
|
|
338
|
+
} catch (e) {
|
|
339
|
+
loadErrors.push(e);
|
|
340
|
+
}
|
|
341
|
+
} else loadErrors.push(/* @__PURE__ */ Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
342
|
+
else if (process.platform === "openharmony") if (process.arch === "arm64") {
|
|
343
|
+
try {
|
|
344
|
+
return require("./oxlint.openharmony-arm64.node");
|
|
345
|
+
} catch (e) {
|
|
346
|
+
loadErrors.push(e);
|
|
347
|
+
}
|
|
348
|
+
try {
|
|
349
|
+
let binding = require("@oxlint/binding-openharmony-arm64"), bindingPackageVersion = require("@oxlint/binding-openharmony-arm64/package.json").version;
|
|
350
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
351
|
+
return binding;
|
|
352
|
+
} catch (e) {
|
|
353
|
+
loadErrors.push(e);
|
|
354
|
+
}
|
|
355
|
+
} else if (process.arch === "x64") {
|
|
356
|
+
try {
|
|
357
|
+
return require("./oxlint.openharmony-x64.node");
|
|
358
|
+
} catch (e) {
|
|
359
|
+
loadErrors.push(e);
|
|
360
|
+
}
|
|
361
|
+
try {
|
|
362
|
+
let binding = require("@oxlint/binding-openharmony-x64"), bindingPackageVersion = require("@oxlint/binding-openharmony-x64/package.json").version;
|
|
363
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
364
|
+
return binding;
|
|
365
|
+
} catch (e) {
|
|
366
|
+
loadErrors.push(e);
|
|
367
|
+
}
|
|
368
|
+
} else if (process.arch === "arm") {
|
|
369
|
+
try {
|
|
370
|
+
return require("./oxlint.openharmony-arm.node");
|
|
371
|
+
} catch (e) {
|
|
372
|
+
loadErrors.push(e);
|
|
373
|
+
}
|
|
374
|
+
try {
|
|
375
|
+
let binding = require("@oxlint/binding-openharmony-arm"), bindingPackageVersion = require("@oxlint/binding-openharmony-arm/package.json").version;
|
|
376
|
+
if (bindingPackageVersion !== "1.51.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw Error(`Native binding package version mismatch, expected 1.51.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
377
|
+
return binding;
|
|
378
|
+
} catch (e) {
|
|
379
|
+
loadErrors.push(e);
|
|
380
|
+
}
|
|
381
|
+
} else loadErrors.push(/* @__PURE__ */ Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
382
|
+
else loadErrors.push(/* @__PURE__ */ Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
|
383
|
+
}
|
|
384
|
+
if (nativeBinding = requireNative(), !nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
385
|
+
let wasiBinding = null, wasiBindingError = null;
|
|
386
|
+
try {
|
|
387
|
+
wasiBinding = require("./oxlint.wasi.cjs"), nativeBinding = wasiBinding;
|
|
388
|
+
} catch (err) {
|
|
389
|
+
process.env.NAPI_RS_FORCE_WASI && (wasiBindingError = err);
|
|
390
|
+
}
|
|
391
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) try {
|
|
392
|
+
wasiBinding = require("@oxlint/binding-wasm32-wasi"), nativeBinding = wasiBinding;
|
|
393
|
+
} catch (err) {
|
|
394
|
+
process.env.NAPI_RS_FORCE_WASI && (wasiBindingError ? wasiBindingError.cause = err : wasiBindingError = err, loadErrors.push(err));
|
|
395
|
+
}
|
|
396
|
+
if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
|
|
397
|
+
let error = /* @__PURE__ */ Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
|
|
398
|
+
throw error.cause = wasiBindingError, error;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (!nativeBinding) throw loadErrors.length > 0 ? Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors.reduce((err, cur) => (cur.cause = err, cur)) }) : Error("Failed to load native binding");
|
|
402
|
+
const { Severity, applyFixes, getBufferOffset, lint, parseRawSync, rawTransferSupported } = nativeBinding;
|
|
403
|
+
//#endregion
|
|
404
|
+
export { rawTransferSupported as a, parseRawSync as i, getBufferOffset as n, lint as r, applyFixes as t };
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { r as lint } from "./bindings.js";
|
|
2
|
+
//#region src-js/cli.ts
|
|
3
|
+
let loadPlugin = null, setupRuleConfigs = null, lintFile = null, createWorkspace = null, destroyWorkspace = null, loadJsConfigs = null;
|
|
4
|
+
/**
|
|
5
|
+
* Load a plugin.
|
|
6
|
+
*
|
|
7
|
+
* Lazy-loads plugins code on first call, so that overhead is skipped if user doesn't use JS plugins.
|
|
8
|
+
*
|
|
9
|
+
* @param path - Absolute path of plugin file
|
|
10
|
+
* @param pluginName - Plugin name (either alias or package name)
|
|
11
|
+
* @param pluginNameIsAlias - `true` if plugin name is an alias (takes priority over name that plugin defines itself)
|
|
12
|
+
* @param workspaceUri - Workspace URI (`null` in CLI mode, `string` in LSP mode)
|
|
13
|
+
* @returns Plugin details or error serialized to JSON string
|
|
14
|
+
*/
|
|
15
|
+
function loadPluginWrapper(path, pluginName, pluginNameIsAlias, workspaceUri) {
|
|
16
|
+
return loadPlugin === null ? import("./plugins.js").then((mod) => ({loadPlugin, lintFile, setupRuleConfigs} = mod, loadPlugin(path, pluginName, pluginNameIsAlias, workspaceUri))) : loadPlugin(path, pluginName, pluginNameIsAlias, workspaceUri);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Bootstrap configuration options.
|
|
20
|
+
*
|
|
21
|
+
* Delegates to `setupRuleConfigs`, which was lazy-loaded by `loadPluginWrapper`.
|
|
22
|
+
*
|
|
23
|
+
* @param optionsJSON - Array of all rule options across all configurations, serialized as JSON
|
|
24
|
+
* @returns `null` if success, or error message string
|
|
25
|
+
*/
|
|
26
|
+
function setupRuleConfigsWrapper(optionsJSON) {
|
|
27
|
+
return setupRuleConfigs(optionsJSON);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Lint a file.
|
|
31
|
+
*
|
|
32
|
+
* Delegates to `lintFile`, which was lazy-loaded by `loadPluginWrapper`.
|
|
33
|
+
*
|
|
34
|
+
* @param filePath - Absolute path of file being linted
|
|
35
|
+
* @param bufferId - ID of buffer containing file data
|
|
36
|
+
* @param buffer - Buffer containing file data, or `null` if buffer with this ID was previously sent to JS
|
|
37
|
+
* @param ruleIds - IDs of rules to run on this file
|
|
38
|
+
* @param optionsIds - IDs of options to use for rules on this file, in same order as `ruleIds`
|
|
39
|
+
* @param settingsJSON - Settings for file, as JSON
|
|
40
|
+
* @param globalsJSON - Globals for file, as JSON
|
|
41
|
+
* @param workspaceUri - Workspace URI (`null` in CLI mode, `string` in LSP mode)
|
|
42
|
+
* @returns Diagnostics or error serialized to JSON string
|
|
43
|
+
*/
|
|
44
|
+
function lintFileWrapper(filePath, bufferId, buffer, ruleIds, optionsIds, settingsJSON, globalsJSON, workspaceUri) {
|
|
45
|
+
return lintFile(filePath, bufferId, buffer, ruleIds, optionsIds, settingsJSON, globalsJSON, workspaceUri);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a new workspace.
|
|
49
|
+
*
|
|
50
|
+
* Lazy-loads workspace code on first call, so that overhead is skipped if user doesn't use JS plugins.
|
|
51
|
+
*
|
|
52
|
+
* @param workspace - Workspace URI
|
|
53
|
+
* @returns Promise which resolves when workspace is created
|
|
54
|
+
*/
|
|
55
|
+
function createWorkspaceWrapper(workspace) {
|
|
56
|
+
return createWorkspace === null ? import("./workspace.js").then((mod) => ({createWorkspace, destroyWorkspace} = mod, createWorkspace(workspace))) : Promise.resolve(createWorkspace(workspace));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Destroy a workspace.
|
|
60
|
+
*
|
|
61
|
+
* Delegates to `destroyWorkspace`, which was lazy-loaded by `createWorkspaceWrapper`.
|
|
62
|
+
*
|
|
63
|
+
* @param workspace - Workspace URI
|
|
64
|
+
* @returns `undefined`
|
|
65
|
+
*/
|
|
66
|
+
function destroyWorkspaceWrapper(workspace) {
|
|
67
|
+
destroyWorkspace(workspace);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Load JavaScript/TypeScript config files (experimental).
|
|
71
|
+
*
|
|
72
|
+
* Lazy-loads the js_config module on first call.
|
|
73
|
+
* Uses native Node.js TypeScript support to import config files.
|
|
74
|
+
*
|
|
75
|
+
* @param paths - Array of absolute paths to JavaScript/TypeScript config files
|
|
76
|
+
* @returns JSON-stringified result with all configs or error
|
|
77
|
+
*/
|
|
78
|
+
function loadJsConfigsWrapper(paths) {
|
|
79
|
+
return loadJsConfigs === null ? import("./js_config.js").then((mod) => (loadJsConfigs = mod.loadJsConfigs, loadJsConfigs(paths))) : loadJsConfigs(paths);
|
|
80
|
+
}
|
|
81
|
+
const args = process.argv.slice(2);
|
|
82
|
+
process.stdout.isTTY || (process.stdin._handle?.setBlocking?.(!0), process.stdout._handle?.setBlocking?.(!0)), await lint(args, loadPluginWrapper, setupRuleConfigsWrapper, lintFileWrapper, createWorkspaceWrapper, destroyWorkspaceWrapper, loadJsConfigsWrapper) || (process.exitCode = 1);
|
|
83
|
+
//#endregion
|
|
84
|
+
export {};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src-js/package/config.ts
|
|
2
|
+
const DEFINE_CONFIG_REGISTRY = /* @__PURE__ */ new WeakSet();
|
|
3
|
+
/**
|
|
4
|
+
* Define an Oxlint configuration with type inference.
|
|
5
|
+
*
|
|
6
|
+
* @param config - Oxlint configuration
|
|
7
|
+
* @returns Config unchanged
|
|
8
|
+
*/
|
|
9
|
+
function defineConfig(config) {
|
|
10
|
+
return DEFINE_CONFIG_REGISTRY.add(config), config;
|
|
11
|
+
}
|
|
12
|
+
function isDefineConfig(config) {
|
|
13
|
+
return typeof config == "object" && !!config && DEFINE_CONFIG_REGISTRY.has(config);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isDefineConfig as n, defineConfig as t };
|