@nx/js 23.2.0-beta.4 → 23.2.0-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/dist/internal.d.ts +3 -3
- package/dist/internal.js +12 -15
- package/dist/src/executors/copy-workspace-modules/copy-workspace-modules.js +5 -6
- package/dist/src/executors/node/lib/output-file.js +4 -4
- package/dist/src/executors/node/node.impl.js +9 -9
- package/dist/src/executors/prune-lockfile/prune-lockfile.d.ts +1 -1
- package/dist/src/executors/prune-lockfile/prune-lockfile.js +7 -9
- package/dist/src/executors/tsc/lib/batch/watch.js +3 -3
- package/dist/src/executors/tsc/tsc.batch-impl.d.ts +1 -1
- package/dist/src/executors/tsc/tsc.batch-impl.js +2 -2
- package/dist/src/executors/verdaccio/verdaccio.impl.js +2 -2
- package/dist/src/generators/library/utils/add-release-config.js +2 -2
- package/dist/src/generators/setup-build/generator.js +1 -2
- package/dist/src/generators/typescript-sync/typescript-sync.d.ts +1 -1
- package/dist/src/generators/typescript-sync/typescript-sync.js +2 -2
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +5 -7
- package/dist/src/plugins/typescript/plugin.js +14 -14
- package/dist/src/plugins/typescript/util.d.ts +1 -1
- package/dist/src/release/utils/update-lock-file.js +6 -7
- package/dist/src/release/version-actions.d.ts +7 -2
- package/dist/src/release/version-actions.js +111 -57
- package/dist/src/utils/assets/copy-assets-handler.d.ts +1 -1
- package/dist/src/utils/assets/copy-assets-handler.js +2 -2
- package/dist/src/utils/buildable-libs-utils.js +10 -13
- package/dist/src/utils/find-npm-dependencies.js +7 -10
- package/dist/src/utils/generate-globs.js +11 -14
- package/dist/src/utils/get-main-file-dir.js +2 -2
- package/dist/src/utils/npm-config.d.ts +1 -1
- package/dist/src/utils/package-json/update-package-json.d.ts +1 -1
- package/dist/src/utils/package-json/update-package-json.js +9 -11
- package/dist/src/utils/package-manager-workspaces.js +2 -2
- package/dist/src/utils/typescript/create-ts-config.d.ts +1 -1
- package/dist/src/utils/typescript/create-ts-config.js +5 -5
- package/dist/src/utils/typescript/plugin.js +2 -2
- package/dist/src/utils/typescript/run-type-check.js +2 -2
- package/dist/src/utils/typescript/ts-solution-setup.d.ts +1 -1
- package/dist/src/utils/typescript/ts-solution-setup.js +3 -3
- package/dist/src/utils/watch-for-single-file-changes.js +2 -2
- package/package.json +5 -5
package/dist/internal.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { forceRegisterEsmLoader, loadTsFile, registerTsProject, registerTsConfigPaths, requireWithTsconfigFallback, } from 'nx/
|
|
2
|
-
export { TargetProjectLocator, isBuiltinModuleImport, } from 'nx/
|
|
3
|
-
export { findProjectsNpmDependencies } from 'nx/
|
|
1
|
+
export { forceRegisterEsmLoader, loadTsFile, registerTsProject, registerTsConfigPaths, requireWithTsconfigFallback, } from '@nx/devkit/internal';
|
|
2
|
+
export { TargetProjectLocator, isBuiltinModuleImport, } from '@nx/devkit/internal';
|
|
3
|
+
export { findProjectsNpmDependencies } from '@nx/devkit/internal';
|
|
4
4
|
export { walkTsconfigExtendsChain, type RawTsconfigJsonCache, } from './src/utils/typescript/raw-tsconfig';
|
|
5
5
|
export { isEsmProject } from './src/utils/module-format/is-esm-project';
|
|
6
6
|
export { TS_SOLUTION_SETUP_TSCONFIG_INPUT, addProjectToTsSolutionWorkspace, assertNotUsingTsSolutionSetup, findRuntimeTsConfigName, getDefinedCustomConditionName, getProjectSourceRoot, getProjectType, isUsingTsSolutionSetup, shouldConfigureTsSolutionSetup, updateTsconfigFiles, } from './src/utils/typescript/ts-solution-setup';
|
package/dist/internal.js
CHANGED
|
@@ -7,21 +7,18 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.addLocalRegistryScripts = exports.stripGlobToBaseDir = exports.getImportPath = exports.createGlobPatternsForDependencies = exports.normalizeUnitTestRunnerOption = exports.normalizeLinterOption = exports.isValidPackageJsonBuildConfig = exports.addBuildAndWatchDepsTargets = exports.findNpmDependencies = exports.getProjectPackageManagerWorkspaceStateWarningTask = exports.getProjectPackageManagerWorkspaceState = exports.getNpmScope = exports.sortPackageJsonFields = exports.CopyAssetsHandler = exports.addSwcRegisterDependencies = exports.addSwcDependencies = exports.addSwcTestConfig = exports.addSwcConfig = exports.createTmpTsConfig = exports.computeCompilerOptionsPaths = exports.calculateProjectDependencies = exports.calculateProjectBuildableDependencies = exports.compileTypeScript = exports.getNeededCompilerOptionOverrides = exports.isTypescriptVersionAtLeast = exports.getTsConfigModuleResolution = exports.getRangeMinimum = exports.ensureTypescript = exports.createTreeParseConfigHost = exports.getTsConfigBaseOptions = exports.updateTsconfigFiles = exports.shouldConfigureTsSolutionSetup = exports.isUsingTsSolutionSetup = exports.getProjectType = exports.getProjectSourceRoot = exports.getDefinedCustomConditionName = exports.findRuntimeTsConfigName = exports.assertNotUsingTsSolutionSetup = exports.addProjectToTsSolutionWorkspace = exports.TS_SOLUTION_SETUP_TSCONFIG_INPUT = exports.isEsmProject = exports.walkTsconfigExtendsChain = exports.findProjectsNpmDependencies = exports.isBuiltinModuleImport = exports.TargetProjectLocator = exports.requireWithTsconfigFallback = exports.registerTsConfigPaths = exports.registerTsProject = exports.loadTsFile = exports.forceRegisterEsmLoader = void 0;
|
|
9
9
|
exports.typesNodeVersion = exports.tsLibVersion = exports.swcNodeVersion = exports.swcHelpersVersion = exports.swcCoreVersion = exports.swcCliVersion = exports.prettierVersion = exports.esbuildVersion = exports.nxVersion = exports.releaseTasks = exports.addReleaseConfigForTsSolution = exports.addReleaseConfigForNonTsSolution = void 0;
|
|
10
|
-
// Re-exports of nx-source internals
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, "
|
|
14
|
-
Object.defineProperty(exports, "
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Object.defineProperty(exports, "
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
23
|
-
var create_package_json_1 = require("nx/src/plugins/js/package-json/create-package-json");
|
|
24
|
-
Object.defineProperty(exports, "findProjectsNpmDependencies", { enumerable: true, get: function () { return create_package_json_1.findProjectsNpmDependencies; } });
|
|
10
|
+
// Re-exports of nx-source internals.
|
|
11
|
+
var internal_1 = require("@nx/devkit/internal");
|
|
12
|
+
Object.defineProperty(exports, "forceRegisterEsmLoader", { enumerable: true, get: function () { return internal_1.forceRegisterEsmLoader; } });
|
|
13
|
+
Object.defineProperty(exports, "loadTsFile", { enumerable: true, get: function () { return internal_1.loadTsFile; } });
|
|
14
|
+
Object.defineProperty(exports, "registerTsProject", { enumerable: true, get: function () { return internal_1.registerTsProject; } });
|
|
15
|
+
Object.defineProperty(exports, "registerTsConfigPaths", { enumerable: true, get: function () { return internal_1.registerTsConfigPaths; } });
|
|
16
|
+
Object.defineProperty(exports, "requireWithTsconfigFallback", { enumerable: true, get: function () { return internal_1.requireWithTsconfigFallback; } });
|
|
17
|
+
var internal_2 = require("@nx/devkit/internal");
|
|
18
|
+
Object.defineProperty(exports, "TargetProjectLocator", { enumerable: true, get: function () { return internal_2.TargetProjectLocator; } });
|
|
19
|
+
Object.defineProperty(exports, "isBuiltinModuleImport", { enumerable: true, get: function () { return internal_2.isBuiltinModuleImport; } });
|
|
20
|
+
var internal_3 = require("@nx/devkit/internal");
|
|
21
|
+
Object.defineProperty(exports, "findProjectsNpmDependencies", { enumerable: true, get: function () { return internal_3.findProjectsNpmDependencies; } });
|
|
25
22
|
// Raw tsconfig walkers (the other AST utils ship via the public @nx/js entry)
|
|
26
23
|
var raw_tsconfig_1 = require("./src/utils/typescript/raw-tsconfig");
|
|
27
24
|
Object.defineProperty(exports, "walkTsconfigExtendsChain", { enumerable: true, get: function () { return raw_tsconfig_1.walkTsconfigExtendsChain; } });
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = copyWorkspaceModules;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const node_fs_1 = require("node:fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
|
-
|
|
10
|
-
const get_workspace_packages_from_graph_1 = require("nx/src/plugins/js/utils/get-workspace-packages-from-graph");
|
|
9
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
11
10
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
12
11
|
async function copyWorkspaceModules(schema, context) {
|
|
13
12
|
devkit_1.logger.log('Copying Workspace Modules to Build Directory...');
|
|
@@ -22,7 +21,7 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
22
21
|
if (!packageJson.dependencies) {
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
|
-
const workspaceModules = (0,
|
|
24
|
+
const workspaceModules = (0, internal_2.getWorkspacePackagesFromGraph)(projectGraph);
|
|
26
25
|
const processedModules = new Set();
|
|
27
26
|
const workspaceModulesDir = (0, path_1.join)(outputDirectory, 'workspace_modules');
|
|
28
27
|
function calculateRelativePath(fromPkgName, toPkgName) {
|
|
@@ -43,7 +42,7 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
43
42
|
processedModules.add(pkgName);
|
|
44
43
|
devkit_1.logger.verbose(`Copying ${pkgName}.`);
|
|
45
44
|
const workspaceModuleProject = workspaceModules.get(pkgName);
|
|
46
|
-
const workspaceModuleRoot = workspaceModuleProject.data.root;
|
|
45
|
+
const workspaceModuleRoot = (0, path_1.join)(devkit_1.workspaceRoot, workspaceModuleProject.data.root);
|
|
47
46
|
const newWorkspaceModulePath = (0, path_1.join)(workspaceModulesDir, pkgName);
|
|
48
47
|
// Copy the module
|
|
49
48
|
(0, node_fs_1.mkdirSync)(newWorkspaceModulePath, { recursive: true });
|
|
@@ -114,7 +113,7 @@ function getOutputDir(schema, context) {
|
|
|
114
113
|
if (!maybeOutputPath) {
|
|
115
114
|
throw new Error(`Could not infer an output directory from the '${schema.buildTarget}' target. Please provide 'outputPath'.`);
|
|
116
115
|
}
|
|
117
|
-
maybeOutputPath = (0,
|
|
116
|
+
maybeOutputPath = (0, internal_1.interpolate)(maybeOutputPath, {
|
|
118
117
|
workspaceRoot: devkit_1.workspaceRoot,
|
|
119
118
|
projectRoot: project.root,
|
|
120
119
|
projectName: project.name,
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOutputFileName = getOutputFileName;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
-
const path_2 = require("nx/src/utils/path");
|
|
6
5
|
const get_main_file_dir_1 = require("../../../utils/get-main-file-dir");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
function getOutputFileName({ buildTargetExecutor, main, outputPath, rootDir, }) {
|
|
8
8
|
const fileName = `${(0, path_1.parse)(main).name}.js`;
|
|
9
9
|
if (buildTargetExecutor !== '@nx/js:tsc' &&
|
|
10
10
|
buildTargetExecutor !== '@nx/js:swc') {
|
|
11
11
|
return fileName;
|
|
12
12
|
}
|
|
13
|
-
const mainDirectory = (0,
|
|
14
|
-
const normalizedOutputPath = (0,
|
|
13
|
+
const mainDirectory = (0, devkit_1.normalizePath)((0, path_1.dirname)(main));
|
|
14
|
+
const normalizedOutputPath = (0, devkit_1.normalizePath)(outputPath);
|
|
15
15
|
const isMainInsideOutputPath = mainDirectory === normalizedOutputPath ||
|
|
16
16
|
mainDirectory.startsWith(`${normalizedOutputPath}/`);
|
|
17
17
|
const base = isMainInsideOutputPath ? normalizedOutputPath : rootDir;
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, devkit_1.joinPathFragments)((0, get_main_file_dir_1.getRelativeDirectoryToProjectRoot)(main, base), fileName);
|
|
19
19
|
}
|
|
@@ -6,16 +6,16 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
6
6
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const
|
|
9
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
10
10
|
const crypto_1 = require("crypto");
|
|
11
11
|
const path = tslib_1.__importStar(require("path"));
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const buildable_libs_utils_1 = require("../../utils/buildable-libs-utils");
|
|
14
|
-
const
|
|
14
|
+
const internal_3 = require("@nx/devkit/internal");
|
|
15
15
|
const line_aware_writer_1 = require("./lib/line-aware-writer");
|
|
16
16
|
const coalescing_debounce_1 = require("./lib/coalescing-debounce");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const internal_4 = require("@nx/devkit/internal");
|
|
18
|
+
const internal_5 = require("@nx/devkit/internal");
|
|
19
19
|
const detect_module_format_1 = require("./lib/detect-module-format");
|
|
20
20
|
const output_file_1 = require("./lib/output-file");
|
|
21
21
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
@@ -175,7 +175,7 @@ async function* nodeExecutor(options, context) {
|
|
|
175
175
|
// Windows cannot deliver graceful signals through this API, so
|
|
176
176
|
// skip the grace period and force-kill immediately (matching the
|
|
177
177
|
// previous taskkill /F behavior).
|
|
178
|
-
await (0,
|
|
178
|
+
await (0, internal_3.killProcessTreeGraceful)(task.childProcess.pid, signal, process.platform === 'win32' ? 0 : undefined);
|
|
179
179
|
}
|
|
180
180
|
if (task.id === globalLineAwareWriter.currentProcessId) {
|
|
181
181
|
globalLineAwareWriter.setActiveProcess(null);
|
|
@@ -237,7 +237,7 @@ async function* nodeExecutor(options, context) {
|
|
|
237
237
|
await debouncedProcessQueue.trigger();
|
|
238
238
|
};
|
|
239
239
|
if ((0, devkit_1.isDaemonEnabled)()) {
|
|
240
|
-
additionalExitHandler = await
|
|
240
|
+
additionalExitHandler = await internal_2.daemonClient.registerFileWatcher({
|
|
241
241
|
watchProjects: [context.projectName],
|
|
242
242
|
includeDependencies: true,
|
|
243
243
|
}, async (err, data) => {
|
|
@@ -337,7 +337,7 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
337
337
|
// {workspaceRoot}/dist/{projectRoot} -> dist/my-app
|
|
338
338
|
const outputPath = project.data.targets[buildOptions.target]?.outputs?.[0];
|
|
339
339
|
if (outputPath) {
|
|
340
|
-
const outputFilePath = (0,
|
|
340
|
+
const outputFilePath = (0, internal_5.interpolate)(outputPath, {
|
|
341
341
|
projectName: project.name,
|
|
342
342
|
projectRoot: project.data.root,
|
|
343
343
|
workspaceRoot: context.root,
|
|
@@ -366,12 +366,12 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
366
366
|
return (0, path_1.join)(context.root, buildOptions.outputPath, outputFileName);
|
|
367
367
|
}
|
|
368
368
|
function fileToRunCorrectPath(fileToRun) {
|
|
369
|
-
if ((0,
|
|
369
|
+
if ((0, internal_4.fileExists)(fileToRun))
|
|
370
370
|
return fileToRun;
|
|
371
371
|
const extensionsToTry = ['.cjs', '.mjs', '.cjs.js', '.esm.js'];
|
|
372
372
|
for (const ext of extensionsToTry) {
|
|
373
373
|
const file = fileToRun.replace(/\.js$/, ext);
|
|
374
|
-
if ((0,
|
|
374
|
+
if ((0, internal_4.fileExists)(file))
|
|
375
375
|
return file;
|
|
376
376
|
}
|
|
377
377
|
throw new Error(`Could not find ${fileToRun}. Make sure your build succeeded.`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import { type PackageJson } from 'nx/
|
|
2
|
+
import { type PackageJson } from '@nx/devkit/internal';
|
|
3
3
|
import { type PruneLockfileOptions } from './schema';
|
|
4
4
|
export default function pruneLockfileExecutor(schema: PruneLockfileOptions, context: ExecutorContext): Promise<{
|
|
5
5
|
success: boolean;
|
|
@@ -6,11 +6,9 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
13
|
-
const get_workspace_packages_from_graph_1 = require("nx/src/plugins/js/utils/get-workspace-packages-from-graph");
|
|
9
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
10
|
+
const internal_3 = require("@nx/devkit/internal");
|
|
11
|
+
const internal_4 = require("@nx/devkit/internal");
|
|
14
12
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
15
13
|
async function pruneLockfileExecutor(schema, context) {
|
|
16
14
|
devkit_1.logger.log('Pruning lockfile...');
|
|
@@ -35,9 +33,9 @@ async function pruneLockfileExecutor(schema, context) {
|
|
|
35
33
|
}
|
|
36
34
|
function createPrunedLockfile(packageJson, graph) {
|
|
37
35
|
const packageManager = (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot);
|
|
38
|
-
const lockfileName = (0,
|
|
39
|
-
const lockFile = (0,
|
|
40
|
-
const workspacePackages = (0,
|
|
36
|
+
const lockfileName = (0, internal_3.getLockFileName)(packageManager);
|
|
37
|
+
const lockFile = (0, internal_3.createLockFile)(packageJson, graph, packageManager);
|
|
38
|
+
const workspacePackages = (0, internal_4.getWorkspacePackagesFromGraph)(graph);
|
|
41
39
|
for (const [pkgName, pkgVersion] of Object.entries(packageJson.dependencies ?? {})) {
|
|
42
40
|
if (pkgVersion.startsWith('workspace:') ||
|
|
43
41
|
pkgVersion.startsWith('file:') ||
|
|
@@ -127,7 +125,7 @@ function getOutputDir(schema, context) {
|
|
|
127
125
|
if (!maybeOutputPath) {
|
|
128
126
|
throw new Error(`Could not infer an output directory from the '${schema.buildTarget}' target. Please provide 'outputPath'.`);
|
|
129
127
|
}
|
|
130
|
-
maybeOutputPath = (0,
|
|
128
|
+
maybeOutputPath = (0, internal_2.interpolate)(maybeOutputPath, {
|
|
131
129
|
workspaceRoot: devkit_1.workspaceRoot,
|
|
132
130
|
projectRoot: project.root,
|
|
133
131
|
projectName: project.name,
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.watchTaskProjectsPackageJsonFileChanges = watchTaskProjectsPackageJsonFileChanges;
|
|
4
4
|
exports.watchTaskProjectsFileChangesForAssets = watchTaskProjectsFileChangesForAssets;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const client_1 = require("nx/src/daemon/client/client");
|
|
7
6
|
const path_1 = require("path");
|
|
7
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
8
8
|
async function watchTaskProjectsPackageJsonFileChanges(taskInfos, callback) {
|
|
9
9
|
const projects = [];
|
|
10
10
|
const packageJsonTaskInfoMap = new Map();
|
|
@@ -12,7 +12,7 @@ async function watchTaskProjectsPackageJsonFileChanges(taskInfos, callback) {
|
|
|
12
12
|
projects.push(t.context.projectName);
|
|
13
13
|
packageJsonTaskInfoMap.set((0, path_1.join)(t.options.projectRoot, 'package.json'), t);
|
|
14
14
|
});
|
|
15
|
-
const unregisterFileWatcher = await
|
|
15
|
+
const unregisterFileWatcher = await internal_1.daemonClient.registerFileWatcher({ watchProjects: projects }, (err, data) => {
|
|
16
16
|
if (err === 'reconnecting') {
|
|
17
17
|
// Silent - daemon restarts automatically on lockfile changes
|
|
18
18
|
return;
|
|
@@ -43,7 +43,7 @@ async function watchTaskProjectsPackageJsonFileChanges(taskInfos, callback) {
|
|
|
43
43
|
return () => unregisterFileWatcher();
|
|
44
44
|
}
|
|
45
45
|
async function watchTaskProjectsFileChangesForAssets(taskInfos) {
|
|
46
|
-
const unregisterFileWatcher = await
|
|
46
|
+
const unregisterFileWatcher = await internal_1.daemonClient.registerFileWatcher({
|
|
47
47
|
watchProjects: taskInfos.map((t) => t.context.projectName),
|
|
48
48
|
includeDependencies: true,
|
|
49
49
|
includeGlobalWorkspaceFiles: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecutorContext, TaskGraph } from '@nx/devkit';
|
|
2
|
-
import type { BatchExecutorTaskResult } from 'nx/src/config/misc-interfaces';
|
|
3
2
|
import type { ExecutorOptions } from '../../utils/schema';
|
|
3
|
+
import { type BatchExecutorTaskResult } from '@nx/devkit/internal';
|
|
4
4
|
export declare function tscBatchExecutor(taskGraph: TaskGraph, inputs: Record<string, ExecutorOptions>, overrides: ExecutorOptions, context: ExecutorContext): AsyncGenerator<BatchExecutorTaskResult, any, unknown>;
|
|
5
5
|
export default tscBatchExecutor;
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tscBatchExecutor = tscBatchExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
-
const async_iterator_1 = require("nx/src/utils/async-iterator");
|
|
7
6
|
const update_package_json_1 = require("../../utils/package-json/update-package-json");
|
|
8
7
|
const tsc_impl_1 = require("./tsc.impl");
|
|
9
8
|
const lib_1 = require("./lib");
|
|
10
9
|
const batch_1 = require("./lib/batch");
|
|
11
10
|
const create_entry_points_1 = require("../../utils/package-json/create-entry-points");
|
|
11
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
12
12
|
async function* tscBatchExecutor(taskGraph, inputs, overrides, context) {
|
|
13
13
|
const tasksOptions = (0, batch_1.normalizeTasksOptions)(inputs, context);
|
|
14
14
|
let shouldWatch = false;
|
|
@@ -89,7 +89,7 @@ async function* tscBatchExecutor(taskGraph, inputs, overrides, context) {
|
|
|
89
89
|
process.on('SIGTERM', () => handleTermination(128 + 15));
|
|
90
90
|
return yield* mapAsyncIterable(typescriptCompilation, async (iterator) => {
|
|
91
91
|
// drain the iterator, we don't use the results
|
|
92
|
-
await (0,
|
|
92
|
+
await (0, internal_1.getLastValueFromAsyncIterableIterator)(iterator);
|
|
93
93
|
return { value: undefined, done: true };
|
|
94
94
|
});
|
|
95
95
|
}
|
|
@@ -7,7 +7,7 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
|
|
9
9
|
const node_fs_1 = require("node:fs");
|
|
10
|
-
const
|
|
10
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
11
11
|
const path_1 = require("path");
|
|
12
12
|
const semver_1 = require("semver");
|
|
13
13
|
let childProcess;
|
|
@@ -68,7 +68,7 @@ async function verdaccioExecutor(options, context) {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
function getVerdaccioBinPath() {
|
|
71
|
-
const { packageJson, path: packageJsonPath } = (0,
|
|
71
|
+
const { packageJson, path: packageJsonPath } = (0, internal_2.readModulePackageJson)('verdaccio');
|
|
72
72
|
const bin = typeof packageJson.bin === 'string'
|
|
73
73
|
? packageJson.bin
|
|
74
74
|
: packageJson.bin['verdaccio'];
|
|
@@ -5,8 +5,8 @@ exports.addReleaseConfigForNonTsSolution = addReleaseConfigForNonTsSolution;
|
|
|
5
5
|
exports.releaseTasks = releaseTasks;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
|
|
9
8
|
const generator_1 = tslib_1.__importDefault(require("../../setup-verdaccio/generator"));
|
|
9
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
10
10
|
/**
|
|
11
11
|
* Adds release option in nx.json to build the project before versioning
|
|
12
12
|
*/
|
|
@@ -122,7 +122,7 @@ function projectsConfigMatchesProject(projectsConfig, project) {
|
|
|
122
122
|
const graph = {
|
|
123
123
|
[project.name]: project,
|
|
124
124
|
};
|
|
125
|
-
const matchingProjects = (0,
|
|
125
|
+
const matchingProjects = (0, internal_1.findMatchingProjects)(projectsConfig, graph);
|
|
126
126
|
return matchingProjects.includes(project.name);
|
|
127
127
|
}
|
|
128
128
|
async function releaseTasks(tree) {
|
|
@@ -4,7 +4,6 @@ exports.setupBuildGenerator = setupBuildGenerator;
|
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const posix_1 = require("node:path/posix");
|
|
7
|
-
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
8
7
|
const assert_supported_typescript_version_1 = require("../../utils/assert-supported-typescript-version");
|
|
9
8
|
const get_import_path_1 = require("../../utils/get-import-path");
|
|
10
9
|
const update_package_json_1 = require("../../utils/package-json/update-package-json");
|
|
@@ -245,5 +244,5 @@ function updatePackageJson(tree, projectName, projectRoot, main, outputPath, roo
|
|
|
245
244
|
function mergeTargetDefaults(tree, project, buildTarget) {
|
|
246
245
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
247
246
|
const projectTarget = project.targets[buildTarget];
|
|
248
|
-
return (0,
|
|
247
|
+
return (0, internal_1.mergeTargetConfigurations)(projectTarget, (0, internal_1.readTargetDefaultsForTarget)(buildTarget, nxJson.targetDefaults, projectTarget.executor));
|
|
249
248
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
|
-
import { type SyncGeneratorResult } from 'nx/
|
|
2
|
+
import { type SyncGeneratorResult } from '@nx/devkit/internal';
|
|
3
3
|
export declare function syncGenerator(tree: Tree): Promise<SyncGeneratorResult>;
|
|
4
4
|
export default syncGenerator;
|
|
@@ -6,9 +6,9 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const ignore_1 = tslib_1.__importDefault(require("ignore"));
|
|
7
7
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
8
8
|
const posix_1 = require("node:path/posix");
|
|
9
|
-
const sync_generators_1 = require("nx/src/utils/sync-generators");
|
|
10
9
|
const ts = tslib_1.__importStar(require("typescript"));
|
|
11
10
|
const assert_supported_typescript_version_1 = require("../../utils/assert-supported-typescript-version");
|
|
11
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
12
12
|
const COMMON_RUNTIME_TS_CONFIG_FILE_NAMES = [
|
|
13
13
|
'tsconfig.app.json',
|
|
14
14
|
'tsconfig.lib.json',
|
|
@@ -29,7 +29,7 @@ async function syncGenerator(tree) {
|
|
|
29
29
|
// Root tsconfig containing project references for the whole workspace
|
|
30
30
|
const rootTsconfigPath = 'tsconfig.json';
|
|
31
31
|
if (!tsconfigExists(tree, tsconfigInfoCaches, rootTsconfigPath)) {
|
|
32
|
-
throw new
|
|
32
|
+
throw new internal_1.SyncError('Missing root "tsconfig.json"', [
|
|
33
33
|
`A "tsconfig.json" file must exist in the workspace root in order to sync the project graph information to the TypeScript configuration files.`,
|
|
34
34
|
]);
|
|
35
35
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export { initGenerator } from './generators/init/init';
|
|
|
16
16
|
export { setupPrettierGenerator } from './generators/setup-prettier/generator';
|
|
17
17
|
export { setupVerdaccio } from './generators/setup-verdaccio/generator';
|
|
18
18
|
export { isValidVariable } from './utils/is-valid-variable';
|
|
19
|
-
export { createLockFile, getLockFileName
|
|
20
|
-
export { createPackageJson } from 'nx/
|
|
19
|
+
export { createLockFile, getLockFileName } from '@nx/devkit/internal';
|
|
20
|
+
export { createPackageJson } from '@nx/devkit/internal';
|
package/dist/src/index.js
CHANGED
|
@@ -25,10 +25,8 @@ var generator_2 = require("./generators/setup-verdaccio/generator");
|
|
|
25
25
|
Object.defineProperty(exports, "setupVerdaccio", { enumerable: true, get: function () { return generator_2.setupVerdaccio; } });
|
|
26
26
|
var is_valid_variable_1 = require("./utils/is-valid-variable");
|
|
27
27
|
Object.defineProperty(exports, "isValidVariable", { enumerable: true, get: function () { return is_valid_variable_1.isValidVariable; } });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var create_package_json_1 = require("nx/src/plugins/js/package-json/create-package-json");
|
|
34
|
-
Object.defineProperty(exports, "createPackageJson", { enumerable: true, get: function () { return create_package_json_1.createPackageJson; } });
|
|
28
|
+
var internal_1 = require("@nx/devkit/internal");
|
|
29
|
+
Object.defineProperty(exports, "createLockFile", { enumerable: true, get: function () { return internal_1.createLockFile; } });
|
|
30
|
+
Object.defineProperty(exports, "getLockFileName", { enumerable: true, get: function () { return internal_1.getLockFileName; } });
|
|
31
|
+
var internal_2 = require("@nx/devkit/internal");
|
|
32
|
+
Object.defineProperty(exports, "createPackageJson", { enumerable: true, get: function () { return internal_2.createPackageJson; } });
|
|
@@ -5,12 +5,12 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const node_fs_1 = require("node:fs");
|
|
7
7
|
const node_path_1 = require("node:path");
|
|
8
|
-
const
|
|
8
|
+
const devkit_2 = require("@nx/devkit");
|
|
9
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
9
10
|
const picomatch = require("picomatch");
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const installation_directory_1 = require("nx/src/utils/installation-directory");
|
|
11
|
+
const internal_3 = require("@nx/devkit/internal");
|
|
12
|
+
const internal_4 = require("@nx/devkit/internal");
|
|
13
|
+
const internal_5 = require("@nx/devkit/internal");
|
|
14
14
|
const util_1 = require("./util");
|
|
15
15
|
let ts;
|
|
16
16
|
const resolvedTypescriptPaths = {};
|
|
@@ -20,12 +20,12 @@ function resolveTypescriptPath(projectRoot, workspaceRoot) {
|
|
|
20
20
|
// path is outside the workspace tree (e.g. pnpm's enableGlobalVirtualStore),
|
|
21
21
|
// since typescript is not a declared dep.
|
|
22
22
|
resolvedTypescriptPaths[projectRoot] ??= require.resolve('typescript', {
|
|
23
|
-
paths: [projectRoot, ...(0,
|
|
23
|
+
paths: [projectRoot, ...(0, internal_5.getNxRequirePaths)(workspaceRoot), __dirname],
|
|
24
24
|
});
|
|
25
25
|
return resolvedTypescriptPaths[projectRoot];
|
|
26
26
|
}
|
|
27
27
|
const TSCONFIG_CACHE_VERSION = 2;
|
|
28
|
-
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(
|
|
28
|
+
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(internal_4.workspaceDataDirectory, 'tsconfig-files.hash');
|
|
29
29
|
// Module-level cache store — each invocation gets a unique Symbol key
|
|
30
30
|
const cacheStore = new Map();
|
|
31
31
|
// Shared tsconfig cache — initialized once per batch, persisted to disk
|
|
@@ -117,8 +117,8 @@ const tsConfigGlob = '**/tsconfig*.json';
|
|
|
117
117
|
exports.createNodesV2 = [
|
|
118
118
|
tsConfigGlob,
|
|
119
119
|
async (configFilePaths, options, context) => {
|
|
120
|
-
const optionsHash = (0,
|
|
121
|
-
const targetsCachePath = (0, node_path_1.join)(
|
|
120
|
+
const optionsHash = (0, internal_2.hashObject)(options);
|
|
121
|
+
const targetsCachePath = (0, node_path_1.join)(internal_4.workspaceDataDirectory, `tsc-${optionsHash}.hash`);
|
|
122
122
|
const targetsCache = readFromCache(targetsCachePath);
|
|
123
123
|
// Each invocation gets a unique Symbol key — guaranteed no collisions
|
|
124
124
|
const cacheKey = Symbol('tsc-invocation');
|
|
@@ -136,7 +136,7 @@ exports.createNodesV2 = [
|
|
|
136
136
|
const normalizedOptions = normalizePluginOptions(options);
|
|
137
137
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
138
138
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
139
|
-
const lockFileName = (0,
|
|
139
|
+
const lockFileName = (0, internal_3.getLockFileName)(packageManager);
|
|
140
140
|
const { configFilePaths: validConfigFilePaths, hashes, projectRoots, } = await resolveValidConfigFilesAndHashes(configFilePaths, normalizedOptions, optionsHash, context, cache, lockFileName);
|
|
141
141
|
try {
|
|
142
142
|
return await (0, devkit_1.createNodesFromFiles)((configFilePath, options, context, idx) => {
|
|
@@ -171,7 +171,7 @@ exports.createNodesV2 = [
|
|
|
171
171
|
];
|
|
172
172
|
exports.createNodes = exports.createNodesV2;
|
|
173
173
|
async function resolveValidConfigFilesAndHashes(configFilePaths, options, optionsHash, context, cache, lockFileName) {
|
|
174
|
-
const lockFileHash = (0,
|
|
174
|
+
const lockFileHash = (0, internal_2.hashFile)((0, node_path_1.join)(context.workspaceRoot, lockFileName)) ?? '';
|
|
175
175
|
const validConfigFilePaths = [];
|
|
176
176
|
const hashes = [];
|
|
177
177
|
const projectRoots = [];
|
|
@@ -218,7 +218,7 @@ async function getConfigFileHash(configFilePath, workspaceRoot, project, options
|
|
|
218
218
|
packageJson = (0, devkit_1.readJsonFile)((0, node_path_1.join)(workspaceRoot, project.root, 'package.json'));
|
|
219
219
|
}
|
|
220
220
|
catch { }
|
|
221
|
-
return (0,
|
|
221
|
+
return (0, devkit_2.hashArray)([
|
|
222
222
|
...[
|
|
223
223
|
fullConfigPath,
|
|
224
224
|
...extendedConfigFiles.files.sort(),
|
|
@@ -228,7 +228,7 @@ async function getConfigFileHash(configFilePath, workspaceRoot, project, options
|
|
|
228
228
|
...extendedConfigFiles.packages.sort(),
|
|
229
229
|
lockFileHash,
|
|
230
230
|
optionsHash,
|
|
231
|
-
...(packageJson ? [(0,
|
|
231
|
+
...(packageJson ? [(0, internal_2.hashObject)(packageJson)] : []),
|
|
232
232
|
]);
|
|
233
233
|
}
|
|
234
234
|
function checkIfConfigFileShouldBeProject(config, cache) {
|
|
@@ -956,7 +956,7 @@ function getFileHash(filePath, workspaceRoot, cache) {
|
|
|
956
956
|
const relativePath = posixRelative(workspaceRoot, filePath);
|
|
957
957
|
if (!cache.fileHashes[relativePath]) {
|
|
958
958
|
const content = readFile(filePath, workspaceRoot, cache);
|
|
959
|
-
cache.fileHashes[relativePath] = (0,
|
|
959
|
+
cache.fileHashes[relativePath] = (0, devkit_2.hashArray)([content]);
|
|
960
960
|
}
|
|
961
961
|
return cache.fileHashes[relativePath];
|
|
962
962
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TargetConfiguration } from '@nx/devkit';
|
|
2
|
-
import { type PackageManagerCommands } from 'nx/src/utils/package-manager';
|
|
3
2
|
import { type ParsedCommandLine } from 'typescript';
|
|
3
|
+
import { type PackageManagerCommands } from '@nx/devkit/internal';
|
|
4
4
|
export type ExtendedConfigFile = {
|
|
5
5
|
filePath: string;
|
|
6
6
|
externalPackage?: string;
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateLockFile = updateLockFile;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
9
8
|
const semver_1 = require("semver");
|
|
10
9
|
async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
11
10
|
if (options?.skipLockFileUpdate) {
|
|
@@ -30,10 +29,10 @@ async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
|
30
29
|
}
|
|
31
30
|
return [];
|
|
32
31
|
}
|
|
33
|
-
const isDaemonEnabled =
|
|
32
|
+
const isDaemonEnabled = internal_1.daemonClient.enabled();
|
|
34
33
|
if (!dryRun && isDaemonEnabled) {
|
|
35
34
|
// if not in dry-run temporarily stop the daemon, as it will error if the lock file is updated
|
|
36
|
-
await
|
|
35
|
+
await internal_1.daemonClient.stop();
|
|
37
36
|
}
|
|
38
37
|
const packageManagerCommands = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
39
38
|
let installArgs = options?.installArgs || '';
|
|
@@ -48,7 +47,7 @@ async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
|
48
47
|
installArgs = `${installArgs} --ignore-scripts`.trim();
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
const lockFile = (0,
|
|
50
|
+
const lockFile = (0, internal_2.getLockFileName)(packageManager);
|
|
52
51
|
const command = `${packageManagerCommands.updateLockFile} ${installArgs}`.trim();
|
|
53
52
|
if (verbose) {
|
|
54
53
|
if (dryRun) {
|
|
@@ -65,7 +64,7 @@ async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
|
65
64
|
execLockFileUpdate(command, cwd, env);
|
|
66
65
|
if (isDaemonEnabled) {
|
|
67
66
|
try {
|
|
68
|
-
await
|
|
67
|
+
await internal_1.daemonClient.startInBackground();
|
|
69
68
|
}
|
|
70
69
|
catch (e) {
|
|
71
70
|
// If the daemon fails to start, we don't want to prevent the user from continuing, so we just log the error and move on
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ProjectGraph, Tree } from '@nx/devkit';
|
|
2
|
-
import {
|
|
3
|
-
import type { NxReleaseVersionConfiguration } from 'nx/
|
|
2
|
+
import { VersionActions } from 'nx/release';
|
|
3
|
+
import type { AfterAllProjectsVersioned, NxReleaseVersionConfiguration } from '@nx/devkit/internal';
|
|
4
4
|
export declare const afterAllProjectsVersioned: AfterAllProjectsVersioned;
|
|
5
5
|
export default class JsVersionActions extends VersionActions {
|
|
6
6
|
validManifestFilenames: string[];
|
|
7
|
+
excludeManifestsFromFormatting: boolean;
|
|
7
8
|
readCurrentVersionFromSourceManifest(tree: Tree): Promise<{
|
|
8
9
|
currentVersion: string;
|
|
9
10
|
manifestPath: string;
|
|
@@ -18,5 +19,9 @@ export default class JsVersionActions extends VersionActions {
|
|
|
18
19
|
}>;
|
|
19
20
|
updateProjectVersion(tree: Tree, newVersion: string): Promise<string[]>;
|
|
20
21
|
updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string>): Promise<string[]>;
|
|
22
|
+
private updateManifestValues;
|
|
23
|
+
private readAndValidateManifest;
|
|
24
|
+
private validateManifestUpdates;
|
|
25
|
+
private detectFormattingOptions;
|
|
21
26
|
private isLocalDependencyProtocol;
|
|
22
27
|
}
|