@nx/js 23.2.0-beta.0 → 23.2.0-beta.10
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 +9 -3
- package/dist/internal.js +28 -17
- package/dist/src/executors/copy-workspace-modules/copy-workspace-modules.js +122 -21
- 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 +40 -33
- 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 +8 -1
- package/dist/src/generators/init/init.js +32 -15
- package/dist/src/generators/init/schema.d.ts +1 -1
- package/dist/src/generators/init/schema.json +1 -1
- package/dist/src/generators/library/library.d.ts +1 -1
- package/dist/src/generators/library/library.js +34 -20
- package/dist/src/generators/library/schema.d.ts +11 -3
- package/dist/src/generators/library/schema.json +15 -4
- package/dist/src/generators/library/utils/add-release-config.js +2 -2
- package/dist/src/generators/setup-build/generator.js +2 -7
- 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 +3 -2
- package/dist/src/index.js +8 -8
- package/dist/src/migrations/update-23-1-0/add-ignore-deprecations-for-ts6.d.ts +3 -2
- package/dist/src/migrations/update-23-1-0/add-ignore-deprecations-for-ts6.js +17 -11
- package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.d.ts +14 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.js +242 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.md +64 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.d.ts +2 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.js +305 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.md +59 -0
- 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 +236 -76
- package/dist/src/utils/add-linting-to-project.d.ts +46 -0
- package/dist/src/utils/add-linting-to-project.js +112 -0
- 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/formatter-setup.d.ts +26 -0
- package/dist/src/utils/formatter-setup.js +43 -0
- package/dist/src/utils/generate-globs.js +11 -14
- package/dist/src/utils/generator-prompts.d.ts +2 -1
- package/dist/src/utils/generator-prompts.js +23 -22
- package/dist/src/utils/get-main-file-dir.js +2 -2
- package/dist/src/utils/linter.d.ts +30 -0
- package/dist/src/utils/linter.js +43 -0
- package/dist/src/utils/npm-config.d.ts +1 -1
- package/dist/src/utils/nx-formatter-internals.d.ts +8 -0
- package/dist/src/utils/nx-formatter-internals.js +18 -0
- package/dist/src/utils/oxfmt.d.ts +4 -0
- package/dist/src/utils/oxfmt.js +35 -0
- package/dist/src/utils/package-json/update-package-json.d.ts +1 -1
- package/dist/src/utils/package-json/update-package-json.js +11 -22
- package/dist/src/utils/package-manager-workspaces.js +2 -2
- package/dist/src/utils/pnpm-deploy-output-cache-inputs.d.ts +29 -0
- package/dist/src/utils/pnpm-deploy-output-cache-inputs.js +177 -0
- package/dist/src/utils/pnpm-install-settings-inputs.d.ts +45 -0
- package/dist/src/utils/pnpm-install-settings-inputs.js +77 -0
- package/dist/src/utils/prettier.js +14 -33
- package/dist/src/utils/target-defaults-matching.d.ts +57 -0
- package/dist/src/utils/target-defaults-matching.js +126 -0
- package/dist/src/utils/typescript/configuration.js +3 -5
- 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-config.d.ts +51 -1
- package/dist/src/utils/typescript/ts-config.js +114 -0
- 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/versions.d.ts +1 -0
- package/dist/src/utils/versions.js +2 -1
- package/dist/src/utils/watch-for-single-file-changes.js +2 -2
- package/dist/src/utils/workspace-module-sections.d.ts +16 -0
- package/dist/src/utils/workspace-module-sections.js +24 -0
- package/migrations.json +13 -1
- package/package.json +12 -5
package/dist/internal.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
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
|
+
export { PNPM_INSTALL_SETTINGS_INPUTS, PNPM_MAJOR_RUNTIME_INPUT, pnpmInstallSettingsInputsForInferredTarget, shouldIncludePnpmMajorRuntimeInput, } from './src/utils/pnpm-install-settings-inputs';
|
|
7
|
+
export { addPnpmDeployOutputCacheInputs } from './src/utils/pnpm-deploy-output-cache-inputs';
|
|
8
|
+
export type { MatchedTargetRef } from './src/utils/target-defaults-matching';
|
|
6
9
|
export { TS_SOLUTION_SETUP_TSCONFIG_INPUT, addProjectToTsSolutionWorkspace, assertNotUsingTsSolutionSetup, findRuntimeTsConfigName, getDefinedCustomConditionName, getProjectSourceRoot, getProjectType, isUsingTsSolutionSetup, shouldConfigureTsSolutionSetup, updateTsconfigFiles, } from './src/utils/typescript/ts-solution-setup';
|
|
7
10
|
export { getTsConfigBaseOptions } from './src/utils/typescript/create-ts-config';
|
|
11
|
+
export { createTreeParseConfigHost, type TreeParseConfigHost, } from './src/utils/typescript/ts-config';
|
|
8
12
|
export { ensureTypescript } from './src/utils/typescript/ensure-typescript';
|
|
9
13
|
export { getRangeMinimum, getTsConfigModuleResolution, isTypescriptVersionAtLeast, } from './src/utils/is-typescript-version-at-least';
|
|
10
14
|
export { getNeededCompilerOptionOverrides } from './src/utils/typescript/configuration';
|
|
@@ -20,6 +24,8 @@ export { getProjectPackageManagerWorkspaceState, getProjectPackageManagerWorkspa
|
|
|
20
24
|
export { findNpmDependencies } from './src/utils/find-npm-dependencies';
|
|
21
25
|
export { addBuildAndWatchDepsTargets, isValidPackageJsonBuildConfig, } from './src/plugins/typescript/util';
|
|
22
26
|
export { normalizeLinterOption, normalizeUnitTestRunnerOption, } from './src/utils/generator-prompts';
|
|
27
|
+
export { detectLinters } from './src/utils/linter';
|
|
28
|
+
export { addLintingToProject, type AddLintingToProjectOptions, } from './src/utils/add-linting-to-project';
|
|
23
29
|
export { createGlobPatternsForDependencies } from './src/utils/generate-globs';
|
|
24
30
|
export { getImportPath } from './src/utils/get-import-path';
|
|
25
31
|
export { stripGlobToBaseDir } from './src/utils/strip-glob-to-base-dir';
|
package/dist/internal.js
CHANGED
|
@@ -5,23 +5,20 @@
|
|
|
5
5
|
// internal consumers and may change without semver protection. Consider it
|
|
6
6
|
// the @nx/js equivalent of `@nx/devkit/internal`.
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
9
|
-
exports.typesNodeVersion = exports.tsLibVersion = exports.swcNodeVersion = exports.swcHelpersVersion = exports.swcCoreVersion = exports.swcCliVersion = exports.prettierVersion = exports.esbuildVersion = exports.nxVersion = exports.releaseTasks = exports.addReleaseConfigForTsSolution = 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; } });
|
|
8
|
+
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.addPnpmDeployOutputCacheInputs = exports.shouldIncludePnpmMajorRuntimeInput = exports.pnpmInstallSettingsInputsForInferredTarget = exports.PNPM_MAJOR_RUNTIME_INPUT = exports.PNPM_INSTALL_SETTINGS_INPUTS = exports.isEsmProject = exports.walkTsconfigExtendsChain = exports.findProjectsNpmDependencies = exports.isBuiltinModuleImport = exports.TargetProjectLocator = exports.requireWithTsconfigFallback = exports.registerTsConfigPaths = exports.registerTsProject = exports.loadTsFile = exports.forceRegisterEsmLoader = void 0;
|
|
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 = exports.addLocalRegistryScripts = exports.stripGlobToBaseDir = exports.getImportPath = exports.createGlobPatternsForDependencies = exports.addLintingToProject = exports.detectLinters = exports.normalizeUnitTestRunnerOption = void 0;
|
|
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; } });
|
|
@@ -29,6 +26,14 @@ Object.defineProperty(exports, "walkTsconfigExtendsChain", { enumerable: true, g
|
|
|
29
26
|
// TS solution awareness; mirrors Node's nearest-package.json semantics).
|
|
30
27
|
var is_esm_project_1 = require("./src/utils/module-format/is-esm-project");
|
|
31
28
|
Object.defineProperty(exports, "isEsmProject", { enumerable: true, get: function () { return is_esm_project_1.isEsmProject; } });
|
|
29
|
+
// Inputs for build targets that emit a pruned pnpm deploy output
|
|
30
|
+
var pnpm_install_settings_inputs_1 = require("./src/utils/pnpm-install-settings-inputs");
|
|
31
|
+
Object.defineProperty(exports, "PNPM_INSTALL_SETTINGS_INPUTS", { enumerable: true, get: function () { return pnpm_install_settings_inputs_1.PNPM_INSTALL_SETTINGS_INPUTS; } });
|
|
32
|
+
Object.defineProperty(exports, "PNPM_MAJOR_RUNTIME_INPUT", { enumerable: true, get: function () { return pnpm_install_settings_inputs_1.PNPM_MAJOR_RUNTIME_INPUT; } });
|
|
33
|
+
Object.defineProperty(exports, "pnpmInstallSettingsInputsForInferredTarget", { enumerable: true, get: function () { return pnpm_install_settings_inputs_1.pnpmInstallSettingsInputsForInferredTarget; } });
|
|
34
|
+
Object.defineProperty(exports, "shouldIncludePnpmMajorRuntimeInput", { enumerable: true, get: function () { return pnpm_install_settings_inputs_1.shouldIncludePnpmMajorRuntimeInput; } });
|
|
35
|
+
var pnpm_deploy_output_cache_inputs_1 = require("./src/utils/pnpm-deploy-output-cache-inputs");
|
|
36
|
+
Object.defineProperty(exports, "addPnpmDeployOutputCacheInputs", { enumerable: true, get: function () { return pnpm_deploy_output_cache_inputs_1.addPnpmDeployOutputCacheInputs; } });
|
|
32
37
|
// TS solution setup detection
|
|
33
38
|
var ts_solution_setup_1 = require("./src/utils/typescript/ts-solution-setup");
|
|
34
39
|
Object.defineProperty(exports, "TS_SOLUTION_SETUP_TSCONFIG_INPUT", { enumerable: true, get: function () { return ts_solution_setup_1.TS_SOLUTION_SETUP_TSCONFIG_INPUT; } });
|
|
@@ -47,6 +52,8 @@ Object.defineProperty(exports, "updateTsconfigFiles", { enumerable: true, get: f
|
|
|
47
52
|
// re-exported here so internal consumers can import it from @nx/js/internal.
|
|
48
53
|
var create_ts_config_1 = require("./src/utils/typescript/create-ts-config");
|
|
49
54
|
Object.defineProperty(exports, "getTsConfigBaseOptions", { enumerable: true, get: function () { return create_ts_config_1.getTsConfigBaseOptions; } });
|
|
55
|
+
var ts_config_1 = require("./src/utils/typescript/ts-config");
|
|
56
|
+
Object.defineProperty(exports, "createTreeParseConfigHost", { enumerable: true, get: function () { return ts_config_1.createTreeParseConfigHost; } });
|
|
50
57
|
var ensure_typescript_1 = require("./src/utils/typescript/ensure-typescript");
|
|
51
58
|
Object.defineProperty(exports, "ensureTypescript", { enumerable: true, get: function () { return ensure_typescript_1.ensureTypescript; } });
|
|
52
59
|
var is_typescript_version_at_least_1 = require("./src/utils/is-typescript-version-at-least");
|
|
@@ -90,6 +97,10 @@ Object.defineProperty(exports, "isValidPackageJsonBuildConfig", { enumerable: tr
|
|
|
90
97
|
var generator_prompts_1 = require("./src/utils/generator-prompts");
|
|
91
98
|
Object.defineProperty(exports, "normalizeLinterOption", { enumerable: true, get: function () { return generator_prompts_1.normalizeLinterOption; } });
|
|
92
99
|
Object.defineProperty(exports, "normalizeUnitTestRunnerOption", { enumerable: true, get: function () { return generator_prompts_1.normalizeUnitTestRunnerOption; } });
|
|
100
|
+
var linter_1 = require("./src/utils/linter");
|
|
101
|
+
Object.defineProperty(exports, "detectLinters", { enumerable: true, get: function () { return linter_1.detectLinters; } });
|
|
102
|
+
var add_linting_to_project_1 = require("./src/utils/add-linting-to-project");
|
|
103
|
+
Object.defineProperty(exports, "addLintingToProject", { enumerable: true, get: function () { return add_linting_to_project_1.addLintingToProject; } });
|
|
93
104
|
var generate_globs_1 = require("./src/utils/generate-globs");
|
|
94
105
|
Object.defineProperty(exports, "createGlobPatternsForDependencies", { enumerable: true, get: function () { return generate_globs_1.createGlobPatternsForDependencies; } });
|
|
95
106
|
var get_import_path_1 = require("./src/utils/get-import-path");
|
|
@@ -2,13 +2,54 @@
|
|
|
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");
|
|
10
|
+
const workspace_module_sections_1 = require("../../utils/workspace-module-sections");
|
|
11
|
+
// Sections of a copied module's own manifest whose workspace-module deps are
|
|
12
|
+
// rewritten to file: and recursed into. pnpm installs a transitive dependency's
|
|
13
|
+
// regular, optional, and auto-installed peer deps (a workspace peer is linked
|
|
14
|
+
// and recorded under the depending importer's dependencies in the lockfile), but
|
|
15
|
+
// never its devDependencies. A workspace-module peer is moved into dependencies,
|
|
16
|
+
// since pnpm rejects a file: spec under peerDependencies (mirrors the app-level
|
|
17
|
+
// move in prune-lockfile).
|
|
18
|
+
const TRANSITIVE_INSTALL_SECTIONS = [
|
|
19
|
+
'dependencies',
|
|
20
|
+
'optionalDependencies',
|
|
21
|
+
'peerDependencies',
|
|
22
|
+
];
|
|
23
|
+
// Resolve `catalog:` references in a copied module manifest to the version the
|
|
24
|
+
// workspace pinned. Only the sections pnpm installs for a `file:` directory
|
|
25
|
+
// dependency are resolved: a copied module's devDependencies are never
|
|
26
|
+
// installed, so a `catalog:` there is inert (pnpm leaves it untouched), and
|
|
27
|
+
// resolving it would abort the whole deploy build if that catalog entry does
|
|
28
|
+
// not exist. Returns whether anything changed.
|
|
29
|
+
function resolveCatalogReferences(packageJson, manager) {
|
|
30
|
+
if (!manager) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
let modified = false;
|
|
34
|
+
for (const section of TRANSITIVE_INSTALL_SECTIONS) {
|
|
35
|
+
const deps = packageJson[section];
|
|
36
|
+
if (!deps) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
for (const [name, version] of Object.entries(deps)) {
|
|
40
|
+
if (!manager.isCatalogReference(version)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const resolved = manager.resolveCatalogReference(devkit_1.workspaceRoot, name, version);
|
|
44
|
+
if (!resolved) {
|
|
45
|
+
throw new Error(`Could not resolve catalog reference for package ${name}@${version}.`);
|
|
46
|
+
}
|
|
47
|
+
deps[name] = resolved;
|
|
48
|
+
modified = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return modified;
|
|
52
|
+
}
|
|
12
53
|
async function copyWorkspaceModules(schema, context) {
|
|
13
54
|
devkit_1.logger.log('Copying Workspace Modules to Build Directory...');
|
|
14
55
|
const outputDirectory = getOutputDir(schema, context);
|
|
@@ -19,10 +60,14 @@ async function copyWorkspaceModules(schema, context) {
|
|
|
19
60
|
return { success: true };
|
|
20
61
|
}
|
|
21
62
|
function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
22
|
-
if (!
|
|
63
|
+
if (!workspace_module_sections_1.WORKSPACE_MODULE_INSTALL_SECTIONS.some((section) => packageJson[section])) {
|
|
23
64
|
return;
|
|
24
65
|
}
|
|
25
|
-
const workspaceModules = (0,
|
|
66
|
+
const workspaceModules = (0, internal_1.getWorkspacePackagesFromGraph)(projectGraph);
|
|
67
|
+
const catalogManager = (0, internal_1.getCatalogManager)(devkit_1.workspaceRoot);
|
|
68
|
+
// Only the pnpm prune path ships non-workspace local-path targets, so only
|
|
69
|
+
// pnpm manifests get their file:/link: specs relocated.
|
|
70
|
+
const isPnpmWorkspace = (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot) === 'pnpm';
|
|
26
71
|
const processedModules = new Set();
|
|
27
72
|
const workspaceModulesDir = (0, path_1.join)(outputDirectory, 'workspace_modules');
|
|
28
73
|
function calculateRelativePath(fromPkgName, toPkgName) {
|
|
@@ -44,10 +89,17 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
44
89
|
devkit_1.logger.verbose(`Copying ${pkgName}.`);
|
|
45
90
|
const workspaceModuleProject = workspaceModules.get(pkgName);
|
|
46
91
|
const workspaceModuleRoot = workspaceModuleProject.data.root;
|
|
92
|
+
// data.root is workspace-root-relative in the graph, but may arrive
|
|
93
|
+
// absolute; normalize so the local-path relocation math is in
|
|
94
|
+
// workspace-root space.
|
|
95
|
+
const moduleWsRelativeRoot = (0, path_1.isAbsolute)(workspaceModuleRoot)
|
|
96
|
+
? (0, path_1.relative)(devkit_1.workspaceRoot, workspaceModuleRoot).split(path_1.sep).join('/')
|
|
97
|
+
: workspaceModuleRoot;
|
|
47
98
|
const newWorkspaceModulePath = (0, path_1.join)(workspaceModulesDir, pkgName);
|
|
48
|
-
// Copy the module
|
|
99
|
+
// Copy the module, from the workspace root rather than the process cwd: a
|
|
100
|
+
// graph root arrives workspace-relative in the common case.
|
|
49
101
|
(0, node_fs_1.mkdirSync)(newWorkspaceModulePath, { recursive: true });
|
|
50
|
-
(0, node_fs_1.cpSync)(
|
|
102
|
+
(0, node_fs_1.cpSync)((0, path_1.join)(devkit_1.workspaceRoot, moduleWsRelativeRoot), newWorkspaceModulePath, {
|
|
51
103
|
filter: (src) => !src.includes('node_modules'),
|
|
52
104
|
recursive: true,
|
|
53
105
|
});
|
|
@@ -62,26 +114,75 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
62
114
|
devkit_1.logger.warn(`Could not read package.json for ${pkgName}: ${e.message}`);
|
|
63
115
|
return;
|
|
64
116
|
}
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
117
|
+
// The standalone dist ships no catalog definition, so resolve any
|
|
118
|
+
// `catalog:` references to the version the workspace pinned.
|
|
119
|
+
let packageJsonModified = resolveCatalogReferences(copiedPackageJson, catalogManager);
|
|
120
|
+
// Rewrite sibling workspace-module deps to file: paths and recurse. A peer
|
|
121
|
+
// is moved into dependencies (pnpm rejects a file: spec under
|
|
122
|
+
// peerDependencies), dropping its now-orphaned optional/required marker.
|
|
123
|
+
for (const section of TRANSITIVE_INSTALL_SECTIONS) {
|
|
124
|
+
const deps = copiedPackageJson[section];
|
|
125
|
+
if (!deps) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
for (const depName of Object.keys(deps)) {
|
|
69
129
|
if (workspaceModules.has(depName)) {
|
|
70
|
-
const
|
|
71
|
-
|
|
130
|
+
const fileSpec = `file:${calculateRelativePath(pkgName, depName)}`;
|
|
131
|
+
if (section === 'peerDependencies') {
|
|
132
|
+
(0, internal_1.movePeerDependencyToDependencies)(copiedPackageJson, depName, fileSpec);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
deps[depName] = fileSpec;
|
|
136
|
+
}
|
|
72
137
|
packageJsonModified = true;
|
|
73
138
|
processModule(depName);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
// A non-workspace file:/link: dep must keep resolving after the module
|
|
142
|
+
// moves. pnpm reads a non-importer manifest file: spec relative to the
|
|
143
|
+
// package dir but a link: spec relative to the install root, so each
|
|
144
|
+
// rebases onto a different base (pnpm-only; see isPnpmWorkspace).
|
|
145
|
+
if (!isPnpmWorkspace) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const spec = deps[depName];
|
|
149
|
+
const relocation = (0, internal_1.relocatePrunedLocalPathSpec)(spec, moduleWsRelativeRoot, spec.startsWith('link:') ? '' : `workspace_modules/${pkgName}`);
|
|
150
|
+
if (!relocation) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (relocation.reason) {
|
|
154
|
+
(0, internal_1.warnUnshippableLocalPathSpec)(`"${spec}" in ${pkgName}`, relocation.reason);
|
|
155
|
+
}
|
|
156
|
+
if (section === 'peerDependencies') {
|
|
157
|
+
// Moved even when the target cannot ship: pnpm rejects the spec here
|
|
158
|
+
// either way.
|
|
159
|
+
(0, internal_1.movePeerDependencyToDependencies)(copiedPackageJson, depName, relocation.spec);
|
|
160
|
+
packageJsonModified = true;
|
|
161
|
+
}
|
|
162
|
+
else if (!relocation.reason) {
|
|
163
|
+
deps[depName] = relocation.spec;
|
|
164
|
+
packageJsonModified = true;
|
|
74
165
|
}
|
|
75
166
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
167
|
+
}
|
|
168
|
+
(0, internal_1.dropEmptyPeerDependencySections)(copiedPackageJson);
|
|
169
|
+
if (packageJsonModified) {
|
|
170
|
+
(0, node_fs_1.writeFileSync)(copiedPackageJsonPath, JSON.stringify(copiedPackageJson, null, 2));
|
|
171
|
+
devkit_1.logger.verbose(`Updated package.json for ${pkgName}.`);
|
|
80
172
|
}
|
|
81
173
|
}
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
174
|
+
// Seed from every section the app declares a workspace module in. Copied
|
|
175
|
+
// modules recurse over production sections only (see processModule).
|
|
176
|
+
// processModule dedups via processedModules, so a module listed in several
|
|
177
|
+
// sections is copied once.
|
|
178
|
+
for (const section of workspace_module_sections_1.WORKSPACE_MODULE_INSTALL_SECTIONS) {
|
|
179
|
+
const deps = packageJson[section];
|
|
180
|
+
if (!deps) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
for (const pkgName of Object.keys(deps)) {
|
|
184
|
+
processModule(pkgName);
|
|
185
|
+
}
|
|
85
186
|
}
|
|
86
187
|
}
|
|
87
188
|
function createWorkspaceModules(outputDirectory) {
|
|
@@ -114,7 +215,7 @@ function getOutputDir(schema, context) {
|
|
|
114
215
|
if (!maybeOutputPath) {
|
|
115
216
|
throw new Error(`Could not infer an output directory from the '${schema.buildTarget}' target. Please provide 'outputPath'.`);
|
|
116
217
|
}
|
|
117
|
-
maybeOutputPath = (0,
|
|
218
|
+
maybeOutputPath = (0, internal_1.interpolate)(maybeOutputPath, {
|
|
118
219
|
workspaceRoot: devkit_1.workspaceRoot,
|
|
119
220
|
projectRoot: project.root,
|
|
120
221
|
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;
|
|
@@ -3,53 +3,60 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = pruneLockfileExecutor;
|
|
4
4
|
exports.resolveCatalogReferences = resolveCatalogReferences;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
7
6
|
const fs_1 = require("fs");
|
|
8
7
|
const path_1 = require("path");
|
|
9
|
-
const
|
|
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");
|
|
8
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
14
9
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
10
|
+
const workspace_module_sections_1 = require("../../utils/workspace-module-sections");
|
|
15
11
|
async function pruneLockfileExecutor(schema, context) {
|
|
16
12
|
devkit_1.logger.log('Pruning lockfile...');
|
|
17
13
|
const outputDirectory = getOutputDir(schema, context);
|
|
18
14
|
const packageJson = resolveCatalogReferences(getPackageJson(schema, context));
|
|
19
15
|
mergeAllowScripts(packageJson);
|
|
20
16
|
const packageManager = (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
17
|
+
const { project } = (0, devkit_1.parseTargetString)(schema.buildTarget, context);
|
|
18
|
+
const projectRoot = context.projectGraph.nodes[project].data.root;
|
|
19
|
+
(0, internal_1.generatePrunedDeployOutput)(packageJson, context.projectGraph, projectRoot, {
|
|
20
|
+
outputDirectory,
|
|
21
|
+
packageManager,
|
|
22
|
+
workspaceRoot: devkit_1.workspaceRoot,
|
|
23
|
+
});
|
|
24
|
+
rewriteWorkspaceModuleSpecifiers(packageJson, context.projectGraph);
|
|
25
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(outputDirectory, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
26
|
+
devkit_1.logger.log(`Pruned deploy output written to ${outputDirectory}`);
|
|
32
27
|
return {
|
|
33
28
|
success: true,
|
|
34
29
|
};
|
|
35
30
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
// Point every workspace-module dependency at its copied directory so the
|
|
32
|
+
// standalone output installs them as pnpm `file:` directory dependencies.
|
|
33
|
+
// pnpm rejects a `file:` spec under peerDependencies, so a peer-declared
|
|
34
|
+
// workspace module is moved into dependencies instead (an optional peer
|
|
35
|
+
// becomes required, which is moot since the module is always copied in). Gate
|
|
36
|
+
// strictly on graph membership: a `file:`/`link:` spec to a non-workspace
|
|
37
|
+
// local path (e.g. a vendored tarball) is left alone, since
|
|
38
|
+
// copy-workspace-modules only ever copies actual workspace projects.
|
|
39
|
+
function rewriteWorkspaceModuleSpecifiers(packageJson, graph) {
|
|
40
|
+
const workspacePackages = (0, internal_1.getWorkspacePackagesFromGraph)(graph);
|
|
41
|
+
for (const section of workspace_module_sections_1.WORKSPACE_MODULE_INSTALL_SECTIONS) {
|
|
42
|
+
const deps = packageJson[section];
|
|
43
|
+
if (!deps) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
for (const pkgName of Object.keys(deps)) {
|
|
47
|
+
if (!workspacePackages.has(pkgName)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const fileSpec = `file:./workspace_modules/${pkgName}`;
|
|
51
|
+
if (section === 'peerDependencies') {
|
|
52
|
+
(0, internal_1.movePeerDependencyToDependencies)(packageJson, pkgName, fileSpec);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
deps[pkgName] = fileSpec;
|
|
56
|
+
}
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
|
-
|
|
50
|
-
lockfileName,
|
|
51
|
-
lockFile,
|
|
52
|
-
};
|
|
59
|
+
(0, internal_1.dropEmptyPeerDependencySections)(packageJson);
|
|
53
60
|
}
|
|
54
61
|
/**
|
|
55
62
|
* npm reads the `allowScripts` install-script allowlist only from the install
|
|
@@ -127,7 +134,7 @@ function getOutputDir(schema, context) {
|
|
|
127
134
|
if (!maybeOutputPath) {
|
|
128
135
|
throw new Error(`Could not infer an output directory from the '${schema.buildTarget}' target. Please provide 'outputPath'.`);
|
|
129
136
|
}
|
|
130
|
-
maybeOutputPath = (0,
|
|
137
|
+
maybeOutputPath = (0, internal_1.interpolate)(maybeOutputPath, {
|
|
131
138
|
workspaceRoot: devkit_1.workspaceRoot,
|
|
132
139
|
projectRoot: project.root,
|
|
133
140
|
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
|
}
|
|
@@ -66,12 +66,19 @@ async function verdaccioExecutor(options, context) {
|
|
|
66
66
|
port: options.port,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
function getVerdaccioBinPath() {
|
|
70
|
+
const { packageJson, path: packageJsonPath } = (0, internal_1.readModulePackageJson)('verdaccio');
|
|
71
|
+
const bin = typeof packageJson.bin === 'string'
|
|
72
|
+
? packageJson.bin
|
|
73
|
+
: packageJson.bin['verdaccio'];
|
|
74
|
+
return (0, path_1.join)((0, path_1.dirname)(packageJsonPath), bin);
|
|
75
|
+
}
|
|
69
76
|
/**
|
|
70
77
|
* Fork the verdaccio process: https://verdaccio.org/docs/verdaccio-programmatically/#using-fork-from-child_process-module
|
|
71
78
|
*/
|
|
72
79
|
function startVerdaccio(options, workspaceRoot) {
|
|
73
80
|
return new Promise((resolve, reject) => {
|
|
74
|
-
childProcess = (0, child_process_1.fork)(
|
|
81
|
+
childProcess = (0, child_process_1.fork)(getVerdaccioBinPath(), createVerdaccioOptions(options, workspaceRoot), {
|
|
75
82
|
env: {
|
|
76
83
|
...process.env,
|
|
77
84
|
VERDACCIO_HANDLE_KILL_SIGNALS: 'true',
|