@nx/eslint-plugin 19.5.0-beta.0 → 19.5.0-beta.1
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 +6 -6
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +1 -1
- package/src/migrations/update-17-2-6-rename-workspace-rules/rename-workspace-rules.js +1 -1
- package/src/migrations/update-19-1-0-migrate-no-extra-semi/migrate-no-extra-semi.js +1 -1
- package/src/rules/nx-plugin-checks.js +7 -7
- package/src/utils/ast-utils.js +3 -4
- package/src/utils/config-utils.js +1 -2
- package/src/utils/graph-utils.js +5 -6
- package/src/utils/package-json-utils.js +3 -4
- package/src/utils/project-graph-utils.js +2 -3
- package/src/utils/runtime-lint-utils.js +23 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint-plugin",
|
|
3
|
-
"version": "19.5.0-beta.
|
|
3
|
+
"version": "19.5.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
|
6
6
|
"repository": {
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nx/devkit": "19.5.0-beta.
|
|
38
|
-
"@nx/js": "19.5.0-beta.
|
|
39
|
-
"@typescript-eslint/type-utils": "^7.
|
|
40
|
-
"@typescript-eslint/utils": "^7.
|
|
37
|
+
"@nx/devkit": "19.5.0-beta.1",
|
|
38
|
+
"@nx/js": "19.5.0-beta.1",
|
|
39
|
+
"@typescript-eslint/type-utils": "^7.16.0",
|
|
40
|
+
"@typescript-eslint/utils": "^7.16.0",
|
|
41
41
|
"chalk": "^4.1.0",
|
|
42
42
|
"confusing-browser-globals": "^1.0.9",
|
|
43
43
|
"jsonc-eslint-parser": "^2.1.0",
|
|
44
44
|
"semver": "^7.5.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
|
-
"@nrwl/eslint-plugin-nx": "19.5.0-beta.
|
|
46
|
+
"@nrwl/eslint-plugin-nx": "19.5.0-beta.1"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = replacePackage;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
5
6
|
const path_1 = require("path");
|
|
@@ -40,4 +41,3 @@ async function replacePackage(tree) {
|
|
|
40
41
|
});
|
|
41
42
|
await (0, devkit_1.formatFiles)(tree);
|
|
42
43
|
}
|
|
43
|
-
exports.default = replacePackage;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = renameWorkspaceRule;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const binary_extensions_1 = require("@nx/devkit/src/utils/binary-extensions");
|
|
5
6
|
const constants_1 = require("../../constants");
|
|
@@ -26,4 +27,3 @@ async function renameWorkspaceRule(tree) {
|
|
|
26
27
|
});
|
|
27
28
|
await (0, devkit_1.formatFiles)(tree);
|
|
28
29
|
}
|
|
29
|
-
exports.default = renameWorkspaceRule;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = migrate;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
async function migrate(tree) {
|
|
5
6
|
(0, devkit_1.visitNotIgnoredFiles)(tree, '.', (path) => {
|
|
@@ -33,7 +34,6 @@ This is because those rules have been migrated to the https://eslint.style/ proj
|
|
|
33
34
|
});
|
|
34
35
|
await (0, devkit_1.formatFiles)(tree);
|
|
35
36
|
}
|
|
36
|
-
exports.default = migrate;
|
|
37
37
|
/**
|
|
38
38
|
* @returns {boolean} whether the json was updated
|
|
39
39
|
*/
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RULE_NAME = void 0;
|
|
4
|
+
exports.checkCollectionFileNode = checkCollectionFileNode;
|
|
5
|
+
exports.checkCollectionNode = checkCollectionNode;
|
|
6
|
+
exports.validateEntry = validateEntry;
|
|
7
|
+
exports.validateImplemenationNode = validateImplemenationNode;
|
|
8
|
+
exports.validatePackageGroup = validatePackageGroup;
|
|
9
|
+
exports.validateVersionJsonExpression = validateVersionJsonExpression;
|
|
4
10
|
const tslib_1 = require("tslib");
|
|
5
11
|
const utils_1 = require("@typescript-eslint/utils");
|
|
6
12
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -168,7 +174,6 @@ function checkCollectionFileNode(baseNode, mode, context) {
|
|
|
168
174
|
}
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
|
-
exports.checkCollectionFileNode = checkCollectionFileNode;
|
|
172
177
|
function checkCollectionNode(baseNode, mode, context) {
|
|
173
178
|
const entries = baseNode.properties;
|
|
174
179
|
for (const entryNode of entries) {
|
|
@@ -184,7 +189,6 @@ function checkCollectionNode(baseNode, mode, context) {
|
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
191
|
}
|
|
187
|
-
exports.checkCollectionNode = checkCollectionNode;
|
|
188
192
|
function validateEntry(baseNode, key, mode, context) {
|
|
189
193
|
const schemaNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'schema');
|
|
190
194
|
if (mode !== 'migration' && !schemaNode) {
|
|
@@ -274,7 +278,6 @@ function validateEntry(baseNode, key, mode, context) {
|
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
280
|
}
|
|
277
|
-
exports.validateEntry = validateEntry;
|
|
278
281
|
function validateImplemenationNode(implementationNode, key, context) {
|
|
279
282
|
if (implementationNode.value.type !== 'JSONLiteral' ||
|
|
280
283
|
typeof implementationNode.value.value !== 'string') {
|
|
@@ -328,7 +331,6 @@ function validateImplemenationNode(implementationNode, key, context) {
|
|
|
328
331
|
}
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
|
-
exports.validateImplemenationNode = validateImplemenationNode;
|
|
332
334
|
function validatePackageGroup(baseNode, context) {
|
|
333
335
|
const migrationsNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' &&
|
|
334
336
|
x.value.type === 'JSONObjectExpression' &&
|
|
@@ -381,7 +383,6 @@ function validatePackageGroup(baseNode, context) {
|
|
|
381
383
|
}
|
|
382
384
|
}
|
|
383
385
|
}
|
|
384
|
-
exports.validatePackageGroup = validatePackageGroup;
|
|
385
386
|
function validateVersionJsonExpression(node, context) {
|
|
386
387
|
return (node &&
|
|
387
388
|
node.type === 'JSONLiteral' &&
|
|
@@ -389,4 +390,3 @@ function validateVersionJsonExpression(node, context) {
|
|
|
389
390
|
((0, semver_1.valid)(node.value) ||
|
|
390
391
|
context.options[0]?.allowedVersionStrings.includes(node.value)));
|
|
391
392
|
}
|
|
392
|
-
exports.validateVersionJsonExpression = validateVersionJsonExpression;
|
package/src/utils/ast-utils.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getBarrelEntryPointByImportScope = getBarrelEntryPointByImportScope;
|
|
4
|
+
exports.getBarrelEntryPointProjectNode = getBarrelEntryPointProjectNode;
|
|
5
|
+
exports.getRelativeImportPath = getRelativeImportPath;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const js_1 = require("@nx/js");
|
|
6
8
|
const type_utils_1 = require("@typescript-eslint/type-utils");
|
|
@@ -50,7 +52,6 @@ function getBarrelEntryPointByImportScope(importScope) {
|
|
|
50
52
|
return [];
|
|
51
53
|
return tryPaths(tsConfigBase.compilerOptions.paths, importScope);
|
|
52
54
|
}
|
|
53
|
-
exports.getBarrelEntryPointByImportScope = getBarrelEntryPointByImportScope;
|
|
54
55
|
function getBarrelEntryPointProjectNode(projectNode) {
|
|
55
56
|
const tsConfigBase = tryReadBaseJson();
|
|
56
57
|
if (tsConfigBase?.compilerOptions?.paths) {
|
|
@@ -70,7 +71,6 @@ function getBarrelEntryPointProjectNode(projectNode) {
|
|
|
70
71
|
}
|
|
71
72
|
return null;
|
|
72
73
|
}
|
|
73
|
-
exports.getBarrelEntryPointProjectNode = getBarrelEntryPointProjectNode;
|
|
74
74
|
function hasMemberExport(exportedMember, filePath) {
|
|
75
75
|
const fileContent = (0, fs_1.readFileSync)(filePath, 'utf8');
|
|
76
76
|
// use the TypeScript AST to find the path to the file where exportedMember is defined
|
|
@@ -217,4 +217,3 @@ function getRelativeImportPath(exportedMember, filePath, basePath) {
|
|
|
217
217
|
}
|
|
218
218
|
return null;
|
|
219
219
|
}
|
|
220
|
-
exports.getRelativeImportPath = getRelativeImportPath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.packageExists =
|
|
3
|
+
exports.packageExists = packageExists;
|
|
4
4
|
/**
|
|
5
5
|
* Checks if package is available
|
|
6
6
|
* @param name name of the package
|
|
@@ -15,4 +15,3 @@ function packageExists(name) {
|
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
exports.packageExists = packageExists;
|
package/src/utils/graph-utils.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getPath = getPath;
|
|
4
|
+
exports.pathExists = pathExists;
|
|
5
|
+
exports.checkCircularPath = checkCircularPath;
|
|
6
|
+
exports.findFilesInCircularPath = findFilesInCircularPath;
|
|
7
|
+
exports.findFilesWithDynamicImports = findFilesWithDynamicImports;
|
|
4
8
|
const project_graph_1 = require("nx/src/config/project-graph");
|
|
5
9
|
const reach = {
|
|
6
10
|
graph: null,
|
|
@@ -83,7 +87,6 @@ function getPath(graph, sourceProjectName, targetProjectName) {
|
|
|
83
87
|
return [];
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
|
-
exports.getPath = getPath;
|
|
87
90
|
function pathExists(graph, sourceProjectName, targetProjectName) {
|
|
88
91
|
if (sourceProjectName === targetProjectName)
|
|
89
92
|
return true;
|
|
@@ -95,13 +98,11 @@ function pathExists(graph, sourceProjectName, targetProjectName) {
|
|
|
95
98
|
}
|
|
96
99
|
return !!reach.matrix[sourceProjectName][targetProjectName];
|
|
97
100
|
}
|
|
98
|
-
exports.pathExists = pathExists;
|
|
99
101
|
function checkCircularPath(graph, sourceProject, targetProject) {
|
|
100
102
|
if (!graph.nodes[targetProject.name])
|
|
101
103
|
return [];
|
|
102
104
|
return getPath(graph, targetProject.name, sourceProject.name);
|
|
103
105
|
}
|
|
104
|
-
exports.checkCircularPath = checkCircularPath;
|
|
105
106
|
function findFilesInCircularPath(projectFileMap, circularPath) {
|
|
106
107
|
const filePathChain = [];
|
|
107
108
|
for (let i = 0; i < circularPath.length - 1; i++) {
|
|
@@ -113,7 +114,6 @@ function findFilesInCircularPath(projectFileMap, circularPath) {
|
|
|
113
114
|
}
|
|
114
115
|
return filePathChain;
|
|
115
116
|
}
|
|
116
|
-
exports.findFilesInCircularPath = findFilesInCircularPath;
|
|
117
117
|
function findFilesWithDynamicImports(projectFileMap, sourceProjectName, targetProjectName) {
|
|
118
118
|
const files = [];
|
|
119
119
|
projectFileMap[sourceProjectName].forEach((file) => {
|
|
@@ -126,4 +126,3 @@ function findFilesWithDynamicImports(projectFileMap, sourceProjectName, targetPr
|
|
|
126
126
|
});
|
|
127
127
|
return files;
|
|
128
128
|
}
|
|
129
|
-
exports.findFilesWithDynamicImports = findFilesWithDynamicImports;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAllDependencies = getAllDependencies;
|
|
4
|
+
exports.getProductionDependencies = getProductionDependencies;
|
|
5
|
+
exports.getPackageJson = getPackageJson;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const fs_1 = require("fs");
|
|
6
8
|
const runtime_lint_utils_1 = require("./runtime-lint-utils");
|
|
@@ -12,7 +14,6 @@ function getAllDependencies(packageJson) {
|
|
|
12
14
|
...packageJson.optionalDependencies,
|
|
13
15
|
};
|
|
14
16
|
}
|
|
15
|
-
exports.getAllDependencies = getAllDependencies;
|
|
16
17
|
function getProductionDependencies(packageJsonPath) {
|
|
17
18
|
if (!globalThis.projPackageJsonDeps ||
|
|
18
19
|
!globalThis.projPackageJsonDeps[packageJsonPath] ||
|
|
@@ -27,11 +28,9 @@ function getProductionDependencies(packageJsonPath) {
|
|
|
27
28
|
}
|
|
28
29
|
return globalThis.projPackageJsonDeps[packageJsonPath];
|
|
29
30
|
}
|
|
30
|
-
exports.getProductionDependencies = getProductionDependencies;
|
|
31
31
|
function getPackageJson(path) {
|
|
32
32
|
if ((0, fs_1.existsSync)(path)) {
|
|
33
33
|
return (0, devkit_1.readJsonFile)(path);
|
|
34
34
|
}
|
|
35
35
|
return {};
|
|
36
36
|
}
|
|
37
|
-
exports.getPackageJson = getPackageJson;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ensureGlobalProjectGraph = ensureGlobalProjectGraph;
|
|
4
|
+
exports.readProjectGraph = readProjectGraph;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const runtime_lint_utils_1 = require("./runtime-lint-utils");
|
|
6
7
|
const chalk = require("chalk");
|
|
@@ -40,7 +41,6 @@ function ensureGlobalProjectGraph(ruleName) {
|
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
exports.ensureGlobalProjectGraph = ensureGlobalProjectGraph;
|
|
44
44
|
function readProjectGraph(ruleName) {
|
|
45
45
|
ensureGlobalProjectGraph(ruleName);
|
|
46
46
|
return {
|
|
@@ -50,4 +50,3 @@ function readProjectGraph(ruleName) {
|
|
|
50
50
|
targetProjectLocator: globalThis.targetProjectLocator,
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
exports.readProjectGraph = readProjectGraph;
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.stringifyTags = stringifyTags;
|
|
4
|
+
exports.hasNoneOfTheseTags = hasNoneOfTheseTags;
|
|
5
|
+
exports.isComboDepConstraint = isComboDepConstraint;
|
|
6
|
+
exports.findDependenciesWithTags = findDependenciesWithTags;
|
|
7
|
+
exports.matchImportWithWildcard = matchImportWithWildcard;
|
|
8
|
+
exports.isRelative = isRelative;
|
|
9
|
+
exports.getTargetProjectBasedOnRelativeImport = getTargetProjectBasedOnRelativeImport;
|
|
10
|
+
exports.findProject = findProject;
|
|
11
|
+
exports.isAbsoluteImportIntoAnotherProject = isAbsoluteImportIntoAnotherProject;
|
|
12
|
+
exports.findProjectUsingImport = findProjectUsingImport;
|
|
13
|
+
exports.findConstraintsFor = findConstraintsFor;
|
|
14
|
+
exports.hasStaticImportOfDynamicResource = hasStaticImportOfDynamicResource;
|
|
15
|
+
exports.getSourceFilePath = getSourceFilePath;
|
|
16
|
+
exports.hasBannedImport = hasBannedImport;
|
|
17
|
+
exports.findTransitiveExternalDependencies = findTransitiveExternalDependencies;
|
|
18
|
+
exports.hasBannedDependencies = hasBannedDependencies;
|
|
19
|
+
exports.isDirectDependency = isDirectDependency;
|
|
20
|
+
exports.hasBuildExecutor = hasBuildExecutor;
|
|
21
|
+
exports.isTerminalRun = isTerminalRun;
|
|
22
|
+
exports.groupImports = groupImports;
|
|
23
|
+
exports.belongsToDifferentNgEntryPoint = belongsToDifferentNgEntryPoint;
|
|
24
|
+
exports.appIsMFERemote = appIsMFERemote;
|
|
25
|
+
exports.getParserServices = getParserServices;
|
|
4
26
|
const tslib_1 = require("tslib");
|
|
5
27
|
const devkit_1 = require("@nx/devkit");
|
|
6
28
|
const js_1 = require("@nx/js");
|
|
@@ -13,15 +35,12 @@ const graph_utils_1 = require("./graph-utils");
|
|
|
13
35
|
function stringifyTags(tags) {
|
|
14
36
|
return tags.map((t) => `"${t}"`).join(', ');
|
|
15
37
|
}
|
|
16
|
-
exports.stringifyTags = stringifyTags;
|
|
17
38
|
function hasNoneOfTheseTags(proj, tags) {
|
|
18
39
|
return tags.filter((tag) => hasTag(proj, tag)).length === 0;
|
|
19
40
|
}
|
|
20
|
-
exports.hasNoneOfTheseTags = hasNoneOfTheseTags;
|
|
21
41
|
function isComboDepConstraint(depConstraint) {
|
|
22
42
|
return !!depConstraint.allSourceTags;
|
|
23
43
|
}
|
|
24
|
-
exports.isComboDepConstraint = isComboDepConstraint;
|
|
25
44
|
/**
|
|
26
45
|
* Check if any of the given tags is included in the project
|
|
27
46
|
* @param proj ProjectGraphProjectNode
|
|
@@ -38,7 +57,6 @@ function findDependenciesWithTags(targetProject, tags, graph) {
|
|
|
38
57
|
? [targetProject]
|
|
39
58
|
: (0, graph_utils_1.getPath)(graph, targetProject.name, project));
|
|
40
59
|
}
|
|
41
|
-
exports.findDependenciesWithTags = findDependenciesWithTags;
|
|
42
60
|
const regexMap = new Map();
|
|
43
61
|
function hasTag(proj, tag) {
|
|
44
62
|
if (tag === '*')
|
|
@@ -83,11 +101,9 @@ allowableImport, extractedImport) {
|
|
|
83
101
|
return new RegExp(allowableImport).test(extractedImport);
|
|
84
102
|
}
|
|
85
103
|
}
|
|
86
|
-
exports.matchImportWithWildcard = matchImportWithWildcard;
|
|
87
104
|
function isRelative(s) {
|
|
88
105
|
return s.startsWith('./') || s.startsWith('../');
|
|
89
106
|
}
|
|
90
|
-
exports.isRelative = isRelative;
|
|
91
107
|
function getTargetProjectBasedOnRelativeImport(imp, projectPath, projectGraph, projectRootMappings, sourceFilePath) {
|
|
92
108
|
if (!isRelative(imp)) {
|
|
93
109
|
return undefined;
|
|
@@ -96,23 +112,19 @@ function getTargetProjectBasedOnRelativeImport(imp, projectPath, projectGraph, p
|
|
|
96
112
|
const targetFile = (0, devkit_1.normalizePath)(path.resolve(sourceDir, imp)).substring(projectPath.length + 1);
|
|
97
113
|
return findProject(projectGraph, projectRootMappings, targetFile);
|
|
98
114
|
}
|
|
99
|
-
exports.getTargetProjectBasedOnRelativeImport = getTargetProjectBasedOnRelativeImport;
|
|
100
115
|
function findProject(projectGraph, projectRootMappings, sourceFilePath) {
|
|
101
116
|
return projectGraph.nodes[(0, find_project_for_path_1.findProjectForPath)(sourceFilePath, projectRootMappings)];
|
|
102
117
|
}
|
|
103
|
-
exports.findProject = findProject;
|
|
104
118
|
function isAbsoluteImportIntoAnotherProject(imp, workspaceLayout = { libsDir: 'libs', appsDir: 'apps' }) {
|
|
105
119
|
return (imp.startsWith(`${workspaceLayout.libsDir}/`) ||
|
|
106
120
|
imp.startsWith(`/${workspaceLayout.libsDir}/`) ||
|
|
107
121
|
imp.startsWith(`${workspaceLayout.appsDir}/`) ||
|
|
108
122
|
imp.startsWith(`/${workspaceLayout.appsDir}/`));
|
|
109
123
|
}
|
|
110
|
-
exports.isAbsoluteImportIntoAnotherProject = isAbsoluteImportIntoAnotherProject;
|
|
111
124
|
function findProjectUsingImport(projectGraph, targetProjectLocator, filePath, imp) {
|
|
112
125
|
const target = targetProjectLocator.findProjectFromImport(imp, filePath);
|
|
113
126
|
return projectGraph.nodes[target] || projectGraph.externalNodes?.[target];
|
|
114
127
|
}
|
|
115
|
-
exports.findProjectUsingImport = findProjectUsingImport;
|
|
116
128
|
function findConstraintsFor(depConstraints, sourceProject) {
|
|
117
129
|
return depConstraints.filter((f) => {
|
|
118
130
|
if (isComboDepConstraint(f)) {
|
|
@@ -123,7 +135,6 @@ function findConstraintsFor(depConstraints, sourceProject) {
|
|
|
123
135
|
}
|
|
124
136
|
});
|
|
125
137
|
}
|
|
126
|
-
exports.findConstraintsFor = findConstraintsFor;
|
|
127
138
|
function hasStaticImportOfDynamicResource(node, graph, sourceProjectName, targetProjectName) {
|
|
128
139
|
if (node.type !== utils_1.AST_NODE_TYPES.ImportDeclaration ||
|
|
129
140
|
node.importKind === 'type') {
|
|
@@ -131,7 +142,6 @@ function hasStaticImportOfDynamicResource(node, graph, sourceProjectName, target
|
|
|
131
142
|
}
|
|
132
143
|
return onlyLoadChildren(graph, sourceProjectName, targetProjectName, []);
|
|
133
144
|
}
|
|
134
|
-
exports.hasStaticImportOfDynamicResource = hasStaticImportOfDynamicResource;
|
|
135
145
|
function onlyLoadChildren(graph, sourceProjectName, targetProjectName, visited) {
|
|
136
146
|
if (visited.indexOf(sourceProjectName) > -1) {
|
|
137
147
|
return false;
|
|
@@ -154,7 +164,6 @@ function getSourceFilePath(sourceFileName, projectPath) {
|
|
|
154
164
|
const normalizedSourceFileName = (0, devkit_1.normalizePath)(sourceFileName);
|
|
155
165
|
return normalizedSourceFileName.slice(normalizedProjectPath.length + 1);
|
|
156
166
|
}
|
|
157
|
-
exports.getSourceFilePath = getSourceFilePath;
|
|
158
167
|
/**
|
|
159
168
|
* Find constraint (if any) that explicitly banns the given target npm project
|
|
160
169
|
* @param externalProject
|
|
@@ -189,7 +198,6 @@ function hasBannedImport(source, target, depConstraints, imp) {
|
|
|
189
198
|
});
|
|
190
199
|
return depConstraints.find((constraint) => isConstraintBanningProject(target, constraint, imp));
|
|
191
200
|
}
|
|
192
|
-
exports.hasBannedImport = hasBannedImport;
|
|
193
201
|
/**
|
|
194
202
|
* Find all unique (transitive) external dependencies of given project
|
|
195
203
|
* @param graph
|
|
@@ -221,7 +229,6 @@ function findTransitiveExternalDependencies(graph, source) {
|
|
|
221
229
|
}
|
|
222
230
|
return externalDependencies;
|
|
223
231
|
}
|
|
224
|
-
exports.findTransitiveExternalDependencies = findTransitiveExternalDependencies;
|
|
225
232
|
/**
|
|
226
233
|
* Check if
|
|
227
234
|
* @param externalDependencies
|
|
@@ -238,12 +245,10 @@ function hasBannedDependencies(externalDependencies, graph, depConstraint, imp)
|
|
|
238
245
|
depConstraint,
|
|
239
246
|
]);
|
|
240
247
|
}
|
|
241
|
-
exports.hasBannedDependencies = hasBannedDependencies;
|
|
242
248
|
function isDirectDependency(source, target) {
|
|
243
249
|
return (packageExistsInPackageJson(target.data.packageName, '.') ||
|
|
244
250
|
packageExistsInPackageJson(target.data.packageName, source.data.root));
|
|
245
251
|
}
|
|
246
|
-
exports.isDirectDependency = isDirectDependency;
|
|
247
252
|
function packageExistsInPackageJson(packageName, projectRoot) {
|
|
248
253
|
const content = (0, fileutils_1.readFileIfExisting)(path.join(devkit_1.workspaceRoot, projectRoot, 'package.json'));
|
|
249
254
|
if (content) {
|
|
@@ -280,7 +285,6 @@ function hasBuildExecutor(projectGraph, buildTargets = ['build']) {
|
|
|
280
285
|
buildTargets.some((target) => projectGraph.data.targets[target] &&
|
|
281
286
|
projectGraph.data.targets[target].executor !== ''));
|
|
282
287
|
}
|
|
283
|
-
exports.hasBuildExecutor = hasBuildExecutor;
|
|
284
288
|
const ESLINT_REGEX = /node_modules.*[\/\\]eslint(?:\.js)?$/;
|
|
285
289
|
const JEST_REGEX = /node_modules\/.bin\/jest$/; // when we run unit tests in jest
|
|
286
290
|
const NRWL_CLI_REGEX = /nx[\/\\]bin[\/\\]run-executor\.js$/;
|
|
@@ -291,7 +295,6 @@ function isTerminalRun() {
|
|
|
291
295
|
!!process.argv[1].match(ESLINT_REGEX) ||
|
|
292
296
|
!!process.argv[1].endsWith('/bin/jest.js')));
|
|
293
297
|
}
|
|
294
|
-
exports.isTerminalRun = isTerminalRun;
|
|
295
298
|
/**
|
|
296
299
|
* Takes an array of imports and tries to group them, so rather than having
|
|
297
300
|
* `import { A } from './some-location'` and `import { B } from './some-location'` you get
|
|
@@ -319,7 +322,6 @@ function groupImports(importsToRemap) {
|
|
|
319
322
|
.map((entry) => `import { ${entry.member} } from '${entry.importPath}';`)
|
|
320
323
|
.join('\n');
|
|
321
324
|
}
|
|
322
|
-
exports.groupImports = groupImports;
|
|
323
325
|
/**
|
|
324
326
|
* Checks if source file belongs to a secondary entry point different than the import one
|
|
325
327
|
*/
|
|
@@ -334,7 +336,6 @@ function belongsToDifferentNgEntryPoint(importExpr, filePath, projectRoot) {
|
|
|
334
336
|
// check if the entry point of import expression is different than the source file's entry point
|
|
335
337
|
return importEntryPoint !== srcEntryPoint;
|
|
336
338
|
}
|
|
337
|
-
exports.belongsToDifferentNgEntryPoint = belongsToDifferentNgEntryPoint;
|
|
338
339
|
function getAngularEntryPoint(file, projectRoot) {
|
|
339
340
|
let parent = (0, devkit_1.joinPathFragments)(file, '../');
|
|
340
341
|
while (parent !== `${projectRoot}/`) {
|
|
@@ -361,7 +362,6 @@ function appIsMFERemote(project) {
|
|
|
361
362
|
}
|
|
362
363
|
return false;
|
|
363
364
|
}
|
|
364
|
-
exports.appIsMFERemote = appIsMFERemote;
|
|
365
365
|
/**
|
|
366
366
|
* parserServices moved from the context object to the nested sourceCode object in v8,
|
|
367
367
|
* and was removed from its original location in v9.
|
|
@@ -376,4 +376,3 @@ function getParserServices(context) {
|
|
|
376
376
|
}
|
|
377
377
|
return parserServices;
|
|
378
378
|
}
|
|
379
|
-
exports.getParserServices = getParserServices;
|