@nx/js 23.2.0-beta.1 → 23.2.0-beta.11
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/README.md +2 -2
- package/dist/internal.d.ts +9 -3
- package/dist/internal.js +28 -17
- package/dist/src/executors/copy-workspace-modules/copy-workspace-modules.js +122 -21
- package/dist/src/executors/node/lib/output-file.js +4 -4
- package/dist/src/executors/node/node.impl.js +9 -10
- package/dist/src/executors/prune-lockfile/prune-lockfile.d.ts +1 -1
- package/dist/src/executors/prune-lockfile/prune-lockfile.js +40 -33
- package/dist/src/executors/tsc/lib/batch/watch.js +3 -3
- package/dist/src/executors/tsc/lib/typescript-compilation.js +1 -1
- package/dist/src/executors/tsc/tsc.batch-impl.d.ts +1 -1
- package/dist/src/executors/tsc/tsc.batch-impl.js +2 -2
- package/dist/src/executors/verdaccio/verdaccio.impl.js +8 -1
- package/dist/src/generators/init/init.js +32 -15
- package/dist/src/generators/init/schema.d.ts +1 -1
- package/dist/src/generators/init/schema.json +1 -1
- package/dist/src/generators/library/library.d.ts +1 -1
- package/dist/src/generators/library/library.js +34 -20
- package/dist/src/generators/library/schema.d.ts +12 -5
- package/dist/src/generators/library/schema.json +15 -4
- package/dist/src/generators/library/utils/add-release-config.js +2 -2
- package/dist/src/generators/setup-build/generator.js +2 -7
- package/dist/src/generators/typescript-sync/typescript-sync.d.ts +1 -1
- package/dist/src/generators/typescript-sync/typescript-sync.js +2 -2
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.js +8 -8
- package/dist/src/migrations/update-23-1-0/add-ignore-deprecations-for-ts6.d.ts +3 -2
- package/dist/src/migrations/update-23-1-0/add-ignore-deprecations-for-ts6.js +17 -11
- package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.d.ts +14 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.js +242 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.md +64 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.d.ts +2 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.js +305 -0
- package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.md +59 -0
- package/dist/src/plugins/typescript/plugin.js +9 -14
- package/dist/src/plugins/typescript/util.d.ts +1 -1
- package/dist/src/release/utils/update-lock-file.js +47 -8
- package/dist/src/release/version-actions.d.ts +12 -3
- package/dist/src/release/version-actions.js +236 -76
- package/dist/src/utils/add-linting-to-project.d.ts +46 -0
- package/dist/src/utils/add-linting-to-project.js +112 -0
- package/dist/src/utils/assets/copy-assets-handler.d.ts +1 -1
- package/dist/src/utils/assets/copy-assets-handler.js +2 -2
- package/dist/src/utils/buildable-libs-utils.js +10 -13
- package/dist/src/utils/find-npm-dependencies.js +7 -10
- package/dist/src/utils/formatter-setup.d.ts +26 -0
- package/dist/src/utils/formatter-setup.js +43 -0
- package/dist/src/utils/generate-globs.js +11 -14
- package/dist/src/utils/generator-prompts.d.ts +2 -1
- package/dist/src/utils/generator-prompts.js +23 -22
- package/dist/src/utils/get-main-file-dir.js +2 -2
- package/dist/src/utils/linter.d.ts +30 -0
- package/dist/src/utils/linter.js +43 -0
- package/dist/src/utils/npm-config.d.ts +1 -1
- package/dist/src/utils/nx-formatter-internals.d.ts +8 -0
- package/dist/src/utils/nx-formatter-internals.js +18 -0
- package/dist/src/utils/oxfmt.d.ts +4 -0
- package/dist/src/utils/oxfmt.js +35 -0
- package/dist/src/utils/package-json/update-package-json.d.ts +1 -1
- package/dist/src/utils/package-json/update-package-json.js +11 -22
- package/dist/src/utils/package-manager-workspaces.js +2 -2
- package/dist/src/utils/pnpm-deploy-output-cache-inputs.d.ts +29 -0
- package/dist/src/utils/pnpm-deploy-output-cache-inputs.js +177 -0
- package/dist/src/utils/pnpm-install-settings-inputs.d.ts +45 -0
- package/dist/src/utils/pnpm-install-settings-inputs.js +77 -0
- package/dist/src/utils/prettier.js +14 -33
- package/dist/src/utils/schema.d.ts +1 -2
- package/dist/src/utils/target-defaults-matching.d.ts +57 -0
- package/dist/src/utils/target-defaults-matching.js +126 -0
- package/dist/src/utils/typescript/configuration.js +3 -5
- package/dist/src/utils/typescript/create-ts-config.d.ts +1 -1
- package/dist/src/utils/typescript/create-ts-config.js +5 -5
- package/dist/src/utils/typescript/plugin.js +2 -2
- package/dist/src/utils/typescript/run-type-check.js +2 -2
- package/dist/src/utils/typescript/ts-config.d.ts +51 -1
- package/dist/src/utils/typescript/ts-config.js +114 -0
- package/dist/src/utils/typescript/ts-solution-setup.d.ts +1 -1
- package/dist/src/utils/typescript/ts-solution-setup.js +3 -3
- package/dist/src/utils/versions.d.ts +1 -0
- package/dist/src/utils/versions.js +2 -1
- package/dist/src/utils/watch-for-single-file-changes.js +2 -2
- package/dist/src/utils/workspace-module-sections.d.ts +16 -0
- package/dist/src/utils/workspace-module-sections.js +24 -0
- package/migrations.json +13 -1
- package/package.json +12 -5
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tsConfigBaseOptions = void 0;
|
|
4
4
|
exports.getTsConfigBaseOptions = getTsConfigBaseOptions;
|
|
5
5
|
exports.extractTsConfigBase = extractTsConfigBase;
|
|
6
|
-
const json_1 = require("nx/src/generators/utils/json");
|
|
7
6
|
const is_typescript_version_at_least_1 = require("../is-typescript-version-at-least");
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
8
|
exports.tsConfigBaseOptions = {
|
|
9
9
|
rootDir: '.',
|
|
10
10
|
sourceMap: true,
|
|
@@ -32,7 +32,7 @@ function getTsConfigBaseOptions(tree) {
|
|
|
32
32
|
function extractTsConfigBase(host) {
|
|
33
33
|
if (host.exists('tsconfig.base.json'))
|
|
34
34
|
return;
|
|
35
|
-
const tsconfig = (0,
|
|
35
|
+
const tsconfig = (0, devkit_1.readJson)(host, 'tsconfig.json');
|
|
36
36
|
const baseCompilerOptions = {};
|
|
37
37
|
if (tsconfig.compilerOptions) {
|
|
38
38
|
for (let compilerOption of Object.keys(exports.tsConfigBaseOptions)) {
|
|
@@ -41,7 +41,7 @@ function extractTsConfigBase(host) {
|
|
|
41
41
|
delete tsconfig.compilerOptions[compilerOption];
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
(0,
|
|
44
|
+
(0, devkit_1.writeJson)(host, 'tsconfig.base.json', {
|
|
45
45
|
compileOnSave: false,
|
|
46
46
|
compilerOptions: baseCompilerOptions,
|
|
47
47
|
exclude: tsconfig.exclude,
|
|
@@ -49,10 +49,10 @@ function extractTsConfigBase(host) {
|
|
|
49
49
|
tsconfig.extends = './tsconfig.base.json';
|
|
50
50
|
delete tsconfig.compileOnSave;
|
|
51
51
|
delete tsconfig.exclude;
|
|
52
|
-
(0,
|
|
52
|
+
(0, devkit_1.writeJson)(host, 'tsconfig.json', tsconfig);
|
|
53
53
|
// special case for updating e2e tests.
|
|
54
54
|
if (host.exists('e2e/tsconfig.json')) {
|
|
55
|
-
(0,
|
|
55
|
+
(0, devkit_1.updateJson)(host, 'e2e/tsconfig.json', (json) => {
|
|
56
56
|
json.extends = '../tsconfig.base.json';
|
|
57
57
|
return json;
|
|
58
58
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureProjectIsIncludedInPluginRegistrations = ensureProjectIsIncludedInPluginRegistrations;
|
|
4
|
-
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
5
4
|
const picomatch = require("picomatch");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, buildTargetName) {
|
|
7
7
|
nxJson.plugins ??= [];
|
|
8
8
|
let isIncluded = false;
|
|
@@ -32,7 +32,7 @@ function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, build
|
|
|
32
32
|
// before the registration's include/exclude filters are applied.
|
|
33
33
|
const tsconfigPath = `${projectRoot}/tsconfig.json`;
|
|
34
34
|
const matchingConfigFiles = picomatch('**/tsconfig.json', { dot: true })(tsconfigPath)
|
|
35
|
-
? (0,
|
|
35
|
+
? (0, internal_1.findMatchingConfigFiles)([tsconfigPath], registration.include, registration.exclude)
|
|
36
36
|
: [];
|
|
37
37
|
if (matchingConfigFiles.length) {
|
|
38
38
|
// it's included by the plugin registration, check if the user-specified options would result
|
|
@@ -6,9 +6,9 @@ exports.getFormattedDiagnostic = getFormattedDiagnostic;
|
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
8
|
const path = tslib_1.__importStar(require("path"));
|
|
9
|
-
const code_frames_1 = require("nx/src/utils/code-frames");
|
|
10
9
|
const highlight_1 = require("../code-frames/highlight");
|
|
11
10
|
const ts_config_1 = require("../../utils/typescript/ts-config");
|
|
11
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
12
12
|
async function runTypeCheckWatch(options, callback) {
|
|
13
13
|
const { ts, workspaceRoot, config, compilerOptions } = await setupTypeScript(options);
|
|
14
14
|
const host = ts.createWatchCompilerHost(config.fileNames, compilerOptions, ts.sys, ts.createEmitAndSemanticDiagnosticsBuilderProgram);
|
|
@@ -133,7 +133,7 @@ function getFormattedDiagnostic(ts, workspaceRoot, diagnostic) {
|
|
|
133
133
|
const code = diagnostic.file.getFullText(diagnostic.file.getSourceFile());
|
|
134
134
|
message +=
|
|
135
135
|
'\n' +
|
|
136
|
-
(0,
|
|
136
|
+
(0, internal_1.codeFrameColumns)(code, {
|
|
137
137
|
start: { line: line, column },
|
|
138
138
|
}, { highlight: highlight_1.highlight });
|
|
139
139
|
}
|
|
@@ -1,7 +1,57 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
|
-
export declare function readTsConfig(tsConfigPath: string, sys?: ts.
|
|
3
|
+
export declare function readTsConfig(tsConfigPath: string, sys?: ts.ParseConfigHost): ts.ParsedCommandLine;
|
|
4
4
|
export declare function readTsConfigFromTree(tree: Tree, tsConfigPath: string): ts.ParsedCommandLine;
|
|
5
|
+
/**
|
|
6
|
+
* The members `createTreeParseConfigHost` overrides: the file system ones are
|
|
7
|
+
* backed by the `Tree`, `realpath`/`getCurrentDirectory` are anchored to
|
|
8
|
+
* `tree.root`, and `useCaseSensitiveFileNames` is platform-derived from
|
|
9
|
+
* `ts.sys`. The returned object still spreads `ts.sys` (TypeScript duck-types
|
|
10
|
+
* the host and reads members this type does not name), so the narrow type is a
|
|
11
|
+
* compile-time guard on Nx callers: everything outside it is disk-backed and
|
|
12
|
+
* escapes the tree.
|
|
13
|
+
*/
|
|
14
|
+
export type TreeParseConfigHost = Required<Pick<ts.ParseConfigHost, 'useCaseSensitiveFileNames' | 'readDirectory' | 'readFile' | 'fileExists' | 'directoryExists' | 'realpath' | 'getCurrentDirectory'>>;
|
|
15
|
+
/**
|
|
16
|
+
* A TypeScript host, backed by the devkit `Tree`, that resolves `extends` the
|
|
17
|
+
* way real `tsc` does. The naive `{ ...ts.sys, readFile: (p) => tree.read(p) }`
|
|
18
|
+
* host resolves less than `tsc`:
|
|
19
|
+
* - A package-form `extends` (e.g. `@tsconfig/node14/tsconfig.json`) is
|
|
20
|
+
* realpath-absolutized by TypeScript; `Tree.read`/`Tree.exists` re-root an
|
|
21
|
+
* absolute path under the workspace, so the base reads as nothing and its
|
|
22
|
+
* options silently vanish from the merged result (the failure surfaces only
|
|
23
|
+
* as a TS5083/TS6053 in `errors`, which callers discard).
|
|
24
|
+
* - An extension-less `extends` resolves against `process.cwd()` when
|
|
25
|
+
* existence comes from `ts.sys`; Nx never chdirs to the workspace root, so it
|
|
26
|
+
* resolves only when the command runs from the root.
|
|
27
|
+
*
|
|
28
|
+
* This host maps absolute paths under `tree.root` back to tree-relative for the
|
|
29
|
+
* tree lookups and falls through to `fs` for paths that resolve outside the
|
|
30
|
+
* workspace (a pnpm store or a `link:`/`file:` target). Resolution is anchored
|
|
31
|
+
* to `tree.root` rather than the working directory: TypeScript resolves a
|
|
32
|
+
* package-form base as a relative path and hands it to `realpath`, and
|
|
33
|
+
* `ts.sys.realpath` would resolve it against `process.cwd()`, so a workspace
|
|
34
|
+
* whose root is not an ancestor of the working directory would read a
|
|
35
|
+
* same-named package from the wrong tree.
|
|
36
|
+
*
|
|
37
|
+
* `readDirectory` is a no-op: the source-file scan is skipped because callers
|
|
38
|
+
* read only the merged `options`, never the file list. A config that resolves
|
|
39
|
+
* its inputs through `include` (or the default glob) then reports a TS18003
|
|
40
|
+
* unless it also carries `files` or `references`, so `errors.length > 0` is not
|
|
41
|
+
* a usable signal; match specific codes (TS5083/TS6053) instead.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createTreeParseConfigHost(tree: Tree): TreeParseConfigHost;
|
|
44
|
+
/**
|
|
45
|
+
* Whether a `ParsedCommandLine` produced with `createTreeParseConfigHost` failed
|
|
46
|
+
* to resolve an `extends` target: TS5083 (the base resolved but could not be
|
|
47
|
+
* read) or TS6053 (the base could not be resolved at all). Because the host
|
|
48
|
+
* resolves what real `tsc` resolves, this only fires for a config whose extends
|
|
49
|
+
* chain `tsc` cannot read either. The no-op `readDirectory` also adds a TS18003
|
|
50
|
+
* whenever the config resolves inputs through `include` and carries neither
|
|
51
|
+
* `files` nor `references`, so `errors.length > 0` is not a usable signal; match
|
|
52
|
+
* these two codes.
|
|
53
|
+
*/
|
|
54
|
+
export declare function extendsResolutionFailed(errors: readonly ts.Diagnostic[]): boolean;
|
|
5
55
|
export declare function getRootTsConfigPathInTree(tree: Tree): string | null;
|
|
6
56
|
export declare function getRelativePathToRootTsConfig(tree: Tree, targetPath: string): string;
|
|
7
57
|
export declare function getRootTsConfigPath(): string | null;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readTsConfig = readTsConfig;
|
|
4
4
|
exports.readTsConfigFromTree = readTsConfigFromTree;
|
|
5
|
+
exports.createTreeParseConfigHost = createTreeParseConfigHost;
|
|
6
|
+
exports.extendsResolutionFailed = extendsResolutionFailed;
|
|
5
7
|
exports.getRootTsConfigPathInTree = getRootTsConfigPathInTree;
|
|
6
8
|
exports.getRelativePathToRootTsConfig = getRelativePathToRootTsConfig;
|
|
7
9
|
exports.getRootTsConfigPath = getRootTsConfigPath;
|
|
@@ -32,6 +34,118 @@ function readTsConfigFromTree(tree, tsConfigPath) {
|
|
|
32
34
|
};
|
|
33
35
|
return readTsConfig(tsConfigPath, tsSysFromTree);
|
|
34
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* A TypeScript host, backed by the devkit `Tree`, that resolves `extends` the
|
|
39
|
+
* way real `tsc` does. The naive `{ ...ts.sys, readFile: (p) => tree.read(p) }`
|
|
40
|
+
* host resolves less than `tsc`:
|
|
41
|
+
* - A package-form `extends` (e.g. `@tsconfig/node14/tsconfig.json`) is
|
|
42
|
+
* realpath-absolutized by TypeScript; `Tree.read`/`Tree.exists` re-root an
|
|
43
|
+
* absolute path under the workspace, so the base reads as nothing and its
|
|
44
|
+
* options silently vanish from the merged result (the failure surfaces only
|
|
45
|
+
* as a TS5083/TS6053 in `errors`, which callers discard).
|
|
46
|
+
* - An extension-less `extends` resolves against `process.cwd()` when
|
|
47
|
+
* existence comes from `ts.sys`; Nx never chdirs to the workspace root, so it
|
|
48
|
+
* resolves only when the command runs from the root.
|
|
49
|
+
*
|
|
50
|
+
* This host maps absolute paths under `tree.root` back to tree-relative for the
|
|
51
|
+
* tree lookups and falls through to `fs` for paths that resolve outside the
|
|
52
|
+
* workspace (a pnpm store or a `link:`/`file:` target). Resolution is anchored
|
|
53
|
+
* to `tree.root` rather than the working directory: TypeScript resolves a
|
|
54
|
+
* package-form base as a relative path and hands it to `realpath`, and
|
|
55
|
+
* `ts.sys.realpath` would resolve it against `process.cwd()`, so a workspace
|
|
56
|
+
* whose root is not an ancestor of the working directory would read a
|
|
57
|
+
* same-named package from the wrong tree.
|
|
58
|
+
*
|
|
59
|
+
* `readDirectory` is a no-op: the source-file scan is skipped because callers
|
|
60
|
+
* read only the merged `options`, never the file list. A config that resolves
|
|
61
|
+
* its inputs through `include` (or the default glob) then reports a TS18003
|
|
62
|
+
* unless it also carries `files` or `references`, so `errors.length > 0` is not
|
|
63
|
+
* a usable signal; match specific codes (TS5083/TS6053) instead.
|
|
64
|
+
*/
|
|
65
|
+
function createTreeParseConfigHost(tree) {
|
|
66
|
+
if (!tsModule) {
|
|
67
|
+
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
|
68
|
+
}
|
|
69
|
+
// Classify with `relative` rather than a string prefix: it normalizes
|
|
70
|
+
// separators, so an absolute path TypeScript hands over with forward slashes
|
|
71
|
+
// still matches a `tree.root` carrying platform separators, and it respects
|
|
72
|
+
// the segment boundary, so a sibling of the root (`/repo/core-utils` for
|
|
73
|
+
// `/repo/core`) is not taken for a path inside it.
|
|
74
|
+
const isOutsideRoot = (path) => {
|
|
75
|
+
if (!(0, path_1.isAbsolute)(path)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const rel = (0, path_1.relative)(tree.root, path);
|
|
79
|
+
return rel === '..' || rel.startsWith(`..${path_1.sep}`) || (0, path_1.isAbsolute)(rel);
|
|
80
|
+
};
|
|
81
|
+
const toTreePath = (path) => (0, path_1.isAbsolute)(path) ? (0, path_1.relative)(tree.root, path) || '.' : path;
|
|
82
|
+
// `ts.sys` gates `readFile`/`fileExists` on `isFile`, so a directory is never
|
|
83
|
+
// read as a config file. Both branches mirror that, which lets an
|
|
84
|
+
// extension-less `extends` ("./config") that collides with a same-named
|
|
85
|
+
// directory fall through to its `.json` sibling. Out-of-root, a bare
|
|
86
|
+
// `existsSync` answers true for a directory and `readFileSync` on it throws
|
|
87
|
+
// EISDIR (TS5012, which the extends-failure guard does not catch); in-root,
|
|
88
|
+
// `tree.exists` also answers true for a directory, so `fileExists` gates on
|
|
89
|
+
// `tree.isFile`.
|
|
90
|
+
const isFileOnDisk = (path) => {
|
|
91
|
+
try {
|
|
92
|
+
return (0, fs_1.statSync)(path).isFile();
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const isDirectoryOnDisk = (path) => {
|
|
99
|
+
try {
|
|
100
|
+
return (0, fs_1.statSync)(path).isDirectory();
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
...tsModule.sys,
|
|
108
|
+
readDirectory: () => [],
|
|
109
|
+
getCurrentDirectory: () => tree.root,
|
|
110
|
+
// A relative path anchored to the workspace instead of `process.cwd()`; an
|
|
111
|
+
// absolute one still goes through `ts.sys` so a symlinked in-root
|
|
112
|
+
// `node_modules` entry resolves to its real (out-of-root) target.
|
|
113
|
+
realpath: (path) => tsModule.sys.realpath((0, path_1.isAbsolute)(path) ? path : (0, path_1.join)(tree.root, path)),
|
|
114
|
+
readFile: (path) => isOutsideRoot(path)
|
|
115
|
+
? isFileOnDisk(path)
|
|
116
|
+
? (0, fs_1.readFileSync)(path, 'utf-8')
|
|
117
|
+
: undefined
|
|
118
|
+
: (tree.read(toTreePath(path), 'utf-8') ?? undefined),
|
|
119
|
+
fileExists: (path) => {
|
|
120
|
+
if (isOutsideRoot(path)) {
|
|
121
|
+
return isFileOnDisk(path);
|
|
122
|
+
}
|
|
123
|
+
const treePath = toTreePath(path);
|
|
124
|
+
return tree.exists(treePath) && tree.isFile(treePath);
|
|
125
|
+
},
|
|
126
|
+
directoryExists: (path) => {
|
|
127
|
+
if (isOutsideRoot(path)) {
|
|
128
|
+
return isDirectoryOnDisk(path);
|
|
129
|
+
}
|
|
130
|
+
const treePath = toTreePath(path);
|
|
131
|
+
return tree.exists(treePath) && !tree.isFile(treePath);
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Whether a `ParsedCommandLine` produced with `createTreeParseConfigHost` failed
|
|
137
|
+
* to resolve an `extends` target: TS5083 (the base resolved but could not be
|
|
138
|
+
* read) or TS6053 (the base could not be resolved at all). Because the host
|
|
139
|
+
* resolves what real `tsc` resolves, this only fires for a config whose extends
|
|
140
|
+
* chain `tsc` cannot read either. The no-op `readDirectory` also adds a TS18003
|
|
141
|
+
* whenever the config resolves inputs through `include` and carries neither
|
|
142
|
+
* `files` nor `references`, so `errors.length > 0` is not a usable signal; match
|
|
143
|
+
* these two codes.
|
|
144
|
+
*/
|
|
145
|
+
function extendsResolutionFailed(errors) {
|
|
146
|
+
// 5083: Cannot read file '{0}'. 6053: File '{0}' not found.
|
|
147
|
+
return errors.some((error) => error.code === 5083 || error.code === 6053);
|
|
148
|
+
}
|
|
35
149
|
function getRootTsConfigPathInTree(tree) {
|
|
36
150
|
for (const path of ['tsconfig.base.json', 'tsconfig.json']) {
|
|
37
151
|
if (tree.exists(path)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ProjectConfiguration, type Tree } from '@nx/devkit';
|
|
2
|
-
import type { JsonInput } from 'nx/
|
|
2
|
+
import type { JsonInput } from '@nx/devkit/internal';
|
|
3
3
|
export declare const TS_SOLUTION_SETUP_TSCONFIG_INPUT: JsonInput;
|
|
4
4
|
export declare function isUsingTypeScriptPlugin(tree: Tree): boolean;
|
|
5
5
|
export declare function shouldConfigureTsSolutionSetup(tree: Tree, addPlugins: boolean, addTsPlugin?: boolean): boolean;
|
|
@@ -15,7 +15,7 @@ exports.getDefinedCustomConditionName = getDefinedCustomConditionName;
|
|
|
15
15
|
const devkit_1 = require("@nx/devkit");
|
|
16
16
|
const node_fs_1 = require("node:fs");
|
|
17
17
|
const posix_1 = require("node:path/posix");
|
|
18
|
-
const
|
|
18
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
19
19
|
const package_manager_workspaces_1 = require("../package-manager-workspaces");
|
|
20
20
|
const configuration_1 = require("./configuration");
|
|
21
21
|
exports.TS_SOLUTION_SETUP_TSCONFIG_INPUT = {
|
|
@@ -48,7 +48,7 @@ function shouldConfigureTsSolutionSetup(tree, addPlugins, addTsPlugin) {
|
|
|
48
48
|
return !tree.exists('tsconfig.base.json') && !tree.exists('tsconfig.json');
|
|
49
49
|
}
|
|
50
50
|
function isUsingTsSolutionSetup(tree) {
|
|
51
|
-
tree ??= new
|
|
51
|
+
tree ??= new internal_1.FsTree(devkit_1.workspaceRoot, false);
|
|
52
52
|
return ((0, package_manager_workspaces_1.isUsingPackageManagerWorkspaces)(tree) &&
|
|
53
53
|
isWorkspaceSetupWithTsSolution(tree));
|
|
54
54
|
}
|
|
@@ -113,7 +113,7 @@ function assertNotUsingTsSolutionSetup(tree, pluginName, generatorName) {
|
|
|
113
113
|
throw new Error(`The ${artifactString} doesn't yet support the existing TypeScript setup. See the error above.`);
|
|
114
114
|
}
|
|
115
115
|
function findRuntimeTsConfigName(projectRoot, tree) {
|
|
116
|
-
tree ??= new
|
|
116
|
+
tree ??= new internal_1.FsTree(devkit_1.workspaceRoot, false);
|
|
117
117
|
if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.app.json')))
|
|
118
118
|
return 'tsconfig.app.json';
|
|
119
119
|
if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.lib.json')))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
2
|
export declare const esbuildVersion = "^0.27.0";
|
|
3
|
+
export declare const oxfmtVersion = "^0.60.0";
|
|
3
4
|
export declare const prettierVersion = "~3.6.2";
|
|
4
5
|
export declare const swcCliVersion = "~0.8.1";
|
|
5
6
|
export declare const swcCoreVersion = "~1.15.5";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.minSupportedTypescriptVersion = exports.typescriptVersion = exports.verdaccioVersion = exports.typesNodeVersion = exports.tsLibVersion = exports.swcNodeVersion = exports.swcHelpersVersion = exports.swcCoreVersion = exports.swcCliVersion = exports.prettierVersion = exports.esbuildVersion = exports.nxVersion = void 0;
|
|
3
|
+
exports.minSupportedTypescriptVersion = exports.typescriptVersion = exports.verdaccioVersion = exports.typesNodeVersion = exports.tsLibVersion = exports.swcNodeVersion = exports.swcHelpersVersion = exports.swcCoreVersion = exports.swcCliVersion = exports.prettierVersion = exports.oxfmtVersion = exports.esbuildVersion = exports.nxVersion = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
exports.nxVersion = require((0, path_1.join)('@nx/js', 'package.json')).version;
|
|
6
6
|
exports.esbuildVersion = '^0.27.0';
|
|
7
|
+
exports.oxfmtVersion = '^0.60.0';
|
|
7
8
|
exports.prettierVersion = '~3.6.2';
|
|
8
9
|
exports.swcCliVersion = '~0.8.1';
|
|
9
10
|
exports.swcCoreVersion = '~1.15.5';
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.watchForSingleFileChanges = watchForSingleFileChanges;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const client_1 = require("nx/src/daemon/client/client");
|
|
6
5
|
const path_1 = require("path");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
async function watchForSingleFileChanges(projectName, projectRoot, relativeFilePath, callback) {
|
|
8
|
-
const unregisterFileWatcher = await
|
|
8
|
+
const unregisterFileWatcher = await internal_1.daemonClient.registerFileWatcher({ watchProjects: [projectName] }, (err, data) => {
|
|
9
9
|
if (err === 'reconnecting') {
|
|
10
10
|
// Silent - daemon restarts automatically on lockfile changes
|
|
11
11
|
return;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-level dependency sections that can declare a workspace module the pruned
|
|
3
|
+
* standalone output must install. copy-workspace-modules copies the module from
|
|
4
|
+
* every one of these sections. prune-lockfile points the module at its copied
|
|
5
|
+
* `file:` directory: in place for dependencies/optionalDependencies/
|
|
6
|
+
* devDependencies, and by moving it into `dependencies` for `peerDependencies`,
|
|
7
|
+
* because pnpm rejects a `file:` spec under peerDependencies (a peer-declared
|
|
8
|
+
* workspace module is installed as a regular dependency instead). A
|
|
9
|
+
* `workspace:*` spec left in any of them fails `pnpm install --frozen-lockfile`
|
|
10
|
+
* (#35425). Transitive copies recurse over dependencies, optionalDependencies,
|
|
11
|
+
* and peerDependencies (TRANSITIVE_INSTALL_SECTIONS in copy-workspace-modules),
|
|
12
|
+
* since pnpm installs a transitive dependency's optional and auto-installed peer
|
|
13
|
+
* deps but never its devDependencies; a transitive workspace-module peer is
|
|
14
|
+
* moved into dependencies the same way.
|
|
15
|
+
*/
|
|
16
|
+
export declare const WORKSPACE_MODULE_INSTALL_SECTIONS: readonly ["dependencies", "optionalDependencies", "devDependencies", "peerDependencies"];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WORKSPACE_MODULE_INSTALL_SECTIONS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* App-level dependency sections that can declare a workspace module the pruned
|
|
6
|
+
* standalone output must install. copy-workspace-modules copies the module from
|
|
7
|
+
* every one of these sections. prune-lockfile points the module at its copied
|
|
8
|
+
* `file:` directory: in place for dependencies/optionalDependencies/
|
|
9
|
+
* devDependencies, and by moving it into `dependencies` for `peerDependencies`,
|
|
10
|
+
* because pnpm rejects a `file:` spec under peerDependencies (a peer-declared
|
|
11
|
+
* workspace module is installed as a regular dependency instead). A
|
|
12
|
+
* `workspace:*` spec left in any of them fails `pnpm install --frozen-lockfile`
|
|
13
|
+
* (#35425). Transitive copies recurse over dependencies, optionalDependencies,
|
|
14
|
+
* and peerDependencies (TRANSITIVE_INSTALL_SECTIONS in copy-workspace-modules),
|
|
15
|
+
* since pnpm installs a transitive dependency's optional and auto-installed peer
|
|
16
|
+
* deps but never its devDependencies; a transitive workspace-module peer is
|
|
17
|
+
* moved into dependencies the same way.
|
|
18
|
+
*/
|
|
19
|
+
exports.WORKSPACE_MODULE_INSTALL_SECTIONS = [
|
|
20
|
+
'dependencies',
|
|
21
|
+
'optionalDependencies',
|
|
22
|
+
'devDependencies',
|
|
23
|
+
'peerDependencies',
|
|
24
|
+
];
|
package/migrations.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"23-1-0-add-ignore-deprecations-for-ts6": {
|
|
33
33
|
"version": "23.1.0-beta.8",
|
|
34
|
-
"description": "Adds `\"ignoreDeprecations\": \"6.0\"` to tsconfig files whose compilerOptions (or ts-node.compilerOptions) carry a TypeScript 6 deprecated option value, set directly or inherited through `extends` including from a base this migration does not edit (e.g. moduleResolution node/node10/classic, baseUrl, target es5, esModuleInterop false, outFile, module amd/umd/system/none, alwaysStrict false, allowSyntheticDefaultImports false, downlevelIteration set). Also pins `\"strict\": false`, `\"noUncheckedSideEffectImports\": false`, `\"types\": [\"*\"]`, and `\"esModuleInterop\": false` in chain-root tsconfigs (no \"extends\") that lack each key, preserving pre-TS6 behavior where these defaults changed; `esModuleInterop` false is itself deprecated (removed in TS7) so it also receives `ignoreDeprecations`, deferring the interop change to the TS7 migration. Also adds `ignoreDeprecations` to every `tsconfig.json` (the exact name jest/ts-node auto-resolve when compiling a config file; ts-node injects a deprecated default `target: es5` there, so the load
|
|
34
|
+
"description": "Adds `\"ignoreDeprecations\": \"6.0\"` to tsconfig files whose compilerOptions (or ts-node.compilerOptions) carry a TypeScript 6 deprecated option value, set directly or inherited through `extends` including from a base this migration does not edit (e.g. moduleResolution node/node10/classic, baseUrl, target es5, esModuleInterop false, outFile, module amd/umd/system/none, alwaysStrict false, allowSyntheticDefaultImports false, downlevelIteration set). Also pins `\"strict\": false`, `\"noUncheckedSideEffectImports\": false`, `\"types\": [\"*\"]`, and `\"esModuleInterop\": false` in chain-root tsconfigs (no \"extends\") that lack each key, preserving pre-TS6 behavior where these defaults changed; `esModuleInterop` false is itself deprecated (removed in TS7) so it also receives `ignoreDeprecations`, deferring the interop change to the TS7 migration. Also adds `ignoreDeprecations` to every `tsconfig.json` (the exact name jest/ts-node auto-resolve when compiling a config file; ts-node injects a deprecated default `target: es5` there, so the load can hit a TS6 error even on a clean config), even one with no deprecated value of its own; a stale local `ignoreDeprecations` (e.g. `5.0`) that would otherwise override the inherited flag is upgraded.",
|
|
35
35
|
"requires": {
|
|
36
36
|
"typescript": ">=6.0.0"
|
|
37
37
|
},
|
|
@@ -46,6 +46,18 @@
|
|
|
46
46
|
},
|
|
47
47
|
"factory": "./dist/src/migrations/update-23-1-0/set-tsconfig-root-dir-for-ts6",
|
|
48
48
|
"documentation": "./dist/src/migrations/update-23-1-0/set-tsconfig-root-dir-for-ts6.md"
|
|
49
|
+
},
|
|
50
|
+
"update-23-2-0-add-pnpm-prune-lockfile-cache-config": {
|
|
51
|
+
"version": "23.2.0-beta.11",
|
|
52
|
+
"description": "Add the pnpm-workspace.yaml, patches, and local_path_modules paths to the outputs of @nx/js:prune-lockfile targets in pnpm workspaces, and the workspace root pnpm-workspace.yaml, package.json, and a pnpm-major runtime probe to their inputs, so a cache replay restores the pnpm install settings, patch files, and vendored local-path dependencies the executor now emits, and a change to the root pnpm install settings or a pnpm major switch does not replay a stale one.",
|
|
53
|
+
"implementation": "./dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config",
|
|
54
|
+
"documentation": "./dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.md"
|
|
55
|
+
},
|
|
56
|
+
"update-23-2-0-add-pnpm-deploy-output-cache-inputs": {
|
|
57
|
+
"version": "23.2.0-beta.11",
|
|
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
|
+
"implementation": "./dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs",
|
|
60
|
+
"documentation": "./dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.md"
|
|
49
61
|
}
|
|
50
62
|
},
|
|
51
63
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
"dependencies": {
|
|
123
|
-
"@babel/core": "^7.
|
|
123
|
+
"@babel/core": "^7.29.6",
|
|
124
124
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
125
125
|
"@babel/plugin-transform-class-properties": "^7.22.5",
|
|
126
126
|
"@babel/plugin-transform-class-static-block": "^7.22.5",
|
|
@@ -147,11 +147,18 @@
|
|
|
147
147
|
"source-map-support": "0.5.19",
|
|
148
148
|
"tinyglobby": "^0.2.12",
|
|
149
149
|
"tslib": "^2.3.0",
|
|
150
|
-
"@nx/devkit": "23.2.0-beta.
|
|
151
|
-
"@nx/workspace": "23.2.0-beta.
|
|
150
|
+
"@nx/devkit": "23.2.0-beta.11",
|
|
151
|
+
"@nx/workspace": "23.2.0-beta.11"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
|
-
"nx": "23.2.0-beta.
|
|
154
|
+
"@nx/esbuild": "23.2.0-beta.11",
|
|
155
|
+
"@nx/eslint": "23.2.0-beta.11",
|
|
156
|
+
"@nx/jest": "23.2.0-beta.11",
|
|
157
|
+
"@nx/oxlint": "23.2.0-beta.11",
|
|
158
|
+
"@nx/rollup": "23.2.0-beta.11",
|
|
159
|
+
"@nx/vite": "23.2.0-beta.11",
|
|
160
|
+
"@nx/vitest": "23.2.0-beta.11",
|
|
161
|
+
"nx": "23.2.0-beta.11"
|
|
155
162
|
},
|
|
156
163
|
"peerDependencies": {
|
|
157
164
|
"@swc/cli": ">=0.6.0 <0.9.0",
|