@nx/js 18.0.3 → 18.0.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/babel.js +1 -1
- package/migrations.json +9 -0
- package/package.json +4 -4
- package/src/executors/swc/swc.impl.js +6 -7
- package/src/generators/library/library.js +22 -6
- package/src/generators/release-version/utils/resolve-version-spec.js +4 -1
- package/src/generators/release-version/utils/update-lock-file.js +2 -2
- package/src/utils/schema.d.ts +1 -0
- package/src/utils/swc/get-swcrc-path.d.ts +4 -1
- package/src/utils/swc/get-swcrc-path.js +6 -1
- package/src/utils/swc/inline.d.ts +1 -1
- package/src/utils/swc/inline.js +1 -2
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- /package/src/generators/library/files/{lib → readme}/README.md +0 -0
package/babel.js
CHANGED
|
@@ -25,7 +25,7 @@ module.exports = function (api, options = {}) {
|
|
|
25
25
|
// For Jest tests, NODE_ENV is set as 'test' and we only want to set target as Node.
|
|
26
26
|
// All other options will fail in Jest since Node does not support some ES features
|
|
27
27
|
// such as import syntax.
|
|
28
|
-
isTest || process.env.NODE_ENV === 'test'
|
|
28
|
+
isTest || process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID
|
|
29
29
|
? { targets: { node: 'current' }, loose: true }
|
|
30
30
|
: {
|
|
31
31
|
// Allow importing core-js in entrypoint and use browserslist to select polyfills.
|
package/migrations.json
CHANGED
|
@@ -145,6 +145,15 @@
|
|
|
145
145
|
"alwaysAddToPackageJson": false
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
+
},
|
|
149
|
+
"18.0.4": {
|
|
150
|
+
"version": "18.0.4-beta.0",
|
|
151
|
+
"packages": {
|
|
152
|
+
"@swc-node/register": {
|
|
153
|
+
"version": "~1.8.0",
|
|
154
|
+
"alwaysAddToPackageJson": false
|
|
155
|
+
}
|
|
156
|
+
}
|
|
148
157
|
}
|
|
149
158
|
}
|
|
150
159
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.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": {
|
|
@@ -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.0.
|
|
61
|
-
"@nx/workspace": "18.0.
|
|
62
|
-
"@nrwl/js": "18.0.
|
|
60
|
+
"@nx/devkit": "18.0.5",
|
|
61
|
+
"@nx/workspace": "18.0.5",
|
|
62
|
+
"@nrwl/js": "18.0.5"
|
|
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
|
}
|
|
@@ -25,7 +25,6 @@ async function libraryGenerator(tree, schema) {
|
|
|
25
25
|
}
|
|
26
26
|
exports.libraryGenerator = libraryGenerator;
|
|
27
27
|
async function libraryGeneratorInternal(tree, schema) {
|
|
28
|
-
const filesDir = (0, path_1.join)(__dirname, './files');
|
|
29
28
|
const tasks = [];
|
|
30
29
|
tasks.push(await (0, init_1.default)(tree, {
|
|
31
30
|
...schema,
|
|
@@ -33,7 +32,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
33
32
|
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
34
33
|
}));
|
|
35
34
|
const options = await normalizeOptions(tree, schema);
|
|
36
|
-
createFiles(tree, options
|
|
35
|
+
createFiles(tree, options);
|
|
37
36
|
addProject(tree, options);
|
|
38
37
|
if (!options.skipPackageJson) {
|
|
39
38
|
tasks.push(addProjectDependencies(tree, options));
|
|
@@ -69,7 +68,7 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
69
68
|
const jestCallback = await addJest(tree, options);
|
|
70
69
|
tasks.push(jestCallback);
|
|
71
70
|
if (options.bundler === 'swc' || options.bundler === 'rollup') {
|
|
72
|
-
replaceJestConfig(tree, options
|
|
71
|
+
replaceJestConfig(tree, options);
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
else if (options.unitTestRunner === 'vitest' &&
|
|
@@ -284,10 +283,10 @@ function addBabelRc(tree, options) {
|
|
|
284
283
|
};
|
|
285
284
|
(0, devkit_1.writeJson)(tree, (0, path_1.join)(options.projectRoot, filename), babelrc);
|
|
286
285
|
}
|
|
287
|
-
function createFiles(tree, options
|
|
286
|
+
function createFiles(tree, options) {
|
|
288
287
|
const { className, name, propertyName } = (0, devkit_1.names)(options.projectNames.projectFileName);
|
|
289
288
|
createProjectTsConfigJson(tree, options);
|
|
290
|
-
(0, devkit_1.generateFiles)(tree,
|
|
289
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files/lib'), options.projectRoot, {
|
|
291
290
|
...options,
|
|
292
291
|
dot: '.',
|
|
293
292
|
className,
|
|
@@ -301,6 +300,22 @@ function createFiles(tree, options, filesDir) {
|
|
|
301
300
|
buildable: options.bundler && options.bundler !== 'none',
|
|
302
301
|
hasUnitTestRunner: options.unitTestRunner !== 'none',
|
|
303
302
|
});
|
|
303
|
+
if (!options.rootProject) {
|
|
304
|
+
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files/readme'), options.projectRoot, {
|
|
305
|
+
...options,
|
|
306
|
+
dot: '.',
|
|
307
|
+
className,
|
|
308
|
+
name,
|
|
309
|
+
propertyName,
|
|
310
|
+
js: !!options.js,
|
|
311
|
+
cliCommand: 'nx',
|
|
312
|
+
strict: undefined,
|
|
313
|
+
tmpl: '',
|
|
314
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot),
|
|
315
|
+
buildable: options.bundler && options.bundler !== 'none',
|
|
316
|
+
hasUnitTestRunner: options.unitTestRunner !== 'none',
|
|
317
|
+
});
|
|
318
|
+
}
|
|
304
319
|
if (options.bundler === 'swc' || options.bundler === 'rollup') {
|
|
305
320
|
(0, add_swc_dependencies_1.addSwcDependencies)(tree);
|
|
306
321
|
(0, add_swc_config_1.addSwcConfig)(tree, options.projectRoot, options.bundler === 'swc' ? 'commonjs' : 'es6');
|
|
@@ -377,7 +392,8 @@ async function addJest(tree, options) {
|
|
|
377
392
|
: undefined,
|
|
378
393
|
});
|
|
379
394
|
}
|
|
380
|
-
function replaceJestConfig(tree, options
|
|
395
|
+
function replaceJestConfig(tree, options) {
|
|
396
|
+
const filesDir = (0, path_1.join)(__dirname, './files/jest-config');
|
|
381
397
|
// the existing config has to be deleted otherwise the new config won't overwrite it
|
|
382
398
|
const existingJestConfig = (0, devkit_1.joinPathFragments)(filesDir, `jest.config.${options.js ? 'js' : 'ts'}`);
|
|
383
399
|
if (tree.exists(existingJestConfig)) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveVersionSpec = void 0;
|
|
4
4
|
const npa = require("npm-package-arg");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
function resolveVersionSpec(name, version, spec, location) {
|
|
6
7
|
// yarn classic uses link instead of file, normalize to match what npm expects
|
|
7
8
|
spec = spec.replace(/^link:/, 'file:');
|
|
@@ -21,6 +22,8 @@ function resolveVersionSpec(name, version, spec, location) {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
const npaResult = npa.resolve(name, spec, location);
|
|
24
|
-
return npaResult.fetchSpec
|
|
25
|
+
return npaResult.fetchSpec.includes('\\')
|
|
26
|
+
? (0, devkit_1.normalizePath)(npaResult.fetchSpec)
|
|
27
|
+
: npaResult.fetchSpec;
|
|
25
28
|
}
|
|
26
29
|
exports.resolveVersionSpec = resolveVersionSpec;
|
|
@@ -24,8 +24,8 @@ async function updateLockFile(cwd, { dryRun, verbose, generatorOptions, }) {
|
|
|
24
24
|
return [];
|
|
25
25
|
}
|
|
26
26
|
const isDaemonEnabled = client_1.daemonClient.enabled();
|
|
27
|
-
if (isDaemonEnabled) {
|
|
28
|
-
// temporarily stop the daemon, as it will error if the lock file is updated
|
|
27
|
+
if (!dryRun && isDaemonEnabled) {
|
|
28
|
+
// if not in dry-run temporarily stop the daemon, as it will error if the lock file is updated
|
|
29
29
|
await client_1.daemonClient.stop();
|
|
30
30
|
}
|
|
31
31
|
const packageManagerCommands = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
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
|
}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const prettierVersion = "^2.6.2";
|
|
|
4
4
|
export declare const swcCliVersion = "~0.1.62";
|
|
5
5
|
export declare const swcCoreVersion = "~1.3.85";
|
|
6
6
|
export declare const swcHelpersVersion = "~0.5.2";
|
|
7
|
-
export declare const swcNodeVersion = "~1.
|
|
7
|
+
export declare const swcNodeVersion = "~1.8.0";
|
|
8
8
|
export declare const tsLibVersion = "^2.3.0";
|
|
9
9
|
export declare const typesNodeVersion = "18.16.9";
|
|
10
10
|
export declare const verdaccioVersion = "^5.0.4";
|
package/src/utils/versions.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.prettierVersion = '^2.6.2';
|
|
|
7
7
|
exports.swcCliVersion = '~0.1.62';
|
|
8
8
|
exports.swcCoreVersion = '~1.3.85';
|
|
9
9
|
exports.swcHelpersVersion = '~0.5.2';
|
|
10
|
-
exports.swcNodeVersion = '~1.
|
|
10
|
+
exports.swcNodeVersion = '~1.8.0';
|
|
11
11
|
exports.tsLibVersion = '^2.3.0';
|
|
12
12
|
exports.typesNodeVersion = '18.16.9';
|
|
13
13
|
exports.verdaccioVersion = '^5.0.4';
|
|
File without changes
|