@nx/workspace 0.0.0-pr-22179-271588f
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/LICENSE +22 -0
- package/README.md +66 -0
- package/executors.json +11 -0
- package/generators.d.ts +5 -0
- package/generators.js +13 -0
- package/generators.json +59 -0
- package/index.d.ts +12 -0
- package/index.js +33 -0
- package/migrations.json +90 -0
- package/package.json +76 -0
- package/presets/core.json +11 -0
- package/presets/npm.json +7 -0
- package/src/core/file-utils.d.ts +1 -0
- package/src/core/file-utils.js +4 -0
- package/src/core/project-graph.d.ts +1 -0
- package/src/core/project-graph.js +4 -0
- package/src/executors/counter/counter.impl.d.ts +12 -0
- package/src/executors/counter/counter.impl.js +40 -0
- package/src/executors/counter/schema.json +20 -0
- package/src/generators/ci-workflow/ci-workflow.d.ts +6 -0
- package/src/generators/ci-workflow/ci-workflow.js +60 -0
- package/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +54 -0
- package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +41 -0
- package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +33 -0
- package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +38 -0
- package/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +24 -0
- package/src/generators/ci-workflow/schema.json +38 -0
- package/src/generators/convert-to-monorepo/convert-to-monorepo.d.ts +3 -0
- package/src/generators/convert-to-monorepo/convert-to-monorepo.js +41 -0
- package/src/generators/convert-to-monorepo/schema.json +16 -0
- package/src/generators/convert-to-nx-project/convert-to-nx-project.d.ts +5 -0
- package/src/generators/convert-to-nx-project/convert-to-nx-project.js +79 -0
- package/src/generators/convert-to-nx-project/schema.d.ts +7 -0
- package/src/generators/convert-to-nx-project/schema.json +38 -0
- package/src/generators/move/lib/check-destination.d.ts +11 -0
- package/src/generators/move/lib/check-destination.js +21 -0
- package/src/generators/move/lib/create-project-configuration-in-new-destination.d.ts +3 -0
- package/src/generators/move/lib/create-project-configuration-in-new-destination.js +54 -0
- package/src/generators/move/lib/extract-base-configs.d.ts +4 -0
- package/src/generators/move/lib/extract-base-configs.js +43 -0
- package/src/generators/move/lib/move-project-files.d.ts +8 -0
- package/src/generators/move/lib/move-project-files.js +60 -0
- package/src/generators/move/lib/normalize-schema.d.ts +3 -0
- package/src/generators/move/lib/normalize-schema.js +183 -0
- package/src/generators/move/lib/run-angular-plugin.d.ts +3 -0
- package/src/generators/move/lib/run-angular-plugin.js +19 -0
- package/src/generators/move/lib/update-build-targets.d.ts +6 -0
- package/src/generators/move/lib/update-build-targets.js +53 -0
- package/src/generators/move/lib/update-cypress-config.d.ts +10 -0
- package/src/generators/move/lib/update-cypress-config.js +40 -0
- package/src/generators/move/lib/update-default-project.d.ts +10 -0
- package/src/generators/move/lib/update-default-project.js +20 -0
- package/src/generators/move/lib/update-eslint-config.d.ts +8 -0
- package/src/generators/move/lib/update-eslint-config.js +33 -0
- package/src/generators/move/lib/update-implicit-dependencies.d.ts +6 -0
- package/src/generators/move/lib/update-implicit-dependencies.js +19 -0
- package/src/generators/move/lib/update-imports.d.ts +8 -0
- package/src/generators/move/lib/update-imports.js +182 -0
- package/src/generators/move/lib/update-jest-config.d.ts +10 -0
- package/src/generators/move/lib/update-jest-config.js +49 -0
- package/src/generators/move/lib/update-package-json.d.ts +8 -0
- package/src/generators/move/lib/update-package-json.js +24 -0
- package/src/generators/move/lib/update-project-root-files.d.ts +12 -0
- package/src/generators/move/lib/update-project-root-files.js +87 -0
- package/src/generators/move/lib/update-readme.d.ts +8 -0
- package/src/generators/move/lib/update-readme.js +21 -0
- package/src/generators/move/lib/update-storybook-config.d.ts +10 -0
- package/src/generators/move/lib/update-storybook-config.js +43 -0
- package/src/generators/move/lib/utils.d.ts +22 -0
- package/src/generators/move/lib/utils.js +49 -0
- package/src/generators/move/move.d.ts +5 -0
- package/src/generators/move/move.js +63 -0
- package/src/generators/move/schema.d.ts +15 -0
- package/src/generators/move/schema.json +59 -0
- package/src/generators/new/files-integrated-repo/__dot__editorconfig +13 -0
- package/src/generators/new/files-integrated-repo/__dot__gitignore +41 -0
- package/src/generators/new/files-integrated-repo/__dot__vscode/extensions.json__tmpl__ +9 -0
- package/src/generators/new/files-integrated-repo/package.json__tmpl__ +14 -0
- package/src/generators/new/files-package-based-repo/__dot__gitignore +41 -0
- package/src/generators/new/files-package-based-repo/__dot__vscode/extensions.json__tmpl__ +8 -0
- package/src/generators/new/files-package-based-repo/package.json__tmpl__ +13 -0
- package/src/generators/new/files-readme/README.md.template +89 -0
- package/src/generators/new/files-root-app/__dot__gitignore +41 -0
- package/src/generators/new/files-root-app/__dot__vscode/extensions.json__tmpl__ +6 -0
- package/src/generators/new/files-root-app/package.json__tmpl__ +17 -0
- package/src/generators/new/generate-preset.d.ts +4 -0
- package/src/generators/new/generate-preset.js +162 -0
- package/src/generators/new/generate-workspace-files.d.ts +3 -0
- package/src/generators/new/generate-workspace-files.js +190 -0
- package/src/generators/new/new.d.ts +30 -0
- package/src/generators/new/new.js +84 -0
- package/src/generators/new/schema.json +92 -0
- package/src/generators/npm-package/files/index.js.template +1 -0
- package/src/generators/npm-package/npm-package.d.ts +9 -0
- package/src/generators/npm-package/npm-package.js +53 -0
- package/src/generators/npm-package/schema.json +31 -0
- package/src/generators/preset/preset.d.ts +4 -0
- package/src/generators/preset/preset.js +301 -0
- package/src/generators/preset/schema.d.ts +22 -0
- package/src/generators/preset/schema.json +109 -0
- package/src/generators/remove/lib/__fixtures__/jest-project.config.d.ts +14 -0
- package/src/generators/remove/lib/__fixtures__/jest-project.config.js +17 -0
- package/src/generators/remove/lib/__fixtures__/jest.config.d.ts +0 -0
- package/src/generators/remove/lib/__fixtures__/jest.config.js +8 -0
- package/src/generators/remove/lib/check-dependencies.d.ts +7 -0
- package/src/generators/remove/lib/check-dependencies.js +23 -0
- package/src/generators/remove/lib/check-project-is-safe-to-remove.d.ts +3 -0
- package/src/generators/remove/lib/check-project-is-safe-to-remove.js +25 -0
- package/src/generators/remove/lib/check-targets.d.ts +10 -0
- package/src/generators/remove/lib/check-targets.js +68 -0
- package/src/generators/remove/lib/remove-project-references-in-config.d.ts +3 -0
- package/src/generators/remove/lib/remove-project-references-in-config.js +21 -0
- package/src/generators/remove/lib/remove-project.d.ts +5 -0
- package/src/generators/remove/lib/remove-project.js +14 -0
- package/src/generators/remove/lib/update-jest-config.d.ts +6 -0
- package/src/generators/remove/lib/update-jest-config.js +75 -0
- package/src/generators/remove/lib/update-tsconfig.d.ts +8 -0
- package/src/generators/remove/lib/update-tsconfig.js +31 -0
- package/src/generators/remove/remove.d.ts +4 -0
- package/src/generators/remove/remove.js +26 -0
- package/src/generators/remove/schema.d.ts +10 -0
- package/src/generators/remove/schema.json +47 -0
- package/src/generators/run-commands/run-commands.d.ts +4 -0
- package/src/generators/run-commands/run-commands.js +25 -0
- package/src/generators/run-commands/schema.d.ts +8 -0
- package/src/generators/run-commands/schema.json +49 -0
- package/src/generators/utils/get-npm-package-version.d.ts +1 -0
- package/src/generators/utils/get-npm-package-version.js +21 -0
- package/src/generators/utils/insert-import.d.ts +2 -0
- package/src/generators/utils/insert-import.js +47 -0
- package/src/generators/utils/insert-statement.d.ts +5 -0
- package/src/generators/utils/insert-statement.js +33 -0
- package/src/generators/utils/jest-config.d.ts +2 -0
- package/src/generators/utils/jest-config.js +13 -0
- package/src/generators/utils/presets.d.ts +29 -0
- package/src/generators/utils/presets.js +34 -0
- package/src/migrations/update-15-7-0/split-configuration-into-project-json-files.d.ts +3 -0
- package/src/migrations/update-15-7-0/split-configuration-into-project-json-files.js +11 -0
- package/src/migrations/update-16-0-0/fix-invalid-babelrc.d.ts +2 -0
- package/src/migrations/update-16-0-0/fix-invalid-babelrc.js +41 -0
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.d.ts +2 -0
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.js +187 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
- package/src/tasks-runner/cache.d.ts +1 -0
- package/src/tasks-runner/cache.js +5 -0
- package/src/tasks-runner/default-tasks-runner.d.ts +1 -0
- package/src/tasks-runner/default-tasks-runner.js +4 -0
- package/src/tasks-runner/life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycle.js +5 -0
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +4 -0
- package/src/tasks-runner/tasks-runner.d.ts +2 -0
- package/src/tasks-runner/tasks-runner.js +4 -0
- package/src/tasks-runner/utils.d.ts +1 -0
- package/src/tasks-runner/utils.js +4 -0
- package/src/utilities/app-root.d.ts +1 -0
- package/src/utilities/app-root.js +4 -0
- package/src/utilities/default-base.d.ts +1 -0
- package/src/utilities/default-base.js +15 -0
- package/src/utilities/fileutils.d.ts +13 -0
- package/src/utilities/fileutils.js +51 -0
- package/src/utilities/get-import-path.d.ts +3 -0
- package/src/utilities/get-import-path.js +20 -0
- package/src/utilities/output.d.ts +1 -0
- package/src/utilities/output.js +4 -0
- package/src/utilities/ts-config.d.ts +7 -0
- package/src/utilities/ts-config.js +67 -0
- package/src/utilities/typescript/compilation.d.ts +22 -0
- package/src/utilities/typescript/compilation.js +120 -0
- package/src/utilities/typescript/get-source-nodes.d.ts +5 -0
- package/src/utilities/typescript/get-source-nodes.js +21 -0
- package/src/utilities/typescript.d.ts +13 -0
- package/src/utilities/typescript.js +55 -0
- package/src/utils/ast-utils.d.ts +1 -0
- package/src/utils/ast-utils.js +5 -0
- package/src/utils/cli-config-utils.d.ts +16 -0
- package/src/utils/cli-config-utils.js +29 -0
- package/src/utils/lint.d.ts +4 -0
- package/src/utils/lint.js +2 -0
- package/src/utils/output.d.ts +52 -0
- package/src/utils/output.js +133 -0
- package/src/utils/perf-logging.d.ts +1 -0
- package/src/utils/perf-logging.js +10 -0
- package/src/utils/project-type.d.ts +5 -0
- package/src/utils/project-type.js +17 -0
- package/src/utils/versions.d.ts +3 -0
- package/src/utils/versions.js +8 -0
- package/tasks-runners/default.d.ts +1 -0
- package/tasks-runners/default.js +5 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileTypeScriptWatcher = exports.compileTypeScript = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const ts_config_1 = require("../ts-config");
|
|
7
|
+
const typescript_1 = require("../typescript");
|
|
8
|
+
let tsModule;
|
|
9
|
+
function compileTypeScript(options) {
|
|
10
|
+
const normalizedOptions = normalizeOptions(options);
|
|
11
|
+
const tsConfig = getNormalizedTsConfig(normalizedOptions);
|
|
12
|
+
if (normalizedOptions.deleteOutputPath) {
|
|
13
|
+
(0, fs_1.rmSync)(normalizedOptions.outputPath, { recursive: true, force: true });
|
|
14
|
+
}
|
|
15
|
+
return createProgram(tsConfig, normalizedOptions);
|
|
16
|
+
}
|
|
17
|
+
exports.compileTypeScript = compileTypeScript;
|
|
18
|
+
function compileTypeScriptWatcher(options, callback) {
|
|
19
|
+
if (!tsModule) {
|
|
20
|
+
tsModule = (0, typescript_1.ensureTypescript)();
|
|
21
|
+
}
|
|
22
|
+
const normalizedOptions = normalizeOptions(options);
|
|
23
|
+
const tsConfig = getNormalizedTsConfig(normalizedOptions);
|
|
24
|
+
if (normalizedOptions.deleteOutputPath) {
|
|
25
|
+
(0, fs_1.rmSync)(normalizedOptions.outputPath, { recursive: true, force: true });
|
|
26
|
+
}
|
|
27
|
+
const host = tsModule.createWatchCompilerHost(tsConfig.fileNames, tsConfig.options, tsModule.sys);
|
|
28
|
+
const originalAfterProgramCreate = host.afterProgramCreate;
|
|
29
|
+
host.afterProgramCreate = (builderProgram) => {
|
|
30
|
+
const originalProgramEmit = builderProgram.emit;
|
|
31
|
+
builderProgram.emit = (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) => {
|
|
32
|
+
const consumerCustomTransformers = options.getCustomTransformers?.(builderProgram.getProgram());
|
|
33
|
+
const mergedCustomTransformers = mergeCustomTransformers(customTransformers, consumerCustomTransformers);
|
|
34
|
+
return originalProgramEmit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, mergedCustomTransformers);
|
|
35
|
+
};
|
|
36
|
+
if (originalAfterProgramCreate)
|
|
37
|
+
originalAfterProgramCreate(builderProgram);
|
|
38
|
+
};
|
|
39
|
+
const originalOnWatchStatusChange = host.onWatchStatusChange;
|
|
40
|
+
host.onWatchStatusChange = async (a, b, c, d) => {
|
|
41
|
+
originalOnWatchStatusChange?.(a, b, c, d);
|
|
42
|
+
await callback?.(a, b, c, d);
|
|
43
|
+
};
|
|
44
|
+
return tsModule.createWatchProgram(host);
|
|
45
|
+
}
|
|
46
|
+
exports.compileTypeScriptWatcher = compileTypeScriptWatcher;
|
|
47
|
+
function mergeCustomTransformers(originalCustomTransformers, consumerCustomTransformers) {
|
|
48
|
+
if (!consumerCustomTransformers)
|
|
49
|
+
return originalCustomTransformers;
|
|
50
|
+
const mergedCustomTransformers = {};
|
|
51
|
+
if (consumerCustomTransformers.before) {
|
|
52
|
+
mergedCustomTransformers.before = originalCustomTransformers?.before
|
|
53
|
+
? [
|
|
54
|
+
...originalCustomTransformers.before,
|
|
55
|
+
...consumerCustomTransformers.before,
|
|
56
|
+
]
|
|
57
|
+
: consumerCustomTransformers.before;
|
|
58
|
+
}
|
|
59
|
+
if (consumerCustomTransformers.after) {
|
|
60
|
+
mergedCustomTransformers.after = originalCustomTransformers?.after
|
|
61
|
+
? [
|
|
62
|
+
...originalCustomTransformers.after,
|
|
63
|
+
...consumerCustomTransformers.after,
|
|
64
|
+
]
|
|
65
|
+
: consumerCustomTransformers.after;
|
|
66
|
+
}
|
|
67
|
+
if (consumerCustomTransformers.afterDeclarations) {
|
|
68
|
+
mergedCustomTransformers.afterDeclarations =
|
|
69
|
+
originalCustomTransformers?.afterDeclarations
|
|
70
|
+
? [
|
|
71
|
+
...originalCustomTransformers.afterDeclarations,
|
|
72
|
+
...consumerCustomTransformers.afterDeclarations,
|
|
73
|
+
]
|
|
74
|
+
: consumerCustomTransformers.afterDeclarations;
|
|
75
|
+
}
|
|
76
|
+
return mergedCustomTransformers;
|
|
77
|
+
}
|
|
78
|
+
function getNormalizedTsConfig(options) {
|
|
79
|
+
const tsConfig = (0, ts_config_1.readTsConfig)(options.tsConfig);
|
|
80
|
+
tsConfig.options.outDir = options.outputPath;
|
|
81
|
+
tsConfig.options.noEmitOnError = true;
|
|
82
|
+
tsConfig.options.rootDir = options.rootDir;
|
|
83
|
+
if (tsConfig.options.incremental && !tsConfig.options.tsBuildInfoFile) {
|
|
84
|
+
tsConfig.options.tsBuildInfoFile = (0, devkit_1.joinPathFragments)(options.outputPath, 'tsconfig.tsbuildinfo');
|
|
85
|
+
}
|
|
86
|
+
return tsConfig;
|
|
87
|
+
}
|
|
88
|
+
function createProgram(tsconfig, { projectName, getCustomTransformers }) {
|
|
89
|
+
if (!tsModule) {
|
|
90
|
+
tsModule = (0, typescript_1.ensureTypescript)();
|
|
91
|
+
}
|
|
92
|
+
const host = tsModule.createCompilerHost(tsconfig.options);
|
|
93
|
+
const program = tsModule.createProgram({
|
|
94
|
+
rootNames: tsconfig.fileNames,
|
|
95
|
+
options: tsconfig.options,
|
|
96
|
+
host,
|
|
97
|
+
});
|
|
98
|
+
devkit_1.logger.info(`Compiling TypeScript files for project "${projectName}"...`);
|
|
99
|
+
const results = program.emit(undefined, undefined, undefined, undefined, getCustomTransformers?.(program));
|
|
100
|
+
if (results.emitSkipped) {
|
|
101
|
+
const diagnostics = tsModule.formatDiagnosticsWithColorAndContext(results.diagnostics, {
|
|
102
|
+
getCurrentDirectory: () => tsModule.sys.getCurrentDirectory(),
|
|
103
|
+
getNewLine: () => tsModule.sys.newLine,
|
|
104
|
+
getCanonicalFileName: (name) => name,
|
|
105
|
+
});
|
|
106
|
+
devkit_1.logger.error(diagnostics);
|
|
107
|
+
return { success: false };
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
devkit_1.logger.info(`Done compiling TypeScript files for project "${projectName}".`);
|
|
111
|
+
return { success: true };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function normalizeOptions(options) {
|
|
115
|
+
return {
|
|
116
|
+
...options,
|
|
117
|
+
deleteOutputPath: options.deleteOutputPath ?? true,
|
|
118
|
+
rootDir: options.rootDir ?? options.projectRoot,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSourceNodes = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated This function will be removed from @nx/workspace in version 17. Prefer importing from @nx/js.
|
|
6
|
+
*/
|
|
7
|
+
function getSourceNodes(sourceFile) {
|
|
8
|
+
const nodes = [sourceFile];
|
|
9
|
+
const result = [];
|
|
10
|
+
while (nodes.length > 0) {
|
|
11
|
+
const node = nodes.shift();
|
|
12
|
+
if (node) {
|
|
13
|
+
result.push(node);
|
|
14
|
+
if (node.getChildCount(sourceFile) >= 0) {
|
|
15
|
+
nodes.unshift(...node.getChildren());
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
exports.getSourceNodes = getSourceNodes;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
export { compileTypeScript } from './typescript/compilation';
|
|
3
|
+
export type { TypeScriptCompilationOptions } from './typescript/compilation';
|
|
4
|
+
export { getSourceNodes } from './typescript/get-source-nodes';
|
|
5
|
+
/**
|
|
6
|
+
* Find a module based on it's import
|
|
7
|
+
*
|
|
8
|
+
* @param importExpr Import used to resolve to a module
|
|
9
|
+
* @param filePath
|
|
10
|
+
* @param tsConfigPath
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveModuleByImport(importExpr: string, filePath: string, tsConfigPath: string): string;
|
|
13
|
+
export declare function ensureTypescript(): typeof ts;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureTypescript = exports.resolveModuleByImport = exports.getSourceNodes = exports.compileTypeScript = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const versions_1 = require("../utils/versions");
|
|
7
|
+
var compilation_1 = require("./typescript/compilation");
|
|
8
|
+
Object.defineProperty(exports, "compileTypeScript", { enumerable: true, get: function () { return compilation_1.compileTypeScript; } });
|
|
9
|
+
var get_source_nodes_1 = require("./typescript/get-source-nodes");
|
|
10
|
+
Object.defineProperty(exports, "getSourceNodes", { enumerable: true, get: function () { return get_source_nodes_1.getSourceNodes; } });
|
|
11
|
+
const normalizedAppRoot = devkit_1.workspaceRoot.replace(/\\/g, '/');
|
|
12
|
+
let tsModule;
|
|
13
|
+
function readTsConfigOptions(tsConfigPath) {
|
|
14
|
+
if (!tsModule) {
|
|
15
|
+
tsModule = ensureTypescript();
|
|
16
|
+
}
|
|
17
|
+
const readResult = tsModule.readConfigFile(tsConfigPath, tsModule.sys.readFile);
|
|
18
|
+
// we don't need to scan the files, we only care about options
|
|
19
|
+
const host = {
|
|
20
|
+
readDirectory: () => [],
|
|
21
|
+
readFile: () => '',
|
|
22
|
+
fileExists: tsModule.sys.fileExists,
|
|
23
|
+
};
|
|
24
|
+
return tsModule.parseJsonConfigFileContent(readResult.config, host, (0, path_1.dirname)(tsConfigPath)).options;
|
|
25
|
+
}
|
|
26
|
+
let compilerHost;
|
|
27
|
+
/**
|
|
28
|
+
* Find a module based on it's import
|
|
29
|
+
*
|
|
30
|
+
* @param importExpr Import used to resolve to a module
|
|
31
|
+
* @param filePath
|
|
32
|
+
* @param tsConfigPath
|
|
33
|
+
*/
|
|
34
|
+
function resolveModuleByImport(importExpr, filePath, tsConfigPath) {
|
|
35
|
+
compilerHost = compilerHost || getCompilerHost(tsConfigPath);
|
|
36
|
+
const { options, host, moduleResolutionCache } = compilerHost;
|
|
37
|
+
const { resolvedModule } = tsModule.resolveModuleName(importExpr, filePath, options, host, moduleResolutionCache);
|
|
38
|
+
if (!resolvedModule) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return resolvedModule.resolvedFileName.replace(`${normalizedAppRoot}/`, '');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.resolveModuleByImport = resolveModuleByImport;
|
|
46
|
+
function getCompilerHost(tsConfigPath) {
|
|
47
|
+
const options = readTsConfigOptions(tsConfigPath);
|
|
48
|
+
const host = tsModule.createCompilerHost(options, true);
|
|
49
|
+
const moduleResolutionCache = tsModule.createModuleResolutionCache(devkit_1.workspaceRoot, host.getCanonicalFileName);
|
|
50
|
+
return { options, host, moduleResolutionCache };
|
|
51
|
+
}
|
|
52
|
+
function ensureTypescript() {
|
|
53
|
+
return (0, devkit_1.ensurePackage)('typescript', versions_1.typescriptVersion);
|
|
54
|
+
}
|
|
55
|
+
exports.ensureTypescript = ensureTypescript;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getSourceNodes } from '../utilities/typescript/get-source-nodes';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSourceNodes = void 0;
|
|
4
|
+
var get_source_nodes_1 = require("../utilities/typescript/get-source-nodes");
|
|
5
|
+
Object.defineProperty(exports, "getSourceNodes", { enumerable: true, get: function () { return get_source_nodes_1.getSourceNodes; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Nx no longer supports workspace.json
|
|
4
|
+
*/
|
|
5
|
+
export declare function getWorkspacePath(host: Tree): string;
|
|
6
|
+
export declare function parseTarget(targetString: string): {
|
|
7
|
+
project: string;
|
|
8
|
+
target: string;
|
|
9
|
+
config: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function editTarget(targetString: string, callback: any): string;
|
|
12
|
+
export declare function serializeTarget({ project, target, config }: {
|
|
13
|
+
project: any;
|
|
14
|
+
target: any;
|
|
15
|
+
config: any;
|
|
16
|
+
}): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeTarget = exports.editTarget = exports.parseTarget = exports.getWorkspacePath = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Nx no longer supports workspace.json
|
|
6
|
+
*/
|
|
7
|
+
function getWorkspacePath(host) {
|
|
8
|
+
const possibleFiles = ['/angular.json', '/workspace.json'];
|
|
9
|
+
return possibleFiles.filter((path) => host.exists(path))[0];
|
|
10
|
+
}
|
|
11
|
+
exports.getWorkspacePath = getWorkspacePath;
|
|
12
|
+
function parseTarget(targetString) {
|
|
13
|
+
const [project, target, config] = targetString.split(':');
|
|
14
|
+
return {
|
|
15
|
+
project,
|
|
16
|
+
target,
|
|
17
|
+
config,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.parseTarget = parseTarget;
|
|
21
|
+
function editTarget(targetString, callback) {
|
|
22
|
+
const parsedTarget = parseTarget(targetString);
|
|
23
|
+
return serializeTarget(callback(parsedTarget));
|
|
24
|
+
}
|
|
25
|
+
exports.editTarget = editTarget;
|
|
26
|
+
function serializeTarget({ project, target, config }) {
|
|
27
|
+
return [project, target, config].filter((part) => !!part).join(':');
|
|
28
|
+
}
|
|
29
|
+
exports.serializeTarget = serializeTarget;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as chalk from 'chalk';
|
|
2
|
+
export interface CLIErrorMessageConfig {
|
|
3
|
+
title: string;
|
|
4
|
+
bodyLines?: string[];
|
|
5
|
+
slug?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CLIWarnMessageConfig {
|
|
8
|
+
title: string;
|
|
9
|
+
bodyLines?: string[];
|
|
10
|
+
slug?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CLINoteMessageConfig {
|
|
13
|
+
title: string;
|
|
14
|
+
bodyLines?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface CLISuccessMessageConfig {
|
|
17
|
+
title: string;
|
|
18
|
+
bodyLines?: string[];
|
|
19
|
+
}
|
|
20
|
+
declare class CLIOutput {
|
|
21
|
+
private readonly NX_PREFIX;
|
|
22
|
+
/**
|
|
23
|
+
* Longer dash character which forms more of a continuous line when place side to side
|
|
24
|
+
* with itself, unlike the standard dash character
|
|
25
|
+
*/
|
|
26
|
+
private readonly VERTICAL_SEPARATOR;
|
|
27
|
+
/**
|
|
28
|
+
* Expose some color and other utility functions so that other parts of the codebase that need
|
|
29
|
+
* more fine-grained control of message bodies are still using a centralized
|
|
30
|
+
* implementation.
|
|
31
|
+
*/
|
|
32
|
+
colors: {
|
|
33
|
+
gray: chalk.Chalk;
|
|
34
|
+
};
|
|
35
|
+
bold: chalk.Chalk;
|
|
36
|
+
underline: chalk.Chalk;
|
|
37
|
+
private writeToStdOut;
|
|
38
|
+
private writeOutputTitle;
|
|
39
|
+
private writeOptionalOutputBody;
|
|
40
|
+
addNewline(): void;
|
|
41
|
+
addVerticalSeparator(): void;
|
|
42
|
+
addVerticalSeparatorWithoutNewLines(): void;
|
|
43
|
+
error({ title, slug, bodyLines }: CLIErrorMessageConfig): void;
|
|
44
|
+
warn({ title, slug, bodyLines }: CLIWarnMessageConfig): void;
|
|
45
|
+
note({ title, bodyLines }: CLINoteMessageConfig): void;
|
|
46
|
+
success({ title, bodyLines }: CLISuccessMessageConfig): void;
|
|
47
|
+
logSingleLine(message: string): void;
|
|
48
|
+
logCommand(message: string, isCached?: boolean): void;
|
|
49
|
+
log({ title, bodyLines }: CLIWarnMessageConfig): void;
|
|
50
|
+
}
|
|
51
|
+
export declare const output: CLIOutput;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.output = void 0;
|
|
4
|
+
const chalk = require("chalk");
|
|
5
|
+
/**
|
|
6
|
+
* Automatically disable styling applied by chalk if CI=true
|
|
7
|
+
*/
|
|
8
|
+
if (process.env.CI === 'true') {
|
|
9
|
+
chalk.level = 0;
|
|
10
|
+
}
|
|
11
|
+
class CLIOutput {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.NX_PREFIX = chalk.reset.inverse.bold.cyan(' NX ');
|
|
14
|
+
/**
|
|
15
|
+
* Longer dash character which forms more of a continuous line when place side to side
|
|
16
|
+
* with itself, unlike the standard dash character
|
|
17
|
+
*/
|
|
18
|
+
this.VERTICAL_SEPARATOR = '———————————————————————————————————————————————';
|
|
19
|
+
/**
|
|
20
|
+
* Expose some color and other utility functions so that other parts of the codebase that need
|
|
21
|
+
* more fine-grained control of message bodies are still using a centralized
|
|
22
|
+
* implementation.
|
|
23
|
+
*/
|
|
24
|
+
this.colors = {
|
|
25
|
+
gray: chalk.gray,
|
|
26
|
+
};
|
|
27
|
+
this.bold = chalk.bold;
|
|
28
|
+
this.underline = chalk.underline;
|
|
29
|
+
}
|
|
30
|
+
writeToStdOut(str) {
|
|
31
|
+
process.stdout.write(str);
|
|
32
|
+
}
|
|
33
|
+
writeOutputTitle({ label, title, }) {
|
|
34
|
+
let outputTitle;
|
|
35
|
+
if (label) {
|
|
36
|
+
outputTitle = `${this.NX_PREFIX} ${label} ${title}\n`;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
outputTitle = `${this.NX_PREFIX} ${title}\n`;
|
|
40
|
+
}
|
|
41
|
+
this.writeToStdOut(outputTitle);
|
|
42
|
+
}
|
|
43
|
+
writeOptionalOutputBody(bodyLines) {
|
|
44
|
+
if (!bodyLines) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.addNewline();
|
|
48
|
+
bodyLines.forEach((bodyLine) => this.writeToStdOut(` ${bodyLine}\n`));
|
|
49
|
+
}
|
|
50
|
+
addNewline() {
|
|
51
|
+
this.writeToStdOut('\n');
|
|
52
|
+
}
|
|
53
|
+
addVerticalSeparator() {
|
|
54
|
+
this.writeToStdOut(`\n${chalk.gray(this.VERTICAL_SEPARATOR)}\n\n`);
|
|
55
|
+
}
|
|
56
|
+
addVerticalSeparatorWithoutNewLines() {
|
|
57
|
+
this.writeToStdOut(`${chalk.gray(this.VERTICAL_SEPARATOR)}\n`);
|
|
58
|
+
}
|
|
59
|
+
error({ title, slug, bodyLines }) {
|
|
60
|
+
this.addNewline();
|
|
61
|
+
this.writeOutputTitle({
|
|
62
|
+
label: chalk.reset.inverse.bold.red(' ERROR '),
|
|
63
|
+
title: chalk.bold.red(title),
|
|
64
|
+
});
|
|
65
|
+
this.writeOptionalOutputBody(bodyLines);
|
|
66
|
+
/**
|
|
67
|
+
* Optional slug to be used in an Nx error message redirect URL
|
|
68
|
+
*/
|
|
69
|
+
if (slug && typeof slug === 'string') {
|
|
70
|
+
this.addNewline();
|
|
71
|
+
this.writeToStdOut(`${chalk.grey(' Learn more about this error: ')}https://errors.nx.dev/${slug}\n`);
|
|
72
|
+
}
|
|
73
|
+
this.addNewline();
|
|
74
|
+
}
|
|
75
|
+
warn({ title, slug, bodyLines }) {
|
|
76
|
+
this.addNewline();
|
|
77
|
+
this.writeOutputTitle({
|
|
78
|
+
label: chalk.reset.inverse.bold.yellow(' WARNING '),
|
|
79
|
+
title: chalk.bold.yellow(title),
|
|
80
|
+
});
|
|
81
|
+
this.writeOptionalOutputBody(bodyLines);
|
|
82
|
+
/**
|
|
83
|
+
* Optional slug to be used in an Nx warning message redirect URL
|
|
84
|
+
*/
|
|
85
|
+
if (slug && typeof slug === 'string') {
|
|
86
|
+
this.addNewline();
|
|
87
|
+
this.writeToStdOut(`${chalk.grey(' Learn more about this warning: ')}https://errors.nx.dev/${slug}\n`);
|
|
88
|
+
}
|
|
89
|
+
this.addNewline();
|
|
90
|
+
}
|
|
91
|
+
note({ title, bodyLines }) {
|
|
92
|
+
this.addNewline();
|
|
93
|
+
this.writeOutputTitle({
|
|
94
|
+
label: chalk.reset.inverse.bold.keyword('orange')(' NOTE '),
|
|
95
|
+
title: chalk.bold.keyword('orange')(title),
|
|
96
|
+
});
|
|
97
|
+
this.writeOptionalOutputBody(bodyLines);
|
|
98
|
+
this.addNewline();
|
|
99
|
+
}
|
|
100
|
+
success({ title, bodyLines }) {
|
|
101
|
+
this.addNewline();
|
|
102
|
+
this.writeOutputTitle({
|
|
103
|
+
label: chalk.reset.inverse.bold.green(' SUCCESS '),
|
|
104
|
+
title: chalk.bold.green(title),
|
|
105
|
+
});
|
|
106
|
+
this.writeOptionalOutputBody(bodyLines);
|
|
107
|
+
this.addNewline();
|
|
108
|
+
}
|
|
109
|
+
logSingleLine(message) {
|
|
110
|
+
this.addNewline();
|
|
111
|
+
this.writeOutputTitle({
|
|
112
|
+
title: message,
|
|
113
|
+
});
|
|
114
|
+
this.addNewline();
|
|
115
|
+
}
|
|
116
|
+
logCommand(message, isCached = false) {
|
|
117
|
+
this.addNewline();
|
|
118
|
+
this.writeToStdOut(chalk.bold(`> ${message} `));
|
|
119
|
+
if (isCached) {
|
|
120
|
+
this.writeToStdOut(chalk.bold.grey(`[retrieved from cache]`));
|
|
121
|
+
}
|
|
122
|
+
this.addNewline();
|
|
123
|
+
}
|
|
124
|
+
log({ title, bodyLines }) {
|
|
125
|
+
this.addNewline();
|
|
126
|
+
this.writeOutputTitle({
|
|
127
|
+
title: chalk.white(title),
|
|
128
|
+
});
|
|
129
|
+
this.writeOptionalOutputBody(bodyLines);
|
|
130
|
+
this.addNewline();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.output = new CLIOutput();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
4
|
+
if (process.env.NX_PERF_LOGGING === 'true') {
|
|
5
|
+
const obs = new perf_hooks_1.PerformanceObserver((list) => {
|
|
6
|
+
const entry = list.getEntries()[0];
|
|
7
|
+
console.log(`Time for '${entry.name}'`, entry.duration);
|
|
8
|
+
});
|
|
9
|
+
obs.observe({ entryTypes: ['measure'] });
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projectRootDir = exports.ProjectType = void 0;
|
|
4
|
+
var ProjectType;
|
|
5
|
+
(function (ProjectType) {
|
|
6
|
+
ProjectType["Application"] = "application";
|
|
7
|
+
ProjectType["Library"] = "library";
|
|
8
|
+
})(ProjectType || (exports.ProjectType = ProjectType = {}));
|
|
9
|
+
function projectRootDir(projectType) {
|
|
10
|
+
if (projectType == ProjectType.Application) {
|
|
11
|
+
return 'apps';
|
|
12
|
+
}
|
|
13
|
+
else if (projectType == ProjectType.Library) {
|
|
14
|
+
return 'libs';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.projectRootDir = projectRootDir;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.angularCliVersion = exports.typescriptVersion = exports.nxVersion = void 0;
|
|
4
|
+
exports.nxVersion = require('../../package.json').version;
|
|
5
|
+
exports.typescriptVersion = '~5.3.2';
|
|
6
|
+
// TODO: remove when preset generation is reworked and
|
|
7
|
+
// deps are not installed from workspace
|
|
8
|
+
exports.angularCliVersion = '~17.2.0';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defaultTasksRunner as default } from 'nx/src/tasks-runner/default-tasks-runner';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var default_tasks_runner_1 = require("nx/src/tasks-runner/default-tasks-runner");
|
|
5
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return default_tasks_runner_1.defaultTasksRunner; } });
|