@nx/js 22.7.0-beta.1 → 22.7.0-beta.10
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/migrations.json +9 -0
- package/package.json +8 -9
- package/src/executors/node/lib/detect-module-format.js +2 -1
- package/src/executors/node/lib/kill-tree.js +3 -3
- package/src/executors/node/node.impl.js +5 -4
- package/src/executors/release-publish/log-tar.js +8 -7
- package/src/executors/release-publish/release-publish.impl.js +3 -3
- package/src/executors/tsc/lib/typescript-compilation.js +2 -1
- package/src/executors/tsc/lib/typescript-diagnostic-reporters.js +2 -1
- package/src/executors/tsc/tsc.impl.js +2 -1
- package/src/executors/verdaccio/verdaccio.impl.d.ts.map +1 -1
- package/src/executors/verdaccio/verdaccio.impl.js +20 -21
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +4 -2
- package/src/generators/library/utils/add-release-config.js +2 -1
- package/src/generators/setup-verdaccio/generator.d.ts.map +1 -1
- package/src/generators/setup-verdaccio/generator.js +4 -7
- package/src/generators/typescript-sync/typescript-sync.js +3 -2
- package/src/plugins/jest/start-local-registry.js +3 -3
- package/src/plugins/typescript/plugin.d.ts.map +1 -1
- package/src/plugins/typescript/plugin.js +35 -30
- package/src/release/utils/update-lock-file.js +1 -1
- package/src/release/version-actions.js +1 -1
- package/src/utils/assets/copy-assets-handler.d.ts +3 -1
- package/src/utils/assets/copy-assets-handler.d.ts.map +1 -1
- package/src/utils/assets/copy-assets-handler.js +10 -41
- package/src/utils/assets/normalize-assets.d.ts +26 -0
- package/src/utils/assets/normalize-assets.d.ts.map +1 -0
- package/src/utils/assets/normalize-assets.js +47 -0
- package/src/utils/code-frames/highlight.js +4 -3
- package/src/utils/find-npm-dependencies.js +1 -1
- package/src/utils/generate-globs.js +2 -1
- package/src/utils/npm-config.js +1 -1
- package/src/utils/prettier.js +36 -3
- package/src/utils/swc/compile-swc.js +2 -2
- package/src/utils/typescript/run-type-check.js +8 -7
- package/src/utils/versions.d.ts +2 -2
- package/src/utils/versions.js +2 -2
package/migrations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"Backend"
|
|
20
20
|
],
|
|
21
21
|
"main": "src/index.js",
|
|
22
|
-
"
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"types": "src/index.d.ts",
|
|
23
24
|
"license": "MIT",
|
|
24
25
|
"bugs": {
|
|
25
26
|
"url": "https://github.com/nrwl/nx/issues"
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
"@babel/preset-env": "^7.23.2",
|
|
40
41
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
42
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "22.7.0-beta.
|
|
43
|
-
"@nx/workspace": "22.7.0-beta.
|
|
43
|
+
"@nx/devkit": "22.7.0-beta.10",
|
|
44
|
+
"@nx/workspace": "22.7.0-beta.10",
|
|
44
45
|
"@zkochan/js-yaml": "0.0.7",
|
|
45
46
|
"babel-plugin-const-enum": "^1.0.1",
|
|
46
47
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -53,14 +54,14 @@
|
|
|
53
54
|
"jsonc-parser": "3.2.0",
|
|
54
55
|
"npm-run-path": "^4.0.1",
|
|
55
56
|
"picocolors": "^1.1.0",
|
|
56
|
-
"picomatch": "4.0.
|
|
57
|
+
"picomatch": "4.0.4",
|
|
57
58
|
"semver": "^7.6.3",
|
|
58
59
|
"source-map-support": "0.5.19",
|
|
59
60
|
"tinyglobby": "^0.2.12",
|
|
60
61
|
"tslib": "^2.3.0"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"nx": "22.7.0-beta.
|
|
64
|
+
"nx": "22.7.0-beta.10"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
67
|
"verdaccio": "^6.0.5"
|
|
@@ -72,7 +73,5 @@
|
|
|
72
73
|
},
|
|
73
74
|
"publishConfig": {
|
|
74
75
|
"access": "public"
|
|
75
|
-
}
|
|
76
|
-
"types": "src/index.d.ts",
|
|
77
|
-
"type": "commonjs"
|
|
76
|
+
}
|
|
78
77
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.detectModuleFormat = detectModuleFormat;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const ts_config_1 = require("../../../utils/typescript/ts-config");
|
|
8
|
-
const ts = require("typescript");
|
|
9
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
9
10
|
function detectModuleFormat(options) {
|
|
10
11
|
if (options.buildOptions?.format) {
|
|
11
12
|
const formats = Array.isArray(options.buildOptions.format)
|
|
@@ -20,7 +20,7 @@ async function killTree(pid, signal) {
|
|
|
20
20
|
switch (process.platform) {
|
|
21
21
|
case 'win32':
|
|
22
22
|
(0, child_process_1.exec)('taskkill /pid ' + pid + ' /T /F', {
|
|
23
|
-
windowsHide:
|
|
23
|
+
windowsHide: true,
|
|
24
24
|
}, (error) => {
|
|
25
25
|
// Ignore Fatal errors (128) because it might be due to the process already being killed.
|
|
26
26
|
// On Linux/Mac we can check ESRCH (no such process), but on Windows we can't.
|
|
@@ -30,7 +30,7 @@ async function killTree(pid, signal) {
|
|
|
30
30
|
case 'darwin':
|
|
31
31
|
buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
|
|
32
32
|
return (0, child_process_1.spawn)('pgrep', ['-P', parentPid], {
|
|
33
|
-
windowsHide:
|
|
33
|
+
windowsHide: true,
|
|
34
34
|
});
|
|
35
35
|
}, function () {
|
|
36
36
|
killAll(tree, signal, callback);
|
|
@@ -39,7 +39,7 @@ async function killTree(pid, signal) {
|
|
|
39
39
|
default: // Linux
|
|
40
40
|
buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
|
|
41
41
|
return (0, child_process_1.spawn)('ps', ['-o', 'pid', '--no-headers', '--ppid', parentPid], {
|
|
42
|
-
windowsHide:
|
|
42
|
+
windowsHide: true,
|
|
43
43
|
});
|
|
44
44
|
}, function () {
|
|
45
45
|
killAll(tree, signal, callback);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nodeExecutor = nodeExecutor;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
6
|
const child_process_1 = require("child_process");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
8
9
|
const client_1 = require("nx/src/daemon/client/client");
|
|
9
10
|
const crypto_1 = require("crypto");
|
|
10
|
-
const path = require("path");
|
|
11
|
+
const path = tslib_1.__importStar(require("path"));
|
|
11
12
|
const path_1 = require("path");
|
|
12
13
|
const buildable_libs_utils_1 = require("../../utils/buildable-libs-utils");
|
|
13
14
|
const kill_tree_1 = require("./lib/kill-tree");
|
|
@@ -23,7 +24,7 @@ async function* nodeExecutor(options, context) {
|
|
|
23
24
|
const project = context.projectGraph.nodes[context.projectName];
|
|
24
25
|
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
|
|
25
26
|
if (!project.data.targets[buildTarget.target]) {
|
|
26
|
-
throw new Error(`Cannot find build target ${
|
|
27
|
+
throw new Error(`Cannot find build target ${chalk_1.default.bold(options.buildTarget)} for project ${chalk_1.default.bold(context.projectName)}`);
|
|
27
28
|
}
|
|
28
29
|
const buildTargetExecutor = project.data.targets[buildTarget.target]?.executor;
|
|
29
30
|
if (buildTargetExecutor === 'nx:run-commands') {
|
|
@@ -331,7 +332,7 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
331
332
|
return path.join(outputFilePath, 'main.js');
|
|
332
333
|
}
|
|
333
334
|
const fallbackFile = path.join('dist', project.data.root, 'main.js');
|
|
334
|
-
devkit_1.logger.warn(`Build option ${
|
|
335
|
+
devkit_1.logger.warn(`Build option ${chalk_1.default.bold('outputFileName')} not set for ${chalk_1.default.bold(project.name)}. Using fallback value of ${chalk_1.default.bold(fallbackFile)}.`);
|
|
335
336
|
return (0, path_1.join)(context.root, fallbackFile);
|
|
336
337
|
}
|
|
337
338
|
let outputFileName = buildOptions.outputFileName;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logTar = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
// Adapted from https://github.com/npm/cli/blob/c736b622b8504b07f5a19f631ade42dd40063269/lib/utils/tar.js
|
|
5
|
-
const
|
|
6
|
-
const
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
+
const columnify_1 = tslib_1.__importDefault(require("columnify"));
|
|
7
8
|
const format_bytes_1 = require("./format-bytes");
|
|
8
9
|
const logTar = (tarball, opts = {}) => {
|
|
9
10
|
// @ts-ignore
|
|
10
11
|
const { unicode = true } = opts;
|
|
11
12
|
console.log('');
|
|
12
13
|
console.log(`${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`);
|
|
13
|
-
console.log(
|
|
14
|
+
console.log(chalk_1.default.magenta('=== Tarball Contents ==='));
|
|
14
15
|
if (tarball.files.length) {
|
|
15
16
|
console.log('');
|
|
16
|
-
const columnData =
|
|
17
|
+
const columnData = (0, columnify_1.default)(tarball.files
|
|
17
18
|
.map((f) => {
|
|
18
19
|
const bytes = (0, format_bytes_1.formatBytes)(f.size, false);
|
|
19
20
|
return /^node_modules\//.test(f.path)
|
|
@@ -29,11 +30,11 @@ const logTar = (tarball, opts = {}) => {
|
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
if (tarball.bundled.length) {
|
|
32
|
-
console.log(
|
|
33
|
+
console.log(chalk_1.default.magenta('=== Bundled Dependencies ==='));
|
|
33
34
|
tarball.bundled.forEach((name) => console.log('', name));
|
|
34
35
|
}
|
|
35
|
-
console.log(
|
|
36
|
-
console.log(
|
|
36
|
+
console.log(chalk_1.default.magenta('=== Tarball Details ==='));
|
|
37
|
+
console.log((0, columnify_1.default)([
|
|
37
38
|
{ name: 'name:', value: tarball.name },
|
|
38
39
|
{ name: 'version:', value: tarball.version },
|
|
39
40
|
tarball.filename && { name: 'filename:', value: tarball.filename },
|
|
@@ -151,7 +151,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
151
151
|
env: processEnv(true),
|
|
152
152
|
cwd: context.root,
|
|
153
153
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
154
|
-
windowsHide:
|
|
154
|
+
windowsHide: true,
|
|
155
155
|
});
|
|
156
156
|
const resultJson = JSON.parse(result.toString());
|
|
157
157
|
const distTags = resultJson['dist-tags'] || {};
|
|
@@ -173,7 +173,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
173
173
|
env: processEnv(true),
|
|
174
174
|
cwd: context.root,
|
|
175
175
|
stdio: 'ignore',
|
|
176
|
-
windowsHide:
|
|
176
|
+
windowsHide: true,
|
|
177
177
|
});
|
|
178
178
|
console.log(`Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.\n`);
|
|
179
179
|
}
|
|
@@ -286,7 +286,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
286
286
|
env: processEnv(true),
|
|
287
287
|
cwd: context.root,
|
|
288
288
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
289
|
-
windowsHide:
|
|
289
|
+
windowsHide: true,
|
|
290
290
|
});
|
|
291
291
|
// If in dry-run mode, the version on disk will not represent the version that would be published, so we scrub it from the output to avoid confusion.
|
|
292
292
|
const dryRunVersionPlaceholder = 'X.X.X-dry-run';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compileTypescriptSolution = compileTypescriptSolution;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
5
|
-
const ts = require("typescript");
|
|
6
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
6
7
|
const get_custom_transformers_factory_1 = require("./get-custom-transformers-factory");
|
|
7
8
|
const typescript_diagnostic_reporters_1 = require("./typescript-diagnostic-reporters");
|
|
8
9
|
// https://github.com/microsoft/TypeScript/blob/d45012c5e2ab122919ee4777a7887307c5f4a1e0/src/compiler/diagnosticMessages.json#L4050-L4053
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatDiagnosticReport = formatDiagnosticReport;
|
|
4
4
|
exports.formatSolutionBuilderStatusReport = formatSolutionBuilderStatusReport;
|
|
5
|
-
const
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
6
7
|
// adapted from TS default diagnostic reporter
|
|
7
8
|
function formatDiagnosticReport(diagnostic, host) {
|
|
8
9
|
const diagnostics = new Array(1);
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.determineModuleFormatFromTsConfig = determineModuleFormatFromTsConfig;
|
|
4
4
|
exports.createTypeScriptCompilationOptions = createTypeScriptCompilationOptions;
|
|
5
5
|
exports.tscExecutor = tscExecutor;
|
|
6
|
-
const
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
7
8
|
const devkit_1 = require("@nx/devkit");
|
|
8
9
|
const fs_1 = require("fs");
|
|
9
10
|
const path_1 = require("path");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdaccio.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/verdaccio/verdaccio.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AAOrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAUnD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,eAAe;;;GAqDzB;
|
|
1
|
+
{"version":3,"file":"verdaccio.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/verdaccio/verdaccio.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AAOrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAUnD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,eAAe;;;GAqDzB;AAkTD,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verdaccioExecutor = verdaccioExecutor;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const child_process_1 = require("child_process");
|
|
7
|
-
const
|
|
8
|
+
const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
|
|
8
9
|
const node_fs_1 = require("node:fs");
|
|
9
10
|
const path_1 = require("path");
|
|
10
11
|
const semver_1 = require("semver");
|
|
@@ -32,7 +33,7 @@ async function verdaccioExecutor(options, context) {
|
|
|
32
33
|
console.log(`Cleared local registry storage folder ${options.storage}`);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
const port = await
|
|
36
|
+
const port = await (0, detect_port_1.default)(options.port);
|
|
36
37
|
if (port !== options.port) {
|
|
37
38
|
devkit_1.logger.info(`Port ${options.port} was occupied. Using port ${port}.`);
|
|
38
39
|
options.port = port;
|
|
@@ -116,7 +117,7 @@ function createVerdaccioOptions(options, workspaceRoot) {
|
|
|
116
117
|
}
|
|
117
118
|
function setupNpm(options) {
|
|
118
119
|
try {
|
|
119
|
-
(0, child_process_1.execSync)('npm --version', { env, windowsHide:
|
|
120
|
+
(0, child_process_1.execSync)('npm --version', { env, windowsHide: true });
|
|
120
121
|
}
|
|
121
122
|
catch (e) {
|
|
122
123
|
return () => { };
|
|
@@ -127,13 +128,13 @@ function setupNpm(options) {
|
|
|
127
128
|
scopes.forEach((scope) => {
|
|
128
129
|
const registryName = scope ? `${scope}:registry` : 'registry';
|
|
129
130
|
try {
|
|
130
|
-
npmRegistryPaths.push((0, child_process_1.execSync)(`npm config get ${registryName} --location ${options.location}`, { env, windowsHide:
|
|
131
|
+
npmRegistryPaths.push((0, child_process_1.execSync)(`npm config get ${registryName} --location ${options.location}`, { env, windowsHide: true })
|
|
131
132
|
?.toString()
|
|
132
133
|
?.trim()
|
|
133
134
|
?.replace('\u001b[2K\u001b[1G', '') // strip out ansi codes
|
|
134
135
|
);
|
|
135
|
-
(0, child_process_1.execSync)(`npm config set ${registryName} http://${options.listenAddress}:${options.port}/ --location ${options.location}`, { env, windowsHide:
|
|
136
|
-
(0, child_process_1.execSync)(`npm config set //${options.listenAddress}:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`, { env, windowsHide:
|
|
136
|
+
(0, child_process_1.execSync)(`npm config set ${registryName} http://${options.listenAddress}:${options.port}/ --location ${options.location}`, { env, windowsHide: true });
|
|
137
|
+
(0, child_process_1.execSync)(`npm config set //${options.listenAddress}:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`, { env, windowsHide: true });
|
|
137
138
|
devkit_1.logger.info(`Set npm ${registryName} to http://${options.listenAddress}:${options.port}/`);
|
|
138
139
|
}
|
|
139
140
|
catch (e) {
|
|
@@ -142,7 +143,7 @@ function setupNpm(options) {
|
|
|
142
143
|
});
|
|
143
144
|
return () => {
|
|
144
145
|
try {
|
|
145
|
-
const currentNpmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}`, { env, windowsHide:
|
|
146
|
+
const currentNpmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}`, { env, windowsHide: true })
|
|
146
147
|
?.toString()
|
|
147
148
|
?.trim()
|
|
148
149
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
|
@@ -150,18 +151,18 @@ function setupNpm(options) {
|
|
|
150
151
|
const registryName = scope ? `${scope}:registry` : 'registry';
|
|
151
152
|
if (npmRegistryPaths[index] &&
|
|
152
153
|
currentNpmRegistryPath.includes(options.listenAddress)) {
|
|
153
|
-
(0, child_process_1.execSync)(`npm config set ${registryName} ${npmRegistryPaths[index]} --location ${options.location}`, { env, windowsHide:
|
|
154
|
+
(0, child_process_1.execSync)(`npm config set ${registryName} ${npmRegistryPaths[index]} --location ${options.location}`, { env, windowsHide: true });
|
|
154
155
|
devkit_1.logger.info(`Reset npm ${registryName} to ${npmRegistryPaths[index]}`);
|
|
155
156
|
}
|
|
156
157
|
else {
|
|
157
158
|
(0, child_process_1.execSync)(`npm config delete ${registryName} --location ${options.location}`, {
|
|
158
159
|
env,
|
|
159
|
-
windowsHide:
|
|
160
|
+
windowsHide: true,
|
|
160
161
|
});
|
|
161
162
|
devkit_1.logger.info('Cleared custom npm registry');
|
|
162
163
|
}
|
|
163
164
|
});
|
|
164
|
-
(0, child_process_1.execSync)(`npm config delete //${options.listenAddress}:${options.port}/:_authToken --location ${options.location}`, { env, windowsHide:
|
|
165
|
+
(0, child_process_1.execSync)(`npm config delete //${options.listenAddress}:${options.port}/:_authToken --location ${options.location}`, { env, windowsHide: true });
|
|
165
166
|
}
|
|
166
167
|
catch (e) {
|
|
167
168
|
throw new Error(`Failed to reset npm registry: ${e.message}`);
|
|
@@ -176,17 +177,17 @@ function getYarnUnsafeHttpWhitelist(isYarnV1) {
|
|
|
176
177
|
return !isYarnV1
|
|
177
178
|
? new Set(JSON.parse((0, child_process_1.execSync)(`yarn config get unsafeHttpWhitelist --json`, {
|
|
178
179
|
env,
|
|
179
|
-
windowsHide:
|
|
180
|
+
windowsHide: true,
|
|
180
181
|
}).toString()))
|
|
181
182
|
: null;
|
|
182
183
|
}
|
|
183
184
|
function setYarnUnsafeHttpWhitelist(currentWhitelist, options) {
|
|
184
185
|
if (currentWhitelist.size > 0) {
|
|
185
|
-
(0, child_process_1.execSync)(`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(Array.from(currentWhitelist))}'` + (options.location === 'user' ? ' --home' : ''), { env, windowsHide:
|
|
186
|
+
(0, child_process_1.execSync)(`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(Array.from(currentWhitelist))}'` + (options.location === 'user' ? ' --home' : ''), { env, windowsHide: true });
|
|
186
187
|
}
|
|
187
188
|
else {
|
|
188
189
|
(0, child_process_1.execSync)(`yarn config unset unsafeHttpWhitelist` +
|
|
189
|
-
(options.location === 'user' ? ' --home' : ''), { env, windowsHide:
|
|
190
|
+
(options.location === 'user' ? ' --home' : ''), { env, windowsHide: true });
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
193
|
function setupYarn(options) {
|
|
@@ -195,9 +196,7 @@ function setupYarn(options) {
|
|
|
195
196
|
const scopes = ['', ...(options.scopes || [])];
|
|
196
197
|
try {
|
|
197
198
|
isYarnV1 =
|
|
198
|
-
(0, semver_1.major)((0, child_process_1.execSync)('yarn --version', { env, windowsHide:
|
|
199
|
-
.toString()
|
|
200
|
-
.trim()) === 1;
|
|
199
|
+
(0, semver_1.major)((0, child_process_1.execSync)('yarn --version', { env, windowsHide: true }).toString().trim()) === 1;
|
|
201
200
|
}
|
|
202
201
|
catch {
|
|
203
202
|
// This would fail if yarn is not installed which is okay
|
|
@@ -209,14 +208,14 @@ function setupYarn(options) {
|
|
|
209
208
|
const scopeName = scope ? `${scope}:` : '';
|
|
210
209
|
yarnRegistryPaths.push((0, child_process_1.execSync)(`yarn config get ${scopeName}${registryConfigName}`, {
|
|
211
210
|
env,
|
|
212
|
-
windowsHide:
|
|
211
|
+
windowsHide: true,
|
|
213
212
|
})
|
|
214
213
|
?.toString()
|
|
215
214
|
?.trim()
|
|
216
215
|
?.replace('\u001b[2K\u001b[1G', '') // strip out ansi codes
|
|
217
216
|
);
|
|
218
217
|
(0, child_process_1.execSync)(`yarn config set ${scopeName}${registryConfigName} http://${options.listenAddress}:${options.port}/` +
|
|
219
|
-
(options.location === 'user' ? ' --home' : ''), { env, windowsHide:
|
|
218
|
+
(options.location === 'user' ? ' --home' : ''), { env, windowsHide: true });
|
|
220
219
|
devkit_1.logger.info(`Set yarn ${scopeName}registry to http://${options.listenAddress}:${options.port}/`);
|
|
221
220
|
});
|
|
222
221
|
const currentWhitelist = getYarnUnsafeHttpWhitelist(isYarnV1);
|
|
@@ -229,7 +228,7 @@ function setupYarn(options) {
|
|
|
229
228
|
}
|
|
230
229
|
return () => {
|
|
231
230
|
try {
|
|
232
|
-
const currentYarnRegistryPath = (0, child_process_1.execSync)(`yarn config get ${registryConfigName}`, { env, windowsHide:
|
|
231
|
+
const currentYarnRegistryPath = (0, child_process_1.execSync)(`yarn config get ${registryConfigName}`, { env, windowsHide: true })
|
|
233
232
|
?.toString()
|
|
234
233
|
?.trim()
|
|
235
234
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
|
@@ -242,13 +241,13 @@ function setupYarn(options) {
|
|
|
242
241
|
(0, child_process_1.execSync)(`yarn config set ${registryName} ${yarnRegistryPaths[index]}` +
|
|
243
242
|
(options.location === 'user' ? ' --home' : ''), {
|
|
244
243
|
env,
|
|
245
|
-
windowsHide:
|
|
244
|
+
windowsHide: true,
|
|
246
245
|
});
|
|
247
246
|
devkit_1.logger.info(`Reset yarn ${registryName} to ${yarnRegistryPaths[index]}`);
|
|
248
247
|
}
|
|
249
248
|
else {
|
|
250
249
|
(0, child_process_1.execSync)(`yarn config ${isYarnV1 ? 'delete' : 'unset'} ${registryName}` +
|
|
251
|
-
(options.location === 'user' ? ' --home' : ''), { env, windowsHide:
|
|
250
|
+
(options.location === 'user' ? ' --home' : ''), { env, windowsHide: true });
|
|
252
251
|
devkit_1.logger.info(`Cleared custom yarn ${registryConfigName}`);
|
|
253
252
|
}
|
|
254
253
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,EAWjB,IAAI,EAKL,MAAM,YAAY,CAAC;AAyCpB,OAAO,KAAK,EAEV,sBAAsB,EACtB,iCAAiC,EAClC,MAAM,UAAU,CAAC;AASlB,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BAO/B;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BAqK/B;AA2HD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,iCAAiC,EAC/B,MAAM,GACN,QAAQ,GACR,aAAa,GACb,gBAAgB,GAChB,IAAI,GACJ,yBAAyB,GACzB,aAAa,GACb,SAAS,GACT,WAAW,GACX,yBAAyB,CAC5B,CAAC;AAEF,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA4G5B;AA+uBD,eAAe,gBAAgB,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
5
|
exports.addLint = addLint;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
8
9
|
const prompt_1 = require("@nx/devkit/src/generators/prompt");
|
|
@@ -21,7 +22,7 @@ const plugin_1 = require("../../utils/typescript/plugin");
|
|
|
21
22
|
const ts_config_1 = require("../../utils/typescript/ts-config");
|
|
22
23
|
const ts_solution_setup_1 = require("../../utils/typescript/ts-solution-setup");
|
|
23
24
|
const versions_1 = require("../../utils/versions");
|
|
24
|
-
const init_1 = require("../init/init");
|
|
25
|
+
const init_1 = tslib_1.__importDefault(require("../init/init"));
|
|
25
26
|
const add_release_config_1 = require("./utils/add-release-config");
|
|
26
27
|
const defaultOutputDirectory = 'dist';
|
|
27
28
|
async function libraryGenerator(tree, schema) {
|
|
@@ -649,7 +650,8 @@ function addProjectDependencies(tree, options) {
|
|
|
649
650
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
650
651
|
'@nx/esbuild': versions_1.nxVersion,
|
|
651
652
|
'@types/node': versions_1.typesNodeVersion,
|
|
652
|
-
esbuild:
|
|
653
|
+
esbuild: (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'esbuild') ??
|
|
654
|
+
versions_1.esbuildVersion,
|
|
653
655
|
});
|
|
654
656
|
}
|
|
655
657
|
else if (options.bundler == 'rollup') {
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addReleaseConfigForTsSolution = addReleaseConfigForTsSolution;
|
|
4
4
|
exports.addReleaseConfigForNonTsSolution = addReleaseConfigForNonTsSolution;
|
|
5
5
|
exports.releaseTasks = releaseTasks;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
|
|
8
|
-
const generator_1 = require("../../setup-verdaccio/generator");
|
|
9
|
+
const generator_1 = tslib_1.__importDefault(require("../../setup-verdaccio/generator"));
|
|
9
10
|
/**
|
|
10
11
|
* Adds release option in nx.json to build the project before versioning
|
|
11
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/setup-verdaccio/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAKzD,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/setup-verdaccio/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAKzD,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,6BAA6B,mDA0DvC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupVerdaccio = setupVerdaccio;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path = require("path");
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
7
|
const ts_solution_setup_1 = require("../../utils/typescript/ts-solution-setup");
|
|
7
8
|
const versions_1 = require("../../utils/versions");
|
|
8
|
-
const
|
|
9
|
+
const npm_config_1 = require("../../utils/npm-config");
|
|
9
10
|
async function setupVerdaccio(tree, options) {
|
|
10
11
|
if (!tree.exists('.verdaccio/config.yml')) {
|
|
11
12
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), '.verdaccio', {
|
|
12
|
-
npmUplinkRegistry: (0,
|
|
13
|
-
windowsHide: false,
|
|
14
|
-
})
|
|
15
|
-
?.toString()
|
|
16
|
-
?.trim() ?? 'https://registry.npmjs.org',
|
|
13
|
+
npmUplinkRegistry: (await (0, npm_config_1.getNpmRegistry)(tree.root)) ?? 'https://registry.npmjs.org',
|
|
17
14
|
});
|
|
18
15
|
}
|
|
19
16
|
const verdaccioTarget = {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.syncGenerator = syncGenerator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const ignore_1 = require("ignore");
|
|
6
|
+
const ignore_1 = tslib_1.__importDefault(require("ignore"));
|
|
6
7
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
7
8
|
const posix_1 = require("node:path/posix");
|
|
8
9
|
const sync_generators_1 = require("nx/src/utils/sync-generators");
|
|
9
|
-
const ts = require("typescript");
|
|
10
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
10
11
|
const COMMON_RUNTIME_TS_CONFIG_FILE_NAMES = [
|
|
11
12
|
'tsconfig.app.json',
|
|
12
13
|
'tsconfig.lib.json',
|
|
@@ -17,7 +17,7 @@ function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorag
|
|
|
17
17
|
throw new Error(`localRegistryTarget is required`);
|
|
18
18
|
}
|
|
19
19
|
return new Promise((resolve, reject) => {
|
|
20
|
-
const childProcess = (0, child_process_1.fork)(require.resolve('nx'), [
|
|
20
|
+
const childProcess = (0, child_process_1.fork)(require.resolve('nx/bin/nx'), [
|
|
21
21
|
...`run ${localRegistryTarget} --location none --clear ${clearStorage ?? true}`.split(' '),
|
|
22
22
|
...(storage ? [`--storage`, storage] : []),
|
|
23
23
|
], { stdio: 'pipe' });
|
|
@@ -34,7 +34,7 @@ function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorag
|
|
|
34
34
|
console.log(`Local registry started on ${registry}`);
|
|
35
35
|
process.env.npm_config_registry = registry;
|
|
36
36
|
(0, child_process_1.execSync)(`npm config set //${listenAddress}:${port}/:_authToken "${authToken}" --ws=false`, {
|
|
37
|
-
windowsHide:
|
|
37
|
+
windowsHide: true,
|
|
38
38
|
});
|
|
39
39
|
// bun
|
|
40
40
|
process.env.BUN_CONFIG_REGISTRY = registry;
|
|
@@ -48,7 +48,7 @@ function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorag
|
|
|
48
48
|
resolve(() => {
|
|
49
49
|
childProcess.kill();
|
|
50
50
|
(0, child_process_1.execSync)(`npm config delete //${listenAddress}:${port}/:_authToken --ws=false`, {
|
|
51
|
-
windowsHide:
|
|
51
|
+
windowsHide: true,
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
54
|
childProcess?.stdout?.off('data', listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AA8BpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EACN,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACN,KAAK,CAAC,EACF,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA0KD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA8FzD,CAAC;AAEF,eAAO,MAAM,WAAW,iCAAgB,CAAC"}
|
|
@@ -12,7 +12,6 @@ const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
|
12
12
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
13
13
|
const util_1 = require("./util");
|
|
14
14
|
let ts;
|
|
15
|
-
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
16
15
|
const TSCONFIG_CACHE_VERSION = 2;
|
|
17
16
|
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, 'tsconfig-files.hash');
|
|
18
17
|
// Module-level cache store — each invocation gets a unique Symbol key
|
|
@@ -123,6 +122,7 @@ exports.createNodesV2 = [
|
|
|
123
122
|
const cache = cacheStore.get(cacheKey);
|
|
124
123
|
initializeTsConfigCache(configFilePaths, context.workspaceRoot, cache);
|
|
125
124
|
const normalizedOptions = normalizePluginOptions(options);
|
|
125
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
126
126
|
const { configFilePaths: validConfigFilePaths, hashes, projectRoots, } = await resolveValidConfigFilesAndHashes(configFilePaths, normalizedOptions, optionsHash, context, cache);
|
|
127
127
|
try {
|
|
128
128
|
return await (0, devkit_1.createNodesFromFiles)((configFilePath, options, context, idx) => {
|
|
@@ -131,7 +131,7 @@ exports.createNodesV2 = [
|
|
|
131
131
|
const targetsCacheKey = `${hash}_${configFilePath}`;
|
|
132
132
|
const absolutePath = (0, node_path_1.join)(context.workspaceRoot, configFilePath);
|
|
133
133
|
const configContext = getConfigContext(absolutePath, context.workspaceRoot, cache);
|
|
134
|
-
targetsCache[targetsCacheKey] ??= buildTscTargets(configContext, options, context, validConfigFilePaths, cache);
|
|
134
|
+
targetsCache[targetsCacheKey] ??= buildTscTargets(configContext, options, context, validConfigFilePaths, cache, pmc);
|
|
135
135
|
const { targets } = targetsCache[targetsCacheKey];
|
|
136
136
|
return {
|
|
137
137
|
projects: {
|
|
@@ -244,7 +244,7 @@ function checkIfConfigFileShouldBeProject(config, cache) {
|
|
|
244
244
|
}
|
|
245
245
|
return true;
|
|
246
246
|
}
|
|
247
|
-
function buildTscTargets(config, options, context, configFiles, cache) {
|
|
247
|
+
function buildTscTargets(config, options, context, configFiles, cache, pmc) {
|
|
248
248
|
const targets = {};
|
|
249
249
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(config.project.root, context);
|
|
250
250
|
const tsConfig = retrieveTsConfigFromCache(config.absolutePath, context.workspaceRoot, cache);
|
|
@@ -257,7 +257,7 @@ function buildTscTargets(config, options, context, configFiles, cache) {
|
|
|
257
257
|
const targetName = options.typecheck.targetName;
|
|
258
258
|
const compiler = options.compiler;
|
|
259
259
|
if (!targets[targetName]) {
|
|
260
|
-
let command = `${compiler} --build --emitDeclarationOnly${options.verboseOutput ? ' --verbose' : ''}`;
|
|
260
|
+
let command = `${compiler} --build ${options.typecheck.configName} --emitDeclarationOnly${options.verboseOutput ? ' --verbose' : ''}`;
|
|
261
261
|
if (tsConfig.options.noEmit ||
|
|
262
262
|
Object.values(internalProjectReferences).some((ref) => ref.options.noEmit) ||
|
|
263
263
|
Object.values(externalProjectReferences).some((ref) => ref.options.noEmit)) {
|
|
@@ -460,11 +460,15 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
|
|
|
460
460
|
// the source files of dependencies. This correctly tracks build outputs from
|
|
461
461
|
// both external project references and same-project task dependencies (e.g.
|
|
462
462
|
// build-native producing .d.ts files that may be excluded from file watching
|
|
463
|
-
// via .nxignore
|
|
463
|
+
// via .nxignore. "*.d.ts" are also read from the deps projects sources.
|
|
464
464
|
inputs.push({
|
|
465
465
|
dependentTasksOutputFiles: '**/*.{d.ts,tsbuildinfo}',
|
|
466
466
|
transitive: true,
|
|
467
467
|
});
|
|
468
|
+
inputs.push({
|
|
469
|
+
fileset: '{projectRoot}/**/*.d.ts',
|
|
470
|
+
dependencies: true,
|
|
471
|
+
});
|
|
468
472
|
const externalRefPatterns = getExternalProjectReferenceTsconfigPatterns(tsConfig, internalProjectReferences, workspaceRoot, config.project, cache);
|
|
469
473
|
inputs.push(...externalRefPatterns);
|
|
470
474
|
// inputs.push({ externalDependencies });
|
|
@@ -492,10 +496,6 @@ function getOutputs(config, rootTsConfig, internalProjectReferences, workspaceRo
|
|
|
492
496
|
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.js.map`), workspaceRoot, config.project));
|
|
493
497
|
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.d.ts`), workspaceRoot, config.project));
|
|
494
498
|
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.d.ts.map`), workspaceRoot, config.project));
|
|
495
|
-
// https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
|
|
496
|
-
outputs.add(tsConfig.options.tsBuildInfoFile
|
|
497
|
-
? pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project)
|
|
498
|
-
: pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.tsbuildinfo`), workspaceRoot, config.project));
|
|
499
499
|
}
|
|
500
500
|
else if (tsConfig.options.outDir) {
|
|
501
501
|
if (emitDeclarationOnly) {
|
|
@@ -505,23 +505,12 @@ function getOutputs(config, rootTsConfig, internalProjectReferences, workspaceRo
|
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
else {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
outputs.add(pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project));
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
else if (tsConfig.options.rootDir && tsConfig.options.rootDir !== '.') {
|
|
518
|
-
// If rootDir is set, then the tsbuildinfo file will be outside the outDir so we need to add it.
|
|
519
|
-
const relativeRootDir = (0, node_path_1.relative)(tsConfig.options.rootDir, (0, node_path_1.join)(workspaceRoot, config.project.root));
|
|
520
|
-
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, relativeRootDir, `*.tsbuildinfo`), workspaceRoot, config.project));
|
|
521
|
-
}
|
|
522
|
-
else if (emitDeclarationOnly) {
|
|
523
|
-
// https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
|
|
524
|
-
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, `${configBaseNameNoExt}.tsbuildinfo`), workspaceRoot, config.project));
|
|
508
|
+
// List specific tsc output extensions instead of claiming the
|
|
509
|
+
// entire outDir, so other tasks that write into the same
|
|
510
|
+
// directory (e.g. copy-assets for .node/.wasm files) don't
|
|
511
|
+
// have their outputs captured by the tsc build cache.
|
|
512
|
+
const jsonExt = tsConfig.options.resolveJsonModule ? ',json' : '';
|
|
513
|
+
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, `**/*.{js,cjs,mjs,jsx${jsonExt},d.ts,d.cts,d.mts}{,.map}`), workspaceRoot, config.project));
|
|
525
514
|
}
|
|
526
515
|
}
|
|
527
516
|
else if (tsConfig.raw?.include?.length ||
|
|
@@ -540,14 +529,30 @@ function getOutputs(config, rootTsConfig, internalProjectReferences, workspaceRo
|
|
|
540
529
|
outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.d.ts.map'));
|
|
541
530
|
outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.d.cts.map'));
|
|
542
531
|
outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.d.mts.map'));
|
|
543
|
-
// https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
|
|
544
|
-
outputs.add(tsConfig.options.tsBuildInfoFile
|
|
545
|
-
? pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project)
|
|
546
|
-
: (0, devkit_1.joinPathFragments)('{projectRoot}', `${configBaseNameNoExt}.tsbuildinfo`));
|
|
547
532
|
}
|
|
533
|
+
// tsc --build always produces a tsbuildinfo file.
|
|
534
|
+
outputs.add(getTsBuildInfoOutputPath(tsConfig, configBaseNameNoExt, workspaceRoot, config.project));
|
|
548
535
|
});
|
|
549
536
|
return Array.from(outputs);
|
|
550
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Returns the path to the tsbuildinfo file that tsc --build will produce.
|
|
540
|
+
* tsc always emits this file in build mode (incremental is implicit).
|
|
541
|
+
*/
|
|
542
|
+
function getTsBuildInfoOutputPath(tsConfig, configBaseNameNoExt, workspaceRoot, project) {
|
|
543
|
+
if (tsConfig.options.tsBuildInfoFile) {
|
|
544
|
+
return pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, project);
|
|
545
|
+
}
|
|
546
|
+
if (tsConfig.options.outFile) {
|
|
547
|
+
const outFileName = (0, node_path_1.basename)(tsConfig.options.outFile, '.js');
|
|
548
|
+
const outDir = (0, node_path_1.relative)(workspaceRoot, (0, node_path_1.dirname)(tsConfig.options.outFile));
|
|
549
|
+
return pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.tsbuildinfo`), workspaceRoot, project);
|
|
550
|
+
}
|
|
551
|
+
if (tsConfig.options.outDir) {
|
|
552
|
+
return pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, `${configBaseNameNoExt}.tsbuildinfo`), workspaceRoot, project);
|
|
553
|
+
}
|
|
554
|
+
return (0, devkit_1.joinPathFragments)('{projectRoot}', `${configBaseNameNoExt}.tsbuildinfo`);
|
|
555
|
+
}
|
|
551
556
|
function pathToInputOrOutput(path, workspaceRoot, project) {
|
|
552
557
|
const fullProjectRoot = project.absolute;
|
|
553
558
|
const fullPath = (0, node_path_1.resolve)(workspaceRoot, path);
|
|
@@ -62,7 +62,7 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
62
62
|
// Must be non-blocking async to allow spinner to render
|
|
63
63
|
currentVersion = await new Promise((resolve, reject) => {
|
|
64
64
|
(0, node_child_process_1.exec)(`npm view ${packageName} version --"${registryConfigKey}=${registry}" --tag=${tag}`, {
|
|
65
|
-
windowsHide:
|
|
65
|
+
windowsHide: true,
|
|
66
66
|
}, (error, stdout, stderr) => {
|
|
67
67
|
if (error) {
|
|
68
68
|
return reject(error);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { AssetGlob } from './assets';
|
|
2
|
+
import { normalizeAssets, getAssetOutputPath, NormalizedAssetEntry as AssetEntry } from './normalize-assets';
|
|
2
3
|
import { ChangedFile } from 'nx/src/daemon/client/client';
|
|
4
|
+
export type { AssetEntry };
|
|
5
|
+
export { normalizeAssets, getAssetOutputPath };
|
|
3
6
|
export type FileEventType = 'create' | 'update' | 'delete';
|
|
4
7
|
export interface FileEvent {
|
|
5
8
|
type: FileEventType;
|
|
@@ -32,5 +35,4 @@ export declare class CopyAssetsHandler {
|
|
|
32
35
|
private filesToEvent;
|
|
33
36
|
private normalizeAssetPattern;
|
|
34
37
|
}
|
|
35
|
-
export {};
|
|
36
38
|
//# sourceMappingURL=copy-assets-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-assets-handler.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/copy-assets-handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"copy-assets-handler.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/copy-assets-handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,oBAAoB,IAAI,UAAU,EACnC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAC;AAGxE,YAAY,EAAE,UAAU,EAAE,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,uBAAuB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IACzC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,uBAAuB,GAAI,QAAQ,SAAS,EAAE,SAiB1D,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IACzD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;gBAElC,IAAI,EAAE,uBAAuB;IA2BnC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB3C,wBAAwB,IAAI,IAAI;IAgBhC,OAAO,CAAC,yBAAyB;IAa3B,4BAA4B,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;IA2BnD,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC9D,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,qBAAqB;CAG9B"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CopyAssetsHandler = exports.defaultFileEventHandler = void 0;
|
|
3
|
+
exports.CopyAssetsHandler = exports.defaultFileEventHandler = exports.getAssetOutputPath = exports.normalizeAssets = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const picomatch = require("picomatch");
|
|
5
6
|
const node_fs_1 = require("node:fs");
|
|
6
|
-
const pathPosix = require("node:path/posix");
|
|
7
|
-
const path = require("node:path");
|
|
8
|
-
const ignore_1 = require("ignore");
|
|
7
|
+
const pathPosix = tslib_1.__importStar(require("node:path/posix"));
|
|
8
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
9
|
+
const ignore_1 = tslib_1.__importDefault(require("ignore"));
|
|
9
10
|
const tinyglobby_1 = require("tinyglobby");
|
|
11
|
+
const normalize_assets_1 = require("./normalize-assets");
|
|
12
|
+
Object.defineProperty(exports, "normalizeAssets", { enumerable: true, get: function () { return normalize_assets_1.normalizeAssets; } });
|
|
13
|
+
Object.defineProperty(exports, "getAssetOutputPath", { enumerable: true, get: function () { return normalize_assets_1.getAssetOutputPath; } });
|
|
10
14
|
const devkit_1 = require("@nx/devkit");
|
|
11
15
|
const client_1 = require("nx/src/daemon/client/client");
|
|
12
16
|
const picocolors_1 = require("picocolors");
|
|
@@ -48,40 +52,7 @@ class CopyAssetsHandler {
|
|
|
48
52
|
if ((0, node_fs_1.existsSync)(nxignore)) {
|
|
49
53
|
this.ignore.add((0, node_fs_1.readFileSync)(nxignore).toString());
|
|
50
54
|
}
|
|
51
|
-
this.assetGlobs = opts.assets.
|
|
52
|
-
let isGlob = false;
|
|
53
|
-
let pattern;
|
|
54
|
-
// Input and output directories are normalized to be relative to root
|
|
55
|
-
let input;
|
|
56
|
-
let output;
|
|
57
|
-
let ignore = null;
|
|
58
|
-
let includeIgnoredFiles = undefined;
|
|
59
|
-
const resolvedOutputDir = path.isAbsolute(opts.outputDir)
|
|
60
|
-
? opts.outputDir
|
|
61
|
-
: path.resolve(opts.rootDir, opts.outputDir);
|
|
62
|
-
if (typeof f === 'string') {
|
|
63
|
-
pattern = f;
|
|
64
|
-
input = path.relative(opts.rootDir, opts.projectDir);
|
|
65
|
-
output = path.relative(opts.rootDir, resolvedOutputDir);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
isGlob = true;
|
|
69
|
-
pattern = pathPosix.join(f.input, f.glob);
|
|
70
|
-
input = f.input;
|
|
71
|
-
output = pathPosix.join(path.relative(opts.rootDir, resolvedOutputDir), f.output);
|
|
72
|
-
if (f.ignore)
|
|
73
|
-
ignore = f.ignore.map((ig) => pathPosix.join(f.input, ig));
|
|
74
|
-
includeIgnoredFiles = f.includeIgnoredFiles;
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
isGlob,
|
|
78
|
-
input,
|
|
79
|
-
pattern,
|
|
80
|
-
ignore,
|
|
81
|
-
output,
|
|
82
|
-
includeIgnoredFiles,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
55
|
+
this.assetGlobs = (0, normalize_assets_1.normalizeAssets)(opts.assets, opts.rootDir, opts.projectDir, opts.outputDir);
|
|
85
56
|
}
|
|
86
57
|
async processAllAssetsOnce() {
|
|
87
58
|
await Promise.all(this.assetGlobs.map(async (ag) => {
|
|
@@ -180,12 +151,10 @@ class CopyAssetsHandler {
|
|
|
180
151
|
if (!assetGlob.ignore?.some((ig) => picomatch(ig)(src)) &&
|
|
181
152
|
((assetGlob.includeIgnoredFiles ?? this.includeIgnoredFiles) ||
|
|
182
153
|
!this.ignore.ignores(src))) {
|
|
183
|
-
const relPath = path.relative(assetGlob.input, src);
|
|
184
|
-
const dest = relPath.startsWith('..') ? src : relPath;
|
|
185
154
|
acc.push({
|
|
186
155
|
type: 'create',
|
|
187
156
|
src: path.join(this.rootDir, src),
|
|
188
|
-
dest: path.join(this.rootDir,
|
|
157
|
+
dest: path.join(this.rootDir, (0, normalize_assets_1.getAssetOutputPath)(src, assetGlob)),
|
|
189
158
|
});
|
|
190
159
|
}
|
|
191
160
|
return acc;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface AssetGlobInput {
|
|
2
|
+
input: string;
|
|
3
|
+
output: string;
|
|
4
|
+
glob: string;
|
|
5
|
+
ignore?: string[];
|
|
6
|
+
includeIgnoredFiles?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface NormalizedAssetEntry {
|
|
9
|
+
isGlob: boolean;
|
|
10
|
+
pattern: string;
|
|
11
|
+
ignore: string[] | null;
|
|
12
|
+
input: string;
|
|
13
|
+
output: string;
|
|
14
|
+
includeIgnoredFiles?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Normalize raw asset definitions (strings or objects) into resolved
|
|
18
|
+
* entries with computed input, output, and pattern fields.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeAssets(assets: (string | AssetGlobInput)[], rootDir: string, projectDir: string, outputDir: string): NormalizedAssetEntry[];
|
|
21
|
+
/**
|
|
22
|
+
* Compute the output path for a file given its asset entry,
|
|
23
|
+
* matching the dest logic used during file copying.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAssetOutputPath(src: string, assetEntry: NormalizedAssetEntry): string;
|
|
26
|
+
//# sourceMappingURL=normalize-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-assets.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/normalize-assets.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,EACnC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,oBAAoB,EAAE,CA8BxB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,oBAAoB,GAC/B,MAAM,CAIR"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeAssets = normalizeAssets;
|
|
4
|
+
exports.getAssetOutputPath = getAssetOutputPath;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
7
|
+
const pathPosix = tslib_1.__importStar(require("node:path/posix"));
|
|
8
|
+
/**
|
|
9
|
+
* Normalize raw asset definitions (strings or objects) into resolved
|
|
10
|
+
* entries with computed input, output, and pattern fields.
|
|
11
|
+
*/
|
|
12
|
+
function normalizeAssets(assets, rootDir, projectDir, outputDir) {
|
|
13
|
+
const resolvedOutputDir = path.isAbsolute(outputDir)
|
|
14
|
+
? outputDir
|
|
15
|
+
: path.resolve(rootDir, outputDir);
|
|
16
|
+
return assets.map((f) => {
|
|
17
|
+
if (typeof f === 'string') {
|
|
18
|
+
return {
|
|
19
|
+
isGlob: false,
|
|
20
|
+
pattern: f,
|
|
21
|
+
input: path.relative(rootDir, projectDir),
|
|
22
|
+
output: path.relative(rootDir, resolvedOutputDir),
|
|
23
|
+
ignore: null,
|
|
24
|
+
includeIgnoredFiles: undefined,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
isGlob: true,
|
|
29
|
+
pattern: pathPosix.join(f.input, f.glob),
|
|
30
|
+
input: f.input,
|
|
31
|
+
output: pathPosix.join(path.relative(rootDir, resolvedOutputDir), f.output),
|
|
32
|
+
ignore: f.ignore
|
|
33
|
+
? f.ignore.map((ig) => pathPosix.join(f.input, ig))
|
|
34
|
+
: null,
|
|
35
|
+
includeIgnoredFiles: f.includeIgnoredFiles,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Compute the output path for a file given its asset entry,
|
|
41
|
+
* matching the dest logic used during file copying.
|
|
42
|
+
*/
|
|
43
|
+
function getAssetOutputPath(src, assetEntry) {
|
|
44
|
+
const relPath = path.relative(assetEntry.input, src);
|
|
45
|
+
const dest = relPath.startsWith('..') ? src : relPath;
|
|
46
|
+
return pathPosix.join(assetEntry.output, dest);
|
|
47
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.highlight = highlight;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-highlight/src/index.js
|
|
5
|
-
const jsTokens = require("js-tokens");
|
|
6
|
-
const
|
|
6
|
+
const jsTokens = tslib_1.__importStar(require("js-tokens"));
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
8
|
const identifiers_1 = require("./identifiers");
|
|
8
9
|
/**
|
|
9
10
|
* Chalk styles for token types.
|
|
@@ -80,6 +81,6 @@ function highlightTokens(defs, text) {
|
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
function highlight(code) {
|
|
83
|
-
const defs = getDefs(
|
|
84
|
+
const defs = getDefs(chalk_1.default);
|
|
84
85
|
return highlightTokens(defs, code);
|
|
85
86
|
}
|
|
@@ -150,7 +150,7 @@ function collectHelperDependencies(workspaceRoot, sourceProject, projectGraph, b
|
|
|
150
150
|
}
|
|
151
151
|
// For inferred targets or manually added run-commands, check if user is using `tsc` in build target.
|
|
152
152
|
if (target.executor === 'nx:run-commands' &&
|
|
153
|
-
/\
|
|
153
|
+
/\b(tsc|tsgo)\b/.test(target.options.command)) {
|
|
154
154
|
const tsConfigFileName = (0, ts_config_1.getRootTsConfigFileName)();
|
|
155
155
|
if (tsConfigFileName) {
|
|
156
156
|
const tsConfig = (0, ts_config_1.readTsConfig)((0, path_1.join)(workspaceRoot, tsConfigFileName));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const workspace_root_1 = require("nx/src/utils/workspace-root");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
8
9
|
const project_graph_utils_1 = require("nx/src/utils/project-graph-utils");
|
|
9
10
|
const fs_1 = require("fs");
|
|
10
|
-
const ignore_1 = require("ignore");
|
|
11
|
+
const ignore_1 = tslib_1.__importDefault(require("ignore"));
|
|
11
12
|
const find_project_for_path_1 = require("nx/src/project-graph/utils/find-project-for-path");
|
|
12
13
|
function configureIgnore() {
|
|
13
14
|
let ig;
|
package/src/utils/npm-config.js
CHANGED
|
@@ -76,7 +76,7 @@ async function getNpmConfigValue(key, cwd) {
|
|
|
76
76
|
async function execAsync(command, cwd) {
|
|
77
77
|
// Must be non-blocking async to allow spinner to render
|
|
78
78
|
return new Promise((resolve, reject) => {
|
|
79
|
-
(0, child_process_1.exec)(command, { cwd, windowsHide:
|
|
79
|
+
(0, child_process_1.exec)(command, { cwd, windowsHide: true }, (error, stdout, stderr) => {
|
|
80
80
|
if (error) {
|
|
81
81
|
return reject((stderr ? `${stderr}\n` : '') + error);
|
|
82
82
|
}
|
package/src/utils/prettier.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.resolveUserExistingPrettierConfig = resolveUserExistingPrettierConfig;
|
|
4
37
|
exports.generatePrettierSetup = generatePrettierSetup;
|
|
@@ -8,7 +41,7 @@ const versions_1 = require("./versions");
|
|
|
8
41
|
async function resolveUserExistingPrettierConfig() {
|
|
9
42
|
let prettier;
|
|
10
43
|
try {
|
|
11
|
-
prettier = await Promise.resolve().then(() => require('prettier'));
|
|
44
|
+
prettier = await Promise.resolve().then(() => __importStar(require('prettier')));
|
|
12
45
|
}
|
|
13
46
|
catch {
|
|
14
47
|
return null;
|
|
@@ -78,7 +111,7 @@ function generatePrettierSetup(tree, options) {
|
|
|
78
111
|
async function resolvePrettierConfigPath(tree) {
|
|
79
112
|
let prettier;
|
|
80
113
|
try {
|
|
81
|
-
prettier = await Promise.resolve().then(() => require('prettier'));
|
|
114
|
+
prettier = await Promise.resolve().then(() => __importStar(require('prettier')));
|
|
82
115
|
}
|
|
83
116
|
catch {
|
|
84
117
|
return null;
|
|
@@ -119,7 +152,7 @@ async function resolvePrettierConfigPath(tree) {
|
|
|
119
152
|
}
|
|
120
153
|
// check the package.yaml file
|
|
121
154
|
if (tree.exists('package.yaml')) {
|
|
122
|
-
const { load } = await Promise.resolve().then(() => require('@zkochan/js-yaml'));
|
|
155
|
+
const { load } = await Promise.resolve().then(() => __importStar(require('@zkochan/js-yaml')));
|
|
123
156
|
const packageYaml = load(tree.read('package.yaml', 'utf-8'));
|
|
124
157
|
if (packageYaml.prettier) {
|
|
125
158
|
return 'package.yaml';
|
|
@@ -60,7 +60,7 @@ async function compileSwc(context, normalizedOptions, postCompilationCallback) {
|
|
|
60
60
|
const swcCmdLog = (0, node_child_process_1.execSync)(getSwcCmd(normalizedOptions), {
|
|
61
61
|
encoding: 'utf8',
|
|
62
62
|
cwd: normalizedOptions.swcCliOptions.swcCwd,
|
|
63
|
-
windowsHide:
|
|
63
|
+
windowsHide: true,
|
|
64
64
|
stdio: 'pipe',
|
|
65
65
|
});
|
|
66
66
|
devkit_1.logger.log(swcCmdLog.replace(/\n/, ''));
|
|
@@ -109,7 +109,7 @@ async function* compileSwcWatch(context, normalizedOptions, postCompilationCallb
|
|
|
109
109
|
let watcherOnExit;
|
|
110
110
|
const swcWatcher = (0, node_child_process_1.exec)(getSwcCmd(normalizedOptions, true), {
|
|
111
111
|
cwd: normalizedOptions.swcCliOptions.swcCwd,
|
|
112
|
-
windowsHide:
|
|
112
|
+
windowsHide: true,
|
|
113
113
|
});
|
|
114
114
|
processOnExit = () => {
|
|
115
115
|
swcWatcher.kill();
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runTypeCheckWatch = runTypeCheckWatch;
|
|
4
4
|
exports.runTypeCheck = runTypeCheck;
|
|
5
5
|
exports.getFormattedDiagnostic = getFormattedDiagnostic;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
9
|
const code_frames_1 = require("nx/src/utils/code-frames");
|
|
9
10
|
const highlight_1 = require("../code-frames/highlight");
|
|
10
11
|
const ts_config_1 = require("../../utils/typescript/ts-config");
|
|
@@ -56,7 +57,7 @@ async function runTypeCheck(options) {
|
|
|
56
57
|
return getTypeCheckResult(ts, allDiagnostics, workspaceRoot, config.fileNames.length, program.getSourceFiles().length, incremental);
|
|
57
58
|
}
|
|
58
59
|
async function setupTypeScript(options) {
|
|
59
|
-
const ts = await Promise.resolve().then(() => require('typescript'));
|
|
60
|
+
const ts = await Promise.resolve().then(() => tslib_1.__importStar(require('typescript')));
|
|
60
61
|
const { workspaceRoot, tsConfigPath, cacheDir, incremental, projectRoot } = options;
|
|
61
62
|
const config = (0, ts_config_1.readTsConfig)(tsConfigPath);
|
|
62
63
|
if (config.errors.length) {
|
|
@@ -103,17 +104,17 @@ function getFormattedDiagnostic(ts, workspaceRoot, diagnostic) {
|
|
|
103
104
|
const category = diagnostic.category;
|
|
104
105
|
switch (category) {
|
|
105
106
|
case ts.DiagnosticCategory.Warning: {
|
|
106
|
-
message += `${
|
|
107
|
+
message += `${chalk_1.default.yellow.bold('warning')} ${chalk_1.default.gray(`TS${diagnostic.code}`)}: `;
|
|
107
108
|
break;
|
|
108
109
|
}
|
|
109
110
|
case ts.DiagnosticCategory.Error: {
|
|
110
|
-
message += `${
|
|
111
|
+
message += `${chalk_1.default.red.bold('error')} ${chalk_1.default.gray(`TS${diagnostic.code}`)}: `;
|
|
111
112
|
break;
|
|
112
113
|
}
|
|
113
114
|
case ts.DiagnosticCategory.Suggestion:
|
|
114
115
|
case ts.DiagnosticCategory.Message:
|
|
115
116
|
default: {
|
|
116
|
-
message += `${
|
|
117
|
+
message += `${chalk_1.default.cyan.bold(category === 2 ? 'suggestion' : 'info')}: `;
|
|
117
118
|
break;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
@@ -124,7 +125,7 @@ function getFormattedDiagnostic(ts, workspaceRoot, diagnostic) {
|
|
|
124
125
|
const column = pos.character + 1;
|
|
125
126
|
const fileName = path.relative(workspaceRoot, diagnostic.file.fileName);
|
|
126
127
|
message =
|
|
127
|
-
`${
|
|
128
|
+
`${chalk_1.default.underline.blue(`${fileName}:${line}:${column}`)} - ` + message;
|
|
128
129
|
const code = diagnostic.file.getFullText(diagnostic.file.getSourceFile());
|
|
129
130
|
message +=
|
|
130
131
|
'\n' +
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
|
-
export declare const esbuildVersion = "^0.
|
|
2
|
+
export declare const esbuildVersion = "^0.27.0";
|
|
3
3
|
export declare const prettierVersion = "~3.6.2";
|
|
4
4
|
export declare const swcCliVersion = "~0.8.0";
|
|
5
5
|
export declare const swcCoreVersion = "~1.15.5";
|
|
@@ -7,7 +7,7 @@ export declare const swcHelpersVersion = "~0.5.18";
|
|
|
7
7
|
export declare const swcNodeVersion = "~1.11.1";
|
|
8
8
|
export declare const tsLibVersion = "^2.3.0";
|
|
9
9
|
export declare const typesNodeVersion = "20.19.9";
|
|
10
|
-
export declare const verdaccioVersion = "^6.
|
|
10
|
+
export declare const verdaccioVersion = "^6.3.2";
|
|
11
11
|
export declare const typescriptVersion = "~5.9.2";
|
|
12
12
|
/**
|
|
13
13
|
* The minimum version is currently determined from the lowest version
|
package/src/utils/versions.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.supportedTypescriptVersions = exports.typescriptVersion = exports.verdaccioVersion = exports.typesNodeVersion = exports.tsLibVersion = exports.swcNodeVersion = exports.swcHelpersVersion = exports.swcCoreVersion = exports.swcCliVersion = exports.prettierVersion = exports.esbuildVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
|
-
exports.esbuildVersion = '^0.
|
|
5
|
+
exports.esbuildVersion = '^0.27.0';
|
|
6
6
|
exports.prettierVersion = '~3.6.2';
|
|
7
7
|
exports.swcCliVersion = '~0.8.0';
|
|
8
8
|
exports.swcCoreVersion = '~1.15.5';
|
|
@@ -10,7 +10,7 @@ exports.swcHelpersVersion = '~0.5.18';
|
|
|
10
10
|
exports.swcNodeVersion = '~1.11.1';
|
|
11
11
|
exports.tsLibVersion = '^2.3.0';
|
|
12
12
|
exports.typesNodeVersion = '20.19.9';
|
|
13
|
-
exports.verdaccioVersion = '^6.
|
|
13
|
+
exports.verdaccioVersion = '^6.3.2';
|
|
14
14
|
// Typescript
|
|
15
15
|
exports.typescriptVersion = '~5.9.2';
|
|
16
16
|
/**
|