@nx/js 19.0.2 → 19.0.4
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": "19.0.
|
|
3
|
+
"version": "19.0.4",
|
|
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": {
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"semver": "^7.5.3",
|
|
57
57
|
"source-map-support": "0.5.19",
|
|
58
58
|
"tslib": "^2.3.0",
|
|
59
|
-
"@nx/devkit": "19.0.
|
|
60
|
-
"@nx/workspace": "19.0.
|
|
61
|
-
"@nrwl/js": "19.0.
|
|
59
|
+
"@nx/devkit": "19.0.4",
|
|
60
|
+
"@nx/workspace": "19.0.4",
|
|
61
|
+
"@nrwl/js": "19.0.4"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"verdaccio": "^5.0.4"
|
|
@@ -69,9 +69,11 @@ async function initGenerator(tree, schema) {
|
|
|
69
69
|
'.prettierrc.json5',
|
|
70
70
|
'.prettierrc.js',
|
|
71
71
|
'.prettierrc.cjs',
|
|
72
|
+
'.prettierrc.mjs',
|
|
73
|
+
'.prettierrc.toml',
|
|
72
74
|
'prettier.config.js',
|
|
73
75
|
'prettier.config.cjs',
|
|
74
|
-
'.
|
|
76
|
+
'prettier.config.mjs',
|
|
75
77
|
];
|
|
76
78
|
if (prettierrcNameOptions.every((name) => !tree.exists(name))) {
|
|
77
79
|
(0, devkit_1.writeJson)(tree, '.prettierrc', {
|
package/src/index.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ export * from './utils/package-json/update-package-json';
|
|
|
13
13
|
export * from './utils/package-json/create-entry-points';
|
|
14
14
|
export { libraryGenerator } from './generators/library/library';
|
|
15
15
|
export { initGenerator } from './generators/init/init';
|
|
16
|
+
export { isValidVariable } from './utils/is-valid-variable';
|
|
16
17
|
export { createLockFile, getLockFileName, } from 'nx/src/plugins/js/lock-file/lock-file';
|
|
17
18
|
export { createPackageJson } from 'nx/src/plugins/js/package-json/create-package-json';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPackageJson = exports.getLockFileName = exports.createLockFile = exports.initGenerator = exports.libraryGenerator = void 0;
|
|
3
|
+
exports.createPackageJson = exports.getLockFileName = exports.createLockFile = exports.isValidVariable = exports.initGenerator = exports.libraryGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./utils/typescript/add-tslib-dependencies"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./utils/typescript/load-ts-transformers"), exports);
|
|
@@ -19,6 +19,8 @@ var library_1 = require("./generators/library/library");
|
|
|
19
19
|
Object.defineProperty(exports, "libraryGenerator", { enumerable: true, get: function () { return library_1.libraryGenerator; } });
|
|
20
20
|
var init_1 = require("./generators/init/init");
|
|
21
21
|
Object.defineProperty(exports, "initGenerator", { enumerable: true, get: function () { return init_1.initGenerator; } });
|
|
22
|
+
var is_valid_variable_1 = require("./utils/is-valid-variable");
|
|
23
|
+
Object.defineProperty(exports, "isValidVariable", { enumerable: true, get: function () { return is_valid_variable_1.isValidVariable; } });
|
|
22
24
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
23
25
|
var lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
24
26
|
Object.defineProperty(exports, "createLockFile", { enumerable: true, get: function () { return lock_file_1.createLockFile; } });
|
|
@@ -2,7 +2,8 @@
|
|
|
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
|
|
5
|
+
const pathPosix = require("node:path/posix");
|
|
6
|
+
const path = require("node:path");
|
|
6
7
|
const fse = require("fs-extra");
|
|
7
8
|
const ignore_1 = require("ignore");
|
|
8
9
|
const fg = require("fast-glob");
|
|
@@ -34,8 +35,8 @@ class CopyAssetsHandler {
|
|
|
34
35
|
this.callback = opts.callback ?? exports.defaultFileEventHandler;
|
|
35
36
|
// TODO(jack): Should handle nested .gitignore files
|
|
36
37
|
this.ignore = (0, ignore_1.default)();
|
|
37
|
-
const gitignore =
|
|
38
|
-
const nxignore =
|
|
38
|
+
const gitignore = pathPosix.join(opts.rootDir, '.gitignore');
|
|
39
|
+
const nxignore = pathPosix.join(opts.rootDir, '.nxignore');
|
|
39
40
|
if (fse.existsSync(gitignore))
|
|
40
41
|
this.ignore.add(fse.readFileSync(gitignore).toString());
|
|
41
42
|
if (fse.existsSync(nxignore))
|
|
@@ -54,11 +55,11 @@ class CopyAssetsHandler {
|
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
57
|
isGlob = true;
|
|
57
|
-
pattern =
|
|
58
|
+
pattern = pathPosix.join(f.input, f.glob);
|
|
58
59
|
input = f.input;
|
|
59
|
-
output =
|
|
60
|
+
output = pathPosix.join(path.relative(opts.rootDir, opts.outputDir), f.output);
|
|
60
61
|
if (f.ignore)
|
|
61
|
-
ignore = f.ignore.map((ig) =>
|
|
62
|
+
ignore = f.ignore.map((ig) => pathPosix.join(f.input, ig));
|
|
62
63
|
}
|
|
63
64
|
return {
|
|
64
65
|
isGlob,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if a given string is a valid JavaScript variable name.
|
|
3
|
+
* @param name name of the variable to be checked
|
|
4
|
+
* @returns result object with a boolean indicating if the name is valid and a message explaining why it is not valid
|
|
5
|
+
*/
|
|
6
|
+
export declare function isValidVariable(name: string): {
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidVariable = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Determines if a given string is a valid JavaScript variable name.
|
|
6
|
+
* @param name name of the variable to be checked
|
|
7
|
+
* @returns result object with a boolean indicating if the name is valid and a message explaining why it is not valid
|
|
8
|
+
*/
|
|
9
|
+
function isValidVariable(name) {
|
|
10
|
+
const validRegex = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
|
|
11
|
+
if (validRegex.test(name)) {
|
|
12
|
+
return { isValid: true, message: 'The name is a valid identifier.' };
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
if (name === '') {
|
|
16
|
+
return { isValid: false, message: 'The name cannot be empty.' };
|
|
17
|
+
}
|
|
18
|
+
else if (/^[0-9]/.test(name)) {
|
|
19
|
+
return { isValid: false, message: 'The name cannot start with a digit.' };
|
|
20
|
+
}
|
|
21
|
+
else if (/[^a-zA-Z0-9_$]/.test(name)) {
|
|
22
|
+
return {
|
|
23
|
+
isValid: false,
|
|
24
|
+
message: 'The name can only contain letters, digits, underscores, and dollar signs.',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
else if (/^[^a-zA-Z_$]/.test(name)) {
|
|
28
|
+
return {
|
|
29
|
+
isValid: false,
|
|
30
|
+
message: 'The name must start with a letter, underscore, or dollar sign.',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
isValid: false,
|
|
35
|
+
message: 'The name is not a valid JavaScript identifier.',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.isValidVariable = isValidVariable;
|