@nrwl/js 14.1.8-beta.2 → 14.1.8-beta.6
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/CHANGELOG.md +1 -1
- package/package.json +6 -6
- package/src/executors/swc/swc.impl.d.ts +2 -1
- package/src/executors/swc/swc.impl.js +9 -4
- package/src/executors/swc/swc.impl.js.map +1 -1
- package/src/executors/tsc/tsc.impl.js +5 -2
- package/src/executors/tsc/tsc.impl.js.map +1 -1
- package/src/utils/compiler-helper-dependency.d.ts +17 -0
- package/src/utils/compiler-helper-dependency.js +113 -0
- package/src/utils/compiler-helper-dependency.js.map +1 -0
- package/src/utils/swc/get-swcrc-path.d.ts +2 -0
- package/src/utils/swc/get-swcrc-path.js +11 -0
- package/src/utils/swc/get-swcrc-path.js.map +1 -0
- package/src/utils/tslib-dependency.d.ts +0 -4
- package/src/utils/tslib-dependency.js +0 -32
- package/src/utils/tslib-dependency.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [14.1.8-beta.
|
|
6
|
+
## [14.1.8-beta.6](https://github.com/nrwl/nx/compare/14.1.7...14.1.8-beta.6) (2022-05-24)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @nrwl/js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/js",
|
|
3
|
-
"version": "14.1.8-beta.
|
|
3
|
+
"version": "14.1.8-beta.6",
|
|
4
4
|
"description": "The Nx plugin that provides the best experience for developing JavaScript and TypeScript projects.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"executors": "./executors.json",
|
|
32
32
|
"builders": "./executors.json",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nrwl/devkit": "14.1.8-beta.
|
|
35
|
-
"@nrwl/jest": "14.1.8-beta.
|
|
36
|
-
"@nrwl/linter": "14.1.8-beta.
|
|
37
|
-
"@nrwl/workspace": "14.1.8-beta.
|
|
34
|
+
"@nrwl/devkit": "14.1.8-beta.6",
|
|
35
|
+
"@nrwl/jest": "14.1.8-beta.6",
|
|
36
|
+
"@nrwl/linter": "14.1.8-beta.6",
|
|
37
|
+
"@nrwl/workspace": "14.1.8-beta.6",
|
|
38
38
|
"@parcel/watcher": "2.0.4",
|
|
39
39
|
"chalk": "4.1.0",
|
|
40
40
|
"fast-glob": "3.2.7",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"source-map-support": "0.5.19",
|
|
46
46
|
"tree-kill": "1.2.2"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "d15dbf7fbf5b155540f81c9fd2ef520926034aca"
|
|
49
49
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
-
import { SwcExecutorOptions } from '../../utils/schema';
|
|
2
|
+
import { NormalizedSwcExecutorOptions, SwcExecutorOptions } from '../../utils/schema';
|
|
3
|
+
export declare function normalizeOptions(options: SwcExecutorOptions, contextRoot: string, sourceRoot?: string, projectRoot?: string): NormalizedSwcExecutorOptions;
|
|
3
4
|
export declare function swcExecutor(_options: SwcExecutorOptions, context: ExecutorContext): AsyncGenerator<{
|
|
4
5
|
success: boolean;
|
|
5
6
|
}, any, undefined>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.swcExecutor = void 0;
|
|
3
|
+
exports.swcExecutor = 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
7
|
const check_dependencies_1 = require("../../utils/check-dependencies");
|
|
8
|
+
const compiler_helper_dependency_1 = require("../../utils/compiler-helper-dependency");
|
|
8
9
|
const copy_assets_handler_1 = require("../../utils/copy-assets-handler");
|
|
9
10
|
const compile_swc_1 = require("../../utils/swc/compile-swc");
|
|
11
|
+
const get_swcrc_path_1 = require("../../utils/swc/get-swcrc-path");
|
|
10
12
|
const update_package_json_1 = require("../../utils/update-package-json");
|
|
11
13
|
const watch_for_single_file_changes_1 = require("../../utils/watch-for-single-file-changes");
|
|
12
14
|
function normalizeOptions(options, contextRoot, sourceRoot, projectRoot) {
|
|
@@ -25,9 +27,7 @@ function normalizeOptions(options, contextRoot, sourceRoot, projectRoot) {
|
|
|
25
27
|
// default to current directory if projectRootParts is [].
|
|
26
28
|
// Eg: when a project is at the root level, outside of layout dir
|
|
27
29
|
const swcCwd = projectRootParts.join('/') || '.';
|
|
28
|
-
const swcrcPath = options
|
|
29
|
-
? (0, path_1.join)(contextRoot, options.swcrc)
|
|
30
|
-
: (0, path_1.join)(contextRoot, projectRoot, '.lib.swcrc');
|
|
30
|
+
const swcrcPath = (0, get_swcrc_path_1.getSwcrcPath)(options, contextRoot, projectRoot);
|
|
31
31
|
const swcCliOptions = {
|
|
32
32
|
srcPath: projectDir,
|
|
33
33
|
destPath: (0, path_1.relative)((0, path_1.join)(contextRoot, swcCwd), outputPath),
|
|
@@ -38,6 +38,7 @@ function normalizeOptions(options, contextRoot, sourceRoot, projectRoot) {
|
|
|
38
38
|
projectRoot,
|
|
39
39
|
outputPath, tsConfig: (0, path_1.join)(contextRoot, options.tsConfig), swcCliOptions });
|
|
40
40
|
}
|
|
41
|
+
exports.normalizeOptions = normalizeOptions;
|
|
41
42
|
function processAssetsAndPackageJsonOnce(assetHandler, options, context, target, dependencies) {
|
|
42
43
|
return () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
44
|
yield assetHandler.processAllAssetsOnce();
|
|
@@ -52,6 +53,10 @@ function swcExecutor(_options, context) {
|
|
|
52
53
|
if (tmpTsConfig) {
|
|
53
54
|
options.tsConfig = tmpTsConfig;
|
|
54
55
|
}
|
|
56
|
+
const swcHelperDependency = (0, compiler_helper_dependency_1.getHelperDependency)(compiler_helper_dependency_1.HelperDependency.swc, options.swcCliOptions.swcrcPath, dependencies);
|
|
57
|
+
if (swcHelperDependency) {
|
|
58
|
+
dependencies.push(swcHelperDependency);
|
|
59
|
+
}
|
|
55
60
|
const assetHandler = new copy_assets_handler_1.CopyAssetsHandler({
|
|
56
61
|
projectDir: projectRoot,
|
|
57
62
|
rootDir: context.root,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swc.impl.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/swc/swc.impl.ts"],"names":[],"mappings":";;;;AACA,iEAG8C;AAE9C,+BAA+C;AAE/C,uEAAmE;AACnE,yEAAoE;AAKpE,6DAA0E;AAC1E,yEAAoE;AACpE,6FAAsF;AAEtF,
|
|
1
|
+
{"version":3,"file":"swc.impl.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/swc/swc.impl.ts"],"names":[],"mappings":";;;;AACA,iEAG8C;AAE9C,+BAA+C;AAE/C,uEAAmE;AACnE,uFAGgD;AAChD,yEAAoE;AAKpE,6DAA0E;AAC1E,mEAA8D;AAC9D,yEAAoE;AACpE,6FAAsF;AAEtF,SAAgB,gBAAgB,CAC9B,OAA2B,EAC3B,WAAmB,EACnB,UAAmB,EACnB,WAAoB;IAEpB,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzD,IAAI,OAAO,CAAC,aAAa,IAAI,IAAI,EAAE;QACjC,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC;KAC/B;IAED,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE;QACzB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;KACvB;IAED,MAAM,KAA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AAO,EACP,MAAM,EACN,YAAY,EACZ,CAAC,OAAO,CAAC,aAAa,CACvB,CACJ,CAAA,CAAC;YACF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAS,EAAE;gBAC5B,MAAM,wBAAwB,EAAE,CAAC;gBACjC,MAAM,yBAAyB,EAAE,CAAC;YACpC,CAAC,CAAA,CAAC,CAAC;YACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAS,EAAE;gBAC/B,MAAM,wBAAwB,EAAE,CAAC;gBACjC,MAAM,yBAAyB,EAAE,CAAC;YACpC,CAAC,CAAA,CAAC,CAAC;YAEH,6BAAO,sBAAA,KAAK,CAAC,CAAC,yBAAA,sBAAA,IAAA,6BAAe,EAC3B,OAAO,EACP,OAAO,EACP,+BAA+B,CAC7B,YAAY,EACZ,OAAO,EACP,OAAO,EACP,MAAM,EACN,YAAY,CACb,CACF,CAAA,CAAA,CAAA,EAAC;SACH;aAAM;YACL,6BAAO,4BAAM,IAAA,wBAAU,EACrB,OAAO,EACP,OAAO,EACP,+BAA+B,CAC7B,YAAY,EACZ,OAAO,EACP,OAAO,EACP,MAAM,EACN,YAAY,CACb,CACF,CAAA,EAAC;SACH;IACH,CAAC;CAAA;AAhFD,kCAgFC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -5,8 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const assets_1 = require("@nrwl/workspace/src/utilities/assets");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const check_dependencies_1 = require("../../utils/check-dependencies");
|
|
8
|
+
const compiler_helper_dependency_1 = require("../../utils/compiler-helper-dependency");
|
|
8
9
|
const copy_assets_handler_1 = require("../../utils/copy-assets-handler");
|
|
9
|
-
const tslib_dependency_1 = require("../../utils/tslib-dependency");
|
|
10
10
|
const compile_typescript_files_1 = require("../../utils/typescript/compile-typescript-files");
|
|
11
11
|
const update_package_json_1 = require("../../utils/update-package-json");
|
|
12
12
|
const watch_for_single_file_changes_1 = require("../../utils/watch-for-single-file-changes");
|
|
@@ -30,7 +30,10 @@ function tscExecutor(_options, context) {
|
|
|
30
30
|
if (tmpTsConfig) {
|
|
31
31
|
options.tsConfig = tmpTsConfig;
|
|
32
32
|
}
|
|
33
|
-
(0,
|
|
33
|
+
const tsLibDependency = (0, compiler_helper_dependency_1.getHelperDependency)(compiler_helper_dependency_1.HelperDependency.tsc, options.tsConfig, dependencies);
|
|
34
|
+
if (tsLibDependency) {
|
|
35
|
+
dependencies.push(tsLibDependency);
|
|
36
|
+
}
|
|
34
37
|
const assetHandler = new copy_assets_handler_1.CopyAssetsHandler({
|
|
35
38
|
projectDir: projectRoot,
|
|
36
39
|
rootDir: context.root,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsc.impl.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/tsc/tsc.impl.ts"],"names":[],"mappings":";;;;AACA,iEAG8C;AAC9C,+BAAqC;AACrC,uEAAmE;AACnE,yEAAoE;AAEpE,
|
|
1
|
+
{"version":3,"file":"tsc.impl.js","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/tsc/tsc.impl.ts"],"names":[],"mappings":";;;;AACA,iEAG8C;AAC9C,+BAAqC;AACrC,uEAAmE;AACnE,uFAGgD;AAChD,yEAAoE;AAEpE,8FAAyF;AACzF,yEAAoE;AACpE,6FAAsF;AAEtF,SAAgB,gBAAgB,CAC9B,OAAwB,EACxB,WAAmB,EACnB,UAAmB,EACnB,WAAoB;IAEpB,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzD,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE;QACzB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;KACvB;IAED,MAAM,KAAK,GAAsB,IAAA,0BAAiB,EAChD,OAAO,CAAC,MAAM,EACd,WAAW,EACX,UAAU,CACX,CAAC;IAEF,uCACK,OAAO,KACV,IAAI,E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YACjB,MAAM,wBAAwB,GAC5B,sBAAM,YAAY,CAAC,4BAA4B,EAAE,CAAA,CAAC;YACpD,MAAM,yBAAyB,GAAG,sBAAM,IAAA,yDAAyB,EAC/D,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,EAC/B,cAAc,EACd,GAAG,EAAE,CAAC,IAAA,uCAAiB,EAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAChE,CAAA,CAAC;YACF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAS,EAAE;gBAC5B,MAAM,wBAAwB,EAAE,CAAC;gBACjC,MAAM,yBAAyB,EAAE,CAAC;YACpC,CAAC,CAAA,CAAC,CAAC;YACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAS,EAAE;gBAC/B,MAAM,wBAAwB,EAAE,CAAC;gBACjC,MAAM,yBAAyB,EAAE,CAAC;YACpC,CAAC,CAAA,CAAC,CAAC;SACJ;QAED,6BAAO,sBAAA,KAAK,CAAC,CAAC,yBAAA,sBAAA,IAAA,iDAAsB,EAAC,OAAO,EAAE,OAAO,EAAE,GAAS,EAAE;YAChE,MAAM,YAAY,CAAC,oBAAoB,EAAE,CAAC;YAC1C,IAAA,uCAAiB,EAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QAC5D,CAAC,CAAA,CAAC,CAAA,CAAA,CAAA,EAAC;IACL,CAAC;CAAA;AAvDD,kCAuDC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProjectGraphDependency } from '@nrwl/devkit';
|
|
2
|
+
import { DependentBuildableProjectNode } from '@nrwl/workspace/src/utilities/buildable-libs-utils';
|
|
3
|
+
export declare enum HelperDependency {
|
|
4
|
+
tsc = "npm:tslib",
|
|
5
|
+
swc = "npm:@swc/helpers"
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Check and return a DependencyNode for the compiler's external helpers npm package. Return "null"
|
|
9
|
+
* if it doesn't need it or it cannot be found in the Project Graph
|
|
10
|
+
*
|
|
11
|
+
* @param {HelperDependency} helperDependency
|
|
12
|
+
* @param {string} configPath
|
|
13
|
+
* @param {DependentBuildableProjectNode[]} dependencies
|
|
14
|
+
* @param {boolean=false} returnDependencyIfFound
|
|
15
|
+
*/
|
|
16
|
+
export declare function getHelperDependency(helperDependency: HelperDependency, configPath: string, dependencies: DependentBuildableProjectNode[], returnDependencyIfFound?: boolean): DependentBuildableProjectNode | null;
|
|
17
|
+
export declare function getHelperDependenciesFromProjectGraph(contextRoot: string, sourceProject: string): ProjectGraphDependency[];
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHelperDependenciesFromProjectGraph = exports.getHelperDependency = exports.HelperDependency = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const typescript_1 = require("@nrwl/workspace/src/utilities/typescript");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const get_swcrc_path_1 = require("./swc/get-swcrc-path");
|
|
8
|
+
var HelperDependency;
|
|
9
|
+
(function (HelperDependency) {
|
|
10
|
+
HelperDependency["tsc"] = "npm:tslib";
|
|
11
|
+
HelperDependency["swc"] = "npm:@swc/helpers";
|
|
12
|
+
})(HelperDependency = exports.HelperDependency || (exports.HelperDependency = {}));
|
|
13
|
+
const jsExecutors = {
|
|
14
|
+
'@nrwl/js:tsc': {
|
|
15
|
+
helperDependency: HelperDependency.tsc,
|
|
16
|
+
getConfigPath: (options, contextRoot, _) => (0, path_1.join)(contextRoot, options.tsConfig),
|
|
17
|
+
},
|
|
18
|
+
'@nrwl/js:swc': {
|
|
19
|
+
helperDependency: HelperDependency.swc,
|
|
20
|
+
getConfigPath: (options, contextRoot, projectRoot) => (0, get_swcrc_path_1.getSwcrcPath)(options, contextRoot, projectRoot),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Check and return a DependencyNode for the compiler's external helpers npm package. Return "null"
|
|
25
|
+
* if it doesn't need it or it cannot be found in the Project Graph
|
|
26
|
+
*
|
|
27
|
+
* @param {HelperDependency} helperDependency
|
|
28
|
+
* @param {string} configPath
|
|
29
|
+
* @param {DependentBuildableProjectNode[]} dependencies
|
|
30
|
+
* @param {boolean=false} returnDependencyIfFound
|
|
31
|
+
*/
|
|
32
|
+
function getHelperDependency(helperDependency, configPath, dependencies, returnDependencyIfFound = false) {
|
|
33
|
+
const dependency = dependencies.find((dep) => dep.name === helperDependency);
|
|
34
|
+
if (!!dependency) {
|
|
35
|
+
// if a helperDependency is found, we either return null or the found dependency
|
|
36
|
+
// We return the found return dependency for the cases where it is a part of a
|
|
37
|
+
// project's dependency's dependency instead
|
|
38
|
+
// eg: app-a -> lib-a (helperDependency is on lib-a instead of app-a)
|
|
39
|
+
// When building app-a, we'd want to know about the found helper dependency still
|
|
40
|
+
return returnDependencyIfFound ? dependency : null;
|
|
41
|
+
}
|
|
42
|
+
let isHelperNeeded = false;
|
|
43
|
+
switch (helperDependency) {
|
|
44
|
+
case HelperDependency.tsc:
|
|
45
|
+
isHelperNeeded = !!(0, typescript_1.readTsConfig)(configPath).options['importHelpers'];
|
|
46
|
+
break;
|
|
47
|
+
case HelperDependency.swc:
|
|
48
|
+
isHelperNeeded = !!(0, devkit_1.readJsonFile)(configPath)['jsc']['externalHelpers'];
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
if (!isHelperNeeded)
|
|
52
|
+
return null;
|
|
53
|
+
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
54
|
+
const libNode = projectGraph.externalNodes[helperDependency];
|
|
55
|
+
if (!libNode) {
|
|
56
|
+
devkit_1.logger.warn(`Your library compilation option specifies that the compiler external helper (${helperDependency.split(':')[1]}) is needed but it is not installed.`);
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
name: helperDependency,
|
|
61
|
+
outputs: [],
|
|
62
|
+
node: libNode,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
exports.getHelperDependency = getHelperDependency;
|
|
66
|
+
function getHelperDependenciesFromProjectGraph(contextRoot, sourceProject) {
|
|
67
|
+
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
68
|
+
// if the source project isn't part of the projectGraph nodes; skip
|
|
69
|
+
if (!projectGraph.nodes[sourceProject])
|
|
70
|
+
return [];
|
|
71
|
+
// if the source project does not have any dependencies; skip
|
|
72
|
+
if (!projectGraph.dependencies[sourceProject] ||
|
|
73
|
+
!projectGraph.dependencies[sourceProject].length)
|
|
74
|
+
return;
|
|
75
|
+
const sourceDependencies = projectGraph.dependencies[sourceProject];
|
|
76
|
+
const internalDependencies = sourceDependencies.reduce((result, dependency) => {
|
|
77
|
+
// we check if a dependency is part of the workspace and if it's a library
|
|
78
|
+
// because we wouldn't want to include external dependencies (npm packages)
|
|
79
|
+
if (!dependency.target.startsWith('npm:') &&
|
|
80
|
+
!!projectGraph.nodes[dependency.target] &&
|
|
81
|
+
projectGraph.nodes[dependency.target].type === 'lib') {
|
|
82
|
+
const targetData = projectGraph.nodes[dependency.target].data;
|
|
83
|
+
// check if the dependency has a buildable target with one of the jsExecutors
|
|
84
|
+
const targetExecutor = Object.values(targetData.targets).find(({ executor }) => !!jsExecutors[executor]);
|
|
85
|
+
if (targetExecutor) {
|
|
86
|
+
const jsExecutor = jsExecutors[targetExecutor['executor']];
|
|
87
|
+
const { root: projectRoot } = targetData;
|
|
88
|
+
const configPath = jsExecutor.getConfigPath(targetExecutor['options'], contextRoot, projectRoot);
|
|
89
|
+
// construct the correct helperDependency configurations
|
|
90
|
+
// so we can compute the ProjectGraphDependency later
|
|
91
|
+
result.push({
|
|
92
|
+
helperDependency: jsExecutors[targetExecutor['executor']].helperDependency,
|
|
93
|
+
dependencies: projectGraph.dependencies[dependency.target],
|
|
94
|
+
configPath,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}, []);
|
|
100
|
+
return internalDependencies.reduce((result, { helperDependency, configPath, dependencies }) => {
|
|
101
|
+
const dependency = getHelperDependency(helperDependency, configPath, dependencies, true);
|
|
102
|
+
if (dependency) {
|
|
103
|
+
result.push({
|
|
104
|
+
type: 'static',
|
|
105
|
+
source: sourceProject,
|
|
106
|
+
target: dependency.name,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
}, []);
|
|
111
|
+
}
|
|
112
|
+
exports.getHelperDependenciesFromProjectGraph = getHelperDependenciesFromProjectGraph;
|
|
113
|
+
//# sourceMappingURL=compiler-helper-dependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler-helper-dependency.js","sourceRoot":"","sources":["../../../../../packages/js/src/utils/compiler-helper-dependency.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AAEtB,yEAAwE;AACxE,+BAA4B;AAE5B,yDAAoD;AAEpD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,4CAAwB,CAAA;AAC1B,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B;AAED,MAAM,WAAW,GAAG;IAClB,cAAc,EAAE;QACd,gBAAgB,EAAE,gBAAgB,CAAC,GAAG;QACtC,aAAa,EAAE,CAAC,OAAwB,EAAE,WAAmB,EAAE,CAAS,EAAE,EAAE,CAC1E,IAAA,WAAI,EAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC;KAC7B;IACV,cAAc,EAAE;QACd,gBAAgB,EAAE,gBAAgB,CAAC,GAAG;QACtC,aAAa,EAAE,CACb,OAA2B,EAC3B,WAAmB,EACnB,WAAmB,EACnB,EAAE,CAAC,IAAA,6BAAY,EAAC,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC;KAC5C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,GAAG,UAAU,CAAC,aAAa,CACzC,cAAc,CAAC,SAAS,CAAC,EACzB,WAAW,EACX,WAAW,CACZ,CAAC;gBAEF,wDAAwD;gBACxD,qDAAqD;gBACrD,MAAM,CAAC,IAAI,CAAC;oBACV,gBAAgB,EACd,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB;oBAC1D,YAAY,EAAE,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC;oBAC1D,UAAU;iBACX,CAAC,CAAC;aACJ;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,oBAAoB,CAAC,MAAM,CAChC,CAAC,MAAM,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,EAAE;QACzD,MAAM,UAAU,GAAG,mBAAmB,CACpC,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,IAAI,CACL,CAAC;QAEF,IAAI,UAAU,EAAE;YACd,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,aAAa;gBACrB,MAAM,EAAE,UAAU,CAAC,IAAI;aACE,CAAC,CAAC;SAC9B;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,EAA8B,CAC/B,CAAC;AACJ,CAAC;AA/ED,sFA+EC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSwcrcPath = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
function getSwcrcPath(options, contextRoot, projectRoot) {
|
|
6
|
+
return options.swcrc
|
|
7
|
+
? (0, path_1.join)(contextRoot, options.swcrc)
|
|
8
|
+
: (0, path_1.join)(contextRoot, projectRoot, '.lib.swcrc');
|
|
9
|
+
}
|
|
10
|
+
exports.getSwcrcPath = getSwcrcPath;
|
|
11
|
+
//# sourceMappingURL=get-swcrc-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-swcrc-path.js","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/swc/get-swcrc-path.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAG5B,SAAgB,YAAY,CAC1B,OAA2B,EAC3B,WAAmB,EACnB,WAAmB;IAEnB,OAAO,OAAO,CAAC,KAAK;QAClB,CAAC,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC;QAClC,CAAC,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;AACnD,CAAC;AARD,oCAQC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
-
import { DependentBuildableProjectNode } from '@nrwl/workspace/src/utilities/buildable-libs-utils';
|
|
3
|
-
import { NormalizedExecutorOptions } from './schema';
|
|
4
|
-
export declare function addTslibDependencyIfNeeded(options: NormalizedExecutorOptions, context: ExecutorContext, dependencies: DependentBuildableProjectNode[]): void;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addTslibDependencyIfNeeded = void 0;
|
|
4
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
const typescript_1 = require("@nrwl/workspace/src/utilities/typescript");
|
|
6
|
-
const tslibNodeName = 'npm:tslib';
|
|
7
|
-
function shouldAddTslibDependency(tsConfig, dependencies) {
|
|
8
|
-
if (dependencies.some((dep) => dep.name === tslibNodeName)) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
const config = (0, typescript_1.readTsConfig)(tsConfig);
|
|
12
|
-
return !!config.options.importHelpers;
|
|
13
|
-
}
|
|
14
|
-
function addTslibDependencyIfNeeded(options, context, dependencies) {
|
|
15
|
-
if (!shouldAddTslibDependency(options.tsConfig, dependencies)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const depGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
19
|
-
const tslibNode = depGraph.externalNodes[tslibNodeName];
|
|
20
|
-
if (!tslibNode) {
|
|
21
|
-
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
22
|
-
throw new Error(`"importHelpers" is enabled for ${context.targetName} but tslib is not installed. Use "${pmc.add} tslib" to install it.`);
|
|
23
|
-
}
|
|
24
|
-
const tslibDependency = {
|
|
25
|
-
name: tslibNodeName,
|
|
26
|
-
outputs: [],
|
|
27
|
-
node: tslibNode,
|
|
28
|
-
};
|
|
29
|
-
dependencies.push(tslibDependency);
|
|
30
|
-
}
|
|
31
|
-
exports.addTslibDependencyIfNeeded = addTslibDependencyIfNeeded;
|
|
32
|
-
//# sourceMappingURL=tslib-dependency.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tslib-dependency.js","sourceRoot":"","sources":["../../../../../packages/js/src/utils/tslib-dependency.ts"],"names":[],"mappings":";;;AAAA,yCAIsB;AAEtB,yEAAwE;AAGxE,MAAM,aAAa,GAAG,WAAW,CAAC;AAElC,SAAS,wBAAwB,CAC/B,QAAgB,EAChB,YAA6C;IAE7C,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,EAAE;QAC1D,OAAO,KAAK,CAAC;KACd;IAED,MAAM,MAAM,GAAG,IAAA,yBAAY,EAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC;AACxC,CAAC;AAED,SAAgB,0BAA0B,CACxC,OAAkC,EAClC,OAAwB,EACxB,YAA6C;IAE7C,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE;QAC7D,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAA,+BAAsB,GAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IAExD,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,GAAG,GAAG,IAAA,iCAAwB,GAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,kCAAkC,OAAO,CAAC,UAAU,qCAAqC,GAAG,CAAC,GAAG,wBAAwB,CACzH,CAAC;KACH;IAED,MAAM,eAAe,GAAkC;QACrD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,SAAS;KAChB,CAAC;IAEF,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AACrC,CAAC;AA1BD,gEA0BC"}
|