@publier/native 1.1.3

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.js ADDED
@@ -0,0 +1,732 @@
1
+ // prettier-ignore
2
+ /* eslint-disable */
3
+ // @ts-nocheck
4
+
5
+ const { readFileSync } = require('node:fs')
6
+ let nativeBinding = null
7
+ const loadErrors = []
8
+
9
+ const isMusl = () => {
10
+ let musl = false
11
+ if (process.platform === 'linux') {
12
+ musl = isMuslFromFilesystem()
13
+ if (musl === null) {
14
+ musl = isMuslFromReport()
15
+ }
16
+ if (musl === null) {
17
+ musl = isMuslFromChildProcess()
18
+ }
19
+ }
20
+ return musl
21
+ }
22
+
23
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
24
+
25
+ const isMuslFromFilesystem = () => {
26
+ try {
27
+ return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
28
+ } catch {
29
+ return null
30
+ }
31
+ }
32
+
33
+ const isMuslFromReport = () => {
34
+ let report = null
35
+ if (typeof process.report?.getReport === 'function') {
36
+ process.report.excludeNetwork = true
37
+ report = process.report.getReport()
38
+ }
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
+ return 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('./publier-native.android-arm64.node')
73
+ } catch (e) {
74
+ loadErrors.push(e)
75
+ }
76
+ try {
77
+ const binding = require('@publier/native-android-arm64')
78
+ const bindingPackageVersion = require('@publier/native-android-arm64/package.json').version
79
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
80
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
81
+ }
82
+ return binding
83
+ } catch (e) {
84
+ loadErrors.push(e)
85
+ }
86
+ } else if (process.arch === 'arm') {
87
+ try {
88
+ return require('./publier-native.android-arm-eabi.node')
89
+ } catch (e) {
90
+ loadErrors.push(e)
91
+ }
92
+ try {
93
+ const binding = require('@publier/native-android-arm-eabi')
94
+ const bindingPackageVersion = require('@publier/native-android-arm-eabi/package.json').version
95
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
96
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
97
+ }
98
+ return binding
99
+ } catch (e) {
100
+ loadErrors.push(e)
101
+ }
102
+ } else {
103
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
104
+ }
105
+ } else if (process.platform === 'win32') {
106
+ if (process.arch === 'x64') {
107
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
108
+ try {
109
+ return require('./publier-native.win32-x64-gnu.node')
110
+ } catch (e) {
111
+ loadErrors.push(e)
112
+ }
113
+ try {
114
+ const binding = require('@publier/native-win32-x64-gnu')
115
+ const bindingPackageVersion = require('@publier/native-win32-x64-gnu/package.json').version
116
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
117
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
118
+ }
119
+ return binding
120
+ } catch (e) {
121
+ loadErrors.push(e)
122
+ }
123
+ } else {
124
+ try {
125
+ return require('./publier-native.win32-x64-msvc.node')
126
+ } catch (e) {
127
+ loadErrors.push(e)
128
+ }
129
+ try {
130
+ const binding = require('@publier/native-win32-x64-msvc')
131
+ const bindingPackageVersion = require('@publier/native-win32-x64-msvc/package.json').version
132
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
133
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ }
135
+ return binding
136
+ } catch (e) {
137
+ loadErrors.push(e)
138
+ }
139
+ }
140
+ } else if (process.arch === 'ia32') {
141
+ try {
142
+ return require('./publier-native.win32-ia32-msvc.node')
143
+ } catch (e) {
144
+ loadErrors.push(e)
145
+ }
146
+ try {
147
+ const binding = require('@publier/native-win32-ia32-msvc')
148
+ const bindingPackageVersion = require('@publier/native-win32-ia32-msvc/package.json').version
149
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
150
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
151
+ }
152
+ return binding
153
+ } catch (e) {
154
+ loadErrors.push(e)
155
+ }
156
+ } else if (process.arch === 'arm64') {
157
+ try {
158
+ return require('./publier-native.win32-arm64-msvc.node')
159
+ } catch (e) {
160
+ loadErrors.push(e)
161
+ }
162
+ try {
163
+ const binding = require('@publier/native-win32-arm64-msvc')
164
+ const bindingPackageVersion = require('@publier/native-win32-arm64-msvc/package.json').version
165
+ if (bindingPackageVersion !== '1.1.3' && 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 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
167
+ }
168
+ return binding
169
+ } catch (e) {
170
+ loadErrors.push(e)
171
+ }
172
+ } else {
173
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
174
+ }
175
+ } else if (process.platform === 'darwin') {
176
+ try {
177
+ return require('./publier-native.darwin-universal.node')
178
+ } catch (e) {
179
+ loadErrors.push(e)
180
+ }
181
+ try {
182
+ const binding = require('@publier/native-darwin-universal')
183
+ const bindingPackageVersion = require('@publier/native-darwin-universal/package.json').version
184
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
185
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
186
+ }
187
+ return binding
188
+ } catch (e) {
189
+ loadErrors.push(e)
190
+ }
191
+ if (process.arch === 'x64') {
192
+ try {
193
+ return require('./publier-native.darwin-x64.node')
194
+ } catch (e) {
195
+ loadErrors.push(e)
196
+ }
197
+ try {
198
+ const binding = require('@publier/native-darwin-x64')
199
+ const bindingPackageVersion = require('@publier/native-darwin-x64/package.json').version
200
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
201
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ }
203
+ return binding
204
+ } catch (e) {
205
+ loadErrors.push(e)
206
+ }
207
+ } else if (process.arch === 'arm64') {
208
+ try {
209
+ return require('./publier-native.darwin-arm64.node')
210
+ } catch (e) {
211
+ loadErrors.push(e)
212
+ }
213
+ try {
214
+ const binding = require('@publier/native-darwin-arm64')
215
+ const bindingPackageVersion = require('@publier/native-darwin-arm64/package.json').version
216
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
217
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
218
+ }
219
+ return binding
220
+ } catch (e) {
221
+ loadErrors.push(e)
222
+ }
223
+ } else {
224
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
225
+ }
226
+ } else if (process.platform === 'freebsd') {
227
+ if (process.arch === 'x64') {
228
+ try {
229
+ return require('./publier-native.freebsd-x64.node')
230
+ } catch (e) {
231
+ loadErrors.push(e)
232
+ }
233
+ try {
234
+ const binding = require('@publier/native-freebsd-x64')
235
+ const bindingPackageVersion = require('@publier/native-freebsd-x64/package.json').version
236
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
237
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
238
+ }
239
+ return binding
240
+ } catch (e) {
241
+ loadErrors.push(e)
242
+ }
243
+ } else if (process.arch === 'arm64') {
244
+ try {
245
+ return require('./publier-native.freebsd-arm64.node')
246
+ } catch (e) {
247
+ loadErrors.push(e)
248
+ }
249
+ try {
250
+ const binding = require('@publier/native-freebsd-arm64')
251
+ const bindingPackageVersion = require('@publier/native-freebsd-arm64/package.json').version
252
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
253
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
254
+ }
255
+ return binding
256
+ } catch (e) {
257
+ loadErrors.push(e)
258
+ }
259
+ } else {
260
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
261
+ }
262
+ } else if (process.platform === 'linux') {
263
+ if (process.arch === 'x64') {
264
+ if (isMusl()) {
265
+ try {
266
+ return require('./publier-native.linux-x64-musl.node')
267
+ } catch (e) {
268
+ loadErrors.push(e)
269
+ }
270
+ try {
271
+ const binding = require('@publier/native-linux-x64-musl')
272
+ const bindingPackageVersion = require('@publier/native-linux-x64-musl/package.json').version
273
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
274
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
275
+ }
276
+ return binding
277
+ } catch (e) {
278
+ loadErrors.push(e)
279
+ }
280
+ } else {
281
+ try {
282
+ return require('./publier-native.linux-x64-gnu.node')
283
+ } catch (e) {
284
+ loadErrors.push(e)
285
+ }
286
+ try {
287
+ const binding = require('@publier/native-linux-x64-gnu')
288
+ const bindingPackageVersion = require('@publier/native-linux-x64-gnu/package.json').version
289
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
290
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
291
+ }
292
+ return binding
293
+ } catch (e) {
294
+ loadErrors.push(e)
295
+ }
296
+ }
297
+ } else if (process.arch === 'arm64') {
298
+ if (isMusl()) {
299
+ try {
300
+ return require('./publier-native.linux-arm64-musl.node')
301
+ } catch (e) {
302
+ loadErrors.push(e)
303
+ }
304
+ try {
305
+ const binding = require('@publier/native-linux-arm64-musl')
306
+ const bindingPackageVersion = require('@publier/native-linux-arm64-musl/package.json').version
307
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
309
+ }
310
+ return binding
311
+ } catch (e) {
312
+ loadErrors.push(e)
313
+ }
314
+ } else {
315
+ try {
316
+ return require('./publier-native.linux-arm64-gnu.node')
317
+ } catch (e) {
318
+ loadErrors.push(e)
319
+ }
320
+ try {
321
+ const binding = require('@publier/native-linux-arm64-gnu')
322
+ const bindingPackageVersion = require('@publier/native-linux-arm64-gnu/package.json').version
323
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
325
+ }
326
+ return binding
327
+ } catch (e) {
328
+ loadErrors.push(e)
329
+ }
330
+ }
331
+ } else if (process.arch === 'arm') {
332
+ if (isMusl()) {
333
+ try {
334
+ return require('./publier-native.linux-arm-musleabihf.node')
335
+ } catch (e) {
336
+ loadErrors.push(e)
337
+ }
338
+ try {
339
+ const binding = require('@publier/native-linux-arm-musleabihf')
340
+ const bindingPackageVersion = require('@publier/native-linux-arm-musleabihf/package.json').version
341
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
343
+ }
344
+ return binding
345
+ } catch (e) {
346
+ loadErrors.push(e)
347
+ }
348
+ } else {
349
+ try {
350
+ return require('./publier-native.linux-arm-gnueabihf.node')
351
+ } catch (e) {
352
+ loadErrors.push(e)
353
+ }
354
+ try {
355
+ const binding = require('@publier/native-linux-arm-gnueabihf')
356
+ const bindingPackageVersion = require('@publier/native-linux-arm-gnueabihf/package.json').version
357
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
359
+ }
360
+ return binding
361
+ } catch (e) {
362
+ loadErrors.push(e)
363
+ }
364
+ }
365
+ } else if (process.arch === 'loong64') {
366
+ if (isMusl()) {
367
+ try {
368
+ return require('./publier-native.linux-loong64-musl.node')
369
+ } catch (e) {
370
+ loadErrors.push(e)
371
+ }
372
+ try {
373
+ const binding = require('@publier/native-linux-loong64-musl')
374
+ const bindingPackageVersion = require('@publier/native-linux-loong64-musl/package.json').version
375
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
377
+ }
378
+ return binding
379
+ } catch (e) {
380
+ loadErrors.push(e)
381
+ }
382
+ } else {
383
+ try {
384
+ return require('./publier-native.linux-loong64-gnu.node')
385
+ } catch (e) {
386
+ loadErrors.push(e)
387
+ }
388
+ try {
389
+ const binding = require('@publier/native-linux-loong64-gnu')
390
+ const bindingPackageVersion = require('@publier/native-linux-loong64-gnu/package.json').version
391
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
393
+ }
394
+ return binding
395
+ } catch (e) {
396
+ loadErrors.push(e)
397
+ }
398
+ }
399
+ } else if (process.arch === 'riscv64') {
400
+ if (isMusl()) {
401
+ try {
402
+ return require('./publier-native.linux-riscv64-musl.node')
403
+ } catch (e) {
404
+ loadErrors.push(e)
405
+ }
406
+ try {
407
+ const binding = require('@publier/native-linux-riscv64-musl')
408
+ const bindingPackageVersion = require('@publier/native-linux-riscv64-musl/package.json').version
409
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
+ }
412
+ return binding
413
+ } catch (e) {
414
+ loadErrors.push(e)
415
+ }
416
+ } else {
417
+ try {
418
+ return require('./publier-native.linux-riscv64-gnu.node')
419
+ } catch (e) {
420
+ loadErrors.push(e)
421
+ }
422
+ try {
423
+ const binding = require('@publier/native-linux-riscv64-gnu')
424
+ const bindingPackageVersion = require('@publier/native-linux-riscv64-gnu/package.json').version
425
+ if (bindingPackageVersion !== '1.1.3' && 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 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
427
+ }
428
+ return binding
429
+ } catch (e) {
430
+ loadErrors.push(e)
431
+ }
432
+ }
433
+ } else if (process.arch === 'ppc64') {
434
+ try {
435
+ return require('./publier-native.linux-ppc64-gnu.node')
436
+ } catch (e) {
437
+ loadErrors.push(e)
438
+ }
439
+ try {
440
+ const binding = require('@publier/native-linux-ppc64-gnu')
441
+ const bindingPackageVersion = require('@publier/native-linux-ppc64-gnu/package.json').version
442
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
443
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
444
+ }
445
+ return binding
446
+ } catch (e) {
447
+ loadErrors.push(e)
448
+ }
449
+ } else if (process.arch === 's390x') {
450
+ try {
451
+ return require('./publier-native.linux-s390x-gnu.node')
452
+ } catch (e) {
453
+ loadErrors.push(e)
454
+ }
455
+ try {
456
+ const binding = require('@publier/native-linux-s390x-gnu')
457
+ const bindingPackageVersion = require('@publier/native-linux-s390x-gnu/package.json').version
458
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
459
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
460
+ }
461
+ return binding
462
+ } catch (e) {
463
+ loadErrors.push(e)
464
+ }
465
+ } else {
466
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
467
+ }
468
+ } else if (process.platform === 'openharmony') {
469
+ if (process.arch === 'arm64') {
470
+ try {
471
+ return require('./publier-native.openharmony-arm64.node')
472
+ } catch (e) {
473
+ loadErrors.push(e)
474
+ }
475
+ try {
476
+ const binding = require('@publier/native-openharmony-arm64')
477
+ const bindingPackageVersion = require('@publier/native-openharmony-arm64/package.json').version
478
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
479
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
480
+ }
481
+ return binding
482
+ } catch (e) {
483
+ loadErrors.push(e)
484
+ }
485
+ } else if (process.arch === 'x64') {
486
+ try {
487
+ return require('./publier-native.openharmony-x64.node')
488
+ } catch (e) {
489
+ loadErrors.push(e)
490
+ }
491
+ try {
492
+ const binding = require('@publier/native-openharmony-x64')
493
+ const bindingPackageVersion = require('@publier/native-openharmony-x64/package.json').version
494
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
495
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
496
+ }
497
+ return binding
498
+ } catch (e) {
499
+ loadErrors.push(e)
500
+ }
501
+ } else if (process.arch === 'arm') {
502
+ try {
503
+ return require('./publier-native.openharmony-arm.node')
504
+ } catch (e) {
505
+ loadErrors.push(e)
506
+ }
507
+ try {
508
+ const binding = require('@publier/native-openharmony-arm')
509
+ const bindingPackageVersion = require('@publier/native-openharmony-arm/package.json').version
510
+ if (bindingPackageVersion !== '1.1.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
511
+ throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
512
+ }
513
+ return binding
514
+ } catch (e) {
515
+ loadErrors.push(e)
516
+ }
517
+ } else {
518
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
519
+ }
520
+ } else {
521
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
522
+ }
523
+ }
524
+
525
+ nativeBinding = requireNative()
526
+
527
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
528
+ let wasiBinding = null
529
+ let wasiBindingError = null
530
+ try {
531
+ wasiBinding = require('./publier-native.wasi.cjs')
532
+ nativeBinding = wasiBinding
533
+ } catch (err) {
534
+ if (process.env.NAPI_RS_FORCE_WASI) {
535
+ wasiBindingError = err
536
+ }
537
+ }
538
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
539
+ try {
540
+ wasiBinding = require('@publier/native-wasm32-wasi')
541
+ nativeBinding = wasiBinding
542
+ } catch (err) {
543
+ if (process.env.NAPI_RS_FORCE_WASI) {
544
+ if (!wasiBindingError) {
545
+ wasiBindingError = err
546
+ } else {
547
+ wasiBindingError.cause = err
548
+ }
549
+ loadErrors.push(err)
550
+ }
551
+ }
552
+ }
553
+ if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
554
+ const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
555
+ error.cause = wasiBindingError
556
+ throw error
557
+ }
558
+ }
559
+
560
+ if (!nativeBinding) {
561
+ if (loadErrors.length > 0) {
562
+ throw new Error(
563
+ `Cannot find native binding. ` +
564
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
565
+ 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
566
+ {
567
+ cause: loadErrors.reduce((err, cur) => {
568
+ cur.cause = err
569
+ return cur
570
+ }),
571
+ },
572
+ )
573
+ }
574
+ throw new Error(`Failed to load native binding`)
575
+ }
576
+
577
+ module.exports = nativeBinding
578
+ module.exports.analyticsGenerateBodyScripts = nativeBinding.analyticsGenerateBodyScripts
579
+ module.exports.analyticsGenerateScripts = nativeBinding.analyticsGenerateScripts
580
+ module.exports.asyncapiSourceBuild = nativeBinding.asyncapiSourceBuild
581
+ module.exports.blogFilterByTag = nativeBinding.blogFilterByTag
582
+ module.exports.blogFilterPublished = nativeBinding.blogFilterPublished
583
+ module.exports.blogReadingTime = nativeBinding.blogReadingTime
584
+ module.exports.blogSortByDate = nativeBinding.blogSortByDate
585
+ module.exports.blogTagCounts = nativeBinding.blogTagCounts
586
+ module.exports.buildHook = nativeBinding.buildHook
587
+ module.exports.configResolvePublierConfig = nativeBinding.configResolvePublierConfig
588
+ module.exports.configShouldRenderPage = nativeBinding.configShouldRenderPage
589
+ module.exports.contentGenerateLlmsTxt = nativeBinding.contentGenerateLlmsTxt
590
+ module.exports.contentGenerateOgImageMarkup = nativeBinding.contentGenerateOgImageMarkup
591
+ module.exports.contentGenerateRobotsTxt = nativeBinding.contentGenerateRobotsTxt
592
+ module.exports.contentGenerateSkillMd = nativeBinding.contentGenerateSkillMd
593
+ module.exports.contentGenerateTwitterMeta = nativeBinding.contentGenerateTwitterMeta
594
+ module.exports.contentGetSlug = nativeBinding.contentGetSlug
595
+ module.exports.navigationActiveIndex = nativeBinding.navigationActiveIndex
596
+ module.exports.navigationBuildSidebar = nativeBinding.navigationBuildSidebar
597
+ module.exports.navigationMatchNavPath = nativeBinding.navigationMatchNavPath
598
+ module.exports.openapiBuildCustomSampleMap = nativeBinding.openapiBuildCustomSampleMap
599
+ module.exports.openapiBuildInstanceId = nativeBinding.openapiBuildInstanceId
600
+ module.exports.openapiDecodePlaceholders = nativeBinding.openapiDecodePlaceholders
601
+ module.exports.openapiExtractEndpoints = nativeBinding.openapiExtractEndpoints
602
+ module.exports.openapiGenerateFiles = nativeBinding.openapiGenerateFiles
603
+ module.exports.openapiGetMediaTypeExample = nativeBinding.openapiGetMediaTypeExample
604
+ module.exports.openapiGetSnippetClient = nativeBinding.openapiGetSnippetClient
605
+ module.exports.openapiHarFromOperation = nativeBinding.openapiHarFromOperation
606
+ module.exports.openapiMergeSpecs = nativeBinding.openapiMergeSpecs
607
+ module.exports.openapiNavigationBuild = nativeBinding.openapiNavigationBuild
608
+ module.exports.openapiParseAsyncApiSpec = nativeBinding.openapiParseAsyncApiSpec
609
+ module.exports.openapiParseOpenapiSpec = nativeBinding.openapiParseOpenapiSpec
610
+ module.exports.openapiRenderApiPage = nativeBinding.openapiRenderApiPage
611
+ module.exports.openapiRenderApiPlayground = nativeBinding.openapiRenderApiPlayground
612
+ module.exports.openapiRenderApiReference = nativeBinding.openapiRenderApiReference
613
+ module.exports.openapiRenderApiReferenceShell = nativeBinding.openapiRenderApiReferenceShell
614
+ module.exports.openapiRenderAsyncChannel = nativeBinding.openapiRenderAsyncChannel
615
+ module.exports.openapiRenderAsyncMessage = nativeBinding.openapiRenderAsyncMessage
616
+ module.exports.openapiRenderCodeSamples = nativeBinding.openapiRenderCodeSamples
617
+ module.exports.openapiRenderCollapsibleSection = nativeBinding.openapiRenderCollapsibleSection
618
+ module.exports.openapiRenderMethodBadge = nativeBinding.openapiRenderMethodBadge
619
+ module.exports.openapiRenderParamField = nativeBinding.openapiRenderParamField
620
+ module.exports.openapiRenderRequestExample = nativeBinding.openapiRenderRequestExample
621
+ module.exports.openapiRenderResponseExample = nativeBinding.openapiRenderResponseExample
622
+ module.exports.openapiRenderResponseField = nativeBinding.openapiRenderResponseField
623
+ module.exports.openapiRenderSchemaRow = nativeBinding.openapiRenderSchemaRow
624
+ module.exports.openapiRenderSchemaView = nativeBinding.openapiRenderSchemaView
625
+ module.exports.openapiResolveBaseUrl = nativeBinding.openapiResolveBaseUrl
626
+ module.exports.openapiResolveRefs = nativeBinding.openapiResolveRefs
627
+ module.exports.openapiSourceBuild = nativeBinding.openapiSourceBuild
628
+ module.exports.pluginHook = nativeBinding.pluginHook
629
+ module.exports.primitivesColorSwatchScript = nativeBinding.primitivesColorSwatchScript
630
+ module.exports.primitivesColorSwatchStyle = nativeBinding.primitivesColorSwatchStyle
631
+ module.exports.primitivesCopyButtonScript = nativeBinding.primitivesCopyButtonScript
632
+ module.exports.primitivesCopyButtonStyle = nativeBinding.primitivesCopyButtonStyle
633
+ module.exports.primitivesRenderAccordion = nativeBinding.primitivesRenderAccordion
634
+ module.exports.primitivesRenderAccordionItem = nativeBinding.primitivesRenderAccordionItem
635
+ module.exports.primitivesRenderColorSwatch = nativeBinding.primitivesRenderColorSwatch
636
+ module.exports.primitivesRenderCopyButton = nativeBinding.primitivesRenderCopyButton
637
+ module.exports.primitivesRenderImageZoom = nativeBinding.primitivesRenderImageZoom
638
+ module.exports.primitivesRenderTabPanel = nativeBinding.primitivesRenderTabPanel
639
+ module.exports.primitivesRenderTabs = nativeBinding.primitivesRenderTabs
640
+ module.exports.primitivesRenderTooltip = nativeBinding.primitivesRenderTooltip
641
+ module.exports.primitivesRenderViewAnimation = nativeBinding.primitivesRenderViewAnimation
642
+ module.exports.primitivesTabsScript = nativeBinding.primitivesTabsScript
643
+ module.exports.primitivesViewAnimationScript = nativeBinding.primitivesViewAnimationScript
644
+ module.exports.primitivesViewAnimationStyle = nativeBinding.primitivesViewAnimationStyle
645
+ module.exports.remarkCollectSections = nativeBinding.remarkCollectSections
646
+ module.exports.remarkResolveSnippet = nativeBinding.remarkResolveSnippet
647
+ module.exports.remarkTransformAsides = nativeBinding.remarkTransformAsides
648
+ module.exports.remarkVarsSubstitute = nativeBinding.remarkVarsSubstitute
649
+ module.exports.rssGenerateFeed = nativeBinding.rssGenerateFeed
650
+ module.exports.searchEntryToPage = nativeBinding.searchEntryToPage
651
+ module.exports.searchExtractStructuredData = nativeBinding.searchExtractStructuredData
652
+ module.exports.searchReadMetaYaml = nativeBinding.searchReadMetaYaml
653
+ module.exports.shellAnnouncementBannerScript = nativeBinding.shellAnnouncementBannerScript
654
+ module.exports.shellBuildBannerInitScript = nativeBinding.shellBuildBannerInitScript
655
+ module.exports.shellBuildGlobPattern = nativeBinding.shellBuildGlobPattern
656
+ module.exports.shellBuildHeaders = nativeBinding.shellBuildHeaders
657
+ module.exports.shellBuildLicenseErrorMessage = nativeBinding.shellBuildLicenseErrorMessage
658
+ module.exports.shellBuildThemeInitScript = nativeBinding.shellBuildThemeInitScript
659
+ module.exports.shellCacheControl = nativeBinding.shellCacheControl
660
+ module.exports.shellCollectTailwindClassTokens = nativeBinding.shellCollectTailwindClassTokens
661
+ module.exports.shellComposeTailwindEntry = nativeBinding.shellComposeTailwindEntry
662
+ module.exports.shellExtractAnalyticsFromYaml = nativeBinding.shellExtractAnalyticsFromYaml
663
+ module.exports.shellExtractAnnouncementFromYaml = nativeBinding.shellExtractAnnouncementFromYaml
664
+ module.exports.shellExtractDocsConfigFromYaml = nativeBinding.shellExtractDocsConfigFromYaml
665
+ module.exports.shellExtractFontsFromYaml = nativeBinding.shellExtractFontsFromYaml
666
+ module.exports.shellExtractNavFromYaml = nativeBinding.shellExtractNavFromYaml
667
+ module.exports.shellExtractSiteFromYaml = nativeBinding.shellExtractSiteFromYaml
668
+ module.exports.shellExtractSnippetsFromYaml = nativeBinding.shellExtractSnippetsFromYaml
669
+ module.exports.shellExtractVarsFromYaml = nativeBinding.shellExtractVarsFromYaml
670
+ module.exports.shellGenerateId = nativeBinding.shellGenerateId
671
+ module.exports.shellLazyUpgradeScript = nativeBinding.shellLazyUpgradeScript
672
+ module.exports.shellListThemes = nativeBinding.shellListThemes
673
+ module.exports.shellNavActiveUpdateScript = nativeBinding.shellNavActiveUpdateScript
674
+ module.exports.shellOpenInAiScript = nativeBinding.shellOpenInAiScript
675
+ module.exports.shellPlanDefaultRoutes = nativeBinding.shellPlanDefaultRoutes
676
+ module.exports.shellPlanDocsSlug = nativeBinding.shellPlanDocsSlug
677
+ module.exports.shellPlanRehypePlugins = nativeBinding.shellPlanRehypePlugins
678
+ module.exports.shellPlanRemarkPlugins = nativeBinding.shellPlanRemarkPlugins
679
+ module.exports.shellRenderAnnouncementBanner = nativeBinding.shellRenderAnnouncementBanner
680
+ module.exports.shellRenderAside = nativeBinding.shellRenderAside
681
+ module.exports.shellRenderBadge = nativeBinding.shellRenderBadge
682
+ module.exports.shellRenderBaseLayout = nativeBinding.shellRenderBaseLayout
683
+ module.exports.shellRenderBlogIndex = nativeBinding.shellRenderBlogIndex
684
+ module.exports.shellRenderBlogSlug = nativeBinding.shellRenderBlogSlug
685
+ module.exports.shellRenderBreadcrumbs = nativeBinding.shellRenderBreadcrumbs
686
+ module.exports.shellRenderCard = nativeBinding.shellRenderCard
687
+ module.exports.shellRenderCardGrid = nativeBinding.shellRenderCardGrid
688
+ module.exports.shellRenderChangelogEntry = nativeBinding.shellRenderChangelogEntry
689
+ module.exports.shellRenderChangelogFooter = nativeBinding.shellRenderChangelogFooter
690
+ module.exports.shellRenderChangelogHeader = nativeBinding.shellRenderChangelogHeader
691
+ module.exports.shellRenderCodeGroup = nativeBinding.shellRenderCodeGroup
692
+ module.exports.shellRenderColumns = nativeBinding.shellRenderColumns
693
+ module.exports.shellRenderDocsLayout = nativeBinding.shellRenderDocsLayout
694
+ module.exports.shellRenderDocsSlug = nativeBinding.shellRenderDocsSlug
695
+ module.exports.shellRenderFileTree = nativeBinding.shellRenderFileTree
696
+ module.exports.shellRenderFileTreeNode = nativeBinding.shellRenderFileTreeNode
697
+ module.exports.shellRenderIcon = nativeBinding.shellRenderIcon
698
+ module.exports.shellRenderLastModified = nativeBinding.shellRenderLastModified
699
+ module.exports.shellRenderLinkButton = nativeBinding.shellRenderLinkButton
700
+ module.exports.shellRenderLinkCard = nativeBinding.shellRenderLinkCard
701
+ module.exports.shellRenderNotFound = nativeBinding.shellRenderNotFound
702
+ module.exports.shellRenderOpenInAi = nativeBinding.shellRenderOpenInAi
703
+ module.exports.shellRenderPackageInstall = nativeBinding.shellRenderPackageInstall
704
+ module.exports.shellRenderPanels = nativeBinding.shellRenderPanels
705
+ module.exports.shellRenderSearchButton = nativeBinding.shellRenderSearchButton
706
+ module.exports.shellRenderSidebar = nativeBinding.shellRenderSidebar
707
+ module.exports.shellRenderSkipLink = nativeBinding.shellRenderSkipLink
708
+ module.exports.shellRenderSteps = nativeBinding.shellRenderSteps
709
+ module.exports.shellRenderTableOfContents = nativeBinding.shellRenderTableOfContents
710
+ module.exports.shellRenderTabs = nativeBinding.shellRenderTabs
711
+ module.exports.shellRenderThemeToggle = nativeBinding.shellRenderThemeToggle
712
+ module.exports.shellRenderTile = nativeBinding.shellRenderTile
713
+ module.exports.shellRenderTileGrid = nativeBinding.shellRenderTileGrid
714
+ module.exports.shellRenderTopNav = nativeBinding.shellRenderTopNav
715
+ module.exports.shellRenderTopNavMobile = nativeBinding.shellRenderTopNavMobile
716
+ module.exports.shellRenderUpdateBadge = nativeBinding.shellRenderUpdateBadge
717
+ module.exports.shellRenderVersionSwitcher = nativeBinding.shellRenderVersionSwitcher
718
+ module.exports.shellResolvePrefetch = nativeBinding.shellResolvePrefetch
719
+ module.exports.shellResolveSnippetsConfig = nativeBinding.shellResolveSnippetsConfig
720
+ module.exports.shellRewriteHead = nativeBinding.shellRewriteHead
721
+ module.exports.shellRewriteModulepreload = nativeBinding.shellRewriteModulepreload
722
+ module.exports.shellSearchButtonScript = nativeBinding.shellSearchButtonScript
723
+ module.exports.shellSearchDialogCss = nativeBinding.shellSearchDialogCss
724
+ module.exports.shellSearchDialogInnerHtml = nativeBinding.shellSearchDialogInnerHtml
725
+ module.exports.shellSearchDialogScript = nativeBinding.shellSearchDialogScript
726
+ module.exports.shellSidebarHeightInitScript = nativeBinding.shellSidebarHeightInitScript
727
+ module.exports.shellSidebarScrollInitScript = nativeBinding.shellSidebarScrollInitScript
728
+ module.exports.shellTableOfContentsScript = nativeBinding.shellTableOfContentsScript
729
+ module.exports.tailwindComposeThemeCss = nativeBinding.tailwindComposeThemeCss
730
+ module.exports.tailwindReadPresetCss = nativeBinding.tailwindReadPresetCss
731
+ module.exports.tailwindResolveTheme = nativeBinding.tailwindResolveTheme
732
+ module.exports.verifyLicense = nativeBinding.verifyLicense