@rspack/binding 1.4.9 → 1.4.11
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/binding.js +357 -193
- package/napi-binding.d.ts +12 -14
- package/package.json +12 -12
package/binding.js
CHANGED
|
@@ -1,229 +1,393 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
3
5
|
|
|
4
|
-
const {
|
|
6
|
+
const { createRequire } = require('node:module')
|
|
7
|
+
require = createRequire(__filename)
|
|
5
8
|
|
|
9
|
+
const { readFileSync } = require('node:fs')
|
|
6
10
|
let nativeBinding = null
|
|
7
|
-
|
|
8
|
-
let loadError = null
|
|
11
|
+
const loadErrors = []
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
}
|
|
13
35
|
}
|
|
14
36
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
case 'arm':
|
|
31
|
-
localFileExisted = existsSync(join(__dirname, 'rspack.android-arm-eabi.node'))
|
|
32
|
-
try {
|
|
33
|
-
if (localFileExisted) {
|
|
34
|
-
nativeBinding = require('./rspack.android-arm-eabi.node')
|
|
35
|
-
} else {
|
|
36
|
-
nativeBinding = require('@rspack/binding-android-arm-eabi')
|
|
37
|
-
}
|
|
38
|
-
} catch (e) {
|
|
39
|
-
loadError = e
|
|
40
|
-
}
|
|
41
|
-
break
|
|
42
|
-
default:
|
|
43
|
-
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
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
|
|
44
52
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
nativeBinding = require('./rspack.win32-ia32-msvc.node')
|
|
65
|
-
} else {
|
|
66
|
-
nativeBinding = require('@rspack/binding-win32-ia32-msvc')
|
|
67
|
-
}
|
|
68
|
-
} catch (e) {
|
|
69
|
-
loadError = e
|
|
70
|
-
}
|
|
71
|
-
break
|
|
72
|
-
case 'arm64':
|
|
73
|
-
localFileExisted = existsSync(join(__dirname, 'rspack.win32-arm64-msvc.node'))
|
|
74
|
-
try {
|
|
75
|
-
if (localFileExisted) {
|
|
76
|
-
nativeBinding = require('./rspack.win32-arm64-msvc.node')
|
|
77
|
-
} else {
|
|
78
|
-
nativeBinding = require('@rspack/binding-win32-arm64-msvc')
|
|
79
|
-
}
|
|
80
|
-
} catch (e) {
|
|
81
|
-
loadError = e
|
|
82
|
-
}
|
|
83
|
-
break
|
|
84
|
-
default:
|
|
85
|
-
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
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)
|
|
86
72
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
break
|
|
114
|
-
default:
|
|
115
|
-
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
73
|
+
} else if (process.platform === 'android') {
|
|
74
|
+
if (process.arch === 'arm64') {
|
|
75
|
+
try {
|
|
76
|
+
return require('./rspack.android-arm64.node')
|
|
77
|
+
} catch (e) {
|
|
78
|
+
loadErrors.push(e)
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
return require('@rspack/binding-android-arm64')
|
|
82
|
+
} catch (e) {
|
|
83
|
+
loadErrors.push(e)
|
|
84
|
+
}
|
|
85
|
+
} else if (process.arch === 'arm') {
|
|
86
|
+
try {
|
|
87
|
+
return require('./rspack.android-arm-eabi.node')
|
|
88
|
+
} catch (e) {
|
|
89
|
+
loadErrors.push(e)
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
return require('@rspack/binding-android-arm-eabi')
|
|
93
|
+
} catch (e) {
|
|
94
|
+
loadErrors.push(e)
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
116
98
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
99
|
+
} else if (process.platform === 'win32') {
|
|
100
|
+
if (process.arch === 'x64') {
|
|
101
|
+
try {
|
|
102
|
+
return require('./rspack.win32-x64-msvc.node')
|
|
103
|
+
} catch (e) {
|
|
104
|
+
loadErrors.push(e)
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
return require('@rspack/binding-win32-x64-msvc')
|
|
108
|
+
} catch (e) {
|
|
109
|
+
loadErrors.push(e)
|
|
110
|
+
}
|
|
111
|
+
} else if (process.arch === 'ia32') {
|
|
112
|
+
try {
|
|
113
|
+
return require('./rspack.win32-ia32-msvc.node')
|
|
114
|
+
} catch (e) {
|
|
115
|
+
loadErrors.push(e)
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
return require('@rspack/binding-win32-ia32-msvc')
|
|
119
|
+
} catch (e) {
|
|
120
|
+
loadErrors.push(e)
|
|
121
|
+
}
|
|
122
|
+
} else if (process.arch === 'arm64') {
|
|
123
|
+
try {
|
|
124
|
+
return require('./rspack.win32-arm64-msvc.node')
|
|
125
|
+
} catch (e) {
|
|
126
|
+
loadErrors.push(e)
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
return require('@rspack/binding-win32-arm64-msvc')
|
|
130
|
+
} catch (e) {
|
|
131
|
+
loadErrors.push(e)
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
135
|
+
}
|
|
136
|
+
} else if (process.platform === 'darwin') {
|
|
137
|
+
try {
|
|
138
|
+
return require('./rspack.darwin-universal.node')
|
|
139
|
+
} catch (e) {
|
|
140
|
+
loadErrors.push(e)
|
|
121
141
|
}
|
|
122
|
-
localFileExisted = existsSync(join(__dirname, 'rspack.freebsd-x64.node'))
|
|
123
142
|
try {
|
|
124
|
-
|
|
125
|
-
|
|
143
|
+
return require('@rspack/binding-darwin-universal')
|
|
144
|
+
} catch (e) {
|
|
145
|
+
loadErrors.push(e)
|
|
146
|
+
}
|
|
147
|
+
if (process.arch === 'x64') {
|
|
148
|
+
try {
|
|
149
|
+
return require('./rspack.darwin-x64.node')
|
|
150
|
+
} catch (e) {
|
|
151
|
+
loadErrors.push(e)
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
return require('@rspack/binding-darwin-x64')
|
|
155
|
+
} catch (e) {
|
|
156
|
+
loadErrors.push(e)
|
|
157
|
+
}
|
|
158
|
+
} else if (process.arch === 'arm64') {
|
|
159
|
+
try {
|
|
160
|
+
return require('./rspack.darwin-arm64.node')
|
|
161
|
+
} catch (e) {
|
|
162
|
+
loadErrors.push(e)
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
return require('@rspack/binding-darwin-arm64')
|
|
166
|
+
} catch (e) {
|
|
167
|
+
loadErrors.push(e)
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
171
|
+
}
|
|
172
|
+
} else if (process.platform === 'freebsd') {
|
|
173
|
+
if (process.arch === 'x64') {
|
|
174
|
+
try {
|
|
175
|
+
return require('./rspack.freebsd-x64.node')
|
|
176
|
+
} catch (e) {
|
|
177
|
+
loadErrors.push(e)
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
return require('@rspack/binding-freebsd-x64')
|
|
181
|
+
} catch (e) {
|
|
182
|
+
loadErrors.push(e)
|
|
183
|
+
}
|
|
184
|
+
} else if (process.arch === 'arm64') {
|
|
185
|
+
try {
|
|
186
|
+
return require('./rspack.freebsd-arm64.node')
|
|
187
|
+
} catch (e) {
|
|
188
|
+
loadErrors.push(e)
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
return require('@rspack/binding-freebsd-arm64')
|
|
192
|
+
} catch (e) {
|
|
193
|
+
loadErrors.push(e)
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
197
|
+
}
|
|
198
|
+
} else if (process.platform === 'linux') {
|
|
199
|
+
if (process.arch === 'x64') {
|
|
200
|
+
if (isMusl()) {
|
|
201
|
+
try {
|
|
202
|
+
return require('./rspack.linux-x64-musl.node')
|
|
203
|
+
} catch (e) {
|
|
204
|
+
loadErrors.push(e)
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
return require('@rspack/binding-linux-x64-musl')
|
|
208
|
+
} catch (e) {
|
|
209
|
+
loadErrors.push(e)
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
try {
|
|
213
|
+
return require('./rspack.linux-x64-gnu.node')
|
|
214
|
+
} catch (e) {
|
|
215
|
+
loadErrors.push(e)
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
return require('@rspack/binding-linux-x64-gnu')
|
|
219
|
+
} catch (e) {
|
|
220
|
+
loadErrors.push(e)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
} else if (process.arch === 'arm64') {
|
|
224
|
+
if (isMusl()) {
|
|
225
|
+
try {
|
|
226
|
+
return require('./rspack.linux-arm64-musl.node')
|
|
227
|
+
} catch (e) {
|
|
228
|
+
loadErrors.push(e)
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
return require('@rspack/binding-linux-arm64-musl')
|
|
232
|
+
} catch (e) {
|
|
233
|
+
loadErrors.push(e)
|
|
234
|
+
}
|
|
126
235
|
} else {
|
|
127
|
-
|
|
236
|
+
try {
|
|
237
|
+
return require('./rspack.linux-arm64-gnu.node')
|
|
238
|
+
} catch (e) {
|
|
239
|
+
loadErrors.push(e)
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
return require('@rspack/binding-linux-arm64-gnu')
|
|
243
|
+
} catch (e) {
|
|
244
|
+
loadErrors.push(e)
|
|
245
|
+
}
|
|
128
246
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
247
|
+
} else if (process.arch === 'arm') {
|
|
248
|
+
if (isMusl()) {
|
|
249
|
+
try {
|
|
250
|
+
return require('./rspack.linux-arm-musleabihf.node')
|
|
251
|
+
} catch (e) {
|
|
252
|
+
loadErrors.push(e)
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
return require('@rspack/binding-linux-arm-musleabihf')
|
|
256
|
+
} catch (e) {
|
|
257
|
+
loadErrors.push(e)
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
try {
|
|
261
|
+
return require('./rspack.linux-arm-gnueabihf.node')
|
|
262
|
+
} catch (e) {
|
|
263
|
+
loadErrors.push(e)
|
|
264
|
+
}
|
|
265
|
+
try {
|
|
266
|
+
return require('@rspack/binding-linux-arm-gnueabihf')
|
|
267
|
+
} catch (e) {
|
|
268
|
+
loadErrors.push(e)
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
} else if (process.arch === 'riscv64') {
|
|
272
|
+
if (isMusl()) {
|
|
273
|
+
try {
|
|
274
|
+
return require('./rspack.linux-riscv64-musl.node')
|
|
275
|
+
} catch (e) {
|
|
276
|
+
loadErrors.push(e)
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
return require('@rspack/binding-linux-riscv64-musl')
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e)
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
try {
|
|
285
|
+
return require('./rspack.linux-riscv64-gnu.node')
|
|
286
|
+
} catch (e) {
|
|
287
|
+
loadErrors.push(e)
|
|
288
|
+
}
|
|
289
|
+
try {
|
|
290
|
+
return require('@rspack/binding-linux-riscv64-gnu')
|
|
291
|
+
} catch (e) {
|
|
292
|
+
loadErrors.push(e)
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
} else if (process.arch === 'ppc64') {
|
|
296
|
+
try {
|
|
297
|
+
return require('./rspack.linux-ppc64-gnu.node')
|
|
298
|
+
} catch (e) {
|
|
299
|
+
loadErrors.push(e)
|
|
300
|
+
}
|
|
301
|
+
try {
|
|
302
|
+
return require('@rspack/binding-linux-ppc64-gnu')
|
|
303
|
+
} catch (e) {
|
|
304
|
+
loadErrors.push(e)
|
|
305
|
+
}
|
|
306
|
+
} else if (process.arch === 's390x') {
|
|
307
|
+
try {
|
|
308
|
+
return require('./rspack.linux-s390x-gnu.node')
|
|
309
|
+
} catch (e) {
|
|
310
|
+
loadErrors.push(e)
|
|
311
|
+
}
|
|
312
|
+
try {
|
|
313
|
+
return require('@rspack/binding-linux-s390x-gnu')
|
|
314
|
+
} catch (e) {
|
|
315
|
+
loadErrors.push(e)
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
131
319
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
} catch (e) {
|
|
170
|
-
loadError = e
|
|
171
|
-
}
|
|
172
|
-
} else {
|
|
173
|
-
localFileExisted = existsSync(join(__dirname, 'rspack.linux-arm64-gnu.node'))
|
|
174
|
-
try {
|
|
175
|
-
if (localFileExisted) {
|
|
176
|
-
nativeBinding = require('./rspack.linux-arm64-gnu.node')
|
|
177
|
-
} else {
|
|
178
|
-
nativeBinding = require('@rspack/binding-linux-arm64-gnu')
|
|
179
|
-
}
|
|
180
|
-
} catch (e) {
|
|
181
|
-
loadError = e
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
break
|
|
185
|
-
case 'arm':
|
|
186
|
-
localFileExisted = existsSync(join(__dirname, 'rspack.linux-arm-gnueabihf.node'))
|
|
187
|
-
try {
|
|
188
|
-
if (localFileExisted) {
|
|
189
|
-
nativeBinding = require('./rspack.linux-arm-gnueabihf.node')
|
|
190
|
-
} else {
|
|
191
|
-
nativeBinding = require('@rspack/binding-linux-arm-gnueabihf')
|
|
192
|
-
}
|
|
193
|
-
} catch (e) {
|
|
194
|
-
loadError = e
|
|
195
|
-
}
|
|
196
|
-
break
|
|
197
|
-
default:
|
|
198
|
-
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
320
|
+
} else if (process.platform === 'openharmony') {
|
|
321
|
+
if (process.arch === 'arm64') {
|
|
322
|
+
try {
|
|
323
|
+
return require('./rspack.linux-arm64-ohos.node')
|
|
324
|
+
} catch (e) {
|
|
325
|
+
loadErrors.push(e)
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
return require('@rspack/binding-linux-arm64-ohos')
|
|
329
|
+
} catch (e) {
|
|
330
|
+
loadErrors.push(e)
|
|
331
|
+
}
|
|
332
|
+
} else if (process.arch === 'x64') {
|
|
333
|
+
try {
|
|
334
|
+
return require('./rspack.linux-x64-ohos.node')
|
|
335
|
+
} catch (e) {
|
|
336
|
+
loadErrors.push(e)
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
return require('@rspack/binding-linux-x64-ohos')
|
|
340
|
+
} catch (e) {
|
|
341
|
+
loadErrors.push(e)
|
|
342
|
+
}
|
|
343
|
+
} else if (process.arch === 'arm') {
|
|
344
|
+
try {
|
|
345
|
+
return require('./rspack.linux-arm-ohos.node')
|
|
346
|
+
} catch (e) {
|
|
347
|
+
loadErrors.push(e)
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
return require('@rspack/binding-linux-arm-ohos')
|
|
351
|
+
} catch (e) {
|
|
352
|
+
loadErrors.push(e)
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
|
199
356
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
357
|
+
} else {
|
|
358
|
+
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
|
359
|
+
}
|
|
203
360
|
}
|
|
204
361
|
|
|
362
|
+
nativeBinding = requireNative()
|
|
363
|
+
|
|
205
364
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
206
365
|
try {
|
|
207
366
|
nativeBinding = require('./rspack.wasi.cjs')
|
|
208
|
-
} catch (
|
|
367
|
+
} catch (err) {
|
|
209
368
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
210
|
-
|
|
369
|
+
loadErrors.push(err)
|
|
211
370
|
}
|
|
212
371
|
}
|
|
213
372
|
if (!nativeBinding) {
|
|
214
373
|
try {
|
|
215
374
|
nativeBinding = require('@rspack/binding-wasm32-wasi')
|
|
216
|
-
} catch (
|
|
375
|
+
} catch (err) {
|
|
217
376
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
218
|
-
|
|
377
|
+
loadErrors.push(err)
|
|
219
378
|
}
|
|
220
379
|
}
|
|
221
380
|
}
|
|
222
381
|
}
|
|
223
382
|
|
|
224
383
|
if (!nativeBinding) {
|
|
225
|
-
if (
|
|
226
|
-
throw
|
|
384
|
+
if (loadErrors.length > 0) {
|
|
385
|
+
throw new Error(
|
|
386
|
+
`Cannot find native binding. ` +
|
|
387
|
+
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
388
|
+
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
389
|
+
{ cause: loadErrors }
|
|
390
|
+
)
|
|
227
391
|
}
|
|
228
392
|
throw new Error(`Failed to load native binding`)
|
|
229
393
|
}
|
package/napi-binding.d.ts
CHANGED
|
@@ -615,17 +615,6 @@ export interface JsAfterEmitData {
|
|
|
615
615
|
uid?: number
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
-
export interface JsAfterResolveData {
|
|
619
|
-
request: string
|
|
620
|
-
context: string
|
|
621
|
-
issuer: string
|
|
622
|
-
issuerLayer?: string
|
|
623
|
-
fileDependencies: Array<string>
|
|
624
|
-
contextDependencies: Array<string>
|
|
625
|
-
missingDependencies: Array<string>
|
|
626
|
-
createData?: JsCreateData
|
|
627
|
-
}
|
|
628
|
-
|
|
629
618
|
export interface JsAfterTemplateExecutionData {
|
|
630
619
|
html: string
|
|
631
620
|
headTags: Array<JsHtmlPluginTag>
|
|
@@ -1157,6 +1146,11 @@ export interface JsRsdoctorSideEffect {
|
|
|
1157
1146
|
variable?: number
|
|
1158
1147
|
}
|
|
1159
1148
|
|
|
1149
|
+
export interface JsRsdoctorSourceMapFeatures {
|
|
1150
|
+
cheap?: boolean
|
|
1151
|
+
module?: boolean
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1160
1154
|
export interface JsRsdoctorSourcePosition {
|
|
1161
1155
|
line?: number
|
|
1162
1156
|
column?: number
|
|
@@ -1510,8 +1504,11 @@ export interface NativeWatcherOptions {
|
|
|
1510
1504
|
followSymlinks?: boolean
|
|
1511
1505
|
pollInterval?: number
|
|
1512
1506
|
aggregateTimeout?: number
|
|
1513
|
-
/**
|
|
1514
|
-
|
|
1507
|
+
/**
|
|
1508
|
+
* The ignored paths for the watcher.
|
|
1509
|
+
* It can be a single path, an array of paths, or a regular expression.
|
|
1510
|
+
*/
|
|
1511
|
+
ignored?: string | string[] | RegExp
|
|
1515
1512
|
}
|
|
1516
1513
|
|
|
1517
1514
|
export interface NodeFsStats {
|
|
@@ -2500,6 +2497,7 @@ export interface RawResolveTsconfigOptions {
|
|
|
2500
2497
|
export interface RawRsdoctorPluginOptions {
|
|
2501
2498
|
moduleGraphFeatures: boolean | Array<'graph' | 'ids' | 'sources'>
|
|
2502
2499
|
chunkGraphFeatures: boolean | Array<'graph' | 'assets'>
|
|
2500
|
+
sourceMapFeatures?: { module?: boolean; cheap?: boolean } | undefined
|
|
2503
2501
|
}
|
|
2504
2502
|
|
|
2505
2503
|
export interface RawRslibPluginOptions {
|
|
@@ -2734,7 +2732,7 @@ export interface RegisterJsTaps {
|
|
|
2734
2732
|
registerNormalModuleFactoryFactorizeTaps: (stages: Array<number>) => Array<{ function: ((arg: JsFactorizeArgs) => Promise<JsFactorizeArgs>); stage: number; }>
|
|
2735
2733
|
registerNormalModuleFactoryResolveTaps: (stages: Array<number>) => Array<{ function: ((arg: JsResolveArgs) => Promise<JsResolveArgs>); stage: number; }>
|
|
2736
2734
|
registerNormalModuleFactoryResolveForSchemeTaps: (stages: Array<number>) => Array<{ function: ((arg: JsResolveForSchemeArgs) => Promise<[boolean | undefined, JsResolveForSchemeArgs]>); stage: number; }>
|
|
2737
|
-
registerNormalModuleFactoryAfterResolveTaps: (stages: Array<number>) => Array<{ function: ((arg:
|
|
2735
|
+
registerNormalModuleFactoryAfterResolveTaps: (stages: Array<number>) => Array<{ function: ((arg: string) => Promise<[boolean | undefined, JsCreateData | undefined]>); stage: number; }>
|
|
2738
2736
|
registerNormalModuleFactoryCreateModuleTaps: (stages: Array<number>) => Array<{ function: ((arg: JsNormalModuleFactoryCreateModuleArgs) => Promise<void>); stage: number; }>
|
|
2739
2737
|
registerContextModuleFactoryBeforeResolveTaps: (stages: Array<number>) => Array<{ function: ((arg: false | JsContextModuleFactoryBeforeResolveData) => Promise<false | JsContextModuleFactoryBeforeResolveData>); stage: number; }>
|
|
2740
2738
|
registerContextModuleFactoryAfterResolveTaps: (stages: Array<number>) => Array<{ function: ((arg: false | JsContextModuleFactoryAfterResolveData) => Promise<false | JsContextModuleFactoryAfterResolveData>); stage: number; }>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/binding",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Node binding for rspack",
|
|
6
6
|
"main": "binding.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
19
19
|
"repository": "web-infra-dev/rspack",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@napi-rs/cli": "3.0.
|
|
21
|
+
"@napi-rs/cli": "3.0.4",
|
|
22
22
|
"@napi-rs/wasm-runtime": "^1.0.1",
|
|
23
23
|
"emnapi": "^1.4.5",
|
|
24
24
|
"typescript": "^5.8.3"
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
|
-
"@rspack/binding-darwin-arm64": "1.4.
|
|
54
|
-
"@rspack/binding-win32-arm64-msvc": "1.4.
|
|
55
|
-
"@rspack/binding-linux-arm64-
|
|
56
|
-
"@rspack/binding-linux-arm64-
|
|
57
|
-
"@rspack/binding-win32-ia32-msvc": "1.4.
|
|
58
|
-
"@rspack/binding-
|
|
59
|
-
"@rspack/binding-
|
|
60
|
-
"@rspack/binding-linux-x64-musl": "1.4.
|
|
61
|
-
"@rspack/binding-
|
|
62
|
-
"@rspack/binding-
|
|
53
|
+
"@rspack/binding-darwin-arm64": "1.4.11",
|
|
54
|
+
"@rspack/binding-win32-arm64-msvc": "1.4.11",
|
|
55
|
+
"@rspack/binding-linux-arm64-musl": "1.4.11",
|
|
56
|
+
"@rspack/binding-linux-arm64-gnu": "1.4.11",
|
|
57
|
+
"@rspack/binding-win32-ia32-msvc": "1.4.11",
|
|
58
|
+
"@rspack/binding-darwin-x64": "1.4.11",
|
|
59
|
+
"@rspack/binding-wasm32-wasi": "1.4.11",
|
|
60
|
+
"@rspack/binding-linux-x64-musl": "1.4.11",
|
|
61
|
+
"@rspack/binding-linux-x64-gnu": "1.4.11",
|
|
62
|
+
"@rspack/binding-win32-x64-msvc": "1.4.11"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build:dev": "node scripts/build.js",
|