@nx/js 16.4.0-beta.1 → 16.4.0-beta.3
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/executors.json +1 -0
- package/package.json +6 -5
- package/src/executors/node/node.impl.js +6 -3
- package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.d.ts +4 -0
- package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.js +54 -0
- package/src/executors/tsc/lib/batch/generate-temp-tsconfig.d.ts +3 -0
- package/src/executors/tsc/lib/batch/generate-temp-tsconfig.js +52 -0
- package/src/executors/tsc/lib/batch/get-task-options.d.ts +3 -0
- package/src/executors/tsc/lib/batch/get-task-options.js +24 -0
- package/src/executors/tsc/lib/batch/index.d.ts +8 -0
- package/src/executors/tsc/lib/batch/index.js +11 -0
- package/src/executors/tsc/lib/batch/normalize-tasks-options.d.ts +3 -0
- package/src/executors/tsc/lib/batch/normalize-tasks-options.js +14 -0
- package/src/executors/tsc/lib/batch/types.d.ts +12 -0
- package/src/executors/tsc/lib/batch/types.js +2 -0
- package/src/executors/tsc/lib/batch/typescript-compilation.d.ts +7 -0
- package/src/executors/tsc/lib/batch/typescript-compilation.js +195 -0
- package/src/executors/tsc/lib/batch/typescript-diagnostic-reporters.d.ts +4 -0
- package/src/executors/tsc/lib/batch/typescript-diagnostic-reporters.js +44 -0
- package/src/executors/tsc/lib/batch/watch.d.ts +3 -0
- package/src/executors/tsc/lib/batch/watch.js +63 -0
- package/src/executors/tsc/lib/get-custom-transformers-factory.d.ts +3 -0
- package/src/executors/tsc/lib/get-custom-transformers-factory.js +13 -0
- package/src/executors/tsc/lib/index.d.ts +2 -0
- package/src/executors/tsc/lib/index.js +5 -0
- package/src/executors/tsc/lib/normalize-options.d.ts +2 -0
- package/src/executors/tsc/lib/normalize-options.js +32 -0
- package/src/executors/tsc/tsc.batch-impl.d.ts +4 -0
- package/src/executors/tsc/tsc.batch-impl.js +47 -0
- package/src/executors/tsc/tsc.impl.d.ts +0 -1
- package/src/executors/tsc/tsc.impl.js +4 -39
- package/src/executors/verdaccio/verdaccio.impl.d.ts +1 -0
- package/src/executors/verdaccio/verdaccio.impl.js +18 -7
- package/src/generators/library/library.js +0 -10
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/utils/add-babel-inputs.d.ts +1 -0
- package/src/utils/add-babel-inputs.js +2 -0
- package/src/utils/assets/copy-assets-handler.d.ts +5 -1
- package/src/utils/assets/copy-assets-handler.js +34 -23
- package/src/utils/inline.d.ts +1 -1
- package/src/utils/inline.js +3 -3
- package/src/utils/schema.d.ts +3 -2
package/executors.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "16.4.0-beta.
|
|
3
|
+
"version": "16.4.0-beta.3",
|
|
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,14 +39,15 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.15.0",
|
|
40
40
|
"@babel/preset-typescript": "^7.15.0",
|
|
41
41
|
"@babel/runtime": "^7.14.8",
|
|
42
|
-
"@nrwl/js": "16.4.0-beta.
|
|
43
|
-
"@nx/devkit": "16.4.0-beta.
|
|
44
|
-
"@nx/workspace": "16.4.0-beta.
|
|
42
|
+
"@nrwl/js": "16.4.0-beta.3",
|
|
43
|
+
"@nx/devkit": "16.4.0-beta.3",
|
|
44
|
+
"@nx/workspace": "16.4.0-beta.3",
|
|
45
45
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
46
46
|
"babel-plugin-const-enum": "^1.0.1",
|
|
47
47
|
"babel-plugin-macros": "^2.8.0",
|
|
48
48
|
"babel-plugin-transform-typescript-metadata": "^0.3.1",
|
|
49
49
|
"chalk": "^4.1.0",
|
|
50
|
+
"detect-port": "^1.5.1",
|
|
50
51
|
"fast-glob": "3.2.7",
|
|
51
52
|
"fs-extra": "^11.1.0",
|
|
52
53
|
"ignore": "^5.0.4",
|
|
@@ -68,5 +69,5 @@
|
|
|
68
69
|
"access": "public"
|
|
69
70
|
},
|
|
70
71
|
"types": "./src/index.d.ts",
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "d7f500985ba56117bf17c133bf70d22e42a7af27"
|
|
72
73
|
}
|
|
@@ -25,8 +25,11 @@ function nodeExecutor(options, context) {
|
|
|
25
25
|
(_a = (_e = process.env).NODE_ENV) !== null && _a !== void 0 ? _a : (_e.NODE_ENV = (_b = context === null || context === void 0 ? void 0 : context.configurationName) !== null && _b !== void 0 ? _b : 'development');
|
|
26
26
|
const project = context.projectGraph.nodes[context.projectName];
|
|
27
27
|
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph);
|
|
28
|
-
|
|
29
|
-
if (
|
|
28
|
+
let buildOptions;
|
|
29
|
+
if (project.data.targets[buildTarget.target]) {
|
|
30
|
+
buildOptions = Object.assign(Object.assign({}, (_c = project.data.targets[buildTarget.target]) === null || _c === void 0 ? void 0 : _c.options), options.buildTargetOptions);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
30
33
|
throw new Error(`Cannot find build target ${chalk.bold(options.buildTarget)} for project ${chalk.bold(context.projectName)}`);
|
|
31
34
|
}
|
|
32
35
|
// Re-map buildable workspace projects to their output directory.
|
|
@@ -90,7 +93,7 @@ function nodeExecutor(options, context) {
|
|
|
90
93
|
// Run the program
|
|
91
94
|
task.promise = new Promise((resolve, reject) => {
|
|
92
95
|
var _a;
|
|
93
|
-
task.childProcess = (0, child_process_1.fork)((0, devkit_1.joinPathFragments)(__dirname, 'node-with-require-overrides'), (_a = options.
|
|
96
|
+
task.childProcess = (0, child_process_1.fork)((0, devkit_1.joinPathFragments)(__dirname, 'node-with-require-overrides'), (_a = options.args) !== null && _a !== void 0 ? _a : [], {
|
|
94
97
|
execArgv: getExecArgv(options),
|
|
95
98
|
stdio: [0, 1, 'pipe', 'ipc'],
|
|
96
99
|
env: Object.assign(Object.assign({}, process.env), { NX_FILE_TO_RUN: fileToRun, NX_MAPPINGS: JSON.stringify(mappings) }),
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import type { NormalizedExecutorOptions } from '../../../../utils/schema';
|
|
3
|
+
import type { TaskInfo } from './types';
|
|
4
|
+
export declare function buildTaskInfoPerTsConfigMap(tsConfigTaskInfoMap: Record<string, TaskInfo>, tasksOptions: Record<string, NormalizedExecutorOptions>, context: ExecutorContext, tasks: string[], shouldWatch: boolean): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildTaskInfoPerTsConfigMap = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const copy_assets_handler_1 = require("../../../../utils/assets/copy-assets-handler");
|
|
6
|
+
const buildable_libs_utils_1 = require("../../../../utils/buildable-libs-utils");
|
|
7
|
+
const generate_temp_tsconfig_1 = require("./generate-temp-tsconfig");
|
|
8
|
+
const get_task_options_1 = require("./get-task-options");
|
|
9
|
+
const taskTsConfigCache = new Set();
|
|
10
|
+
function buildTaskInfoPerTsConfigMap(tsConfigTaskInfoMap, tasksOptions, context, tasks, shouldWatch) {
|
|
11
|
+
for (const taskName of tasks) {
|
|
12
|
+
if (taskTsConfigCache.has(taskName)) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
let taskOptions = tasksOptions[taskName];
|
|
16
|
+
// task is in the batch (it's meant to be processed), create TaskInfo
|
|
17
|
+
if (taskOptions) {
|
|
18
|
+
const taskInfo = createTaskInfo(taskName, taskOptions, context);
|
|
19
|
+
const tsConfigPath = (0, generate_temp_tsconfig_1.generateTempTsConfig)(tasksOptions, taskName, taskOptions, context);
|
|
20
|
+
tsConfigTaskInfoMap[tsConfigPath] = taskInfo;
|
|
21
|
+
taskTsConfigCache.add(taskName);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// if it's not included in the provided map, it could be a cached task and
|
|
25
|
+
// we need to pull the options from the relevant project graph node
|
|
26
|
+
taskOptions = (0, get_task_options_1.getTaskOptions)(taskName, context);
|
|
27
|
+
(0, generate_temp_tsconfig_1.generateTempTsConfig)(tasksOptions, taskName, taskOptions, context);
|
|
28
|
+
}
|
|
29
|
+
buildTaskInfoPerTsConfigMap(tsConfigTaskInfoMap, tasksOptions, context, context.taskGraph.dependencies[taskName], shouldWatch);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.buildTaskInfoPerTsConfigMap = buildTaskInfoPerTsConfigMap;
|
|
33
|
+
function createTaskInfo(taskName, taskOptions, context) {
|
|
34
|
+
const target = (0, devkit_1.parseTargetString)(taskName, context.projectGraph);
|
|
35
|
+
const taskContext = Object.assign(Object.assign({}, context), {
|
|
36
|
+
// batch executors don't get these in the context, we provide them
|
|
37
|
+
// here per task
|
|
38
|
+
projectName: target.project, targetName: target.target, configurationName: target.configuration });
|
|
39
|
+
const assetsHandler = new copy_assets_handler_1.CopyAssetsHandler({
|
|
40
|
+
projectDir: taskOptions.projectRoot,
|
|
41
|
+
rootDir: context.root,
|
|
42
|
+
outputDir: taskOptions.outputPath,
|
|
43
|
+
assets: taskOptions.assets,
|
|
44
|
+
});
|
|
45
|
+
const { target: projectGraphNode, dependencies: buildableProjectNodeDependencies, } = (0, buildable_libs_utils_1.calculateProjectDependencies)(context.projectGraph, context.root, context.taskGraph.tasks[taskName].target.project, context.taskGraph.tasks[taskName].target.target, context.taskGraph.tasks[taskName].target.configuration);
|
|
46
|
+
return {
|
|
47
|
+
task: taskName,
|
|
48
|
+
options: taskOptions,
|
|
49
|
+
context: taskContext,
|
|
50
|
+
assetsHandler,
|
|
51
|
+
buildableProjectNodeDependencies,
|
|
52
|
+
projectGraphNode,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import type { NormalizedExecutorOptions } from '../../../../utils/schema';
|
|
3
|
+
export declare function generateTempTsConfig(taskOptionsMap: Record<string, NormalizedExecutorOptions>, taskName: string, taskOptions: NormalizedExecutorOptions, context: ExecutorContext): string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateTempTsConfig = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const ts = require("typescript");
|
|
7
|
+
const get_task_options_1 = require("./get-task-options");
|
|
8
|
+
function generateTempTsConfig(taskOptionsMap, taskName, taskOptions, context) {
|
|
9
|
+
const tmpDir = (0, path_1.join)(context.root, 'tmp');
|
|
10
|
+
const originalTsConfigPath = taskOptions.tsConfig;
|
|
11
|
+
const tmpTsConfigPath = (0, path_1.join)(tmpDir, (0, path_1.relative)(context.root, originalTsConfigPath));
|
|
12
|
+
const projectReferences = [];
|
|
13
|
+
for (const depTask of context.taskGraph.dependencies[taskName]) {
|
|
14
|
+
// if included in the provided map, use it
|
|
15
|
+
if (taskOptionsMap[depTask]) {
|
|
16
|
+
projectReferences.push({
|
|
17
|
+
path: (0, path_1.join)(tmpDir, (0, path_1.relative)(context.root, taskOptionsMap[depTask].tsConfig)),
|
|
18
|
+
});
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
// if it's not included in the provided map, it could be a cached task and
|
|
22
|
+
// we need to pull the tsconfig from the relevant project graph node
|
|
23
|
+
const options = (0, get_task_options_1.getTaskOptions)(depTask, context);
|
|
24
|
+
if (options.tsConfig) {
|
|
25
|
+
projectReferences.push({
|
|
26
|
+
path: (0, path_1.join)(tmpDir, (0, path_1.relative)(context.root, options.tsConfig)),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
(0, devkit_1.writeJsonFile)(tmpTsConfigPath, {
|
|
31
|
+
extends: (0, devkit_1.normalizePath)((0, path_1.relative)((0, path_1.dirname)(tmpTsConfigPath), taskOptions.tsConfig)),
|
|
32
|
+
compilerOptions: {
|
|
33
|
+
rootDir: taskOptions.rootDir,
|
|
34
|
+
outDir: taskOptions.outputPath,
|
|
35
|
+
composite: true,
|
|
36
|
+
declaration: true,
|
|
37
|
+
declarationMap: true,
|
|
38
|
+
tsBuildInfoFile: (0, devkit_1.joinPathFragments)(taskOptions.outputPath, 'tsconfig.tsbuildinfo'),
|
|
39
|
+
},
|
|
40
|
+
references: projectReferences,
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Ensure the temp tsconfig has the same modified date as the original.
|
|
44
|
+
* Typescript compares this against the modified date of the tsbuildinfo
|
|
45
|
+
* file. If the tsbuildinfo file is older, the cache is invalidated.
|
|
46
|
+
* Since we always generate the temp tsconfig, any existing tsbuildinfo
|
|
47
|
+
* file will be older even if they are not older than the original tsconfig.
|
|
48
|
+
*/
|
|
49
|
+
ts.sys.setModifiedTime(tmpTsConfigPath, ts.sys.getModifiedTime(originalTsConfigPath));
|
|
50
|
+
return tmpTsConfigPath;
|
|
51
|
+
}
|
|
52
|
+
exports.generateTempTsConfig = generateTempTsConfig;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTaskOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const normalize_options_1 = require("../normalize-options");
|
|
6
|
+
const tasksOptionsCache = new Map();
|
|
7
|
+
function getTaskOptions(taskName, context) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
if (tasksOptionsCache.has(taskName)) {
|
|
10
|
+
return tasksOptionsCache.get(taskName);
|
|
11
|
+
}
|
|
12
|
+
const target = context.taskGraph.tasks[taskName].target;
|
|
13
|
+
const projectNode = context.projectGraph.nodes[target.project];
|
|
14
|
+
const targetConfig = (_a = projectNode.data.targets) === null || _a === void 0 ? void 0 : _a[target.target];
|
|
15
|
+
const taskOptions = Object.assign(Object.assign({}, targetConfig.options), (target.configuration
|
|
16
|
+
? (_b = targetConfig.configurations) === null || _b === void 0 ? void 0 : _b[target.configuration]
|
|
17
|
+
: {}));
|
|
18
|
+
const { project } = (0, devkit_1.parseTargetString)(taskName, context.projectGraph);
|
|
19
|
+
const { sourceRoot, root } = context.projectsConfigurations.projects[project];
|
|
20
|
+
const normalizedTaskOptions = (0, normalize_options_1.normalizeOptions)(taskOptions, context.root, sourceRoot, root);
|
|
21
|
+
tasksOptionsCache.set(taskName, normalizedTaskOptions);
|
|
22
|
+
return normalizedTaskOptions;
|
|
23
|
+
}
|
|
24
|
+
exports.getTaskOptions = getTaskOptions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './build-task-info-per-tsconfig-map';
|
|
2
|
+
export * from './generate-temp-tsconfig';
|
|
3
|
+
export * from './get-task-options';
|
|
4
|
+
export * from './normalize-tasks-options';
|
|
5
|
+
export * from './types';
|
|
6
|
+
export * from './typescript-compilation';
|
|
7
|
+
export * from './typescript-diagnostic-reporters';
|
|
8
|
+
export * from './watch';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./build-task-info-per-tsconfig-map"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./generate-temp-tsconfig"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./get-task-options"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./normalize-tasks-options"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./typescript-compilation"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./typescript-diagnostic-reporters"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./watch"), exports);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import type { ExecutorOptions, NormalizedExecutorOptions } from '../../../../utils/schema';
|
|
3
|
+
export declare function normalizeTasksOptions(inputs: Record<string, ExecutorOptions>, context: ExecutorContext): Record<string, NormalizedExecutorOptions>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeTasksOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const normalize_options_1 = require("../normalize-options");
|
|
6
|
+
function normalizeTasksOptions(inputs, context) {
|
|
7
|
+
return Object.entries(inputs).reduce((tasksOptions, [taskName, options]) => {
|
|
8
|
+
const { project } = (0, devkit_1.parseTargetString)(taskName, context.projectGraph);
|
|
9
|
+
const { sourceRoot, root } = context.projectsConfigurations.projects[project];
|
|
10
|
+
tasksOptions[taskName] = (0, normalize_options_1.normalizeOptions)(options, context.root, sourceRoot, root);
|
|
11
|
+
return tasksOptions;
|
|
12
|
+
}, {});
|
|
13
|
+
}
|
|
14
|
+
exports.normalizeTasksOptions = normalizeTasksOptions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExecutorContext, ProjectGraphProjectNode } from '@nx/devkit';
|
|
2
|
+
import type { CopyAssetsHandler } from '../../../../utils/assets/copy-assets-handler';
|
|
3
|
+
import type { DependentBuildableProjectNode } from '../../../../utils/buildable-libs-utils';
|
|
4
|
+
import type { NormalizedExecutorOptions } from '../../../../utils/schema';
|
|
5
|
+
export interface TaskInfo {
|
|
6
|
+
task: string;
|
|
7
|
+
options: NormalizedExecutorOptions;
|
|
8
|
+
context: ExecutorContext;
|
|
9
|
+
assetsHandler: CopyAssetsHandler;
|
|
10
|
+
buildableProjectNodeDependencies: DependentBuildableProjectNode[];
|
|
11
|
+
projectGraphNode: ProjectGraphProjectNode;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TaskGraph } from '@nx/devkit';
|
|
2
|
+
import type { BatchResults } from 'nx/src/tasks-runner/batch/batch-messages';
|
|
3
|
+
import type { TaskInfo } from './types';
|
|
4
|
+
export declare function compileBatchTypescript(tsConfigTaskInfoMap: Record<string, TaskInfo>, taskGraph: TaskGraph, watch: boolean, postProjectCompilationCallback: (taskInfo: TaskInfo) => void): {
|
|
5
|
+
iterator: AsyncIterable<BatchResults>;
|
|
6
|
+
close: () => void | Promise<void>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileBatchTypescript = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
6
|
+
const ts = require("typescript");
|
|
7
|
+
const get_custom_transformers_factory_1 = require("../get-custom-transformers-factory");
|
|
8
|
+
const typescript_diagnostic_reporters_1 = require("./typescript-diagnostic-reporters");
|
|
9
|
+
// https://github.com/microsoft/TypeScript/blob/d45012c5e2ab122919ee4777a7887307c5f4a1e0/src/compiler/diagnosticMessages.json#L4050-L4053
|
|
10
|
+
// Typescript diagnostic message for 5083: Cannot read file '{0}'.
|
|
11
|
+
const TYPESCRIPT_CANNOT_READ_FILE = 5083;
|
|
12
|
+
// https://github.com/microsoft/TypeScript/blob/d45012c5e2ab122919ee4777a7887307c5f4a1e0/src/compiler/diagnosticMessages.json#L4211-4214
|
|
13
|
+
// Typescript diagnostic message for 6032: File change detected. Starting incremental compilation...
|
|
14
|
+
const TYPESCRIPT_FILE_CHANGE_DETECTED_STARTING_INCREMENTAL_COMPILATION = 6032;
|
|
15
|
+
function compileBatchTypescript(tsConfigTaskInfoMap, taskGraph, watch, postProjectCompilationCallback) {
|
|
16
|
+
const timeNow = Date.now();
|
|
17
|
+
const defaultResults = Object.keys(taskGraph.tasks).reduce((acc, task) => {
|
|
18
|
+
acc[task] = { success: true, startTime: timeNow, terminalOutput: '' };
|
|
19
|
+
return acc;
|
|
20
|
+
}, {});
|
|
21
|
+
let tearDown;
|
|
22
|
+
return {
|
|
23
|
+
iterator: (0, async_iterable_1.createAsyncIterable)(({ next, done }) => {
|
|
24
|
+
if (watch) {
|
|
25
|
+
compileTSWithWatch(tsConfigTaskInfoMap, postProjectCompilationCallback);
|
|
26
|
+
tearDown = () => {
|
|
27
|
+
done();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const compilationResults = compileTS(tsConfigTaskInfoMap, postProjectCompilationCallback);
|
|
32
|
+
next(Object.assign(Object.assign({}, defaultResults), compilationResults));
|
|
33
|
+
done();
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
close: () => tearDown === null || tearDown === void 0 ? void 0 : tearDown(),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
exports.compileBatchTypescript = compileBatchTypescript;
|
|
40
|
+
function compileTSWithWatch(tsConfigTaskInfoMap, postProjectCompilationCallback) {
|
|
41
|
+
const formatDiagnosticsHost = {
|
|
42
|
+
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
|
43
|
+
getNewLine: () => ts.sys.newLine,
|
|
44
|
+
getCanonicalFileName: (filename) => ts.sys.useCaseSensitiveFileNames ? filename : filename.toLowerCase(),
|
|
45
|
+
};
|
|
46
|
+
const solutionHost = ts.createSolutionBuilderWithWatchHost(ts.sys,
|
|
47
|
+
/*createProgram*/ undefined, (diagnostic) => {
|
|
48
|
+
const formattedDiagnostic = (0, typescript_diagnostic_reporters_1.formatDiagnosticReport)(diagnostic, formatDiagnosticsHost);
|
|
49
|
+
devkit_1.logger.info(formattedDiagnostic);
|
|
50
|
+
}, (diagnostic) => {
|
|
51
|
+
const formattedDiagnostic = (0, typescript_diagnostic_reporters_1.formatSolutionBuilderStatusReport)(diagnostic);
|
|
52
|
+
devkit_1.logger.info(formattedDiagnostic);
|
|
53
|
+
}, (diagnostic, newLine) => {
|
|
54
|
+
const formattedDiagnostic = (0, typescript_diagnostic_reporters_1.formatWatchStatusReport)(diagnostic, newLine);
|
|
55
|
+
devkit_1.logger.info(formattedDiagnostic);
|
|
56
|
+
if (diagnostic.code ===
|
|
57
|
+
TYPESCRIPT_FILE_CHANGE_DETECTED_STARTING_INCREMENTAL_COMPILATION) {
|
|
58
|
+
// there's a change, build invalidated projects
|
|
59
|
+
build();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const rootNames = Object.keys(tsConfigTaskInfoMap);
|
|
63
|
+
const solutionBuilder = ts.createSolutionBuilderWithWatch(solutionHost, rootNames, {});
|
|
64
|
+
const build = () => {
|
|
65
|
+
while (true) {
|
|
66
|
+
const project = solutionBuilder.getNextInvalidatedProject();
|
|
67
|
+
if (!project) {
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
const taskInfo = tsConfigTaskInfoMap[project.project];
|
|
71
|
+
if (project.kind === ts.InvalidatedProjectKind.UpdateOutputFileStamps) {
|
|
72
|
+
// update output timestamps and mark project as complete
|
|
73
|
+
project.done();
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* This only applies when the deprecated `prepend` option is set to `true`.
|
|
78
|
+
* Skip support.
|
|
79
|
+
*/
|
|
80
|
+
if (project.kind === ts.InvalidatedProjectKind.UpdateBundle) {
|
|
81
|
+
devkit_1.logger.warn(`The project ${taskInfo.context.projectName} ` +
|
|
82
|
+
`is using the deprecated "prepend" Typescript compiler option. ` +
|
|
83
|
+
`This option is not supported by the batch executor and it's ignored.`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
// build and mark project as complete
|
|
87
|
+
project.done(undefined, undefined, (0, get_custom_transformers_factory_1.getCustomTrasformersFactory)(taskInfo.options.transformers)(project.getProgram()));
|
|
88
|
+
postProjectCompilationCallback(taskInfo);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// initial build
|
|
92
|
+
build();
|
|
93
|
+
/**
|
|
94
|
+
* This is a workaround to get the TS file watching to kick off. It won't
|
|
95
|
+
* build twice since the `build` call above will mark invalidated projects
|
|
96
|
+
* as completed and then, the implementation of the `solutionBuilder.build`
|
|
97
|
+
* skips them.
|
|
98
|
+
* We can't rely solely in `solutionBuilder.build()` because it doesn't
|
|
99
|
+
* accept custom transformers.
|
|
100
|
+
*/
|
|
101
|
+
solutionBuilder.build();
|
|
102
|
+
return solutionHost;
|
|
103
|
+
}
|
|
104
|
+
function compileTS(tsConfigTaskInfoMap, postProjectCompilationCallback) {
|
|
105
|
+
var _a;
|
|
106
|
+
const results = {};
|
|
107
|
+
let terminalOutput;
|
|
108
|
+
const logInfo = (text) => {
|
|
109
|
+
devkit_1.logger.info(text);
|
|
110
|
+
terminalOutput += `${text}\n`;
|
|
111
|
+
};
|
|
112
|
+
const logWarn = (text) => {
|
|
113
|
+
devkit_1.logger.warn(text);
|
|
114
|
+
terminalOutput += `${text}\n`;
|
|
115
|
+
};
|
|
116
|
+
const formatDiagnosticsHost = {
|
|
117
|
+
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
|
118
|
+
getNewLine: () => ts.sys.newLine,
|
|
119
|
+
getCanonicalFileName: (filename) => ts.sys.useCaseSensitiveFileNames ? filename : filename.toLowerCase(),
|
|
120
|
+
};
|
|
121
|
+
const solutionBuilderHost = ts.createSolutionBuilderHost(ts.sys,
|
|
122
|
+
/*createProgram*/ undefined, (diagnostic) => {
|
|
123
|
+
const formattedDiagnostic = (0, typescript_diagnostic_reporters_1.formatDiagnosticReport)(diagnostic, formatDiagnosticsHost);
|
|
124
|
+
// handles edge case where a wrong a project reference path can't be read
|
|
125
|
+
if (diagnostic.code === TYPESCRIPT_CANNOT_READ_FILE) {
|
|
126
|
+
Object.values(tsConfigTaskInfoMap).forEach((taskInfo) => {
|
|
127
|
+
var _a, _b;
|
|
128
|
+
var _c;
|
|
129
|
+
(_a = results[_c = taskInfo.task]) !== null && _a !== void 0 ? _a : (results[_c] = { success: false, terminalOutput: '' });
|
|
130
|
+
results[taskInfo.task].success = false;
|
|
131
|
+
results[taskInfo.task].terminalOutput = `${(_b = results[taskInfo.task]) === null || _b === void 0 ? void 0 : _b.terminalOutput}${formattedDiagnostic}`;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
logInfo(formattedDiagnostic);
|
|
135
|
+
}, (diagnostic) => {
|
|
136
|
+
const formattedDiagnostic = (0, typescript_diagnostic_reporters_1.formatSolutionBuilderStatusReport)(diagnostic);
|
|
137
|
+
logInfo(formattedDiagnostic);
|
|
138
|
+
});
|
|
139
|
+
const rootNames = Object.keys(tsConfigTaskInfoMap);
|
|
140
|
+
const solutionBuilder = ts.createSolutionBuilder(solutionBuilderHost, rootNames, {});
|
|
141
|
+
// eslint-disable-next-line no-constant-condition
|
|
142
|
+
while (true) {
|
|
143
|
+
const project = solutionBuilder.getNextInvalidatedProject();
|
|
144
|
+
if (!project) {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
const startTime = Date.now();
|
|
148
|
+
terminalOutput = '';
|
|
149
|
+
const taskInfo = tsConfigTaskInfoMap[project.project];
|
|
150
|
+
const projectName = (_a = taskInfo === null || taskInfo === void 0 ? void 0 : taskInfo.context) === null || _a === void 0 ? void 0 : _a.projectName;
|
|
151
|
+
if (project.kind === ts.InvalidatedProjectKind.UpdateOutputFileStamps) {
|
|
152
|
+
if (projectName) {
|
|
153
|
+
logInfo(`Updating output timestamps of project "${projectName}"...`);
|
|
154
|
+
}
|
|
155
|
+
// update output timestamps and mark project as complete
|
|
156
|
+
const status = project.done();
|
|
157
|
+
if (projectName && status === ts.ExitStatus.Success) {
|
|
158
|
+
logInfo(`Done updating output timestamps of project "${projectName}"...`);
|
|
159
|
+
}
|
|
160
|
+
if (taskInfo) {
|
|
161
|
+
results[taskInfo.task] = {
|
|
162
|
+
success: status === ts.ExitStatus.Success,
|
|
163
|
+
terminalOutput,
|
|
164
|
+
startTime,
|
|
165
|
+
endTime: Date.now(),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* This only applies when the deprecated `prepend` option is set to `true`.
|
|
172
|
+
* Skip support.
|
|
173
|
+
*/
|
|
174
|
+
if (project.kind === ts.InvalidatedProjectKind.UpdateBundle) {
|
|
175
|
+
logWarn(`The project ${taskInfo.context.projectName} ` +
|
|
176
|
+
`is using the deprecated "prepend" Typescript compiler option. ` +
|
|
177
|
+
`This option is not supported by the batch executor and it's ignored.`);
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
logInfo(`Compiling TypeScript files for project "${projectName}"...`);
|
|
181
|
+
// build and mark project as complete
|
|
182
|
+
const status = project.done(undefined, undefined, (0, get_custom_transformers_factory_1.getCustomTrasformersFactory)(taskInfo.options.transformers)(project.getProgram()));
|
|
183
|
+
postProjectCompilationCallback(taskInfo);
|
|
184
|
+
if (status === ts.ExitStatus.Success) {
|
|
185
|
+
logInfo(`Done compiling TypeScript files for project "${projectName}".`);
|
|
186
|
+
}
|
|
187
|
+
results[taskInfo.task] = {
|
|
188
|
+
success: status === ts.ExitStatus.Success,
|
|
189
|
+
terminalOutput,
|
|
190
|
+
startTime,
|
|
191
|
+
endTime: Date.now(),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return results;
|
|
195
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
export declare function formatDiagnosticReport(diagnostic: ts.Diagnostic, host: ts.FormatDiagnosticsHost): string;
|
|
3
|
+
export declare function formatSolutionBuilderStatusReport(diagnostic: ts.Diagnostic): string;
|
|
4
|
+
export declare function formatWatchStatusReport(diagnostic: ts.Diagnostic, newLine: string): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatWatchStatusReport = exports.formatSolutionBuilderStatusReport = exports.formatDiagnosticReport = void 0;
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
// adapted from TS default diagnostic reporter
|
|
6
|
+
function formatDiagnosticReport(diagnostic, host) {
|
|
7
|
+
const diagnostics = new Array(1);
|
|
8
|
+
diagnostics[0] = diagnostic;
|
|
9
|
+
const formattedDiagnostic = '\n' +
|
|
10
|
+
ts.formatDiagnosticsWithColorAndContext(diagnostics, host) +
|
|
11
|
+
host.getNewLine();
|
|
12
|
+
diagnostics[0] = undefined;
|
|
13
|
+
return formattedDiagnostic;
|
|
14
|
+
}
|
|
15
|
+
exports.formatDiagnosticReport = formatDiagnosticReport;
|
|
16
|
+
// adapted from TS default solution builder status reporter
|
|
17
|
+
function formatSolutionBuilderStatusReport(diagnostic) {
|
|
18
|
+
let formattedDiagnostic = `[${formatColorAndReset(getLocaleTimeString(), ForegroundColorEscapeSequences.Grey)}] `;
|
|
19
|
+
formattedDiagnostic += `${ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine)}${ts.sys.newLine + ts.sys.newLine}`;
|
|
20
|
+
return formattedDiagnostic;
|
|
21
|
+
}
|
|
22
|
+
exports.formatSolutionBuilderStatusReport = formatSolutionBuilderStatusReport;
|
|
23
|
+
// adapted from TS default watch status reporter
|
|
24
|
+
function formatWatchStatusReport(diagnostic, newLine) {
|
|
25
|
+
let output = `[${formatColorAndReset(getLocaleTimeString(), ForegroundColorEscapeSequences.Grey)}] `;
|
|
26
|
+
output += `${ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine)}${newLine + newLine}`;
|
|
27
|
+
return output;
|
|
28
|
+
}
|
|
29
|
+
exports.formatWatchStatusReport = formatWatchStatusReport;
|
|
30
|
+
function formatColorAndReset(text, formatStyle) {
|
|
31
|
+
const resetEscapeSequence = '\u001b[0m';
|
|
32
|
+
return formatStyle + text + resetEscapeSequence;
|
|
33
|
+
}
|
|
34
|
+
function getLocaleTimeString() {
|
|
35
|
+
return new Date().toLocaleTimeString();
|
|
36
|
+
}
|
|
37
|
+
var ForegroundColorEscapeSequences;
|
|
38
|
+
(function (ForegroundColorEscapeSequences) {
|
|
39
|
+
ForegroundColorEscapeSequences["Grey"] = "\u001B[90m";
|
|
40
|
+
ForegroundColorEscapeSequences["Red"] = "\u001B[91m";
|
|
41
|
+
ForegroundColorEscapeSequences["Yellow"] = "\u001B[93m";
|
|
42
|
+
ForegroundColorEscapeSequences["Blue"] = "\u001B[94m";
|
|
43
|
+
ForegroundColorEscapeSequences["Cyan"] = "\u001B[96m";
|
|
44
|
+
})(ForegroundColorEscapeSequences || (ForegroundColorEscapeSequences = {}));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { TaskInfo } from './types';
|
|
2
|
+
export declare function watchTaskProjectsPackageJsonFileChanges(taskInfos: TaskInfo[], callback: (changedTaskInfos: TaskInfo[]) => void): Promise<() => void>;
|
|
3
|
+
export declare function watchTaskProjectsFileChangesForAssets(taskInfos: TaskInfo[]): Promise<() => void>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.watchTaskProjectsFileChangesForAssets = exports.watchTaskProjectsPackageJsonFileChanges = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const client_1 = require("nx/src/daemon/client/client");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
function watchTaskProjectsPackageJsonFileChanges(taskInfos, callback) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const projects = [];
|
|
11
|
+
const packageJsonTaskInfoMap = new Map();
|
|
12
|
+
taskInfos.forEach((t) => {
|
|
13
|
+
projects.push(t.context.projectName);
|
|
14
|
+
packageJsonTaskInfoMap.set((0, path_1.join)(t.options.projectRoot, 'package.json'), t);
|
|
15
|
+
});
|
|
16
|
+
const unregisterFileWatcher = yield client_1.daemonClient.registerFileWatcher({ watchProjects: projects }, (err, data) => {
|
|
17
|
+
var _a;
|
|
18
|
+
if (err === 'closed') {
|
|
19
|
+
devkit_1.logger.error(`Watch error: Daemon closed the connection`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
else if (err) {
|
|
23
|
+
devkit_1.logger.error(`Watch error: ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : 'Unknown'}`);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const changedTasks = [];
|
|
27
|
+
data.changedFiles.forEach((file) => {
|
|
28
|
+
if (packageJsonTaskInfoMap.has(file.path)) {
|
|
29
|
+
changedTasks.push(packageJsonTaskInfoMap.get(file.path));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (changedTasks.length) {
|
|
33
|
+
callback(changedTasks);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return () => unregisterFileWatcher();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.watchTaskProjectsPackageJsonFileChanges = watchTaskProjectsPackageJsonFileChanges;
|
|
41
|
+
function watchTaskProjectsFileChangesForAssets(taskInfos) {
|
|
42
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const unregisterFileWatcher = yield client_1.daemonClient.registerFileWatcher({
|
|
44
|
+
watchProjects: taskInfos.map((t) => t.context.projectName),
|
|
45
|
+
includeDependentProjects: true,
|
|
46
|
+
includeGlobalWorkspaceFiles: true,
|
|
47
|
+
}, (err, data) => {
|
|
48
|
+
var _a;
|
|
49
|
+
if (err === 'closed') {
|
|
50
|
+
devkit_1.logger.error(`Watch error: Daemon closed the connection`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
else if (err) {
|
|
54
|
+
devkit_1.logger.error(`Watch error: ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : 'Unknown'}`);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
taskInfos.forEach((t) => t.assetsHandler.processWatchEvents(data.changedFiles));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return () => unregisterFileWatcher();
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
exports.watchTaskProjectsFileChangesForAssets = watchTaskProjectsFileChangesForAssets;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCustomTrasformersFactory = void 0;
|
|
4
|
+
const load_ts_transformers_1 = require("../../../utils/typescript/load-ts-transformers");
|
|
5
|
+
function getCustomTrasformersFactory(transformers) {
|
|
6
|
+
const { compilerPluginHooks } = (0, load_ts_transformers_1.loadTsTransformers)(transformers);
|
|
7
|
+
return (program) => ({
|
|
8
|
+
before: compilerPluginHooks.beforeHooks.map((hook) => hook(program)),
|
|
9
|
+
after: compilerPluginHooks.afterHooks.map((hook) => hook(program)),
|
|
10
|
+
afterDeclarations: compilerPluginHooks.afterDeclarationsHooks.map((hook) => hook(program)),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.getCustomTrasformersFactory = getCustomTrasformersFactory;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const assets_1 = require("../../../utils/assets/assets");
|
|
6
|
+
function normalizeOptions(options, contextRoot, sourceRoot, projectRoot) {
|
|
7
|
+
const outputPath = (0, path_1.join)(contextRoot, options.outputPath);
|
|
8
|
+
const rootDir = options.rootDir
|
|
9
|
+
? (0, path_1.join)(contextRoot, options.rootDir)
|
|
10
|
+
: (0, path_1.join)(contextRoot, projectRoot);
|
|
11
|
+
if (options.watch == null) {
|
|
12
|
+
options.watch = false;
|
|
13
|
+
}
|
|
14
|
+
// TODO: put back when inlining story is more stable
|
|
15
|
+
// if (options.external == null) {
|
|
16
|
+
// options.external = 'all';
|
|
17
|
+
// } else if (Array.isArray(options.external) && options.external.length === 0) {
|
|
18
|
+
// options.external = 'none';
|
|
19
|
+
// }
|
|
20
|
+
if (Array.isArray(options.external) && options.external.length > 0) {
|
|
21
|
+
const firstItem = options.external[0];
|
|
22
|
+
if (firstItem === 'all' || firstItem === 'none') {
|
|
23
|
+
options.external = firstItem;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const files = (0, assets_1.assetGlobsToFiles)(options.assets, contextRoot, outputPath);
|
|
27
|
+
return Object.assign(Object.assign({}, options), { root: contextRoot, sourceRoot,
|
|
28
|
+
projectRoot,
|
|
29
|
+
files,
|
|
30
|
+
outputPath, tsConfig: (0, path_1.join)(contextRoot, options.tsConfig), rootDir, mainOutputPath: (0, path_1.resolve)(outputPath, options.main.replace(`${projectRoot}/`, '').replace('.ts', '.js')) });
|
|
31
|
+
}
|
|
32
|
+
exports.normalizeOptions = normalizeOptions;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ExecutorContext, TaskGraph } from '@nx/devkit';
|
|
2
|
+
import type { ExecutorOptions } from '../../utils/schema';
|
|
3
|
+
export declare function tscBatchExecutor(taskGraph: TaskGraph, inputs: Record<string, ExecutorOptions>, overrides: ExecutorOptions, context: ExecutorContext): AsyncGenerator<import("../../../../../build/packages/nx/src/tasks-runner/batch/batch-messages").BatchResults, any, undefined>;
|
|
4
|
+
export default tscBatchExecutor;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tscBatchExecutor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const update_package_json_1 = require("../../utils/package-json/update-package-json");
|
|
7
|
+
const batch_1 = require("./lib/batch");
|
|
8
|
+
function tscBatchExecutor(taskGraph, inputs, overrides, context) {
|
|
9
|
+
return tslib_1.__asyncGenerator(this, arguments, function* tscBatchExecutor_1() {
|
|
10
|
+
const tasksOptions = (0, batch_1.normalizeTasksOptions)(inputs, context);
|
|
11
|
+
let shouldWatch = false;
|
|
12
|
+
Object.values(tasksOptions).forEach((taskOptions) => {
|
|
13
|
+
if (taskOptions.clean) {
|
|
14
|
+
(0, fs_1.rmSync)(taskOptions.outputPath, { force: true, recursive: true });
|
|
15
|
+
}
|
|
16
|
+
if (taskOptions.watch) {
|
|
17
|
+
shouldWatch = true;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const tsConfigTaskInfoMap = {};
|
|
21
|
+
(0, batch_1.buildTaskInfoPerTsConfigMap)(tsConfigTaskInfoMap, tasksOptions, context, Object.keys(taskGraph.tasks), shouldWatch);
|
|
22
|
+
const typescriptCompilation = (0, batch_1.compileBatchTypescript)(tsConfigTaskInfoMap, taskGraph, shouldWatch, (taskInfo) => {
|
|
23
|
+
taskInfo.assetsHandler.processAllAssetsOnceSync();
|
|
24
|
+
(0, update_package_json_1.updatePackageJson)(taskInfo.options, taskInfo.context, taskInfo.projectGraphNode, taskInfo.buildableProjectNodeDependencies);
|
|
25
|
+
});
|
|
26
|
+
if (shouldWatch) {
|
|
27
|
+
const taskInfos = Object.values(tsConfigTaskInfoMap);
|
|
28
|
+
const watchAssetsChangesDisposer = yield tslib_1.__await((0, batch_1.watchTaskProjectsFileChangesForAssets)(taskInfos));
|
|
29
|
+
const watchProjectsChangesDisposer = yield tslib_1.__await((0, batch_1.watchTaskProjectsPackageJsonFileChanges)(taskInfos, (changedTaskInfos) => {
|
|
30
|
+
for (const t of changedTaskInfos) {
|
|
31
|
+
(0, update_package_json_1.updatePackageJson)(t.options, t.context, t.projectGraphNode, t.buildableProjectNodeDependencies);
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
const handleTermination = (exitCode) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
yield typescriptCompilation.close();
|
|
36
|
+
watchAssetsChangesDisposer();
|
|
37
|
+
watchProjectsChangesDisposer();
|
|
38
|
+
process.exit(exitCode);
|
|
39
|
+
});
|
|
40
|
+
process.on('SIGINT', () => handleTermination(128 + 2));
|
|
41
|
+
process.on('SIGTERM', () => handleTermination(128 + 15));
|
|
42
|
+
}
|
|
43
|
+
return yield tslib_1.__await(yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(typescriptCompilation.iterator))));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.tscBatchExecutor = tscBatchExecutor;
|
|
47
|
+
exports.default = tscBatchExecutor;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { TypeScriptCompilationOptions } from '@nx/workspace/src/utilities/typescript/compilation';
|
|
3
3
|
import { ExecutorOptions, NormalizedExecutorOptions } from '../../utils/schema';
|
|
4
|
-
export declare function normalizeOptions(options: ExecutorOptions, contextRoot: string, sourceRoot: string, projectRoot: string): NormalizedExecutorOptions;
|
|
5
4
|
export declare function createTypeScriptCompilationOptions(normalizedOptions: NormalizedExecutorOptions, context: ExecutorContext): TypeScriptCompilationOptions;
|
|
6
5
|
export declare function tscExecutor(_options: ExecutorOptions, context: ExecutorContext): AsyncGenerator<import("../../utils/typescript/compile-typescript-files").TypescriptCompilationResult, any, undefined>;
|
|
7
6
|
export default tscExecutor;
|
|
@@ -1,51 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tscExecutor = exports.createTypeScriptCompilationOptions =
|
|
3
|
+
exports.tscExecutor = exports.createTypeScriptCompilationOptions = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const assets_1 = require("../../utils/assets/assets");
|
|
6
|
-
const path_1 = require("path");
|
|
7
5
|
const copy_assets_handler_1 = require("../../utils/assets/copy-assets-handler");
|
|
8
6
|
const check_dependencies_1 = require("../../utils/check-dependencies");
|
|
9
7
|
const compiler_helper_dependency_1 = require("../../utils/compiler-helper-dependency");
|
|
10
8
|
const inline_1 = require("../../utils/inline");
|
|
11
9
|
const update_package_json_1 = require("../../utils/package-json/update-package-json");
|
|
12
10
|
const compile_typescript_files_1 = require("../../utils/typescript/compile-typescript-files");
|
|
13
|
-
const load_ts_transformers_1 = require("../../utils/typescript/load-ts-transformers");
|
|
14
11
|
const watch_for_single_file_changes_1 = require("../../utils/watch-for-single-file-changes");
|
|
15
|
-
|
|
16
|
-
const outputPath = (0, path_1.join)(contextRoot, options.outputPath);
|
|
17
|
-
const rootDir = options.rootDir
|
|
18
|
-
? (0, path_1.join)(contextRoot, options.rootDir)
|
|
19
|
-
: projectRoot;
|
|
20
|
-
if (options.watch == null) {
|
|
21
|
-
options.watch = false;
|
|
22
|
-
}
|
|
23
|
-
// TODO: put back when inlining story is more stable
|
|
24
|
-
// if (options.external == null) {
|
|
25
|
-
// options.external = 'all';
|
|
26
|
-
// } else if (Array.isArray(options.external) && options.external.length === 0) {
|
|
27
|
-
// options.external = 'none';
|
|
28
|
-
// }
|
|
29
|
-
if (Array.isArray(options.external) && options.external.length > 0) {
|
|
30
|
-
const firstItem = options.external[0];
|
|
31
|
-
if (firstItem === 'all' || firstItem === 'none') {
|
|
32
|
-
options.external = firstItem;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const files = (0, assets_1.assetGlobsToFiles)(options.assets, contextRoot, outputPath);
|
|
36
|
-
return Object.assign(Object.assign({}, options), { root: contextRoot, sourceRoot,
|
|
37
|
-
projectRoot,
|
|
38
|
-
files,
|
|
39
|
-
outputPath, tsConfig: (0, path_1.join)(contextRoot, options.tsConfig), rootDir, mainOutputPath: (0, path_1.resolve)(outputPath, options.main.replace(`${projectRoot}/`, '').replace('.ts', '.js')) });
|
|
40
|
-
}
|
|
41
|
-
exports.normalizeOptions = normalizeOptions;
|
|
12
|
+
const lib_1 = require("./lib");
|
|
42
13
|
function createTypeScriptCompilationOptions(normalizedOptions, context) {
|
|
43
|
-
const { compilerPluginHooks } = (0, load_ts_transformers_1.loadTsTransformers)(normalizedOptions.transformers);
|
|
44
|
-
const getCustomTransformers = (program) => ({
|
|
45
|
-
before: compilerPluginHooks.beforeHooks.map((hook) => hook(program)),
|
|
46
|
-
after: compilerPluginHooks.afterHooks.map((hook) => hook(program)),
|
|
47
|
-
afterDeclarations: compilerPluginHooks.afterDeclarationsHooks.map((hook) => hook(program)),
|
|
48
|
-
});
|
|
49
14
|
return {
|
|
50
15
|
outputPath: normalizedOptions.outputPath,
|
|
51
16
|
projectName: context.projectName,
|
|
@@ -54,14 +19,14 @@ function createTypeScriptCompilationOptions(normalizedOptions, context) {
|
|
|
54
19
|
tsConfig: normalizedOptions.tsConfig,
|
|
55
20
|
watch: normalizedOptions.watch,
|
|
56
21
|
deleteOutputPath: normalizedOptions.clean,
|
|
57
|
-
getCustomTransformers,
|
|
22
|
+
getCustomTransformers: (0, lib_1.getCustomTrasformersFactory)(normalizedOptions.transformers),
|
|
58
23
|
};
|
|
59
24
|
}
|
|
60
25
|
exports.createTypeScriptCompilationOptions = createTypeScriptCompilationOptions;
|
|
61
26
|
function tscExecutor(_options, context) {
|
|
62
27
|
return tslib_1.__asyncGenerator(this, arguments, function* tscExecutor_1() {
|
|
63
28
|
const { sourceRoot, root } = context.projectsConfigurations.projects[context.projectName];
|
|
64
|
-
const options = normalizeOptions(_options, context.root, sourceRoot, root);
|
|
29
|
+
const options = (0, lib_1.normalizeOptions)(_options, context.root, sourceRoot, root);
|
|
65
30
|
const { projectRoot, tmpTsConfig, target, dependencies } = (0, check_dependencies_1.checkDependencies)(context, _options.tsConfig);
|
|
66
31
|
if (tmpTsConfig) {
|
|
67
32
|
options.tsConfig = tmpTsConfig;
|
|
@@ -5,6 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const fs_extra_1 = require("fs-extra");
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
|
+
const detectPort = require("detect-port");
|
|
9
|
+
const path_1 = require("path");
|
|
8
10
|
let childProcess;
|
|
9
11
|
/**
|
|
10
12
|
* - set npm and yarn to use local registry
|
|
@@ -36,16 +38,23 @@ function verdaccioExecutor(options, context) {
|
|
|
36
38
|
process.on('SIGINT', processExitListener);
|
|
37
39
|
process.on('SIGHUP', processExitListener);
|
|
38
40
|
try {
|
|
39
|
-
yield
|
|
41
|
+
const port = yield detectPort(options.port);
|
|
42
|
+
if (port === options.port) {
|
|
43
|
+
devkit_1.logger.info(`Port ${options.port} was occupied. Using port ${port}.`);
|
|
44
|
+
options.port = port;
|
|
45
|
+
}
|
|
46
|
+
yield startVerdaccio(options, context.root);
|
|
40
47
|
}
|
|
41
48
|
catch (e) {
|
|
42
|
-
devkit_1.logger.error('Failed to start verdaccio: ' + e.toString());
|
|
49
|
+
devkit_1.logger.error('Failed to start verdaccio: ' + (e === null || e === void 0 ? void 0 : e.toString()));
|
|
43
50
|
return {
|
|
44
51
|
success: false,
|
|
52
|
+
port: options.port,
|
|
45
53
|
};
|
|
46
54
|
}
|
|
47
55
|
return {
|
|
48
56
|
success: true,
|
|
57
|
+
port: options.port,
|
|
49
58
|
};
|
|
50
59
|
});
|
|
51
60
|
}
|
|
@@ -53,10 +62,12 @@ exports.verdaccioExecutor = verdaccioExecutor;
|
|
|
53
62
|
/**
|
|
54
63
|
* Fork the verdaccio process: https://verdaccio.org/docs/verdaccio-programmatically/#using-fork-from-child_process-module
|
|
55
64
|
*/
|
|
56
|
-
function startVerdaccio(options) {
|
|
65
|
+
function startVerdaccio(options, workspaceRoot) {
|
|
57
66
|
return new Promise((resolve, reject) => {
|
|
58
|
-
childProcess = (0, child_process_1.fork)(require.resolve('verdaccio/bin/verdaccio'), createVerdaccioOptions(options), {
|
|
59
|
-
env: Object.assign(Object.assign({}, process.env), { VERDACCIO_HANDLE_KILL_SIGNALS: 'true' }),
|
|
67
|
+
childProcess = (0, child_process_1.fork)(require.resolve('verdaccio/bin/verdaccio'), createVerdaccioOptions(options, workspaceRoot), {
|
|
68
|
+
env: Object.assign(Object.assign(Object.assign({}, process.env), { VERDACCIO_HANDLE_KILL_SIGNALS: 'true' }), (options.storage
|
|
69
|
+
? { VERDACCIO_STORAGE_PATH: options.storage }
|
|
70
|
+
: {})),
|
|
60
71
|
stdio: ['inherit', 'pipe', 'pipe', 'ipc'],
|
|
61
72
|
});
|
|
62
73
|
childProcess.stdout.on('data', (data) => {
|
|
@@ -87,13 +98,13 @@ function startVerdaccio(options) {
|
|
|
87
98
|
});
|
|
88
99
|
});
|
|
89
100
|
}
|
|
90
|
-
function createVerdaccioOptions(options) {
|
|
101
|
+
function createVerdaccioOptions(options, workspaceRoot) {
|
|
91
102
|
const verdaccioArgs = [];
|
|
92
103
|
if (options.port) {
|
|
93
104
|
verdaccioArgs.push('--listen', options.port.toString());
|
|
94
105
|
}
|
|
95
106
|
if (options.config) {
|
|
96
|
-
verdaccioArgs.push('--config', options.config);
|
|
107
|
+
verdaccioArgs.push('--config', (0, path_1.join)(workspaceRoot, options.config));
|
|
97
108
|
}
|
|
98
109
|
return verdaccioArgs;
|
|
99
110
|
}
|
|
@@ -47,9 +47,6 @@ function projectGenerator(tree, schema, destinationDir, filesDir) {
|
|
|
47
47
|
});
|
|
48
48
|
tasks.push(viteTask);
|
|
49
49
|
}
|
|
50
|
-
if (options.bundler === 'rollup') {
|
|
51
|
-
ensureBabelRootConfigExists(tree);
|
|
52
|
-
}
|
|
53
50
|
if (options.linter !== 'none') {
|
|
54
51
|
const lintCallback = yield addLint(tree, options);
|
|
55
52
|
tasks.push(lintCallback);
|
|
@@ -384,13 +381,6 @@ function getBuildExecutor(bundler) {
|
|
|
384
381
|
return undefined;
|
|
385
382
|
}
|
|
386
383
|
}
|
|
387
|
-
function ensureBabelRootConfigExists(tree) {
|
|
388
|
-
if (tree.exists('babel.config.json'))
|
|
389
|
-
return;
|
|
390
|
-
(0, devkit_1.writeJson)(tree, 'babel.config.json', {
|
|
391
|
-
babelrcRoots: ['*'],
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
384
|
function getOutputPath(options, destinationDir) {
|
|
395
385
|
const parts = ['dist'];
|
|
396
386
|
if (destinationDir) {
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPackageJson = exports.getLockFileName = exports.createLockFile = exports.initGenerator = exports.libraryGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./utils/typescript/add-tslib-dependencies"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./utils/typescript/load-ts-transformers"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./utils/typescript/print-diagnostics"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./utils/typescript/run-type-check"), exports);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addBabelInputs = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
/** @deprecated Do not use this function as the root babel.config.json file is no longer needed */
|
|
6
|
+
// TODO(jack): Remove This in Nx 17 once we don't need to support Nx 15 anymore. Currently this function is used in v15 migrations.
|
|
5
7
|
function addBabelInputs(tree) {
|
|
6
8
|
var _a;
|
|
7
9
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AssetGlob } from './assets';
|
|
2
|
+
import { ChangedFile } from 'nx/src/daemon/client/client';
|
|
2
3
|
export type FileEventType = 'create' | 'update' | 'delete';
|
|
3
4
|
export interface FileEvent {
|
|
4
5
|
type: FileEventType;
|
|
@@ -22,7 +23,10 @@ export declare class CopyAssetsHandler {
|
|
|
22
23
|
private readonly callback;
|
|
23
24
|
constructor(opts: CopyAssetHandlerOptions);
|
|
24
25
|
processAllAssetsOnce(): Promise<void>;
|
|
26
|
+
processAllAssetsOnceSync(): void;
|
|
25
27
|
watchAndProcessOnAssetChange(): Promise<() => void>;
|
|
26
|
-
|
|
28
|
+
processWatchEvents(events: ChangedFile[]): Promise<void>;
|
|
29
|
+
private filesToEvent;
|
|
30
|
+
private normalizeAssetPattern;
|
|
27
31
|
}
|
|
28
32
|
export {};
|
|
@@ -74,35 +74,27 @@ class CopyAssetsHandler {
|
|
|
74
74
|
processAllAssetsOnce() {
|
|
75
75
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
76
|
yield Promise.all(this.assetGlobs.map((ag) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
|
|
78
|
-
if (typeof ag === 'string') {
|
|
79
|
-
pattern = ag;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
pattern = ag.pattern;
|
|
83
|
-
}
|
|
77
|
+
const pattern = this.normalizeAssetPattern(ag);
|
|
84
78
|
// fast-glob only supports Unix paths
|
|
85
79
|
const files = yield fg(pattern.replace(/\\/g, '/'), {
|
|
86
80
|
cwd: this.rootDir,
|
|
87
81
|
dot: true, // enable hidden files
|
|
88
82
|
});
|
|
89
|
-
this.callback(
|
|
90
|
-
var _a;
|
|
91
|
-
if (!((_a = ag.ignore) === null || _a === void 0 ? void 0 : _a.some((ig) => minimatch(src, ig))) &&
|
|
92
|
-
!this.ignore.ignores(src)) {
|
|
93
|
-
const relPath = path.relative(ag.input, src);
|
|
94
|
-
const dest = relPath.startsWith('..') ? src : relPath;
|
|
95
|
-
acc.push({
|
|
96
|
-
type: 'create',
|
|
97
|
-
src: path.join(this.rootDir, src),
|
|
98
|
-
dest: path.join(this.rootDir, ag.output, dest),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return acc;
|
|
102
|
-
}, []));
|
|
83
|
+
this.callback(this.filesToEvent(files, ag));
|
|
103
84
|
})));
|
|
104
85
|
});
|
|
105
86
|
}
|
|
87
|
+
processAllAssetsOnceSync() {
|
|
88
|
+
this.assetGlobs.forEach((ag) => {
|
|
89
|
+
const pattern = this.normalizeAssetPattern(ag);
|
|
90
|
+
// fast-glob only supports Unix paths
|
|
91
|
+
const files = fg.sync(pattern.replace(/\\/g, '/'), {
|
|
92
|
+
cwd: this.rootDir,
|
|
93
|
+
dot: true, // enable hidden files
|
|
94
|
+
});
|
|
95
|
+
this.callback(this.filesToEvent(files, ag));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
106
98
|
watchAndProcessOnAssetChange() {
|
|
107
99
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
108
100
|
const unregisterFileWatcher = yield client_1.daemonClient.registerFileWatcher({
|
|
@@ -118,13 +110,13 @@ class CopyAssetsHandler {
|
|
|
118
110
|
devkit_1.logger.error(`Watch error: ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : 'Unknown'}`);
|
|
119
111
|
}
|
|
120
112
|
else {
|
|
121
|
-
this.
|
|
113
|
+
this.processWatchEvents(data.changedFiles);
|
|
122
114
|
}
|
|
123
115
|
});
|
|
124
116
|
return () => unregisterFileWatcher();
|
|
125
117
|
});
|
|
126
118
|
}
|
|
127
|
-
|
|
119
|
+
processWatchEvents(events) {
|
|
128
120
|
var _a;
|
|
129
121
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
130
122
|
const fileEvents = [];
|
|
@@ -150,5 +142,24 @@ class CopyAssetsHandler {
|
|
|
150
142
|
this.callback(fileEvents);
|
|
151
143
|
});
|
|
152
144
|
}
|
|
145
|
+
filesToEvent(files, assetGlob) {
|
|
146
|
+
return files.reduce((acc, src) => {
|
|
147
|
+
var _a;
|
|
148
|
+
if (!((_a = assetGlob.ignore) === null || _a === void 0 ? void 0 : _a.some((ig) => minimatch(src, ig))) &&
|
|
149
|
+
!this.ignore.ignores(src)) {
|
|
150
|
+
const relPath = path.relative(assetGlob.input, src);
|
|
151
|
+
const dest = relPath.startsWith('..') ? src : relPath;
|
|
152
|
+
acc.push({
|
|
153
|
+
type: 'create',
|
|
154
|
+
src: path.join(this.rootDir, src),
|
|
155
|
+
dest: path.join(this.rootDir, assetGlob.output, dest),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return acc;
|
|
159
|
+
}, []);
|
|
160
|
+
}
|
|
161
|
+
normalizeAssetPattern(assetEntry) {
|
|
162
|
+
return typeof assetEntry === 'string' ? assetEntry : assetEntry.pattern;
|
|
163
|
+
}
|
|
153
164
|
}
|
|
154
165
|
exports.CopyAssetsHandler = CopyAssetsHandler;
|
package/src/utils/inline.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface InlineProjectGraph {
|
|
|
13
13
|
dependencies: Record<string, string[]>;
|
|
14
14
|
}
|
|
15
15
|
export declare function isInlineGraphEmpty(inlineGraph: InlineProjectGraph): boolean;
|
|
16
|
-
export declare function handleInliningBuild(context: ExecutorContext, options: NormalizedExecutorOptions, tsConfigPath: string): InlineProjectGraph;
|
|
16
|
+
export declare function handleInliningBuild(context: ExecutorContext, options: NormalizedExecutorOptions, tsConfigPath: string, projectName?: string): InlineProjectGraph;
|
|
17
17
|
export declare function postProcessInlinedDependencies(outputPath: string, parentOutputPath: string, inlineGraph: InlineProjectGraph): void;
|
|
18
18
|
export declare function getRootTsConfigPath(context: ExecutorContext): string | null;
|
|
19
19
|
export {};
|
package/src/utils/inline.js
CHANGED
|
@@ -9,11 +9,11 @@ function isInlineGraphEmpty(inlineGraph) {
|
|
|
9
9
|
return Object.keys(inlineGraph.nodes).length === 0;
|
|
10
10
|
}
|
|
11
11
|
exports.isInlineGraphEmpty = isInlineGraphEmpty;
|
|
12
|
-
function handleInliningBuild(context, options, tsConfigPath) {
|
|
12
|
+
function handleInliningBuild(context, options, tsConfigPath, projectName = context.projectName) {
|
|
13
13
|
var _a;
|
|
14
14
|
const tsConfigJson = (0, devkit_1.readJsonFile)(tsConfigPath);
|
|
15
15
|
const pathAliases = ((_a = tsConfigJson['compilerOptions']) === null || _a === void 0 ? void 0 : _a['paths']) || readBasePathAliases(context);
|
|
16
|
-
const inlineGraph = createInlineGraph(context, options, pathAliases);
|
|
16
|
+
const inlineGraph = createInlineGraph(context, options, pathAliases, projectName);
|
|
17
17
|
if (isInlineGraphEmpty(inlineGraph)) {
|
|
18
18
|
return inlineGraph;
|
|
19
19
|
}
|
|
@@ -81,7 +81,7 @@ function projectNodeToInlineProjectNode(projectNode, pathAlias = '', buildOutput
|
|
|
81
81
|
buildOutputPath,
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
function createInlineGraph(context, options, pathAliases, projectName
|
|
84
|
+
function createInlineGraph(context, options, pathAliases, projectName, inlineGraph = emptyInlineGraph()) {
|
|
85
85
|
var _a;
|
|
86
86
|
var _b;
|
|
87
87
|
if (options.external == null)
|
package/src/utils/schema.d.ts
CHANGED
|
@@ -50,11 +50,12 @@ export interface ExecutorOptions {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export interface NormalizedExecutorOptions extends ExecutorOptions {
|
|
53
|
-
|
|
54
|
-
sourceRoot?: string;
|
|
53
|
+
rootDir: string;
|
|
55
54
|
projectRoot: string;
|
|
56
55
|
mainOutputPath: string;
|
|
57
56
|
files: Array<FileInputOutput>;
|
|
57
|
+
root?: string;
|
|
58
|
+
sourceRoot?: string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
export interface SwcExecutorOptions extends ExecutorOptions {
|