@shined/doctor-binding 0.0.21-snapshot.2
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/LICENSE +21 -0
- package/index.d.ts +339 -0
- package/index.js +385 -0
- package/package.json +32 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SHEIN
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export interface Diagnostic {
|
|
4
|
+
fileName: string
|
|
5
|
+
help: string
|
|
6
|
+
url: string
|
|
7
|
+
severity: string
|
|
8
|
+
code: string
|
|
9
|
+
message: string
|
|
10
|
+
labels: Array<LabeledLoc>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare function doctor(cwd: string, opts?: DoctorOptions | undefined | null): Promise<Array<NapiMessages>>
|
|
14
|
+
|
|
15
|
+
export interface DoctorOptions {
|
|
16
|
+
verbose?: boolean
|
|
17
|
+
maxRenderCount?: number
|
|
18
|
+
withDashboard?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare function getLanguagesStatistics(paths: Array<string>): Array<LanguageStatistics>
|
|
22
|
+
|
|
23
|
+
export interface GlobJsArgs {
|
|
24
|
+
ignore?: Array<string>
|
|
25
|
+
cwd: string
|
|
26
|
+
verbose?: boolean
|
|
27
|
+
absolute?: boolean
|
|
28
|
+
globals?: Record<string, string>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare function initializeLogger(level?: LogLevel | undefined | null): void
|
|
32
|
+
|
|
33
|
+
export declare function innerDebugLint(oxlintConfig: string, globJsArgs: GlobJsArgs): Promise<Array<Diagnostic>>
|
|
34
|
+
|
|
35
|
+
export declare function innerLint(globJsArgs: GlobJsArgs, category: NaPiCategory): Promise<Array<Diagnostic>>
|
|
36
|
+
|
|
37
|
+
export interface LabeledLoc {
|
|
38
|
+
span: Span
|
|
39
|
+
loc: Location
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface LanguageStatistics {
|
|
43
|
+
language: LanguageType
|
|
44
|
+
code: number
|
|
45
|
+
comments: number
|
|
46
|
+
blanks: number
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export declare const enum LanguageType {
|
|
50
|
+
ABNF = 'ABNF',
|
|
51
|
+
Abap = 'Abap',
|
|
52
|
+
ActionScript = 'ActionScript',
|
|
53
|
+
Ada = 'Ada',
|
|
54
|
+
Agda = 'Agda',
|
|
55
|
+
Alex = 'Alex',
|
|
56
|
+
Alloy = 'Alloy',
|
|
57
|
+
Arduino = 'Arduino',
|
|
58
|
+
AsciiDoc = 'AsciiDoc',
|
|
59
|
+
Asn1 = 'Asn1',
|
|
60
|
+
Asp = 'Asp',
|
|
61
|
+
AspNet = 'AspNet',
|
|
62
|
+
Assembly = 'Assembly',
|
|
63
|
+
AssemblyGAS = 'AssemblyGAS',
|
|
64
|
+
AutoHotKey = 'AutoHotKey',
|
|
65
|
+
Autoconf = 'Autoconf',
|
|
66
|
+
Automake = 'Automake',
|
|
67
|
+
Bash = 'Bash',
|
|
68
|
+
Batch = 'Batch',
|
|
69
|
+
Bean = 'Bean',
|
|
70
|
+
BrightScript = 'BrightScript',
|
|
71
|
+
C = 'C',
|
|
72
|
+
CHeader = 'CHeader',
|
|
73
|
+
CMake = 'CMake',
|
|
74
|
+
CSharp = 'CSharp',
|
|
75
|
+
CShell = 'CShell',
|
|
76
|
+
Cabal = 'Cabal',
|
|
77
|
+
Cassius = 'Cassius',
|
|
78
|
+
Ceylon = 'Ceylon',
|
|
79
|
+
Clojure = 'Clojure',
|
|
80
|
+
ClojureC = 'ClojureC',
|
|
81
|
+
ClojureScript = 'ClojureScript',
|
|
82
|
+
Cobol = 'Cobol',
|
|
83
|
+
CodeQL = 'CodeQL',
|
|
84
|
+
CoffeeScript = 'CoffeeScript',
|
|
85
|
+
Cogent = 'Cogent',
|
|
86
|
+
ColdFusion = 'ColdFusion',
|
|
87
|
+
ColdFusionScript = 'ColdFusionScript',
|
|
88
|
+
Coq = 'Coq',
|
|
89
|
+
Cpp = 'Cpp',
|
|
90
|
+
CppHeader = 'CppHeader',
|
|
91
|
+
Crystal = 'Crystal',
|
|
92
|
+
Css = 'Css',
|
|
93
|
+
D = 'D',
|
|
94
|
+
Daml = 'Daml',
|
|
95
|
+
Dart = 'Dart',
|
|
96
|
+
DeviceTree = 'DeviceTree',
|
|
97
|
+
Dhall = 'Dhall',
|
|
98
|
+
Dockerfile = 'Dockerfile',
|
|
99
|
+
DotNetResource = 'DotNetResource',
|
|
100
|
+
DreamMaker = 'DreamMaker',
|
|
101
|
+
Dust = 'Dust',
|
|
102
|
+
Edn = 'Edn',
|
|
103
|
+
Elisp = 'Elisp',
|
|
104
|
+
Elixir = 'Elixir',
|
|
105
|
+
Elm = 'Elm',
|
|
106
|
+
Elvish = 'Elvish',
|
|
107
|
+
EmacsDevEnv = 'EmacsDevEnv',
|
|
108
|
+
Emojicode = 'Emojicode',
|
|
109
|
+
Erlang = 'Erlang',
|
|
110
|
+
FEN = 'FEN',
|
|
111
|
+
FSharp = 'FSharp',
|
|
112
|
+
Fish = 'Fish',
|
|
113
|
+
FlatBuffers = 'FlatBuffers',
|
|
114
|
+
Forth = 'Forth',
|
|
115
|
+
FortranLegacy = 'FortranLegacy',
|
|
116
|
+
FortranModern = 'FortranModern',
|
|
117
|
+
FreeMarker = 'FreeMarker',
|
|
118
|
+
Fstar = 'Fstar',
|
|
119
|
+
Futhark = 'Futhark',
|
|
120
|
+
GDB = 'GDB',
|
|
121
|
+
GdScript = 'GdScript',
|
|
122
|
+
Gherkin = 'Gherkin',
|
|
123
|
+
Gleam = 'Gleam',
|
|
124
|
+
Glsl = 'Glsl',
|
|
125
|
+
Go = 'Go',
|
|
126
|
+
Gohtml = 'Gohtml',
|
|
127
|
+
Graphql = 'Graphql',
|
|
128
|
+
Groovy = 'Groovy',
|
|
129
|
+
Gwion = 'Gwion',
|
|
130
|
+
Hamlet = 'Hamlet',
|
|
131
|
+
Handlebars = 'Handlebars',
|
|
132
|
+
Happy = 'Happy',
|
|
133
|
+
Haskell = 'Haskell',
|
|
134
|
+
Haxe = 'Haxe',
|
|
135
|
+
Hcl = 'Hcl',
|
|
136
|
+
Headache = 'Headache',
|
|
137
|
+
Hex = 'Hex',
|
|
138
|
+
Hlsl = 'Hlsl',
|
|
139
|
+
HolyC = 'HolyC',
|
|
140
|
+
Html = 'Html',
|
|
141
|
+
Idris = 'Idris',
|
|
142
|
+
Ini = 'Ini',
|
|
143
|
+
IntelHex = 'IntelHex',
|
|
144
|
+
Isabelle = 'Isabelle',
|
|
145
|
+
Jai = 'Jai',
|
|
146
|
+
Java = 'Java',
|
|
147
|
+
JavaScript = 'JavaScript',
|
|
148
|
+
Json = 'Json',
|
|
149
|
+
Jsonnet = 'Jsonnet',
|
|
150
|
+
Jsx = 'Jsx',
|
|
151
|
+
Julia = 'Julia',
|
|
152
|
+
Julius = 'Julius',
|
|
153
|
+
Jupyter = 'Jupyter',
|
|
154
|
+
K = 'K',
|
|
155
|
+
KakouneScript = 'KakouneScript',
|
|
156
|
+
Kotlin = 'Kotlin',
|
|
157
|
+
LLVM = 'LLVM',
|
|
158
|
+
Lean = 'Lean',
|
|
159
|
+
Less = 'Less',
|
|
160
|
+
LinkerScript = 'LinkerScript',
|
|
161
|
+
Liquid = 'Liquid',
|
|
162
|
+
Lisp = 'Lisp',
|
|
163
|
+
LiveScript = 'LiveScript',
|
|
164
|
+
Logtalk = 'Logtalk',
|
|
165
|
+
Lua = 'Lua',
|
|
166
|
+
Lucius = 'Lucius',
|
|
167
|
+
Madlang = 'Madlang',
|
|
168
|
+
Makefile = 'Makefile',
|
|
169
|
+
Markdown = 'Markdown',
|
|
170
|
+
Meson = 'Meson',
|
|
171
|
+
Mint = 'Mint',
|
|
172
|
+
ModuleDef = 'ModuleDef',
|
|
173
|
+
MoonScript = 'MoonScript',
|
|
174
|
+
MsBuild = 'MsBuild',
|
|
175
|
+
Mustache = 'Mustache',
|
|
176
|
+
Nim = 'Nim',
|
|
177
|
+
Nix = 'Nix',
|
|
178
|
+
NotQuitePerl = 'NotQuitePerl',
|
|
179
|
+
OCaml = 'OCaml',
|
|
180
|
+
ObjectiveC = 'ObjectiveC',
|
|
181
|
+
ObjectiveCpp = 'ObjectiveCpp',
|
|
182
|
+
Odin = 'Odin',
|
|
183
|
+
OpenType = 'OpenType',
|
|
184
|
+
Org = 'Org',
|
|
185
|
+
Oz = 'Oz',
|
|
186
|
+
PSL = 'PSL',
|
|
187
|
+
Pan = 'Pan',
|
|
188
|
+
Pascal = 'Pascal',
|
|
189
|
+
Perl = 'Perl',
|
|
190
|
+
Perl6 = 'Perl6',
|
|
191
|
+
Pest = 'Pest',
|
|
192
|
+
Php = 'Php',
|
|
193
|
+
Polly = 'Polly',
|
|
194
|
+
Pony = 'Pony',
|
|
195
|
+
PostCss = 'PostCss',
|
|
196
|
+
PowerShell = 'PowerShell',
|
|
197
|
+
Processing = 'Processing',
|
|
198
|
+
Prolog = 'Prolog',
|
|
199
|
+
Protobuf = 'Protobuf',
|
|
200
|
+
Pug = 'Pug',
|
|
201
|
+
PureScript = 'PureScript',
|
|
202
|
+
Python = 'Python',
|
|
203
|
+
Q = 'Q',
|
|
204
|
+
Qcl = 'Qcl',
|
|
205
|
+
Qml = 'Qml',
|
|
206
|
+
R = 'R',
|
|
207
|
+
RON = 'RON',
|
|
208
|
+
RPMSpecfile = 'RPMSpecfile',
|
|
209
|
+
Racket = 'Racket',
|
|
210
|
+
Rakefile = 'Rakefile',
|
|
211
|
+
Razor = 'Razor',
|
|
212
|
+
ReStructuredText = 'ReStructuredText',
|
|
213
|
+
Renpy = 'Renpy',
|
|
214
|
+
Ruby = 'Ruby',
|
|
215
|
+
RubyHtml = 'RubyHtml',
|
|
216
|
+
Rust = 'Rust',
|
|
217
|
+
SRecode = 'SRecode',
|
|
218
|
+
Sass = 'Sass',
|
|
219
|
+
Scala = 'Scala',
|
|
220
|
+
Scheme = 'Scheme',
|
|
221
|
+
Scons = 'Scons',
|
|
222
|
+
Sh = 'Sh',
|
|
223
|
+
Sml = 'Sml',
|
|
224
|
+
Solidity = 'Solidity',
|
|
225
|
+
SpecmanE = 'SpecmanE',
|
|
226
|
+
Spice = 'Spice',
|
|
227
|
+
Sql = 'Sql',
|
|
228
|
+
Stan = 'Stan',
|
|
229
|
+
Stratego = 'Stratego',
|
|
230
|
+
Stylus = 'Stylus',
|
|
231
|
+
Svelte = 'Svelte',
|
|
232
|
+
Svg = 'Svg',
|
|
233
|
+
Swift = 'Swift',
|
|
234
|
+
Swig = 'Swig',
|
|
235
|
+
SystemVerilog = 'SystemVerilog',
|
|
236
|
+
Tcl = 'Tcl',
|
|
237
|
+
Tera = 'Tera',
|
|
238
|
+
Tex = 'Tex',
|
|
239
|
+
Text = 'Text',
|
|
240
|
+
Thrift = 'Thrift',
|
|
241
|
+
Toml = 'Toml',
|
|
242
|
+
Tsx = 'Tsx',
|
|
243
|
+
Ttcn = 'Ttcn',
|
|
244
|
+
Twig = 'Twig',
|
|
245
|
+
TypeScript = 'TypeScript',
|
|
246
|
+
UnrealDeveloperMarkdown = 'UnrealDeveloperMarkdown',
|
|
247
|
+
UnrealPlugin = 'UnrealPlugin',
|
|
248
|
+
UnrealProject = 'UnrealProject',
|
|
249
|
+
UnrealScript = 'UnrealScript',
|
|
250
|
+
UnrealShader = 'UnrealShader',
|
|
251
|
+
UnrealShaderHeader = 'UnrealShaderHeader',
|
|
252
|
+
UrWeb = 'UrWeb',
|
|
253
|
+
UrWebProject = 'UrWebProject',
|
|
254
|
+
VB6 = 'VB6',
|
|
255
|
+
VBScript = 'VBScript',
|
|
256
|
+
Vala = 'Vala',
|
|
257
|
+
Velocity = 'Velocity',
|
|
258
|
+
Verilog = 'Verilog',
|
|
259
|
+
VerilogArgsFile = 'VerilogArgsFile',
|
|
260
|
+
Vhdl = 'Vhdl',
|
|
261
|
+
VimScript = 'VimScript',
|
|
262
|
+
VisualBasic = 'VisualBasic',
|
|
263
|
+
VisualStudioProject = 'VisualStudioProject',
|
|
264
|
+
VisualStudioSolution = 'VisualStudioSolution',
|
|
265
|
+
Vue = 'Vue',
|
|
266
|
+
WebAssembly = 'WebAssembly',
|
|
267
|
+
Wolfram = 'Wolfram',
|
|
268
|
+
XSL = 'XSL',
|
|
269
|
+
Xaml = 'Xaml',
|
|
270
|
+
XcodeConfig = 'XcodeConfig',
|
|
271
|
+
Xml = 'Xml',
|
|
272
|
+
Xtend = 'Xtend',
|
|
273
|
+
Yaml = 'Yaml',
|
|
274
|
+
Zig = 'Zig',
|
|
275
|
+
Zsh = 'Zsh'
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface Location {
|
|
279
|
+
start: Position
|
|
280
|
+
end: Position
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export declare const enum LogLevel {
|
|
284
|
+
Error = 0,
|
|
285
|
+
Warn = 1,
|
|
286
|
+
Info = 2,
|
|
287
|
+
Debug = 3,
|
|
288
|
+
Trace = 4
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export declare const enum NaPiCategory {
|
|
292
|
+
V20250601Inner = 0
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface NapiDiagnostics {
|
|
296
|
+
message: string
|
|
297
|
+
code?: string
|
|
298
|
+
severity?: NapiSeverity
|
|
299
|
+
help?: string
|
|
300
|
+
url?: string
|
|
301
|
+
labels?: Array<NapiLabeledSpan>
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export interface NapiLabeledSpan {
|
|
305
|
+
label?: string
|
|
306
|
+
span: NapiSourceSpan
|
|
307
|
+
primary: boolean
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface NapiMessages {
|
|
311
|
+
sourcePath: string
|
|
312
|
+
diagnostics: Array<NapiDiagnostics>
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export declare const enum NapiSeverity {
|
|
316
|
+
Error = 'Error',
|
|
317
|
+
Warning = 'Warning',
|
|
318
|
+
Advice = 'Advice'
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface NapiSourceSpan {
|
|
322
|
+
offset: number
|
|
323
|
+
length: number
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface Position {
|
|
327
|
+
line: number
|
|
328
|
+
col: number
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export interface Response {
|
|
332
|
+
rc: string
|
|
333
|
+
map: Record<string, number>
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface Span {
|
|
337
|
+
offset: number
|
|
338
|
+
length: number
|
|
339
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
const { createRequire } = require('node:module')
|
|
7
|
+
require = createRequire(__filename)
|
|
8
|
+
|
|
9
|
+
const { readFileSync } = require('node:fs')
|
|
10
|
+
let nativeBinding = null
|
|
11
|
+
const loadErrors = []
|
|
12
|
+
|
|
13
|
+
const isMusl = () => {
|
|
14
|
+
let musl = false
|
|
15
|
+
if (process.platform === 'linux') {
|
|
16
|
+
musl = isMuslFromFilesystem()
|
|
17
|
+
if (musl === null) {
|
|
18
|
+
musl = isMuslFromReport()
|
|
19
|
+
}
|
|
20
|
+
if (musl === null) {
|
|
21
|
+
musl = isMuslFromChildProcess()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return musl
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
|
28
|
+
|
|
29
|
+
const isMuslFromFilesystem = () => {
|
|
30
|
+
try {
|
|
31
|
+
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
|
32
|
+
} catch {
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const isMuslFromReport = () => {
|
|
38
|
+
let report = null
|
|
39
|
+
if (typeof process.report?.getReport === 'function') {
|
|
40
|
+
process.report.excludeNetwork = true
|
|
41
|
+
report = process.report.getReport()
|
|
42
|
+
}
|
|
43
|
+
if (!report) {
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
50
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
51
|
+
return true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return false
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const isMuslFromChildProcess = () => {
|
|
58
|
+
try {
|
|
59
|
+
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
|
60
|
+
} catch (e) {
|
|
61
|
+
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
62
|
+
return false
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function requireNative() {
|
|
67
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
68
|
+
try {
|
|
69
|
+
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
loadErrors.push(err);
|
|
72
|
+
}
|
|
73
|
+
} else if (process.platform === 'android') {
|
|
74
|
+
if (process.arch === 'arm64') {
|
|
75
|
+
try {
|
|
76
|
+
return require('./doctor-binding.android-arm64.node')
|
|
77
|
+
} catch (e) {
|
|
78
|
+
loadErrors.push(e)
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
return require('@shined/doctor-binding-android-arm64')
|
|
82
|
+
} catch (e) {
|
|
83
|
+
loadErrors.push(e)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
} else if (process.arch === 'arm') {
|
|
87
|
+
try {
|
|
88
|
+
return require('./doctor-binding.android-arm-eabi.node')
|
|
89
|
+
} catch (e) {
|
|
90
|
+
loadErrors.push(e)
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
return require('@shined/doctor-binding-android-arm-eabi')
|
|
94
|
+
} catch (e) {
|
|
95
|
+
loadErrors.push(e)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
} else {
|
|
99
|
+
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
100
|
+
}
|
|
101
|
+
} else if (process.platform === 'win32') {
|
|
102
|
+
if (process.arch === 'x64') {
|
|
103
|
+
try {
|
|
104
|
+
return require('./doctor-binding.win32-x64-msvc.node')
|
|
105
|
+
} catch (e) {
|
|
106
|
+
loadErrors.push(e)
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
return require('@shined/doctor-binding-win32-x64-msvc')
|
|
110
|
+
} catch (e) {
|
|
111
|
+
loadErrors.push(e)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
} else if (process.arch === 'ia32') {
|
|
115
|
+
try {
|
|
116
|
+
return require('./doctor-binding.win32-ia32-msvc.node')
|
|
117
|
+
} catch (e) {
|
|
118
|
+
loadErrors.push(e)
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
return require('@shined/doctor-binding-win32-ia32-msvc')
|
|
122
|
+
} catch (e) {
|
|
123
|
+
loadErrors.push(e)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
} else if (process.arch === 'arm64') {
|
|
127
|
+
try {
|
|
128
|
+
return require('./doctor-binding.win32-arm64-msvc.node')
|
|
129
|
+
} catch (e) {
|
|
130
|
+
loadErrors.push(e)
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
return require('@shined/doctor-binding-win32-arm64-msvc')
|
|
134
|
+
} catch (e) {
|
|
135
|
+
loadErrors.push(e)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
} else {
|
|
139
|
+
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
140
|
+
}
|
|
141
|
+
} else if (process.platform === 'darwin') {
|
|
142
|
+
try {
|
|
143
|
+
return require('./doctor-binding.darwin-universal.node')
|
|
144
|
+
} catch (e) {
|
|
145
|
+
loadErrors.push(e)
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
return require('@shined/doctor-binding-darwin-universal')
|
|
149
|
+
} catch (e) {
|
|
150
|
+
loadErrors.push(e)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (process.arch === 'x64') {
|
|
154
|
+
try {
|
|
155
|
+
return require('./doctor-binding.darwin-x64.node')
|
|
156
|
+
} catch (e) {
|
|
157
|
+
loadErrors.push(e)
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
return require('@shined/doctor-binding-darwin-x64')
|
|
161
|
+
} catch (e) {
|
|
162
|
+
loadErrors.push(e)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
} else if (process.arch === 'arm64') {
|
|
166
|
+
try {
|
|
167
|
+
return require('./doctor-binding.darwin-arm64.node')
|
|
168
|
+
} catch (e) {
|
|
169
|
+
loadErrors.push(e)
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
return require('@shined/doctor-binding-darwin-arm64')
|
|
173
|
+
} catch (e) {
|
|
174
|
+
loadErrors.push(e)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
} else {
|
|
178
|
+
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
179
|
+
}
|
|
180
|
+
} else if (process.platform === 'freebsd') {
|
|
181
|
+
if (process.arch === 'x64') {
|
|
182
|
+
try {
|
|
183
|
+
return require('./doctor-binding.freebsd-x64.node')
|
|
184
|
+
} catch (e) {
|
|
185
|
+
loadErrors.push(e)
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
return require('@shined/doctor-binding-freebsd-x64')
|
|
189
|
+
} catch (e) {
|
|
190
|
+
loadErrors.push(e)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
} else if (process.arch === 'arm64') {
|
|
194
|
+
try {
|
|
195
|
+
return require('./doctor-binding.freebsd-arm64.node')
|
|
196
|
+
} catch (e) {
|
|
197
|
+
loadErrors.push(e)
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
return require('@shined/doctor-binding-freebsd-arm64')
|
|
201
|
+
} catch (e) {
|
|
202
|
+
loadErrors.push(e)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
} else {
|
|
206
|
+
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
207
|
+
}
|
|
208
|
+
} else if (process.platform === 'linux') {
|
|
209
|
+
if (process.arch === 'x64') {
|
|
210
|
+
if (isMusl()) {
|
|
211
|
+
try {
|
|
212
|
+
return require('./doctor-binding.linux-x64-musl.node')
|
|
213
|
+
} catch (e) {
|
|
214
|
+
loadErrors.push(e)
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
return require('@shined/doctor-binding-linux-x64-musl')
|
|
218
|
+
} catch (e) {
|
|
219
|
+
loadErrors.push(e)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
} else {
|
|
223
|
+
try {
|
|
224
|
+
return require('./doctor-binding.linux-x64-gnu.node')
|
|
225
|
+
} catch (e) {
|
|
226
|
+
loadErrors.push(e)
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
return require('@shined/doctor-binding-linux-x64-gnu')
|
|
230
|
+
} catch (e) {
|
|
231
|
+
loadErrors.push(e)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
} else if (process.arch === 'arm64') {
|
|
236
|
+
if (isMusl()) {
|
|
237
|
+
try {
|
|
238
|
+
return require('./doctor-binding.linux-arm64-musl.node')
|
|
239
|
+
} catch (e) {
|
|
240
|
+
loadErrors.push(e)
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
return require('@shined/doctor-binding-linux-arm64-musl')
|
|
244
|
+
} catch (e) {
|
|
245
|
+
loadErrors.push(e)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
} else {
|
|
249
|
+
try {
|
|
250
|
+
return require('./doctor-binding.linux-arm64-gnu.node')
|
|
251
|
+
} catch (e) {
|
|
252
|
+
loadErrors.push(e)
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
return require('@shined/doctor-binding-linux-arm64-gnu')
|
|
256
|
+
} catch (e) {
|
|
257
|
+
loadErrors.push(e)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
}
|
|
261
|
+
} else if (process.arch === 'arm') {
|
|
262
|
+
if (isMusl()) {
|
|
263
|
+
try {
|
|
264
|
+
return require('./doctor-binding.linux-arm-musleabihf.node')
|
|
265
|
+
} catch (e) {
|
|
266
|
+
loadErrors.push(e)
|
|
267
|
+
}
|
|
268
|
+
try {
|
|
269
|
+
return require('@shined/doctor-binding-linux-arm-musleabihf')
|
|
270
|
+
} catch (e) {
|
|
271
|
+
loadErrors.push(e)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
} else {
|
|
275
|
+
try {
|
|
276
|
+
return require('./doctor-binding.linux-arm-gnueabihf.node')
|
|
277
|
+
} catch (e) {
|
|
278
|
+
loadErrors.push(e)
|
|
279
|
+
}
|
|
280
|
+
try {
|
|
281
|
+
return require('@shined/doctor-binding-linux-arm-gnueabihf')
|
|
282
|
+
} catch (e) {
|
|
283
|
+
loadErrors.push(e)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
} else if (process.arch === 'riscv64') {
|
|
288
|
+
if (isMusl()) {
|
|
289
|
+
try {
|
|
290
|
+
return require('./doctor-binding.linux-riscv64-musl.node')
|
|
291
|
+
} catch (e) {
|
|
292
|
+
loadErrors.push(e)
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
return require('@shined/doctor-binding-linux-riscv64-musl')
|
|
296
|
+
} catch (e) {
|
|
297
|
+
loadErrors.push(e)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
} else {
|
|
301
|
+
try {
|
|
302
|
+
return require('./doctor-binding.linux-riscv64-gnu.node')
|
|
303
|
+
} catch (e) {
|
|
304
|
+
loadErrors.push(e)
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
return require('@shined/doctor-binding-linux-riscv64-gnu')
|
|
308
|
+
} catch (e) {
|
|
309
|
+
loadErrors.push(e)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
}
|
|
313
|
+
} else if (process.arch === 'ppc64') {
|
|
314
|
+
try {
|
|
315
|
+
return require('./doctor-binding.linux-ppc64-gnu.node')
|
|
316
|
+
} catch (e) {
|
|
317
|
+
loadErrors.push(e)
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
return require('@shined/doctor-binding-linux-ppc64-gnu')
|
|
321
|
+
} catch (e) {
|
|
322
|
+
loadErrors.push(e)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
} else if (process.arch === 's390x') {
|
|
326
|
+
try {
|
|
327
|
+
return require('./doctor-binding.linux-s390x-gnu.node')
|
|
328
|
+
} catch (e) {
|
|
329
|
+
loadErrors.push(e)
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
return require('@shined/doctor-binding-linux-s390x-gnu')
|
|
333
|
+
} catch (e) {
|
|
334
|
+
loadErrors.push(e)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
} else {
|
|
338
|
+
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
nativeBinding = requireNative()
|
|
346
|
+
|
|
347
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
348
|
+
try {
|
|
349
|
+
nativeBinding = require('./doctor-binding.wasi.cjs')
|
|
350
|
+
} catch (err) {
|
|
351
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
352
|
+
loadErrors.push(err)
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (!nativeBinding) {
|
|
356
|
+
try {
|
|
357
|
+
nativeBinding = require('@shined/doctor-binding-wasm32-wasi')
|
|
358
|
+
} catch (err) {
|
|
359
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
360
|
+
loadErrors.push(err)
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
if (!nativeBinding) {
|
|
367
|
+
if (loadErrors.length > 0) {
|
|
368
|
+
// TODO Link to documentation with potential fixes
|
|
369
|
+
// - The package owner could build/publish bindings for this arch
|
|
370
|
+
// - The user may need to bundle the correct files
|
|
371
|
+
// - The user may need to re-install node_modules to get new packages
|
|
372
|
+
throw new Error('Failed to load native binding', { cause: loadErrors })
|
|
373
|
+
}
|
|
374
|
+
throw new Error(`Failed to load native binding`)
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
module.exports.doctor = nativeBinding.doctor
|
|
378
|
+
module.exports.getLanguagesStatistics = nativeBinding.getLanguagesStatistics
|
|
379
|
+
module.exports.initializeLogger = nativeBinding.initializeLogger
|
|
380
|
+
module.exports.innerDebugLint = nativeBinding.innerDebugLint
|
|
381
|
+
module.exports.innerLint = nativeBinding.innerLint
|
|
382
|
+
module.exports.LanguageType = nativeBinding.LanguageType
|
|
383
|
+
module.exports.LogLevel = nativeBinding.LogLevel
|
|
384
|
+
module.exports.NaPiCategory = nativeBinding.NaPiCategory
|
|
385
|
+
module.exports.NapiSeverity = nativeBinding.NapiSeverity
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shined/doctor-binding",
|
|
3
|
+
"version": "0.0.21-snapshot.2",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "git+https://github.com/sheinsight/doctor-engine.git"
|
|
8
|
+
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"tag": "snapshot"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"index.d.ts"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/sheinsight/doctor-engine/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/sheinsight/doctor-engine#readme",
|
|
22
|
+
"optionalDependencies": {
|
|
23
|
+
"@shined/doctor-binding-darwin-x64": "0.0.21-snapshot.2",
|
|
24
|
+
"@shined/doctor-binding-darwin-arm64": "0.0.21-snapshot.2",
|
|
25
|
+
"@shined/doctor-binding-win32-x64-msvc": "0.0.21-snapshot.2",
|
|
26
|
+
"@shined/doctor-binding-win32-arm64-msvc": "0.0.21-snapshot.2",
|
|
27
|
+
"@shined/doctor-binding-linux-x64-gnu": "0.0.21-snapshot.2",
|
|
28
|
+
"@shined/doctor-binding-linux-x64-musl": "0.0.21-snapshot.2",
|
|
29
|
+
"@shined/doctor-binding-linux-arm64-gnu": "0.0.21-snapshot.2",
|
|
30
|
+
"@shined/doctor-binding-linux-arm64-musl": "0.0.21-snapshot.2"
|
|
31
|
+
}
|
|
32
|
+
}
|