@nx/js 22.2.1 → 22.3.0-canary.20251211-205daee
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.3.0-canary.20251211-205daee",
|
|
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.
|
|
43
|
-
"@nx/workspace": "22.
|
|
42
|
+
"@nx/devkit": "22.3.0-canary.20251211-205daee",
|
|
43
|
+
"@nx/workspace": "22.3.0-canary.20251211-205daee",
|
|
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.
|
|
63
|
+
"nx": "22.3.0-canary.20251211-205daee"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"verdaccio": "^6.0.5"
|
|
@@ -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) => {
|