nx 23.2.0-beta.5 → 23.2.0-beta.7
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/dist/src/command-line/init/init-v2.js +2 -0
- package/dist/src/command-line/migrate/migrate.js +44 -27
- package/dist/src/command-line/migrate/version-skew-guard.d.ts +3 -4
- package/dist/src/command-line/migrate/version-skew-guard.js +5 -6
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +45 -1
- package/dist/src/daemon/client/client.js +128 -32
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/server.js +22 -0
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +2 -1
- package/dist/src/devkit-internals.js +14 -5
- package/dist/src/generators/tree.d.ts +4 -2
- package/dist/src/native/index.d.ts +10 -0
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +1 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/project-graph.js +20 -0
- package/dist/src/utils/child-process.d.ts +31 -1
- package/dist/src/utils/child-process.js +102 -1
- package/dist/src/utils/ignore.d.ts +128 -1
- package/dist/src/utils/ignore.js +182 -12
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/plugins/core-plugins.js +4 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/package.json +12 -11
|
@@ -401,6 +401,7 @@ async function runInit(options, baseMeta) {
|
|
|
401
401
|
function getPluginReason(plugin) {
|
|
402
402
|
const reasonMap = {
|
|
403
403
|
'@nx/eslint': 'eslint detected in dependencies',
|
|
404
|
+
'@nx/oxlint': 'oxlint detected in dependencies',
|
|
404
405
|
'@nx/storybook': 'storybook detected in dependencies',
|
|
405
406
|
'@nx/vite': 'vite detected in dependencies',
|
|
406
407
|
'@nx/vitest': 'vitest detected in dependencies',
|
|
@@ -448,6 +449,7 @@ function parsePluginsFlag(value) {
|
|
|
448
449
|
const npmPackageToPluginMap = {
|
|
449
450
|
// Generic JS tools
|
|
450
451
|
eslint: '@nx/eslint',
|
|
452
|
+
oxlint: '@nx/oxlint',
|
|
451
453
|
storybook: '@nx/storybook',
|
|
452
454
|
// Bundlers
|
|
453
455
|
vite: '@nx/vite',
|
|
@@ -28,6 +28,7 @@ const util_1 = require("util");
|
|
|
28
28
|
const fileutils_1 = require("../../utils/fileutils");
|
|
29
29
|
const tar_1 = require("../../utils/tar");
|
|
30
30
|
const write_formatted_json_file_1 = require("../../utils/write-formatted-json-file");
|
|
31
|
+
const shell_quoting_1 = require("../../utils/shell-quoting");
|
|
31
32
|
const logger_1 = require("../../utils/logger");
|
|
32
33
|
const git_utils_1 = require("../../utils/git-utils");
|
|
33
34
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
|
@@ -1989,13 +1990,10 @@ async function executeMigrations(root, migrations, isVerbose, shouldCreateCommit
|
|
|
1989
1990
|
retainedAtSuccess: (0, migrate_output_1.retainedMigrations)(outcomes).map((p) => `${p.package}: ${p.name}`),
|
|
1990
1991
|
};
|
|
1991
1992
|
}
|
|
1992
|
-
//
|
|
1993
|
-
//
|
|
1994
|
-
// right after its gated `runInstall` pre-install. `runNxSync` resolves nx
|
|
1995
|
-
// through the workspace's package manager at spawn time, so the child runs
|
|
1996
|
-
// the bytes that pre-install put in place.
|
|
1993
|
+
// nx is located at spawn time, after the gated pre-install, so the child runs
|
|
1994
|
+
// the bytes that install put in place.
|
|
1997
1995
|
function handOffToLocalNx(args) {
|
|
1998
|
-
const exitCode = runOrReturnExitCode(() => (0, child_process_2.
|
|
1996
|
+
const exitCode = runOrReturnExitCode(() => (0, child_process_2.runNxArgvSync)(['migrate', ...args], {
|
|
1999
1997
|
stdio: ['inherit', 'inherit', 'inherit'],
|
|
2000
1998
|
env: {
|
|
2001
1999
|
...process.env,
|
|
@@ -2283,10 +2281,14 @@ function stringifyCaught(e) {
|
|
|
2283
2281
|
// A resolver-based lookup (including `resolvePackageJsonWithoutCachePollution`,
|
|
2284
2282
|
// which does defeat Node's package self-reference) is the wrong tool here:
|
|
2285
2283
|
// resolvers fall back to NODE_PATH after the explicit paths, and NODE_PATH
|
|
2286
|
-
// names the temp installation when this runs there
|
|
2287
|
-
//
|
|
2288
|
-
//
|
|
2289
|
-
//
|
|
2284
|
+
// names the temp installation when this runs there. The scan below reads its
|
|
2285
|
+
// candidate directories itself, so neither NODE_PATH nor self-reference can
|
|
2286
|
+
// reach it; `getNxBin` (utils/child-process.ts), which locates the nx the
|
|
2287
|
+
// hand-off spawns, avoids resolvers for the same reason, over a narrower set
|
|
2288
|
+
// of directories: it skips `.nx/installation`, declines a root without a
|
|
2289
|
+
// package.json, and stops at the nearest install rather than reading past an
|
|
2290
|
+
// unusable one. The PnP branch below stays bespoke either way: a resolver
|
|
2291
|
+
// cannot see into the zip cache without the PnP runtime.
|
|
2290
2292
|
function readLocalNxVersion(root) {
|
|
2291
2293
|
// A PnP manifest is consulted only when yarn drives the hand-off:
|
|
2292
2294
|
// `getRunNxBaseCommand` builds the hand-off command through this same
|
|
@@ -2387,12 +2389,13 @@ function readLocalNxVersion(root) {
|
|
|
2387
2389
|
// The workspace's own install locations first (.nx/installation, root), then
|
|
2388
2390
|
// ancestor directories: package-manager executable lookup ascends (npx and
|
|
2389
2391
|
// bun always, pnpm and yarn inside an outer workspace) and hoisted layouts
|
|
2390
|
-
// install nx above the workspace root.
|
|
2391
|
-
//
|
|
2392
|
-
//
|
|
2393
|
-
//
|
|
2394
|
-
//
|
|
2395
|
-
//
|
|
2392
|
+
// install nx above the workspace root. `getNxBin` ascends too, so an ancestor
|
|
2393
|
+
// read here is usually the one the hand-off spawns. They diverge for a
|
|
2394
|
+
// `.nx/installation` workspace, which `getNxBin` declines, and where the only
|
|
2395
|
+
// nx found sits past the package manager's own lookup boundary and the spawn
|
|
2396
|
+
// has fallen back to that manager: yarn then reports "command not found"
|
|
2397
|
+
// while pnpm exec lands on an nx on PATH. The version read here is therefore
|
|
2398
|
+
// the readable answer, not necessarily the executed one.
|
|
2396
2399
|
function scanNodeModulesForNxVersion(root) {
|
|
2397
2400
|
const searchPaths = [...(0, installation_directory_1.getNxRequirePaths)(root)];
|
|
2398
2401
|
for (let dir = (0, path_1.dirname)(root);; dir = (0, path_1.dirname)(dir)) {
|
|
@@ -2469,9 +2472,11 @@ async function runMigration() {
|
|
|
2469
2472
|
// that parsed the flags, so it needs no capability check. Two lookups
|
|
2470
2473
|
// can still diverge from the running install, both properties of the
|
|
2471
2474
|
// spawn machinery rather than of this fallback: a `.nx/installation`
|
|
2472
|
-
// beside a root package.json, and
|
|
2473
|
-
//
|
|
2474
|
-
|
|
2475
|
+
// beside a root package.json, and, once the spawn falls back to the
|
|
2476
|
+
// package manager, a lookup that misses the workspace install and lands
|
|
2477
|
+
// on an nx on PATH (pnpm exec).
|
|
2478
|
+
const forwardedArgv = process.argv.slice(3);
|
|
2479
|
+
const runLocalMigrate = () => runOrReturnExitCode(() => (0, child_process_2.runNxArgvSync)(['_migrate', ...forwardedArgv], {
|
|
2475
2480
|
stdio: ['inherit', 'inherit', 'inherit'],
|
|
2476
2481
|
}));
|
|
2477
2482
|
if (process.env.NX_USE_LOCAL !== 'true' &&
|
|
@@ -2505,14 +2510,26 @@ async function runMigration() {
|
|
|
2505
2510
|
process.env.npm_config_registry.match(/^https:\/\/registry\.(npmjs\.org|yarnpkg\.com)/)) {
|
|
2506
2511
|
delete process.env.npm_config_registry;
|
|
2507
2512
|
}
|
|
2508
|
-
// Intentionally not
|
|
2509
|
-
// temp dir by nxCliPath() (latest, or
|
|
2510
|
-
// migrations run with an up-to-date migrate
|
|
2511
|
-
//
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2513
|
+
// Intentionally not the workspace's nx: `p` is an nx CLI freshly
|
|
2514
|
+
// installed into a temp dir by nxCliPath() (latest, or
|
|
2515
|
+
// NX_MIGRATE_CLI_VERSION), so migrations run with an up-to-date migrate
|
|
2516
|
+
// implementation. `p` is <tmpDir>/node_modules/.bin/nx, a shell shim;
|
|
2517
|
+
// spawning the entry point that install's own manifest names instead
|
|
2518
|
+
// keeps the forwarded argv out of a shell. That install declares nx
|
|
2519
|
+
// itself, so it is read without ascending: an nx above the temp dir is
|
|
2520
|
+
// one nothing asked for, and the shim below is the answer instead.
|
|
2521
|
+
const tempNxEntry = (0, child_process_2.readInstalledNxBin)((0, path_1.dirname)((0, path_1.dirname)((0, path_1.dirname)(p))));
|
|
2522
|
+
return runOrReturnExitCode(() => tempNxEntry
|
|
2523
|
+
? (0, child_process_2.runNxArgvSync)(['_migrate', ...forwardedArgv], {
|
|
2524
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
2525
|
+
nxBin: tempNxEntry,
|
|
2526
|
+
})
|
|
2527
|
+
: (0, child_process_1.execSync)(`${(0, shell_quoting_1.quoteShellArg)(p)} _migrate ${forwardedArgv
|
|
2528
|
+
.map(shell_quoting_1.quoteShellArg)
|
|
2529
|
+
.join(' ')}`, {
|
|
2530
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
2531
|
+
windowsHide: true,
|
|
2532
|
+
}));
|
|
2516
2533
|
}
|
|
2517
2534
|
return runLocalMigrate();
|
|
2518
2535
|
});
|
|
@@ -48,10 +48,9 @@ export declare function resolveNewMigrateFlagsRunTarget(options: {
|
|
|
48
48
|
* because the invoking nx's version is not forwarded across hop A; the
|
|
49
49
|
* refusal names the workspace update that resolves it.
|
|
50
50
|
*
|
|
51
|
-
* `readLocalNxVersion`
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* delegate to it exits visibly rather than running anything.
|
|
51
|
+
* `readLocalNxVersion` returning undefined does not block: the hand-off then
|
|
52
|
+
* resolves nx as it always does, which may fail visibly or land on another nx
|
|
53
|
+
* the package manager locates.
|
|
55
54
|
*/
|
|
56
55
|
export declare function assertWorkspaceNxSupportsNewMigrateFlags(options: {
|
|
57
56
|
argv: string[];
|
|
@@ -18,8 +18,8 @@ const version_utils_1 = require("./version-utils");
|
|
|
18
18
|
// this floor and route to a temp CLI that drops the new flags and runs the
|
|
19
19
|
// plan phase instead.
|
|
20
20
|
exports.NEW_MIGRATE_FLAGS_FLOOR = '23.2.0';
|
|
21
|
-
// yargs accepts both spellings and the raw argv is forwarded
|
|
22
|
-
//
|
|
21
|
+
// yargs accepts both spellings and the raw argv is forwarded across both
|
|
22
|
+
// migrate hops, so detection must catch each one.
|
|
23
23
|
exports.NEW_MIGRATE_FLAGS = ['--run-migration', '--runMigration'];
|
|
24
24
|
/**
|
|
25
25
|
* Matches an exact token or `<flag>=<value>`. The `=` matters: a bare
|
|
@@ -132,10 +132,9 @@ async function resolveNewMigrateFlagsRunTarget(options) {
|
|
|
132
132
|
* because the invoking nx's version is not forwarded across hop A; the
|
|
133
133
|
* refusal names the workspace update that resolves it.
|
|
134
134
|
*
|
|
135
|
-
* `readLocalNxVersion`
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* delegate to it exits visibly rather than running anything.
|
|
135
|
+
* `readLocalNxVersion` returning undefined does not block: the hand-off then
|
|
136
|
+
* resolves nx as it always does, which may fail visibly or land on another nx
|
|
137
|
+
* the package manager locates.
|
|
139
138
|
*/
|
|
140
139
|
function assertWorkspaceNxSupportsNewMigrateFlags(options) {
|
|
141
140
|
const flag = findNewMigrateFlag(options.argv);
|
|
@@ -137,7 +137,12 @@ function cleanupCacheEntries() {
|
|
|
137
137
|
}
|
|
138
138
|
function cleanupNativeFileCache() {
|
|
139
139
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
|
140
|
-
|
|
140
|
+
// Null when the native cache root is not a real directory we own, which
|
|
141
|
+
// would mean deleting through a path another user planted.
|
|
142
|
+
const cacheDir = (0, native_file_cache_location_1.getNativeFileCacheLocationToDelete)();
|
|
143
|
+
if (cacheDir) {
|
|
144
|
+
(0, node_fs_1.rmSync)(cacheDir, { recursive: true, force: true });
|
|
145
|
+
}
|
|
141
146
|
});
|
|
142
147
|
}
|
|
143
148
|
function cleanupWorkspaceData() {
|
|
@@ -51,6 +51,7 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, projectName, extraTargetDependencies, extraOptions);
|
|
54
|
+
await output_1.output.drain();
|
|
54
55
|
process.exit(status);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -41,6 +41,7 @@ async function runMany(args, extraTargetDependencies = {}, extraOptions = {
|
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, extraOptions);
|
|
44
|
+
await output_1.output.drain();
|
|
44
45
|
process.exit(status);
|
|
45
46
|
}
|
|
46
47
|
}
|