@nx/js 19.7.3 → 19.7.5
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 -5
- package/src/executors/swc/swc.impl.js +2 -2
- package/src/executors/verdaccio/verdaccio.impl.js +3 -3
- package/src/generators/release-version/release-version.js +2 -2
- package/src/plugins/typescript/plugin.js +4 -0
- package/src/utils/assets/copy-assets-handler.js +9 -9
- package/src/utils/inline.js +8 -9
- package/src/utils/package-json/update-package-json.js +3 -4
- package/src/utils/swc/compile-swc.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "19.7.
|
|
3
|
+
"version": "19.7.5",
|
|
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": "19.7.
|
|
43
|
-
"@nx/workspace": "19.7.
|
|
42
|
+
"@nx/devkit": "19.7.5",
|
|
43
|
+
"@nx/workspace": "19.7.5",
|
|
44
44
|
"babel-plugin-const-enum": "^1.0.1",
|
|
45
45
|
"babel-plugin-macros": "^2.8.0",
|
|
46
46
|
"babel-plugin-transform-typescript-metadata": "^0.3.1",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"columnify": "^1.6.0",
|
|
49
49
|
"detect-port": "^1.5.1",
|
|
50
50
|
"fast-glob": "3.2.7",
|
|
51
|
-
"fs-extra": "^11.1.0",
|
|
52
51
|
"ignore": "^5.0.4",
|
|
53
52
|
"js-tokens": "^4.0.0",
|
|
54
53
|
"jsonc-parser": "3.2.0",
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"ts-node": "10.9.1",
|
|
62
61
|
"tsconfig-paths": "^4.1.2",
|
|
63
62
|
"tslib": "^2.3.0",
|
|
64
|
-
"@nrwl/js": "19.7.
|
|
63
|
+
"@nrwl/js": "19.7.5"
|
|
65
64
|
},
|
|
66
65
|
"peerDependencies": {
|
|
67
66
|
"verdaccio": "^5.0.4"
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.swcExecutor = swcExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const assets_1 = require("../../utils/assets/assets");
|
|
6
|
-
const fs_extra_1 = require("fs-extra");
|
|
7
6
|
const fast_glob_1 = require("fast-glob");
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const assets_2 = require("../../utils/assets");
|
|
10
10
|
const check_dependencies_1 = require("../../utils/check-dependencies");
|
|
@@ -129,7 +129,7 @@ async function* swcExecutor(_options, context) {
|
|
|
129
129
|
function removeTmpSwcrc(swcrcPath) {
|
|
130
130
|
if (swcrcPath.includes((0, path_1.normalize)('tmp/')) &&
|
|
131
131
|
swcrcPath.includes('.generated.swcrc')) {
|
|
132
|
-
(0,
|
|
132
|
+
(0, node_fs_1.rmSync)((0, path_1.dirname)(swcrcPath), { recursive: true, force: true });
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
function createEntryPoints(options, context) {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verdaccioExecutor = verdaccioExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const fs_extra_1 = require("fs-extra");
|
|
6
5
|
const child_process_1 = require("child_process");
|
|
7
6
|
const detectPort = require("detect-port");
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const semver_1 = require("semver");
|
|
10
10
|
let childProcess;
|
|
@@ -26,8 +26,8 @@ async function verdaccioExecutor(options, context) {
|
|
|
26
26
|
}
|
|
27
27
|
if (options.storage) {
|
|
28
28
|
options.storage = (0, path_1.resolve)(context.root, options.storage);
|
|
29
|
-
if (options.clear && (0,
|
|
30
|
-
(0,
|
|
29
|
+
if (options.clear && (0, node_fs_1.existsSync)(options.storage)) {
|
|
30
|
+
(0, node_fs_1.rmSync)(options.storage, { recursive: true, force: true });
|
|
31
31
|
console.log(`Cleared local registry storage folder ${options.storage}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.releaseVersionGenerator = releaseVersionGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
|
-
const fs_extra_1 = require("fs-extra");
|
|
7
6
|
const node_child_process_1 = require("node:child_process");
|
|
7
|
+
const promises_1 = require("node:fs/promises");
|
|
8
8
|
const node_path_1 = require("node:path");
|
|
9
9
|
const config_1 = require("nx/src/command-line/release/config/config");
|
|
10
10
|
const git_1 = require("nx/src/command-line/release/utils/git");
|
|
@@ -338,7 +338,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
338
338
|
(options.releaseGroup.resolvedVersionPlans || []).forEach((p) => {
|
|
339
339
|
deleteVersionPlanCallbacks.push(async (dryRun) => {
|
|
340
340
|
if (!dryRun) {
|
|
341
|
-
await (0,
|
|
341
|
+
await (0, promises_1.rm)(p.absolutePath, { recursive: true, force: true });
|
|
342
342
|
// the relative path is easier to digest, so use that for
|
|
343
343
|
// git operations and logging
|
|
344
344
|
return [p.relativePath];
|
|
@@ -56,6 +56,10 @@ exports.createNodes = [
|
|
|
56
56
|
async function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
57
57
|
const projectRoot = (0, node_path_1.dirname)(configFilePath);
|
|
58
58
|
const fullConfigPath = (0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath);
|
|
59
|
+
// Do not create a project for the workspace root tsconfig files.
|
|
60
|
+
if (projectRoot === '.') {
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
59
63
|
// Do not create a project if package.json and project.json isn't there.
|
|
60
64
|
const siblingFiles = (0, node_fs_1.readdirSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot));
|
|
61
65
|
if (!siblingFiles.includes('package.json') &&
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CopyAssetsHandler = exports.defaultFileEventHandler = void 0;
|
|
4
4
|
const minimatch_1 = require("minimatch");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
5
6
|
const pathPosix = require("node:path/posix");
|
|
6
7
|
const path = require("node:path");
|
|
7
|
-
const fse = require("fs-extra");
|
|
8
8
|
const ignore_1 = require("ignore");
|
|
9
9
|
const fg = require("fast-glob");
|
|
10
10
|
const devkit_1 = require("@nx/devkit");
|
|
11
11
|
const client_1 = require("nx/src/daemon/client/client");
|
|
12
12
|
const defaultFileEventHandler = (events) => {
|
|
13
13
|
const dirs = new Set(events.map((event) => path.dirname(event.dest)));
|
|
14
|
-
dirs.forEach((d) =>
|
|
14
|
+
dirs.forEach((d) => (0, node_fs_1.mkdirSync)(d, { recursive: true }));
|
|
15
15
|
events.forEach((event) => {
|
|
16
16
|
if (event.type === 'create' || event.type === 'update') {
|
|
17
|
-
if (
|
|
18
|
-
|
|
17
|
+
if ((0, node_fs_1.lstatSync)(event.src).isFile()) {
|
|
18
|
+
(0, node_fs_1.copyFileSync)(event.src, event.dest);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
else if (event.type === 'delete') {
|
|
22
|
-
|
|
22
|
+
(0, node_fs_1.rmSync)(event.dest, { recursive: true, force: true });
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
devkit_1.logger.error(`Unknown file event: ${event.type}`);
|
|
@@ -37,10 +37,10 @@ class CopyAssetsHandler {
|
|
|
37
37
|
this.ignore = (0, ignore_1.default)();
|
|
38
38
|
const gitignore = pathPosix.join(opts.rootDir, '.gitignore');
|
|
39
39
|
const nxignore = pathPosix.join(opts.rootDir, '.nxignore');
|
|
40
|
-
if (
|
|
41
|
-
this.ignore.add(
|
|
42
|
-
if (
|
|
43
|
-
this.ignore.add(
|
|
40
|
+
if ((0, node_fs_1.existsSync)(gitignore))
|
|
41
|
+
this.ignore.add((0, node_fs_1.readFileSync)(gitignore).toString());
|
|
42
|
+
if ((0, node_fs_1.existsSync)(nxignore))
|
|
43
|
+
this.ignore.add((0, node_fs_1.readFileSync)(nxignore).toString());
|
|
44
44
|
this.assetGlobs = opts.assets.map((f) => {
|
|
45
45
|
let isGlob = false;
|
|
46
46
|
let pattern;
|
package/src/utils/inline.js
CHANGED
|
@@ -5,9 +5,8 @@ exports.handleInliningBuild = handleInliningBuild;
|
|
|
5
5
|
exports.postProcessInlinedDependencies = postProcessInlinedDependencies;
|
|
6
6
|
exports.getRootTsConfigPath = getRootTsConfigPath;
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
9
|
const path_1 = require("path");
|
|
10
|
-
const fs_1 = require("fs");
|
|
11
10
|
function isInlineGraphEmpty(inlineGraph) {
|
|
12
11
|
return Object.keys(inlineGraph.nodes).length === 0;
|
|
13
12
|
}
|
|
@@ -40,7 +39,7 @@ function postProcessInlinedDependencies(outputPath, parentOutputPath, inlineGrap
|
|
|
40
39
|
const destDepOutputPath = (0, path_1.join)(outputPath, inlineDependency.name);
|
|
41
40
|
const isBuildable = !!inlineDependency.buildOutputPath;
|
|
42
41
|
if (isBuildable) {
|
|
43
|
-
(0,
|
|
42
|
+
(0, node_fs_1.cpSync)(depOutputPath, destDepOutputPath, { recursive: true });
|
|
44
43
|
}
|
|
45
44
|
else {
|
|
46
45
|
movePackage(depOutputPath, destDepOutputPath);
|
|
@@ -51,7 +50,7 @@ function postProcessInlinedDependencies(outputPath, parentOutputPath, inlineGrap
|
|
|
51
50
|
destDepOutputPath + '/src';
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
markedForDeletion.forEach((path) => (0,
|
|
53
|
+
markedForDeletion.forEach((path) => (0, node_fs_1.rmSync)(path, { recursive: true, force: true }));
|
|
55
54
|
updateImports(outputPath, inlinedDepsDestOutputRecord);
|
|
56
55
|
}
|
|
57
56
|
function readBasePathAliases(context) {
|
|
@@ -60,7 +59,7 @@ function readBasePathAliases(context) {
|
|
|
60
59
|
function getRootTsConfigPath(context) {
|
|
61
60
|
for (const tsConfigName of ['tsconfig.base.json', 'tsconfig.json']) {
|
|
62
61
|
const tsConfigPath = (0, path_1.join)(context.root, tsConfigName);
|
|
63
|
-
if ((0,
|
|
62
|
+
if ((0, node_fs_1.existsSync)(tsConfigPath)) {
|
|
64
63
|
return tsConfigPath;
|
|
65
64
|
}
|
|
66
65
|
}
|
|
@@ -157,7 +156,7 @@ function buildInlineGraphExternals(context, inlineProjectGraph, pathAliases) {
|
|
|
157
156
|
function movePackage(from, to) {
|
|
158
157
|
if (from === to)
|
|
159
158
|
return;
|
|
160
|
-
(0,
|
|
159
|
+
(0, node_fs_1.cpSync)(from, to, { recursive: true });
|
|
161
160
|
}
|
|
162
161
|
function updateImports(destOutputPath, inlinedDepsDestOutputRecord) {
|
|
163
162
|
const pathAliases = Object.keys(inlinedDepsDestOutputRecord);
|
|
@@ -168,13 +167,13 @@ function updateImports(destOutputPath, inlinedDepsDestOutputRecord) {
|
|
|
168
167
|
recursiveUpdateImport(destOutputPath, importRegex, inlinedDepsDestOutputRecord);
|
|
169
168
|
}
|
|
170
169
|
function recursiveUpdateImport(dirPath, importRegex, inlinedDepsDestOutputRecord, rootParentDir) {
|
|
171
|
-
const files = (0,
|
|
170
|
+
const files = (0, node_fs_1.readdirSync)(dirPath, { withFileTypes: true });
|
|
172
171
|
for (const file of files) {
|
|
173
172
|
// only check .js and .d.ts files
|
|
174
173
|
if (file.isFile() &&
|
|
175
174
|
(file.name.endsWith('.js') || file.name.endsWith('.d.ts'))) {
|
|
176
175
|
const filePath = (0, path_1.join)(dirPath, file.name);
|
|
177
|
-
const fileContent = (0,
|
|
176
|
+
const fileContent = (0, node_fs_1.readFileSync)(filePath, 'utf-8');
|
|
178
177
|
const updatedContent = fileContent.replace(importRegex, (matched) => {
|
|
179
178
|
const result = matched.replace(/['"]/g, '');
|
|
180
179
|
// If a match is the same as the rootParentDir, we're checking its own files so we return the matched as in no changes.
|
|
@@ -183,7 +182,7 @@ function recursiveUpdateImport(dirPath, importRegex, inlinedDepsDestOutputRecord
|
|
|
183
182
|
const importPath = `"${(0, path_1.relative)(dirPath, inlinedDepsDestOutputRecord[result])}"`;
|
|
184
183
|
return (0, devkit_1.normalizePath)(importPath);
|
|
185
184
|
});
|
|
186
|
-
(0,
|
|
185
|
+
(0, node_fs_1.writeFileSync)(filePath, updatedContent);
|
|
187
186
|
}
|
|
188
187
|
else if (file.isDirectory()) {
|
|
189
188
|
recursiveUpdateImport((0, path_1.join)(dirPath, file.name), importRegex, inlinedDepsDestOutputRecord, rootParentDir || file.name);
|
|
@@ -8,10 +8,9 @@ const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
9
9
|
const create_package_json_1 = require("nx/src/plugins/js/package-json/create-package-json");
|
|
10
10
|
const devkit_1 = require("@nx/devkit");
|
|
11
|
+
const node_fs_1 = require("node:fs");
|
|
11
12
|
const path_1 = require("path");
|
|
12
|
-
const fs_extra_1 = require("fs-extra");
|
|
13
13
|
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
14
|
-
const fs_1 = require("fs");
|
|
15
14
|
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
|
16
15
|
const get_main_file_dir_1 = require("../get-main-file-dir");
|
|
17
16
|
function updatePackageJson(options, context, target, dependencies, fileMap = null) {
|
|
@@ -60,7 +59,7 @@ function updatePackageJson(options, context, target, dependencies, fileMap = nul
|
|
|
60
59
|
}
|
|
61
60
|
else {
|
|
62
61
|
const lockFile = (0, lock_file_1.createLockFile)(packageJson, context.projectGraph, packageManager);
|
|
63
|
-
(0,
|
|
62
|
+
(0, node_fs_1.writeFileSync)(`${options.outputPath}/${(0, lock_file_1.getLockFileName)(packageManager)}`, lockFile, {
|
|
64
63
|
encoding: 'utf-8',
|
|
65
64
|
});
|
|
66
65
|
}
|
|
@@ -102,7 +101,7 @@ function addMissingDependencies(packageJson, { projectName, targetName, configur
|
|
|
102
101
|
configuration: configurationName,
|
|
103
102
|
}, {}, entry.node);
|
|
104
103
|
const depPackageJsonPath = (0, path_1.join)(root, outputs[0], 'package.json');
|
|
105
|
-
if ((0,
|
|
104
|
+
if ((0, node_fs_1.existsSync)(depPackageJsonPath)) {
|
|
106
105
|
const version = (0, devkit_1.readJsonFile)(depPackageJsonPath).version;
|
|
107
106
|
packageJson[propType] ??= {};
|
|
108
107
|
packageJson[propType][packageName] = version;
|
|
@@ -4,8 +4,8 @@ exports.compileSwc = compileSwc;
|
|
|
4
4
|
exports.compileSwcWatch = compileSwcWatch;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const node_child_process_1 = require("node:child_process");
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
7
8
|
const node_path_1 = require("node:path");
|
|
8
|
-
const fs_extra_1 = require("fs-extra");
|
|
9
9
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
10
10
|
const print_diagnostics_1 = require("../typescript/print-diagnostics");
|
|
11
11
|
const run_type_check_1 = require("../typescript/run-type-check");
|
|
@@ -24,7 +24,7 @@ function getSwcCmd({ swcCliOptions: { swcrcPath, destPath, stripLeadingPaths },
|
|
|
24
24
|
else {
|
|
25
25
|
// If sourceRoot is not provided, check if `src` exists and use that instead.
|
|
26
26
|
// This is important for root projects to avoid compiling too many directories.
|
|
27
|
-
inputDir = (0,
|
|
27
|
+
inputDir = (0, node_fs_1.existsSync)((0, node_path_1.join)(root, projectRoot, 'src')) ? 'src' : '.';
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
let swcCmd = `node ${swcCLI} ${inputDir || '.'} -d ${destPath} --config-file=${swcrcPath} ${stripLeadingPaths ? '--strip-leading-paths' : ''}`;
|
|
@@ -38,7 +38,7 @@ function getTypeCheckOptions(normalizedOptions) {
|
|
|
38
38
|
? projectRoot
|
|
39
39
|
: sourceRoot
|
|
40
40
|
? sourceRoot
|
|
41
|
-
: (0,
|
|
41
|
+
: (0, node_fs_1.existsSync)((0, node_path_1.join)(root, projectRoot, 'src'))
|
|
42
42
|
? (0, node_path_1.join)(projectRoot, 'src')
|
|
43
43
|
: projectRoot;
|
|
44
44
|
const typeCheckOptions = {
|
|
@@ -57,7 +57,7 @@ function getTypeCheckOptions(normalizedOptions) {
|
|
|
57
57
|
async function compileSwc(context, normalizedOptions, postCompilationCallback) {
|
|
58
58
|
devkit_1.logger.log(`Compiling with SWC for ${context.projectName}...`);
|
|
59
59
|
if (normalizedOptions.clean) {
|
|
60
|
-
(0,
|
|
60
|
+
(0, node_fs_1.rmSync)(normalizedOptions.outputPath, { recursive: true, force: true });
|
|
61
61
|
}
|
|
62
62
|
const swcCmdLog = (0, node_child_process_1.execSync)(getSwcCmd(normalizedOptions), {
|
|
63
63
|
encoding: 'utf8',
|
|
@@ -89,7 +89,7 @@ async function* compileSwcWatch(context, normalizedOptions, postCompilationCallb
|
|
|
89
89
|
let typeCheckOptions;
|
|
90
90
|
let initialPostCompile = true;
|
|
91
91
|
if (normalizedOptions.clean) {
|
|
92
|
-
(0,
|
|
92
|
+
(0, node_fs_1.rmSync)(normalizedOptions.outputPath, { recursive: true, force: true });
|
|
93
93
|
}
|
|
94
94
|
return yield* (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
|
|
95
95
|
let processOnExit;
|