@nx/js 24.0.6 → 24.1.0-beta.1

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/babel.d.ts CHANGED
@@ -5,9 +5,4 @@ export interface NxWebBabelPresetOptions {
5
5
  legacy?: boolean;
6
6
  };
7
7
  loose?: boolean;
8
- /** @deprecated Use `loose` option instead of `classProperties.loose`
9
- */
10
- classProperties?: {
11
- loose?: boolean;
12
- };
13
8
  }
package/dist/babel.js CHANGED
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const path_1 = require("path");
4
4
  const semver_1 = require("semver");
5
- const devkit_1 = require("@nx/devkit");
6
5
  module.exports = function (api, options = {}) {
7
6
  api.assertVersion(7);
8
7
  const isModern = api.caller((caller) => caller?.isModern);
@@ -11,13 +10,7 @@ module.exports = function (api, options = {}) {
11
10
  // This is set by `@nx/rollup:rollup` executor
12
11
  const isNxPackage = api.caller((caller) => caller?.isNxPackage);
13
12
  const emitDecoratorMetadata = api.caller((caller) => caller?.emitDecoratorMetadata ?? true);
14
- // Determine settings for `@babel//babel-plugin-transform-class-properties`,
15
- // so that we can sync the `loose` option with `@babel/preset-env`.
16
- // TODO(v21): Remove classProperties since it's no longer needed, now that the class props transform is in preset-env.
17
- const loose = options.classProperties?.loose ?? options.loose ?? true;
18
- if (options.classProperties) {
19
- devkit_1.logger.warn(`Use =\`loose\` option instead of \`classProperties.loose\`. The \`classProperties\` option will be removed in Nx 20`);
20
- }
13
+ const loose = options.loose ?? true;
21
14
  const plugins = [
22
15
  !isNxPackage
23
16
  ? [
@@ -35,4 +35,4 @@ export { stripGlobToBaseDir } from './src/utils/strip-glob-to-base-dir';
35
35
  export { addLocalRegistryScripts } from './src/utils/add-local-registry-scripts';
36
36
  export type { LibraryGeneratorSchema } from './src/generators/library/schema';
37
37
  export { addReleaseConfigForNonTsSolution, addReleaseConfigForTsSolution, releaseTasks, } from './src/generators/library/utils/add-release-config';
38
- export { nxVersion, esbuildVersion, prettierVersion, swcCliVersion, swcCoreVersion, swcHelpersVersion, swcNodeVersion, tsLibVersion, typesNodeVersion, } from './src/utils/versions';
38
+ export { nxVersion, esbuildVersion, prettierVersion, swcCliVersion, swcCoreVersion, swcHelpersVersion, swcNodeVersion, tsLibVersion, typesNodeVersion, typescriptVersion, } from './src/utils/versions';
package/dist/internal.js CHANGED
@@ -6,7 +6,7 @@
6
6
  // the @nx/js equivalent of `@nx/devkit/internal`.
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.getProjectPackageManagerWorkspaceStateWarningTask = exports.getProjectPackageManagerWorkspaceState = 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.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 = exports.normalizeLinterOption = exports.selectTypecheckTsConfig = exports.createTypecheckTarget = exports.isValidPackageJsonBuildConfig = exports.addBuildAndWatchDepsTargets = exports.findNpmDependencies = 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 = 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; } });
@@ -133,3 +133,4 @@ Object.defineProperty(exports, "swcHelpersVersion", { enumerable: true, get: fun
133
133
  Object.defineProperty(exports, "swcNodeVersion", { enumerable: true, get: function () { return versions_1.swcNodeVersion; } });
134
134
  Object.defineProperty(exports, "tsLibVersion", { enumerable: true, get: function () { return versions_1.tsLibVersion; } });
135
135
  Object.defineProperty(exports, "typesNodeVersion", { enumerable: true, get: function () { return versions_1.typesNodeVersion; } });
136
+ Object.defineProperty(exports, "typescriptVersion", { enumerable: true, get: function () { return versions_1.typescriptVersion; } });
@@ -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 cleanupFunctions = options.location === 'none' ? [] : [setupNpm(options), setupYarn(options)];
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,6 +93,27 @@ function startVerdaccio(options, workspaceRoot) {
91
93
  childProcess.on('error', (err) => {
92
94
  reject(err);
93
95
  });
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) {
112
+ // Nx versions without signal readiness do not export this API.
113
+ const { emitReadySignal } = require('@nx/devkit');
114
+ emitReadySignal(url);
115
+ }
116
+ });
94
117
  childProcess.on('disconnect', (err) => {
95
118
  reject(err);
96
119
  });
@@ -106,6 +129,27 @@ function startVerdaccio(options, workspaceRoot) {
106
129
  });
107
130
  });
108
131
  }
132
+ // Keeps wildcard hosts like Verdaccio's own address line, because
133
+ // startLocalRegistry matches the host its caller passes
134
+ function getVerdaccioAddress(options) {
135
+ const listenAddress = options.listenAddress
136
+ ? `${options.listenAddress}:${options.port}`
137
+ : String(options.port);
138
+ // Verdaccio accepts protocol prefixes without "//" and an empty host.
139
+ const address = /^(?:(https?):(?:\/\/)?)?(?:([^/:]*|\[[^\[\]]+\]):)?(\d+)\/?$/.exec(listenAddress);
140
+ if (!address)
141
+ return undefined;
142
+ const endpoint = `${address[1] ?? 'http'}://${address[2] || 'localhost'}:${address[3]}/`;
143
+ return URL.canParse(endpoint) ? new URL(endpoint).href : undefined;
144
+ }
145
+ function getVerdaccioListeningUrl(address) {
146
+ const url = new URL(address);
147
+ if (url.hostname === '0.0.0.0')
148
+ url.hostname = '127.0.0.1';
149
+ if (url.hostname === '[::]')
150
+ url.hostname = '[::1]';
151
+ return url.href;
152
+ }
109
153
  function createVerdaccioOptions(options, workspaceRoot) {
110
154
  const verdaccioArgs = [];
111
155
  if (options.config) {
@@ -122,12 +166,27 @@ function createVerdaccioOptions(options, workspaceRoot) {
122
166
  }
123
167
  return verdaccioArgs;
124
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
+ }
125
184
  function setupNpm(options) {
126
185
  try {
127
186
  (0, child_process_1.execSync)('npm --version', { env, windowsHide: true });
128
187
  }
129
188
  catch (e) {
130
- return () => { };
189
+ return { cleanup: () => { }, authTokenSet: false };
131
190
  }
132
191
  let npmRegistryPaths = [];
133
192
  const scopes = ['', ...(options.scopes || [])];
@@ -141,14 +200,14 @@ function setupNpm(options) {
141
200
  ?.replace('\u001b[2K\u001b[1G', '') // strip out ansi codes
142
201
  );
143
202
  (0, child_process_1.execSync)(`npm config set ${registryName} http://${options.listenAddress}:${options.port}/ --location ${options.location}`, { env, windowsHide: true });
144
- (0, child_process_1.execSync)(`npm config set //${options.listenAddress}:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`, { env, windowsHide: true });
203
+ (0, child_process_1.execSync)(`npm config set ${getNpmAuthTokenKey(options)}="${placeholder_auth_token_1.PLACEHOLDER_AUTH_TOKEN}" --location ${options.location}`, { env, windowsHide: true });
145
204
  devkit_1.logger.info(`Set npm ${registryName} to http://${options.listenAddress}:${options.port}/`);
146
205
  }
147
206
  catch (e) {
148
207
  throw new Error(`Failed to set npm ${registryName} to http://${options.listenAddress}:${options.port}/: ${e.message}`);
149
208
  }
150
209
  });
151
- return () => {
210
+ const cleanup = () => {
152
211
  try {
153
212
  const currentNpmRegistryPath = (0, child_process_1.execSync)(`npm config get registry --location ${options.location}`, { env, windowsHide: true })
154
213
  ?.toString()
@@ -169,12 +228,13 @@ function setupNpm(options) {
169
228
  devkit_1.logger.info('Cleared custom npm registry');
170
229
  }
171
230
  });
172
- (0, child_process_1.execSync)(`npm config delete //${options.listenAddress}:${options.port}/:_authToken --location ${options.location}`, { env, windowsHide: true });
231
+ (0, child_process_1.execSync)(`npm config delete ${getNpmAuthTokenKey(options)} --location ${options.location}`, { env, windowsHide: true });
173
232
  }
174
233
  catch (e) {
175
234
  throw new Error(`Failed to reset npm registry: ${e.message}`);
176
235
  }
177
236
  };
237
+ return { cleanup, authTokenSet: true };
178
238
  }
179
239
  catch (e) {
180
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';
@@ -132,7 +133,7 @@ async function syncGenerator(tree) {
132
133
  continue;
133
134
  }
134
135
  // Collect the dependencies of the source project
135
- const dependencies = collectProjectDependencies(tree, projectName, projectGraph, collectedDependencies);
136
+ const dependencies = collectProjectDependencies(projectName, projectGraph, collectedDependencies);
136
137
  let foundRuntimeTsConfig = false;
137
138
  for (const runtimeTsConfigFileName of runtimeTsConfigFileNames) {
138
139
  const runtimeTsConfigPath = (0, devkit_1.joinPathFragments)(sourceProjectNode.data.root, runtimeTsConfigFileName);
@@ -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,
@@ -233,7 +234,7 @@ function updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, tsCon
233
234
  // reference path is relative to the tsconfig file
234
235
  const resolvedRefPath = getTsConfigPathFromReferencePath(tsConfigPath, ref.path);
235
236
  if (isProjectReferenceWithinNxProject(resolvedRefPath, projectRoot, projectRoots) ||
236
- isProjectReferenceIgnored(tree, resolvedRefPath)) {
237
+ isProjectReferenceIgnored(tree, tsconfigInfoCaches, resolvedRefPath)) {
237
238
  // we keep all references within the current Nx project or that are ignored
238
239
  references.push(ref);
239
240
  newReferencesSet.add(normalizedPath);
@@ -313,7 +314,7 @@ function updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, tsCon
313
314
  // TODO(leo): follow up with the TypeScript team to confirm if we really need
314
315
  // to reference transitive dependencies.
315
316
  // Collect the dependencies of a project recursively sorted from root to leaf
316
- function collectProjectDependencies(tree, projectName, projectGraph, collectedDependencies) {
317
+ function collectProjectDependencies(projectName, projectGraph, collectedDependencies) {
317
318
  if (collectedDependencies.has(projectName)) {
318
319
  // We've already collected the dependencies for this project
319
320
  return collectedDependencies.get(projectName);
@@ -335,7 +336,7 @@ function collectProjectDependencies(tree, projectName, projectGraph, collectedDe
335
336
  continue;
336
337
  }
337
338
  // Recursively get the dependencies of the target project
338
- const transitiveDependencies = collectProjectDependencies(tree, dep.target, projectGraph, collectedDependencies);
339
+ const transitiveDependencies = collectProjectDependencies(dep.target, projectGraph, collectedDependencies);
339
340
  for (const transitiveDep of transitiveDependencies) {
340
341
  if (!collectedDependencies
341
342
  .get(projectName)
@@ -374,16 +375,19 @@ function isProjectReferenceWithinNxProject(refTsConfigPath, projectRoot, project
374
375
  // it's inside the project root, so it's an internal project reference
375
376
  return true;
376
377
  }
377
- function isProjectReferenceIgnored(tree, refTsConfigPath) {
378
- const ig = (0, ignore_1.default)();
379
- if (tree.exists('.gitignore')) {
380
- ig.add('.git');
381
- ig.add(tree.read('.gitignore', 'utf-8'));
382
- }
383
- if (tree.exists('.nxignore')) {
384
- ig.add(tree.read('.nxignore', 'utf-8'));
378
+ function isProjectReferenceIgnored(tree, tsconfigInfoCaches, refTsConfigPath) {
379
+ if (!tsconfigInfoCaches.ignore) {
380
+ const ig = (0, ignore_1.default)();
381
+ if (tree.exists('.gitignore')) {
382
+ ig.add('.git');
383
+ ig.add(tree.read('.gitignore', 'utf-8'));
384
+ }
385
+ if (tree.exists('.nxignore')) {
386
+ ig.add(tree.read('.nxignore', 'utf-8'));
387
+ }
388
+ tsconfigInfoCaches.ignore = ig;
385
389
  }
386
- return ig.ignores(refTsConfigPath);
390
+ return tsconfigInfoCaches.ignore.ignores(refTsConfigPath);
387
391
  }
388
392
  function getTsConfigDirName(tsConfigPath) {
389
393
  return tsConfigPath.endsWith('.json')
@@ -409,7 +413,7 @@ function patchTsconfigJsonReferences(tree, tsconfigInfoCaches, tsconfigPath, upd
409
413
  }
410
414
  function hasCompositeEnabled(tsSysFromTree, tsconfigInfoCaches, tsconfigPath) {
411
415
  if (!tsconfigInfoCaches.composite.has(tsconfigPath)) {
412
- const parsed = parseTsconfig(tsconfigPath, tsSysFromTree);
416
+ const parsed = parseTsconfig(tsconfigPath, { ...tsSysFromTree, readDirectory: () => [] }, tsconfigInfoCaches);
413
417
  tsconfigInfoCaches.composite.set(tsconfigPath, parsed.options.composite === true);
414
418
  }
415
419
  return tsconfigInfoCaches.composite.get(tsconfigPath);
@@ -0,0 +1,10 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function addVerdaccioJwtSecurity(tree: Tree): Promise<{
3
+ nextSteps: string[];
4
+ agentContext: string[];
5
+ skipAgentic?: undefined;
6
+ } | {
7
+ nextSteps?: undefined;
8
+ agentContext?: undefined;
9
+ skipAgentic: boolean;
10
+ }>;
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = addVerdaccioJwtSecurity;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const internal_1 = require("@nx/devkit/internal");
6
+ const js_yaml_1 = require("@zkochan/js-yaml");
7
+ const target_defaults_matching_1 = require("../../utils/target-defaults-matching");
8
+ const VERDACCIO_EXECUTOR = '@nx/js:verdaccio';
9
+ // The groups Verdaccio gives a user that is not logged in
10
+ const ANONYMOUS_GROUPS = new Set(['$all', '$anonymous', '@all', '@anonymous']);
11
+ const JWT_SECURITY_BLOCK = `# jwt tokens make verdaccio 7+ treat the placeholder npm auth token set by nx
12
+ # as anonymous instead of rejecting it
13
+ security:
14
+ api:
15
+ jwt:
16
+ sign:
17
+ expiresIn: 7d
18
+ `;
19
+ const MANUAL_STEP = 'To let Verdaccio 7+ accept the placeholder npm auth token that Nx sets, set `security.api.jwt.sign.expiresIn` (for example to `7d`) in it.';
20
+ async function addVerdaccioJwtSecurity(tree) {
21
+ const nextSteps = [];
22
+ for (const path of findVerdaccioConfigPaths(tree)) {
23
+ if (!tree.exists(path))
24
+ continue;
25
+ const content = tree.read(path, 'utf-8');
26
+ const config = parseYamlMap(content);
27
+ if (!config) {
28
+ nextSteps.push(`Could not parse ${path}. ${MANUAL_STEP}`);
29
+ continue;
30
+ }
31
+ if (acceptsPlaceholderToken(config))
32
+ continue;
33
+ if (reliesOnLoggedInUsers(config)) {
34
+ nextSteps.push(`${path} relies on logged-in users, so it was not changed. On Verdaccio 7+, npm and bun need a token from \`npm login\` to publish to it. Setting \`security.api.jwt\` would let them publish packages open to anonymous users with the placeholder npm auth token that Nx sets. It would also make existing tokens from \`npm login\` stop working until users log in again.`);
35
+ continue;
36
+ }
37
+ if ('security' in config) {
38
+ nextSteps.push(`${path} already has a \`security\` section, so it was not changed. ${MANUAL_STEP}`);
39
+ continue;
40
+ }
41
+ const updated = `${content}${content.endsWith('\n') ? '' : '\n'}\n${JWT_SECURITY_BLOCK}`;
42
+ // Appending breaks configs written as a single flow mapping
43
+ if (!parseYamlMap(updated)?.security?.api?.jwt?.sign) {
44
+ nextSteps.push(`Could not update ${path}. ${MANUAL_STEP}`);
45
+ continue;
46
+ }
47
+ tree.write(path, updated);
48
+ }
49
+ return nextSteps.length
50
+ ? { nextSteps, agentContext: nextSteps }
51
+ : { skipAgentic: true };
52
+ }
53
+ function findVerdaccioConfigPaths(tree) {
54
+ const targetDefaults = (0, devkit_1.readNxJson)(tree)?.targetDefaults;
55
+ const paths = new Set();
56
+ for (const [projectName, project] of (0, devkit_1.getProjects)(tree)) {
57
+ const projectNode = {
58
+ name: projectName,
59
+ type: project.projectType === 'application' ? 'app' : 'lib',
60
+ data: project,
61
+ };
62
+ for (const [targetName, projectTarget] of Object.entries(project.targets ?? {})) {
63
+ try {
64
+ const target = resolveTarget({ targetName, projectName, projectNode, target: projectTarget }, targetDefaults);
65
+ if (target.executor !== VERDACCIO_EXECUTOR)
66
+ continue;
67
+ for (const options of [
68
+ target.options,
69
+ ...Object.values(target.configurations ?? {}),
70
+ ]) {
71
+ if (typeof options?.config !== 'string')
72
+ continue;
73
+ const { config } = (0, internal_1.resolveNxTokensInOptions)({ config: options.config }, project, `${projectName}:${targetName}`);
74
+ paths.add((0, devkit_1.joinPathFragments)(config));
75
+ }
76
+ }
77
+ catch {
78
+ // Project graph creation fails on targets that cannot be resolved, so no task reads them
79
+ }
80
+ }
81
+ }
82
+ return paths;
83
+ }
84
+ // Like project graph creation: `command` means nx:run-commands, defaults entries incompatible
85
+ // with the target are dropped, and the rest merge in order, so an incompatible one replaces earlier ones
86
+ function resolveTarget(ref, targetDefaults) {
87
+ const root = ref.projectNode.data.root;
88
+ const target = (0, internal_1.resolveCommandSyntacticSugar)(ref.target, root);
89
+ const matchedRef = {
90
+ ...ref,
91
+ target,
92
+ matcherExecutor: target.executor,
93
+ };
94
+ const key = targetDefaults
95
+ ? (0, target_defaults_matching_1.selectDefaultsKey)(matchedRef, targetDefaults, target.executor)
96
+ : null;
97
+ let defaults;
98
+ for (const entry of (0, target_defaults_matching_1.compatibleDefaultsEntries)(matchedRef, key, targetDefaults)) {
99
+ // The reader merges a key's entries without resolving `command`, so read one at a time
100
+ const matched = (0, internal_1.readTargetDefaultsForTarget)(ref.targetName, { [key]: [entry] }, target.executor, { projectName: ref.projectName, projectNode: ref.projectNode });
101
+ if (matched) {
102
+ defaults = (0, internal_1.mergeTargetConfigurations)((0, internal_1.resolveCommandSyntacticSugar)(matched, root), defaults);
103
+ }
104
+ }
105
+ return defaults ? (0, internal_1.mergeTargetConfigurations)(target, defaults) : target;
106
+ }
107
+ // Verdaccio 7+ rejects undecodable tokens only while `security.api.legacy` is on and `jwt` is unset
108
+ function acceptsPlaceholderToken(config) {
109
+ return (config.security?.api?.jwt != null || config.security?.api?.legacy === false);
110
+ }
111
+ // jwt tokens make existing login tokens anonymous, which can lose access under these configs
112
+ function reliesOnLoggedInUsers(config) {
113
+ if (config.publish?.check_owners === true)
114
+ return true;
115
+ // Auth plugins other than htpasswd can grant access or parse tokens their own way
116
+ if (config.auth &&
117
+ typeof config.auth === 'object' &&
118
+ Object.keys(config.auth).some((plugin) => plugin !== 'htpasswd')) {
119
+ return true;
120
+ }
121
+ return Object.values(config.packages ?? {}).some((rule) => rule &&
122
+ typeof rule === 'object' &&
123
+ ['access', 'publish', 'unpublish', 'stage'].some((action) => {
124
+ // An empty list denies everyone, and empty `unpublish` or `stage` falls back to `publish`
125
+ const groups = normalizeGroups(rule[action]);
126
+ return (groups.length > 0 &&
127
+ !groups.some((group) => ANONYMOUS_GROUPS.has(group)));
128
+ }));
129
+ }
130
+ function normalizeGroups(groups) {
131
+ if (typeof groups === 'string')
132
+ return groups.split(/\s+/).filter(Boolean);
133
+ return Array.isArray(groups) ? groups.map(String) : [];
134
+ }
135
+ function parseYamlMap(content) {
136
+ try {
137
+ const value = (0, js_yaml_1.load)(content);
138
+ return value && typeof value === 'object' && !Array.isArray(value)
139
+ ? value
140
+ : undefined;
141
+ }
142
+ catch {
143
+ return undefined;
144
+ }
145
+ }
@@ -0,0 +1,49 @@
1
+ #### Enable JWT API tokens in Verdaccio configs
2
+
3
+ The `@nx/js:verdaccio` executor and `startLocalRegistry` set a placeholder npm auth token for the local registry, because npm and bun refuse to publish to a registry without one. Verdaccio 7 rejects a token it cannot decode with a 401 error, which breaks `npm publish` and `npm view` against the local registry. With JWT API tokens enabled, Verdaccio 6 and 7 treat the placeholder token as anonymous instead.
4
+
5
+ The migration adds a `security.api.jwt` section to each Verdaccio config file that an `@nx/js:verdaccio` target points at through its `config` option, including target configurations and `targetDefaults` in `nx.json`. Config files that already set `security.api.jwt`, or set `security.api.legacy` to `false`, already accept the placeholder token and stay unchanged.
6
+
7
+ JWT API tokens turn existing tokens from `npm login` into anonymous ones. The migration therefore lists, and leaves unchanged, config files that rely on logged-in users:
8
+
9
+ - a package rule grants `access`, `publish`, `unpublish` or `stage` only to logged-in users
10
+ - `publish.check_owners` is enabled
11
+ - an auth plugin other than `htpasswd` is configured
12
+
13
+ It also lists config files that already have a `security` section, and files it cannot parse or update.
14
+
15
+ In the config files it changes, users who logged in before the migration act as anonymous users until they log in again. Installs and publishes keep working, but `npm whoami` fails on Verdaccio 7. New tokens from `npm login` expire after 7 days.
16
+
17
+ #### Sample code changes
18
+
19
+ ##### Before
20
+
21
+ ```yaml title=".verdaccio/config.yml"
22
+ storage: ../tmp/local-registry/storage
23
+
24
+ packages:
25
+ '**':
26
+ access: $all
27
+ publish: $all
28
+ unpublish: $all
29
+ ```
30
+
31
+ ##### After
32
+
33
+ ```yaml title=".verdaccio/config.yml"
34
+ storage: ../tmp/local-registry/storage
35
+
36
+ packages:
37
+ '**':
38
+ access: $all
39
+ publish: $all
40
+ unpublish: $all
41
+
42
+ # jwt tokens make verdaccio 7+ treat the placeholder npm auth token set by nx
43
+ # as anonymous instead of rejecting it
44
+ security:
45
+ api:
46
+ jwt:
47
+ sign:
48
+ expiresIn: 7d
49
+ ```
@@ -0,0 +1,10 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function replaceBabelClassPropertiesLoose(tree: Tree): Promise<{
3
+ nextSteps: string[];
4
+ agentContext: string[];
5
+ skipAgentic?: undefined;
6
+ } | {
7
+ nextSteps?: undefined;
8
+ agentContext?: undefined;
9
+ skipAgentic: boolean;
10
+ }>;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = replaceBabelClassPropertiesLoose;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const node_path_1 = require("node:path");
6
+ const jsonc_parser_1 = require("jsonc-parser");
7
+ const FORMATTING_OPTIONS = {
8
+ formattingOptions: { keepLines: true, insertSpaces: true, tabSize: 2 },
9
+ };
10
+ const JSON_CONFIG_FILES = new Set([
11
+ '.babelrc',
12
+ '.babelrc.json',
13
+ 'babel.config.json',
14
+ ]);
15
+ const JS_CONFIG_FILE = /^(\.babelrc|babel\.config)\.(c|m)?(js|ts)$/;
16
+ // `@nx/react/babel` and `@nx/web/babel` forward their options to `@nx/js/babel`.
17
+ const NX_PRESETS = new Set([
18
+ '@nx/js/babel',
19
+ '@nx/react/babel',
20
+ '@nx/web/babel',
21
+ ]);
22
+ async function replaceBabelClassPropertiesLoose(tree) {
23
+ const unparsable = [];
24
+ const jsConfigs = [];
25
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '', (path) => {
26
+ const name = (0, node_path_1.basename)(path);
27
+ const isJson = JSON_CONFIG_FILES.has(name);
28
+ if (!isJson && !JS_CONFIG_FILE.test(name))
29
+ return;
30
+ const content = tree.read(path, 'utf-8');
31
+ if (!isJson) {
32
+ // Preset options may be imported from another file, so flag every JS
33
+ // config that uses an Nx preset.
34
+ if ([...NX_PRESETS].some((preset) => content.includes(preset))) {
35
+ jsConfigs.push(path);
36
+ }
37
+ return;
38
+ }
39
+ if (!content.includes('classProperties'))
40
+ return;
41
+ const errors = [];
42
+ const config = (0, jsonc_parser_1.parse)(content, errors, { allowTrailingComma: true });
43
+ if (errors.length || !config || typeof config !== 'object') {
44
+ unparsable.push(path);
45
+ return;
46
+ }
47
+ let updated = content;
48
+ for (const optionsPath of findNxPresetOptions(config)) {
49
+ const options = getAt(config, optionsPath);
50
+ if (!options || !('classProperties' in options))
51
+ continue;
52
+ // `classProperties.loose` used to take precedence over `loose`.
53
+ const loose = options.classProperties?.loose;
54
+ if (loose !== undefined) {
55
+ updated = (0, jsonc_parser_1.applyEdits)(updated, (0, jsonc_parser_1.modify)(updated, [...optionsPath, 'loose'], loose, FORMATTING_OPTIONS));
56
+ }
57
+ updated = (0, jsonc_parser_1.applyEdits)(updated, (0, jsonc_parser_1.modify)(updated, [...optionsPath, 'classProperties'], undefined, FORMATTING_OPTIONS));
58
+ }
59
+ if (updated !== content)
60
+ tree.write(path, updated);
61
+ });
62
+ await (0, devkit_1.formatFiles)(tree);
63
+ const nextSteps = [
64
+ ...unparsable.map((path) => `Could not parse ${path}. If it passes \`classProperties.loose\` to an Nx babel preset, replace it with the \`loose\` option.`),
65
+ ...jsConfigs.map((path) => `${path} uses an Nx babel preset. If its preset options set \`classProperties.loose\`, replace it with the \`loose\` option.`),
66
+ ];
67
+ return nextSteps.length
68
+ ? { nextSteps, agentContext: nextSteps }
69
+ : { skipAgentic: true };
70
+ }
71
+ // Babel accepts presets at the top level, under `env.<name>`, in `overrides[]`
72
+ // and under `overrides[].env.<name>`.
73
+ function findNxPresetOptions(config) {
74
+ const scopes = [[]];
75
+ (Array.isArray(config.overrides) ? config.overrides : []).forEach((_, i) => scopes.push(['overrides', i]));
76
+ for (const scope of [...scopes]) {
77
+ for (const env of Object.keys(getAt(config, [...scope, 'env']) ?? {})) {
78
+ scopes.push([...scope, 'env', env]);
79
+ }
80
+ }
81
+ const result = [];
82
+ for (const scope of scopes) {
83
+ const presets = getAt(config, [...scope, 'presets']);
84
+ if (!Array.isArray(presets))
85
+ continue;
86
+ presets.forEach((preset, i) => {
87
+ if (Array.isArray(preset) &&
88
+ NX_PRESETS.has(preset[0]) &&
89
+ preset[1] &&
90
+ typeof preset[1] === 'object') {
91
+ result.push([...scope, 'presets', i, 1]);
92
+ }
93
+ });
94
+ }
95
+ return result;
96
+ }
97
+ function getAt(value, path) {
98
+ return path.reduce((current, key) => current?.[key], value);
99
+ }
@@ -0,0 +1,41 @@
1
+ #### Replace the `classProperties.loose` babel preset option with `loose`
2
+
3
+ The `classProperties` option of the `@nx/js/babel`, `@nx/react/babel` and `@nx/web/babel` presets is removed. Its `loose` value moves to the preset's `loose` option, so class fields compile the same way as before. When both are set, the `classProperties.loose` value is kept, because it used to take precedence.
4
+
5
+ The migration updates `.babelrc`, `.babelrc.json` and `babel.config.json` files, including presets under `env` and `overrides`. It lists JavaScript babel config files that use an Nx preset, and JSON files it cannot parse, so you can check them by hand.
6
+
7
+ #### Sample code changes
8
+
9
+ ##### Before
10
+
11
+ ```json title="libs/my-lib/.babelrc"
12
+ {
13
+ "presets": [
14
+ [
15
+ "@nx/js/babel",
16
+ {
17
+ "useBuiltIns": "usage",
18
+ "classProperties": {
19
+ "loose": false
20
+ }
21
+ }
22
+ ]
23
+ ]
24
+ }
25
+ ```
26
+
27
+ ##### After
28
+
29
+ ```json title="libs/my-lib/.babelrc"
30
+ {
31
+ "presets": [
32
+ [
33
+ "@nx/js/babel",
34
+ {
35
+ "useBuiltIns": "usage",
36
+ "loose": false
37
+ }
38
+ ]
39
+ ]
40
+ }
41
+ ```
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * This function is used to start a local registry for testing purposes.
3
3
  * @param localRegistryTarget the target to run to start the local registry e.g. workspace:local-registry
4
- * @param storage the storage location for the local registry
5
- * @param verbose whether to log verbose output
6
- * @param clearStorage whether to clear the verdaccio storage before running the registry
7
- * @param listenAddress the address that verdaccio should listen to (default to `localhost`)
4
+ * @param storage the storage location for the local registry, passed to the target as `--storage`
5
+ * @param verbose whether to print the target's stdout until the registry address appears (stderr is always printed)
6
+ * @param clearStorage whether to ask the target to clear the registry storage before starting, passed to the target as `--clear` (default `true`)
7
+ * @param listenAddress the address the target listens on (default `localhost`). It is not passed to the target; the helper waits for `http://<listenAddress>:<port>` in the target's stdout and uses it as the registry URL.
8
8
  */
9
9
  export declare function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorage, listenAddress, }: {
10
10
  localRegistryTarget: string;
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.startLocalRegistry = startLocalRegistry;
4
4
  const internal_1 = require("@nx/devkit/internal");
5
5
  const child_process_1 = require("child_process");
6
+ const placeholder_auth_token_1 = require("../../executors/verdaccio/placeholder-auth-token");
6
7
  /**
7
8
  * This function is used to start a local registry for testing purposes.
8
9
  * @param localRegistryTarget the target to run to start the local registry e.g. workspace:local-registry
9
- * @param storage the storage location for the local registry
10
- * @param verbose whether to log verbose output
11
- * @param clearStorage whether to clear the verdaccio storage before running the registry
12
- * @param listenAddress the address that verdaccio should listen to (default to `localhost`)
10
+ * @param storage the storage location for the local registry, passed to the target as `--storage`
11
+ * @param verbose whether to print the target's stdout until the registry address appears (stderr is always printed)
12
+ * @param clearStorage whether to ask the target to clear the registry storage before starting, passed to the target as `--clear` (default `true`)
13
+ * @param listenAddress the address the target listens on (default `localhost`). It is not passed to the target; the helper waits for `http://<listenAddress>:<port>` in the target's stdout and uses it as the registry URL.
13
14
  */
14
15
  function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorage, listenAddress, }) {
15
16
  listenAddress ??= 'localhost';
@@ -26,37 +27,50 @@ function startLocalRegistry({ localRegistryTarget, storage, verbose, clearStorag
26
27
  process.stdout.write(data);
27
28
  console.log('Waiting for local registry to start...');
28
29
  }
29
- if (data.toString().includes(`http://${listenAddress}:`)) {
30
- const port = parseInt(data.toString().match(new RegExp(`${listenAddress}:(?<port>\\d+)`))
31
- ?.groups?.port);
30
+ const output = data.toString();
31
+ const addressPrefix = `http://${listenAddress}:`;
32
+ const addressIndex = output.indexOf(addressPrefix);
33
+ if (addressIndex !== -1) {
34
+ childProcess?.stdout?.off('data', listener);
35
+ const port = parseInt(output.slice(addressIndex + addressPrefix.length));
32
36
  const registry = `http://${listenAddress}:${port}`;
33
- const authToken = 'secretVerdaccioToken';
37
+ const authTokenKey = `//${listenAddress}:${port}/:_authToken`;
34
38
  console.log(`Local registry started on ${registry}`);
35
- process.env.npm_config_registry = registry;
36
- (0, child_process_1.execSync)(`npm config set //${listenAddress}:${port}/:_authToken "${authToken}" --ws=false`, {
37
- windowsHide: true,
38
- });
39
- // pnpm 11 reads pnpm_config_* env vars instead of npm_config_*, and
40
- // they take precedence over any registry configured in ~/.npmrc
41
- process.env.pnpm_config_registry = registry;
42
- process.env[`pnpm_config_//${listenAddress}:${port}/:_authToken`] =
43
- authToken;
44
- // bun
45
- process.env.BUN_CONFIG_REGISTRY = registry;
46
- process.env.BUN_CONFIG_TOKEN = authToken;
47
- // yarnv1
48
- process.env.YARN_REGISTRY = registry;
49
- // yarnv2
50
- process.env.YARN_NPM_REGISTRY_SERVER = registry;
51
- process.env.YARN_UNSAFE_HTTP_WHITELIST = listenAddress;
52
- console.log('Set npm, pnpm, bun, and yarn config registry to ' + registry);
53
- resolve(() => {
54
- childProcess.kill();
55
- (0, child_process_1.execSync)(`npm config delete //${listenAddress}:${port}/:_authToken --ws=false`, {
56
- windowsHide: true,
39
+ (0, placeholder_auth_token_1.isPlaceholderAuthTokenRejected)(registry)
40
+ .then((authTokenRejected) => {
41
+ if (authTokenRejected) {
42
+ (0, placeholder_auth_token_1.warnPlaceholderAuthTokenRejected)(registry);
43
+ }
44
+ else {
45
+ (0, child_process_1.execSync)(`npm config set ${authTokenKey} "${placeholder_auth_token_1.PLACEHOLDER_AUTH_TOKEN}" --ws=false`, {
46
+ windowsHide: true,
47
+ });
48
+ process.env[`pnpm_config_${authTokenKey}`] =
49
+ placeholder_auth_token_1.PLACEHOLDER_AUTH_TOKEN;
50
+ process.env.BUN_CONFIG_TOKEN = placeholder_auth_token_1.PLACEHOLDER_AUTH_TOKEN;
51
+ }
52
+ process.env.npm_config_registry = registry;
53
+ // pnpm 11 reads pnpm_config_* env vars instead of npm_config_*, and
54
+ // they take precedence over any registry configured in ~/.npmrc
55
+ process.env.pnpm_config_registry = registry;
56
+ // bun
57
+ process.env.BUN_CONFIG_REGISTRY = registry;
58
+ // yarnv1
59
+ process.env.YARN_REGISTRY = registry;
60
+ // yarnv2
61
+ process.env.YARN_NPM_REGISTRY_SERVER = registry;
62
+ process.env.YARN_UNSAFE_HTTP_WHITELIST = listenAddress;
63
+ console.log('Set npm, pnpm, bun, and yarn config registry to ' + registry);
64
+ resolve(() => {
65
+ childProcess.kill();
66
+ if (!authTokenRejected) {
67
+ (0, child_process_1.execSync)(`npm config delete ${authTokenKey} --ws=false`, {
68
+ windowsHide: true,
69
+ });
70
+ }
57
71
  });
58
- });
59
- childProcess?.stdout?.off('data', listener);
72
+ })
73
+ .catch(reject);
60
74
  }
61
75
  };
62
76
  childProcess?.stdout?.on('data', listener);
@@ -27,7 +27,7 @@ function detectTransformerFormat(plugin) {
27
27
  }
28
28
  return TransformerFormat.UNKNOWN;
29
29
  }
30
- function adaptFunctionBasedTransformer(plugin, pluginOptions) {
30
+ function adaptFunctionBasedTransformer(plugin) {
31
31
  // Handle direct function export
32
32
  if (typeof plugin === 'function') {
33
33
  return {
@@ -102,7 +102,7 @@ function loadTsTransformers(plugins, moduleResolver = require.resolve) {
102
102
  // Adapt function-based transformers to standard format
103
103
  if (format === TransformerFormat.FUNCTION_EXPORT) {
104
104
  devkit_1.logger.debug(`Adapting function-based transformer: ${pluginName}`);
105
- plugin = adaptFunctionBasedTransformer(plugin, pluginOptions);
105
+ plugin = adaptFunctionBasedTransformer(plugin);
106
106
  }
107
107
  else if (format === TransformerFormat.UNKNOWN) {
108
108
  devkit_1.logger.warn(`${pluginName} is not a recognized Transformer Plugin format. It should export ` +
package/migrations.json CHANGED
@@ -58,6 +58,18 @@
58
58
  "description": "Add the workspace root pnpm-workspace.yaml, the pnpm settings fields of the root package.json, and a pnpm-major runtime probe to the inputs of build targets that emit the pruned pnpm deploy output (webpack, rspack, vite, esbuild with generatePackageJson; next, remix, tsc, swc with generateLockfile), so revoking a build-script approval, changing another pnpm install setting, or crossing the pnpm 10/11 boundary does not replay a cached output that still carries the old one.",
59
59
  "implementation": "./dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs",
60
60
  "documentation": "./dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.md"
61
+ },
62
+ "update-24-1-0-replace-babel-class-properties-loose": {
63
+ "version": "24.1.0-beta.0",
64
+ "description": "Replaces the removed `classProperties.loose` option with `loose` for the `@nx/js/babel`, `@nx/react/babel` and `@nx/web/babel` presets in JSON babel config files.",
65
+ "implementation": "./dist/src/migrations/update-24-1-0/replace-babel-class-properties-loose",
66
+ "documentation": "./dist/src/migrations/update-24-1-0/replace-babel-class-properties-loose.md"
67
+ },
68
+ "update-24-1-0-add-verdaccio-jwt-security": {
69
+ "version": "24.1.0-beta.1",
70
+ "description": "Enables JWT API tokens in Verdaccio config files used by `@nx/js:verdaccio` targets, so Verdaccio 7+ accepts the placeholder npm auth token that Nx sets for the local registry.",
71
+ "implementation": "./dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security",
72
+ "documentation": "./dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security.md"
61
73
  }
62
74
  },
63
75
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "24.0.6",
3
+ "version": "24.1.0-beta.1",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -162,8 +162,8 @@
162
162
  "@babel/preset-env": "^7.23.2",
163
163
  "@babel/preset-typescript": "^7.22.5",
164
164
  "@babel/runtime": "^7.22.6",
165
- "@nx/devkit": "24.0.6",
166
- "@nx/workspace": "24.0.6",
165
+ "@nx/devkit": "24.1.0-beta.1",
166
+ "@nx/workspace": "24.1.0-beta.1",
167
167
  "@zkochan/js-yaml": "0.0.7",
168
168
  "babel-plugin-const-enum": "^1.0.1",
169
169
  "babel-plugin-macros": "^3.1.0",
@@ -183,18 +183,18 @@
183
183
  "tslib": "^2.3.0"
184
184
  },
185
185
  "devDependencies": {
186
- "@nx/esbuild": "24.0.6",
187
- "@nx/eslint": "24.0.6",
188
- "@nx/jest": "24.0.6",
189
- "@nx/oxlint": "24.0.6",
190
- "@nx/rollup": "24.0.6",
191
- "@nx/vite": "24.0.6",
192
- "@nx/vitest": "24.0.6",
193
- "nx": "24.0.6"
186
+ "@nx/esbuild": "24.1.0-beta.1",
187
+ "@nx/eslint": "24.1.0-beta.1",
188
+ "@nx/jest": "24.1.0-beta.1",
189
+ "@nx/oxlint": "24.1.0-beta.1",
190
+ "@nx/rollup": "24.1.0-beta.1",
191
+ "@nx/vite": "24.1.0-beta.1",
192
+ "@nx/vitest": "24.1.0-beta.1",
193
+ "nx": "24.1.0-beta.1"
194
194
  },
195
195
  "peerDependencies": {
196
196
  "@swc/cli": ">=0.6.0 <0.9.0",
197
- "verdaccio": "^6.0.5"
197
+ "verdaccio": "^6.0.5 || ^7.0.0"
198
198
  },
199
199
  "peerDependenciesMeta": {
200
200
  "@swc/cli": {