Skip to content

chore(repo): update nx to 23.0.0-beta.11#3131

Merged
FrozenPandaz merged 7 commits into
masterfrom
upnx
May 14, 2026
Merged

chore(repo): update nx to 23.0.0-beta.11#3131
FrozenPandaz merged 7 commits into
masterfrom
upnx

Conversation

@FrozenPandaz
Copy link
Copy Markdown
Contributor

@FrozenPandaz FrozenPandaz commented May 5, 2026

Updating Nx from 23.0.0-beta.4 to 23.0.0-beta.11

@FrozenPandaz FrozenPandaz requested a review from MaxKless as a code owner May 5, 2026 02:10
@nx-cloud-snapshot
Copy link
Copy Markdown
Contributor

nx-cloud-snapshot Bot commented May 5, 2026

View your CI Pipeline Execution ↗ for commit 78eca78

Command Status Duration Result
nx affected --targets=lint,test,build,e2e-ci,ty... ✅ Succeeded 2m 34s View ↗
nx-cloud record -- node tools/scripts/check-pin... ✅ Succeeded <1s View ↗
nx-cloud record -- yarn nx sync:check ✅ Succeeded 10s View ↗
nx-cloud record -- yarn nx run-many -t ktfmtFormat ✅ Succeeded 3m 19s View ↗
nx run-many -t ktfmtFormat ✅ Succeeded 1m 42s View ↗
nx-cloud record -- yarn nx format:check --verbose ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-14 04:21:27 UTC

nx-cloud-snapshot[bot]

This comment was marked as outdated.

FrozenPandaz added a commit to nrwl/nx that referenced this pull request May 5, 2026
)

## Current Behavior

The 23.0.0-beta.6 `@nx/devkit` deep-import migration (#35541) catches
non-named-import shapes (default / namespace / side-effect / `require()`
/ dynamic `import()` / `jest.mock`-style calls) by running a regex sweep
over the file:

```ts
const FALLBACK_RE = /(['"])@nx\/devkit\/src\/[^'"\n]+?\1/g;
updated = updated.replace(
  FALLBACK_RE,
  (_match, quote: string) => `${quote}${INTERNAL_SPECIFIER}${quote}`
);
```

That sweep matches **any** `'@nx/devkit/src/...'` literal anywhere in
the file, regardless of context. As a result the migration mangled:

- **Test fixtures inside template literals** — including the migration's
own `update-deep-imports.spec.ts`. Examples observed in the wild:
`packages/devkit/src/migrations/update-23-0-0/update-deep-imports.spec.ts`,
`packages/expo/src/utils/expo-project-detection.spec.ts`,
`packages/nuxt/src/plugins/plugin.spec.ts`,
`packages/react-native/src/utils/react-native-project-detection.spec.ts`,
etc. ([#35565](#35565))
- **`typeof import('@nx/devkit/src/...')` type queries** — e.g.
`libs/shared/npm/src/lib/local-nx-utils/parse-target-string.ts` in
nrwl/nx-console, where the type now claims `@nx/devkit/internal` while
the runtime `importPath` next to it is built dynamically and still
points at `src/...`.
([nrwl/nx-console#3131](nrwl/nx-console#3131))
- **Deep-import paths in comments**, doc strings, and arbitrary
string-literal arguments to unrelated functions.

## Expected Behavior

The migration only rewrites deep-import paths that are *actually* import
sites. Everything else (template strings, type queries, comments,
unrelated calls) is left alone.

This is implemented by replacing the regex sweep with a TypeScript-AST
visitor that only rewrites the string-literal argument of
`CallExpression` nodes whose callee is one of:

- `require` (identifier)
- the dynamic-`import` keyword
- `jest.mock` / `jest.unmock` / `jest.doMock` / `jest.dontMock` /
`jest.requireActual` / `jest.requireMock`
- `vi.mock` / `vi.unmock` / `vi.doMock` / `vi.dontMock` /
`vi.requireActual` / `vi.requireMock` / `vi.importActual` /
`vi.importMock`

Type queries (`ImportTypeNode`), template literals, and comments are all
naturally untouched because they are not `CallExpression` nodes — no
allowlist needed. Quote style is preserved per literal.

The named-import bucketing pass and the duplicate-collapse pass are
unchanged.

### Tests

10 new unit tests:

- 5 in a new `non-runtime string literals` block guarding template
literals, `typeof import(...)` type queries, block comments, line
comments, and unrelated call expressions.
- 5 in a new `mock helper calls` block covering `jest.mock`,
`jest.requireActual`, `vi.mock`, `vi.importActual`, and a paired
`import` + `jest.mock` + `jest.requireActual` combination.

All 39 unit tests pass; `nx build devkit` is clean.

## Related Issue(s)

Follow-up to #35541. Workspaces that have already merged the bad
rewrites need to revert those files by hand — there's no general way to
undo the over-rewrites without losing the legitimate ones.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
@FrozenPandaz FrozenPandaz changed the title chore(repo): update nx to 23.0.0-beta.6 chore(repo): update nx to 23.0.0-beta.7 May 5, 2026
nx-cloud-snapshot[bot]

This comment was marked as outdated.

nx-cloud-snapshot[bot]

This comment was marked as outdated.

nx-cloud-snapshot[bot]

This comment was marked as outdated.

@FrozenPandaz FrozenPandaz changed the title chore(repo): update nx to 23.0.0-beta.7 chore(repo): update nx to 23.0.0-beta.9 May 8, 2026
nx-cloud-snapshot[bot]

This comment was marked as outdated.

nx-cloud-snapshot[bot]

This comment was marked as outdated.

nx-cloud-snapshot[bot]

This comment was marked as outdated.

@FrozenPandaz FrozenPandaz changed the title chore(repo): update nx to 23.0.0-beta.9 chore(repo): update nx to 23.0.0-beta.11 May 13, 2026
nx-cloud-snapshot[bot]

This comment was marked as outdated.

Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
Comment thread package.json
Comment on lines +115 to 117
"jest": "30.3.0",
"jest-environment-jsdom": "30.0.5",
"jest-environment-node": "29.7.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version mismatch between Jest and its environment packages. jest is updated to 30.3.0 while jest-environment-node remains at 29.7.0 (major version behind). This will likely cause compatibility issues since Jest 30.x expects environment packages to be on version 30.x.

"jest": "30.3.0",
"jest-environment-jsdom": "30.3.0",
"jest-environment-node": "30.3.0",

Both jest-environment-jsdom should also be updated from 30.0.5 to 30.3.0 to match the Jest core version, and jest-environment-node needs to be updated from 29.7.0 to 30.3.0.

Suggested change
"jest": "30.3.0",
"jest-environment-jsdom": "30.0.5",
"jest-environment-node": "29.7.0",
"jest": "30.3.0",
"jest-environment-jsdom": "30.3.0",
"jest-environment-node": "30.3.0",

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link
Copy Markdown
Contributor

@nx-cloud-snapshot nx-cloud-snapshot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

We update the parseTargetString helper to fix TypeScript compilation failures caused by the @nx/devkit 23.0.0-beta.11 upgrade, which removed the ./src/executors/parse-target-string subpath export and dropped the top-level src/ directory from the published package. These changes resolve all three failing tasks (nx-mcp:build:production, shared-npm:typecheck, vscode:build:ci) by pointing both the runtime import and the TypeScript type annotation at the correct, still-exported locations.

Tip

We verified this fix by re-running shared-npm:typecheck, nx-mcp:build:production.

diff --git a/libs/shared/npm/src/lib/local-nx-utils/parse-target-string.ts b/libs/shared/npm/src/lib/local-nx-utils/parse-target-string.ts
index 79f3066..26937b3 100644
--- a/libs/shared/npm/src/lib/local-nx-utils/parse-target-string.ts
+++ b/libs/shared/npm/src/lib/local-nx-utils/parse-target-string.ts
@@ -14,10 +14,8 @@ export async function parseTargetString(
   if (!devkitPath) {
     throw 'local @nx/devkit dependency not found';
   }
-  const importPath = join(devkitPath, 'src/executors/parse-target-string');
+  const importPath = join(devkitPath, 'dist/src/executors/parse-target-string');
   const { parseTargetString } =
-    await importWorkspaceDependency<
-      typeof import('@nx/devkit/src/executors/parse-target-string')
-    >(importPath);
+    await importWorkspaceDependency<typeof import('@nx/devkit')>(importPath);
   return parseTargetString(targetString, projectGraph);
 }

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally otbg-ENCj

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

…export

Nx 23 added an exports field to @nx/devkit/package.json that blocks the
@nx/devkit/src/executors/parse-target-string subpath. Use the top-level
export instead, which has been available since Nx 16.
@FrozenPandaz FrozenPandaz merged commit 1acc012 into master May 14, 2026
7 checks passed
@FrozenPandaz FrozenPandaz deleted the upnx branch May 14, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants