nx 23.0.1 → 23.0.2
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/bin/init-local.js +1 -1
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +1 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +6 -1
- package/dist/src/command-line/init/init-v2.js +1 -1
- package/dist/src/command-line/migrate/migrate.d.ts +2 -0
- package/dist/src/command-line/migrate/migrate.js +32 -6
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.d.ts +1 -1
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +28 -21
- package/dist/src/command-line/release/version/resolve-current-version.js +4 -1
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +30 -11
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/lock-file/bun-parser.js +61 -38
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +1 -3
- package/dist/src/plugins/js/package-json/create-package-json.js +22 -1
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +7 -0
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +26 -1
- package/dist/src/plugins/js/utils/register.d.ts +31 -10
- package/dist/src/plugins/js/utils/register.js +87 -18
- package/dist/src/plugins/package-json/create-nodes.js +5 -3
- package/dist/src/project-graph/operators.d.ts +0 -1
- package/dist/src/project-graph/operators.js +0 -44
- package/dist/src/project-graph/project-graph-builder.js +26 -10
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +23 -6
- package/dist/src/project-graph/utils/project-configuration-utils.js +28 -28
- package/dist/src/tasks-runner/batch/run-batch.js +3 -0
- package/dist/src/tasks-runner/cache.js +6 -0
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -0
- package/dist/src/tasks-runner/pseudo-terminal.js +18 -4
- package/dist/src/tasks-runner/run-command.js +24 -8
- package/dist/src/tasks-runner/utils.d.ts +1 -0
- package/dist/src/tasks-runner/utils.js +4 -0
- package/dist/src/utils/ab-testing.d.ts +4 -4
- package/dist/src/utils/ab-testing.js +5 -5
- package/dist/src/utils/catalog/manager-utils.d.ts +9 -0
- package/dist/src/utils/catalog/manager-utils.js +215 -0
- package/dist/src/utils/catalog/pnpm-manager.js +4 -102
- package/dist/src/utils/catalog/yarn-manager.js +4 -102
- package/dist/src/utils/is-sandbox.js +2 -0
- package/dist/src/utils/min-release-age/behavior/pnpm.d.ts +6 -5
- package/dist/src/utils/min-release-age/behavior/pnpm.js +87 -339
- package/dist/src/utils/package-json.d.ts +1 -0
- package/dist/src/utils/package-manager.d.ts +6 -3
- package/dist/src/utils/package-manager.js +21 -7
- package/dist/src/utils/spinner.d.ts +13 -1
- package/dist/src/utils/spinner.js +20 -4
- package/package.json +16 -12
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PnpmCatalogManager = void 0;
|
|
4
|
-
const js_yaml_1 = require("@zkochan/js-yaml");
|
|
5
4
|
const node_fs_1 = require("node:fs");
|
|
6
5
|
const node_path_1 = require("node:path");
|
|
7
|
-
const fileutils_1 = require("../fileutils");
|
|
8
|
-
const output_1 = require("../output");
|
|
9
6
|
const manager_1 = require("./manager");
|
|
7
|
+
const manager_utils_1 = require("./manager-utils");
|
|
10
8
|
const PNPM_WORKSPACE_FILENAME = 'pnpm-workspace.yaml';
|
|
11
9
|
/**
|
|
12
10
|
* PNPM-specific catalog manager implementation
|
|
@@ -40,13 +38,13 @@ class PnpmCatalogManager {
|
|
|
40
38
|
if (!(0, node_fs_1.existsSync)(configPath)) {
|
|
41
39
|
return null;
|
|
42
40
|
}
|
|
43
|
-
return
|
|
41
|
+
return (0, manager_utils_1.readCatalogConfigFromFs)(PNPM_WORKSPACE_FILENAME, configPath);
|
|
44
42
|
}
|
|
45
43
|
else {
|
|
46
44
|
if (!treeOrRoot.exists(PNPM_WORKSPACE_FILENAME)) {
|
|
47
45
|
return null;
|
|
48
46
|
}
|
|
49
|
-
return
|
|
47
|
+
return (0, manager_utils_1.readCatalogConfigFromTree)(PNPM_WORKSPACE_FILENAME, treeOrRoot);
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
resolveCatalogReference(treeOrRoot, packageName, version) {
|
|
@@ -147,103 +145,7 @@ class PnpmCatalogManager {
|
|
|
147
145
|
}
|
|
148
146
|
}
|
|
149
147
|
updateCatalogVersions(treeOrRoot, updates) {
|
|
150
|
-
|
|
151
|
-
let readYaml;
|
|
152
|
-
let writeYaml;
|
|
153
|
-
if (typeof treeOrRoot === 'string') {
|
|
154
|
-
const configPath = (0, node_path_1.join)(treeOrRoot, PNPM_WORKSPACE_FILENAME);
|
|
155
|
-
checkExists = () => (0, node_fs_1.existsSync)(configPath);
|
|
156
|
-
readYaml = () => (0, node_fs_1.readFileSync)(configPath, 'utf-8');
|
|
157
|
-
writeYaml = (content) => (0, node_fs_1.writeFileSync)(configPath, content, 'utf-8');
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
checkExists = () => treeOrRoot.exists(PNPM_WORKSPACE_FILENAME);
|
|
161
|
-
readYaml = () => treeOrRoot.read(PNPM_WORKSPACE_FILENAME, 'utf-8');
|
|
162
|
-
writeYaml = (content) => treeOrRoot.write(PNPM_WORKSPACE_FILENAME, content);
|
|
163
|
-
}
|
|
164
|
-
if (!checkExists()) {
|
|
165
|
-
output_1.output.warn({
|
|
166
|
-
title: `No ${PNPM_WORKSPACE_FILENAME} found`,
|
|
167
|
-
bodyLines: [
|
|
168
|
-
`Cannot update catalog versions without a ${PNPM_WORKSPACE_FILENAME} file.`,
|
|
169
|
-
`Create a ${PNPM_WORKSPACE_FILENAME} file to use catalogs.`,
|
|
170
|
-
],
|
|
171
|
-
});
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
try {
|
|
175
|
-
const configContent = readYaml();
|
|
176
|
-
const configData = (0, js_yaml_1.load)(configContent) || {};
|
|
177
|
-
let hasChanges = false;
|
|
178
|
-
for (const update of updates) {
|
|
179
|
-
const { packageName, version, catalogName } = update;
|
|
180
|
-
const normalizedCatalogName = catalogName === 'default' ? undefined : catalogName;
|
|
181
|
-
let targetCatalog;
|
|
182
|
-
if (!normalizedCatalogName) {
|
|
183
|
-
// Default catalog - update whichever exists, prefer catalog over catalogs.default
|
|
184
|
-
if (configData.catalog) {
|
|
185
|
-
targetCatalog = configData.catalog;
|
|
186
|
-
}
|
|
187
|
-
else if (configData.catalogs?.default) {
|
|
188
|
-
targetCatalog = configData.catalogs.default;
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
// Neither exists, create catalog (shorthand syntax)
|
|
192
|
-
configData.catalog ??= {};
|
|
193
|
-
targetCatalog = configData.catalog;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
// Named catalog
|
|
198
|
-
configData.catalogs ??= {};
|
|
199
|
-
configData.catalogs[normalizedCatalogName] ??= {};
|
|
200
|
-
targetCatalog = configData.catalogs[normalizedCatalogName];
|
|
201
|
-
}
|
|
202
|
-
if (targetCatalog[packageName] !== version) {
|
|
203
|
-
targetCatalog[packageName] = version;
|
|
204
|
-
hasChanges = true;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (hasChanges) {
|
|
208
|
-
writeYaml((0, js_yaml_1.dump)(configData, {
|
|
209
|
-
indent: 2,
|
|
210
|
-
quotingType: '"',
|
|
211
|
-
forceQuotes: true,
|
|
212
|
-
}));
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
catch (error) {
|
|
216
|
-
output_1.output.error({
|
|
217
|
-
title: 'Failed to update catalog versions',
|
|
218
|
-
bodyLines: [error instanceof Error ? error.message : String(error)],
|
|
219
|
-
});
|
|
220
|
-
throw error;
|
|
221
|
-
}
|
|
148
|
+
(0, manager_utils_1.updateCatalogVersionsInFile)(PNPM_WORKSPACE_FILENAME, treeOrRoot, updates);
|
|
222
149
|
}
|
|
223
150
|
}
|
|
224
151
|
exports.PnpmCatalogManager = PnpmCatalogManager;
|
|
225
|
-
function readConfigFromFs(path) {
|
|
226
|
-
try {
|
|
227
|
-
return (0, fileutils_1.readYamlFile)(path);
|
|
228
|
-
}
|
|
229
|
-
catch (error) {
|
|
230
|
-
output_1.output.warn({
|
|
231
|
-
title: `Unable to parse ${PNPM_WORKSPACE_FILENAME}`,
|
|
232
|
-
bodyLines: [error.toString()],
|
|
233
|
-
});
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
function readConfigFromTree(tree, path) {
|
|
238
|
-
const content = tree.read(path, 'utf-8');
|
|
239
|
-
try {
|
|
240
|
-
return (0, js_yaml_1.load)(content, { filename: path });
|
|
241
|
-
}
|
|
242
|
-
catch (error) {
|
|
243
|
-
output_1.output.warn({
|
|
244
|
-
title: `Unable to parse ${PNPM_WORKSPACE_FILENAME}`,
|
|
245
|
-
bodyLines: [error.toString()],
|
|
246
|
-
});
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.YarnCatalogManager = void 0;
|
|
4
|
-
const js_yaml_1 = require("@zkochan/js-yaml");
|
|
5
4
|
const node_fs_1 = require("node:fs");
|
|
6
5
|
const node_path_1 = require("node:path");
|
|
7
|
-
const fileutils_1 = require("../fileutils");
|
|
8
|
-
const output_1 = require("../output");
|
|
9
6
|
const manager_1 = require("./manager");
|
|
7
|
+
const manager_utils_1 = require("./manager-utils");
|
|
10
8
|
const YARNRC_FILENAME = '.yarnrc.yml';
|
|
11
9
|
/**
|
|
12
10
|
* Yarn Berry (v4+) catalog manager implementation
|
|
@@ -40,13 +38,13 @@ class YarnCatalogManager {
|
|
|
40
38
|
if (!(0, node_fs_1.existsSync)(configPath)) {
|
|
41
39
|
return null;
|
|
42
40
|
}
|
|
43
|
-
return
|
|
41
|
+
return (0, manager_utils_1.readCatalogConfigFromFs)(YARNRC_FILENAME, configPath);
|
|
44
42
|
}
|
|
45
43
|
else {
|
|
46
44
|
if (!treeOrRoot.exists(YARNRC_FILENAME)) {
|
|
47
45
|
return null;
|
|
48
46
|
}
|
|
49
|
-
return
|
|
47
|
+
return (0, manager_utils_1.readCatalogConfigFromTree)(YARNRC_FILENAME, treeOrRoot);
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
resolveCatalogReference(treeOrRoot, packageName, version) {
|
|
@@ -147,103 +145,7 @@ class YarnCatalogManager {
|
|
|
147
145
|
}
|
|
148
146
|
}
|
|
149
147
|
updateCatalogVersions(treeOrRoot, updates) {
|
|
150
|
-
|
|
151
|
-
let readYaml;
|
|
152
|
-
let writeYaml;
|
|
153
|
-
if (typeof treeOrRoot === 'string') {
|
|
154
|
-
const configPath = (0, node_path_1.join)(treeOrRoot, YARNRC_FILENAME);
|
|
155
|
-
checkExists = () => (0, node_fs_1.existsSync)(configPath);
|
|
156
|
-
readYaml = () => (0, node_fs_1.readFileSync)(configPath, 'utf-8');
|
|
157
|
-
writeYaml = (content) => (0, node_fs_1.writeFileSync)(configPath, content, 'utf-8');
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
checkExists = () => treeOrRoot.exists(YARNRC_FILENAME);
|
|
161
|
-
readYaml = () => treeOrRoot.read(YARNRC_FILENAME, 'utf-8');
|
|
162
|
-
writeYaml = (content) => treeOrRoot.write(YARNRC_FILENAME, content);
|
|
163
|
-
}
|
|
164
|
-
if (!checkExists()) {
|
|
165
|
-
output_1.output.warn({
|
|
166
|
-
title: `No ${YARNRC_FILENAME} found`,
|
|
167
|
-
bodyLines: [
|
|
168
|
-
`Cannot update catalog versions without a ${YARNRC_FILENAME} file.`,
|
|
169
|
-
`Create a ${YARNRC_FILENAME} file to use catalogs.`,
|
|
170
|
-
],
|
|
171
|
-
});
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
try {
|
|
175
|
-
const configContent = readYaml();
|
|
176
|
-
const configData = (0, js_yaml_1.load)(configContent) || {};
|
|
177
|
-
let hasChanges = false;
|
|
178
|
-
for (const update of updates) {
|
|
179
|
-
const { packageName, version, catalogName } = update;
|
|
180
|
-
const normalizedCatalogName = catalogName === 'default' ? undefined : catalogName;
|
|
181
|
-
let targetCatalog;
|
|
182
|
-
if (!normalizedCatalogName) {
|
|
183
|
-
// Default catalog - update whichever exists, prefer catalog over catalogs.default
|
|
184
|
-
if (configData.catalog) {
|
|
185
|
-
targetCatalog = configData.catalog;
|
|
186
|
-
}
|
|
187
|
-
else if (configData.catalogs?.default) {
|
|
188
|
-
targetCatalog = configData.catalogs.default;
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
// Neither exists, create catalog (shorthand syntax)
|
|
192
|
-
configData.catalog ??= {};
|
|
193
|
-
targetCatalog = configData.catalog;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
// Named catalog
|
|
198
|
-
configData.catalogs ??= {};
|
|
199
|
-
configData.catalogs[normalizedCatalogName] ??= {};
|
|
200
|
-
targetCatalog = configData.catalogs[normalizedCatalogName];
|
|
201
|
-
}
|
|
202
|
-
if (targetCatalog[packageName] !== version) {
|
|
203
|
-
targetCatalog[packageName] = version;
|
|
204
|
-
hasChanges = true;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (hasChanges) {
|
|
208
|
-
writeYaml((0, js_yaml_1.dump)(configData, {
|
|
209
|
-
indent: 2,
|
|
210
|
-
quotingType: '"',
|
|
211
|
-
forceQuotes: true,
|
|
212
|
-
}));
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
catch (error) {
|
|
216
|
-
output_1.output.error({
|
|
217
|
-
title: 'Failed to update catalog versions',
|
|
218
|
-
bodyLines: [error instanceof Error ? error.message : String(error)],
|
|
219
|
-
});
|
|
220
|
-
throw error;
|
|
221
|
-
}
|
|
148
|
+
(0, manager_utils_1.updateCatalogVersionsInFile)(YARNRC_FILENAME, treeOrRoot, updates);
|
|
222
149
|
}
|
|
223
150
|
}
|
|
224
151
|
exports.YarnCatalogManager = YarnCatalogManager;
|
|
225
|
-
function readConfigFromFs(path) {
|
|
226
|
-
try {
|
|
227
|
-
return (0, fileutils_1.readYamlFile)(path);
|
|
228
|
-
}
|
|
229
|
-
catch (error) {
|
|
230
|
-
output_1.output.warn({
|
|
231
|
-
title: `Unable to parse ${YARNRC_FILENAME}`,
|
|
232
|
-
bodyLines: [error.toString()],
|
|
233
|
-
});
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
function readConfigFromTree(tree, path) {
|
|
238
|
-
const content = tree.read(path, 'utf-8');
|
|
239
|
-
try {
|
|
240
|
-
return (0, js_yaml_1.load)(content, { filename: path });
|
|
241
|
-
}
|
|
242
|
-
catch (error) {
|
|
243
|
-
output_1.output.warn({
|
|
244
|
-
title: `Unable to parse ${YARNRC_FILENAME}`,
|
|
245
|
-
bodyLines: [error.toString()],
|
|
246
|
-
});
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
@@ -5,5 +5,7 @@ function isSandbox() {
|
|
|
5
5
|
return (!!process.env.SANDBOX_RUNTIME ||
|
|
6
6
|
!!process.env.GEMINI_SANDBOX ||
|
|
7
7
|
!!process.env.CODEX_SANDBOX ||
|
|
8
|
+
// Codex only sets CODEX_SANDBOX on macOS; on Linux it sets this instead.
|
|
9
|
+
!!process.env.CODEX_SANDBOX_NETWORK_DISABLED ||
|
|
8
10
|
!!process.env.CURSOR_SANDBOX);
|
|
9
11
|
}
|
|
@@ -2,11 +2,12 @@ import type { RegistryMetadata } from '../packument';
|
|
|
2
2
|
import { type PickOutcome } from '../pick';
|
|
3
3
|
import type { MinReleaseAgePolicy, MinReleaseAgePolicyReadResult } from '../policy';
|
|
4
4
|
/**
|
|
5
|
-
* Reads pnpm's effective cooldown configuration once
|
|
6
|
-
*
|
|
7
|
-
* (
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* Reads pnpm's effective cooldown configuration once by asking pnpm itself
|
|
6
|
+
* (`pnpm config list --json`) instead of re-implementing how it layers config
|
|
7
|
+
* surfaces (a moving target across pnpm versions). The window and excludes come
|
|
8
|
+
* straight from pnpm; the strict default, exclude grammar, and loose-fallback
|
|
9
|
+
* semantics stay version-keyed because pnpm does not report those resolved
|
|
10
|
+
* values.
|
|
10
11
|
*/
|
|
11
12
|
export declare function readPnpmPolicy(root: string, pmVersion: string): Promise<MinReleaseAgePolicyReadResult>;
|
|
12
13
|
/**
|