@nrwl/js 13.4.0-beta.2 → 13.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/executors.json +10 -0
- package/package.json +10 -6
- package/src/executors/node/compat.d.ts +2 -0
- package/src/executors/node/compat.js +6 -0
- package/src/executors/node/compat.js.map +1 -0
- package/src/executors/node/node-with-require-overrides.d.ts +5 -0
- package/src/executors/node/node-with-require-overrides.js +20 -0
- package/src/executors/node/node-with-require-overrides.js.map +1 -0
- package/src/executors/node/node.impl.d.ts +5 -0
- package/src/executors/node/node.impl.js +141 -0
- package/src/executors/node/node.impl.js.map +1 -0
- package/src/executors/node/schema.d.ts +16 -0
- package/src/executors/node/schema.json +67 -0
- package/src/executors/swc/schema.json +10 -5
- package/src/executors/swc/swc.impl.d.ts +3 -5
- package/src/executors/swc/swc.impl.js +20 -46
- package/src/executors/swc/swc.impl.js.map +1 -1
- package/src/executors/tsc/schema.json +34 -1
- package/src/executors/tsc/tsc.impl.d.ts +3 -4
- package/src/executors/tsc/tsc.impl.js +25 -22
- package/src/executors/tsc/tsc.impl.js.map +1 -1
- package/src/generators/application/schema.json +1 -1
- package/src/generators/convert-to-swc/convert-to-swc.js +2 -2
- package/src/generators/convert-to-swc/convert-to-swc.js.map +1 -1
- package/src/generators/convert-to-swc/schema.d.ts +1 -1
- package/src/generators/convert-to-swc/schema.json +2 -2
- package/src/generators/library/schema.json +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -1
- package/src/utils/check-dependencies.d.ts +0 -3
- package/src/utils/check-dependencies.js +10 -7
- package/src/utils/check-dependencies.js.map +1 -1
- package/src/utils/project-generator.js +9 -1
- package/src/utils/project-generator.js.map +1 -1
- package/src/utils/schema.d.ts +22 -0
- package/src/utils/swc/compile-swc.d.ts +5 -3
- package/src/utils/swc/compile-swc.js +110 -35
- package/src/utils/swc/compile-swc.js.map +1 -1
- package/src/utils/typescript/__mocks__/plugin-a.d.ts +1 -0
- package/src/utils/typescript/__mocks__/plugin-a.js +6 -0
- package/src/utils/typescript/__mocks__/plugin-a.js.map +1 -0
- package/src/utils/typescript/__mocks__/plugin-b.d.ts +1 -0
- package/src/utils/typescript/__mocks__/plugin-b.js +6 -0
- package/src/utils/typescript/__mocks__/plugin-b.js.map +1 -0
- package/src/utils/typescript/compile-typescript-files.d.ts +4 -0
- package/src/utils/typescript/compile-typescript-files.js +59 -0
- package/src/utils/typescript/compile-typescript-files.js.map +1 -0
- package/src/utils/typescript/load-ts-plugins.d.ts +5 -0
- package/src/utils/typescript/load-ts-plugins.js +63 -0
- package/src/utils/typescript/load-ts-plugins.js.map +1 -0
- package/src/utils/typescript/print-diagnostics.d.ts +1 -2
- package/src/utils/typescript/print-diagnostics.js +7 -7
- package/src/utils/typescript/print-diagnostics.js.map +1 -1
- package/src/utils/typescript/run-type-check.d.ts +8 -3
- package/src/utils/typescript/run-type-check.js +90 -58
- package/src/utils/typescript/run-type-check.js.map +1 -1
- package/src/utils/typescript/types.d.ts +18 -0
- package/src/utils/typescript/types.js +3 -0
- package/src/utils/typescript/types.js.map +1 -0
- package/src/utils/versions.js +1 -1
- package/src/utils/compile.d.ts +0 -6
- package/src/utils/compile.js +0 -20
- package/src/utils/compile.js.map +0 -1
package/executors.json
CHANGED
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"implementation": "./src/executors/swc/swc.impl",
|
|
11
11
|
"schema": "./src/executors/swc/schema.json",
|
|
12
12
|
"description": "Build a project using SWC"
|
|
13
|
+
},
|
|
14
|
+
"node": {
|
|
15
|
+
"implementation": "./src/executors/node/node.impl",
|
|
16
|
+
"schema": "./src/executors/node/schema.json",
|
|
17
|
+
"description": "Build Node.js applications"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"builders": {
|
|
@@ -22,6 +27,11 @@
|
|
|
22
27
|
"implementation": "./src/executors/swc/compat",
|
|
23
28
|
"schema": "./src/executors/swc/schema.json",
|
|
24
29
|
"description": "Build a project using SWC"
|
|
30
|
+
},
|
|
31
|
+
"node": {
|
|
32
|
+
"implementation": "./src/executors/node/compat",
|
|
33
|
+
"schema": "./src/executors/node/schema.json",
|
|
34
|
+
"description": "Build Node.js applications"
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
37
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/js",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.1",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"generators": "./generators.json",
|
|
6
6
|
"schematics": "./generators.json",
|
|
7
7
|
"executors": "./executors.json",
|
|
8
8
|
"builders": "./executors.json",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@nrwl/workspace": "13.4.
|
|
11
|
-
"@nrwl/devkit": "13.4.
|
|
12
|
-
"@nrwl/jest": "13.4.
|
|
13
|
-
"@nrwl/linter": "13.4.
|
|
10
|
+
"@nrwl/workspace": "13.4.1",
|
|
11
|
+
"@nrwl/devkit": "13.4.1",
|
|
12
|
+
"@nrwl/jest": "13.4.1",
|
|
13
|
+
"@nrwl/linter": "13.4.1",
|
|
14
14
|
"chalk": "4.1.0",
|
|
15
|
-
"js-tokens": "^4.0.0"
|
|
15
|
+
"js-tokens": "^4.0.0",
|
|
16
|
+
"rxjs": "^6.5.4",
|
|
17
|
+
"rxjs-for-await": "0.0.2",
|
|
18
|
+
"source-map-support": "0.5.19",
|
|
19
|
+
"tree-kill": "1.2.2"
|
|
16
20
|
},
|
|
17
21
|
"typings": "./src/index.d.ts"
|
|
18
22
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
4
|
+
const node_impl_1 = require("./node.impl");
|
|
5
|
+
exports.default = (0, devkit_1.convertNxExecutor)(node_impl_1.default);
|
|
6
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/node/compat.ts"],"names":[],"mappings":";;AAAA,yCAAiD;AACjD,2CAAuC;AAEvC,kBAAe,IAAA,0BAAiB,EAAC,mBAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const Module = require('module');
|
|
2
|
+
const originalLoader = Module._load;
|
|
3
|
+
const mappings = JSON.parse(process.env.NX_MAPPINGS);
|
|
4
|
+
const keys = Object.keys(mappings);
|
|
5
|
+
const fileToRun = process.env.NX_FILE_TO_RUN;
|
|
6
|
+
Module._load = function (request, parent) {
|
|
7
|
+
if (!parent)
|
|
8
|
+
return originalLoader.apply(this, arguments);
|
|
9
|
+
const match = keys.find((k) => request === k);
|
|
10
|
+
if (match) {
|
|
11
|
+
const newArguments = [...arguments];
|
|
12
|
+
newArguments[0] = mappings[match];
|
|
13
|
+
return originalLoader.apply(this, newArguments);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return originalLoader.apply(this, arguments);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
require(fileToRun);
|
|
20
|
+
//# sourceMappingURL=node-with-require-overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-with-require-overrides.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/node/node-with-require-overrides.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC;AAEpC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACrD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACnC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAE7C,MAAM,CAAC,KAAK,GAAG,UAAU,OAAO,EAAE,MAAM;IACtC,IAAI,CAAC,MAAM;QAAE,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;IAC9C,IAAI,KAAK,EAAE;QACT,MAAM,YAAY,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC;QACpC,YAAY,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;KACjD;SAAM;QACL,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;KAC9C;AACH,CAAC,CAAC;AAEF,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
+
import { ExecutorEvent } from '../../utils/schema';
|
|
3
|
+
import { NodeExecutorOptions } from './schema';
|
|
4
|
+
export declare function nodeExecutor(options: NodeExecutorOptions, context: ExecutorContext): AsyncGenerator<ExecutorEvent, void, unknown>;
|
|
5
|
+
export default nodeExecutor;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodeExecutor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const treeKill = require("tree-kill");
|
|
8
|
+
const util_1 = require("util");
|
|
9
|
+
const project_graph_1 = require("@nrwl/workspace/src/core/project-graph");
|
|
10
|
+
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
11
|
+
let subProcess = null;
|
|
12
|
+
function nodeExecutor(options, context) {
|
|
13
|
+
return (0, tslib_1.__asyncGenerator)(this, arguments, function* nodeExecutor_1() {
|
|
14
|
+
var e_1, _a;
|
|
15
|
+
// for now we only run the executor in the watch mode
|
|
16
|
+
options.watch = true;
|
|
17
|
+
process.on('SIGTERM', () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
18
|
+
yield killProcess();
|
|
19
|
+
process.exit(128 + 15);
|
|
20
|
+
}));
|
|
21
|
+
process.on('SIGINT', () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
22
|
+
yield killProcess();
|
|
23
|
+
process.exit(128 + 2);
|
|
24
|
+
}));
|
|
25
|
+
process.on('SIGHUP', () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
26
|
+
yield killProcess();
|
|
27
|
+
process.exit(128 + 1);
|
|
28
|
+
}));
|
|
29
|
+
if (options.waitUntilTargets && options.waitUntilTargets.length > 0) {
|
|
30
|
+
const results = yield (0, tslib_1.__await)(runWaitUntilTargets(options, context));
|
|
31
|
+
for (const [i, result] of results.entries()) {
|
|
32
|
+
if (!result.success) {
|
|
33
|
+
throw new Error(`Wait until target failed: ${options.waitUntilTargets[i]}.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const mappings = calculateResolveMappings(context, options);
|
|
38
|
+
try {
|
|
39
|
+
for (var _b = (0, tslib_1.__asyncValues)(startBuild(options, context)), _c; _c = yield (0, tslib_1.__await)(_b.next()), !_c.done;) {
|
|
40
|
+
const event = _c.value;
|
|
41
|
+
if (!event.success) {
|
|
42
|
+
devkit_1.logger.error('There was an error with the build. See above.');
|
|
43
|
+
devkit_1.logger.info(`${event.outfile} was not restarted.`);
|
|
44
|
+
}
|
|
45
|
+
yield (0, tslib_1.__await)(handleBuildEvent(event, options, mappings));
|
|
46
|
+
yield yield (0, tslib_1.__await)(event);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
50
|
+
finally {
|
|
51
|
+
try {
|
|
52
|
+
if (_c && !_c.done && (_a = _b.return)) yield (0, tslib_1.__await)(_a.call(_b));
|
|
53
|
+
}
|
|
54
|
+
finally { if (e_1) throw e_1.error; }
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.nodeExecutor = nodeExecutor;
|
|
59
|
+
function calculateResolveMappings(context, options) {
|
|
60
|
+
const projectGraph = (0, project_graph_1.readCachedProjectGraph)();
|
|
61
|
+
const parsed = (0, devkit_1.parseTargetString)(options.buildTarget);
|
|
62
|
+
const { dependencies } = (0, buildable_libs_utils_1.calculateProjectDependencies)(projectGraph, context.root, parsed.project, parsed.target, parsed.configuration);
|
|
63
|
+
return dependencies.reduce((m, c) => {
|
|
64
|
+
m[c.name] = (0, devkit_1.joinPathFragments)(context.root, c.outputs[0]);
|
|
65
|
+
return m;
|
|
66
|
+
}, {});
|
|
67
|
+
}
|
|
68
|
+
function runProcess(event, options, mappings) {
|
|
69
|
+
subProcess = (0, child_process_1.fork)((0, devkit_1.joinPathFragments)(__dirname, 'node-with-require-overrides'), options.args, {
|
|
70
|
+
execArgv: getExecArgv(options),
|
|
71
|
+
stdio: 'inherit',
|
|
72
|
+
env: Object.assign(Object.assign({}, process.env), { NX_FILE_TO_RUN: event.outfile, NX_MAPPINGS: JSON.stringify(mappings) }),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function getExecArgv(options) {
|
|
76
|
+
const args = [
|
|
77
|
+
'-r',
|
|
78
|
+
require.resolve('source-map-support/register'),
|
|
79
|
+
...options.runtimeArgs,
|
|
80
|
+
];
|
|
81
|
+
if (options.inspect === true) {
|
|
82
|
+
options.inspect = "inspect" /* Inspect */;
|
|
83
|
+
}
|
|
84
|
+
if (options.inspect) {
|
|
85
|
+
args.push(`--${options.inspect}=${options.host}:${options.port}`);
|
|
86
|
+
}
|
|
87
|
+
return args;
|
|
88
|
+
}
|
|
89
|
+
function handleBuildEvent(event, options, mappings) {
|
|
90
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
91
|
+
if ((!event.success || options.watch) && subProcess) {
|
|
92
|
+
yield killProcess();
|
|
93
|
+
}
|
|
94
|
+
if (event.success) {
|
|
95
|
+
runProcess(event, options, mappings);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function killProcess() {
|
|
100
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
101
|
+
const promisifiedTreeKill = (0, util_1.promisify)(treeKill);
|
|
102
|
+
try {
|
|
103
|
+
yield promisifiedTreeKill(subProcess.pid, 'SIGTERM');
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
if (Array.isArray(err) && err[0] && err[2]) {
|
|
107
|
+
const errorMessage = err[2];
|
|
108
|
+
devkit_1.logger.error(errorMessage);
|
|
109
|
+
}
|
|
110
|
+
else if (err.message) {
|
|
111
|
+
devkit_1.logger.error(err.message);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
subProcess = null;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function startBuild(options, context) {
|
|
120
|
+
return (0, tslib_1.__asyncGenerator)(this, arguments, function* startBuild_1() {
|
|
121
|
+
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget);
|
|
122
|
+
yield (0, tslib_1.__await)(yield* (0, tslib_1.__asyncDelegator)((0, tslib_1.__asyncValues)(yield (0, tslib_1.__await)((0, devkit_1.runExecutor)(buildTarget, Object.assign(Object.assign({}, options.buildTargetOptions), { watch: options.watch }), context)))));
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function runWaitUntilTargets(options, context) {
|
|
126
|
+
return Promise.all(options.waitUntilTargets.map((waitUntilTarget) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
127
|
+
const target = (0, devkit_1.parseTargetString)(waitUntilTarget);
|
|
128
|
+
const output = yield (0, devkit_1.runExecutor)(target, {}, context);
|
|
129
|
+
return new Promise((resolve) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
130
|
+
let event = yield output.next();
|
|
131
|
+
// Resolve after first event
|
|
132
|
+
resolve(event.value);
|
|
133
|
+
// Continue iterating
|
|
134
|
+
while (!event.done) {
|
|
135
|
+
event = yield output.next();
|
|
136
|
+
}
|
|
137
|
+
}));
|
|
138
|
+
})));
|
|
139
|
+
}
|
|
140
|
+
exports.default = nodeExecutor;
|
|
141
|
+
//# sourceMappingURL=node.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.impl.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/node/node.impl.ts"],"names":[],"mappings":";;;;AAAA,yCAMsB;AACtB,iDAAmD;AACnD,sCAAsC;AACtC,+BAAiC;AAGjC,0EAAgF;AAChF,6FAAkG;AAElG,IAAI,UAAU,GAAiB,IAAI,CAAC;AAEpC,SAAuB,YAAY,CACjC,OAA4B,EAC5B,OAAwB;;;QAExB,qDAAqD;QACrD,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;QAErB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAS,EAAE;YAC/B,MAAM,WAAW,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;QACzB,CAAC,CAAA,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAS,EAAE;YAC9B,MAAM,WAAW,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACxB,CAAC,CAAA,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAS,EAAE;YAC9B,MAAM,WA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A,CAAA,CAAA,CAAA,CAAC;IACJ,CAAC;CAAA;AAED,SAAS,mBAAmB,CAC1B,OAA4B,EAC5B,OAAwB;IAExB,OAAO,OAAO,CAAC,GAAG,CAChB,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAO,eAAe,EAAE,EAAE;QACrD,MAAM,MAAM,GAAG,IAAA,0BAAiB,EAAC,eAAe,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAW,EAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,IAAI,OAAO,CAAuB,CAAO,OAAO,EAAE,EAAE;YACzD,IAAI,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAChC,4BAA4B;YAC5B,OAAO,CAAC,KAAK,CAAC,KAA6B,CAAC,CAAC;YAE7C,qBAAqB;YACrB,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE;gBAClB,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;aAC7B;QACH,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CACH,CAAC;AACJ,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const enum InspectType {
|
|
2
|
+
Inspect = 'inspect',
|
|
3
|
+
InspectBrk = 'inspect-brk',
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface NodeExecutorOptions {
|
|
7
|
+
inspect: boolean | InspectType;
|
|
8
|
+
runtimeArgs: string[];
|
|
9
|
+
args: string[];
|
|
10
|
+
waitUntilTargets: string[];
|
|
11
|
+
buildTarget: string;
|
|
12
|
+
buildTargetOptions: Record<string, any>;
|
|
13
|
+
host: string;
|
|
14
|
+
port: number;
|
|
15
|
+
watch: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"title": "Node executor",
|
|
5
|
+
"description": "Execute Nodejs applications",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"buildTarget": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The target to run to build you the app"
|
|
11
|
+
},
|
|
12
|
+
"buildTargetOptions": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"description": "Additional options to pass into the build target.",
|
|
15
|
+
"default": {}
|
|
16
|
+
},
|
|
17
|
+
"waitUntilTargets": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"description": "The targets to run to before starting the node app",
|
|
20
|
+
"default": [],
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"host": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"default": "localhost",
|
|
28
|
+
"description": "The host to inspect the process on"
|
|
29
|
+
},
|
|
30
|
+
"port": {
|
|
31
|
+
"type": "number",
|
|
32
|
+
"default": 9229,
|
|
33
|
+
"description": "The port to inspect the process on. Setting port to 0 will assign random free ports to all forked processes."
|
|
34
|
+
},
|
|
35
|
+
"inspect": {
|
|
36
|
+
"oneOf": [
|
|
37
|
+
{
|
|
38
|
+
"type": "string",
|
|
39
|
+
"enum": ["inspect", "inspect-brk"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"type": "boolean"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"description": "Ensures the app is starting with debugging",
|
|
46
|
+
"default": "inspect"
|
|
47
|
+
},
|
|
48
|
+
"runtimeArgs": {
|
|
49
|
+
"type": "array",
|
|
50
|
+
"description": "Extra args passed to the node process",
|
|
51
|
+
"default": [],
|
|
52
|
+
"items": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"args": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"description": "Extra args when starting the app",
|
|
59
|
+
"default": [],
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"required": ["buildTarget"]
|
|
67
|
+
}
|
|
@@ -17,11 +17,6 @@
|
|
|
17
17
|
"type": "string",
|
|
18
18
|
"description": "The path to the Typescript configuration file."
|
|
19
19
|
},
|
|
20
|
-
"skipTypeCheck": {
|
|
21
|
-
"type": "boolean",
|
|
22
|
-
"description": "Whether to skip TypeScript type checking.",
|
|
23
|
-
"default": false
|
|
24
|
-
},
|
|
25
20
|
"assets": {
|
|
26
21
|
"type": "array",
|
|
27
22
|
"description": "List of static assets.",
|
|
@@ -29,6 +24,16 @@
|
|
|
29
24
|
"items": {
|
|
30
25
|
"$ref": "#/definitions/assetPattern"
|
|
31
26
|
}
|
|
27
|
+
},
|
|
28
|
+
"watch": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Enable re-building when files change.",
|
|
31
|
+
"default": false
|
|
32
|
+
},
|
|
33
|
+
"skipTypeCheck": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"description": "Whether to skip TypeScript type checking.",
|
|
36
|
+
"default": false
|
|
32
37
|
}
|
|
33
38
|
},
|
|
34
39
|
"required": ["main", "outputPath", "tsConfig"],
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
-
import { NormalizedSwcExecutorOptions, SwcExecutorOptions } from '
|
|
3
|
-
export declare function normalizeOptions(options: SwcExecutorOptions,
|
|
4
|
-
export declare function swcExecutor(options: SwcExecutorOptions, context: ExecutorContext):
|
|
5
|
-
success: boolean;
|
|
6
|
-
}>;
|
|
2
|
+
import { ExecutorEvent, NormalizedSwcExecutorOptions, SwcExecutorOptions } from '../../utils/schema';
|
|
3
|
+
export declare function normalizeOptions(options: SwcExecutorOptions, contextRoot: string, sourceRoot?: string, projectRoot?: string): NormalizedSwcExecutorOptions;
|
|
4
|
+
export declare function swcExecutor(options: SwcExecutorOptions, context: ExecutorContext): AsyncGenerator<ExecutorEvent, any, undefined>;
|
|
7
5
|
export default swcExecutor;
|
|
@@ -2,67 +2,41 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.swcExecutor = exports.normalizeOptions = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const app_root_1 = require("@nrwl/tao/src/utils/app-root");
|
|
6
5
|
const assets_1 = require("@nrwl/workspace/src/utilities/assets");
|
|
7
6
|
const path_1 = require("path");
|
|
7
|
+
const rxjs_for_await_1 = require("rxjs-for-await");
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
8
9
|
const check_dependencies_1 = require("../../utils/check-dependencies");
|
|
9
10
|
const compile_swc_1 = require("../../utils/swc/compile-swc");
|
|
10
|
-
const print_diagnostics_1 = require("../../utils/typescript/print-diagnostics");
|
|
11
|
-
const run_type_check_1 = require("../../utils/typescript/run-type-check");
|
|
12
11
|
const update_package_json_1 = require("../../utils/update-package-json");
|
|
13
|
-
function normalizeOptions(options,
|
|
14
|
-
const outputPath = (0, path_1.join)(
|
|
12
|
+
function normalizeOptions(options, contextRoot, sourceRoot, projectRoot) {
|
|
13
|
+
const outputPath = (0, path_1.join)(contextRoot, options.outputPath);
|
|
15
14
|
if (options.skipTypeCheck == null) {
|
|
16
15
|
options.skipTypeCheck = false;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (options.watch == null) {
|
|
18
|
+
options.watch = false;
|
|
19
|
+
}
|
|
20
|
+
const files = (0, assets_1.assetGlobsToFiles)(options.assets, contextRoot, outputPath);
|
|
21
|
+
return Object.assign(Object.assign({}, options), { swcrcPath: (0, path_1.join)(projectRoot, '.swcrc'), mainOutputPath: (0, path_1.resolve)(outputPath, options.main.replace(`${projectRoot}/`, '').replace('.ts', '.js')), files, root: contextRoot, sourceRoot,
|
|
22
|
+
projectRoot,
|
|
23
|
+
outputPath, tsConfig: (0, path_1.join)(contextRoot, options.tsConfig) });
|
|
21
24
|
}
|
|
22
25
|
exports.normalizeOptions = normalizeOptions;
|
|
23
26
|
function swcExecutor(options, context) {
|
|
24
|
-
return (0, tslib_1.
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
return { success: false };
|
|
29
|
-
}
|
|
27
|
+
return (0, tslib_1.__asyncGenerator)(this, arguments, function* swcExecutor_1() {
|
|
28
|
+
const { sourceRoot, root } = context.workspace.projects[context.projectName];
|
|
29
|
+
const normalizedOptions = normalizeOptions(options, context.root, sourceRoot, root);
|
|
30
|
+
const { tmpTsConfig, projectRoot } = (0, check_dependencies_1.checkDependencies)(context, options.tsConfig);
|
|
30
31
|
if (tmpTsConfig) {
|
|
31
32
|
normalizedOptions.tsConfig = tmpTsConfig;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
outputPath: normalizedOptions.outputPath,
|
|
35
|
-
projectName: context.projectName,
|
|
36
|
-
projectRoot,
|
|
37
|
-
tsConfig: normalizedOptions.tsConfig,
|
|
38
|
-
};
|
|
39
|
-
if (!options.skipTypeCheck) {
|
|
40
|
-
const ts = yield Promise.resolve().then(() => require('typescript'));
|
|
41
|
-
// start two promises, one for type checking, one for transpiling
|
|
42
|
-
return Promise.all([
|
|
43
|
-
(0, run_type_check_1.runTypeCheck)({
|
|
44
|
-
ts,
|
|
45
|
-
mode: 'emitDeclarationOnly',
|
|
46
|
-
tsConfigPath: tsOptions.tsConfig,
|
|
47
|
-
outDir: tsOptions.outputPath.replace(`/${projectRoot}`, ''),
|
|
48
|
-
workspaceRoot: app_root_1.appRootPath,
|
|
49
|
-
}).then((result) => {
|
|
50
|
-
const hasErrors = result.errors.length > 0;
|
|
51
|
-
if (hasErrors) {
|
|
52
|
-
(0, print_diagnostics_1.printDiagnostics)(result);
|
|
53
|
-
}
|
|
54
|
-
return Promise.resolve({ success: !hasErrors });
|
|
55
|
-
}),
|
|
56
|
-
(0, compile_swc_1.compileSwc)(tsOptions, () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
57
|
-
yield updatePackageAndCopyAssets(normalizedOptions, projectRoot);
|
|
58
|
-
})),
|
|
59
|
-
]).then(([typeCheckResult, transpileResult]) => ({
|
|
60
|
-
success: typeCheckResult.success && transpileResult.success,
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
return (0, compile_swc_1.compileSwc)(tsOptions, () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
34
|
+
return yield (0, tslib_1.__await)(yield (0, tslib_1.__await)(yield* (0, tslib_1.__asyncDelegator)((0, tslib_1.__asyncValues)((0, rxjs_for_await_1.eachValueFrom)((0, compile_swc_1.compileSwc)(context, normalizedOptions, () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
64
35
|
yield updatePackageAndCopyAssets(normalizedOptions, projectRoot);
|
|
65
|
-
}))
|
|
36
|
+
})).pipe((0, operators_1.map)(({ success }) => ({
|
|
37
|
+
success,
|
|
38
|
+
outfile: normalizedOptions.mainOutputPath,
|
|
39
|
+
}))))))));
|
|
66
40
|
});
|
|
67
41
|
}
|
|
68
42
|
exports.swcExecutor = swcExecutor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swc.impl.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/swc/swc.impl.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"swc.impl.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/swc/swc.impl.ts"],"names":[],"mappings":";;;;AACA,iEAI8C;AAC9C,+BAAqC;AACrC,mDAA+C;AAC/C,8CAAqC;AACrC,uEAAmE;AAMnE,6DAAyD;AACzD,yEAAoE;AAEpE,SAAgB,gBAAgB,CAC9B,OAA2B,EAC3B,WAAmB,EACnB,UAAmB,EACnB,WAAoB;IAEpB,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,WAAW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,CAAC,CAAC,8BAAA,2BAAA,IAAA,8BAAa,EACzB,IAAA,wBAAU,EAAC,OAAO,EAAE,iBAAiB,EAAE,GAAS,EAAE;YAChD,MAAM,0BAA0B,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;QACnE,CAAC,CAAA,CAAC,CAAC,IAAI,CACL,IAAA,eAAG,EACD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CACd,CAAC;YACC,OAAO;YACP,OAAO,EAAE,iBAAiB,CAAC,cAAc;SACxB,CAAA,CACtB,CACF,CACF,CAAA,CAAA,CAAA,EAAC;IACJ,CAAC;CAAA;AAjCD,kCAiCC;AAED,SAAe,0BAA0B,CACvC,OAAqC,EACrC,WAAmB;;QAEnB,MAAM,IAAA,uBAAc,EAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpC,IAAA,uCAAiB,EACf,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,UAAU,EAClB,WAAW,EACX,CAAC,OAAO,CAAC,aAAa,CACvB,CAAC;IACJ,CAAC;CAAA;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -23,10 +23,22 @@
|
|
|
23
23
|
"items": {
|
|
24
24
|
"$ref": "#/definitions/assetPattern"
|
|
25
25
|
}
|
|
26
|
+
},
|
|
27
|
+
"watch": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"description": "Enable re-building when files change.",
|
|
30
|
+
"default": false
|
|
31
|
+
},
|
|
32
|
+
"transformers": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"description": "List of TypeScript Transformer Plugins.",
|
|
35
|
+
"default": [],
|
|
36
|
+
"items": {
|
|
37
|
+
"$ref": "#/definitions/transformerPattern"
|
|
38
|
+
}
|
|
26
39
|
}
|
|
27
40
|
},
|
|
28
41
|
"required": ["main", "outputPath", "tsConfig"],
|
|
29
|
-
|
|
30
42
|
"definitions": {
|
|
31
43
|
"assetPattern": {
|
|
32
44
|
"oneOf": [
|
|
@@ -60,6 +72,27 @@
|
|
|
60
72
|
"type": "string"
|
|
61
73
|
}
|
|
62
74
|
]
|
|
75
|
+
},
|
|
76
|
+
"transformerPattern": {
|
|
77
|
+
"oneOf": [
|
|
78
|
+
{
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"name": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
},
|
|
87
|
+
"options": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"additionalProperties": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"required": ["name"]
|
|
94
|
+
}
|
|
95
|
+
]
|
|
63
96
|
}
|
|
64
97
|
}
|
|
65
98
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
-
import { ExecutorOptions } from '../../utils/schema';
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
}>;
|
|
2
|
+
import { ExecutorEvent, ExecutorOptions, NormalizedExecutorOptions } from '../../utils/schema';
|
|
3
|
+
export declare function normalizeOptions(options: ExecutorOptions, contextRoot: string, sourceRoot?: string, projectRoot?: string): NormalizedExecutorOptions;
|
|
4
|
+
export declare function tscExecutor(options: ExecutorOptions, context: ExecutorContext): AsyncGenerator<ExecutorEvent, any, undefined>;
|
|
6
5
|
export default tscExecutor;
|
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tscExecutor = void 0;
|
|
3
|
+
exports.tscExecutor = exports.normalizeOptions = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const assets_1 = require("@nrwl/workspace/src/utilities/assets");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
+
const rxjs_for_await_1 = require("rxjs-for-await");
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
7
9
|
const check_dependencies_1 = require("../../utils/check-dependencies");
|
|
8
|
-
const
|
|
10
|
+
const compile_typescript_files_1 = require("../../utils/typescript/compile-typescript-files");
|
|
9
11
|
const update_package_json_1 = require("../../utils/update-package-json");
|
|
12
|
+
function normalizeOptions(options, contextRoot, sourceRoot, projectRoot) {
|
|
13
|
+
const outputPath = (0, path_1.join)(contextRoot, options.outputPath);
|
|
14
|
+
if (options.watch == null) {
|
|
15
|
+
options.watch = false;
|
|
16
|
+
}
|
|
17
|
+
const files = (0, assets_1.assetGlobsToFiles)(options.assets, contextRoot, outputPath);
|
|
18
|
+
return Object.assign(Object.assign({}, options), { root: contextRoot, sourceRoot,
|
|
19
|
+
projectRoot,
|
|
20
|
+
files,
|
|
21
|
+
outputPath, tsConfig: (0, path_1.join)(contextRoot, options.tsConfig), mainOutputPath: (0, path_1.resolve)(outputPath, options.main.replace(`${projectRoot}/`, '').replace('.ts', '.js')) });
|
|
22
|
+
}
|
|
23
|
+
exports.normalizeOptions = normalizeOptions;
|
|
10
24
|
function tscExecutor(options, context) {
|
|
11
|
-
return (0, tslib_1.
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
return { success: false };
|
|
16
|
-
}
|
|
25
|
+
return (0, tslib_1.__asyncGenerator)(this, arguments, function* tscExecutor_1() {
|
|
26
|
+
const { sourceRoot, root } = context.workspace.projects[context.projectName];
|
|
27
|
+
const normalizedOptions = normalizeOptions(options, context.root, sourceRoot, root);
|
|
28
|
+
const { projectRoot, tmpTsConfig } = (0, check_dependencies_1.checkDependencies)(context, options.tsConfig);
|
|
17
29
|
if (tmpTsConfig) {
|
|
18
30
|
normalizedOptions.tsConfig = tmpTsConfig;
|
|
19
31
|
}
|
|
20
|
-
|
|
21
|
-
outputPath: normalizedOptions.outputPath,
|
|
22
|
-
projectName: context.projectName,
|
|
23
|
-
projectRoot,
|
|
24
|
-
tsConfig: normalizedOptions.tsConfig,
|
|
25
|
-
};
|
|
26
|
-
return (0, compile_1.compile)('tsc', context, tsOptions, () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
32
|
+
return yield (0, tslib_1.__await)(yield (0, tslib_1.__await)(yield* (0, tslib_1.__asyncDelegator)((0, tslib_1.__asyncValues)((0, rxjs_for_await_1.eachValueFrom)((0, compile_typescript_files_1.compileTypeScriptFiles)(normalizedOptions, context, () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
27
33
|
yield updatePackageAndCopyAssets(normalizedOptions, projectRoot);
|
|
28
|
-
}))
|
|
34
|
+
})).pipe((0, operators_1.map)(({ success }) => ({
|
|
35
|
+
success,
|
|
36
|
+
outfile: normalizedOptions.mainOutputPath,
|
|
37
|
+
}))))))));
|
|
29
38
|
});
|
|
30
39
|
}
|
|
31
40
|
exports.tscExecutor = tscExecutor;
|
|
@@ -35,11 +44,5 @@ function updatePackageAndCopyAssets(options, projectRoot) {
|
|
|
35
44
|
(0, update_package_json_1.updatePackageJson)(options.main, options.outputPath, projectRoot);
|
|
36
45
|
});
|
|
37
46
|
}
|
|
38
|
-
function normalizeOptions(options, context) {
|
|
39
|
-
const outputPath = (0, path_1.join)(context.root, options.outputPath);
|
|
40
|
-
const files = (0, assets_1.assetGlobsToFiles)(options.assets, context.root, outputPath);
|
|
41
|
-
return Object.assign(Object.assign({}, options), { files,
|
|
42
|
-
outputPath, tsConfig: (0, path_1.join)(context.root, options.tsConfig) });
|
|
43
|
-
}
|
|
44
47
|
exports.default = tscExecutor;
|
|
45
48
|
//# sourceMappingURL=tsc.impl.js.map
|