@nx/js 18.1.0-beta.0 → 18.1.0-beta.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "18.1.0-beta.
|
|
3
|
+
"version": "18.1.0-beta.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": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"semver": "^7.5.3",
|
|
58
58
|
"source-map-support": "0.5.19",
|
|
59
59
|
"tslib": "^2.3.0",
|
|
60
|
-
"@nx/devkit": "18.1.0-beta.
|
|
61
|
-
"@nx/workspace": "18.1.0-beta.
|
|
62
|
-
"@nrwl/js": "18.1.0-beta.
|
|
60
|
+
"@nx/devkit": "18.1.0-beta.2",
|
|
61
|
+
"@nx/workspace": "18.1.0-beta.2",
|
|
62
|
+
"@nrwl/js": "18.1.0-beta.2"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -42,7 +42,7 @@ function normalizeOptions(options, root, sourceRoot, projectRoot) {
|
|
|
42
42
|
// default to current directory if projectRootParts is [].
|
|
43
43
|
// Eg: when a project is at the root level, outside of layout dir
|
|
44
44
|
const swcCwd = projectRootParts.join('/') || '.';
|
|
45
|
-
const swcrcPath = (0, get_swcrc_path_1.getSwcrcPath)(options, root, projectRoot);
|
|
45
|
+
const { swcrcPath, tmpSwcrcPath } = (0, get_swcrc_path_1.getSwcrcPath)(options, root, projectRoot);
|
|
46
46
|
const swcCliOptions = {
|
|
47
47
|
srcPath: projectDir,
|
|
48
48
|
destPath: (0, path_1.relative)((0, path_1.join)(root, swcCwd), outputPath),
|
|
@@ -60,6 +60,7 @@ function normalizeOptions(options, root, sourceRoot, projectRoot) {
|
|
|
60
60
|
outputPath,
|
|
61
61
|
tsConfig: (0, path_1.join)(root, options.tsConfig),
|
|
62
62
|
swcCliOptions,
|
|
63
|
+
tmpSwcrcPath,
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
async function* swcExecutor(_options, context) {
|
|
@@ -79,14 +80,11 @@ async function* swcExecutor(_options, context) {
|
|
|
79
80
|
// remap paths for SWC compilation
|
|
80
81
|
options.swcCliOptions.srcPath = options.swcCliOptions.swcCwd;
|
|
81
82
|
options.swcCliOptions.swcCwd = '.';
|
|
82
|
-
options.swcCliOptions.destPath = options.swcCliOptions.destPath
|
|
83
|
-
.split('../')
|
|
84
|
-
.at(-1)
|
|
85
|
-
.concat('/', options.swcCliOptions.srcPath);
|
|
83
|
+
options.swcCliOptions.destPath = (0, path_1.join)(options.swcCliOptions.destPath.split((0, path_1.normalize)('../')).at(-1), options.swcCliOptions.srcPath);
|
|
86
84
|
// tmp swcrc with dependencies to exclude
|
|
87
85
|
// - buildable libraries
|
|
88
86
|
// - other libraries that are not dependent on the current project
|
|
89
|
-
options.swcCliOptions.swcrcPath = (0, inline_2.generateTmpSwcrc)(inlineProjectGraph, options.swcCliOptions.swcrcPath);
|
|
87
|
+
options.swcCliOptions.swcrcPath = (0, inline_2.generateTmpSwcrc)(inlineProjectGraph, options.swcCliOptions.swcrcPath, options.tmpSwcrcPath);
|
|
90
88
|
}
|
|
91
89
|
function determineModuleFormatFromSwcrc(absolutePathToSwcrc) {
|
|
92
90
|
const swcrc = (0, devkit_1.readJsonFile)(absolutePathToSwcrc);
|
|
@@ -136,7 +134,8 @@ async function* swcExecutor(_options, context) {
|
|
|
136
134
|
}
|
|
137
135
|
exports.swcExecutor = swcExecutor;
|
|
138
136
|
function removeTmpSwcrc(swcrcPath) {
|
|
139
|
-
if (swcrcPath.includes(
|
|
137
|
+
if (swcrcPath.includes((0, path_1.normalize)('tmp/')) &&
|
|
138
|
+
swcrcPath.includes('.generated.swcrc')) {
|
|
140
139
|
(0, fs_extra_1.removeSync)((0, path_1.dirname)(swcrcPath));
|
|
141
140
|
}
|
|
142
141
|
}
|
package/src/utils/schema.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { SwcExecutorOptions } from '../schema';
|
|
2
|
-
export declare function getSwcrcPath(options: SwcExecutorOptions, contextRoot: string, projectRoot: string):
|
|
2
|
+
export declare function getSwcrcPath(options: SwcExecutorOptions, contextRoot: string, projectRoot: string): {
|
|
3
|
+
swcrcPath: string;
|
|
4
|
+
tmpSwcrcPath: string;
|
|
5
|
+
};
|
|
@@ -3,8 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getSwcrcPath = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
function getSwcrcPath(options, contextRoot, projectRoot) {
|
|
6
|
-
|
|
6
|
+
const swcrcPath = options.swcrc
|
|
7
7
|
? (0, path_1.join)(contextRoot, options.swcrc)
|
|
8
8
|
: (0, path_1.join)(contextRoot, projectRoot, '.swcrc');
|
|
9
|
+
const tmpSwcrcPath = (0, path_1.join)(contextRoot, projectRoot, 'tmp', '.generated.swcrc');
|
|
10
|
+
return {
|
|
11
|
+
swcrcPath,
|
|
12
|
+
tmpSwcrcPath,
|
|
13
|
+
};
|
|
9
14
|
}
|
|
10
15
|
exports.getSwcrcPath = getSwcrcPath;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { InlineProjectGraph } from '../inline';
|
|
2
|
-
export declare function generateTmpSwcrc(inlineProjectGraph: InlineProjectGraph, swcrcPath: string): string;
|
|
2
|
+
export declare function generateTmpSwcrc(inlineProjectGraph: InlineProjectGraph, swcrcPath: string, tmpSwcrcPath: string): string;
|
package/src/utils/swc/inline.js
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateTmpSwcrc = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function generateTmpSwcrc(inlineProjectGraph, swcrcPath) {
|
|
5
|
+
function generateTmpSwcrc(inlineProjectGraph, swcrcPath, tmpSwcrcPath) {
|
|
6
6
|
const swcrc = (0, devkit_1.readJsonFile)(swcrcPath);
|
|
7
7
|
swcrc['exclude'] = swcrc['exclude'].concat(Object.values(inlineProjectGraph.externals).map((external) => `${external.root}/**/.*.ts$`), 'node_modules/**/*.ts$');
|
|
8
|
-
const tmpSwcrcPath = `tmp${swcrcPath}`;
|
|
9
8
|
(0, devkit_1.writeJsonFile)(tmpSwcrcPath, swcrc);
|
|
10
9
|
return tmpSwcrcPath;
|
|
11
10
|
}
|