@nx/js 19.5.0-beta.0 → 19.5.0-beta.2
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/migrations.json +13 -0
- package/package.json +4 -4
- package/src/executors/node/lib/kill-tree.d.ts +0 -1
- package/src/executors/node/lib/kill-tree.js +1 -2
- package/src/executors/node/node.impl.js +1 -2
- package/src/executors/release-publish/extract-npm-publish-json-data.js +1 -2
- package/src/executors/release-publish/release-publish.impl.js +1 -1
- package/src/executors/swc/swc.impl.js +1 -2
- package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.js +1 -2
- package/src/executors/tsc/lib/batch/normalize-tasks-options.js +1 -2
- package/src/executors/tsc/lib/batch/watch.js +2 -3
- package/src/executors/tsc/lib/get-custom-transformers-factory.js +1 -2
- package/src/executors/tsc/lib/get-task-options.js +1 -2
- package/src/executors/tsc/lib/get-tsconfig.js +1 -2
- package/src/executors/tsc/lib/normalize-options.js +1 -2
- package/src/executors/tsc/lib/typescript-compilation.js +7 -4
- package/src/executors/tsc/lib/typescript-diagnostic-reporters.js +2 -3
- package/src/executors/tsc/tsc.batch-impl.js +1 -2
- package/src/executors/tsc/tsc.impl.js +3 -4
- package/src/executors/verdaccio/verdaccio.impl.js +1 -2
- package/src/generators/convert-to-swc/convert-to-swc.js +1 -2
- package/src/generators/init/init.js +1 -2
- package/src/generators/library/library.js +3 -4
- package/src/generators/release-version/release-version.js +1 -2
- package/src/generators/release-version/test-utils/create-workspace-with-package-dependencies.js +1 -2
- package/src/generators/release-version/utils/resolve-local-package-dependencies.js +1 -2
- package/src/generators/release-version/utils/resolve-version-spec.js +1 -2
- package/src/generators/release-version/utils/sort-projects-topologically.js +1 -2
- package/src/generators/release-version/utils/update-lock-file.js +1 -2
- package/src/generators/setup-build/generator.js +1 -2
- package/src/generators/setup-verdaccio/generator.js +1 -2
- package/src/generators/sync/sync.js +1 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +1 -1
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +1 -1
- package/src/migrations/update-16-8-2/update-swcrc.js +1 -1
- package/src/migrations/update-17-0-0/remove-deprecated-build-options.js +1 -1
- package/src/plugins/jest/start-local-registry.js +1 -2
- package/src/plugins/rollup/type-definitions.js +1 -2
- package/src/plugins/typescript/plugin.d.ts +5 -1
- package/src/plugins/typescript/plugin.js +58 -40
- package/src/utils/add-babel-inputs.js +1 -2
- package/src/utils/add-local-registry-scripts.js +1 -2
- package/src/utils/assets/assets.js +1 -2
- package/src/utils/assets/index.js +1 -2
- package/src/utils/buildable-libs-utils.js +9 -10
- package/src/utils/check-dependencies.js +1 -2
- package/src/utils/code-frames/highlight.js +1 -2
- package/src/utils/code-frames/identifiers.js +2 -3
- package/src/utils/compiler-helper-dependency.js +3 -3
- package/src/utils/find-npm-dependencies.js +1 -2
- package/src/utils/generate-globs.js +1 -2
- package/src/utils/get-import-path.js +1 -2
- package/src/utils/get-main-file-dir.js +1 -2
- package/src/utils/inline.js +4 -5
- package/src/utils/is-valid-variable.js +1 -2
- package/src/utils/npm-config.js +3 -4
- package/src/utils/package-json/create-entry-points.js +1 -2
- package/src/utils/package-json/get-npm-scope.js +1 -2
- package/src/utils/package-json/index.js +1 -2
- package/src/utils/package-json/update-package-json.js +3 -4
- package/src/utils/prettier.js +1 -2
- package/src/utils/swc/add-swc-config.js +2 -2
- package/src/utils/swc/add-swc-dependencies.js +2 -3
- package/src/utils/swc/compile-swc.js +2 -3
- package/src/utils/swc/get-swcrc-path.js +1 -2
- package/src/utils/swc/inline.js +1 -2
- package/src/utils/typescript/add-tslib-dependencies.js +1 -2
- package/src/utils/typescript/ast-utils.js +12 -13
- package/src/utils/typescript/compile-typescript-files.js +1 -2
- package/src/utils/typescript/create-ts-config.js +2 -2
- package/src/utils/typescript/ensure-typescript.js +1 -2
- package/src/utils/typescript/get-source-nodes.js +1 -2
- package/src/utils/typescript/load-ts-transformers.js +1 -2
- package/src/utils/typescript/print-diagnostics.js +1 -2
- package/src/utils/typescript/run-type-check.js +3 -4
- package/src/utils/typescript/ts-config.js +7 -8
- package/src/utils/typescript/tsnode-register.js +1 -2
- package/src/utils/versions.d.ts +2 -2
- package/src/utils/versions.js +2 -2
- package/src/utils/watch-for-single-file-changes.js +1 -2
- package/typescript.d.ts +1 -1
- package/typescript.js +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typeDefinitions =
|
|
3
|
+
exports.typeDefinitions = typeDefinitions;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
//NOTE: This is here so we can share between `@nx/rollup` and `@nx/vite`.
|
|
@@ -45,4 +45,3 @@ function typeDefinitions(options) {
|
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
exports.typeDefinitions = typeDefinitions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreateDependencies, type CreateNodes } from '@nx/devkit';
|
|
1
|
+
import { type CreateDependencies, type CreateNodes, type CreateNodesV2 } from '@nx/devkit';
|
|
2
2
|
export interface TscPluginOptions {
|
|
3
3
|
typecheck?: boolean | {
|
|
4
4
|
targetName?: string;
|
|
@@ -8,6 +8,10 @@ export interface TscPluginOptions {
|
|
|
8
8
|
configName?: string;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
13
|
+
*/
|
|
11
14
|
export declare const createDependencies: CreateDependencies;
|
|
12
15
|
export declare const PLUGIN_NAME = "@nx/js/typescript";
|
|
16
|
+
export declare const createNodesV2: CreateNodesV2<TscPluginOptions>;
|
|
13
17
|
export declare const createNodes: CreateNodes<TscPluginOptions>;
|
|
@@ -1,65 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNodes = exports.PLUGIN_NAME = exports.createDependencies = void 0;
|
|
3
|
+
exports.createNodes = exports.createNodesV2 = exports.PLUGIN_NAME = exports.createDependencies = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
6
6
|
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
7
|
+
const minimatch_1 = require("minimatch");
|
|
7
8
|
const node_fs_1 = require("node:fs");
|
|
8
9
|
const node_path_1 = require("node:path");
|
|
9
|
-
const
|
|
10
|
+
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
11
12
|
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
12
13
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
13
14
|
const ts_config_1 = require("../../utils/typescript/ts-config");
|
|
14
|
-
|
|
15
|
-
const targetsCache = readTargetsCache();
|
|
16
|
-
function readTargetsCache() {
|
|
15
|
+
function readTargetsCache(cachePath) {
|
|
17
16
|
return (0, node_fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
18
17
|
}
|
|
19
|
-
function writeTargetsToCache() {
|
|
20
|
-
|
|
21
|
-
(0, devkit_1.writeJsonFile)(cachePath, {
|
|
22
|
-
...oldCache,
|
|
23
|
-
...targetsCache,
|
|
24
|
-
});
|
|
18
|
+
function writeTargetsToCache(cachePath, results) {
|
|
19
|
+
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
25
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
23
|
+
*/
|
|
26
24
|
const createDependencies = () => {
|
|
27
|
-
writeTargetsToCache();
|
|
28
25
|
return [];
|
|
29
26
|
};
|
|
30
27
|
exports.createDependencies = createDependencies;
|
|
31
28
|
exports.PLUGIN_NAME = '@nx/js/typescript';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return {};
|
|
29
|
+
const tsConfigGlob = '**/tsconfig*.json';
|
|
30
|
+
exports.createNodesV2 = [
|
|
31
|
+
tsConfigGlob,
|
|
32
|
+
async (configFilePaths, options, context) => {
|
|
33
|
+
const optionsHash = (0, file_hasher_1.hashObject)(options);
|
|
34
|
+
const cachePath = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, `tsc-${optionsHash}.hash`);
|
|
35
|
+
const targetsCache = readTargetsCache(cachePath);
|
|
36
|
+
const normalizedOptions = normalizePluginOptions(options);
|
|
37
|
+
try {
|
|
38
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache), configFilePaths, normalizedOptions, context);
|
|
43
39
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
!siblingFiles.includes('tsconfig.json')) {
|
|
47
|
-
return {};
|
|
40
|
+
finally {
|
|
41
|
+
writeTargetsToCache(cachePath, targetsCache);
|
|
48
42
|
}
|
|
49
|
-
const nodeHash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, pluginOptions, context, [(0, lock_file_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
50
|
-
// The hash is calculated at the node/project level, so we add the config file path to avoid conflicts when caching
|
|
51
|
-
const cacheKey = `${nodeHash}_${configFilePath}`;
|
|
52
|
-
targetsCache[cacheKey] ??= buildTscTargets(fullConfigPath, projectRoot, pluginOptions, context);
|
|
53
|
-
return {
|
|
54
|
-
projects: {
|
|
55
|
-
[projectRoot]: {
|
|
56
|
-
projectType: 'library',
|
|
57
|
-
targets: targetsCache[cacheKey],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
43
|
},
|
|
62
44
|
];
|
|
45
|
+
exports.createNodes = [
|
|
46
|
+
tsConfigGlob,
|
|
47
|
+
async (configFilePath, options, context) => {
|
|
48
|
+
devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
|
|
49
|
+
const normalizedOptions = normalizePluginOptions(options);
|
|
50
|
+
return createNodesInternal(configFilePath, normalizedOptions, context, {});
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
54
|
+
const projectRoot = (0, node_path_1.dirname)(configFilePath);
|
|
55
|
+
const fullConfigPath = (0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath);
|
|
56
|
+
// Do not create a project if package.json and project.json isn't there.
|
|
57
|
+
const siblingFiles = (0, node_fs_1.readdirSync)((0, node_path_1.join)(context.workspaceRoot, projectRoot));
|
|
58
|
+
if (!siblingFiles.includes('package.json') &&
|
|
59
|
+
!siblingFiles.includes('project.json')) {
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
// Do not create a project if it's not a tsconfig.json and there is no tsconfig.json in the same directory
|
|
63
|
+
if ((0, node_path_1.basename)(configFilePath) !== 'tsconfig.json' &&
|
|
64
|
+
!siblingFiles.includes('tsconfig.json')) {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
const nodeHash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, lock_file_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
68
|
+
// The hash is calculated at the node/project level, so we add the config file path to avoid conflicts when caching
|
|
69
|
+
const cacheKey = `${nodeHash}_${configFilePath}`;
|
|
70
|
+
targetsCache[cacheKey] ??= buildTscTargets(fullConfigPath, projectRoot, options, context);
|
|
71
|
+
const { targets } = targetsCache[cacheKey];
|
|
72
|
+
return {
|
|
73
|
+
projects: {
|
|
74
|
+
[projectRoot]: {
|
|
75
|
+
projectType: 'library',
|
|
76
|
+
targets,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
63
81
|
function buildTscTargets(configFilePath, projectRoot, options, context) {
|
|
64
82
|
const targets = {};
|
|
65
83
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
@@ -105,7 +123,7 @@ function buildTscTargets(configFilePath, projectRoot, options, context) {
|
|
|
105
123
|
outputs: getOutputs(configFilePath, tsConfig, internalProjectReferences, context.workspaceRoot, projectRoot),
|
|
106
124
|
};
|
|
107
125
|
}
|
|
108
|
-
return targets;
|
|
126
|
+
return { targets };
|
|
109
127
|
}
|
|
110
128
|
function getInputs(namedInputs, configFilePath, tsConfig, internalProjectReferences, workspaceRoot, projectRoot) {
|
|
111
129
|
const configFiles = new Set();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addBabelInputs =
|
|
3
|
+
exports.addBabelInputs = addBabelInputs;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
/** @deprecated Do not use this function as the root babel.config.json file is no longer needed */
|
|
6
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.
|
|
@@ -20,4 +20,3 @@ function addBabelInputs(tree) {
|
|
|
20
20
|
}
|
|
21
21
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
22
22
|
}
|
|
23
|
-
exports.addBabelInputs = addBabelInputs;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addLocalRegistryScripts =
|
|
3
|
+
exports.addLocalRegistryScripts = addLocalRegistryScripts;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const startLocalRegistryScript = (localRegistryTarget) => `
|
|
6
6
|
/**
|
|
@@ -74,4 +74,3 @@ function addLocalRegistryScripts(tree) {
|
|
|
74
74
|
}
|
|
75
75
|
return { startLocalRegistryPath, stopLocalRegistryPath };
|
|
76
76
|
}
|
|
77
|
-
exports.addLocalRegistryScripts = addLocalRegistryScripts;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assetGlobsToFiles =
|
|
3
|
+
exports.assetGlobsToFiles = assetGlobsToFiles;
|
|
4
4
|
const fastGlob = require("fast-glob");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
function assetGlobsToFiles(assets, rootDir, outDir) {
|
|
@@ -33,4 +33,3 @@ function assetGlobsToFiles(assets, rootDir, outDir) {
|
|
|
33
33
|
});
|
|
34
34
|
return files;
|
|
35
35
|
}
|
|
36
|
-
exports.assetGlobsToFiles = assetGlobsToFiles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copyAssets =
|
|
3
|
+
exports.copyAssets = copyAssets;
|
|
4
4
|
const copy_assets_handler_1 = require("./copy-assets-handler");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
async function copyAssets(options, context) {
|
|
@@ -30,4 +30,3 @@ async function copyAssets(options, context) {
|
|
|
30
30
|
}
|
|
31
31
|
return result;
|
|
32
32
|
}
|
|
33
|
-
exports.copyAssets = copyAssets;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calculateProjectBuildableDependencies = calculateProjectBuildableDependencies;
|
|
4
|
+
exports.calculateProjectDependencies = calculateProjectDependencies;
|
|
5
|
+
exports.calculateDependenciesFromTaskGraph = calculateDependenciesFromTaskGraph;
|
|
6
|
+
exports.computeCompilerOptionsPaths = computeCompilerOptionsPaths;
|
|
7
|
+
exports.createTmpTsConfig = createTmpTsConfig;
|
|
8
|
+
exports.checkDependentProjectsHaveBeenBuilt = checkDependentProjectsHaveBeenBuilt;
|
|
9
|
+
exports.findMissingBuildDependencies = findMissingBuildDependencies;
|
|
10
|
+
exports.updatePaths = updatePaths;
|
|
11
|
+
exports.updateBuildableProjectPackageJsonDependencies = updateBuildableProjectPackageJsonDependencies;
|
|
4
12
|
const devkit_1 = require("@nx/devkit");
|
|
5
13
|
const fs_1 = require("fs");
|
|
6
14
|
const operators_1 = require("nx/src/project-graph/operators");
|
|
@@ -19,7 +27,6 @@ function calculateProjectBuildableDependencies(taskGraph, projGraph, root, proje
|
|
|
19
27
|
}
|
|
20
28
|
return calculateProjectDependencies(projGraph, root, projectName, targetName, configurationName, shallow);
|
|
21
29
|
}
|
|
22
|
-
exports.calculateProjectBuildableDependencies = calculateProjectBuildableDependencies;
|
|
23
30
|
function calculateProjectDependencies(projGraph, root, projectName, targetName, configurationName, shallow) {
|
|
24
31
|
const target = projGraph.nodes[projectName];
|
|
25
32
|
// gather the library dependencies
|
|
@@ -81,7 +88,6 @@ function calculateProjectDependencies(projGraph, root, projectName, targetName,
|
|
|
81
88
|
topLevelDependencies,
|
|
82
89
|
};
|
|
83
90
|
}
|
|
84
|
-
exports.calculateProjectDependencies = calculateProjectDependencies;
|
|
85
91
|
function collectDependencies(project, projGraph, acc, shallow, areTopLevelDeps = true) {
|
|
86
92
|
(projGraph.dependencies[project] || []).forEach((dependency) => {
|
|
87
93
|
const existingEntry = acc.find((dep) => dep.name === dependency.target);
|
|
@@ -165,7 +171,6 @@ function calculateDependenciesFromTaskGraph(taskGraph, projectGraph, root, proje
|
|
|
165
171
|
topLevelDependencies,
|
|
166
172
|
};
|
|
167
173
|
}
|
|
168
|
-
exports.calculateDependenciesFromTaskGraph = calculateDependenciesFromTaskGraph;
|
|
169
174
|
function collectNpmDependencies(projectName, projectGraph, dependentTasks, collectedPackages = new Set(), isTopLevel = true) {
|
|
170
175
|
const dependencies = projectGraph.dependencies[projectName]
|
|
171
176
|
.map((dep) => {
|
|
@@ -225,7 +230,6 @@ function computeCompilerOptionsPaths(tsConfig, dependencies) {
|
|
|
225
230
|
updatePaths(dependencies, paths);
|
|
226
231
|
return paths;
|
|
227
232
|
}
|
|
228
|
-
exports.computeCompilerOptionsPaths = computeCompilerOptionsPaths;
|
|
229
233
|
function createTmpTsConfig(tsconfigPath, workspaceRoot, projectRoot, dependencies, useWorkspaceAsBaseUrl = false) {
|
|
230
234
|
const tmpTsConfigPath = (0, path_1.join)(workspaceRoot, 'tmp', projectRoot, process.env.NX_TASK_TARGET_TARGET ?? 'build', 'tsconfig.generated.json');
|
|
231
235
|
const parsedTSConfig = readTsConfigWithRemappedPaths(tsconfigPath, tmpTsConfigPath, dependencies);
|
|
@@ -237,7 +241,6 @@ function createTmpTsConfig(tsconfigPath, workspaceRoot, projectRoot, dependencie
|
|
|
237
241
|
(0, devkit_1.writeJsonFile)(tmpTsConfigPath, parsedTSConfig);
|
|
238
242
|
return (0, path_1.join)(tmpTsConfigPath);
|
|
239
243
|
}
|
|
240
|
-
exports.createTmpTsConfig = createTmpTsConfig;
|
|
241
244
|
function cleanupTmpTsConfigFile(tmpTsConfigPath) {
|
|
242
245
|
try {
|
|
243
246
|
if (tmpTsConfigPath) {
|
|
@@ -262,7 +265,6 @@ function checkDependentProjectsHaveBeenBuilt(root, projectName, targetName, proj
|
|
|
262
265
|
return true;
|
|
263
266
|
}
|
|
264
267
|
}
|
|
265
|
-
exports.checkDependentProjectsHaveBeenBuilt = checkDependentProjectsHaveBeenBuilt;
|
|
266
268
|
function findMissingBuildDependencies(root, projectName, targetName, projectDependencies) {
|
|
267
269
|
const depLibsToBuildFirst = [];
|
|
268
270
|
// verify whether all dependent libraries have been built
|
|
@@ -277,7 +279,6 @@ function findMissingBuildDependencies(root, projectName, targetName, projectDepe
|
|
|
277
279
|
});
|
|
278
280
|
return depLibsToBuildFirst;
|
|
279
281
|
}
|
|
280
|
-
exports.findMissingBuildDependencies = findMissingBuildDependencies;
|
|
281
282
|
function updatePaths(dependencies, paths) {
|
|
282
283
|
const pathsKeys = Object.keys(paths);
|
|
283
284
|
// For each registered dependency
|
|
@@ -307,7 +308,6 @@ function updatePaths(dependencies, paths) {
|
|
|
307
308
|
}
|
|
308
309
|
});
|
|
309
310
|
}
|
|
310
|
-
exports.updatePaths = updatePaths;
|
|
311
311
|
/**
|
|
312
312
|
* Updates the peerDependencies section in the `dist/lib/xyz/package.json` with
|
|
313
313
|
* the proper dependency and version
|
|
@@ -371,7 +371,6 @@ function updateBuildableProjectPackageJsonDependencies(root, projectName, target
|
|
|
371
371
|
(0, devkit_1.writeJsonFile)(packageJsonPath, packageJson);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
exports.updateBuildableProjectPackageJsonDependencies = updateBuildableProjectPackageJsonDependencies;
|
|
375
374
|
// verify whether the package.json already specifies the dep
|
|
376
375
|
function hasDependency(outputJson, depConfigName, packageName) {
|
|
377
376
|
if (outputJson[depConfigName]) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkDependencies =
|
|
3
|
+
exports.checkDependencies = checkDependencies;
|
|
4
4
|
const buildable_libs_utils_1 = require("./buildable-libs-utils");
|
|
5
5
|
function checkDependencies(context, tsConfigPath) {
|
|
6
6
|
const { target, dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
|
|
@@ -20,4 +20,3 @@ function checkDependencies(context, tsConfigPath) {
|
|
|
20
20
|
dependencies,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
exports.checkDependencies = checkDependencies;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.highlight =
|
|
3
|
+
exports.highlight = highlight;
|
|
4
4
|
// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-highlight/src/index.js
|
|
5
5
|
const jsTokens = require("js-tokens");
|
|
6
6
|
const chalk = require("chalk");
|
|
@@ -83,4 +83,3 @@ function highlight(code) {
|
|
|
83
83
|
const defs = getDefs(chalk);
|
|
84
84
|
return highlightTokens(defs, code);
|
|
85
85
|
}
|
|
86
|
-
exports.highlight = highlight;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isReservedWord = isReservedWord;
|
|
4
|
+
exports.isKeyword = isKeyword;
|
|
4
5
|
// Adapted from https://raw.githubusercontent.com/babel/babel/e39b508030a9f696584d21b0eb9677498e3ca231/packages/babel-helper-validator-identifier/src/keyword.js
|
|
5
6
|
const keywords = new Set([
|
|
6
7
|
'break',
|
|
@@ -45,8 +46,6 @@ const keywords = new Set([
|
|
|
45
46
|
function isReservedWord(word, inModule) {
|
|
46
47
|
return (inModule && word === 'await') || word === 'enum';
|
|
47
48
|
}
|
|
48
|
-
exports.isReservedWord = isReservedWord;
|
|
49
49
|
function isKeyword(word) {
|
|
50
50
|
return keywords.has(word);
|
|
51
51
|
}
|
|
52
|
-
exports.isKeyword = isKeyword;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.HelperDependency = void 0;
|
|
4
|
+
exports.getHelperDependency = getHelperDependency;
|
|
5
|
+
exports.getHelperDependenciesFromProjectGraph = getHelperDependenciesFromProjectGraph;
|
|
4
6
|
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
const path_1 = require("path");
|
|
6
8
|
const ts_config_1 = require("./typescript/ts-config");
|
|
@@ -72,7 +74,6 @@ function getHelperDependency(helperDependency, configPath, dependencies, project
|
|
|
72
74
|
node: libNode,
|
|
73
75
|
};
|
|
74
76
|
}
|
|
75
|
-
exports.getHelperDependency = getHelperDependency;
|
|
76
77
|
function getHelperDependenciesFromProjectGraph(contextRoot, sourceProject, projectGraph) {
|
|
77
78
|
// if the source project isn't part of the projectGraph nodes; skip
|
|
78
79
|
if (!projectGraph.nodes[sourceProject])
|
|
@@ -117,4 +118,3 @@ function getHelperDependenciesFromProjectGraph(contextRoot, sourceProject, proje
|
|
|
117
118
|
return result;
|
|
118
119
|
}, []);
|
|
119
120
|
}
|
|
120
|
-
exports.getHelperDependenciesFromProjectGraph = getHelperDependenciesFromProjectGraph;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findNpmDependencies =
|
|
3
|
+
exports.findNpmDependencies = findNpmDependencies;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const configuration_1 = require("nx/src/config/configuration");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -35,7 +35,6 @@ function findNpmDependencies(workspaceRoot, sourceProject, projectGraph, project
|
|
|
35
35
|
collectAll(sourceProject, results);
|
|
36
36
|
return results;
|
|
37
37
|
}
|
|
38
|
-
exports.findNpmDependencies = findNpmDependencies;
|
|
39
38
|
// Keep track of workspace libs we already read package.json for so we don't read from disk again.
|
|
40
39
|
const seenWorkspaceDeps = {};
|
|
41
40
|
function collectDependenciesFromFileMap(workspaceRoot, sourceProject, projectGraph, projectFileMap, buildTarget, ignoredFiles, useLocalPathsForWorkspaceDependencies, npmDeps) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createGlobPatternsForDependencies =
|
|
3
|
+
exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const workspace_root_1 = require("nx/src/utils/workspace-root");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -77,4 +77,3 @@ due to missing "sourceRoot" in the dependencies' project configuration
|
|
|
77
77
|
throw new Error(`createGlobPatternsForDependencies: Error when generating globs.\n${e?.message}`);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getImportPath =
|
|
3
|
+
exports.getImportPath = getImportPath;
|
|
4
4
|
const get_npm_scope_1 = require("./package-json/get-npm-scope");
|
|
5
5
|
/**
|
|
6
6
|
* Prefixes project name with npm scope
|
|
@@ -11,4 +11,3 @@ function getImportPath(tree, projectDirectory) {
|
|
|
11
11
|
? `${npmScope === '@' ? '' : '@'}${npmScope}/${projectDirectory}`
|
|
12
12
|
: projectDirectory;
|
|
13
13
|
}
|
|
14
|
-
exports.getImportPath = getImportPath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRelativeDirectoryToProjectRoot =
|
|
3
|
+
exports.getRelativeDirectoryToProjectRoot = getRelativeDirectoryToProjectRoot;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const path_2 = require("nx/src/utils/path");
|
|
6
6
|
function getRelativeDirectoryToProjectRoot(file, projectRoot) {
|
|
@@ -8,4 +8,3 @@ function getRelativeDirectoryToProjectRoot(file, projectRoot) {
|
|
|
8
8
|
const relativeDir = (0, path_2.normalizePath)((0, path_1.relative)(projectRoot, dir));
|
|
9
9
|
return relativeDir === '' ? `./` : `./${relativeDir}/`;
|
|
10
10
|
}
|
|
11
|
-
exports.getRelativeDirectoryToProjectRoot = getRelativeDirectoryToProjectRoot;
|
package/src/utils/inline.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isInlineGraphEmpty = isInlineGraphEmpty;
|
|
4
|
+
exports.handleInliningBuild = handleInliningBuild;
|
|
5
|
+
exports.postProcessInlinedDependencies = postProcessInlinedDependencies;
|
|
6
|
+
exports.getRootTsConfigPath = getRootTsConfigPath;
|
|
4
7
|
const devkit_1 = require("@nx/devkit");
|
|
5
8
|
const fs_extra_1 = require("fs-extra");
|
|
6
9
|
const path_1 = require("path");
|
|
@@ -8,7 +11,6 @@ const fs_1 = require("fs");
|
|
|
8
11
|
function isInlineGraphEmpty(inlineGraph) {
|
|
9
12
|
return Object.keys(inlineGraph.nodes).length === 0;
|
|
10
13
|
}
|
|
11
|
-
exports.isInlineGraphEmpty = isInlineGraphEmpty;
|
|
12
14
|
function handleInliningBuild(context, options, tsConfigPath, projectName = context.projectName) {
|
|
13
15
|
const tsConfigJson = (0, devkit_1.readJsonFile)(tsConfigPath);
|
|
14
16
|
const pathAliases = tsConfigJson['compilerOptions']?.['paths'] || readBasePathAliases(context);
|
|
@@ -19,7 +21,6 @@ function handleInliningBuild(context, options, tsConfigPath, projectName = conte
|
|
|
19
21
|
buildInlineGraphExternals(context, inlineGraph, pathAliases);
|
|
20
22
|
return inlineGraph;
|
|
21
23
|
}
|
|
22
|
-
exports.handleInliningBuild = handleInliningBuild;
|
|
23
24
|
function postProcessInlinedDependencies(outputPath, parentOutputPath, inlineGraph) {
|
|
24
25
|
if (isInlineGraphEmpty(inlineGraph)) {
|
|
25
26
|
return;
|
|
@@ -53,7 +54,6 @@ function postProcessInlinedDependencies(outputPath, parentOutputPath, inlineGrap
|
|
|
53
54
|
markedForDeletion.forEach((path) => (0, fs_extra_1.removeSync)(path));
|
|
54
55
|
updateImports(outputPath, inlinedDepsDestOutputRecord);
|
|
55
56
|
}
|
|
56
|
-
exports.postProcessInlinedDependencies = postProcessInlinedDependencies;
|
|
57
57
|
function readBasePathAliases(context) {
|
|
58
58
|
return (0, devkit_1.readJsonFile)(getRootTsConfigPath(context))?.['compilerOptions']['paths'];
|
|
59
59
|
}
|
|
@@ -66,7 +66,6 @@ function getRootTsConfigPath(context) {
|
|
|
66
66
|
}
|
|
67
67
|
throw new Error('Could not find a root tsconfig.json or tsconfig.base.json file.');
|
|
68
68
|
}
|
|
69
|
-
exports.getRootTsConfigPath = getRootTsConfigPath;
|
|
70
69
|
function emptyInlineGraph() {
|
|
71
70
|
return { nodes: {}, externals: {}, dependencies: {} };
|
|
72
71
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidVariable =
|
|
3
|
+
exports.isValidVariable = isValidVariable;
|
|
4
4
|
/**
|
|
5
5
|
* Determines if a given string is a valid JavaScript variable name.
|
|
6
6
|
* @param name name of the variable to be checked
|
|
@@ -36,4 +36,3 @@ function isValidVariable(name) {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
exports.isValidVariable = isValidVariable;
|
package/src/utils/npm-config.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseRegistryOptions = parseRegistryOptions;
|
|
4
|
+
exports.getNpmRegistry = getNpmRegistry;
|
|
5
|
+
exports.getNpmTag = getNpmTag;
|
|
4
6
|
const child_process_1 = require("child_process");
|
|
5
7
|
const fs_1 = require("fs");
|
|
6
8
|
const path_1 = require("path");
|
|
@@ -37,7 +39,6 @@ async function parseRegistryOptions(cwd, pkg, options, logWarnFn = console.warn)
|
|
|
37
39
|
const tag = options.tag || (await getNpmTag(cwd));
|
|
38
40
|
return { registry, tag, registryConfigKey };
|
|
39
41
|
}
|
|
40
|
-
exports.parseRegistryOptions = parseRegistryOptions;
|
|
41
42
|
/**
|
|
42
43
|
* Returns the npm registry that is used for publishing.
|
|
43
44
|
*
|
|
@@ -54,7 +55,6 @@ async function getNpmRegistry(cwd, scope) {
|
|
|
54
55
|
}
|
|
55
56
|
return registry;
|
|
56
57
|
}
|
|
57
|
-
exports.getNpmRegistry = getNpmRegistry;
|
|
58
58
|
/**
|
|
59
59
|
* Returns the npm tag that is used for publishing.
|
|
60
60
|
*
|
|
@@ -64,7 +64,6 @@ async function getNpmTag(cwd) {
|
|
|
64
64
|
// npm does not support '@scope:tag' in the npm config, so we only need to check for 'tag'.
|
|
65
65
|
return getNpmConfigValue('tag', cwd);
|
|
66
66
|
}
|
|
67
|
-
exports.getNpmTag = getNpmTag;
|
|
68
67
|
async function getNpmConfigValue(key, cwd) {
|
|
69
68
|
try {
|
|
70
69
|
const result = await execAsync(`npm config get ${key}`, cwd);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createEntryPoints =
|
|
3
|
+
exports.createEntryPoints = createEntryPoints;
|
|
4
4
|
const fast_glob_1 = require("fast-glob");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
function createEntryPoints(additionalEntryPoints, root) {
|
|
@@ -20,4 +20,3 @@ function createEntryPoints(additionalEntryPoints, root) {
|
|
|
20
20
|
}
|
|
21
21
|
return files;
|
|
22
22
|
}
|
|
23
|
-
exports.createEntryPoints = createEntryPoints;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNpmScope =
|
|
3
|
+
exports.getNpmScope = getNpmScope;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
/**
|
|
6
6
|
* Read the npm scope that a workspace should use by default
|
|
@@ -13,4 +13,3 @@ function getNpmScope(tree) {
|
|
|
13
13
|
return name.split('/')[0].substring(1);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
exports.getNpmScope = getNpmScope;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copyPackageJson =
|
|
3
|
+
exports.copyPackageJson = copyPackageJson;
|
|
4
4
|
const watch_for_single_file_changes_1 = require("../watch-for-single-file-changes");
|
|
5
5
|
const update_package_json_1 = require("./update-package-json");
|
|
6
6
|
const check_dependencies_1 = require("../check-dependencies");
|
|
@@ -27,4 +27,3 @@ async function copyPackageJson(_options, context) {
|
|
|
27
27
|
return { success: true };
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
exports.copyPackageJson = copyPackageJson;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.updatePackageJson = updatePackageJson;
|
|
4
|
+
exports.getExports = getExports;
|
|
5
|
+
exports.getUpdatedPackageJsonContent = getUpdatedPackageJsonContent;
|
|
4
6
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
5
7
|
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
6
8
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
@@ -52,7 +54,6 @@ function updatePackageJson(options, context, target, dependencies, fileMap = nul
|
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
|
-
exports.updatePackageJson = updatePackageJson;
|
|
56
57
|
function isNpmNode(node, graph) {
|
|
57
58
|
return !!(graph.externalNodes[node.name]?.type === 'npm');
|
|
58
59
|
}
|
|
@@ -122,7 +123,6 @@ function getExports(options) {
|
|
|
122
123
|
}
|
|
123
124
|
return exports;
|
|
124
125
|
}
|
|
125
|
-
exports.getExports = getExports;
|
|
126
126
|
function getUpdatedPackageJsonContent(packageJson, options) {
|
|
127
127
|
// Default is CJS unless esm is explicitly passed.
|
|
128
128
|
const hasCjsFormat = !options.format || options.format?.includes('cjs');
|
|
@@ -181,4 +181,3 @@ function getUpdatedPackageJsonContent(packageJson, options) {
|
|
|
181
181
|
}
|
|
182
182
|
return packageJson;
|
|
183
183
|
}
|
|
184
|
-
exports.getUpdatedPackageJsonContent = getUpdatedPackageJsonContent;
|
package/src/utils/prettier.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveUserExistingPrettierConfig =
|
|
3
|
+
exports.resolveUserExistingPrettierConfig = resolveUserExistingPrettierConfig;
|
|
4
4
|
let prettier;
|
|
5
5
|
try {
|
|
6
6
|
prettier = require('prettier');
|
|
@@ -31,4 +31,3 @@ async function resolveUserExistingPrettierConfig() {
|
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
exports.resolveUserExistingPrettierConfig = resolveUserExistingPrettierConfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.defaultExclude = void 0;
|
|
4
|
+
exports.addSwcConfig = addSwcConfig;
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
exports.defaultExclude = [
|
|
6
7
|
'jest.config.ts',
|
|
@@ -38,4 +39,3 @@ function addSwcConfig(tree, projectDir, type = 'commonjs') {
|
|
|
38
39
|
return;
|
|
39
40
|
tree.write(swcrcPath, swcOptionsString(type));
|
|
40
41
|
}
|
|
41
|
-
exports.addSwcConfig = addSwcConfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addSwcDependencies = addSwcDependencies;
|
|
4
|
+
exports.addSwcRegisterDependencies = addSwcRegisterDependencies;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const versions_1 = require("../versions");
|
|
6
7
|
function addSwcDependencies(tree) {
|
|
@@ -11,8 +12,6 @@ function addSwcDependencies(tree) {
|
|
|
11
12
|
'@swc/cli': versions_1.swcCliVersion,
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
exports.addSwcDependencies = addSwcDependencies;
|
|
15
15
|
function addSwcRegisterDependencies(tree) {
|
|
16
16
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@swc-node/register': versions_1.swcNodeVersion, '@swc/core': versions_1.swcCoreVersion });
|
|
17
17
|
}
|
|
18
|
-
exports.addSwcRegisterDependencies = addSwcRegisterDependencies;
|