@nx/js 22.2.0 → 22.2.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/package.json +4 -4
- package/src/executors/release-publish/release-publish.impl.d.ts.map +1 -1
- package/src/executors/release-publish/release-publish.impl.js +16 -0
- package/src/executors/tsc/tsc.impl.d.ts +1 -1
- package/src/executors/tsc/tsc.impl.d.ts.map +1 -1
- package/src/executors/tsc/tsc.impl.js +30 -3
- package/src/plugins/typescript/plugin.d.ts +1 -0
- package/src/plugins/typescript/plugin.d.ts.map +1 -1
- package/src/plugins/typescript/plugin.js +9 -4
- package/src/utils/assets/copy-assets-handler.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "22.2.
|
|
3
|
+
"version": "22.2.2",
|
|
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": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.23.2",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "22.2.
|
|
43
|
-
"@nx/workspace": "22.2.
|
|
42
|
+
"@nx/devkit": "22.2.2",
|
|
43
|
+
"@nx/workspace": "22.2.2",
|
|
44
44
|
"@zkochan/js-yaml": "0.0.7",
|
|
45
45
|
"babel-plugin-const-enum": "^1.0.1",
|
|
46
46
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"tslib": "^2.3.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"nx": "22.2.
|
|
63
|
+
"nx": "22.2.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"verdaccio": "^6.0.5"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-publish.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/release-publish/release-publish.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAiBjD,wBAA8B,WAAW,CACvC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,eAAe;;
|
|
1
|
+
{"version":3,"file":"release-publish.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/release-publish/release-publish.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAiBjD,wBAA8B,WAAW,CACvC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,eAAe;;GAsYzB"}
|
|
@@ -155,12 +155,20 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
155
155
|
!(err.stderr?.toString().includes('E404') &&
|
|
156
156
|
err.stderr?.toString().includes('no such package available'))) {
|
|
157
157
|
console.error('npm dist-tag add error:');
|
|
158
|
+
// npm returns error.summary and error.detail
|
|
158
159
|
if (stdoutData.error?.summary) {
|
|
159
160
|
console.error(stdoutData.error.summary);
|
|
160
161
|
}
|
|
161
162
|
if (stdoutData.error?.detail) {
|
|
162
163
|
console.error(stdoutData.error.detail);
|
|
163
164
|
}
|
|
165
|
+
// pnpm returns error.code and error.message
|
|
166
|
+
if (stdoutData.error?.code && !stdoutData.error?.summary) {
|
|
167
|
+
console.error(`Error code: ${stdoutData.error.code}`);
|
|
168
|
+
}
|
|
169
|
+
if (stdoutData.error?.message && !stdoutData.error?.summary) {
|
|
170
|
+
console.error(stdoutData.error.message);
|
|
171
|
+
}
|
|
164
172
|
if (context.isVerbose) {
|
|
165
173
|
console.error('npm dist-tag add stdout:');
|
|
166
174
|
console.error(JSON.stringify(stdoutData, null, 2));
|
|
@@ -285,12 +293,20 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
285
293
|
}
|
|
286
294
|
const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
|
|
287
295
|
console.error(`${pm} publish error:`);
|
|
296
|
+
// npm returns error.summary and error.detail
|
|
288
297
|
if (stdoutData.error?.summary) {
|
|
289
298
|
console.error(stdoutData.error.summary);
|
|
290
299
|
}
|
|
291
300
|
if (stdoutData.error?.detail) {
|
|
292
301
|
console.error(stdoutData.error.detail);
|
|
293
302
|
}
|
|
303
|
+
// pnpm returns error.code and error.message
|
|
304
|
+
if (stdoutData.error?.code && !stdoutData.error?.summary) {
|
|
305
|
+
console.error(`Error code: ${stdoutData.error.code}`);
|
|
306
|
+
}
|
|
307
|
+
if (stdoutData.error?.message && !stdoutData.error?.summary) {
|
|
308
|
+
console.error(stdoutData.error.message);
|
|
309
|
+
}
|
|
294
310
|
if (context.isVerbose) {
|
|
295
311
|
console.error(`${pm} publish stdout:`);
|
|
296
312
|
console.error(JSON.stringify(stdoutData, null, 2));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { TypeScriptCompilationOptions } from '@nx/workspace/src/utilities/typescript/compilation';
|
|
3
3
|
import { ExecutorOptions, NormalizedExecutorOptions } from '../../utils/schema';
|
|
4
|
-
export declare function determineModuleFormatFromTsConfig(absolutePathToTsConfig: string): 'cjs' | 'esm';
|
|
4
|
+
export declare function determineModuleFormatFromTsConfig(absolutePathToTsConfig: string, projectRoot?: string, workspaceRoot?: string): 'cjs' | 'esm';
|
|
5
5
|
export declare function createTypeScriptCompilationOptions(normalizedOptions: NormalizedExecutorOptions, context: ExecutorContext): TypeScriptCompilationOptions;
|
|
6
6
|
export declare function tscExecutor(_options: ExecutorOptions, context: ExecutorContext): AsyncGenerator<import("../../utils/typescript/compile-typescript-files").TypescriptCompilationResult, any, any>;
|
|
7
7
|
export default tscExecutor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsc.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/tsc/tsc.impl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"tsc.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/tsc/tsc.impl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAKhB,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAQvG,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAOhF,wBAAgB,iCAAiC,CAC/C,sBAAsB,EAAE,MAAM,EAC9B,WAAW,CAAC,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,GACrB,KAAK,GAAG,KAAK,CAkCf;AAED,wBAAgB,kCAAkC,CAChD,iBAAiB,EAAE,yBAAyB,EAC5C,OAAO,EAAE,eAAe,GACvB,4BAA4B,CAa9B;AAED,wBAAuB,WAAW,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,eAAe,mHAqHzB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -5,6 +5,8 @@ exports.createTypeScriptCompilationOptions = createTypeScriptCompilationOptions;
|
|
|
5
5
|
exports.tscExecutor = tscExecutor;
|
|
6
6
|
const ts = require("typescript");
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
8
10
|
const copy_assets_handler_1 = require("../../utils/assets/copy-assets-handler");
|
|
9
11
|
const check_dependencies_1 = require("../../utils/check-dependencies");
|
|
10
12
|
const compiler_helper_dependency_1 = require("../../utils/compiler-helper-dependency");
|
|
@@ -14,8 +16,29 @@ const watch_for_single_file_changes_1 = require("../../utils/watch-for-single-fi
|
|
|
14
16
|
const lib_1 = require("./lib");
|
|
15
17
|
const ts_config_1 = require("../../utils/typescript/ts-config");
|
|
16
18
|
const create_entry_points_1 = require("../../utils/package-json/create-entry-points");
|
|
17
|
-
function determineModuleFormatFromTsConfig(absolutePathToTsConfig) {
|
|
19
|
+
function determineModuleFormatFromTsConfig(absolutePathToTsConfig, projectRoot, workspaceRoot) {
|
|
18
20
|
const tsConfig = (0, ts_config_1.readTsConfig)(absolutePathToTsConfig);
|
|
21
|
+
// NodeNext is context-dependent - check package.json type field
|
|
22
|
+
// NodeNext outputs ESM only when package.json has "type": "module"
|
|
23
|
+
// Otherwise it outputs CJS (when "type": "commonjs" or no type field)
|
|
24
|
+
if (tsConfig.options.module === ts.ModuleKind.NodeNext) {
|
|
25
|
+
if (projectRoot && workspaceRoot) {
|
|
26
|
+
const packageJsonPath = (0, path_1.join)(workspaceRoot, projectRoot, 'package.json');
|
|
27
|
+
if ((0, fs_1.existsSync)(packageJsonPath)) {
|
|
28
|
+
try {
|
|
29
|
+
const packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
|
|
30
|
+
if (packageJson.type === 'module') {
|
|
31
|
+
return 'esm';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Fall through to default CJS
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// NodeNext defaults to CJS when no type field or when we can't check
|
|
40
|
+
return 'cjs';
|
|
41
|
+
}
|
|
19
42
|
if (tsConfig.options.module === ts.ModuleKind.ES2015 ||
|
|
20
43
|
tsConfig.options.module === ts.ModuleKind.ES2020 ||
|
|
21
44
|
tsConfig.options.module === ts.ModuleKind.ES2022 ||
|
|
@@ -63,7 +86,9 @@ async function* tscExecutor(_options, context) {
|
|
|
63
86
|
(0, update_package_json_1.updatePackageJson)({
|
|
64
87
|
...options,
|
|
65
88
|
additionalEntryPoints: (0, create_entry_points_1.createEntryPoints)(options.additionalEntryPoints, context.root),
|
|
66
|
-
format: [
|
|
89
|
+
format: [
|
|
90
|
+
determineModuleFormatFromTsConfig(options.tsConfig, options.projectRoot, context.root),
|
|
91
|
+
],
|
|
67
92
|
}, context, target, dependencies);
|
|
68
93
|
}
|
|
69
94
|
});
|
|
@@ -79,7 +104,9 @@ async function* tscExecutor(_options, context) {
|
|
|
79
104
|
disposePackageJsonChanges = await (0, watch_for_single_file_changes_1.watchForSingleFileChanges)(context.projectName, options.projectRoot, 'package.json', () => (0, update_package_json_1.updatePackageJson)({
|
|
80
105
|
...options,
|
|
81
106
|
additionalEntryPoints: (0, create_entry_points_1.createEntryPoints)(options.additionalEntryPoints, context.root),
|
|
82
|
-
format: [
|
|
107
|
+
format: [
|
|
108
|
+
determineModuleFormatFromTsConfig(options.tsConfig, options.projectRoot, context.root),
|
|
109
|
+
],
|
|
83
110
|
}, context, target, dependencies));
|
|
84
111
|
}
|
|
85
112
|
const handleTermination = async (exitCode) => {
|
|
@@ -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;AAgCpB,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EACN,OAAO,GACP;QACE,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;
|
|
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;AAgCpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EACN,OAAO,GACP;QACE,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;AAmKD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA6EzD,CAAC;AAEF,eAAO,MAAM,WAAW,iCAAgB,CAAC"}
|
|
@@ -244,8 +244,9 @@ function buildTscTargets(config, options, context, configFiles) {
|
|
|
244
244
|
internalProjectReferences = resolveInternalProjectReferences(tsConfig, context.workspaceRoot, config.project);
|
|
245
245
|
const externalProjectReferences = resolveShallowExternalProjectReferences(tsConfig, context.workspaceRoot, config.project);
|
|
246
246
|
const targetName = options.typecheck.targetName;
|
|
247
|
+
const compiler = options.compiler;
|
|
247
248
|
if (!targets[targetName]) {
|
|
248
|
-
let command =
|
|
249
|
+
let command = `${compiler} --build --emitDeclarationOnly${options.verboseOutput ? ' --verbose' : ''}`;
|
|
249
250
|
if (tsConfig.options.noEmit ||
|
|
250
251
|
Object.values(internalProjectReferences).some((ref) => ref.options.noEmit) ||
|
|
251
252
|
Object.values(externalProjectReferences).some((ref) => ref.options.noEmit)) {
|
|
@@ -279,7 +280,7 @@ function buildTscTargets(config, options, context, configFiles) {
|
|
|
279
280
|
technologies: ['typescript'],
|
|
280
281
|
description: 'Runs type-checking for the project.',
|
|
281
282
|
help: {
|
|
282
|
-
command: `${pmc.exec}
|
|
283
|
+
command: `${pmc.exec} ${compiler} --build --help`,
|
|
283
284
|
example: {
|
|
284
285
|
args: ['--force'],
|
|
285
286
|
},
|
|
@@ -295,9 +296,10 @@ function buildTscTargets(config, options, context, configFiles) {
|
|
|
295
296
|
(0, util_1.isValidPackageJsonBuildConfig)(tsConfig, context.workspaceRoot, config.project.root))) {
|
|
296
297
|
internalProjectReferences ??= resolveInternalProjectReferences(tsConfig, context.workspaceRoot, config.project);
|
|
297
298
|
const targetName = options.build.targetName;
|
|
299
|
+
const compiler = options.compiler;
|
|
298
300
|
targets[targetName] = {
|
|
299
301
|
dependsOn: [`^${targetName}`],
|
|
300
|
-
command:
|
|
302
|
+
command: `${compiler} --build ${options.build.configName}${options.verboseOutput ? ' --verbose' : ''}`,
|
|
301
303
|
options: { cwd: config.project.root },
|
|
302
304
|
cache: true,
|
|
303
305
|
inputs: getInputs(namedInputs, config, tsConfig, internalProjectReferences, context.workspaceRoot),
|
|
@@ -309,7 +311,7 @@ function buildTscTargets(config, options, context, configFiles) {
|
|
|
309
311
|
technologies: ['typescript'],
|
|
310
312
|
description: 'Builds the project with `tsc`.',
|
|
311
313
|
help: {
|
|
312
|
-
command: `${pmc.exec}
|
|
314
|
+
command: `${pmc.exec} ${compiler} --build --help`,
|
|
313
315
|
example: {
|
|
314
316
|
args: ['--force'],
|
|
315
317
|
},
|
|
@@ -743,6 +745,8 @@ function readTsConfig(tsConfigPath, workspaceRoot) {
|
|
|
743
745
|
return ts.parseJsonConfigFileContent(readResult.config, tsSys, (0, node_path_1.dirname)(tsConfigPath));
|
|
744
746
|
}
|
|
745
747
|
function normalizePluginOptions(pluginOptions = {}) {
|
|
748
|
+
const defaultCompiler = 'tsc';
|
|
749
|
+
const compiler = pluginOptions.compiler ?? defaultCompiler;
|
|
746
750
|
const defaultTypecheckTargetName = 'typecheck';
|
|
747
751
|
let typecheck = {
|
|
748
752
|
targetName: defaultTypecheckTargetName,
|
|
@@ -779,6 +783,7 @@ function normalizePluginOptions(pluginOptions = {}) {
|
|
|
779
783
|
};
|
|
780
784
|
}
|
|
781
785
|
return {
|
|
786
|
+
compiler,
|
|
782
787
|
typecheck,
|
|
783
788
|
build,
|
|
784
789
|
verboseOutput: pluginOptions.verboseOutput ?? false,
|
|
@@ -27,7 +27,7 @@ const defaultFileEventHandler = (events) => {
|
|
|
27
27
|
}
|
|
28
28
|
const eventDir = path.dirname(event.src);
|
|
29
29
|
const relativeDest = path.relative(eventDir, event.dest);
|
|
30
|
-
devkit_1.logger.
|
|
30
|
+
devkit_1.logger.verbose(`\n${(0, picocolors_1.dim)(relativeDest)}`);
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
exports.defaultFileEventHandler = defaultFileEventHandler;
|