nx 22.4.0-canary.20260113-246d4fd → 22.4.0-canary.20260114-45f2ae3
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/package.json +12 -12
- package/project.json +2 -2
- package/src/native/index.js +48 -8
- package/src/native/nx.wasm32-wasi.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "22.4.0-canary.
|
|
3
|
+
"version": "22.4.0-canary.20260114-45f2ae3",
|
|
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": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"jest-diff": "^30.0.2",
|
|
54
54
|
"jsonc-parser": "3.2.0",
|
|
55
55
|
"lines-and-columns": "2.0.3",
|
|
56
|
-
"minimatch": "
|
|
56
|
+
"minimatch": "10.1.1",
|
|
57
57
|
"node-machine-id": "1.1.12",
|
|
58
58
|
"npm-run-path": "^4.0.1",
|
|
59
59
|
"open": "^8.4.0",
|
|
@@ -83,16 +83,16 @@
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
"optionalDependencies": {
|
|
86
|
-
"@nx/nx-darwin-arm64": "22.4.0-canary.
|
|
87
|
-
"@nx/nx-darwin-x64": "22.4.0-canary.
|
|
88
|
-
"@nx/nx-freebsd-x64": "22.4.0-canary.
|
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "22.4.0-canary.
|
|
90
|
-
"@nx/nx-linux-arm64-gnu": "22.4.0-canary.
|
|
91
|
-
"@nx/nx-linux-arm64-musl": "22.4.0-canary.
|
|
92
|
-
"@nx/nx-linux-x64-gnu": "22.4.0-canary.
|
|
93
|
-
"@nx/nx-linux-x64-musl": "22.4.0-canary.
|
|
94
|
-
"@nx/nx-win32-arm64-msvc": "22.4.0-canary.
|
|
95
|
-
"@nx/nx-win32-x64-msvc": "22.4.0-canary.
|
|
86
|
+
"@nx/nx-darwin-arm64": "22.4.0-canary.20260114-45f2ae3",
|
|
87
|
+
"@nx/nx-darwin-x64": "22.4.0-canary.20260114-45f2ae3",
|
|
88
|
+
"@nx/nx-freebsd-x64": "22.4.0-canary.20260114-45f2ae3",
|
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "22.4.0-canary.20260114-45f2ae3",
|
|
90
|
+
"@nx/nx-linux-arm64-gnu": "22.4.0-canary.20260114-45f2ae3",
|
|
91
|
+
"@nx/nx-linux-arm64-musl": "22.4.0-canary.20260114-45f2ae3",
|
|
92
|
+
"@nx/nx-linux-x64-gnu": "22.4.0-canary.20260114-45f2ae3",
|
|
93
|
+
"@nx/nx-linux-x64-musl": "22.4.0-canary.20260114-45f2ae3",
|
|
94
|
+
"@nx/nx-win32-arm64-msvc": "22.4.0-canary.20260114-45f2ae3",
|
|
95
|
+
"@nx/nx-win32-x64-msvc": "22.4.0-canary.20260114-45f2ae3"
|
|
96
96
|
},
|
|
97
97
|
"nx-migrations": {
|
|
98
98
|
"migrations": "./migrations.json",
|
package/project.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"inputs": ["native"],
|
|
16
16
|
"outputs": [
|
|
17
17
|
"{projectRoot}/src/native/*.wasm",
|
|
18
|
-
"{projectRoot}/src/native
|
|
18
|
+
"{projectRoot}/src/native/!(index|browser).js",
|
|
19
19
|
"{projectRoot}/src/native/*.cjs",
|
|
20
20
|
"{projectRoot}/src/native/*.mjs",
|
|
21
21
|
"{projectRoot}/src/native/index.d.ts"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build-native": {
|
|
32
32
|
"outputs": [
|
|
33
33
|
"{projectRoot}/src/native/*.node",
|
|
34
|
-
"{projectRoot}/src/native
|
|
34
|
+
"{projectRoot}/src/native/!(index|browser).js",
|
|
35
35
|
"{projectRoot}/src/native/index.d.ts"
|
|
36
36
|
],
|
|
37
37
|
"executor": "@monodon/rust:napi",
|
package/src/native/index.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
const { join, basename } = require('path');
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
copyFileSync,
|
|
4
|
+
existsSync,
|
|
5
|
+
mkdirSync,
|
|
6
|
+
renameSync,
|
|
7
|
+
statSync,
|
|
8
|
+
unlinkSync,
|
|
9
|
+
} = require('fs');
|
|
3
10
|
const Module = require('module');
|
|
4
11
|
const { nxVersion } = require('../utils/versions');
|
|
5
12
|
const { getNativeFileCacheLocation } = require('./native-file-cache-location');
|
|
6
13
|
|
|
14
|
+
const MAX_COPY_RETRIES = 3;
|
|
15
|
+
|
|
7
16
|
// WASI is still experimental and throws a warning when used
|
|
8
17
|
// We spawn many many processes so the warning gets printed a lot
|
|
9
18
|
// We have a different warning elsewhere to warn people using WASI
|
|
@@ -56,6 +65,14 @@ const localNodeFiles = [
|
|
|
56
65
|
|
|
57
66
|
const originalLoad = Module._load;
|
|
58
67
|
|
|
68
|
+
function statsOrNull(path) {
|
|
69
|
+
try {
|
|
70
|
+
return statSync(path);
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
59
76
|
// We override the _load function so that when a native file is required,
|
|
60
77
|
// we copy it to a cache directory and require it from there.
|
|
61
78
|
// This prevents the file being loaded from node_modules and causing file locking issues.
|
|
@@ -83,22 +100,45 @@ Module._load = function (request, parent, isMain) {
|
|
|
83
100
|
);
|
|
84
101
|
// This is the path that will get loaded
|
|
85
102
|
const tmpFile = join(nativeFileCacheLocation, nxVersion + '-' + fileName);
|
|
103
|
+
const expectedFileSize = statSync(nativeLocation).size;
|
|
104
|
+
const existingFileStats = statsOrNull(tmpFile);
|
|
86
105
|
|
|
87
106
|
// If the file to be loaded already exists, just load it
|
|
88
|
-
if (
|
|
107
|
+
if (existingFileStats?.size === expectedFileSize) {
|
|
89
108
|
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
|
90
109
|
}
|
|
91
110
|
if (!existsSync(nativeFileCacheLocation)) {
|
|
92
111
|
mkdirSync(nativeFileCacheLocation, { recursive: true });
|
|
93
112
|
}
|
|
94
|
-
// First copy to a unique location for each process
|
|
95
|
-
copyFileSync(nativeLocation, tmpTmpFile);
|
|
96
113
|
|
|
97
|
-
//
|
|
98
|
-
|
|
114
|
+
// Retry copying up to 3 times, validating after each copy
|
|
115
|
+
for (let attempt = 1; attempt <= MAX_COPY_RETRIES; attempt++) {
|
|
116
|
+
// First copy to a unique location for each process
|
|
117
|
+
copyFileSync(nativeLocation, tmpTmpFile);
|
|
118
|
+
|
|
119
|
+
// Validate the copy - check file size matches expected
|
|
120
|
+
const copiedFileStats = statsOrNull(tmpTmpFile);
|
|
121
|
+
if (copiedFileStats?.size === expectedFileSize) {
|
|
122
|
+
// Copy succeeded, rename to final location and load
|
|
123
|
+
renameSync(tmpTmpFile, tmpFile);
|
|
124
|
+
return originalLoad.apply(this, [tmpFile, parent, isMain]);
|
|
125
|
+
}
|
|
99
126
|
|
|
100
|
-
|
|
101
|
-
|
|
127
|
+
// Copy failed validation, clean up the malformed file
|
|
128
|
+
try {
|
|
129
|
+
unlinkSync(tmpTmpFile);
|
|
130
|
+
} catch {
|
|
131
|
+
// Ignore cleanup errors
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// All retries failed - warn and load from original location
|
|
136
|
+
console.warn(
|
|
137
|
+
`Warning: Failed to copy native module to cache after ${MAX_COPY_RETRIES} attempts. ` +
|
|
138
|
+
`Loading from original location instead. ` +
|
|
139
|
+
`This may cause file locking issues on Windows.`
|
|
140
|
+
);
|
|
141
|
+
return originalLoad.apply(this, [nativeLocation, parent, isMain]);
|
|
102
142
|
} else {
|
|
103
143
|
// call the original _load function for everything else
|
|
104
144
|
return originalLoad.apply(this, arguments);
|
|
Binary file
|