@nx/js 23.1.1 → 23.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +12 -15
- package/dist/src/executors/copy-workspace-modules/copy-workspace-modules.js +4 -6
- package/dist/src/executors/node/lib/output-file.js +4 -4
- package/dist/src/executors/node/node.impl.js +9 -10
- package/dist/src/executors/prune-lockfile/prune-lockfile.d.ts +1 -1
- package/dist/src/executors/prune-lockfile/prune-lockfile.js +4 -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 +1 -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 +9 -14
- package/dist/src/plugins/typescript/util.d.ts +1 -1
- package/dist/src/release/utils/update-lock-file.js +5 -7
- package/dist/src/release/version-actions.d.ts +12 -3
- package/dist/src/release/version-actions.js +232 -74
- 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 +6 -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,10 @@
|
|
|
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
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
10
|
-
const get_workspace_packages_from_graph_1 = require("nx/src/plugins/js/utils/get-workspace-packages-from-graph");
|
|
11
9
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
12
10
|
async function copyWorkspaceModules(schema, context) {
|
|
13
11
|
devkit_1.logger.log('Copying Workspace Modules to Build Directory...');
|
|
@@ -22,7 +20,7 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
22
20
|
if (!packageJson.dependencies) {
|
|
23
21
|
return;
|
|
24
22
|
}
|
|
25
|
-
const workspaceModules = (0,
|
|
23
|
+
const workspaceModules = (0, internal_1.getWorkspacePackagesFromGraph)(projectGraph);
|
|
26
24
|
const processedModules = new Set();
|
|
27
25
|
const workspaceModulesDir = (0, path_1.join)(outputDirectory, 'workspace_modules');
|
|
28
26
|
function calculateRelativePath(fromPkgName, toPkgName) {
|
|
@@ -43,7 +41,7 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
43
41
|
processedModules.add(pkgName);
|
|
44
42
|
devkit_1.logger.verbose(`Copying ${pkgName}.`);
|
|
45
43
|
const workspaceModuleProject = workspaceModules.get(pkgName);
|
|
46
|
-
const workspaceModuleRoot = workspaceModuleProject.data.root;
|
|
44
|
+
const workspaceModuleRoot = (0, path_1.join)(devkit_1.workspaceRoot, workspaceModuleProject.data.root);
|
|
47
45
|
const newWorkspaceModulePath = (0, path_1.join)(workspaceModulesDir, pkgName);
|
|
48
46
|
// Copy the module
|
|
49
47
|
(0, node_fs_1.mkdirSync)(newWorkspaceModulePath, { recursive: true });
|
|
@@ -114,7 +112,7 @@ function getOutputDir(schema, context) {
|
|
|
114
112
|
if (!maybeOutputPath) {
|
|
115
113
|
throw new Error(`Could not infer an output directory from the '${schema.buildTarget}' target. Please provide 'outputPath'.`);
|
|
116
114
|
}
|
|
117
|
-
maybeOutputPath = (0,
|
|
115
|
+
maybeOutputPath = (0, internal_1.interpolate)(maybeOutputPath, {
|
|
118
116
|
workspaceRoot: devkit_1.workspaceRoot,
|
|
119
117
|
projectRoot: project.root,
|
|
120
118
|
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,12 @@ 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 client_1 = require("nx/src/daemon/client/client");
|
|
10
9
|
const crypto_1 = require("crypto");
|
|
11
10
|
const path = tslib_1.__importStar(require("path"));
|
|
12
11
|
const path_1 = require("path");
|
|
13
12
|
const buildable_libs_utils_1 = require("../../utils/buildable-libs-utils");
|
|
14
|
-
const native_1 = require("nx/src/native");
|
|
15
13
|
const line_aware_writer_1 = require("./lib/line-aware-writer");
|
|
16
14
|
const coalescing_debounce_1 = require("./lib/coalescing-debounce");
|
|
17
|
-
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
18
|
-
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
19
15
|
const detect_module_format_1 = require("./lib/detect-module-format");
|
|
20
16
|
const output_file_1 = require("./lib/output-file");
|
|
21
17
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
@@ -175,7 +171,7 @@ async function* nodeExecutor(options, context) {
|
|
|
175
171
|
// Windows cannot deliver graceful signals through this API, so
|
|
176
172
|
// skip the grace period and force-kill immediately (matching the
|
|
177
173
|
// previous taskkill /F behavior).
|
|
178
|
-
await (0,
|
|
174
|
+
await (0, internal_1.killProcessTreeGraceful)(task.childProcess.pid, signal, process.platform === 'win32' ? 0 : undefined);
|
|
179
175
|
}
|
|
180
176
|
if (task.id === globalLineAwareWriter.currentProcessId) {
|
|
181
177
|
globalLineAwareWriter.setActiveProcess(null);
|
|
@@ -237,7 +233,7 @@ async function* nodeExecutor(options, context) {
|
|
|
237
233
|
await debouncedProcessQueue.trigger();
|
|
238
234
|
};
|
|
239
235
|
if ((0, devkit_1.isDaemonEnabled)()) {
|
|
240
|
-
additionalExitHandler = await
|
|
236
|
+
additionalExitHandler = await internal_1.daemonClient.registerFileWatcher({
|
|
241
237
|
watchProjects: [context.projectName],
|
|
242
238
|
includeDependencies: true,
|
|
243
239
|
}, async (err, data) => {
|
|
@@ -279,9 +275,12 @@ async function* nodeExecutor(options, context) {
|
|
|
279
275
|
}, context);
|
|
280
276
|
while (true) {
|
|
281
277
|
const event = await output.next();
|
|
278
|
+
if (event.done) {
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
282
281
|
await addToQueue(null, Promise.resolve(event.value));
|
|
283
282
|
await debouncedProcessQueue.trigger();
|
|
284
|
-
if (
|
|
283
|
+
if (!options.watch) {
|
|
285
284
|
break;
|
|
286
285
|
}
|
|
287
286
|
}
|
|
@@ -337,7 +336,7 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
337
336
|
// {workspaceRoot}/dist/{projectRoot} -> dist/my-app
|
|
338
337
|
const outputPath = project.data.targets[buildOptions.target]?.outputs?.[0];
|
|
339
338
|
if (outputPath) {
|
|
340
|
-
const outputFilePath = (0,
|
|
339
|
+
const outputFilePath = (0, internal_1.interpolate)(outputPath, {
|
|
341
340
|
projectName: project.name,
|
|
342
341
|
projectRoot: project.data.root,
|
|
343
342
|
workspaceRoot: context.root,
|
|
@@ -366,12 +365,12 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
366
365
|
return (0, path_1.join)(context.root, buildOptions.outputPath, outputFileName);
|
|
367
366
|
}
|
|
368
367
|
function fileToRunCorrectPath(fileToRun) {
|
|
369
|
-
if ((0,
|
|
368
|
+
if ((0, internal_1.fileExists)(fileToRun))
|
|
370
369
|
return fileToRun;
|
|
371
370
|
const extensionsToTry = ['.cjs', '.mjs', '.cjs.js', '.esm.js'];
|
|
372
371
|
for (const ext of extensionsToTry) {
|
|
373
372
|
const file = fileToRun.replace(/\.js$/, ext);
|
|
374
|
-
if ((0,
|
|
373
|
+
if ((0, internal_1.fileExists)(file))
|
|
375
374
|
return file;
|
|
376
375
|
}
|
|
377
376
|
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,6 @@ 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 utils_1 = require("nx/src/tasks-runner/utils");
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
11
|
-
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
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");
|
|
14
9
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
15
10
|
async function pruneLockfileExecutor(schema, context) {
|
|
16
11
|
devkit_1.logger.log('Pruning lockfile...');
|
|
@@ -35,9 +30,9 @@ async function pruneLockfileExecutor(schema, context) {
|
|
|
35
30
|
}
|
|
36
31
|
function createPrunedLockfile(packageJson, graph) {
|
|
37
32
|
const packageManager = (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot);
|
|
38
|
-
const lockfileName = (0,
|
|
39
|
-
const lockFile = (0,
|
|
40
|
-
const workspacePackages = (0,
|
|
33
|
+
const lockfileName = (0, internal_1.getLockFileName)(packageManager);
|
|
34
|
+
const lockFile = (0, internal_1.createLockFile)(packageJson, graph, packageManager);
|
|
35
|
+
const workspacePackages = (0, internal_1.getWorkspacePackagesFromGraph)(graph);
|
|
41
36
|
for (const [pkgName, pkgVersion] of Object.entries(packageJson.dependencies ?? {})) {
|
|
42
37
|
if (pkgVersion.startsWith('workspace:') ||
|
|
43
38
|
pkgVersion.startsWith('file:') ||
|
|
@@ -127,7 +122,7 @@ function getOutputDir(schema, context) {
|
|
|
127
122
|
if (!maybeOutputPath) {
|
|
128
123
|
throw new Error(`Could not infer an output directory from the '${schema.buildTarget}' target. Please provide 'outputPath'.`);
|
|
129
124
|
}
|
|
130
|
-
maybeOutputPath = (0,
|
|
125
|
+
maybeOutputPath = (0, internal_1.interpolate)(maybeOutputPath, {
|
|
131
126
|
workspaceRoot: devkit_1.workspaceRoot,
|
|
132
127
|
projectRoot: project.root,
|
|
133
128
|
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,6 @@ 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 devkit_internals_1 = require("nx/src/devkit-internals");
|
|
11
10
|
const path_1 = require("path");
|
|
12
11
|
const semver_1 = require("semver");
|
|
13
12
|
let childProcess;
|
|
@@ -68,7 +67,7 @@ async function verdaccioExecutor(options, context) {
|
|
|
68
67
|
};
|
|
69
68
|
}
|
|
70
69
|
function getVerdaccioBinPath() {
|
|
71
|
-
const { packageJson, path: packageJsonPath } = (0,
|
|
70
|
+
const { packageJson, path: packageJsonPath } = (0, internal_1.readModulePackageJson)('verdaccio');
|
|
72
71
|
const bin = typeof packageJson.bin === 'string'
|
|
73
72
|
? packageJson.bin
|
|
74
73
|
: 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,7 @@ 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 file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
9
8
|
const picomatch = require("picomatch");
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
11
|
-
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
12
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
13
|
-
const installation_directory_1 = require("nx/src/utils/installation-directory");
|
|
14
9
|
const util_1 = require("./util");
|
|
15
10
|
let ts;
|
|
16
11
|
const resolvedTypescriptPaths = {};
|
|
@@ -20,12 +15,12 @@ function resolveTypescriptPath(projectRoot, workspaceRoot) {
|
|
|
20
15
|
// path is outside the workspace tree (e.g. pnpm's enableGlobalVirtualStore),
|
|
21
16
|
// since typescript is not a declared dep.
|
|
22
17
|
resolvedTypescriptPaths[projectRoot] ??= require.resolve('typescript', {
|
|
23
|
-
paths: [projectRoot, ...(0,
|
|
18
|
+
paths: [projectRoot, ...(0, internal_1.getNxRequirePaths)(workspaceRoot), __dirname],
|
|
24
19
|
});
|
|
25
20
|
return resolvedTypescriptPaths[projectRoot];
|
|
26
21
|
}
|
|
27
22
|
const TSCONFIG_CACHE_VERSION = 2;
|
|
28
|
-
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(
|
|
23
|
+
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(internal_1.workspaceDataDirectory, 'tsconfig-files.hash');
|
|
29
24
|
// Module-level cache store — each invocation gets a unique Symbol key
|
|
30
25
|
const cacheStore = new Map();
|
|
31
26
|
// Shared tsconfig cache — initialized once per batch, persisted to disk
|
|
@@ -117,8 +112,8 @@ const tsConfigGlob = '**/tsconfig*.json';
|
|
|
117
112
|
exports.createNodesV2 = [
|
|
118
113
|
tsConfigGlob,
|
|
119
114
|
async (configFilePaths, options, context) => {
|
|
120
|
-
const optionsHash = (0,
|
|
121
|
-
const targetsCachePath = (0, node_path_1.join)(
|
|
115
|
+
const optionsHash = (0, internal_1.hashObject)(options);
|
|
116
|
+
const targetsCachePath = (0, node_path_1.join)(internal_1.workspaceDataDirectory, `tsc-${optionsHash}.hash`);
|
|
122
117
|
const targetsCache = readFromCache(targetsCachePath);
|
|
123
118
|
// Each invocation gets a unique Symbol key — guaranteed no collisions
|
|
124
119
|
const cacheKey = Symbol('tsc-invocation');
|
|
@@ -136,7 +131,7 @@ exports.createNodesV2 = [
|
|
|
136
131
|
const normalizedOptions = normalizePluginOptions(options);
|
|
137
132
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
138
133
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
139
|
-
const lockFileName = (0,
|
|
134
|
+
const lockFileName = (0, internal_1.getLockFileName)(packageManager);
|
|
140
135
|
const { configFilePaths: validConfigFilePaths, hashes, projectRoots, } = await resolveValidConfigFilesAndHashes(configFilePaths, normalizedOptions, optionsHash, context, cache, lockFileName);
|
|
141
136
|
try {
|
|
142
137
|
return await (0, devkit_1.createNodesFromFiles)((configFilePath, options, context, idx) => {
|
|
@@ -171,7 +166,7 @@ exports.createNodesV2 = [
|
|
|
171
166
|
];
|
|
172
167
|
exports.createNodes = exports.createNodesV2;
|
|
173
168
|
async function resolveValidConfigFilesAndHashes(configFilePaths, options, optionsHash, context, cache, lockFileName) {
|
|
174
|
-
const lockFileHash = (0,
|
|
169
|
+
const lockFileHash = (0, internal_1.hashFile)((0, node_path_1.join)(context.workspaceRoot, lockFileName)) ?? '';
|
|
175
170
|
const validConfigFilePaths = [];
|
|
176
171
|
const hashes = [];
|
|
177
172
|
const projectRoots = [];
|
|
@@ -218,7 +213,7 @@ async function getConfigFileHash(configFilePath, workspaceRoot, project, options
|
|
|
218
213
|
packageJson = (0, devkit_1.readJsonFile)((0, node_path_1.join)(workspaceRoot, project.root, 'package.json'));
|
|
219
214
|
}
|
|
220
215
|
catch { }
|
|
221
|
-
return (0,
|
|
216
|
+
return (0, devkit_1.hashArray)([
|
|
222
217
|
...[
|
|
223
218
|
fullConfigPath,
|
|
224
219
|
...extendedConfigFiles.files.sort(),
|
|
@@ -228,7 +223,7 @@ async function getConfigFileHash(configFilePath, workspaceRoot, project, options
|
|
|
228
223
|
...extendedConfigFiles.packages.sort(),
|
|
229
224
|
lockFileHash,
|
|
230
225
|
optionsHash,
|
|
231
|
-
...(packageJson ? [(0,
|
|
226
|
+
...(packageJson ? [(0, internal_1.hashObject)(packageJson)] : []),
|
|
232
227
|
]);
|
|
233
228
|
}
|
|
234
229
|
function checkIfConfigFileShouldBeProject(config, cache) {
|
|
@@ -956,7 +951,7 @@ function getFileHash(filePath, workspaceRoot, cache) {
|
|
|
956
951
|
const relativePath = posixRelative(workspaceRoot, filePath);
|
|
957
952
|
if (!cache.fileHashes[relativePath]) {
|
|
958
953
|
const content = readFile(filePath, workspaceRoot, cache);
|
|
959
|
-
cache.fileHashes[relativePath] = (0,
|
|
954
|
+
cache.fileHashes[relativePath] = (0, devkit_1.hashArray)([content]);
|
|
960
955
|
}
|
|
961
956
|
return cache.fileHashes[relativePath];
|
|
962
957
|
}
|
|
@@ -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,7 @@ 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
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
8
|
-
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
9
7
|
const semver_1 = require("semver");
|
|
10
8
|
async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
11
9
|
if (options?.skipLockFileUpdate) {
|
|
@@ -30,10 +28,10 @@ async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
|
30
28
|
}
|
|
31
29
|
return [];
|
|
32
30
|
}
|
|
33
|
-
const isDaemonEnabled =
|
|
31
|
+
const isDaemonEnabled = internal_1.daemonClient.enabled();
|
|
34
32
|
if (!dryRun && isDaemonEnabled) {
|
|
35
33
|
// if not in dry-run temporarily stop the daemon, as it will error if the lock file is updated
|
|
36
|
-
await
|
|
34
|
+
await internal_1.daemonClient.stop();
|
|
37
35
|
}
|
|
38
36
|
const packageManagerCommands = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
39
37
|
let installArgs = options?.installArgs || '';
|
|
@@ -48,7 +46,7 @@ async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
|
48
46
|
installArgs = `${installArgs} --ignore-scripts`.trim();
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
|
-
const lockFile = (0,
|
|
49
|
+
const lockFile = (0, internal_1.getLockFileName)(packageManager);
|
|
52
50
|
const command = `${packageManagerCommands.updateLockFile} ${installArgs}`.trim();
|
|
53
51
|
if (verbose) {
|
|
54
52
|
if (dryRun) {
|
|
@@ -65,7 +63,7 @@ async function updateLockFile(cwd, { dryRun, verbose, options, }) {
|
|
|
65
63
|
execLockFileUpdate(command, cwd, env);
|
|
66
64
|
if (isDaemonEnabled) {
|
|
67
65
|
try {
|
|
68
|
-
await
|
|
66
|
+
await internal_1.daemonClient.startInBackground();
|
|
69
67
|
}
|
|
70
68
|
catch (e) {
|
|
71
69
|
// 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,11 @@
|
|
|
1
1
|
import { ProjectGraph, Tree } from '@nx/devkit';
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
2
|
+
import { VersionActions } from 'nx/release';
|
|
3
|
+
import type { ResolveVersionForDependency } from 'nx/release';
|
|
4
|
+
import type { AfterAllProjectsVersioned, NxReleaseVersionConfiguration } from '@nx/devkit/internal';
|
|
4
5
|
export declare const afterAllProjectsVersioned: AfterAllProjectsVersioned;
|
|
5
6
|
export default class JsVersionActions extends VersionActions {
|
|
6
7
|
validManifestFilenames: string[];
|
|
8
|
+
excludeManifestsFromFormatting: boolean;
|
|
7
9
|
readCurrentVersionFromSourceManifest(tree: Tree): Promise<{
|
|
8
10
|
currentVersion: string;
|
|
9
11
|
manifestPath: string;
|
|
@@ -17,6 +19,13 @@ export default class JsVersionActions extends VersionActions {
|
|
|
17
19
|
dependencyCollection: string | null;
|
|
18
20
|
}>;
|
|
19
21
|
updateProjectVersion(tree: Tree, newVersion: string): Promise<string[]>;
|
|
20
|
-
updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string
|
|
22
|
+
updateProjectDependencies(tree: Tree, projectGraph: ProjectGraph, dependenciesToUpdate: Record<string, string>, resolveVersionForDependency?: ResolveVersionForDependency): Promise<string[]>;
|
|
23
|
+
private getLocalDependencyProjectLookup;
|
|
24
|
+
private resolveLocalDependencySpecifier;
|
|
25
|
+
private applyVersionPrefix;
|
|
26
|
+
private updateManifestValues;
|
|
27
|
+
private readAndValidateManifest;
|
|
28
|
+
private validateManifestUpdates;
|
|
29
|
+
private detectFormattingOptions;
|
|
21
30
|
private isLocalDependencyProtocol;
|
|
22
31
|
}
|