@shined/doctor 0.0.1-snapshot.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 (3) hide show
  1. package/index.d.ts +7 -0
  2. package/index.js +374 -0
  3. package/package.json +54 -0
package/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ export declare function innerLint(cwd: string, category: NaPiCategory): void
4
+
5
+ export declare const enum NaPiCategory {
6
+ V20250601Inner = 0
7
+ }
package/index.js ADDED
@@ -0,0 +1,374 @@
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
+ const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null
39
+ if (!report) {
40
+ return null
41
+ }
42
+ if (report.header && report.header.glibcVersionRuntime) {
43
+ return false
44
+ }
45
+ if (Array.isArray(report.sharedObjects)) {
46
+ if (report.sharedObjects.some(isFileMusl)) {
47
+ return true
48
+ }
49
+ }
50
+ return false
51
+ }
52
+
53
+ const isMuslFromChildProcess = () => {
54
+ try {
55
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
56
+ } catch (e) {
57
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
58
+ return false
59
+ }
60
+ }
61
+
62
+ function requireNative() {
63
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
64
+ try {
65
+ nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
66
+ } catch (err) {
67
+ loadErrors.push(err);
68
+ }
69
+ } else if (process.platform === 'android') {
70
+ if (process.arch === 'arm64') {
71
+ try {
72
+ return require('./doctor.android-arm64.node')
73
+ } catch (e) {
74
+ loadErrors.push(e)
75
+ }
76
+ try {
77
+ return require('@shined/doctor-android-arm64')
78
+ } catch (e) {
79
+ loadErrors.push(e)
80
+ }
81
+
82
+ } else if (process.arch === 'arm') {
83
+ try {
84
+ return require('./doctor.android-arm-eabi.node')
85
+ } catch (e) {
86
+ loadErrors.push(e)
87
+ }
88
+ try {
89
+ return require('@shined/doctor-android-arm-eabi')
90
+ } catch (e) {
91
+ loadErrors.push(e)
92
+ }
93
+
94
+ } else {
95
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
96
+ }
97
+ } else if (process.platform === 'win32') {
98
+ if (process.arch === 'x64') {
99
+ try {
100
+ return require('./doctor.win32-x64-msvc.node')
101
+ } catch (e) {
102
+ loadErrors.push(e)
103
+ }
104
+ try {
105
+ return require('@shined/doctor-win32-x64-msvc')
106
+ } catch (e) {
107
+ loadErrors.push(e)
108
+ }
109
+
110
+ } else if (process.arch === 'ia32') {
111
+ try {
112
+ return require('./doctor.win32-ia32-msvc.node')
113
+ } catch (e) {
114
+ loadErrors.push(e)
115
+ }
116
+ try {
117
+ return require('@shined/doctor-win32-ia32-msvc')
118
+ } catch (e) {
119
+ loadErrors.push(e)
120
+ }
121
+
122
+ } else if (process.arch === 'arm64') {
123
+ try {
124
+ return require('./doctor.win32-arm64-msvc.node')
125
+ } catch (e) {
126
+ loadErrors.push(e)
127
+ }
128
+ try {
129
+ return require('@shined/doctor-win32-arm64-msvc')
130
+ } catch (e) {
131
+ loadErrors.push(e)
132
+ }
133
+
134
+ } else {
135
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
136
+ }
137
+ } else if (process.platform === 'darwin') {
138
+ try {
139
+ return require('./doctor.darwin-universal.node')
140
+ } catch (e) {
141
+ loadErrors.push(e)
142
+ }
143
+ try {
144
+ return require('@shined/doctor-darwin-universal')
145
+ } catch (e) {
146
+ loadErrors.push(e)
147
+ }
148
+
149
+ if (process.arch === 'x64') {
150
+ try {
151
+ return require('./doctor.darwin-x64.node')
152
+ } catch (e) {
153
+ loadErrors.push(e)
154
+ }
155
+ try {
156
+ return require('@shined/doctor-darwin-x64')
157
+ } catch (e) {
158
+ loadErrors.push(e)
159
+ }
160
+
161
+ } else if (process.arch === 'arm64') {
162
+ try {
163
+ return require('./doctor.darwin-arm64.node')
164
+ } catch (e) {
165
+ loadErrors.push(e)
166
+ }
167
+ try {
168
+ return require('@shined/doctor-darwin-arm64')
169
+ } catch (e) {
170
+ loadErrors.push(e)
171
+ }
172
+
173
+ } else {
174
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
175
+ }
176
+ } else if (process.platform === 'freebsd') {
177
+ if (process.arch === 'x64') {
178
+ try {
179
+ return require('./doctor.freebsd-x64.node')
180
+ } catch (e) {
181
+ loadErrors.push(e)
182
+ }
183
+ try {
184
+ return require('@shined/doctor-freebsd-x64')
185
+ } catch (e) {
186
+ loadErrors.push(e)
187
+ }
188
+
189
+ } else if (process.arch === 'arm64') {
190
+ try {
191
+ return require('./doctor.freebsd-arm64.node')
192
+ } catch (e) {
193
+ loadErrors.push(e)
194
+ }
195
+ try {
196
+ return require('@shined/doctor-freebsd-arm64')
197
+ } catch (e) {
198
+ loadErrors.push(e)
199
+ }
200
+
201
+ } else {
202
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
203
+ }
204
+ } else if (process.platform === 'linux') {
205
+ if (process.arch === 'x64') {
206
+ if (isMusl()) {
207
+ try {
208
+ return require('./doctor.linux-x64-musl.node')
209
+ } catch (e) {
210
+ loadErrors.push(e)
211
+ }
212
+ try {
213
+ return require('@shined/doctor-linux-x64-musl')
214
+ } catch (e) {
215
+ loadErrors.push(e)
216
+ }
217
+
218
+ } else {
219
+ try {
220
+ return require('./doctor.linux-x64-gnu.node')
221
+ } catch (e) {
222
+ loadErrors.push(e)
223
+ }
224
+ try {
225
+ return require('@shined/doctor-linux-x64-gnu')
226
+ } catch (e) {
227
+ loadErrors.push(e)
228
+ }
229
+
230
+ }
231
+ } else if (process.arch === 'arm64') {
232
+ if (isMusl()) {
233
+ try {
234
+ return require('./doctor.linux-arm64-musl.node')
235
+ } catch (e) {
236
+ loadErrors.push(e)
237
+ }
238
+ try {
239
+ return require('@shined/doctor-linux-arm64-musl')
240
+ } catch (e) {
241
+ loadErrors.push(e)
242
+ }
243
+
244
+ } else {
245
+ try {
246
+ return require('./doctor.linux-arm64-gnu.node')
247
+ } catch (e) {
248
+ loadErrors.push(e)
249
+ }
250
+ try {
251
+ return require('@shined/doctor-linux-arm64-gnu')
252
+ } catch (e) {
253
+ loadErrors.push(e)
254
+ }
255
+
256
+ }
257
+ } else if (process.arch === 'arm') {
258
+ if (isMusl()) {
259
+ try {
260
+ return require('./doctor.linux-arm-musleabihf.node')
261
+ } catch (e) {
262
+ loadErrors.push(e)
263
+ }
264
+ try {
265
+ return require('@shined/doctor-linux-arm-musleabihf')
266
+ } catch (e) {
267
+ loadErrors.push(e)
268
+ }
269
+
270
+ } else {
271
+ try {
272
+ return require('./doctor.linux-arm-gnueabihf.node')
273
+ } catch (e) {
274
+ loadErrors.push(e)
275
+ }
276
+ try {
277
+ return require('@shined/doctor-linux-arm-gnueabihf')
278
+ } catch (e) {
279
+ loadErrors.push(e)
280
+ }
281
+
282
+ }
283
+ } else if (process.arch === 'riscv64') {
284
+ if (isMusl()) {
285
+ try {
286
+ return require('./doctor.linux-riscv64-musl.node')
287
+ } catch (e) {
288
+ loadErrors.push(e)
289
+ }
290
+ try {
291
+ return require('@shined/doctor-linux-riscv64-musl')
292
+ } catch (e) {
293
+ loadErrors.push(e)
294
+ }
295
+
296
+ } else {
297
+ try {
298
+ return require('./doctor.linux-riscv64-gnu.node')
299
+ } catch (e) {
300
+ loadErrors.push(e)
301
+ }
302
+ try {
303
+ return require('@shined/doctor-linux-riscv64-gnu')
304
+ } catch (e) {
305
+ loadErrors.push(e)
306
+ }
307
+
308
+ }
309
+ } else if (process.arch === 'ppc64') {
310
+ try {
311
+ return require('./doctor.linux-ppc64-gnu.node')
312
+ } catch (e) {
313
+ loadErrors.push(e)
314
+ }
315
+ try {
316
+ return require('@shined/doctor-linux-ppc64-gnu')
317
+ } catch (e) {
318
+ loadErrors.push(e)
319
+ }
320
+
321
+ } else if (process.arch === 's390x') {
322
+ try {
323
+ return require('./doctor.linux-s390x-gnu.node')
324
+ } catch (e) {
325
+ loadErrors.push(e)
326
+ }
327
+ try {
328
+ return require('@shined/doctor-linux-s390x-gnu')
329
+ } catch (e) {
330
+ loadErrors.push(e)
331
+ }
332
+
333
+ } else {
334
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
335
+ }
336
+ } else {
337
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
338
+ }
339
+ }
340
+
341
+ nativeBinding = requireNative()
342
+
343
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
344
+ try {
345
+ nativeBinding = require('./doctor.wasi.cjs')
346
+ } catch (err) {
347
+ if (process.env.NAPI_RS_FORCE_WASI) {
348
+ loadErrors.push(err)
349
+ }
350
+ }
351
+ if (!nativeBinding) {
352
+ try {
353
+ nativeBinding = require('@shined/doctor-wasm32-wasi')
354
+ } catch (err) {
355
+ if (process.env.NAPI_RS_FORCE_WASI) {
356
+ loadErrors.push(err)
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ if (!nativeBinding) {
363
+ if (loadErrors.length > 0) {
364
+ // TODO Link to documentation with potential fixes
365
+ // - The package owner could build/publish bindings for this arch
366
+ // - The user may need to bundle the correct files
367
+ // - The user may need to re-install node_modules to get new packages
368
+ throw new Error('Failed to load native binding', { cause: loadErrors })
369
+ }
370
+ throw new Error(`Failed to load native binding`)
371
+ }
372
+
373
+ module.exports.innerLint = nativeBinding.innerLint
374
+ module.exports.NaPiCategory = nativeBinding.NaPiCategory
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@shined/doctor",
3
+ "version": "0.0.1-snapshot.0",
4
+ "main": "index.js",
5
+ "types": "index.d.ts",
6
+ "napi": {
7
+ "binaryName": "doctor",
8
+ "packageName": "@shined/doctor",
9
+ "targets": [
10
+ "x86_64-apple-darwin",
11
+ "aarch64-apple-darwin",
12
+ "x86_64-pc-windows-msvc",
13
+ "aarch64-pc-windows-msvc",
14
+ "x86_64-unknown-linux-gnu",
15
+ "x86_64-unknown-linux-musl",
16
+ "aarch64-unknown-linux-gnu",
17
+ "aarch64-unknown-linux-musl"
18
+ ]
19
+ },
20
+ "scripts": {
21
+ "create-npm-dirs": "napi create-npm-dirs",
22
+ "artifacts": "napi artifacts ",
23
+ "build:js": "napi build --platform --js index.js --dts index.d.ts",
24
+ "build": "napi build --platform --release",
25
+ "build:debug": "napi build --platform",
26
+ "prepublishOnly": "napi prepublish -t npm",
27
+ "universal": "napi universal"
28
+ },
29
+ "repository": {
30
+ "url": "https://github.com/sheinsight/doctor-engine"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public",
34
+ "tag": "snapshot"
35
+ },
36
+ "files": [
37
+ "index.js",
38
+ "index.d.ts"
39
+ ],
40
+ "license": "MIT",
41
+ "devDependencies": {
42
+ "@napi-rs/cli": "^3.0.0-alpha.75"
43
+ },
44
+ "optionalDependencies": {
45
+ "@shined/doctor-darwin-x64": "0.0.1-snapshot.0",
46
+ "@shined/doctor-darwin-arm64": "0.0.1-snapshot.0",
47
+ "@shined/doctor-win32-x64-msvc": "0.0.1-snapshot.0",
48
+ "@shined/doctor-win32-arm64-msvc": "0.0.1-snapshot.0",
49
+ "@shined/doctor-linux-x64-gnu": "0.0.1-snapshot.0",
50
+ "@shined/doctor-linux-x64-musl": "0.0.1-snapshot.0",
51
+ "@shined/doctor-linux-arm64-gnu": "0.0.1-snapshot.0",
52
+ "@shined/doctor-linux-arm64-musl": "0.0.1-snapshot.0"
53
+ }
54
+ }