nx 19.2.0-alpha.0 → 19.2.0-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +12 -12
- package/src/native/index.js +72 -372
- package/src/native/nx.wasi.cjs +139 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.2.0-alpha.
|
3
|
+
"version": "19.2.0-alpha.2",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"yargs-parser": "21.1.1",
|
71
71
|
"node-machine-id": "1.1.12",
|
72
72
|
"ora": "5.3.0",
|
73
|
-
"@nrwl/tao": "19.2.0-alpha.
|
73
|
+
"@nrwl/tao": "19.2.0-alpha.2"
|
74
74
|
},
|
75
75
|
"peerDependencies": {
|
76
76
|
"@swc-node/register": "^1.8.0",
|
@@ -85,16 +85,16 @@
|
|
85
85
|
}
|
86
86
|
},
|
87
87
|
"optionalDependencies": {
|
88
|
-
"@nx/nx-darwin-x64": "19.2.0-alpha.
|
89
|
-
"@nx/nx-darwin-arm64": "19.2.0-alpha.
|
90
|
-
"@nx/nx-linux-x64-gnu": "19.2.0-alpha.
|
91
|
-
"@nx/nx-linux-x64-musl": "19.2.0-alpha.
|
92
|
-
"@nx/nx-win32-x64-msvc": "19.2.0-alpha.
|
93
|
-
"@nx/nx-linux-arm64-gnu": "19.2.0-alpha.
|
94
|
-
"@nx/nx-linux-arm64-musl": "19.2.0-alpha.
|
95
|
-
"@nx/nx-linux-arm-gnueabihf": "19.2.0-alpha.
|
96
|
-
"@nx/nx-win32-arm64-msvc": "19.2.0-alpha.
|
97
|
-
"@nx/nx-freebsd-x64": "19.2.0-alpha.
|
88
|
+
"@nx/nx-darwin-x64": "19.2.0-alpha.2",
|
89
|
+
"@nx/nx-darwin-arm64": "19.2.0-alpha.2",
|
90
|
+
"@nx/nx-linux-x64-gnu": "19.2.0-alpha.2",
|
91
|
+
"@nx/nx-linux-x64-musl": "19.2.0-alpha.2",
|
92
|
+
"@nx/nx-win32-x64-msvc": "19.2.0-alpha.2",
|
93
|
+
"@nx/nx-linux-arm64-gnu": "19.2.0-alpha.2",
|
94
|
+
"@nx/nx-linux-arm64-musl": "19.2.0-alpha.2",
|
95
|
+
"@nx/nx-linux-arm-gnueabihf": "19.2.0-alpha.2",
|
96
|
+
"@nx/nx-win32-arm64-msvc": "19.2.0-alpha.2",
|
97
|
+
"@nx/nx-freebsd-x64": "19.2.0-alpha.2"
|
98
98
|
},
|
99
99
|
"nx-migrations": {
|
100
100
|
"migrations": "./migrations.json",
|
package/src/native/index.js
CHANGED
@@ -1,378 +1,78 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
const
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
1
|
+
const { join, basename } = require('path');
|
2
|
+
const { copyFileSync, existsSync, mkdirSync } = require('fs');
|
3
|
+
const Module = require('module');
|
4
|
+
const { nxVersion } = require('../utils/versions');
|
5
|
+
const { getNativeFileCacheLocation } = require('./native-file-cache-location');
|
6
|
+
|
7
|
+
const nxPackages = new Set([
|
8
|
+
'@nx/nx-android-arm64',
|
9
|
+
'@nx/nx-android-arm-eabi',
|
10
|
+
'@nx/nx-win32-x64-msvc',
|
11
|
+
'@nx/nx-win32-ia32-msvc',
|
12
|
+
'@nx/nx-win32-arm64-msvc',
|
13
|
+
'@nx/nx-darwin-universal',
|
14
|
+
'@nx/nx-darwin-x64',
|
15
|
+
'@nx/nx-darwin-arm64',
|
16
|
+
'@nx/nx-freebsd-x64',
|
17
|
+
'@nx/nx-linux-x64-musl',
|
18
|
+
'@nx/nx-linux-x64-gnu',
|
19
|
+
'@nx/nx-linux-arm64-musl',
|
20
|
+
'@nx/nx-linux-arm64-gnu',
|
21
|
+
'@nx/nx-linux-arm-gnueabihf',
|
22
|
+
]);
|
23
|
+
|
24
|
+
const localNodeFiles = [
|
25
|
+
'nx.android-arm64.node',
|
26
|
+
'nx.android-arm-eabi.node',
|
27
|
+
'nx.win32-x64-msvc.node',
|
28
|
+
'nx.win32-ia32-msvc.node',
|
29
|
+
'nx.win32-arm64-msvc.node',
|
30
|
+
'nx.darwin-universal.node',
|
31
|
+
'nx.darwin-x64.node',
|
32
|
+
'nx.darwin-arm64.node',
|
33
|
+
'nx.freebsd-x64.node',
|
34
|
+
'nx.linux-x64-musl.node',
|
35
|
+
'nx.linux-x64-gnu.node',
|
36
|
+
'nx.linux-arm64-musl.node',
|
37
|
+
'nx.linux-arm64-gnu.node',
|
38
|
+
'nx.linux-arm-gnueabihf.node',
|
39
|
+
];
|
40
|
+
|
41
|
+
const originalLoad = Module._load;
|
42
|
+
|
43
|
+
// We override the _load function so that when a native file is required,
|
44
|
+
// we copy it to a cache directory and require it from there.
|
45
|
+
// This prevents the file being loaded from node_modules and causing file locking issues.
|
46
|
+
// Will only be called once because the require cache takes over afterwards.
|
47
|
+
Module._load = function (request, parent, isMain) {
|
48
|
+
const modulePath = request;
|
49
|
+
if (
|
50
|
+
nxPackages.has(modulePath) ||
|
51
|
+
localNodeFiles.some((f) => modulePath.endsWith(f))
|
52
|
+
) {
|
53
|
+
const nativeLocation = require.resolve(modulePath);
|
54
|
+
const fileName = basename(nativeLocation);
|
55
|
+
|
56
|
+
// we copy the file to a workspace-scoped tmp directory and prefix with nxVersion to avoid stale files being loaded
|
57
|
+
const nativeFileCacheLocation = getNativeFileCacheLocation();
|
58
|
+
const tmpFile = join(nativeFileCacheLocation, nxVersion + '-' + fileName);
|
59
|
+
if (existsSync(tmpFile)) {
|
60
|
+
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
45
61
|
}
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
|
50
|
-
const isMuslFromChildProcess = () => {
|
51
|
-
try {
|
52
|
-
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
53
|
-
} catch (e) {
|
54
|
-
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
55
|
-
return false
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
function requireNative() {
|
60
|
-
if (process.platform === 'android') {
|
61
|
-
if (process.arch === 'arm64') {
|
62
|
-
try {
|
63
|
-
return require('./nx.android-arm64.node')
|
64
|
-
} catch (e) {
|
65
|
-
loadErrors.push(e)
|
66
|
-
}
|
67
|
-
try {
|
68
|
-
return require('@nx/nx-android-arm64')
|
69
|
-
} catch (e) {
|
70
|
-
loadErrors.push(e)
|
71
|
-
}
|
72
|
-
|
73
|
-
} else if (process.arch === 'arm') {
|
74
|
-
try {
|
75
|
-
return require('./nx.android-arm-eabi.node')
|
76
|
-
} catch (e) {
|
77
|
-
loadErrors.push(e)
|
78
|
-
}
|
79
|
-
try {
|
80
|
-
return require('@nx/nx-android-arm-eabi')
|
81
|
-
} catch (e) {
|
82
|
-
loadErrors.push(e)
|
83
|
-
}
|
84
|
-
|
85
|
-
} else {
|
86
|
-
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
87
|
-
}
|
88
|
-
} else if (process.platform === 'win32') {
|
89
|
-
if (process.arch === 'x64') {
|
90
|
-
try {
|
91
|
-
return require('./nx.win32-x64-msvc.node')
|
92
|
-
} catch (e) {
|
93
|
-
loadErrors.push(e)
|
94
|
-
}
|
95
|
-
try {
|
96
|
-
return require('@nx/nx-win32-x64-msvc')
|
97
|
-
} catch (e) {
|
98
|
-
loadErrors.push(e)
|
99
|
-
}
|
100
|
-
|
101
|
-
} else if (process.arch === 'ia32') {
|
102
|
-
try {
|
103
|
-
return require('./nx.win32-ia32-msvc.node')
|
104
|
-
} catch (e) {
|
105
|
-
loadErrors.push(e)
|
106
|
-
}
|
107
|
-
try {
|
108
|
-
return require('@nx/nx-win32-ia32-msvc')
|
109
|
-
} catch (e) {
|
110
|
-
loadErrors.push(e)
|
111
|
-
}
|
112
|
-
|
113
|
-
} else if (process.arch === 'arm64') {
|
114
|
-
try {
|
115
|
-
return require('./nx.win32-arm64-msvc.node')
|
116
|
-
} catch (e) {
|
117
|
-
loadErrors.push(e)
|
118
|
-
}
|
119
|
-
try {
|
120
|
-
return require('@nx/nx-win32-arm64-msvc')
|
121
|
-
} catch (e) {
|
122
|
-
loadErrors.push(e)
|
123
|
-
}
|
124
|
-
|
125
|
-
} else {
|
126
|
-
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
127
|
-
}
|
128
|
-
} else if (process.platform === 'darwin') {
|
129
|
-
try {
|
130
|
-
return require('./nx.darwin-universal.node')
|
131
|
-
} catch (e) {
|
132
|
-
loadErrors.push(e)
|
133
|
-
}
|
134
|
-
try {
|
135
|
-
return require('@nx/nx-darwin-universal')
|
136
|
-
} catch (e) {
|
137
|
-
loadErrors.push(e)
|
138
|
-
}
|
139
|
-
|
140
|
-
if (process.arch === 'x64') {
|
141
|
-
try {
|
142
|
-
return require('./nx.darwin-x64.node')
|
143
|
-
} catch (e) {
|
144
|
-
loadErrors.push(e)
|
145
|
-
}
|
146
|
-
try {
|
147
|
-
return require('@nx/nx-darwin-x64')
|
148
|
-
} catch (e) {
|
149
|
-
loadErrors.push(e)
|
150
|
-
}
|
151
|
-
|
152
|
-
} else if (process.arch === 'arm64') {
|
153
|
-
try {
|
154
|
-
return require('./nx.darwin-arm64.node')
|
155
|
-
} catch (e) {
|
156
|
-
loadErrors.push(e)
|
157
|
-
}
|
158
|
-
try {
|
159
|
-
return require('@nx/nx-darwin-arm64')
|
160
|
-
} catch (e) {
|
161
|
-
loadErrors.push(e)
|
162
|
-
}
|
163
|
-
|
164
|
-
} else {
|
165
|
-
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
166
|
-
}
|
167
|
-
} else if (process.platform === 'freebsd') {
|
168
|
-
if (process.arch === 'x64') {
|
169
|
-
try {
|
170
|
-
return require('./nx.freebsd-x64.node')
|
171
|
-
} catch (e) {
|
172
|
-
loadErrors.push(e)
|
173
|
-
}
|
174
|
-
try {
|
175
|
-
return require('@nx/nx-freebsd-x64')
|
176
|
-
} catch (e) {
|
177
|
-
loadErrors.push(e)
|
178
|
-
}
|
179
|
-
|
180
|
-
} else if (process.arch === 'arm64') {
|
181
|
-
try {
|
182
|
-
return require('./nx.freebsd-arm64.node')
|
183
|
-
} catch (e) {
|
184
|
-
loadErrors.push(e)
|
185
|
-
}
|
186
|
-
try {
|
187
|
-
return require('@nx/nx-freebsd-arm64')
|
188
|
-
} catch (e) {
|
189
|
-
loadErrors.push(e)
|
190
|
-
}
|
191
|
-
|
192
|
-
} else {
|
193
|
-
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
194
|
-
}
|
195
|
-
} else if (process.platform === 'linux') {
|
196
|
-
if (process.arch === 'x64') {
|
197
|
-
if (isMusl()) {
|
198
|
-
try {
|
199
|
-
return require('./nx.linux-x64-musl.node')
|
200
|
-
} catch (e) {
|
201
|
-
loadErrors.push(e)
|
202
|
-
}
|
203
|
-
try {
|
204
|
-
return require('@nx/nx-linux-x64-musl')
|
205
|
-
} catch (e) {
|
206
|
-
loadErrors.push(e)
|
207
|
-
}
|
208
|
-
|
209
|
-
} else {
|
210
|
-
try {
|
211
|
-
return require('./nx.linux-x64-gnu.node')
|
212
|
-
} catch (e) {
|
213
|
-
loadErrors.push(e)
|
214
|
-
}
|
215
|
-
try {
|
216
|
-
return require('@nx/nx-linux-x64-gnu')
|
217
|
-
} catch (e) {
|
218
|
-
loadErrors.push(e)
|
219
|
-
}
|
220
|
-
|
221
|
-
}
|
222
|
-
} else if (process.arch === 'arm64') {
|
223
|
-
if (isMusl()) {
|
224
|
-
try {
|
225
|
-
return require('./nx.linux-arm64-musl.node')
|
226
|
-
} catch (e) {
|
227
|
-
loadErrors.push(e)
|
228
|
-
}
|
229
|
-
try {
|
230
|
-
return require('@nx/nx-linux-arm64-musl')
|
231
|
-
} catch (e) {
|
232
|
-
loadErrors.push(e)
|
233
|
-
}
|
234
|
-
|
235
|
-
} else {
|
236
|
-
try {
|
237
|
-
return require('./nx.linux-arm64-gnu.node')
|
238
|
-
} catch (e) {
|
239
|
-
loadErrors.push(e)
|
240
|
-
}
|
241
|
-
try {
|
242
|
-
return require('@nx/nx-linux-arm64-gnu')
|
243
|
-
} catch (e) {
|
244
|
-
loadErrors.push(e)
|
245
|
-
}
|
246
|
-
|
247
|
-
}
|
248
|
-
} else if (process.arch === 'arm') {
|
249
|
-
if (isMusl()) {
|
250
|
-
try {
|
251
|
-
return require('./nx.linux-arm-musleabihf.node')
|
252
|
-
} catch (e) {
|
253
|
-
loadErrors.push(e)
|
254
|
-
}
|
255
|
-
try {
|
256
|
-
return require('@nx/nx-linux-arm-musleabihf')
|
257
|
-
} catch (e) {
|
258
|
-
loadErrors.push(e)
|
259
|
-
}
|
260
|
-
|
261
|
-
} else {
|
262
|
-
try {
|
263
|
-
return require('./nx.linux-arm-gnueabihf.node')
|
264
|
-
} catch (e) {
|
265
|
-
loadErrors.push(e)
|
266
|
-
}
|
267
|
-
try {
|
268
|
-
return require('@nx/nx-linux-arm-gnueabihf')
|
269
|
-
} catch (e) {
|
270
|
-
loadErrors.push(e)
|
271
|
-
}
|
272
|
-
|
273
|
-
}
|
274
|
-
} else if (process.arch === 'riscv64') {
|
275
|
-
if (isMusl()) {
|
276
|
-
try {
|
277
|
-
return require('./nx.linux-riscv64-musl.node')
|
278
|
-
} catch (e) {
|
279
|
-
loadErrors.push(e)
|
280
|
-
}
|
281
|
-
try {
|
282
|
-
return require('@nx/nx-linux-riscv64-musl')
|
283
|
-
} catch (e) {
|
284
|
-
loadErrors.push(e)
|
285
|
-
}
|
286
|
-
|
287
|
-
} else {
|
288
|
-
try {
|
289
|
-
return require('./nx.linux-riscv64-gnu.node')
|
290
|
-
} catch (e) {
|
291
|
-
loadErrors.push(e)
|
292
|
-
}
|
293
|
-
try {
|
294
|
-
return require('@nx/nx-linux-riscv64-gnu')
|
295
|
-
} catch (e) {
|
296
|
-
loadErrors.push(e)
|
297
|
-
}
|
298
|
-
|
299
|
-
}
|
300
|
-
} else if (process.arch === 'ppc64') {
|
301
|
-
try {
|
302
|
-
return require('./nx.linux-ppc64-gnu.node')
|
303
|
-
} catch (e) {
|
304
|
-
loadErrors.push(e)
|
305
|
-
}
|
306
|
-
try {
|
307
|
-
return require('@nx/nx-linux-ppc64-gnu')
|
308
|
-
} catch (e) {
|
309
|
-
loadErrors.push(e)
|
310
|
-
}
|
311
|
-
|
312
|
-
} else if (process.arch === 's390x') {
|
313
|
-
try {
|
314
|
-
return require('./nx.linux-s390x-gnu.node')
|
315
|
-
} catch (e) {
|
316
|
-
loadErrors.push(e)
|
317
|
-
}
|
318
|
-
try {
|
319
|
-
return require('@nx/nx-linux-s390x-gnu')
|
320
|
-
} catch (e) {
|
321
|
-
loadErrors.push(e)
|
322
|
-
}
|
323
|
-
|
324
|
-
} else {
|
325
|
-
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
62
|
+
if (!existsSync(nativeFileCacheLocation)) {
|
63
|
+
mkdirSync(nativeFileCacheLocation, { recursive: true });
|
326
64
|
}
|
65
|
+
copyFileSync(nativeLocation, tmpFile);
|
66
|
+
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
327
67
|
} else {
|
328
|
-
|
68
|
+
// call the original _load function for everything else
|
69
|
+
return originalLoad.apply(this, arguments);
|
329
70
|
}
|
330
|
-
}
|
331
|
-
|
332
|
-
nativeBinding = requireNative()
|
71
|
+
};
|
333
72
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
} catch (err) {
|
338
|
-
if (process.env.NAPI_RS_FORCE_WASI) {
|
339
|
-
console.error(err)
|
340
|
-
}
|
341
|
-
}
|
342
|
-
if (!nativeBinding) {
|
343
|
-
try {
|
344
|
-
nativeBinding = require('@nx/nx-wasm32-wasi')
|
345
|
-
} catch (err) {
|
346
|
-
if (process.env.NAPI_RS_FORCE_WASI) {
|
347
|
-
console.error(err)
|
348
|
-
}
|
349
|
-
}
|
350
|
-
}
|
351
|
-
}
|
352
|
-
|
353
|
-
if (!nativeBinding) {
|
354
|
-
if (loadErrors.length > 0) {
|
355
|
-
// TODO Link to documentation with potential fixes
|
356
|
-
// - The package owner could build/publish bindings for this arch
|
357
|
-
// - The user may need to bundle the correct files
|
358
|
-
// - The user may need to re-install node_modules to get new packages
|
359
|
-
throw new Error('Failed to load native binding', { cause: loadErrors })
|
360
|
-
}
|
361
|
-
throw new Error(`Failed to load native binding`)
|
362
|
-
}
|
73
|
+
const indexModulePath = require.resolve('./native-bindings.js');
|
74
|
+
delete require.cache[indexModulePath];
|
75
|
+
const indexModule = require('./native-bindings.js');
|
363
76
|
|
364
|
-
module.exports
|
365
|
-
|
366
|
-
module.exports.TaskHasher = nativeBinding.TaskHasher
|
367
|
-
module.exports.WorkspaceContext = nativeBinding.WorkspaceContext
|
368
|
-
module.exports.copy = nativeBinding.copy
|
369
|
-
module.exports.expandOutputs = nativeBinding.expandOutputs
|
370
|
-
module.exports.findImports = nativeBinding.findImports
|
371
|
-
module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs
|
372
|
-
module.exports.hashArray = nativeBinding.hashArray
|
373
|
-
module.exports.hashFile = nativeBinding.hashFile
|
374
|
-
module.exports.isWasm = nativeBinding.isWasm
|
375
|
-
module.exports.remove = nativeBinding.remove
|
376
|
-
module.exports.testOnlyTransferFileMap = nativeBinding.testOnlyTransferFileMap
|
377
|
-
module.exports.transferProjectGraph = nativeBinding.transferProjectGraph
|
378
|
-
module.exports.WorkspaceErrors = nativeBinding.WorkspaceErrors
|
77
|
+
module.exports = indexModule;
|
78
|
+
Module._load = originalLoad;
|
@@ -0,0 +1,139 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
/* prettier-ignore */
|
3
|
+
|
4
|
+
/* auto-generated by NAPI-RS */
|
5
|
+
|
6
|
+
const __nodeFs = require('node:fs')
|
7
|
+
const __nodePath = require('node:path')
|
8
|
+
const { WASI: __nodeWASI } = require('node:wasi')
|
9
|
+
const { Worker } = require('node:worker_threads')
|
10
|
+
|
11
|
+
const {
|
12
|
+
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
|
13
|
+
getDefaultContext: __emnapiGetDefaultContext,
|
14
|
+
createOnMessage: __wasmCreateOnMessageForFsProxy,
|
15
|
+
} = require('@napi-rs/wasm-runtime')
|
16
|
+
|
17
|
+
const __rootDir = __nodePath.parse(process.cwd()).root
|
18
|
+
|
19
|
+
const __wasi = new __nodeWASI({
|
20
|
+
version: 'preview1',
|
21
|
+
env: process.env,
|
22
|
+
preopens: {
|
23
|
+
[__rootDir]: __rootDir,
|
24
|
+
}
|
25
|
+
})
|
26
|
+
|
27
|
+
const __emnapiContext = __emnapiGetDefaultContext()
|
28
|
+
|
29
|
+
const __sharedMemory = new WebAssembly.Memory({
|
30
|
+
initial: 4000,
|
31
|
+
maximum: 65536,
|
32
|
+
shared: true,
|
33
|
+
})
|
34
|
+
|
35
|
+
let __wasmFilePath = __nodePath.join(__dirname, 'nx.wasm32-wasi.wasm')
|
36
|
+
const __wasmDebugFilePath = __nodePath.join(__dirname, 'nx.wasm32-wasi.debug.wasm')
|
37
|
+
|
38
|
+
if (__nodeFs.existsSync(__wasmDebugFilePath)) {
|
39
|
+
__wasmFilePath = __wasmDebugFilePath
|
40
|
+
} else if (!__nodeFs.existsSync(__wasmFilePath)) {
|
41
|
+
try {
|
42
|
+
__wasmFilePath = __nodePath.resolve('@nx/nx-wasm32-wasi')
|
43
|
+
} catch {
|
44
|
+
throw new Error('Cannot find nx.wasm32-wasi.wasm file, and @nx/nx-wasm32-wasi package is not installed.')
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), {
|
49
|
+
context: __emnapiContext,
|
50
|
+
asyncWorkPoolSize: (function() {
|
51
|
+
const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE)
|
52
|
+
// NaN > 0 is false
|
53
|
+
if (threadsSizeFromEnv > 0) {
|
54
|
+
return threadsSizeFromEnv
|
55
|
+
} else {
|
56
|
+
return 4
|
57
|
+
}
|
58
|
+
})(),
|
59
|
+
wasi: __wasi,
|
60
|
+
onCreateWorker() {
|
61
|
+
const worker = new Worker(__nodePath.join(__dirname, 'wasi-worker.mjs'), {
|
62
|
+
env: process.env,
|
63
|
+
execArgv: ['--experimental-wasi-unstable-preview1'],
|
64
|
+
})
|
65
|
+
worker.onmessage = ({ data }) => {
|
66
|
+
__wasmCreateOnMessageForFsProxy(__nodeFs)(data)
|
67
|
+
}
|
68
|
+
return worker
|
69
|
+
},
|
70
|
+
overwriteImports(importObject) {
|
71
|
+
importObject.env = {
|
72
|
+
...importObject.env,
|
73
|
+
...importObject.napi,
|
74
|
+
...importObject.emnapi,
|
75
|
+
memory: __sharedMemory,
|
76
|
+
}
|
77
|
+
return importObject
|
78
|
+
},
|
79
|
+
beforeInit({ instance }) {
|
80
|
+
__napi_rs_initialize_modules(instance)
|
81
|
+
}
|
82
|
+
})
|
83
|
+
|
84
|
+
function __napi_rs_initialize_modules(__napiInstance) {
|
85
|
+
__napiInstance.exports['__napi_register__expand_outputs_0']?.()
|
86
|
+
__napiInstance.exports['__napi_register__get_files_for_outputs_1']?.()
|
87
|
+
__napiInstance.exports['__napi_register__remove_2']?.()
|
88
|
+
__napiInstance.exports['__napi_register__copy_3']?.()
|
89
|
+
__napiInstance.exports['__napi_register__hash_array_4']?.()
|
90
|
+
__napiInstance.exports['__napi_register__hash_file_5']?.()
|
91
|
+
__napiInstance.exports['__napi_register__ImportResult_struct_6']?.()
|
92
|
+
__napiInstance.exports['__napi_register__find_imports_7']?.()
|
93
|
+
__napiInstance.exports['__napi_register__transfer_project_graph_8']?.()
|
94
|
+
__napiInstance.exports['__napi_register__ExternalNode_struct_9']?.()
|
95
|
+
__napiInstance.exports['__napi_register__Target_struct_10']?.()
|
96
|
+
__napiInstance.exports['__napi_register__Project_struct_11']?.()
|
97
|
+
__napiInstance.exports['__napi_register__ProjectGraph_struct_12']?.()
|
98
|
+
__napiInstance.exports['__napi_register__HashPlanner_struct_13']?.()
|
99
|
+
__napiInstance.exports['__napi_register__HashPlanner_impl_17']?.()
|
100
|
+
__napiInstance.exports['__napi_register__HashDetails_struct_18']?.()
|
101
|
+
__napiInstance.exports['__napi_register__HasherOptions_struct_19']?.()
|
102
|
+
__napiInstance.exports['__napi_register__TaskHasher_struct_20']?.()
|
103
|
+
__napiInstance.exports['__napi_register__TaskHasher_impl_23']?.()
|
104
|
+
__napiInstance.exports['__napi_register__Task_struct_24']?.()
|
105
|
+
__napiInstance.exports['__napi_register__TaskTarget_struct_25']?.()
|
106
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_26']?.()
|
107
|
+
__napiInstance.exports['__napi_register__FileData_struct_27']?.()
|
108
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_28']?.()
|
109
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_29']?.()
|
110
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_30']?.()
|
111
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_31']?.()
|
112
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_32']?.()
|
113
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_33']?.()
|
114
|
+
__napiInstance.exports['__napi_register__NxJson_struct_34']?.()
|
115
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_35']?.()
|
116
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_44']?.()
|
117
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_45']?.()
|
118
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_46']?.()
|
119
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_47']?.()
|
120
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_48']?.()
|
121
|
+
__napiInstance.exports['__napi_register__FileMap_struct_49']?.()
|
122
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_50']?.()
|
123
|
+
__napiInstance.exports['__napi_register__is_wasm_51']?.()
|
124
|
+
}
|
125
|
+
module.exports.HashPlanner = __napiModule.exports.HashPlanner
|
126
|
+
module.exports.ImportResult = __napiModule.exports.ImportResult
|
127
|
+
module.exports.TaskHasher = __napiModule.exports.TaskHasher
|
128
|
+
module.exports.WorkspaceContext = __napiModule.exports.WorkspaceContext
|
129
|
+
module.exports.copy = __napiModule.exports.copy
|
130
|
+
module.exports.expandOutputs = __napiModule.exports.expandOutputs
|
131
|
+
module.exports.findImports = __napiModule.exports.findImports
|
132
|
+
module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
|
133
|
+
module.exports.hashArray = __napiModule.exports.hashArray
|
134
|
+
module.exports.hashFile = __napiModule.exports.hashFile
|
135
|
+
module.exports.isWasm = __napiModule.exports.isWasm
|
136
|
+
module.exports.remove = __napiModule.exports.remove
|
137
|
+
module.exports.testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
|
138
|
+
module.exports.transferProjectGraph = __napiModule.exports.transferProjectGraph
|
139
|
+
module.exports.WorkspaceErrors = __napiModule.exports.WorkspaceErrors
|