@nx/js 16.6.0-beta.7 → 16.6.0
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": "16.6.0
|
|
3
|
+
"version": "16.6.0",
|
|
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,9 +39,9 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.22.9",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nrwl/js": "16.6.0
|
|
43
|
-
"@nx/devkit": "16.6.0
|
|
44
|
-
"@nx/workspace": "16.6.0
|
|
42
|
+
"@nrwl/js": "16.6.0",
|
|
43
|
+
"@nx/devkit": "16.6.0",
|
|
44
|
+
"@nx/workspace": "16.6.0",
|
|
45
45
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
46
46
|
"babel-plugin-const-enum": "^1.0.1",
|
|
47
47
|
"babel-plugin-macros": "^2.8.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"types": "./src/index.d.ts",
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "d02a8dbf06c85de78c0c76f64a17f10ae8085739"
|
|
75
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const Module = require('module');
|
|
2
|
-
const url = require('url');
|
|
2
|
+
const url = require('node:url');
|
|
3
3
|
const originalLoader = Module._load;
|
|
4
4
|
const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
5
5
|
const mappings = JSON.parse(process.env.NX_MAPPINGS);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import {
|
|
3
|
-
export declare function normalizeOptions(options: SwcExecutorOptions, contextRoot: string, sourceRoot?: string, projectRoot?: string): NormalizedSwcExecutorOptions;
|
|
2
|
+
import { SwcExecutorOptions } from '../../utils/schema';
|
|
4
3
|
export declare function swcExecutor(_options: SwcExecutorOptions, context: ExecutorContext): AsyncGenerator<{
|
|
5
4
|
success: boolean;
|
|
6
5
|
outfile?: undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.swcExecutor =
|
|
3
|
+
exports.swcExecutor = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const assets_1 = require("../../utils/assets/assets");
|
|
6
6
|
const fs_extra_1 = require("fs-extra");
|
|
@@ -13,8 +13,8 @@ const package_json_1 = require("../../utils/package-json");
|
|
|
13
13
|
const compile_swc_1 = require("../../utils/swc/compile-swc");
|
|
14
14
|
const get_swcrc_path_1 = require("../../utils/swc/get-swcrc-path");
|
|
15
15
|
const inline_2 = require("../../utils/swc/inline");
|
|
16
|
-
function normalizeOptions(options,
|
|
17
|
-
const outputPath = (0, path_1.join)(
|
|
16
|
+
function normalizeOptions(options, root, sourceRoot, projectRoot) {
|
|
17
|
+
const outputPath = (0, path_1.join)(root, options.outputPath);
|
|
18
18
|
if (options.skipTypeCheck == null) {
|
|
19
19
|
options.skipTypeCheck = false;
|
|
20
20
|
}
|
|
@@ -33,25 +33,20 @@ function normalizeOptions(options, contextRoot, sourceRoot, projectRoot) {
|
|
|
33
33
|
options.external = firstItem;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const files = (0, assets_1.assetGlobsToFiles)(options.assets,
|
|
37
|
-
const
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
const projectDir = projectRootParts.pop();
|
|
41
|
-
// default to current directory if projectRootParts is [].
|
|
42
|
-
// Eg: when a project is at the root level, outside of layout dir
|
|
43
|
-
const swcCwd = projectRootParts.join('/') || '.';
|
|
44
|
-
const swcrcPath = (0, get_swcrc_path_1.getSwcrcPath)(options, contextRoot, projectRoot);
|
|
36
|
+
const files = (0, assets_1.assetGlobsToFiles)(options.assets, root, outputPath);
|
|
37
|
+
const swcrcPath = (0, get_swcrc_path_1.getSwcrcPath)(options, root, projectRoot);
|
|
38
|
+
// TODO(meeroslav): Check why this is needed in order for swc to properly nest folders
|
|
39
|
+
const distParent = outputPath.split('/').slice(0, -1).join('/');
|
|
45
40
|
const swcCliOptions = {
|
|
46
|
-
srcPath:
|
|
47
|
-
destPath: (0, path_1.relative)(
|
|
48
|
-
swcCwd,
|
|
41
|
+
srcPath: projectRoot,
|
|
42
|
+
destPath: (0, path_1.relative)(root, distParent),
|
|
49
43
|
swcrcPath,
|
|
50
44
|
};
|
|
51
|
-
return Object.assign(Object.assign({}, options), { mainOutputPath: (0, path_1.resolve)(outputPath, options.main.replace(`${projectRoot}/`, '').replace('.ts', '.js')), files,
|
|
52
|
-
|
|
45
|
+
return Object.assign(Object.assign({}, options), { mainOutputPath: (0, path_1.resolve)(outputPath, options.main.replace(`${projectRoot}/`, '').replace('.ts', '.js')), files,
|
|
46
|
+
root,
|
|
47
|
+
sourceRoot,
|
|
48
|
+
projectRoot, originalProjectRoot: projectRoot, outputPath, tsConfig: (0, path_1.join)(root, options.tsConfig), swcCliOptions });
|
|
53
49
|
}
|
|
54
|
-
exports.normalizeOptions = normalizeOptions;
|
|
55
50
|
function swcExecutor(_options, context) {
|
|
56
51
|
return tslib_1.__asyncGenerator(this, arguments, function* swcExecutor_1() {
|
|
57
52
|
const { sourceRoot, root } = context.projectsConfigurations.projects[context.projectName];
|
|
@@ -67,13 +62,8 @@ function swcExecutor(_options, context) {
|
|
|
67
62
|
const inlineProjectGraph = (0, inline_1.handleInliningBuild)(context, options, options.tsConfig);
|
|
68
63
|
if (!(0, inline_1.isInlineGraphEmpty)(inlineProjectGraph)) {
|
|
69
64
|
options.projectRoot = '.'; // set to root of workspace to include other libs for type check
|
|
70
|
-
//
|
|
71
|
-
options.swcCliOptions.
|
|
72
|
-
options.swcCliOptions.swcCwd = '.';
|
|
73
|
-
options.swcCliOptions.destPath = options.swcCliOptions.destPath
|
|
74
|
-
.split('../')
|
|
75
|
-
.at(-1)
|
|
76
|
-
.concat('/', options.swcCliOptions.srcPath);
|
|
65
|
+
options.swcCliOptions.srcPath = root.split('/').slice(0, -1).join('/'); // set to root of libraries to include other libs
|
|
66
|
+
options.swcCliOptions.destPath = (0, path_1.join)(_options.outputPath, options.swcCliOptions.srcPath); // new destPath is dist/{libs}/{parentLib}/{libs}
|
|
77
67
|
// tmp swcrc with dependencies to exclude
|
|
78
68
|
// - buildable libraries
|
|
79
69
|
// - other libraries that are not dependent on the current project
|
|
@@ -9,7 +9,8 @@ const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
|
9
9
|
const print_diagnostics_1 = require("../typescript/print-diagnostics");
|
|
10
10
|
const run_type_check_1 = require("../typescript/run-type-check");
|
|
11
11
|
function getSwcCmd({ swcrcPath, srcPath, destPath }, watch = false) {
|
|
12
|
-
|
|
12
|
+
const packageManager = (0, devkit_1.getPackageManagerCommand)();
|
|
13
|
+
let swcCmd = `${packageManager.exec} swc ${
|
|
13
14
|
// TODO(jack): clean this up when we remove inline module support
|
|
14
15
|
// Handle root project
|
|
15
16
|
srcPath === '.' ? 'src' : srcPath} -d ${destPath} --config-file=${swcrcPath}`;
|
|
@@ -32,14 +33,13 @@ function getTypeCheckOptions(normalizedOptions) {
|
|
|
32
33
|
}
|
|
33
34
|
function compileSwc(context, normalizedOptions, postCompilationCallback) {
|
|
34
35
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const isRootProject = context.projectGraph.nodes[context.projectName].data.root === '.';
|
|
36
36
|
devkit_1.logger.log(`Compiling with SWC for ${context.projectName}...`);
|
|
37
37
|
if (normalizedOptions.clean) {
|
|
38
38
|
(0, fs_extra_1.removeSync)(normalizedOptions.outputPath);
|
|
39
39
|
}
|
|
40
40
|
const swcCmdLog = (0, child_process_1.execSync)(getSwcCmd(normalizedOptions.swcCliOptions), {
|
|
41
|
-
|
|
42
|
-
})
|
|
41
|
+
encoding: 'utf8',
|
|
42
|
+
});
|
|
43
43
|
devkit_1.logger.log(swcCmdLog.replace(/\n/, ''));
|
|
44
44
|
const isCompileSuccess = swcCmdLog.includes('Successfully compiled');
|
|
45
45
|
if (normalizedOptions.skipTypeCheck) {
|