@stanleysun233/oneproxy-cli 1.0.0
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/bin/onep.js +2 -0
- package/dist/commands.d.ts +15 -0
- package/dist/commands.js +216 -0
- package/dist/commands.js.map +1 -0
- package/dist/control-plane.d.ts +41 -0
- package/dist/control-plane.js +284 -0
- package/dist/control-plane.js.map +1 -0
- package/dist/daemon/http-proxy.d.ts +11 -0
- package/dist/daemon/http-proxy.js +148 -0
- package/dist/daemon/http-proxy.js.map +1 -0
- package/dist/daemon/lifecycle.d.ts +129 -0
- package/dist/daemon/lifecycle.js +350 -0
- package/dist/daemon/lifecycle.js.map +1 -0
- package/dist/daemon/port-selection.d.ts +9 -0
- package/dist/daemon/port-selection.js +61 -0
- package/dist/daemon/port-selection.js.map +1 -0
- package/dist/daemon/router.d.ts +35 -0
- package/dist/daemon/router.js +105 -0
- package/dist/daemon/router.js.map +1 -0
- package/dist/doctor.d.ts +29 -0
- package/dist/doctor.js +178 -0
- package/dist/doctor.js.map +1 -0
- package/dist/init.d.ts +2 -0
- package/dist/init.js +199 -0
- package/dist/init.js.map +1 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.js +130 -0
- package/dist/main.js.map +1 -0
- package/dist/profile.d.ts +2 -0
- package/dist/profile.js +53 -0
- package/dist/profile.js.map +1 -0
- package/dist/session-env.d.ts +8 -0
- package/dist/session-env.js +219 -0
- package/dist/session-env.js.map +1 -0
- package/dist/shell.d.ts +3 -0
- package/dist/shell.js +50 -0
- package/dist/shell.js.map +1 -0
- package/dist/ssh.d.ts +19 -0
- package/dist/ssh.js +83 -0
- package/dist/ssh.js.map +1 -0
- package/dist/storage.d.ts +115 -0
- package/dist/storage.js +224 -0
- package/dist/storage.js.map +1 -0
- package/package.json +27 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export type LocalOverrides = {
|
|
2
|
+
direct: string[];
|
|
3
|
+
proxy: string[];
|
|
4
|
+
};
|
|
5
|
+
export type OneProxyConfig = {
|
|
6
|
+
schemaVersion: number;
|
|
7
|
+
profileName?: string;
|
|
8
|
+
controlPlaneUrl?: string;
|
|
9
|
+
activeTenantId?: string;
|
|
10
|
+
activeGroupId?: string;
|
|
11
|
+
overrides: LocalOverrides;
|
|
12
|
+
};
|
|
13
|
+
export type Account = {
|
|
14
|
+
id: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
account?: string;
|
|
17
|
+
};
|
|
18
|
+
export type OneProxyTokens = {
|
|
19
|
+
schemaVersion: number;
|
|
20
|
+
account?: Account;
|
|
21
|
+
accessToken?: string;
|
|
22
|
+
refreshToken?: string;
|
|
23
|
+
proxyToken?: string;
|
|
24
|
+
accessTokenExpiresAt?: string;
|
|
25
|
+
refreshTokenExpiresAt?: string;
|
|
26
|
+
proxyTokenExpiresAt?: string;
|
|
27
|
+
};
|
|
28
|
+
export type EntryNode = {
|
|
29
|
+
id: string;
|
|
30
|
+
host: string;
|
|
31
|
+
port: number;
|
|
32
|
+
protocol: string;
|
|
33
|
+
};
|
|
34
|
+
export type RouteRule = {
|
|
35
|
+
id: string;
|
|
36
|
+
type: 'domain' | 'suffix' | 'cidr' | 'wildcard';
|
|
37
|
+
pattern: string;
|
|
38
|
+
mode: 'direct' | 'proxy';
|
|
39
|
+
};
|
|
40
|
+
export type RouteGroup = {
|
|
41
|
+
id: string;
|
|
42
|
+
tenantId: string;
|
|
43
|
+
name?: string;
|
|
44
|
+
rules: RouteRule[];
|
|
45
|
+
};
|
|
46
|
+
export type OneProxyState = {
|
|
47
|
+
schemaVersion: number;
|
|
48
|
+
bootstrap?: {
|
|
49
|
+
tenantId?: string;
|
|
50
|
+
groupId?: string;
|
|
51
|
+
entryNodes?: EntryNode[];
|
|
52
|
+
};
|
|
53
|
+
policyRevision?: string;
|
|
54
|
+
fetchedAt?: string;
|
|
55
|
+
routeGroups: RouteGroup[];
|
|
56
|
+
};
|
|
57
|
+
export type DaemonBindings = {
|
|
58
|
+
host: string;
|
|
59
|
+
httpPort: number;
|
|
60
|
+
httpsPort: number;
|
|
61
|
+
ipcPort?: number;
|
|
62
|
+
};
|
|
63
|
+
export type DaemonMetadata = {
|
|
64
|
+
schemaVersion: number;
|
|
65
|
+
pid: number;
|
|
66
|
+
startedAt: string;
|
|
67
|
+
lastHeartbeatAt: string;
|
|
68
|
+
controlPlaneUrl?: string;
|
|
69
|
+
tenantId?: string;
|
|
70
|
+
groupId?: string;
|
|
71
|
+
policyRevision?: string;
|
|
72
|
+
bindings: DaemonBindings;
|
|
73
|
+
portSelection?: {
|
|
74
|
+
candidatePorts: number[];
|
|
75
|
+
selectedPair: [number, number];
|
|
76
|
+
excludedCommonPorts: number[];
|
|
77
|
+
};
|
|
78
|
+
idleTimeoutSeconds?: number;
|
|
79
|
+
};
|
|
80
|
+
export declare const loopbackHost = "127.0.0.1";
|
|
81
|
+
export type ProfileRecord = {
|
|
82
|
+
name: string;
|
|
83
|
+
controlPlaneUrl: string;
|
|
84
|
+
};
|
|
85
|
+
export type ProfilesIndex = {
|
|
86
|
+
schemaVersion: number;
|
|
87
|
+
activeProfile?: string;
|
|
88
|
+
profiles: Record<string, ProfileRecord>;
|
|
89
|
+
};
|
|
90
|
+
export declare function oneProxyHome(): string;
|
|
91
|
+
export declare function profilesFile(): string;
|
|
92
|
+
export declare function activeProfileName(): string;
|
|
93
|
+
export declare function profileRoot(name?: string): string;
|
|
94
|
+
export declare function storageFile(name: 'config' | 'state' | 'tokens' | 'daemon' | 'log'): string;
|
|
95
|
+
export declare function ensureStorageRoot(): Promise<void>;
|
|
96
|
+
export declare function ensureProfileRoot(): Promise<void>;
|
|
97
|
+
export declare function defaultConfig(): OneProxyConfig;
|
|
98
|
+
export declare function readConfig(): Promise<OneProxyConfig>;
|
|
99
|
+
export declare function writeConfig(config: OneProxyConfig): Promise<void>;
|
|
100
|
+
export declare function readProfilesIndex(): Promise<ProfilesIndex>;
|
|
101
|
+
export declare function writeProfilesIndex(index: ProfilesIndex): Promise<void>;
|
|
102
|
+
export declare function profileKey(name: string): string;
|
|
103
|
+
export declare function addProfile(name: string, controlPlaneUrl: string): Promise<ProfileRecord>;
|
|
104
|
+
export declare function useProfile(name: string): Promise<ProfileRecord>;
|
|
105
|
+
export declare function readTokens(): Promise<OneProxyTokens | null>;
|
|
106
|
+
export declare function writeTokens(tokens: OneProxyTokens): Promise<void>;
|
|
107
|
+
export declare function clearTokens(): Promise<void>;
|
|
108
|
+
export declare function readState(): Promise<OneProxyState>;
|
|
109
|
+
export declare function writeState(state: OneProxyState): Promise<void>;
|
|
110
|
+
export declare function readDaemonMetadata(): Promise<DaemonMetadata | null>;
|
|
111
|
+
export declare function writeDaemonMetadata(metadata: DaemonMetadata): Promise<void>;
|
|
112
|
+
export declare function appendLog(message: string): Promise<void>;
|
|
113
|
+
export declare function isLoopbackPortAvailable(port: number): Promise<boolean>;
|
|
114
|
+
export declare function scanAvailableProxyPortPairs(): Promise<Array<[number, number]>>;
|
|
115
|
+
export declare function processIsRunning(pid: number): boolean;
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as fsSync from 'node:fs';
|
|
3
|
+
import * as net from 'node:net';
|
|
4
|
+
import * as os from 'node:os';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
export const loopbackHost = '127.0.0.1';
|
|
7
|
+
const portRangeStart = 10000;
|
|
8
|
+
const portRangeEnd = 60999;
|
|
9
|
+
const commonPorts = new Set([
|
|
10
|
+
20, 21, 22, 25, 53, 67, 68, 80, 110, 123, 143, 161, 389, 443, 445, 465, 587, 631, 993, 995,
|
|
11
|
+
1433, 1521, 2049, 2375, 2376, 3000, 3306, 3389, 5000, 5432, 5601, 5672, 5900, 6379, 8000,
|
|
12
|
+
8080, 8443, 9000, 9200, 9300, 11211, 27017
|
|
13
|
+
]);
|
|
14
|
+
export function oneProxyHome() {
|
|
15
|
+
return process.env.ONEPROXY_HOME || path.join(os.homedir(), '.oneproxy');
|
|
16
|
+
}
|
|
17
|
+
export function profilesFile() {
|
|
18
|
+
return path.join(oneProxyHome(), 'profiles.json');
|
|
19
|
+
}
|
|
20
|
+
export function activeProfileName() {
|
|
21
|
+
const envProfile = process.env.ONEPROXY_PROFILE || process.env.ONEPROXY_ACTIVE_PROFILE;
|
|
22
|
+
if (envProfile) {
|
|
23
|
+
return profileKey(envProfile);
|
|
24
|
+
}
|
|
25
|
+
if (fsSync.existsSync(profilesFile())) {
|
|
26
|
+
const index = JSON.parse(fsSync.readFileSync(profilesFile(), 'utf8'));
|
|
27
|
+
if (index.activeProfile) {
|
|
28
|
+
return profileKey(index.activeProfile);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return 'default';
|
|
32
|
+
}
|
|
33
|
+
export function profileRoot(name = activeProfileName()) {
|
|
34
|
+
return path.join(oneProxyHome(), 'profiles', profileKey(name));
|
|
35
|
+
}
|
|
36
|
+
export function storageFile(name) {
|
|
37
|
+
const names = {
|
|
38
|
+
config: 'config.json',
|
|
39
|
+
state: 'state.json',
|
|
40
|
+
tokens: 'tokens.json',
|
|
41
|
+
daemon: 'daemon.json',
|
|
42
|
+
log: 'onep.log'
|
|
43
|
+
};
|
|
44
|
+
return path.join(profileRoot(), names[name]);
|
|
45
|
+
}
|
|
46
|
+
export async function ensureStorageRoot() {
|
|
47
|
+
await fs.mkdir(oneProxyHome(), { recursive: true, mode: 0o700 });
|
|
48
|
+
}
|
|
49
|
+
export async function ensureProfileRoot() {
|
|
50
|
+
await fs.mkdir(profileRoot(), { recursive: true, mode: 0o700 });
|
|
51
|
+
}
|
|
52
|
+
async function readJson(file) {
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(await fs.readFile(file, 'utf8'));
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
if (error.code === 'ENOENT') {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function writeJson(file, value, mode = 0o600) {
|
|
64
|
+
await fs.mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
65
|
+
await fs.writeFile(file, `${JSON.stringify(value, null, 2)}\n`, { mode });
|
|
66
|
+
if (process.platform !== 'win32') {
|
|
67
|
+
await fs.chmod(file, mode);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function uniqueHosts(items) {
|
|
71
|
+
return [...new Set((items ?? []).map((item) => item.trim().toLowerCase()).filter(Boolean))].sort();
|
|
72
|
+
}
|
|
73
|
+
export function defaultConfig() {
|
|
74
|
+
return {
|
|
75
|
+
schemaVersion: 1,
|
|
76
|
+
profileName: activeProfileName(),
|
|
77
|
+
overrides: { direct: [], proxy: [] }
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export async function readConfig() {
|
|
81
|
+
const config = await readJson(storageFile('config'));
|
|
82
|
+
return {
|
|
83
|
+
...defaultConfig(),
|
|
84
|
+
...config,
|
|
85
|
+
overrides: {
|
|
86
|
+
direct: uniqueHosts(config?.overrides?.direct),
|
|
87
|
+
proxy: uniqueHosts(config?.overrides?.proxy)
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export async function writeConfig(config) {
|
|
92
|
+
await writeJson(storageFile('config'), {
|
|
93
|
+
...config,
|
|
94
|
+
schemaVersion: 1,
|
|
95
|
+
profileName: config.profileName || activeProfileName(),
|
|
96
|
+
overrides: {
|
|
97
|
+
direct: uniqueHosts(config.overrides.direct),
|
|
98
|
+
proxy: uniqueHosts(config.overrides.proxy)
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export async function readProfilesIndex() {
|
|
103
|
+
const index = await readJson(profilesFile());
|
|
104
|
+
return {
|
|
105
|
+
schemaVersion: 1,
|
|
106
|
+
activeProfile: index?.activeProfile,
|
|
107
|
+
profiles: index?.profiles ?? {}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export async function writeProfilesIndex(index) {
|
|
111
|
+
await writeJson(profilesFile(), {
|
|
112
|
+
schemaVersion: 1,
|
|
113
|
+
activeProfile: index.activeProfile,
|
|
114
|
+
profiles: index.profiles
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export function profileKey(name) {
|
|
118
|
+
const value = name.trim().toLowerCase();
|
|
119
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(value)) {
|
|
120
|
+
throw Object.assign(new Error(`Invalid profile name: ${name}`), { code: 'SYNTAX_ERROR', exitCode: 2 });
|
|
121
|
+
}
|
|
122
|
+
return value;
|
|
123
|
+
}
|
|
124
|
+
export async function addProfile(name, controlPlaneUrl) {
|
|
125
|
+
const key = profileKey(name);
|
|
126
|
+
const index = await readProfilesIndex();
|
|
127
|
+
const profile = { name: key, controlPlaneUrl };
|
|
128
|
+
index.profiles[key] = profile;
|
|
129
|
+
index.activeProfile = key;
|
|
130
|
+
await writeProfilesIndex(index);
|
|
131
|
+
await writeConfig({ ...(await readConfig()), profileName: key, controlPlaneUrl });
|
|
132
|
+
return profile;
|
|
133
|
+
}
|
|
134
|
+
export async function useProfile(name) {
|
|
135
|
+
const key = profileKey(name);
|
|
136
|
+
const index = await readProfilesIndex();
|
|
137
|
+
const profile = index.profiles[key];
|
|
138
|
+
if (!profile) {
|
|
139
|
+
throw Object.assign(new Error(`Profile not found: ${name}`), { code: 'PROFILE_REQUIRED' });
|
|
140
|
+
}
|
|
141
|
+
index.activeProfile = key;
|
|
142
|
+
await writeProfilesIndex(index);
|
|
143
|
+
process.env.ONEPROXY_PROFILE = key;
|
|
144
|
+
await writeConfig({ ...(await readConfig()), profileName: key, controlPlaneUrl: profile.controlPlaneUrl });
|
|
145
|
+
return profile;
|
|
146
|
+
}
|
|
147
|
+
export async function readTokens() {
|
|
148
|
+
return readJson(storageFile('tokens'));
|
|
149
|
+
}
|
|
150
|
+
export async function writeTokens(tokens) {
|
|
151
|
+
await writeJson(storageFile('tokens'), { ...tokens, schemaVersion: 1 });
|
|
152
|
+
}
|
|
153
|
+
export async function clearTokens() {
|
|
154
|
+
try {
|
|
155
|
+
await fs.rm(storageFile('tokens'));
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
if (error.code !== 'ENOENT') {
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export async function readState() {
|
|
164
|
+
const state = await readJson(storageFile('state'));
|
|
165
|
+
return {
|
|
166
|
+
schemaVersion: 1,
|
|
167
|
+
...state,
|
|
168
|
+
routeGroups: state?.routeGroups ?? []
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export async function writeState(state) {
|
|
172
|
+
await writeJson(storageFile('state'), { ...state, schemaVersion: 1 });
|
|
173
|
+
}
|
|
174
|
+
export async function readDaemonMetadata() {
|
|
175
|
+
return readJson(storageFile('daemon'));
|
|
176
|
+
}
|
|
177
|
+
export async function writeDaemonMetadata(metadata) {
|
|
178
|
+
await writeJson(storageFile('daemon'), { ...metadata, schemaVersion: 1 });
|
|
179
|
+
}
|
|
180
|
+
export async function appendLog(message) {
|
|
181
|
+
await ensureStorageRoot();
|
|
182
|
+
await fs.appendFile(storageFile('log'), `${new Date().toISOString()} ${message}\n`, { mode: 0o600 });
|
|
183
|
+
}
|
|
184
|
+
function isExcludedPort(port) {
|
|
185
|
+
return commonPorts.has(port) || port < portRangeStart || port > portRangeEnd;
|
|
186
|
+
}
|
|
187
|
+
export async function isLoopbackPortAvailable(port) {
|
|
188
|
+
if (isExcludedPort(port)) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
const server = net.createServer();
|
|
192
|
+
return new Promise((resolve) => {
|
|
193
|
+
server.once('error', () => resolve(false));
|
|
194
|
+
server.listen(port, loopbackHost, () => {
|
|
195
|
+
server.close(() => resolve(true));
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
export async function scanAvailableProxyPortPairs() {
|
|
200
|
+
const pairs = [];
|
|
201
|
+
for (let port = portRangeStart; port < portRangeEnd; port += 1) {
|
|
202
|
+
if (isExcludedPort(port) || isExcludedPort(port + 1)) {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const [httpAvailable, httpsAvailable] = await Promise.all([
|
|
206
|
+
isLoopbackPortAvailable(port),
|
|
207
|
+
isLoopbackPortAvailable(port + 1)
|
|
208
|
+
]);
|
|
209
|
+
if (httpAvailable && httpsAvailable) {
|
|
210
|
+
pairs.push([port, port + 1]);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return pairs;
|
|
214
|
+
}
|
|
215
|
+
export function processIsRunning(pid) {
|
|
216
|
+
try {
|
|
217
|
+
process.kill(pid, 0);
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AA2FlC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;AAaxC,MAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,MAAM,YAAY,GAAG,KAAK,CAAC;AAC3B,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,G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AAc,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;YACrD,SAAS;QACX,CAAC;QACD,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACxD,uBAAuB,CAAC,IAAI,CAAC;YAC7B,uBAAuB,CAAC,IAAI,GAAG,CAAC,CAAC;SAClC,CAAC,CAAC;QACH,IAAI,aAAa,IAAI,cAAc,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stanleysun233/oneproxy-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "OneProxy CLI session proxy client",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"onep": "bin/onep.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"check": "tsc -p tsconfig.json --noEmit"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^24.0.0",
|
|
22
|
+
"typescript": "^5.8.0"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=22"
|
|
26
|
+
}
|
|
27
|
+
}
|