@printers/printers-linux-arm64-gnu 0.5.4 → 0.5.6

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/index.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ /** Printer class for Node.js */
4
+ export declare class Printer {
5
+ /** Create a new printer instance */
6
+ constructor(name: string)
7
+ /** Get printer name */
8
+ get name(): string
9
+ /** Get printer information */
10
+ getInfo(): PrinterInfo
11
+ /** Check if printer exists */
12
+ exists(): boolean
13
+ /** Print a file (async) */
14
+ printFile(filePath: string, jobProperties?: Record<string, string> | undefined | null): Promise<unknown>
15
+ }
16
+
17
+ /** Clean up old completed/failed jobs */
18
+ export declare function cleanupOldJobs(maxAgeSeconds: number): number
19
+
20
+ /** Find a printer by name */
21
+ export declare function findPrinterByName(name: string): Printer | null
22
+
23
+ /** Get all available printer names */
24
+ export declare function getAllPrinterNames(): Array<string>
25
+
26
+ /** Get all available printers */
27
+ export declare function getAllPrinters(): Array<Printer>
28
+
29
+ /** Get the status of a print job */
30
+ export declare function getJobStatus(jobId: number): JobStatus | null
31
+
32
+ /** Job status interface */
33
+ export interface JobStatus {
34
+ id: number
35
+ printerName: string
36
+ filePath: string
37
+ status: string
38
+ errorMessage?: string
39
+ ageSeconds: number
40
+ }
41
+
42
+ /** Check if a printer exists by name */
43
+ export declare function printerExists(name: string): boolean
44
+
45
+ /** Printer information */
46
+ export interface PrinterInfo {
47
+ name: string
48
+ systemName: string
49
+ driverName: string
50
+ uri: string
51
+ portName: string
52
+ processor: string
53
+ dataType: string
54
+ description: string
55
+ location: string
56
+ isDefault: boolean
57
+ isShared: boolean
58
+ state: string
59
+ stateReasons: Array<string>
60
+ }
61
+
62
+ /** Error codes for printing operations */
63
+ export declare const enum PrintErrorCode {
64
+ InvalidParams = 1,
65
+ InvalidPrinterName = 2,
66
+ InvalidFilePath = 3,
67
+ InvalidJson = 4,
68
+ InvalidJsonEncoding = 5,
69
+ PrinterNotFound = 6,
70
+ FileNotFound = 7
71
+ }
72
+
73
+ /** Print a file using printer name (async) */
74
+ export declare function printFile(printerName: string, filePath: string, jobProperties?: Record<string, string> | undefined | null): Promise<unknown>
75
+
76
+ /** Shutdown the library and cleanup all background threads */
77
+ export declare function shutdown(): void
package/index.js ADDED
@@ -0,0 +1,515 @@
1
+ // prettier-ignore
2
+ /* eslint-disable */
3
+ // @ts-nocheck
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ import { createRequire } from 'node:module'
7
+ const require = createRequire(import.meta.url)
8
+ const __dirname = new URL('.', import.meta.url).pathname
9
+
10
+ const { readFileSync } = require('node:fs')
11
+ let nativeBinding = null
12
+ const loadErrors = []
13
+
14
+ const isMusl = () => {
15
+ let musl = false
16
+ if (process.platform === 'linux') {
17
+ musl = isMuslFromFilesystem()
18
+ if (musl === null) {
19
+ musl = isMuslFromReport()
20
+ }
21
+ if (musl === null) {
22
+ musl = isMuslFromChildProcess()
23
+ }
24
+ }
25
+ return musl
26
+ }
27
+
28
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
29
+
30
+ const isMuslFromFilesystem = () => {
31
+ try {
32
+ return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
33
+ } catch {
34
+ return null
35
+ }
36
+ }
37
+
38
+ const isMuslFromReport = () => {
39
+ let report = null
40
+ if (typeof process.report?.getReport === 'function') {
41
+ process.report.excludeNetwork = true
42
+ report = process.report.getReport()
43
+ }
44
+ if (!report) {
45
+ return null
46
+ }
47
+ if (report.header && report.header.glibcVersionRuntime) {
48
+ return false
49
+ }
50
+ if (Array.isArray(report.sharedObjects)) {
51
+ if (report.sharedObjects.some(isFileMusl)) {
52
+ return true
53
+ }
54
+ }
55
+ return false
56
+ }
57
+
58
+ const isMuslFromChildProcess = () => {
59
+ try {
60
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
61
+ } catch (e) {
62
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
63
+ return false
64
+ }
65
+ }
66
+
67
+ function requireNative() {
68
+ if (process.platform === 'android') {
69
+ if (process.arch === 'arm64') {
70
+ try {
71
+ return require('./printers.android-arm64.node')
72
+ } catch (e) {
73
+ loadErrors.push(e)
74
+ }
75
+ try {
76
+ const binding = require('@printers/printers-android-arm64')
77
+ const bindingPackageVersion = require('@printers/printers-android-arm64/package.json').version
78
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
79
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ }
81
+ return binding
82
+ } catch (e) {
83
+ loadErrors.push(e)
84
+ }
85
+ } else if (process.arch === 'arm') {
86
+ try {
87
+ return require('./printers.android-arm-eabi.node')
88
+ } catch (e) {
89
+ loadErrors.push(e)
90
+ }
91
+ try {
92
+ const binding = require('@printers/printers-android-arm-eabi')
93
+ const bindingPackageVersion = require('@printers/printers-android-arm-eabi/package.json').version
94
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
95
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ }
97
+ return binding
98
+ } catch (e) {
99
+ loadErrors.push(e)
100
+ }
101
+ } else {
102
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
103
+ }
104
+ } else if (process.platform === 'win32') {
105
+ if (process.arch === 'x64') {
106
+ try {
107
+ return require('./printers.win32-x64-msvc.node')
108
+ } catch (e) {
109
+ loadErrors.push(e)
110
+ }
111
+ try {
112
+ const binding = require('@printers/printers-win32-x64-msvc')
113
+ const bindingPackageVersion = require('@printers/printers-win32-x64-msvc/package.json').version
114
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
115
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
116
+ }
117
+ return binding
118
+ } catch (e) {
119
+ loadErrors.push(e)
120
+ }
121
+ } else if (process.arch === 'ia32') {
122
+ try {
123
+ return require('./printers.win32-ia32-msvc.node')
124
+ } catch (e) {
125
+ loadErrors.push(e)
126
+ }
127
+ try {
128
+ const binding = require('@printers/printers-win32-ia32-msvc')
129
+ const bindingPackageVersion = require('@printers/printers-win32-ia32-msvc/package.json').version
130
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
131
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
132
+ }
133
+ return binding
134
+ } catch (e) {
135
+ loadErrors.push(e)
136
+ }
137
+ } else if (process.arch === 'arm64') {
138
+ try {
139
+ return require('./printers.win32-arm64-msvc.node')
140
+ } catch (e) {
141
+ loadErrors.push(e)
142
+ }
143
+ try {
144
+ const binding = require('@printers/printers-win32-arm64-msvc')
145
+ const bindingPackageVersion = require('@printers/printers-win32-arm64-msvc/package.json').version
146
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
147
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
148
+ }
149
+ return binding
150
+ } catch (e) {
151
+ loadErrors.push(e)
152
+ }
153
+ } else {
154
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
155
+ }
156
+ } else if (process.platform === 'darwin') {
157
+ try {
158
+ return require('./printers.darwin-universal.node')
159
+ } catch (e) {
160
+ loadErrors.push(e)
161
+ }
162
+ try {
163
+ const binding = require('@printers/printers-darwin-universal')
164
+ const bindingPackageVersion = require('@printers/printers-darwin-universal/package.json').version
165
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
166
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
167
+ }
168
+ return binding
169
+ } catch (e) {
170
+ loadErrors.push(e)
171
+ }
172
+ if (process.arch === 'x64') {
173
+ try {
174
+ return require('./printers.darwin-x64.node')
175
+ } catch (e) {
176
+ loadErrors.push(e)
177
+ }
178
+ try {
179
+ const binding = require('@printers/printers-darwin-x64')
180
+ const bindingPackageVersion = require('@printers/printers-darwin-x64/package.json').version
181
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
183
+ }
184
+ return binding
185
+ } catch (e) {
186
+ loadErrors.push(e)
187
+ }
188
+ } else if (process.arch === 'arm64') {
189
+ try {
190
+ return require('./printers.darwin-arm64.node')
191
+ } catch (e) {
192
+ loadErrors.push(e)
193
+ }
194
+ try {
195
+ const binding = require('@printers/printers-darwin-arm64')
196
+ const bindingPackageVersion = require('@printers/printers-darwin-arm64/package.json').version
197
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
199
+ }
200
+ return binding
201
+ } catch (e) {
202
+ loadErrors.push(e)
203
+ }
204
+ } else {
205
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
206
+ }
207
+ } else if (process.platform === 'freebsd') {
208
+ if (process.arch === 'x64') {
209
+ try {
210
+ return require('./printers.freebsd-x64.node')
211
+ } catch (e) {
212
+ loadErrors.push(e)
213
+ }
214
+ try {
215
+ const binding = require('@printers/printers-freebsd-x64')
216
+ const bindingPackageVersion = require('@printers/printers-freebsd-x64/package.json').version
217
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
+ }
220
+ return binding
221
+ } catch (e) {
222
+ loadErrors.push(e)
223
+ }
224
+ } else if (process.arch === 'arm64') {
225
+ try {
226
+ return require('./printers.freebsd-arm64.node')
227
+ } catch (e) {
228
+ loadErrors.push(e)
229
+ }
230
+ try {
231
+ const binding = require('@printers/printers-freebsd-arm64')
232
+ const bindingPackageVersion = require('@printers/printers-freebsd-arm64/package.json').version
233
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
234
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
235
+ }
236
+ return binding
237
+ } catch (e) {
238
+ loadErrors.push(e)
239
+ }
240
+ } else {
241
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
242
+ }
243
+ } else if (process.platform === 'linux') {
244
+ if (process.arch === 'x64') {
245
+ if (isMusl()) {
246
+ try {
247
+ return require('./printers.linux-x64-musl.node')
248
+ } catch (e) {
249
+ loadErrors.push(e)
250
+ }
251
+ try {
252
+ const binding = require('@printers/printers-linux-x64-musl')
253
+ const bindingPackageVersion = require('@printers/printers-linux-x64-musl/package.json').version
254
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
255
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
256
+ }
257
+ return binding
258
+ } catch (e) {
259
+ loadErrors.push(e)
260
+ }
261
+ } else {
262
+ try {
263
+ return require('./printers.linux-x64-gnu.node')
264
+ } catch (e) {
265
+ loadErrors.push(e)
266
+ }
267
+ try {
268
+ const binding = require('@printers/printers-linux-x64-gnu')
269
+ const bindingPackageVersion = require('@printers/printers-linux-x64-gnu/package.json').version
270
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
271
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
272
+ }
273
+ return binding
274
+ } catch (e) {
275
+ loadErrors.push(e)
276
+ }
277
+ }
278
+ } else if (process.arch === 'arm64') {
279
+ if (isMusl()) {
280
+ try {
281
+ return require('./printers.linux-arm64-musl.node')
282
+ } catch (e) {
283
+ loadErrors.push(e)
284
+ }
285
+ try {
286
+ const binding = require('@printers/printers-linux-arm64-musl')
287
+ const bindingPackageVersion = require('@printers/printers-linux-arm64-musl/package.json').version
288
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
289
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ }
291
+ return binding
292
+ } catch (e) {
293
+ loadErrors.push(e)
294
+ }
295
+ } else {
296
+ try {
297
+ return require('./printers.linux-arm64-gnu.node')
298
+ } catch (e) {
299
+ loadErrors.push(e)
300
+ }
301
+ try {
302
+ const binding = require('@printers/printers-linux-arm64-gnu')
303
+ const bindingPackageVersion = require('@printers/printers-linux-arm64-gnu/package.json').version
304
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
305
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
306
+ }
307
+ return binding
308
+ } catch (e) {
309
+ loadErrors.push(e)
310
+ }
311
+ }
312
+ } else if (process.arch === 'arm') {
313
+ if (isMusl()) {
314
+ try {
315
+ return require('./printers.linux-arm-musleabihf.node')
316
+ } catch (e) {
317
+ loadErrors.push(e)
318
+ }
319
+ try {
320
+ const binding = require('@printers/printers-linux-arm-musleabihf')
321
+ const bindingPackageVersion = require('@printers/printers-linux-arm-musleabihf/package.json').version
322
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
323
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ }
325
+ return binding
326
+ } catch (e) {
327
+ loadErrors.push(e)
328
+ }
329
+ } else {
330
+ try {
331
+ return require('./printers.linux-arm-gnueabihf.node')
332
+ } catch (e) {
333
+ loadErrors.push(e)
334
+ }
335
+ try {
336
+ const binding = require('@printers/printers-linux-arm-gnueabihf')
337
+ const bindingPackageVersion = require('@printers/printers-linux-arm-gnueabihf/package.json').version
338
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
339
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
340
+ }
341
+ return binding
342
+ } catch (e) {
343
+ loadErrors.push(e)
344
+ }
345
+ }
346
+ } else if (process.arch === 'riscv64') {
347
+ if (isMusl()) {
348
+ try {
349
+ return require('./printers.linux-riscv64-musl.node')
350
+ } catch (e) {
351
+ loadErrors.push(e)
352
+ }
353
+ try {
354
+ const binding = require('@printers/printers-linux-riscv64-musl')
355
+ const bindingPackageVersion = require('@printers/printers-linux-riscv64-musl/package.json').version
356
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
357
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ }
359
+ return binding
360
+ } catch (e) {
361
+ loadErrors.push(e)
362
+ }
363
+ } else {
364
+ try {
365
+ return require('./printers.linux-riscv64-gnu.node')
366
+ } catch (e) {
367
+ loadErrors.push(e)
368
+ }
369
+ try {
370
+ const binding = require('@printers/printers-linux-riscv64-gnu')
371
+ const bindingPackageVersion = require('@printers/printers-linux-riscv64-gnu/package.json').version
372
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
373
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
374
+ }
375
+ return binding
376
+ } catch (e) {
377
+ loadErrors.push(e)
378
+ }
379
+ }
380
+ } else if (process.arch === 'ppc64') {
381
+ try {
382
+ return require('./printers.linux-ppc64-gnu.node')
383
+ } catch (e) {
384
+ loadErrors.push(e)
385
+ }
386
+ try {
387
+ const binding = require('@printers/printers-linux-ppc64-gnu')
388
+ const bindingPackageVersion = require('@printers/printers-linux-ppc64-gnu/package.json').version
389
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
390
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
391
+ }
392
+ return binding
393
+ } catch (e) {
394
+ loadErrors.push(e)
395
+ }
396
+ } else if (process.arch === 's390x') {
397
+ try {
398
+ return require('./printers.linux-s390x-gnu.node')
399
+ } catch (e) {
400
+ loadErrors.push(e)
401
+ }
402
+ try {
403
+ const binding = require('@printers/printers-linux-s390x-gnu')
404
+ const bindingPackageVersion = require('@printers/printers-linux-s390x-gnu/package.json').version
405
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
406
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
407
+ }
408
+ return binding
409
+ } catch (e) {
410
+ loadErrors.push(e)
411
+ }
412
+ } else {
413
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
414
+ }
415
+ } else if (process.platform === 'openharmony') {
416
+ if (process.arch === 'arm64') {
417
+ try {
418
+ return require('./printers.openharmony-arm64.node')
419
+ } catch (e) {
420
+ loadErrors.push(e)
421
+ }
422
+ try {
423
+ const binding = require('@printers/printers-openharmony-arm64')
424
+ const bindingPackageVersion = require('@printers/printers-openharmony-arm64/package.json').version
425
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
427
+ }
428
+ return binding
429
+ } catch (e) {
430
+ loadErrors.push(e)
431
+ }
432
+ } else if (process.arch === 'x64') {
433
+ try {
434
+ return require('./printers.openharmony-x64.node')
435
+ } catch (e) {
436
+ loadErrors.push(e)
437
+ }
438
+ try {
439
+ const binding = require('@printers/printers-openharmony-x64')
440
+ const bindingPackageVersion = require('@printers/printers-openharmony-x64/package.json').version
441
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
442
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ }
444
+ return binding
445
+ } catch (e) {
446
+ loadErrors.push(e)
447
+ }
448
+ } else if (process.arch === 'arm') {
449
+ try {
450
+ return require('./printers.openharmony-arm.node')
451
+ } catch (e) {
452
+ loadErrors.push(e)
453
+ }
454
+ try {
455
+ const binding = require('@printers/printers-openharmony-arm')
456
+ const bindingPackageVersion = require('@printers/printers-openharmony-arm/package.json').version
457
+ if (bindingPackageVersion !== '0.5.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
458
+ throw new Error(`Native binding package version mismatch, expected 0.5.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ }
460
+ return binding
461
+ } catch (e) {
462
+ loadErrors.push(e)
463
+ }
464
+ } else {
465
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
466
+ }
467
+ } else {
468
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
469
+ }
470
+ }
471
+
472
+ nativeBinding = requireNative()
473
+
474
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
475
+ try {
476
+ nativeBinding = require('./printers.wasi.cjs')
477
+ } catch (err) {
478
+ if (process.env.NAPI_RS_FORCE_WASI) {
479
+ loadErrors.push(err)
480
+ }
481
+ }
482
+ if (!nativeBinding) {
483
+ try {
484
+ nativeBinding = require('@printers/printers-wasm32-wasi')
485
+ } catch (err) {
486
+ if (process.env.NAPI_RS_FORCE_WASI) {
487
+ loadErrors.push(err)
488
+ }
489
+ }
490
+ }
491
+ }
492
+
493
+ if (!nativeBinding) {
494
+ if (loadErrors.length > 0) {
495
+ throw new Error(
496
+ `Cannot find native binding. ` +
497
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
498
+ 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
499
+ { cause: loadErrors }
500
+ )
501
+ }
502
+ throw new Error(`Failed to load native binding`)
503
+ }
504
+
505
+ const { Printer, cleanupOldJobs, findPrinterByName, getAllPrinterNames, getAllPrinters, getJobStatus, printerExists, PrintErrorCode, printFile, shutdown } = nativeBinding
506
+ export { Printer }
507
+ export { cleanupOldJobs }
508
+ export { findPrinterByName }
509
+ export { getAllPrinterNames }
510
+ export { getAllPrinters }
511
+ export { getJobStatus }
512
+ export { printerExists }
513
+ export { PrintErrorCode }
514
+ export { printFile }
515
+ export { shutdown }
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@printers/printers-linux-arm64-gnu",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "cpu": [
5
5
  "arm64"
6
6
  ],
7
- "main": "printers.linux-arm64-gnu.node",
7
+ "main": "index.js",
8
8
  "files": [
9
- "printers.linux-arm64-gnu.node"
9
+ "index.js",
10
+ "index.js",
11
+ "index.d.ts"
10
12
  ],
11
13
  "description": "Cross-platform printer library for Node.js, Deno, and Bun",
12
14
  "license": "MIT",
@@ -22,5 +24,6 @@
22
24
  ],
23
25
  "libc": [
24
26
  "glibc"
25
- ]
27
+ ],
28
+ "types": "index.d.ts"
26
29
  }
Binary file