@nx/js 22.7.2 → 22.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "22.7.2",
3
+ "version": "22.7.3",
4
4
  "private": false,
5
5
  "description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
6
6
  "repository": {
@@ -40,8 +40,8 @@
40
40
  "@babel/preset-env": "^7.23.2",
41
41
  "@babel/preset-typescript": "^7.22.5",
42
42
  "@babel/runtime": "^7.22.6",
43
- "@nx/devkit": "22.7.2",
44
- "@nx/workspace": "22.7.2",
43
+ "@nx/devkit": "22.7.3",
44
+ "@nx/workspace": "22.7.3",
45
45
  "@zkochan/js-yaml": "0.0.7",
46
46
  "babel-plugin-const-enum": "^1.0.1",
47
47
  "babel-plugin-macros": "^3.1.0",
@@ -61,7 +61,7 @@
61
61
  "tslib": "^2.3.0"
62
62
  },
63
63
  "devDependencies": {
64
- "nx": "22.7.2"
64
+ "nx": "22.7.3"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "verdaccio": "^6.0.5"
@@ -1 +1 @@
1
- {"version":3,"file":"release-publish.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/release-publish/release-publish.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAiBjD,wBAA8B,WAAW,CACvC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,eAAe;;GA6dzB"}
1
+ {"version":3,"file":"release-publish.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/release-publish/release-publish.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAiBjD,wBAA8B,WAAW,CACvC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,eAAe;;GA0UzB"}
@@ -267,6 +267,21 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
267
267
  * to running from the package root directly), then special attention should be paid to the fact that npm/pnpm publish will nest its
268
268
  * JSON output under the name of the package in that case (and it would need to be handled below).
269
269
  */
270
+ return runPublish({
271
+ pm,
272
+ options,
273
+ context,
274
+ packageRoot,
275
+ packageJson,
276
+ registry,
277
+ registryConfigKey,
278
+ tag,
279
+ isDryRun,
280
+ isNpmInstalled,
281
+ });
282
+ }
283
+ function runPublish(ctx) {
284
+ const { pm, options, context, packageRoot, packageJson, registry, registryConfigKey, tag, isDryRun, isNpmInstalled, } = ctx;
270
285
  const pmCommand = (0, devkit_1.getPackageManagerCommand)(pm);
271
286
  const publishCommandSegments = [
272
287
  pmCommand.publish(packageRoot, registry, registryConfigKey, tag),
@@ -342,9 +357,20 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
342
357
  try {
343
358
  // bun publish does not support outputting JSON, so we cannot perform any further processing
344
359
  if (pm === 'bun') {
360
+ const bunStderr = err.stderr?.toString() || '';
361
+ const bunStdout = err.stdout?.toString() || '';
362
+ // bun publish does not yet support npm's OIDC trusted publishing flow. If the failure
363
+ // looks like an authentication error and npm is available, retry via npm to recover.
364
+ // Other failures (e.g. version conflict, 403) would produce the same error from npm,
365
+ // so we surface bun's error directly instead.
366
+ const looksLikeAuthError = /missing authentication|bunx npm login|unauthorized|\b401\b/i.test(bunStderr + bunStdout);
367
+ if (isNpmInstalled && looksLikeAuthError) {
368
+ console.warn(`bun publish failed with an authentication error; falling back to npm publish (bun does not support npm OIDC trusted publishing).`);
369
+ return runPublish({ ...ctx, pm: 'npm' });
370
+ }
345
371
  console.error(`bun publish error:`);
346
- console.error(err.stderr?.toString() || '');
347
- console.error(err.stdout?.toString() || '');
372
+ console.error(bunStderr);
373
+ console.error(bunStdout);
348
374
  return {
349
375
  success: false,
350
376
  };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AA8BpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EACN,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACN,KAAK,CAAC,EACF,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA0KD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA8FzD,CAAC;AAEF,eAAO,MAAM,WAAW,iCAAgB,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AA+BpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EACN,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACN,KAAK,CAAC,EACF,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAyLD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA8FzD,CAAC;AAEF,eAAO,MAAM,WAAW,iCAAgB,CAAC"}
@@ -10,8 +10,20 @@ const picomatch = require("picomatch");
10
10
  // eslint-disable-next-line @typescript-eslint/no-restricted-imports
11
11
  const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
12
12
  const cache_directory_1 = require("nx/src/utils/cache-directory");
13
+ const installation_directory_1 = require("nx/src/utils/installation-directory");
13
14
  const util_1 = require("./util");
14
15
  let ts;
16
+ const resolvedTypescriptPaths = {};
17
+ function resolveTypescriptPath(projectRoot, workspaceRoot) {
18
+ // Resolve from projectRoot first, then workspace paths, with __dirname as a
19
+ // last resort. Required so the lookup works under layouts where @nx/js's real
20
+ // path is outside the workspace tree (e.g. pnpm's enableGlobalVirtualStore),
21
+ // since typescript is not a declared dep.
22
+ resolvedTypescriptPaths[projectRoot] ??= require.resolve('typescript', {
23
+ paths: [projectRoot, ...(0, installation_directory_1.getNxRequirePaths)(workspaceRoot), __dirname],
24
+ });
25
+ return resolvedTypescriptPaths[projectRoot];
26
+ }
15
27
  const TSCONFIG_CACHE_VERSION = 2;
16
28
  const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, 'tsconfig-files.hash');
17
29
  // Module-level cache store — each invocation gets a unique Symbol key
@@ -354,7 +366,7 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
354
366
  ];
355
367
  const absoluteProjectRoot = config.project.absolute;
356
368
  if (!ts) {
357
- ts = require('typescript');
369
+ ts = require(resolveTypescriptPath(absoluteProjectRoot, workspaceRoot));
358
370
  }
359
371
  // https://github.com/microsoft/TypeScript/blob/19b777260b26aac5707b1efd34202054164d4a9d/src/compiler/utilities.ts#L9869
360
372
  const supportedTSExtensions = [
@@ -819,7 +831,7 @@ function getExtendedFilesHash(extendedConfigFiles, workspaceRoot, cache) {
819
831
  }
820
832
  function readTsConfig(tsConfigPath, workspaceRoot, cache) {
821
833
  if (!ts) {
822
- ts = require('typescript');
834
+ ts = require(resolveTypescriptPath(workspaceRoot, workspaceRoot));
823
835
  }
824
836
  // Normalize to forward slashes for TypeScript compatibility on Windows.
825
837
  // TypeScript's parser normalizes paths inconsistently — diagnostics use