Files
Craigory Coppola ee0bc60a33 fix(misc): move plugin internal imports to devkit/internal (#36430)
## Current Behavior

First-party plugins reach into `nx` internals through deep subpaths
(`nx/src/executors/run-commands/run-commands.impl`,
`nx/src/generators/tree`, `nx/src/plugins/js/lock-file/lock-file`, …),
so there is no single boundary between the plugins and nx's internal
module layout.

## Expected Behavior

Those imports are routed through the `@nx/devkit/internal` barrel, and a
lint rule enforces the boundary. `nx/release` stays exempt as a public,
stable entry point for release-extension plugins.

### Note on `packages/nest/test-setup.ts`

This one is a latent-bug fix, not lint appeasement. The previous setup
installed the project-graph stub with
`jest.spyOn(require('nx/src/project-graph/project-graph'),
'createProjectGraphAsync')` at module scope. `jest.restoreAllMocks()`
undoes anything installed via `jest.spyOn`, and four nest suites —
`init`, `library`, `application` and `run-nest-schematic` — call it from
an `afterAll` hook. Since `test-setup.ts` is wired in through
`setupFilesAfterEnv` and runs once per test file, that `afterAll` tore
the stub down for the rest of the file, so any later `describe` block
silently fell through to the **real** `createProjectGraphAsync` instead
of the stub. Switching to a `jest.mock(...)` module factory fixes it:
module-registry substitution is not affected by `restoreAllMocks()`, so
the stub now survives the whole file as intended.

## Related Issue(s)

<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes NXC-4748

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-08-05 13:00:44 -04:00

128 lines
3.7 KiB
JSON

{
"name": "@nx/devkit",
"version": "0.0.1",
"private": false,
"type": "commonjs",
"files": [
"dist",
"!dist/tsconfig.tsbuildinfo",
"migrations.json"
],
"description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
"repository": {
"type": "git",
"url": "https://github.com/nrwl/nx.git",
"directory": "packages/devkit"
},
"keywords": [
"Monorepo",
"Angular",
"React",
"Web",
"Node",
"Nest",
"Jest",
"Cypress",
"CLI"
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"typesVersions": {
"*": {
"testing": [
"dist/testing.d.ts"
],
"ngcli-adapter": [
"dist/ngcli-adapter.d.ts"
],
"internal": [
"dist/internal.d.ts"
],
"internal-testing-utils": [
"dist/internal-testing-utils.d.ts"
],
"internal-testing-utils/mock-project-graph": [
"dist/internal-testing-utils/mock-project-graph.d.ts"
],
"internal-testing-utils/mock-fs": [
"dist/internal-testing-utils/mock-fs.d.ts"
],
"internal-testing-utils/mock-prettier": [
"dist/internal-testing-utils/mock-prettier.d.ts"
]
}
},
"author": "Victor Savkin",
"license": "MIT",
"bugs": {
"url": "https://github.com/nrwl/nx/issues"
},
"homepage": "https://nx.dev",
"dependencies": {
"ejs": "5.0.1",
"tslib": "catalog:typescript",
"semver": "catalog:",
"yargs-parser": "catalog:",
"minimatch": "catalog:",
"enquirer": "catalog:"
},
"devDependencies": {
"jest": "catalog:jest",
"nx": "workspace:*"
},
"peerDependencies": {
"nx": ">= 22 <= 24 || ^23.0.0-0"
},
"publishConfig": {
"access": "public"
},
"nx-migrations": {
"migrations": "./migrations.json",
"supportsOptionalMigrations": true
},
"exports": {
".": {
"@nx/nx-source": "./index.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json",
"./migrations.json": "./migrations.json",
"./internal": {
"@nx/nx-source": "./internal.ts",
"types": "./dist/internal.d.ts",
"default": "./dist/internal.js"
},
"./internal-testing-utils": {
"@nx/nx-source": "./internal-testing-utils.ts",
"types": "./dist/internal-testing-utils.d.ts",
"default": "./dist/internal-testing-utils.js"
},
"./internal-testing-utils/mock-project-graph": {
"@nx/nx-source": "./internal-testing-utils/mock-project-graph.ts",
"types": "./dist/internal-testing-utils/mock-project-graph.d.ts",
"default": "./dist/internal-testing-utils/mock-project-graph.js"
},
"./internal-testing-utils/mock-fs": {
"@nx/nx-source": "./internal-testing-utils/mock-fs.ts",
"types": "./dist/internal-testing-utils/mock-fs.d.ts",
"default": "./dist/internal-testing-utils/mock-fs.js"
},
"./internal-testing-utils/mock-prettier": {
"@nx/nx-source": "./internal-testing-utils/mock-prettier.ts",
"types": "./dist/internal-testing-utils/mock-prettier.d.ts",
"default": "./dist/internal-testing-utils/mock-prettier.js"
},
"./ngcli-adapter": {
"@nx/nx-source": "./ngcli-adapter.ts",
"types": "./dist/ngcli-adapter.d.ts",
"default": "./dist/ngcli-adapter.js"
},
"./testing": {
"@nx/nx-source": "./testing.ts",
"types": "./dist/testing.d.ts",
"default": "./dist/testing.js"
}
}
}