depfresh 0.9.2

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.
@@ -0,0 +1,145 @@
1
+ import './config.mjs';
2
+ import { c as createLogger } from '../shared/depfresh.B1o7OHO_.mjs';
3
+ import { execSync } from 'node:child_process';
4
+ import '../shared/depfresh.ClIHCCxD.mjs';
5
+
6
+ function detectGlobalPackageManager(pm) {
7
+ if (pm && (pm === "npm" || pm === "pnpm" || pm === "bun")) {
8
+ return pm;
9
+ }
10
+ try {
11
+ execSync("pnpm --version", { stdio: "ignore" });
12
+ return "pnpm";
13
+ } catch {
14
+ }
15
+ try {
16
+ execSync("bun --version", { stdio: "ignore" });
17
+ return "bun";
18
+ } catch {
19
+ }
20
+ return "npm";
21
+ }
22
+ function parseNpmGlobalList(json) {
23
+ try {
24
+ const data = JSON.parse(json);
25
+ if (!data.dependencies || typeof data.dependencies !== "object") {
26
+ return [];
27
+ }
28
+ return Object.entries(data.dependencies).map(([name, info]) => ({
29
+ name,
30
+ version: info.version
31
+ }));
32
+ } catch {
33
+ return [];
34
+ }
35
+ }
36
+ function parsePnpmGlobalList(json) {
37
+ try {
38
+ const data = JSON.parse(json);
39
+ if (!Array.isArray(data) || data.length === 0) {
40
+ return [];
41
+ }
42
+ const deps = data[0]?.dependencies;
43
+ if (!deps || typeof deps !== "object") {
44
+ return [];
45
+ }
46
+ return Object.entries(deps).map(([name, info]) => ({
47
+ name,
48
+ version: info.version
49
+ }));
50
+ } catch {
51
+ return [];
52
+ }
53
+ }
54
+ function parseBunGlobalList(output) {
55
+ const results = [];
56
+ const lines = output.split("\n");
57
+ for (const line of lines) {
58
+ const match = line.match(/[├└]──\s+(.+)@(\d.+)/);
59
+ if (match) {
60
+ results.push({ name: match[1], version: match[2] });
61
+ }
62
+ }
63
+ return results;
64
+ }
65
+ function listGlobalPackages(pm) {
66
+ try {
67
+ switch (pm) {
68
+ case "npm": {
69
+ const output = execSync("npm list -g --depth=0 --json", { encoding: "utf-8" });
70
+ return parseNpmGlobalList(output);
71
+ }
72
+ case "pnpm": {
73
+ const output = execSync("pnpm list -g --json", { encoding: "utf-8" });
74
+ return parsePnpmGlobalList(output);
75
+ }
76
+ case "bun": {
77
+ const output = execSync("bun pm ls -g", { encoding: "utf-8" });
78
+ return parseBunGlobalList(output);
79
+ }
80
+ case "yarn":
81
+ return [];
82
+ }
83
+ } catch {
84
+ return [];
85
+ }
86
+ }
87
+ function loadGlobalPackages(pm) {
88
+ const detectedPm = detectGlobalPackageManager(pm);
89
+ const packages = listGlobalPackages(detectedPm);
90
+ if (packages.length === 0) {
91
+ return [];
92
+ }
93
+ const deps = packages.map((pkg) => ({
94
+ name: pkg.name,
95
+ currentVersion: pkg.version,
96
+ source: "dependencies",
97
+ update: true,
98
+ parents: []
99
+ }));
100
+ return [
101
+ {
102
+ name: "Global packages",
103
+ type: "global",
104
+ filepath: `global:${detectedPm}`,
105
+ deps,
106
+ resolved: [],
107
+ raw: {},
108
+ indent: " "
109
+ }
110
+ ];
111
+ }
112
+ function writeGlobalPackage(pm, name, version) {
113
+ const logger = createLogger("info");
114
+ switch (pm) {
115
+ case "npm":
116
+ execSync(`npm install -g ${name}@${version}`, { stdio: "inherit" });
117
+ break;
118
+ case "pnpm":
119
+ execSync(`pnpm add -g ${name}@${version}`, { stdio: "inherit" });
120
+ break;
121
+ case "bun":
122
+ execSync(`bun add -g ${name}@${version}`, { stdio: "inherit" });
123
+ break;
124
+ case "yarn":
125
+ logger.warn("Yarn global packages not supported");
126
+ break;
127
+ }
128
+ }
129
+
130
+ const global = {
131
+ __proto__: null,
132
+ detectGlobalPackageManager: detectGlobalPackageManager,
133
+ listGlobalPackages: listGlobalPackages,
134
+ loadGlobalPackages: loadGlobalPackages,
135
+ parseBunGlobalList: parseBunGlobalList,
136
+ parseNpmGlobalList: parseNpmGlobalList,
137
+ parsePnpmGlobalList: parsePnpmGlobalList,
138
+ writeGlobalPackage: writeGlobalPackage
139
+ };
140
+
141
+ function defineConfig(options) {
142
+ return options;
143
+ }
144
+
145
+ export { defineConfig as d, global as g, loadGlobalPackages as l, writeGlobalPackage as w };
@@ -0,0 +1,85 @@
1
+ import * as p from '@clack/prompts';
2
+ import c from 'ansis';
3
+ import { a as arrow, b as colorizeVersionDiff, e as colorDiff } from '../shared/depfresh.ClIHCCxD.mjs';
4
+ import '../shared/depfresh.B1o7OHO_.mjs';
5
+ import 'node:fs';
6
+ import 'node:os';
7
+ import 'find-up-simple';
8
+ import 'ini';
9
+ import 'pathe';
10
+ import 'node:child_process';
11
+ import 'detect-indent';
12
+ import 'semver';
13
+ import 'pnpm-workspace-yaml';
14
+ import 'yaml';
15
+ import 'p-limit';
16
+ import 'better-sqlite3';
17
+ import 'tinyglobby';
18
+
19
+ const DIFF_GROUP_ORDER = ["major", "minor", "patch"];
20
+ const GROUP_COLORS = {
21
+ major: c.red,
22
+ minor: c.yellow,
23
+ patch: c.green
24
+ };
25
+ function makeOption(dep) {
26
+ return {
27
+ value: dep.name,
28
+ label: `${dep.name} ${dep.currentVersion}${arrow()}${colorizeVersionDiff(dep.currentVersion, dep.targetVersion, dep.diff)} ${colorDiff(dep.diff)}`,
29
+ hint: dep.deprecated ? c.red("deprecated") : void 0
30
+ };
31
+ }
32
+ async function runClackFallback(updates) {
33
+ const grouped = /* @__PURE__ */ new Map();
34
+ for (const dep of updates) {
35
+ const existing = grouped.get(dep.diff);
36
+ if (existing) {
37
+ existing.push(dep);
38
+ } else {
39
+ grouped.set(dep.diff, [dep]);
40
+ }
41
+ }
42
+ const hasStandardGroups = DIFF_GROUP_ORDER.some((d) => grouped.has(d));
43
+ if (!hasStandardGroups) {
44
+ const options = updates.map(makeOption);
45
+ const selected2 = await p.multiselect({
46
+ message: "Select dependencies to update",
47
+ options,
48
+ required: false
49
+ });
50
+ if (p.isCancel(selected2)) {
51
+ p.cancel("Update cancelled");
52
+ return [];
53
+ }
54
+ return updates.filter((u) => selected2.includes(u.name));
55
+ }
56
+ const groupOptions = {};
57
+ for (const diffType of DIFF_GROUP_ORDER) {
58
+ const deps = grouped.get(diffType);
59
+ if (!deps) continue;
60
+ const colorFn = GROUP_COLORS[diffType];
61
+ const label = colorFn ? colorFn(diffType) : diffType;
62
+ groupOptions[label] = deps.map(makeOption);
63
+ }
64
+ const selected = await p.groupMultiselect({
65
+ message: "Select dependencies to update",
66
+ options: groupOptions,
67
+ required: false,
68
+ selectableGroups: true
69
+ });
70
+ if (p.isCancel(selected)) {
71
+ p.cancel("Update cancelled");
72
+ return [];
73
+ }
74
+ return updates.filter((u) => selected.includes(u.name));
75
+ }
76
+ async function runInteractive(updates, options) {
77
+ if (updates.length === 0) return [];
78
+ if (process.stdin.isTTY && process.stdout.isTTY) {
79
+ const { createInteractiveTUI } = await import('./index2.mjs');
80
+ return createInteractiveTUI(updates, { explain: options?.explain ?? false });
81
+ }
82
+ return runClackFallback(updates);
83
+ }
84
+
85
+ export { runInteractive };
@@ -0,0 +1,59 @@
1
+ const VALID_MODES = /* @__PURE__ */ new Set([
2
+ "default",
3
+ "major",
4
+ "minor",
5
+ "patch",
6
+ "latest",
7
+ "newest",
8
+ "next"
9
+ ]);
10
+ async function normalizeArgs(args) {
11
+ const { resolveConfig } = await import('./config.mjs').then(function (n) { return n.c; });
12
+ const depFields = {};
13
+ if (args["deps-only"]) {
14
+ depFields.devDependencies = false;
15
+ depFields.peerDependencies = false;
16
+ depFields.optionalDependencies = false;
17
+ }
18
+ if (args["dev-only"]) {
19
+ depFields.dependencies = false;
20
+ depFields.peerDependencies = false;
21
+ depFields.optionalDependencies = false;
22
+ }
23
+ const mode = args.mode_arg && VALID_MODES.has(args.mode_arg) ? args.mode_arg : args.mode;
24
+ const include = typeof args.include === "string" ? args.include.split(",").map((s) => s.trim()) : void 0;
25
+ const exclude = typeof args.exclude === "string" ? args.exclude.split(",").map((s) => s.trim()) : void 0;
26
+ return resolveConfig({
27
+ cwd: args.cwd || process.cwd(),
28
+ recursive: args.recursive,
29
+ write: args.write,
30
+ interactive: args.interactive,
31
+ mode,
32
+ include,
33
+ exclude,
34
+ force: args.force,
35
+ global: args.global,
36
+ peer: args.peer,
37
+ includeLocked: args["include-locked"],
38
+ output: args.output,
39
+ concurrency: Number.parseInt(args.concurrency, 10),
40
+ loglevel: args.loglevel,
41
+ depFields,
42
+ all: args.all,
43
+ group: args.group,
44
+ sort: args.sort,
45
+ timediff: args.timediff,
46
+ cooldown: Number.parseInt(args.cooldown, 10),
47
+ nodecompat: args.nodecompat,
48
+ long: args.long,
49
+ explain: args.explain,
50
+ install: args.install,
51
+ update: args.update,
52
+ execute: args.execute,
53
+ verifyCommand: args["verify-command"],
54
+ failOnOutdated: args["fail-on-outdated"],
55
+ ignoreOtherWorkspaces: args["ignore-other-workspaces"]
56
+ });
57
+ }
58
+
59
+ export { normalizeArgs };
package/dist/cli.d.mts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { };
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { };
package/dist/cli.mjs ADDED
@@ -0,0 +1,202 @@
1
+ #!/usr/bin/env node
2
+ import { defineCommand, runMain } from 'citty';
3
+
4
+ const version = "0.9.2";
5
+
6
+ const args = {
7
+ mode_arg: {
8
+ type: "positional",
9
+ description: "Version range mode shorthand (major, minor, patch, latest, newest, next)",
10
+ required: false
11
+ },
12
+ cwd: {
13
+ type: "string",
14
+ alias: "C",
15
+ description: "Working directory for depzy to run in"
16
+ },
17
+ recursive: {
18
+ type: "boolean",
19
+ alias: "r",
20
+ description: "Recursively search for package.json in subdirectories",
21
+ default: true
22
+ },
23
+ write: {
24
+ type: "boolean",
25
+ alias: "w",
26
+ description: "Write updated versions to package files",
27
+ default: false
28
+ },
29
+ interactive: {
30
+ type: "boolean",
31
+ alias: "I",
32
+ description: "Interactive mode \u2014 select which deps to update",
33
+ default: false
34
+ },
35
+ mode: {
36
+ type: "string",
37
+ alias: "m",
38
+ description: "Version range mode: default, major, minor, patch, latest, newest, next",
39
+ default: "default"
40
+ },
41
+ include: {
42
+ type: "string",
43
+ alias: "n",
44
+ description: "Only include packages matching this regex (comma-separated)"
45
+ },
46
+ exclude: {
47
+ type: "string",
48
+ alias: "x",
49
+ description: "Exclude packages matching this regex (comma-separated)"
50
+ },
51
+ force: {
52
+ type: "boolean",
53
+ alias: "f",
54
+ description: "Force update even if the version is satisfied",
55
+ default: false
56
+ },
57
+ global: {
58
+ type: "boolean",
59
+ alias: "g",
60
+ description: "Check global packages",
61
+ default: false
62
+ },
63
+ peer: {
64
+ type: "boolean",
65
+ alias: "P",
66
+ description: "Include peer dependencies",
67
+ default: false
68
+ },
69
+ "include-locked": {
70
+ type: "boolean",
71
+ alias: "l",
72
+ description: "Include locked (pinned) dependencies",
73
+ default: false
74
+ },
75
+ output: {
76
+ type: "string",
77
+ alias: "o",
78
+ description: "Output format: table, json, sarif",
79
+ default: "table"
80
+ },
81
+ concurrency: {
82
+ type: "string",
83
+ alias: "c",
84
+ description: "Max concurrent registry requests",
85
+ default: "16"
86
+ },
87
+ loglevel: {
88
+ type: "string",
89
+ description: "Log level: silent, info, debug",
90
+ default: "info"
91
+ },
92
+ "deps-only": {
93
+ type: "boolean",
94
+ description: "Only check dependencies (not devDependencies)",
95
+ default: false
96
+ },
97
+ "dev-only": {
98
+ type: "boolean",
99
+ description: "Only check devDependencies",
100
+ default: false
101
+ },
102
+ all: {
103
+ type: "boolean",
104
+ alias: "a",
105
+ description: "Show all packages including up-to-date ones",
106
+ default: false
107
+ },
108
+ group: {
109
+ type: "boolean",
110
+ alias: "G",
111
+ description: "Group output by dependency source",
112
+ default: true
113
+ },
114
+ sort: {
115
+ type: "string",
116
+ alias: "s",
117
+ description: "Sort order: diff-asc, diff-desc, time-asc, time-desc, name-asc, name-desc",
118
+ default: "diff-asc"
119
+ },
120
+ timediff: {
121
+ type: "boolean",
122
+ alias: "T",
123
+ description: "Show time since version was published",
124
+ default: true
125
+ },
126
+ cooldown: {
127
+ type: "string",
128
+ description: "Skip versions published less than N days ago (0 = disabled)",
129
+ default: "0"
130
+ },
131
+ nodecompat: {
132
+ type: "boolean",
133
+ description: "Show Node.js engine compatibility for target versions",
134
+ default: true
135
+ },
136
+ long: {
137
+ type: "boolean",
138
+ alias: "L",
139
+ description: "Show extra details (homepage URL) per package",
140
+ default: false
141
+ },
142
+ explain: {
143
+ type: "boolean",
144
+ alias: "E",
145
+ description: "Show human-readable explanations for update types in interactive mode",
146
+ default: false
147
+ },
148
+ install: {
149
+ type: "boolean",
150
+ alias: "i",
151
+ description: "Run package manager install after writing",
152
+ default: false
153
+ },
154
+ update: {
155
+ type: "boolean",
156
+ alias: "u",
157
+ description: "Run package manager update instead of install after writing",
158
+ default: false
159
+ },
160
+ execute: {
161
+ type: "string",
162
+ alias: "e",
163
+ description: 'Run command after writing updates (e.g. "pnpm test")'
164
+ },
165
+ "verify-command": {
166
+ type: "string",
167
+ alias: "V",
168
+ description: "Run command after each dep update, revert on failure"
169
+ },
170
+ "fail-on-outdated": {
171
+ type: "boolean",
172
+ description: "Exit with code 1 when outdated dependencies are found (CI mode)",
173
+ default: false
174
+ },
175
+ "ignore-other-workspaces": {
176
+ type: "boolean",
177
+ description: "Skip packages that belong to nested/separate workspaces",
178
+ default: true
179
+ }
180
+ };
181
+
182
+ const main = defineCommand({
183
+ meta: {
184
+ name: "depzy",
185
+ version,
186
+ description: "Keep your npm dependencies fresh"
187
+ },
188
+ args,
189
+ async run({ args: args2 }) {
190
+ try {
191
+ const { normalizeArgs } = await import('./chunks/normalize-args.mjs');
192
+ const { check } = await import('./chunks/index.mjs');
193
+ const options = await normalizeArgs(args2);
194
+ const exitCode = await check(options);
195
+ process.exit(exitCode);
196
+ } catch (error) {
197
+ console.error("Fatal error:", error instanceof Error ? error.message : String(error));
198
+ process.exit(2);
199
+ }
200
+ }
201
+ });
202
+ runMain(main);
@@ -0,0 +1,204 @@
1
+ type ProvenanceLevel = 'trusted' | 'attested' | 'none';
2
+ interface PackageData {
3
+ name: string;
4
+ versions: string[];
5
+ distTags: Record<string, string>;
6
+ time?: Record<string, string>;
7
+ deprecated?: Record<string, string>;
8
+ description?: string;
9
+ homepage?: string;
10
+ repository?: string;
11
+ provenance?: Record<string, ProvenanceLevel>;
12
+ engines?: Record<string, string>;
13
+ }
14
+ interface RegistryConfig {
15
+ url: string;
16
+ token?: string;
17
+ authType?: 'bearer' | 'basic';
18
+ scope?: string;
19
+ }
20
+ interface NpmrcConfig {
21
+ registries: Map<string, RegistryConfig>;
22
+ defaultRegistry: string;
23
+ proxy?: string;
24
+ httpsProxy?: string;
25
+ strictSsl: boolean;
26
+ cafile?: string;
27
+ }
28
+
29
+ type RangeMode = 'default' | 'major' | 'minor' | 'patch' | 'latest' | 'newest' | 'next' | 'ignore';
30
+ type DiffType = 'major' | 'minor' | 'patch' | 'none' | 'error';
31
+ type SortOption = 'diff-asc' | 'diff-desc' | 'time-asc' | 'time-desc' | 'name-asc' | 'name-desc';
32
+ type DepFieldType = 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies' | 'overrides' | 'resolutions' | 'packageManager' | 'pnpm.overrides' | 'catalog';
33
+ interface RawDep {
34
+ name: string;
35
+ currentVersion: string;
36
+ source: DepFieldType;
37
+ update: boolean;
38
+ parents: string[];
39
+ aliasName?: string;
40
+ protocol?: string;
41
+ }
42
+ interface UpdateScore {
43
+ confidence: number;
44
+ maturity: number;
45
+ adoption: number;
46
+ breaking: boolean;
47
+ }
48
+ interface ResolvedDepChange extends RawDep {
49
+ targetVersion: string;
50
+ diff: DiffType;
51
+ pkgData: PackageData;
52
+ resolvedUrl?: string;
53
+ deprecated?: string | boolean;
54
+ latestVersion?: string;
55
+ publishedAt?: string;
56
+ currentVersionTime?: string;
57
+ score?: UpdateScore;
58
+ provenance?: ProvenanceLevel;
59
+ currentProvenance?: ProvenanceLevel;
60
+ nodeCompat?: string;
61
+ nodeCompatible?: boolean;
62
+ }
63
+
64
+ type PackageManagerName = 'npm' | 'pnpm' | 'yarn' | 'bun';
65
+ type OutputFormat = 'table' | 'json' | 'sarif';
66
+ interface PackageManagerField {
67
+ name: PackageManagerName;
68
+ version: string;
69
+ hash?: string;
70
+ raw: string;
71
+ }
72
+ interface CatalogSource {
73
+ type: 'pnpm' | 'bun' | 'yarn';
74
+ name: string;
75
+ filepath: string;
76
+ deps: RawDep[];
77
+ raw: unknown;
78
+ indent: string;
79
+ }
80
+ type PackageType = 'package.json' | 'package.yaml' | 'pnpm-workspace' | 'bun-workspace' | 'yarn-workspace' | 'global';
81
+ interface PackageMeta {
82
+ name: string;
83
+ type: PackageType;
84
+ filepath: string;
85
+ deps: RawDep[];
86
+ resolved: ResolvedDepChange[];
87
+ raw: unknown;
88
+ indent: string;
89
+ catalogs?: CatalogSource[];
90
+ packageManager?: PackageManagerField;
91
+ }
92
+
93
+ interface DepzyOptions {
94
+ cwd: string;
95
+ recursive: boolean;
96
+ mode: RangeMode;
97
+ write: boolean;
98
+ interactive: boolean;
99
+ force: boolean;
100
+ includeLocked: boolean;
101
+ includeWorkspace: boolean;
102
+ include?: string[];
103
+ exclude?: string[];
104
+ depFields?: Partial<Record<DepFieldType, boolean>>;
105
+ packageMode?: Record<string, RangeMode>;
106
+ concurrency: number;
107
+ timeout: number;
108
+ retries: number;
109
+ cacheTTL: number;
110
+ output: OutputFormat;
111
+ loglevel: 'silent' | 'info' | 'debug';
112
+ peer: boolean;
113
+ global: boolean;
114
+ ignorePaths: string[];
115
+ ignoreOtherWorkspaces: boolean;
116
+ all: boolean;
117
+ group: boolean;
118
+ sort: SortOption;
119
+ timediff: boolean;
120
+ cooldown: number;
121
+ nodecompat: boolean;
122
+ long: boolean;
123
+ explain: boolean;
124
+ failOnOutdated: boolean;
125
+ install: boolean;
126
+ update: boolean;
127
+ execute?: string;
128
+ verifyCommand?: string;
129
+ beforePackageStart?: (pkg: PackageMeta) => void | Promise<void>;
130
+ onDependencyResolved?: (pkg: PackageMeta, dep: ResolvedDepChange) => void | Promise<void>;
131
+ beforePackageWrite?: (pkg: PackageMeta) => boolean | Promise<boolean>;
132
+ afterPackageWrite?: (pkg: PackageMeta) => void | Promise<void>;
133
+ afterPackagesLoaded?: (pkgs: PackageMeta[]) => void | Promise<void>;
134
+ afterPackageEnd?: (pkg: PackageMeta) => void | Promise<void>;
135
+ afterPackagesEnd?: (pkgs: PackageMeta[]) => void | Promise<void>;
136
+ }
137
+ declare const DEFAULT_OPTIONS: Partial<DepzyOptions>;
138
+
139
+ declare function check(options: DepzyOptions): Promise<number>;
140
+
141
+ declare function resolveConfig(overrides?: Partial<DepzyOptions>): Promise<DepzyOptions>;
142
+
143
+ interface DepzyErrorOptions {
144
+ cause?: unknown;
145
+ }
146
+ /**
147
+ * Base error class for all depzy runtime errors.
148
+ * Allows API users to reliably branch on `instanceof DepzyError` and `code`.
149
+ */
150
+ declare class DepzyError extends Error {
151
+ readonly code: string;
152
+ readonly cause?: unknown;
153
+ constructor(message: string, code: string, options?: DepzyErrorOptions);
154
+ }
155
+ declare class RegistryError extends DepzyError {
156
+ readonly status: number;
157
+ readonly url: string;
158
+ constructor(message: string, status: number, url: string, options?: DepzyErrorOptions);
159
+ }
160
+ declare class CacheError extends DepzyError {
161
+ constructor(message: string, options?: DepzyErrorOptions);
162
+ }
163
+ declare class ConfigError extends DepzyError {
164
+ constructor(message: string, options?: DepzyErrorOptions);
165
+ }
166
+ declare class WriteError extends DepzyError {
167
+ constructor(message: string, options?: DepzyErrorOptions);
168
+ }
169
+ declare class ResolveError extends DepzyError {
170
+ constructor(message: string, options?: DepzyErrorOptions);
171
+ }
172
+
173
+ declare function parseDependencies(raw: Record<string, unknown>, options: DepzyOptions): RawDep[];
174
+
175
+ declare function loadGlobalPackages(pm?: string): PackageMeta[];
176
+ declare function writeGlobalPackage(pm: PackageManagerName, name: string, version: string): void;
177
+
178
+ declare function loadPackages(options: DepzyOptions): Promise<PackageMeta[]>;
179
+
180
+ interface Cache {
181
+ get(key: string): PackageData | undefined;
182
+ set(key: string, data: PackageData, ttl: number): void;
183
+ has(key: string): boolean;
184
+ clear(): void;
185
+ close(): void;
186
+ stats(): {
187
+ hits: number;
188
+ misses: number;
189
+ size: number;
190
+ };
191
+ }
192
+
193
+ declare function resolvePackage(pkg: PackageMeta, options: DepzyOptions, externalCache?: Cache, externalNpmrc?: NpmrcConfig, privatePackages?: Set<string>, onDependencyProcessed?: (pkg: PackageMeta, dep: RawDep) => void | Promise<void>): Promise<ResolvedDepChange[]>;
194
+
195
+ /**
196
+ * Single-writer architecture: reads once, applies all mutations, writes once.
197
+ * Never allow independent writers to clobber each other.
198
+ */
199
+ declare function writePackage(pkg: PackageMeta, changes: ResolvedDepChange[], loglevel?: 'silent' | 'info' | 'debug'): void;
200
+
201
+ declare function defineConfig(options: Partial<DepzyOptions>): Partial<DepzyOptions>;
202
+
203
+ export { CacheError, ConfigError, DEFAULT_OPTIONS, DepzyError, RegistryError, ResolveError, WriteError, check, defineConfig, loadGlobalPackages, loadPackages, parseDependencies, resolveConfig, resolvePackage, writeGlobalPackage, writePackage };
204
+ export type { CatalogSource, DepFieldType, DepzyOptions, DiffType, NpmrcConfig, OutputFormat, PackageData, PackageManagerField, PackageManagerName, PackageMeta, PackageType, ProvenanceLevel, RangeMode, RawDep, RegistryConfig, ResolvedDepChange, SortOption, UpdateScore };