nx 19.4.0-rc.0 → 19.4.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.4.0-rc.
|
3
|
+
"version": "19.4.0-rc.1",
|
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.4.0-rc.
|
73
|
+
"@nrwl/tao": "19.4.0-rc.1"
|
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.4.0-rc.
|
89
|
-
"@nx/nx-darwin-arm64": "19.4.0-rc.
|
90
|
-
"@nx/nx-linux-x64-gnu": "19.4.0-rc.
|
91
|
-
"@nx/nx-linux-x64-musl": "19.4.0-rc.
|
92
|
-
"@nx/nx-win32-x64-msvc": "19.4.0-rc.
|
93
|
-
"@nx/nx-linux-arm64-gnu": "19.4.0-rc.
|
94
|
-
"@nx/nx-linux-arm64-musl": "19.4.0-rc.
|
95
|
-
"@nx/nx-linux-arm-gnueabihf": "19.4.0-rc.
|
96
|
-
"@nx/nx-win32-arm64-msvc": "19.4.0-rc.
|
97
|
-
"@nx/nx-freebsd-x64": "19.4.0-rc.
|
88
|
+
"@nx/nx-darwin-x64": "19.4.0-rc.1",
|
89
|
+
"@nx/nx-darwin-arm64": "19.4.0-rc.1",
|
90
|
+
"@nx/nx-linux-x64-gnu": "19.4.0-rc.1",
|
91
|
+
"@nx/nx-linux-x64-musl": "19.4.0-rc.1",
|
92
|
+
"@nx/nx-win32-x64-msvc": "19.4.0-rc.1",
|
93
|
+
"@nx/nx-linux-arm64-gnu": "19.4.0-rc.1",
|
94
|
+
"@nx/nx-linux-arm64-musl": "19.4.0-rc.1",
|
95
|
+
"@nx/nx-linux-arm-gnueabihf": "19.4.0-rc.1",
|
96
|
+
"@nx/nx-win32-arm64-msvc": "19.4.0-rc.1",
|
97
|
+
"@nx/nx-freebsd-x64": "19.4.0-rc.1"
|
98
98
|
},
|
99
99
|
"nx-migrations": {
|
100
100
|
"migrations": "./migrations.json",
|
@@ -10,6 +10,7 @@ const configuration_1 = require("../../../config/configuration");
|
|
10
10
|
const nx_deps_cache_1 = require("../../../project-graph/nx-deps-cache");
|
11
11
|
const path_1 = require("path");
|
12
12
|
const task_hasher_1 = require("../../../hasher/task-hasher");
|
13
|
+
const output_1 = require("../../../utils/output");
|
13
14
|
/**
|
14
15
|
* Creates a package.json in the output directory for support to install dependencies within containers.
|
15
16
|
*
|
@@ -106,6 +107,19 @@ function createPackageJson(projectName, graph, options = {}, fileMap = null) {
|
|
106
107
|
packageJson.dependencies &&= (0, object_sort_1.sortObjectByKeys)(packageJson.dependencies);
|
107
108
|
packageJson.peerDependencies &&= (0, object_sort_1.sortObjectByKeys)(packageJson.peerDependencies);
|
108
109
|
packageJson.peerDependenciesMeta &&= (0, object_sort_1.sortObjectByKeys)(packageJson.peerDependenciesMeta);
|
110
|
+
if (rootPackageJson.packageManager) {
|
111
|
+
if (packageJson.packageManager &&
|
112
|
+
packageJson.packageManager !== rootPackageJson.packageManager) {
|
113
|
+
output_1.output.warn({
|
114
|
+
title: 'Package Manager Mismatch',
|
115
|
+
bodyLines: [
|
116
|
+
`The project ${projectName} has explicitly specified "packageManager" config of "${packageJson.packageManager}" but the workspace is using "${rootPackageJson.packageManager}".`,
|
117
|
+
`Please remove the project level "packageManager" config or align it with the workspace root package.json.`,
|
118
|
+
],
|
119
|
+
});
|
120
|
+
}
|
121
|
+
packageJson.packageManager = rootPackageJson.packageManager;
|
122
|
+
}
|
109
123
|
return packageJson;
|
110
124
|
}
|
111
125
|
exports.createPackageJson = createPackageJson;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { TsConfigOptions } from 'ts-node';
|
2
1
|
import type { CompilerOptions } from 'typescript';
|
3
2
|
/**
|
4
3
|
* Optionally, if swc-node and tsconfig-paths are available in the current workspace, apply the require
|
@@ -24,7 +23,7 @@ export declare function registerTsProject(tsConfigPath: string): () => void;
|
|
24
23
|
*/
|
25
24
|
export declare function registerTsProject(path: string, configFilename: string): any;
|
26
25
|
export declare function getSwcTranspiler(compilerOptions: CompilerOptions): (...args: unknown[]) => unknown;
|
27
|
-
export declare function getTsNodeTranspiler(compilerOptions: CompilerOptions
|
26
|
+
export declare function getTsNodeTranspiler(compilerOptions: CompilerOptions): (...args: unknown[]) => unknown;
|
28
27
|
export declare function getTranspiler(compilerOptions: CompilerOptions, tsConfigRaw?: unknown): () => (...args: unknown[]) => unknown;
|
29
28
|
/**
|
30
29
|
* Register ts-node or swc-node given a set of compiler options.
|
@@ -7,7 +7,45 @@ const swcNodeInstalled = packageIsInstalled('@swc-node/register');
|
|
7
7
|
const tsNodeInstalled = packageIsInstalled('ts-node/register');
|
8
8
|
let ts;
|
9
9
|
let isTsEsmLoaderRegistered = false;
|
10
|
+
/**
|
11
|
+
* tsx is a utility to run TypeScript files in node which is growing in popularity:
|
12
|
+
* https://tsx.is
|
13
|
+
*
|
14
|
+
* Behind the scenes it is invoking node with relevant --require and --import flags.
|
15
|
+
*
|
16
|
+
* If the user is invoking Nx via a script which is being invoked via tsx, then we
|
17
|
+
* do not need to register any transpiler at all as the environment will have already
|
18
|
+
* been configured by tsx. In fact, registering a transpiler such as ts-node or swc
|
19
|
+
* in this case causes issues.
|
20
|
+
*
|
21
|
+
* Because node is being invoked by tsx, the tsx binary does not end up in the final
|
22
|
+
* process.argv and so we need to check a few possible things to account for usage
|
23
|
+
* via different package managers (e.g. pnpm does not set process._ to tsx, but rather
|
24
|
+
* pnpm itself, modern yarn does not set process._ at all etc.).
|
25
|
+
*/
|
26
|
+
const isInvokedByTsx = (() => {
|
27
|
+
if (process.env._?.endsWith(`${path_1.sep}tsx`)) {
|
28
|
+
return true;
|
29
|
+
}
|
30
|
+
const requireArgs = [];
|
31
|
+
const importArgs = [];
|
32
|
+
(process.execArgv ?? []).forEach((arg, i) => {
|
33
|
+
if (arg === '-r' || arg === '--require') {
|
34
|
+
requireArgs.push(process.execArgv[i + 1]);
|
35
|
+
}
|
36
|
+
if (arg === '--import') {
|
37
|
+
importArgs.push(process.execArgv[i + 1]);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
const isTsxPath = (p) => p.includes(`${path_1.sep}tsx${path_1.sep}`);
|
41
|
+
return (requireArgs.some((a) => isTsxPath(a)) ||
|
42
|
+
importArgs.some((a) => isTsxPath(a)));
|
43
|
+
})();
|
10
44
|
function registerTsProject(path, configFilename) {
|
45
|
+
// See explanation alongside isInvokedByTsx declaration
|
46
|
+
if (isInvokedByTsx) {
|
47
|
+
return () => { };
|
48
|
+
}
|
11
49
|
const tsConfigPath = configFilename ? (0, path_1.join)(path, configFilename) : path;
|
12
50
|
const compilerOptions = readCompilerOptions(tsConfigPath);
|
13
51
|
const cleanupFunctions = [
|
@@ -41,7 +79,13 @@ function getSwcTranspiler(compilerOptions) {
|
|
41
79
|
return typeof cleanupFn === 'function' ? cleanupFn : () => { };
|
42
80
|
}
|
43
81
|
exports.getSwcTranspiler = getSwcTranspiler;
|
44
|
-
|
82
|
+
const registered = new Set();
|
83
|
+
function getTsNodeTranspiler(compilerOptions) {
|
84
|
+
// Just return if transpiler was already registered before.
|
85
|
+
const registrationKey = JSON.stringify(compilerOptions);
|
86
|
+
if (registered.has(registrationKey)) {
|
87
|
+
return () => { };
|
88
|
+
}
|
45
89
|
const { register } = require('ts-node');
|
46
90
|
// ts-node doesn't provide a cleanup method
|
47
91
|
const service = register({
|
@@ -50,13 +94,14 @@ function getTsNodeTranspiler(compilerOptions, tsNodeOptions) {
|
|
50
94
|
// we already read and provide the compiler options, so prevent ts-node from reading them again
|
51
95
|
skipProject: true,
|
52
96
|
});
|
97
|
+
registered.add(registrationKey);
|
53
98
|
const { transpiler, swc } = service.options;
|
54
99
|
// Don't warn if a faster transpiler is enabled
|
55
100
|
if (!transpiler && !swc) {
|
56
101
|
warnTsNodeUsage();
|
57
102
|
}
|
58
103
|
return () => {
|
59
|
-
service
|
104
|
+
// Do not cleanup ts-node service since other consumers may need it
|
60
105
|
};
|
61
106
|
}
|
62
107
|
exports.getTsNodeTranspiler = getTsNodeTranspiler;
|
@@ -121,7 +166,7 @@ function getTranspiler(compilerOptions, tsConfigRaw) {
|
|
121
166
|
// We can fall back on ts-node if it's available
|
122
167
|
if (tsNodeInstalled) {
|
123
168
|
const tsNodeOptions = filterRecognizedTsConfigTsNodeOptions(tsConfigRaw).recognized;
|
124
|
-
return () => getTsNodeTranspiler(compilerOptions
|
169
|
+
return () => getTsNodeTranspiler(compilerOptions);
|
125
170
|
}
|
126
171
|
}
|
127
172
|
exports.getTranspiler = getTranspiler;
|
@@ -9,12 +9,12 @@ import { LoadedNxPlugin } from '../plugins/internal-api';
|
|
9
9
|
* @param nxJson
|
10
10
|
*/
|
11
11
|
export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
|
12
|
-
allWorkspaceFiles: import("
|
12
|
+
allWorkspaceFiles: import("../file-utils").FileData[];
|
13
13
|
fileMap: {
|
14
14
|
projectFileMap: ProjectFiles;
|
15
|
-
nonProjectFiles: import("
|
15
|
+
nonProjectFiles: import("../../native").FileData[];
|
16
16
|
};
|
17
|
-
rustReferences: import("
|
17
|
+
rustReferences: import("../../native").NxWorkspaceFilesExternals;
|
18
18
|
}>;
|
19
19
|
/**
|
20
20
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|