@baicie/ncu 0.1.14 → 0.1.16
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/build/chunks/source.js +6 -0
- package/build/chunks/source.js.map +1 -0
- package/build/chunks/src.js +374 -0
- package/build/chunks/src.js.map +1 -0
- package/build/chunks/strip-ansi.js +2 -0
- package/build/chunks/strip-ansi.js.map +1 -0
- package/build/cli.d.ts +1 -1
- package/build/cli.js +7 -32
- package/build/cli.js.map +1 -1
- package/build/index.d.ts +247 -233
- package/build/index.js +1 -598
- package/package.json +85 -78
- package/build/index-Bl96b__P.js +0 -6
- package/build/index-Bl96b__P.js.map +0 -1
- package/build/index-CG9irf3b.js +0 -2
- package/build/index-CG9irf3b.js.map +0 -1
- package/build/index-CiVmsGI5.js +0 -2
- package/build/index-CiVmsGI5.js.map +0 -1
- package/build/index-DDwixysM.js +0 -32
- package/build/index-DDwixysM.js.map +0 -1
- package/build/index.js.map +0 -1
package/build/index.d.ts
CHANGED
|
@@ -1,233 +1,247 @@
|
|
|
1
|
-
import { SemVer } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
1
|
+
import { SemVer } from "semver-utils";
|
|
2
|
+
|
|
3
|
+
//#region src/types/IndexType.d.ts
|
|
4
|
+
/** A very generic object. */
|
|
5
|
+
type Index<T = any> = Record<string, T>;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/types/PackageFileRepository.d.ts
|
|
8
|
+
/** Represents the repository field in package.json. */
|
|
9
|
+
interface PackageFileRepository {
|
|
10
|
+
url: string;
|
|
11
|
+
directory?: string;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/types/VersionSpec.d.ts
|
|
15
|
+
/** A version specification or range supported as a value in package.json dependencies. Includes SemVer, git urls, npm urls, etc. */
|
|
16
|
+
type VersionSpec = string;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/types/PackageFile.d.ts
|
|
19
|
+
type NestedVersionSpecs = {
|
|
20
|
+
[name: string]: VersionSpec | NestedVersionSpecs;
|
|
21
|
+
};
|
|
22
|
+
/** The relevant bits of a parsed package.json file. */
|
|
23
|
+
interface PackageFile {
|
|
24
|
+
dependencies?: Index<VersionSpec>;
|
|
25
|
+
devDependencies?: Index<VersionSpec>;
|
|
26
|
+
imports?: Index<VersionSpec>;
|
|
27
|
+
engines?: Index<VersionSpec>;
|
|
28
|
+
name?: string;
|
|
29
|
+
packageManager?: string;
|
|
30
|
+
optionalDependencies?: Index<VersionSpec>;
|
|
31
|
+
overrides?: NestedVersionSpecs;
|
|
32
|
+
peerDependencies?: Index<VersionSpec>;
|
|
33
|
+
repository?: string | PackageFileRepository;
|
|
34
|
+
scripts?: Index<string>;
|
|
35
|
+
workspaces?: string[] | {
|
|
36
|
+
packages: string[];
|
|
37
|
+
};
|
|
38
|
+
version?: string;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/CooldownFunction.d.ts
|
|
42
|
+
/** A function that can be provided to the --cooldown option for custom cooldown predicate. */
|
|
43
|
+
type CooldownFunction = (packageName: string) => number | null;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/types/FilterFunction.d.ts
|
|
46
|
+
/** Supported function for the --filter and --reject options. */
|
|
47
|
+
type FilterFunction = (packageName: string, versionRange: SemVer[]) => boolean;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/types/Version.d.ts
|
|
50
|
+
/** An exact version number or value. Includes SemVer and some nonstandard variants for convenience. */
|
|
51
|
+
type Version = string;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/types/FilterResultsFunction.d.ts
|
|
54
|
+
type FilterResultsFunction = (packageName: string, versioningMetadata: {
|
|
55
|
+
currentVersion: VersionSpec;
|
|
56
|
+
currentVersionSemver: SemVer[];
|
|
57
|
+
upgradedVersion: Version;
|
|
58
|
+
upgradedVersionSemver: SemVer;
|
|
59
|
+
}) => boolean;
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/types/UpgradeGroup.d.ts
|
|
62
|
+
type UpgradeGroup = 'major' | 'minor' | 'patch' | 'majorVersionZero' | 'none';
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/types/GroupFunction.d.ts
|
|
65
|
+
/** Customize how packages are divided into groups when using `--format group`. Run "ncu --help --groupFunction" for details. */
|
|
66
|
+
type GroupFunction = (packageName: string, defaultGroup: UpgradeGroup, currentVersionSpec: SemVer[], upgradedVersionSpec: SemVer[], upgradedVersion: SemVer | null) => UpgradeGroup | string;
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/types/TargetFunction.d.ts
|
|
69
|
+
/** A function that can be provided to the --target option for custom filtering. */
|
|
70
|
+
type TargetFunction = (packageName: string, versionRange: SemVer[]) => string;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/types/RunOptions.d.ts
|
|
73
|
+
/** Options that can be given on the CLI or passed to the ncu module to control all behavior. */
|
|
74
|
+
interface RunOptions {
|
|
75
|
+
/** Cache versions to a local cache file. Default `--cacheFile` is ~/.ncu-cache.json and default `--cacheExpiration` is 10 minutes. */
|
|
76
|
+
cache?: boolean;
|
|
77
|
+
/** Clear the default cache, or the cache file specified by `--cacheFile`. */
|
|
78
|
+
cacheClear?: boolean;
|
|
79
|
+
/** Cache expiration in minutes. Only works with `--cache`.
|
|
80
|
+
*
|
|
81
|
+
* @default 10
|
|
82
|
+
*/
|
|
83
|
+
cacheExpiration?: number;
|
|
84
|
+
/** Filepath for the cache file. Only works with `--cache`.
|
|
85
|
+
*
|
|
86
|
+
* @default "~/.ncu-cache.json"
|
|
87
|
+
*/
|
|
88
|
+
cacheFile?: string;
|
|
89
|
+
/** Force color in terminal. */
|
|
90
|
+
color?: boolean;
|
|
91
|
+
/** Max number of concurrent HTTP requests to registry.
|
|
92
|
+
*
|
|
93
|
+
* @default 8
|
|
94
|
+
*/
|
|
95
|
+
concurrency?: number;
|
|
96
|
+
/** Config file name. (default: .ncurc.{json,yml,js,cjs}) */
|
|
97
|
+
configFileName?: string;
|
|
98
|
+
/** Directory of .ncurc config file. (default: directory of `packageFile`) */
|
|
99
|
+
configFilePath?: string;
|
|
100
|
+
/** Sets a minimum age (in days) for package versions to be considered for upgrade, reducing the risk of installing newly published, potentially compromised packages. Run "ncu --help --cooldown" for details. */
|
|
101
|
+
cooldown?: number | CooldownFunction;
|
|
102
|
+
/** Working directory in which npm will be executed. */
|
|
103
|
+
cwd?: string;
|
|
104
|
+
/** Run recursively in current working directory. Alias of (`--packageFile '**\/package.json'`). */
|
|
105
|
+
deep?: boolean;
|
|
106
|
+
/** Check one or more sections of dependencies only: dev, optional, peer, prod, or packageManager (comma-delimited).
|
|
107
|
+
*
|
|
108
|
+
* @default ["prod","dev","optional","packageManager"]
|
|
109
|
+
*/
|
|
110
|
+
dep?: string | readonly string[];
|
|
111
|
+
/** Include deprecated packages. Use `--no-deprecated` to exclude deprecated packages (20–25% slower).
|
|
112
|
+
*
|
|
113
|
+
* @default true
|
|
114
|
+
*/
|
|
115
|
+
deprecated?: boolean;
|
|
116
|
+
/** Iteratively installs upgrades and runs tests to identify breaking upgrades. Requires `-u` to execute. Run "ncu --help --doctor" for details. */
|
|
117
|
+
doctor?: boolean;
|
|
118
|
+
/** Specifies the install script to use in doctor mode. (default: `npm install` or the equivalent for your package manager) */
|
|
119
|
+
doctorInstall?: string;
|
|
120
|
+
/** Specifies the test script to use in doctor mode. (default: `npm test`) */
|
|
121
|
+
doctorTest?: string;
|
|
122
|
+
/** Include only packages that satisfy engines.node as specified in the package file. */
|
|
123
|
+
enginesNode?: boolean;
|
|
124
|
+
/** Set the error level. 1: exits with error code 0 if no errors occur. 2: exits with error code 0 if no packages need updating (useful for continuous integration).
|
|
125
|
+
*
|
|
126
|
+
* @default 1
|
|
127
|
+
*/
|
|
128
|
+
errorLevel?: number;
|
|
129
|
+
/** Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Run "ncu --help --filter" for details. */
|
|
130
|
+
filter?: string | RegExp | readonly (string | RegExp)[] | FilterFunction;
|
|
131
|
+
/** Filters results based on a user provided predicate function after fetching new versions. Run "ncu --help --filterResults" for details. */
|
|
132
|
+
filterResults?: FilterResultsFunction;
|
|
133
|
+
/** Filter on package version using comma-or-space-delimited list, /regex/, or predicate function. Run "ncu --help --filterVersion" for details. */
|
|
134
|
+
filterVersion?: string | RegExp | readonly (string | RegExp)[] | FilterFunction;
|
|
135
|
+
/** Modify the output formatting or show additional information. Specify one or more comma-delimited values: dep, group, ownerChanged, repo, time, lines, installedVersion. Run "ncu --help --format" for details. */
|
|
136
|
+
format?: readonly string[];
|
|
137
|
+
/** Check global packages instead of in the current project. */
|
|
138
|
+
global?: boolean;
|
|
139
|
+
/** Customize how packages are divided into groups when using `--format group`. Run "ncu --help --groupFunction" for details. */
|
|
140
|
+
groupFunction?: GroupFunction;
|
|
141
|
+
/** Ignore directories containing package.json files (comma-delimited). */
|
|
142
|
+
ignoreDirs?: string | readonly string[];
|
|
143
|
+
/** Control the auto-install behavior: always, never, prompt. Run "ncu --help --install" for details.
|
|
144
|
+
*
|
|
145
|
+
* @default "prompt"
|
|
146
|
+
*/
|
|
147
|
+
install?: 'always' | 'never' | 'prompt';
|
|
148
|
+
/** Enable interactive prompts for each dependency; implies `-u` unless one of the json options are set. */
|
|
149
|
+
interactive?: boolean;
|
|
150
|
+
/** Output new package file instead of human-readable message. */
|
|
151
|
+
jsonAll?: boolean;
|
|
152
|
+
/** Like `jsonAll` but only lists `dependencies`, `devDependencies`, `optionalDependencies`, etc of the new package data. */
|
|
153
|
+
jsonDeps?: boolean;
|
|
154
|
+
/** Output upgraded dependencies in json. */
|
|
155
|
+
jsonUpgraded?: boolean;
|
|
156
|
+
/** Amount to log: silent, error, minimal, warn, info, verbose, silly.
|
|
157
|
+
*
|
|
158
|
+
* @default "warn"
|
|
159
|
+
*/
|
|
160
|
+
loglevel?: string;
|
|
161
|
+
/** Merges nested configs with the root config file for `--deep` or `--packageFile` options. (default: false) */
|
|
162
|
+
mergeConfig?: boolean;
|
|
163
|
+
/** Do not upgrade newer versions that are already satisfied by the version range according to semver. */
|
|
164
|
+
minimal?: boolean;
|
|
165
|
+
/** Package file data (you can also use stdin). */
|
|
166
|
+
packageData?: string | PackageFile;
|
|
167
|
+
/** Package file(s) location. (default: ./package.json) */
|
|
168
|
+
packageFile?: string;
|
|
169
|
+
/** npm, yarn, pnpm, deno, bun, staticRegistry (default: npm). Run "ncu --help --packageManager" for details. */
|
|
170
|
+
packageManager?: 'npm' | 'yarn' | 'pnpm' | 'deno' | 'bun' | 'staticRegistry';
|
|
171
|
+
/** Check peer dependencies of installed packages and filter updates to compatible versions. Run "ncu --help --peer" for details. */
|
|
172
|
+
peer?: boolean;
|
|
173
|
+
/** Include prerelease versions, e.g. -alpha.0, -beta.5, -rc.2. Automatically set to 1 when `--target` is newest or greatest, or when the current version is a prerelease. (default: 0) */
|
|
174
|
+
pre?: boolean;
|
|
175
|
+
/** Current working directory of npm. */
|
|
176
|
+
prefix?: string;
|
|
177
|
+
/** Specify the registry to use when looking up package versions. */
|
|
178
|
+
registry?: string;
|
|
179
|
+
/** Specify whether --registry refers to a full npm registry or a simple JSON file or url: npm, json. (default: npm) Run "ncu --help --registryType" for details. */
|
|
180
|
+
registryType?: 'npm' | 'json';
|
|
181
|
+
/** Exclude packages matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Run "ncu --help --reject" for details. */
|
|
182
|
+
reject?: string | RegExp | readonly (string | RegExp)[] | FilterFunction;
|
|
183
|
+
/** Exclude package.json versions using comma-or-space-delimited list, /regex/, or predicate function. Run "ncu --help --rejectVersion" for details. */
|
|
184
|
+
rejectVersion?: string | RegExp | readonly (string | RegExp)[] | FilterFunction;
|
|
185
|
+
/** Remove version ranges from the final package version. */
|
|
186
|
+
removeRange?: boolean;
|
|
187
|
+
/** Number of times to retry failed requests for package info.
|
|
188
|
+
*
|
|
189
|
+
* @default 3
|
|
190
|
+
*/
|
|
191
|
+
retry?: number;
|
|
192
|
+
/** Runs updates on the root project in addition to specified workspaces. Only allowed with `--workspace` or `--workspaces`.
|
|
193
|
+
*
|
|
194
|
+
* @default true
|
|
195
|
+
*/
|
|
196
|
+
root?: boolean;
|
|
197
|
+
/** Don't output anything. Alias for `--loglevel` silent. */
|
|
198
|
+
silent?: boolean;
|
|
199
|
+
/** Read package.json from stdin. */
|
|
200
|
+
stdin?: string;
|
|
201
|
+
/** Determines the version to upgrade to: latest, newest, greatest, minor, patch, semver, `@[tag]`, or [function]. (default: latest) Run "ncu --help --target" for details. */
|
|
202
|
+
target?: 'latest' | 'newest' | 'greatest' | 'minor' | 'patch' | 'semver' | `@${string}` | TargetFunction;
|
|
203
|
+
/** Global timeout in milliseconds. (default: no global timeout and 30 seconds per npm-registry-fetch) */
|
|
204
|
+
timeout?: number;
|
|
205
|
+
/** Overwrite package file with upgraded versions instead of just outputting to console. */
|
|
206
|
+
upgrade?: boolean;
|
|
207
|
+
/** Log additional information for debugging. Alias for `--loglevel` verbose. */
|
|
208
|
+
verbose?: boolean;
|
|
209
|
+
/** Run on one or more specified workspaces. Add `--no-root` to exclude the root project. */
|
|
210
|
+
workspace?: readonly string[];
|
|
211
|
+
/** Run on all workspaces. Add `--no-root` to exclude the root project. */
|
|
212
|
+
workspaces?: boolean;
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/types/RcOptions.d.ts
|
|
216
|
+
/** Options that would make no sense in a .ncurc file */
|
|
217
|
+
type Nonsensical = 'configFileName' | 'configFilePath' | 'cwd' | 'packageData' | 'stdin';
|
|
218
|
+
/** Expected options that might be found in an .ncurc file. Since the config is external, this cannot be guaranteed */
|
|
219
|
+
type RcOptions = Omit<RunOptions, Nonsensical> & {
|
|
220
|
+
$schema?: string;
|
|
221
|
+
format?: string | string[];
|
|
222
|
+
};
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/lib/defineConfig.d.ts
|
|
225
|
+
/**
|
|
226
|
+
* TypeScript helper for .npmrc config file. Similar to vite and eslint's
|
|
227
|
+
* defineConfig helper
|
|
228
|
+
*/
|
|
229
|
+
declare function defineConfig(config: RcOptions): RcOptions;
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/index.d.ts
|
|
232
|
+
/** Main entry point.
|
|
233
|
+
*
|
|
234
|
+
* @returns Promise<
|
|
235
|
+
* PackageFile Default returns upgraded package file.
|
|
236
|
+
* | Index<VersionSpec> --jsonUpgraded returns only upgraded dependencies.
|
|
237
|
+
* | void --global upgrade returns void.
|
|
238
|
+
* >
|
|
239
|
+
*/
|
|
240
|
+
declare function run(runOptions?: RunOptions, {
|
|
241
|
+
cli
|
|
242
|
+
}?: {
|
|
243
|
+
cli?: boolean;
|
|
244
|
+
}): Promise<PackageFile | Index<VersionSpec> | void>;
|
|
245
|
+
//#endregion
|
|
246
|
+
export { type RcOptions, type RunOptions, run as default, run, defineConfig };
|
|
247
|
+
//# sourceMappingURL=index.d.ts.map
|