nx 21.6.2 → 21.6.3
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 +11 -11
- package/src/ai/utils.d.ts +6 -5
- package/src/ai/utils.d.ts.map +1 -1
- package/src/ai/utils.js +14 -13
- package/src/command-line/affected/affected.d.ts.map +1 -1
- package/src/command-line/affected/affected.js +1 -2
- package/src/command-line/configure-ai-agents/configure-ai-agents.d.ts.map +1 -1
- package/src/command-line/configure-ai-agents/configure-ai-agents.js +79 -74
- package/src/command-line/format/format.js +1 -1
- package/src/command-line/release/utils/get-touched-projects-for-group.js +1 -1
- package/src/command-line/show/projects.js +1 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/native/index.d.ts +2 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/file-utils.d.ts +5 -2
- package/src/project-graph/file-utils.d.ts.map +1 -1
- package/src/project-graph/file-utils.js +1 -5
- package/src/utils/nx-console-prompt.d.ts.map +1 -1
- package/src/utils/nx-console-prompt.js +4 -1
- package/src/utils/provenance.d.ts.map +1 -1
- package/src/utils/provenance.js +28 -7
package/src/core/graph/styles.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_nx_graph_client=self.webpackChunk_nx_graph_client||[]).push([[869],{
|
1
|
+
"use strict";(self.webpackChunk_nx_graph_client=self.webpackChunk_nx_graph_client||[]).push([[869],{7337:()=>{}},e=>{var n;n=7337,e(e.s=n)}]);
|
package/src/native/index.d.ts
CHANGED
@@ -251,9 +251,9 @@ export interface InputsInput {
|
|
251
251
|
projects?: string | Array<string>
|
252
252
|
}
|
253
253
|
|
254
|
-
export declare export declare function installNxConsole():
|
254
|
+
export declare export declare function installNxConsole(): boolean
|
255
255
|
|
256
|
-
export declare export declare function installNxConsoleForEditor(editor: SupportedEditor):
|
256
|
+
export declare export declare function installNxConsoleForEditor(editor: SupportedEditor): boolean
|
257
257
|
|
258
258
|
export const IS_WASM: boolean
|
259
259
|
|
Binary file
|
@@ -3,7 +3,8 @@ import type { NxArgs } from '../utils/command-line-utils';
|
|
3
3
|
export interface Change {
|
4
4
|
type: string;
|
5
5
|
}
|
6
|
-
export interface FileChange<T extends Change = Change>
|
6
|
+
export interface FileChange<T extends Change = Change> {
|
7
|
+
file: string;
|
7
8
|
getChanges: () => T[];
|
8
9
|
}
|
9
10
|
export declare class WholeFileChange implements Change {
|
@@ -14,7 +15,9 @@ export declare class DeletedFileChange implements Change {
|
|
14
15
|
}
|
15
16
|
export declare function isWholeFileChange(change: Change): change is WholeFileChange;
|
16
17
|
export declare function isDeletedFileChange(change: Change): change is DeletedFileChange;
|
17
|
-
export declare function calculateFileChanges(files: string[],
|
18
|
+
export declare function calculateFileChanges(files: string[], nxArgs?: NxArgs, readFileAtRevision?: {
|
19
|
+
(f: string, r: string | void): string;
|
20
|
+
}, ignore?: ReturnType<typeof ignore>): FileChange[];
|
18
21
|
export declare const TEN_MEGABYTES: number;
|
19
22
|
export declare function defaultFileRead(filePath: string): string | null;
|
20
23
|
export declare function readPackageJson(root?: string): any;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/project-graph/file-utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAM1D,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,
|
1
|
+
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/project-graph/file-utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAM1D,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC;CACvB;AAED,qBAAa,eAAgB,YAAW,MAAM;IAC5C,IAAI,SAAqB;CAC1B;AAED,qBAAa,iBAAkB,YAAW,MAAM;IAC9C,IAAI,SAAsB;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,eAAe,CAE3E;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,iBAAiB,CAE7B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,CAAC,EAAE,MAAM,EACf,kBAAkB,GAAE;IAClB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;CACX,EAC7B,MAAM,GAAwB,UAAU,CAAC,OAAO,MAAM,CAAC,GACtD,UAAU,EAAE,CA6Cd;AAED,eAAO,MAAM,aAAa,QAAe,CAAC;AA4B1C,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE/D;AAED,wBAAgB,eAAe,CAAC,IAAI,GAAE,MAAsB,GAAG,GAAG,CAMjE;AAGD,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
@@ -31,16 +31,12 @@ function isWholeFileChange(change) {
|
|
31
31
|
function isDeletedFileChange(change) {
|
32
32
|
return change.type === 'WholeFileDeleted';
|
33
33
|
}
|
34
|
-
function calculateFileChanges(files,
|
34
|
+
function calculateFileChanges(files, nxArgs, readFileAtRevision = defaultReadFileAtRevision, ignore = (0, ignore_1.getIgnoreObject)()) {
|
35
35
|
files = files.filter((f) => !ignore.ignores(f));
|
36
36
|
return files.map((f) => {
|
37
37
|
const ext = (0, path_1.extname)(f);
|
38
|
-
const file = allWorkspaceFiles.find((fileData) => fileData.file == f);
|
39
|
-
const hash = file?.hash;
|
40
38
|
return {
|
41
39
|
file: f,
|
42
|
-
ext,
|
43
|
-
hash,
|
44
40
|
getChanges: () => {
|
45
41
|
if (!(0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, f))) {
|
46
42
|
return [new DeletedFileChange()];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nx-console-prompt.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/nx-console-prompt.ts"],"names":[],"mappings":"AASA,wBAAsB,wBAAwB,
|
1
|
+
{"version":3,"file":"nx-console-prompt.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/nx-console-prompt.ts"],"names":[],"mappings":"AASA,wBAAsB,wBAAwB,kBA+B7C"}
|
@@ -26,7 +26,10 @@ async function ensureNxConsoleInstalled() {
|
|
26
26
|
preferences.setAutoInstallPreference(setting);
|
27
27
|
}
|
28
28
|
if (setting) {
|
29
|
-
(0, native_1.installNxConsole)();
|
29
|
+
const installed = (0, native_1.installNxConsole)();
|
30
|
+
if (installed) {
|
31
|
+
output_1.output.log({ title: 'Successfully installed Nx Console!' });
|
32
|
+
}
|
30
33
|
}
|
31
34
|
}
|
32
35
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/provenance.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/provenance.ts"],"names":[],"mappings":"AAiBA,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CA4Gf;AAED,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,WAAW,EA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AgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH"}
|
package/src/utils/provenance.js
CHANGED
@@ -5,8 +5,8 @@ exports.ensurePackageHasProvenance = ensurePackageHasProvenance;
|
|
5
5
|
exports.getNxPackageGroup = getNxPackageGroup;
|
6
6
|
const child_process_1 = require("child_process");
|
7
7
|
const path_1 = require("path");
|
8
|
-
const util_1 = require("util");
|
9
8
|
const fileutils_1 = require("./fileutils");
|
9
|
+
const package_manager_1 = require("./package-manager");
|
10
10
|
/*
|
11
11
|
* Verifies that the given npm package has provenance attestations
|
12
12
|
* generated by the GitHub Actions workflow at .github/workflows/publish.yml
|
@@ -20,12 +20,9 @@ async function ensurePackageHasProvenance(packageName, packageVersion) {
|
|
20
20
|
if (process.env.NX_SKIP_PROVENANCE_CHECK) {
|
21
21
|
return;
|
22
22
|
}
|
23
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
24
23
|
try {
|
25
|
-
const result = await
|
26
|
-
|
27
|
-
});
|
28
|
-
const npmViewResult = JSON.parse(result.stdout.trim());
|
24
|
+
const result = await (0, package_manager_1.packageRegistryView)(packageName, packageVersion, '--json --silent');
|
25
|
+
const npmViewResult = JSON.parse(result);
|
29
26
|
const attURL = npmViewResult.dist?.attestations?.url;
|
30
27
|
if (!attURL)
|
31
28
|
throw new ProvenanceError(packageName, packageVersion, 'No attestation URL found');
|
@@ -68,7 +65,31 @@ async function ensurePackageHasProvenance(packageName, packageVersion) {
|
|
68
65
|
}
|
69
66
|
class ProvenanceError extends Error {
|
70
67
|
constructor(packageName, packageVersion, error) {
|
71
|
-
|
68
|
+
let customRegistry = undefined;
|
69
|
+
try {
|
70
|
+
const packageManager = (0, package_manager_1.detectPackageManager)();
|
71
|
+
const commands = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
72
|
+
// Try to get registry from current package manager, fall back to npm
|
73
|
+
const registryCommand = commands.getRegistryUrl ?? 'npm config get registry';
|
74
|
+
const registry = (0, child_process_1.execSync)(registryCommand, {
|
75
|
+
timeout: 5000,
|
76
|
+
windowsHide: true,
|
77
|
+
encoding: 'utf-8',
|
78
|
+
}).trim();
|
79
|
+
// Only consider it custom if it's not the default npm registry
|
80
|
+
if (registry &&
|
81
|
+
registry !== 'undefined' &&
|
82
|
+
!registry.includes('registry.npmjs.org')) {
|
83
|
+
customRegistry = registry;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
catch {
|
87
|
+
// If we can't determine the registry, proceed with default error message
|
88
|
+
}
|
89
|
+
const registryNote = customRegistry
|
90
|
+
? `This might be due to a custom registry configuration (${customRegistry}). Please check whether provenance is correctly configured for your registry.`
|
91
|
+
: `This could indicate a security risk. Please double check https://www.npmjs.com/package/${packageName} to see if the package is published correctly or file an issue at https://github.com/nrwl/nx/issues.`;
|
92
|
+
super(`An error occurred while checking the provenance of ${packageName}@${packageVersion}. ${registryNote} To disable this check at your own risk, you can set the NX_SKIP_PROVENANCE_CHECK environment variable to true. \n Error: ${error ?? ''}`);
|
72
93
|
}
|
73
94
|
}
|
74
95
|
exports.ProvenanceError = ProvenanceError;
|