@nx/js 24.1.0-beta.0 → 24.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/internal.d.ts +2 -1
- package/dist/internal.js +8 -5
- package/dist/src/executors/copy-workspace-modules/copy-workspace-modules.js +40 -32
- package/dist/src/executors/prune-lockfile/prune-lockfile.js +105 -8
- package/dist/src/executors/verdaccio/placeholder-auth-token.d.ts +8 -0
- package/dist/src/executors/verdaccio/placeholder-auth-token.js +36 -0
- package/dist/src/executors/verdaccio/verdaccio.impl.js +49 -15
- package/dist/src/generators/setup-verdaccio/files/config.yml +8 -0
- package/dist/src/generators/typescript-sync/typescript-sync.js +5 -7
- package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.d.ts +1 -6
- package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.js +4 -224
- package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.js +18 -297
- package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.d.ts +8 -0
- package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.js +21 -0
- package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.md +49 -0
- package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.d.ts +2 -0
- package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.js +28 -0
- package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.md +44 -0
- package/dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security.d.ts +10 -0
- package/dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security.js +145 -0
- package/dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security.md +49 -0
- package/dist/src/plugins/jest/start-local-registry.d.ts +4 -4
- package/dist/src/plugins/jest/start-local-registry.js +46 -32
- package/dist/src/release/version-actions.js +6 -0
- package/dist/src/utils/bun-install-settings-inputs.d.ts +20 -0
- package/dist/src/utils/bun-install-settings-inputs.js +31 -0
- package/dist/src/utils/deploy-output-cache-inputs.d.ts +35 -0
- package/dist/src/utils/deploy-output-cache-inputs.js +400 -0
- package/dist/src/utils/pnpm-install-settings-inputs.d.ts +0 -6
- package/dist/src/utils/pnpm-install-settings-inputs.js +0 -6
- package/dist/src/utils/prune-lockfile-cache-config.d.ts +18 -0
- package/dist/src/utils/prune-lockfile-cache-config.js +288 -0
- package/dist/src/utils/target-defaults-matching.d.ts +3 -0
- package/dist/src/utils/target-defaults-matching.js +7 -0
- package/dist/src/utils/workspace-module-sections.d.ts +10 -5
- package/dist/src/utils/workspace-module-sections.js +15 -6
- package/migrations.json +18 -0
- package/package.json +12 -12
- package/dist/src/utils/pnpm-deploy-output-cache-inputs.d.ts +0 -29
- package/dist/src/utils/pnpm-deploy-output-cache-inputs.js +0 -177
package/dist/internal.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ 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 { PNPM_INSTALL_SETTINGS_INPUTS, PNPM_MAJOR_RUNTIME_INPUT, pnpmInstallSettingsInputsForInferredTarget, shouldIncludePnpmMajorRuntimeInput, } from './src/utils/pnpm-install-settings-inputs';
|
|
7
|
-
export {
|
|
7
|
+
export { BUN_INSTALL_SETTINGS_INPUTS, shouldIncludeBunInstallSettingsInputs, } from './src/utils/bun-install-settings-inputs';
|
|
8
|
+
export { addDeployOutputCacheInputs, type DeployOutputSettingsInput, } from './src/utils/deploy-output-cache-inputs';
|
|
8
9
|
export { readRuntimeDependencies } from './src/utils/package-json/runtime-dependencies';
|
|
9
10
|
export type { MatchedTargetRef } from './src/utils/target-defaults-matching';
|
|
10
11
|
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
|
@@ -5,8 +5,8 @@
|
|
|
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.typescriptVersion = 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 = exports.normalizeLinterOption = exports.selectTypecheckTsConfig = exports.createTypecheckTarget = exports.isValidPackageJsonBuildConfig = exports.addBuildAndWatchDepsTargets = exports.findNpmDependencies = void 0;
|
|
8
|
+
exports.getNpmScope = exports.sortPackageJsonFields = exports.CopyAssetsHandler = exports.addSwcRegisterDependencies = exports.addSwcDependencies = exports.acknowledgeSwcBuildScripts = 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.registerTypescriptPluginForTypecheck = exports.ensureTypescriptPlugin = 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.readRuntimeDependencies = exports.addDeployOutputCacheInputs = exports.shouldIncludeBunInstallSettingsInputs = exports.BUN_INSTALL_SETTINGS_INPUTS = 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.typescriptVersion = 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 = exports.normalizeLinterOption = exports.selectTypecheckTsConfig = exports.createTypecheckTarget = exports.isValidPackageJsonBuildConfig = exports.addBuildAndWatchDepsTargets = exports.findNpmDependencies = exports.getProjectPackageManagerWorkspaceStateWarningTask = exports.getProjectPackageManagerWorkspaceState = void 0;
|
|
10
10
|
// Re-exports of nx-source internals.
|
|
11
11
|
var internal_1 = require("@nx/devkit/internal");
|
|
12
12
|
Object.defineProperty(exports, "forceRegisterEsmLoader", { enumerable: true, get: function () { return internal_1.forceRegisterEsmLoader; } });
|
|
@@ -26,14 +26,17 @@ Object.defineProperty(exports, "walkTsconfigExtendsChain", { enumerable: true, g
|
|
|
26
26
|
// TS solution awareness; mirrors Node's nearest-package.json semantics).
|
|
27
27
|
var is_esm_project_1 = require("./src/utils/module-format/is-esm-project");
|
|
28
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
|
|
29
|
+
// Inputs for build targets that emit a pruned pnpm or Bun deploy output
|
|
30
30
|
var pnpm_install_settings_inputs_1 = require("./src/utils/pnpm-install-settings-inputs");
|
|
31
31
|
Object.defineProperty(exports, "PNPM_INSTALL_SETTINGS_INPUTS", { enumerable: true, get: function () { return pnpm_install_settings_inputs_1.PNPM_INSTALL_SETTINGS_INPUTS; } });
|
|
32
32
|
Object.defineProperty(exports, "PNPM_MAJOR_RUNTIME_INPUT", { enumerable: true, get: function () { return pnpm_install_settings_inputs_1.PNPM_MAJOR_RUNTIME_INPUT; } });
|
|
33
33
|
Object.defineProperty(exports, "pnpmInstallSettingsInputsForInferredTarget", { enumerable: true, get: function () { return pnpm_install_settings_inputs_1.pnpmInstallSettingsInputsForInferredTarget; } });
|
|
34
34
|
Object.defineProperty(exports, "shouldIncludePnpmMajorRuntimeInput", { enumerable: true, get: function () { return pnpm_install_settings_inputs_1.shouldIncludePnpmMajorRuntimeInput; } });
|
|
35
|
-
var
|
|
36
|
-
Object.defineProperty(exports, "
|
|
35
|
+
var bun_install_settings_inputs_1 = require("./src/utils/bun-install-settings-inputs");
|
|
36
|
+
Object.defineProperty(exports, "BUN_INSTALL_SETTINGS_INPUTS", { enumerable: true, get: function () { return bun_install_settings_inputs_1.BUN_INSTALL_SETTINGS_INPUTS; } });
|
|
37
|
+
Object.defineProperty(exports, "shouldIncludeBunInstallSettingsInputs", { enumerable: true, get: function () { return bun_install_settings_inputs_1.shouldIncludeBunInstallSettingsInputs; } });
|
|
38
|
+
var deploy_output_cache_inputs_1 = require("./src/utils/deploy-output-cache-inputs");
|
|
39
|
+
Object.defineProperty(exports, "addDeployOutputCacheInputs", { enumerable: true, get: function () { return deploy_output_cache_inputs_1.addDeployOutputCacheInputs; } });
|
|
37
40
|
var runtime_dependencies_1 = require("./src/utils/package-json/runtime-dependencies");
|
|
38
41
|
Object.defineProperty(exports, "readRuntimeDependencies", { enumerable: true, get: function () { return runtime_dependencies_1.readRuntimeDependencies; } });
|
|
39
42
|
// TS solution setup detection
|
|
@@ -8,18 +8,6 @@ const path_1 = require("path");
|
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
10
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
11
|
// Resolve `catalog:` references in a copied module manifest to the version the
|
|
24
12
|
// workspace pinned. Only the sections pnpm installs for a `file:` directory
|
|
25
13
|
// dependency are resolved: a copied module's devDependencies are never
|
|
@@ -31,7 +19,7 @@ function resolveCatalogReferences(packageJson, manager) {
|
|
|
31
19
|
return false;
|
|
32
20
|
}
|
|
33
21
|
let modified = false;
|
|
34
|
-
for (const section of TRANSITIVE_INSTALL_SECTIONS) {
|
|
22
|
+
for (const section of workspace_module_sections_1.TRANSITIVE_INSTALL_SECTIONS) {
|
|
35
23
|
const deps = packageJson[section];
|
|
36
24
|
if (!deps) {
|
|
37
25
|
continue;
|
|
@@ -54,20 +42,30 @@ async function copyWorkspaceModules(schema, context) {
|
|
|
54
42
|
devkit_1.logger.log('Copying Workspace Modules to Build Directory...');
|
|
55
43
|
const outputDirectory = getOutputDir(schema, context);
|
|
56
44
|
const packageJson = getPackageJson(schema, context);
|
|
45
|
+
const { project } = (0, devkit_1.parseTargetString)(schema.buildTarget, context);
|
|
57
46
|
createWorkspaceModules(outputDirectory);
|
|
58
|
-
handleWorkspaceModules(outputDirectory, packageJson, context.projectGraph);
|
|
47
|
+
handleWorkspaceModules(outputDirectory, packageJson, context.projectGraph, context.projectGraph.nodes[project].data.root);
|
|
59
48
|
devkit_1.logger.log('Success!');
|
|
60
49
|
return { success: true };
|
|
61
50
|
}
|
|
62
|
-
function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
51
|
+
function handleWorkspaceModules(outputDirectory, packageJson, projectGraph, projectRoot) {
|
|
63
52
|
if (!workspace_module_sections_1.WORKSPACE_MODULE_INSTALL_SECTIONS.some((section) => packageJson[section])) {
|
|
64
53
|
return;
|
|
65
54
|
}
|
|
66
55
|
const workspaceModules = (0, internal_1.getWorkspacePackagesFromGraph)(projectGraph);
|
|
67
56
|
const catalogManager = (0, internal_1.getCatalogManager)(devkit_1.workspaceRoot);
|
|
68
|
-
// Only the pnpm prune
|
|
69
|
-
//
|
|
70
|
-
|
|
57
|
+
// Only the pnpm and Bun prune paths tell a vendored package from a workspace
|
|
58
|
+
// package of the same name. They also ship non-workspace local-path targets,
|
|
59
|
+
// so their manifests get their file:/link: specs relocated, except for Bun
|
|
60
|
+
// without the text bun.lock, whose output ships the manifest alone.
|
|
61
|
+
const packageManager = (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot);
|
|
62
|
+
const isPnpmWorkspace = packageManager === 'pnpm';
|
|
63
|
+
const resolvesLocalPaths = isPnpmWorkspace || packageManager === 'bun';
|
|
64
|
+
const relocatesLocalPaths = isPnpmWorkspace ||
|
|
65
|
+
(packageManager === 'bun' && (0, internal_1.hasTextBunLockfile)(devkit_1.workspaceRoot));
|
|
66
|
+
const resolveModule = (name, spec, dependentRoot) => resolvesLocalPaths
|
|
67
|
+
? (0, internal_1.resolveWorkspaceModuleDependency)(workspaceModules, name, spec, dependentRoot, devkit_1.workspaceRoot)
|
|
68
|
+
: workspaceModules.get(name);
|
|
71
69
|
const processedModules = new Set();
|
|
72
70
|
const workspaceModulesDir = (0, path_1.join)(outputDirectory, 'workspace_modules');
|
|
73
71
|
function calculateRelativePath(fromPkgName, toPkgName) {
|
|
@@ -77,17 +75,13 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
77
75
|
// Ensure forward slashes for file: protocol (Windows compatibility)
|
|
78
76
|
return relativePath.split(path_1.sep).join('/');
|
|
79
77
|
}
|
|
80
|
-
function processModule(pkgName) {
|
|
78
|
+
function processModule(pkgName, workspaceModuleProject) {
|
|
81
79
|
if (processedModules.has(pkgName)) {
|
|
82
80
|
devkit_1.logger.verbose(`Skipping ${pkgName} (already processed).`);
|
|
83
81
|
return;
|
|
84
82
|
}
|
|
85
|
-
if (!workspaceModules.has(pkgName)) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
83
|
processedModules.add(pkgName);
|
|
89
84
|
devkit_1.logger.verbose(`Copying ${pkgName}.`);
|
|
90
|
-
const workspaceModuleProject = workspaceModules.get(pkgName);
|
|
91
85
|
const workspaceModuleRoot = workspaceModuleProject.data.root;
|
|
92
86
|
// data.root is workspace-root-relative in the graph, but may arrive
|
|
93
87
|
// absolute; normalize so the local-path relocation math is in
|
|
@@ -120,13 +114,14 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
120
114
|
// Rewrite sibling workspace-module deps to file: paths and recurse. A peer
|
|
121
115
|
// is moved into dependencies (pnpm rejects a file: spec under
|
|
122
116
|
// peerDependencies), dropping its now-orphaned optional/required marker.
|
|
123
|
-
for (const section of TRANSITIVE_INSTALL_SECTIONS) {
|
|
117
|
+
for (const section of workspace_module_sections_1.TRANSITIVE_INSTALL_SECTIONS) {
|
|
124
118
|
const deps = copiedPackageJson[section];
|
|
125
119
|
if (!deps) {
|
|
126
120
|
continue;
|
|
127
121
|
}
|
|
128
122
|
for (const depName of Object.keys(deps)) {
|
|
129
|
-
|
|
123
|
+
const depModule = resolveModule(depName, deps[depName], moduleWsRelativeRoot);
|
|
124
|
+
if (depModule) {
|
|
130
125
|
const fileSpec = `file:${calculateRelativePath(pkgName, depName)}`;
|
|
131
126
|
if (section === 'peerDependencies') {
|
|
132
127
|
(0, internal_1.movePeerDependencyToDependencies)(copiedPackageJson, depName, fileSpec);
|
|
@@ -135,25 +130,28 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
135
130
|
deps[depName] = fileSpec;
|
|
136
131
|
}
|
|
137
132
|
packageJsonModified = true;
|
|
138
|
-
processModule(depName);
|
|
133
|
+
processModule(depName, depModule);
|
|
139
134
|
continue;
|
|
140
135
|
}
|
|
141
136
|
// A non-workspace file:/link: dep must keep resolving after the module
|
|
142
137
|
// moves. pnpm reads a non-importer manifest file: spec relative to the
|
|
143
138
|
// package dir but a link: spec relative to the install root, so each
|
|
144
|
-
// rebases onto a different base
|
|
145
|
-
|
|
139
|
+
// rebases onto a different base. Bun reads both relative to the
|
|
140
|
+
// package dir.
|
|
141
|
+
if (!relocatesLocalPaths) {
|
|
146
142
|
continue;
|
|
147
143
|
}
|
|
148
144
|
const spec = deps[depName];
|
|
149
|
-
const relocation = (0, internal_1.relocatePrunedLocalPathSpec)(spec, moduleWsRelativeRoot, spec.startsWith('link:')
|
|
145
|
+
const relocation = (0, internal_1.relocatePrunedLocalPathSpec)(spec, moduleWsRelativeRoot, isPnpmWorkspace && spec.startsWith('link:')
|
|
146
|
+
? ''
|
|
147
|
+
: `workspace_modules/${pkgName}`);
|
|
150
148
|
if (!relocation) {
|
|
151
149
|
continue;
|
|
152
150
|
}
|
|
153
151
|
if (relocation.reason) {
|
|
154
152
|
(0, internal_1.warnUnshippableLocalPathSpec)(`"${spec}" in ${pkgName}`, relocation.reason);
|
|
155
153
|
}
|
|
156
|
-
if (section === 'peerDependencies') {
|
|
154
|
+
if (section === 'peerDependencies' && isPnpmWorkspace) {
|
|
157
155
|
// Moved even when the target cannot ship: pnpm rejects the spec here
|
|
158
156
|
// either way.
|
|
159
157
|
(0, internal_1.movePeerDependencyToDependencies)(copiedPackageJson, depName, relocation.spec);
|
|
@@ -166,6 +164,13 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
166
164
|
}
|
|
167
165
|
}
|
|
168
166
|
(0, internal_1.dropEmptyPeerDependencySections)(copiedPackageJson);
|
|
167
|
+
// Bun resolves the devDependencies of a folder dependency the output
|
|
168
|
+
// manifest lists, but the pruned lockfile leaves them out and a
|
|
169
|
+
// `workspace:` one cannot resolve outside the workspace.
|
|
170
|
+
if (packageManager === 'bun' && copiedPackageJson.devDependencies) {
|
|
171
|
+
delete copiedPackageJson.devDependencies;
|
|
172
|
+
packageJsonModified = true;
|
|
173
|
+
}
|
|
169
174
|
if (packageJsonModified) {
|
|
170
175
|
(0, node_fs_1.writeFileSync)(copiedPackageJsonPath, JSON.stringify(copiedPackageJson, null, 2));
|
|
171
176
|
devkit_1.logger.verbose(`Updated package.json for ${pkgName}.`);
|
|
@@ -180,8 +185,11 @@ function handleWorkspaceModules(outputDirectory, packageJson, projectGraph) {
|
|
|
180
185
|
if (!deps) {
|
|
181
186
|
continue;
|
|
182
187
|
}
|
|
183
|
-
for (const pkgName of Object.
|
|
184
|
-
|
|
188
|
+
for (const [pkgName, spec] of Object.entries(deps)) {
|
|
189
|
+
const workspaceModule = resolveModule(pkgName, spec, projectRoot);
|
|
190
|
+
if (workspaceModule) {
|
|
191
|
+
processModule(pkgName, workspaceModule);
|
|
192
|
+
}
|
|
185
193
|
}
|
|
186
194
|
}
|
|
187
195
|
}
|
|
@@ -16,12 +16,15 @@ async function pruneLockfileExecutor(schema, context) {
|
|
|
16
16
|
const packageManager = (0, devkit_1.detectPackageManager)(devkit_1.workspaceRoot);
|
|
17
17
|
const { project } = (0, devkit_1.parseTargetString)(schema.buildTarget, context);
|
|
18
18
|
const projectRoot = context.projectGraph.nodes[project].data.root;
|
|
19
|
+
if (packageManager === 'bun') {
|
|
20
|
+
declareTransitiveFolderDependencies(packageJson, context.projectGraph, projectRoot);
|
|
21
|
+
}
|
|
19
22
|
(0, internal_1.generatePrunedDeployOutput)(packageJson, context.projectGraph, projectRoot, {
|
|
20
23
|
outputDirectory,
|
|
21
24
|
packageManager,
|
|
22
25
|
workspaceRoot: devkit_1.workspaceRoot,
|
|
23
26
|
});
|
|
24
|
-
rewriteWorkspaceModuleSpecifiers(packageJson, context.projectGraph);
|
|
27
|
+
rewriteWorkspaceModuleSpecifiers(packageJson, context.projectGraph, projectRoot, packageManager);
|
|
25
28
|
(0, fs_1.writeFileSync)((0, path_1.join)(outputDirectory, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
26
29
|
devkit_1.logger.log(`Pruned deploy output written to ${outputDirectory}`);
|
|
27
30
|
return {
|
|
@@ -32,19 +35,22 @@ async function pruneLockfileExecutor(schema, context) {
|
|
|
32
35
|
// standalone output installs them as pnpm `file:` directory dependencies.
|
|
33
36
|
// pnpm rejects a `file:` spec under peerDependencies, so a peer-declared
|
|
34
37
|
// workspace module is moved into dependencies instead (an optional peer
|
|
35
|
-
// becomes required, which is moot since the module is always copied in).
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
function rewriteWorkspaceModuleSpecifiers(packageJson, graph) {
|
|
38
|
+
// becomes required, which is moot since the module is always copied in). For
|
|
39
|
+
// pnpm and Bun, as in copy-workspace-modules, a `file:`/`link:` spec to another
|
|
40
|
+
// directory is a vendored package even when a workspace package has its name.
|
|
41
|
+
function rewriteWorkspaceModuleSpecifiers(packageJson, graph, projectRoot, packageManager) {
|
|
40
42
|
const workspacePackages = (0, internal_1.getWorkspacePackagesFromGraph)(graph);
|
|
43
|
+
const resolvesLocalPaths = packageManager === 'pnpm' || packageManager === 'bun';
|
|
41
44
|
for (const section of workspace_module_sections_1.WORKSPACE_MODULE_INSTALL_SECTIONS) {
|
|
42
45
|
const deps = packageJson[section];
|
|
43
46
|
if (!deps) {
|
|
44
47
|
continue;
|
|
45
48
|
}
|
|
46
|
-
for (const pkgName of Object.
|
|
47
|
-
|
|
49
|
+
for (const [pkgName, spec] of Object.entries(deps)) {
|
|
50
|
+
const isWorkspaceModule = resolvesLocalPaths
|
|
51
|
+
? (0, internal_1.resolveWorkspaceModuleDependency)(workspacePackages, pkgName, spec, projectRoot, devkit_1.workspaceRoot)
|
|
52
|
+
: workspacePackages.has(pkgName);
|
|
53
|
+
if (!isWorkspaceModule) {
|
|
48
54
|
continue;
|
|
49
55
|
}
|
|
50
56
|
const fileSpec = `file:./workspace_modules/${pkgName}`;
|
|
@@ -75,6 +81,97 @@ function mergeAllowScripts(packageJson) {
|
|
|
75
81
|
...packageJson.allowScripts,
|
|
76
82
|
};
|
|
77
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Bun never installs the dependencies of a `file:` dependency declared by
|
|
86
|
+
* another `file:` dependency, so a Bun output declares every workspace module
|
|
87
|
+
* the app reaches through other modules. With the text bun.lock it also
|
|
88
|
+
* declares each vendored `file:` package those modules declare, unless the
|
|
89
|
+
* manifest already declares that name. Without the text bun.lock, the output
|
|
90
|
+
* ships no vendored copy for that declaration to point at.
|
|
91
|
+
* A package a production section reaches goes to dependencies, one only
|
|
92
|
+
* devDependencies reach to devDependencies. A vendored package the modules
|
|
93
|
+
* declare only as optional goes to optionalDependencies instead, and is left
|
|
94
|
+
* out when only devDependencies reach them, since no section holds an
|
|
95
|
+
* optional devDependency. A vendored package is declared relative to
|
|
96
|
+
* `projectRoot`, like the app's own.
|
|
97
|
+
*/
|
|
98
|
+
function declareTransitiveFolderDependencies(packageJson, graph, projectRoot) {
|
|
99
|
+
const workspacePackages = (0, internal_1.getWorkspacePackagesFromGraph)(graph);
|
|
100
|
+
const shipsVendoredPackages = (0, internal_1.hasTextBunLockfile)(devkit_1.workspaceRoot);
|
|
101
|
+
const productionSections = workspace_module_sections_1.WORKSPACE_MODULE_INSTALL_SECTIONS.filter((section) => section !== 'devDependencies');
|
|
102
|
+
const resolveModule = (name, spec, dependentRoot) => (0, internal_1.resolveWorkspaceModuleDependency)(workspacePackages, name, spec, dependentRoot, devkit_1.workspaceRoot);
|
|
103
|
+
const visited = new Set();
|
|
104
|
+
const visit = (name, project, section) => {
|
|
105
|
+
if (visited.has(name)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
visited.add(name);
|
|
109
|
+
const declaredForProduction = productionSections.some((declared) => packageJson[declared]?.[name]);
|
|
110
|
+
if (!declaredForProduction &&
|
|
111
|
+
(section === 'dependencies' || !packageJson.devDependencies?.[name])) {
|
|
112
|
+
if (packageJson.devDependencies?.[name]) {
|
|
113
|
+
delete packageJson.devDependencies[name];
|
|
114
|
+
if (!Object.keys(packageJson.devDependencies).length) {
|
|
115
|
+
delete packageJson.devDependencies;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
(packageJson[section] ??= {})[name] = 'workspace:*';
|
|
119
|
+
}
|
|
120
|
+
const manifest = (0, devkit_1.readJsonFile)((0, path_1.join)(devkit_1.workspaceRoot, project.data.root, 'package.json'));
|
|
121
|
+
for (const transitiveSection of workspace_module_sections_1.TRANSITIVE_INSTALL_SECTIONS) {
|
|
122
|
+
for (const [dep, spec] of Object.entries(manifest[transitiveSection] ?? {})) {
|
|
123
|
+
const workspaceModule = resolveModule(dep, spec, project.data.root);
|
|
124
|
+
if (workspaceModule) {
|
|
125
|
+
visit(dep, workspaceModule, section);
|
|
126
|
+
}
|
|
127
|
+
else if (shipsVendoredPackages && spec.startsWith('file:')) {
|
|
128
|
+
if (transitiveSection !== 'optionalDependencies') {
|
|
129
|
+
declareVendored(dep, spec, project.data.root, section);
|
|
130
|
+
}
|
|
131
|
+
else if (section === 'dependencies') {
|
|
132
|
+
declareVendored(dep, spec, project.data.root, 'optionalDependencies');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
// Optional declarations made here, which a module requiring the same
|
|
139
|
+
// package promotes to dependencies.
|
|
140
|
+
const declaredOptional = new Set();
|
|
141
|
+
const declareVendored = (name, spec, moduleRoot, section) => {
|
|
142
|
+
if (section !== 'optionalDependencies' && declaredOptional.delete(name)) {
|
|
143
|
+
(packageJson.dependencies ??= {})[name] =
|
|
144
|
+
packageJson.optionalDependencies[name];
|
|
145
|
+
delete packageJson.optionalDependencies[name];
|
|
146
|
+
if (!Object.keys(packageJson.optionalDependencies).length) {
|
|
147
|
+
delete packageJson.optionalDependencies;
|
|
148
|
+
}
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (workspace_module_sections_1.WORKSPACE_MODULE_INSTALL_SECTIONS.some((declared) => packageJson[declared]?.[name])) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const path = (0, devkit_1.normalizePath)(spec.slice('file:'.length));
|
|
155
|
+
(packageJson[section] ??= {})[name] = (0, path_1.isAbsolute)(path)
|
|
156
|
+
? spec
|
|
157
|
+
: `file:${path_1.posix.relative(projectRoot, path_1.posix.join(moduleRoot, path))}`;
|
|
158
|
+
if (section === 'optionalDependencies') {
|
|
159
|
+
declaredOptional.add(name);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const visitDeclared = (section, visitAs) => {
|
|
163
|
+
for (const [name, spec] of Object.entries(packageJson[section] ?? {})) {
|
|
164
|
+
const workspaceModule = resolveModule(name, spec, projectRoot);
|
|
165
|
+
if (workspaceModule) {
|
|
166
|
+
visit(name, workspaceModule, visitAs);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
for (const section of productionSections) {
|
|
171
|
+
visitDeclared(section, 'dependencies');
|
|
172
|
+
}
|
|
173
|
+
visitDeclared('devDependencies', 'devDependencies');
|
|
174
|
+
}
|
|
78
175
|
function resolveCatalogReferences(packageJson) {
|
|
79
176
|
const manager = (0, internal_1.getCatalogManager)(devkit_1.workspaceRoot);
|
|
80
177
|
if (!manager) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PLACEHOLDER_AUTH_TOKEN = "secretVerdaccioToken";
|
|
2
|
+
/**
|
|
3
|
+
* Verdaccio 7+ answers 401 to a token it cannot decode, unless its config
|
|
4
|
+
* enables JWT tokens, which treat such a token as anonymous. Resolves `false`
|
|
5
|
+
* when the registry cannot be reached, so callers keep the token.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isPlaceholderAuthTokenRejected(registryUrl: string): Promise<boolean>;
|
|
8
|
+
export declare function warnPlaceholderAuthTokenRejected(registryUrl: string): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PLACEHOLDER_AUTH_TOKEN = void 0;
|
|
4
|
+
exports.isPlaceholderAuthTokenRejected = isPlaceholderAuthTokenRejected;
|
|
5
|
+
exports.warnPlaceholderAuthTokenRejected = warnPlaceholderAuthTokenRejected;
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
// npm and bun refuse to publish to a registry without a token for it
|
|
8
|
+
exports.PLACEHOLDER_AUTH_TOKEN = 'secretVerdaccioToken';
|
|
9
|
+
/**
|
|
10
|
+
* Verdaccio 7+ answers 401 to a token it cannot decode, unless its config
|
|
11
|
+
* enables JWT tokens, which treat such a token as anonymous. Resolves `false`
|
|
12
|
+
* when the registry cannot be reached, so callers keep the token.
|
|
13
|
+
*/
|
|
14
|
+
async function isPlaceholderAuthTokenRejected(registryUrl) {
|
|
15
|
+
try {
|
|
16
|
+
const response = await fetch(new URL('-/ping', registryUrl), {
|
|
17
|
+
headers: { authorization: `Bearer ${exports.PLACEHOLDER_AUTH_TOKEN}` },
|
|
18
|
+
signal: AbortSignal.timeout(5000),
|
|
19
|
+
});
|
|
20
|
+
return response.status === 401;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function warnPlaceholderAuthTokenRejected(registryUrl) {
|
|
27
|
+
devkit_1.logger.warn(`Verdaccio at ${registryUrl} rejects the placeholder npm auth token. Without a token, npm and bun cannot publish to the registry.
|
|
28
|
+
If the registry requires a login, publish with a token from \`npm login\`.
|
|
29
|
+
Otherwise, make Verdaccio accept the placeholder by adding the following to its config file. Existing tokens from \`npm login\` then stop working until users log in again.
|
|
30
|
+
|
|
31
|
+
security:
|
|
32
|
+
api:
|
|
33
|
+
jwt:
|
|
34
|
+
sign:
|
|
35
|
+
expiresIn: 7d`);
|
|
36
|
+
}
|
|
@@ -9,6 +9,7 @@ const detect_port_1 = tslib_1.__importDefault(require("detect-port"));
|
|
|
9
9
|
const node_fs_1 = require("node:fs");
|
|
10
10
|
const path_1 = require("path");
|
|
11
11
|
const semver_1 = require("semver");
|
|
12
|
+
const placeholder_auth_token_1 = require("./placeholder-auth-token");
|
|
12
13
|
let childProcess;
|
|
13
14
|
let env = {
|
|
14
15
|
SKIP_YARN_COREPACK_CHECK: 'true',
|
|
@@ -38,7 +39,8 @@ async function verdaccioExecutor(options, context) {
|
|
|
38
39
|
devkit_1.logger.info(`Port ${options.port} was occupied. Using port ${port}.`);
|
|
39
40
|
options.port = port;
|
|
40
41
|
}
|
|
41
|
-
const
|
|
42
|
+
const npm = options.location === 'none' ? undefined : setupNpm(options);
|
|
43
|
+
const cleanupFunctions = npm ? [npm.cleanup, setupYarn(options)] : [];
|
|
42
44
|
const processExitListener = (signal) => {
|
|
43
45
|
for (const fn of cleanupFunctions) {
|
|
44
46
|
fn();
|
|
@@ -52,7 +54,7 @@ async function verdaccioExecutor(options, context) {
|
|
|
52
54
|
process.on('SIGINT', processExitListener);
|
|
53
55
|
process.on('SIGHUP', processExitListener);
|
|
54
56
|
try {
|
|
55
|
-
await startVerdaccio(options, context.root);
|
|
57
|
+
await startVerdaccio(options, context.root, npm?.authTokenSet ?? false);
|
|
56
58
|
}
|
|
57
59
|
catch (e) {
|
|
58
60
|
devkit_1.logger.error('Failed to start verdaccio: ' + e?.toString());
|
|
@@ -76,7 +78,7 @@ function getVerdaccioBinPath() {
|
|
|
76
78
|
/**
|
|
77
79
|
* Fork the verdaccio process: https://verdaccio.org/docs/verdaccio-programmatically/#using-fork-from-child_process-module
|
|
78
80
|
*/
|
|
79
|
-
function startVerdaccio(options, workspaceRoot) {
|
|
81
|
+
function startVerdaccio(options, workspaceRoot, npmAuthTokenSet) {
|
|
80
82
|
return new Promise((resolve, reject) => {
|
|
81
83
|
childProcess = (0, child_process_1.fork)(getVerdaccioBinPath(), createVerdaccioOptions(options, workspaceRoot), {
|
|
82
84
|
env: {
|
|
@@ -91,12 +93,25 @@ function startVerdaccio(options, workspaceRoot) {
|
|
|
91
93
|
childProcess.on('error', (err) => {
|
|
92
94
|
reject(err);
|
|
93
95
|
});
|
|
94
|
-
childProcess.on('message', (message) => {
|
|
95
|
-
if (message?.verdaccio_started
|
|
96
|
-
|
|
96
|
+
childProcess.on('message', async (message) => {
|
|
97
|
+
if (message?.verdaccio_started !== true) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const address = getVerdaccioAddress(options);
|
|
101
|
+
const url = address ? getVerdaccioListeningUrl(address) : undefined;
|
|
102
|
+
// Dependent tasks start on readiness, so drop a rejected token first
|
|
103
|
+
if (npmAuthTokenSet && url) {
|
|
104
|
+
await removeRejectedNpmAuthToken(options, url);
|
|
105
|
+
}
|
|
106
|
+
if (address) {
|
|
107
|
+
// startLocalRegistry waits for an address on stdout, and Verdaccio 7
|
|
108
|
+
// logs its own at info level, which the generated config hides
|
|
109
|
+
devkit_1.logger.info(`Verdaccio is listening on ${address}`);
|
|
110
|
+
}
|
|
111
|
+
if (process.env.NX_READY_SIGNAL_SOCKET) {
|
|
97
112
|
// Nx versions without signal readiness do not export this API.
|
|
98
113
|
const { emitReadySignal } = require('@nx/devkit');
|
|
99
|
-
emitReadySignal(
|
|
114
|
+
emitReadySignal(url);
|
|
100
115
|
}
|
|
101
116
|
});
|
|
102
117
|
childProcess.on('disconnect', (err) => {
|
|
@@ -114,7 +129,9 @@ function startVerdaccio(options, workspaceRoot) {
|
|
|
114
129
|
});
|
|
115
130
|
});
|
|
116
131
|
}
|
|
117
|
-
|
|
132
|
+
// Keeps wildcard hosts like Verdaccio's own address line, because
|
|
133
|
+
// startLocalRegistry matches the host its caller passes
|
|
134
|
+
function getVerdaccioAddress(options) {
|
|
118
135
|
const listenAddress = options.listenAddress
|
|
119
136
|
? `${options.listenAddress}:${options.port}`
|
|
120
137
|
: String(options.port);
|
|
@@ -123,9 +140,10 @@ function getVerdaccioListeningUrl(options) {
|
|
|
123
140
|
if (!address)
|
|
124
141
|
return undefined;
|
|
125
142
|
const endpoint = `${address[1] ?? 'http'}://${address[2] || 'localhost'}:${address[3]}/`;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
143
|
+
return URL.canParse(endpoint) ? new URL(endpoint).href : undefined;
|
|
144
|
+
}
|
|
145
|
+
function getVerdaccioListeningUrl(address) {
|
|
146
|
+
const url = new URL(address);
|
|
129
147
|
if (url.hostname === '0.0.0.0')
|
|
130
148
|
url.hostname = '127.0.0.1';
|
|
131
149
|
if (url.hostname === '[::]')
|
|
@@ -148,12 +166,27 @@ function createVerdaccioOptions(options, workspaceRoot) {
|
|
|
148
166
|
}
|
|
149
167
|
return verdaccioArgs;
|
|
150
168
|
}
|
|
169
|
+
function getNpmAuthTokenKey(options) {
|
|
170
|
+
return `//${options.listenAddress}:${options.port}/:_authToken`;
|
|
171
|
+
}
|
|
172
|
+
async function removeRejectedNpmAuthToken(options, registryUrl) {
|
|
173
|
+
if (!(await (0, placeholder_auth_token_1.isPlaceholderAuthTokenRejected)(registryUrl))) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
(0, child_process_1.execSync)(`npm config delete ${getNpmAuthTokenKey(options)} --location ${options.location}`, { env, windowsHide: true });
|
|
178
|
+
}
|
|
179
|
+
catch (e) {
|
|
180
|
+
devkit_1.logger.warn(`Failed to remove the npm auth token: ${e.message}`);
|
|
181
|
+
}
|
|
182
|
+
(0, placeholder_auth_token_1.warnPlaceholderAuthTokenRejected)(registryUrl);
|
|
183
|
+
}
|
|
151
184
|
function setupNpm(options) {
|
|
152
185
|
try {
|
|
153
186
|
(0, child_process_1.execSync)('npm --version', { env, windowsHide: true });
|
|
154
187
|
}
|
|
155
188
|
catch (e) {
|
|
156
|
-
return () => { };
|
|
189
|
+
return { cleanup: () => { }, authTokenSet: false };
|
|
157
190
|
}
|
|
158
191
|
let npmRegistryPaths = [];
|
|
159
192
|
const scopes = ['', ...(options.scopes || [])];
|
|
@@ -167,14 +200,14 @@ function setupNpm(options) {
|
|
|
167
200
|
?.replace('\u001b[2K\u001b[1G', '') // strip out ansi codes
|
|
168
201
|
);
|
|
169
202
|
(0, child_process_1.execSync)(`npm config set ${registryName} http://${options.listenAddress}:${options.port}/ --location ${options.location}`, { env, windowsHide: true });
|
|
170
|
-
(0, child_process_1.execSync)(`npm config set
|
|
203
|
+
(0, child_process_1.execSync)(`npm config set ${getNpmAuthTokenKey(options)}="${placeholder_auth_token_1.PLACEHOLDER_AUTH_TOKEN}" --location ${options.location}`, { env, windowsHide: true });
|
|
171
204
|
devkit_1.logger.info(`Set npm ${registryName} to http://${options.listenAddress}:${options.port}/`);
|
|
172
205
|
}
|
|
173
206
|
catch (e) {
|
|
174
207
|
throw new Error(`Failed to set npm ${registryName} to http://${options.listenAddress}:${options.port}/: ${e.message}`);
|
|
175
208
|
}
|
|
176
209
|
});
|
|
177
|
-
|
|
210
|
+
const cleanup = () => {
|
|
178
211
|
try {
|
|
179
212
|
const currentNpmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}`, { env, windowsHide: true })
|
|
180
213
|
?.toString()
|
|
@@ -195,12 +228,13 @@ function setupNpm(options) {
|
|
|
195
228
|
devkit_1.logger.info('Cleared custom npm registry');
|
|
196
229
|
}
|
|
197
230
|
});
|
|
198
|
-
(0, child_process_1.execSync)(`npm config delete
|
|
231
|
+
(0, child_process_1.execSync)(`npm config delete ${getNpmAuthTokenKey(options)} --location ${options.location}`, { env, windowsHide: true });
|
|
199
232
|
}
|
|
200
233
|
catch (e) {
|
|
201
234
|
throw new Error(`Failed to reset npm registry: ${e.message}`);
|
|
202
235
|
}
|
|
203
236
|
};
|
|
237
|
+
return { cleanup, authTokenSet: true };
|
|
204
238
|
}
|
|
205
239
|
catch (e) {
|
|
206
240
|
throw new Error(`Failed to set npm registry to http://${options.listenAddress}:${options.port}/: ${e.message}`);
|
|
@@ -26,3 +26,11 @@ log:
|
|
|
26
26
|
|
|
27
27
|
publish:
|
|
28
28
|
allow_offline: true # set offline to true to allow publish offline
|
|
29
|
+
|
|
30
|
+
# jwt tokens make verdaccio 7+ treat the placeholder npm auth token set by nx
|
|
31
|
+
# as anonymous instead of rejecting it
|
|
32
|
+
security:
|
|
33
|
+
api:
|
|
34
|
+
jwt:
|
|
35
|
+
sign:
|
|
36
|
+
expiresIn: 7d
|
|
@@ -25,6 +25,7 @@ async function syncGenerator(tree) {
|
|
|
25
25
|
composite: new Map(),
|
|
26
26
|
content: new Map(),
|
|
27
27
|
exists: new Map(),
|
|
28
|
+
extendedConfigs: new Map(),
|
|
28
29
|
};
|
|
29
30
|
// Root tsconfig containing project references for the whole workspace
|
|
30
31
|
const rootTsconfigPath = 'tsconfig.json';
|
|
@@ -148,7 +149,7 @@ async function syncGenerator(tree) {
|
|
|
148
149
|
// duplicate the project references in the tsconfig.json file
|
|
149
150
|
let keepReferencesInTsconfigJson = true;
|
|
150
151
|
if (foundRuntimeTsConfig) {
|
|
151
|
-
const sourceProjectTsconfig = parseTsconfig(sourceProjectTsconfigPath, tsSysFromTree);
|
|
152
|
+
const sourceProjectTsconfig = parseTsconfig(sourceProjectTsconfigPath, tsSysFromTree, tsconfigInfoCaches);
|
|
152
153
|
keepReferencesInTsconfigJson = sourceProjectTsconfig.fileNames.length > 0;
|
|
153
154
|
}
|
|
154
155
|
updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, sourceProjectTsconfigPath, keepReferencesInTsconfigJson ? dependencies : [], sourceProjectNode.data.root, projectRoots, changedFiles);
|
|
@@ -185,8 +186,8 @@ function readRawTsconfigContents(tree, tsconfigInfoCaches, tsconfigPath) {
|
|
|
185
186
|
}
|
|
186
187
|
return tsconfigInfoCaches.content.get(tsconfigPath);
|
|
187
188
|
}
|
|
188
|
-
function parseTsconfig(tsconfigPath, sys) {
|
|
189
|
-
return ts.parseJsonConfigFileContent(ts.readConfigFile(tsconfigPath, sys.readFile).config, sys, (0, posix_1.dirname)(tsconfigPath));
|
|
189
|
+
function parseTsconfig(tsconfigPath, sys, tsconfigInfoCaches) {
|
|
190
|
+
return ts.parseJsonConfigFileContent(ts.readConfigFile(tsconfigPath, sys.readFile).config, sys, (0, posix_1.dirname)(tsconfigPath), undefined, undefined, undefined, undefined, tsconfigInfoCaches.extendedConfigs);
|
|
190
191
|
}
|
|
191
192
|
/**
|
|
192
193
|
* Within the context of a sync generator, performance is a key concern,
|
|
@@ -412,10 +413,7 @@ function patchTsconfigJsonReferences(tree, tsconfigInfoCaches, tsconfigPath, upd
|
|
|
412
413
|
}
|
|
413
414
|
function hasCompositeEnabled(tsSysFromTree, tsconfigInfoCaches, tsconfigPath) {
|
|
414
415
|
if (!tsconfigInfoCaches.composite.has(tsconfigPath)) {
|
|
415
|
-
const parsed = parseTsconfig(tsconfigPath, {
|
|
416
|
-
...tsSysFromTree,
|
|
417
|
-
readDirectory: () => [],
|
|
418
|
-
});
|
|
416
|
+
const parsed = parseTsconfig(tsconfigPath, { ...tsSysFromTree, readDirectory: () => [] }, tsconfigInfoCaches);
|
|
419
417
|
tsconfigInfoCaches.composite.set(tsconfigPath, parsed.options.composite === true);
|
|
420
418
|
}
|
|
421
419
|
return tsconfigInfoCaches.composite.get(tsconfigPath);
|
|
@@ -4,11 +4,6 @@ import { type Tree } from '@nx/devkit';
|
|
|
4
4
|
* build targets that emit the pruned pnpm deploy output. The build approvals
|
|
5
5
|
* and `supportedArchitectures` those outputs carry reach no lockfile, so
|
|
6
6
|
* without these a revoked approval leaves the task hash unchanged and a cached
|
|
7
|
-
* run replays an output that still grants it.
|
|
8
|
-
* the `@nx/webpack` and `@nx/rspack` plugins themselves; this migration covers
|
|
9
|
-
* the explicitly configured executor targets, plus overlays of inferred
|
|
10
|
-
* targets (a project-level entry, under the exact name or a glob-pattern key
|
|
11
|
-
* matching it, or a matching `targetDefaults` entry) whose replacing `inputs`
|
|
12
|
-
* array discards the plugin-generated one.
|
|
7
|
+
* run replays an output that still grants it.
|
|
13
8
|
*/
|
|
14
9
|
export default function update(tree: Tree): Promise<void>;
|