@hot-updater/cli-tools 0.28.0 → 0.29.1
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/dist/chunk-BEJ448es.mjs +35 -0
- package/dist/index.cjs +11222 -54750
- package/dist/index.d.cts +591 -6
- package/dist/index.d.mts +830 -0
- package/dist/index.mjs +47758 -0
- package/package.json +141 -22
- package/dist/index.d.ts +0 -247
- package/dist/index.js +0 -91305
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
import { Readable } from "stream";
|
|
2
|
+
import { Key as Key$1 } from "node:readline";
|
|
3
|
+
import { Readable as Readable$1, Writable } from "node:stream";
|
|
4
|
+
import { ConfigInput, Platform, RequiredDeep } from "@hot-updater/plugin-core";
|
|
5
|
+
|
|
6
|
+
//#region src/BuildLogger.d.ts
|
|
7
|
+
type LinePattern = string | RegExp;
|
|
8
|
+
interface BuildLoggerConfig {
|
|
9
|
+
logPrefix: string;
|
|
10
|
+
/** Lines that should be surfaced in prompt output as important events. */
|
|
11
|
+
importantLogPatterns: LinePattern[];
|
|
12
|
+
/** Progress stages: stage index advances when corresponding output patterns are observed. */
|
|
13
|
+
progressStages: LinePattern[][];
|
|
14
|
+
}
|
|
15
|
+
declare class BuildLogger {
|
|
16
|
+
private readonly config;
|
|
17
|
+
private state;
|
|
18
|
+
private logWriter?;
|
|
19
|
+
private readonly promptProgress;
|
|
20
|
+
private readonly stageCount;
|
|
21
|
+
constructor(config: BuildLoggerConfig);
|
|
22
|
+
start(): Promise<void>;
|
|
23
|
+
processStream(input: Readable): Promise<void>;
|
|
24
|
+
private consumeProgressStream;
|
|
25
|
+
private processProgressLine;
|
|
26
|
+
stop(message?: string, success?: boolean): void;
|
|
27
|
+
writeError(error: unknown): void;
|
|
28
|
+
close(): Promise<void>;
|
|
29
|
+
private updateProgress;
|
|
30
|
+
private finishRemainingProgress;
|
|
31
|
+
private shouldLogLine;
|
|
32
|
+
private showLogFileLocation;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/banner.d.ts
|
|
36
|
+
declare const link: (url: string) => string;
|
|
37
|
+
declare const banner: (version?: string) => string;
|
|
38
|
+
declare const printBanner: (version?: string) => void;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/ConfigBuilder.d.ts
|
|
41
|
+
type BuildType = "bare" | "rock" | "expo";
|
|
42
|
+
type ImportInfo = {
|
|
43
|
+
pkg: string;
|
|
44
|
+
named?: string[];
|
|
45
|
+
defaultOrNamespace?: string;
|
|
46
|
+
sideEffect?: boolean;
|
|
47
|
+
};
|
|
48
|
+
type ProviderConfig = {
|
|
49
|
+
imports: ImportInfo[];
|
|
50
|
+
configString: string;
|
|
51
|
+
};
|
|
52
|
+
interface IConfigBuilder {
|
|
53
|
+
/** Sets the build type ('bare' or 'rock' or 'expo') and adds necessary build imports. */
|
|
54
|
+
setBuildType(buildType: BuildType): this;
|
|
55
|
+
/** Sets the storage configuration and adds its required imports. */
|
|
56
|
+
setStorage(storageConfig: ProviderConfig): this;
|
|
57
|
+
/** Sets the database configuration and adds its required imports. */
|
|
58
|
+
setDatabase(databaseConfig: ProviderConfig): this;
|
|
59
|
+
/** Sets the intermediate code block to be placed between imports and defineConfig. */
|
|
60
|
+
setIntermediateCode(code: string): this;
|
|
61
|
+
/** Assembles and returns the final configuration string. */
|
|
62
|
+
getResult(): string;
|
|
63
|
+
}
|
|
64
|
+
declare class ConfigBuilder implements IConfigBuilder {
|
|
65
|
+
private buildType;
|
|
66
|
+
private storageInfo;
|
|
67
|
+
private databaseInfo;
|
|
68
|
+
private intermediateCode;
|
|
69
|
+
private collectedImports;
|
|
70
|
+
constructor();
|
|
71
|
+
addImport(info: ImportInfo): this;
|
|
72
|
+
private addImports;
|
|
73
|
+
private generateImportStatements;
|
|
74
|
+
private generateBuildConfigString;
|
|
75
|
+
setBuildType(buildType: BuildType): this;
|
|
76
|
+
setStorage(storageConfig: ProviderConfig): this;
|
|
77
|
+
setDatabase(databaseConfig: ProviderConfig): this;
|
|
78
|
+
setIntermediateCode(code: string): this;
|
|
79
|
+
getResult(): string;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/types.d.ts
|
|
83
|
+
type Formatter = (input: string | number | null | undefined) => string;
|
|
84
|
+
interface Colors {
|
|
85
|
+
isColorSupported: boolean;
|
|
86
|
+
reset: Formatter;
|
|
87
|
+
bold: Formatter;
|
|
88
|
+
dim: Formatter;
|
|
89
|
+
italic: Formatter;
|
|
90
|
+
underline: Formatter;
|
|
91
|
+
inverse: Formatter;
|
|
92
|
+
hidden: Formatter;
|
|
93
|
+
strikethrough: Formatter;
|
|
94
|
+
black: Formatter;
|
|
95
|
+
red: Formatter;
|
|
96
|
+
green: Formatter;
|
|
97
|
+
yellow: Formatter;
|
|
98
|
+
blue: Formatter;
|
|
99
|
+
magenta: Formatter;
|
|
100
|
+
cyan: Formatter;
|
|
101
|
+
white: Formatter;
|
|
102
|
+
gray: Formatter;
|
|
103
|
+
bgBlack: Formatter;
|
|
104
|
+
bgRed: Formatter;
|
|
105
|
+
bgGreen: Formatter;
|
|
106
|
+
bgYellow: Formatter;
|
|
107
|
+
bgBlue: Formatter;
|
|
108
|
+
bgMagenta: Formatter;
|
|
109
|
+
bgCyan: Formatter;
|
|
110
|
+
bgWhite: Formatter;
|
|
111
|
+
blackBright: Formatter;
|
|
112
|
+
redBright: Formatter;
|
|
113
|
+
greenBright: Formatter;
|
|
114
|
+
yellowBright: Formatter;
|
|
115
|
+
blueBright: Formatter;
|
|
116
|
+
magentaBright: Formatter;
|
|
117
|
+
cyanBright: Formatter;
|
|
118
|
+
whiteBright: Formatter;
|
|
119
|
+
bgBlackBright: Formatter;
|
|
120
|
+
bgRedBright: Formatter;
|
|
121
|
+
bgGreenBright: Formatter;
|
|
122
|
+
bgYellowBright: Formatter;
|
|
123
|
+
bgBlueBright: Formatter;
|
|
124
|
+
bgMagentaBright: Formatter;
|
|
125
|
+
bgCyanBright: Formatter;
|
|
126
|
+
bgWhiteBright: Formatter;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.d.ts
|
|
130
|
+
declare const picocolors: Colors & {
|
|
131
|
+
createColors: (enabled?: boolean) => Colors;
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/copyDirToTmp.d.ts
|
|
135
|
+
declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
|
|
136
|
+
tmpDir: string;
|
|
137
|
+
removeTmpDir: () => Promise<void>;
|
|
138
|
+
}>;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/createTarBr.d.ts
|
|
141
|
+
declare const createTarBrTargetFiles: ({
|
|
142
|
+
outfile,
|
|
143
|
+
targetFiles
|
|
144
|
+
}: {
|
|
145
|
+
targetFiles: {
|
|
146
|
+
path: string;
|
|
147
|
+
name: string;
|
|
148
|
+
}[];
|
|
149
|
+
outfile: string;
|
|
150
|
+
}) => Promise<string>;
|
|
151
|
+
declare const createTarBr: ({
|
|
152
|
+
outfile,
|
|
153
|
+
targetDir,
|
|
154
|
+
excludeExts
|
|
155
|
+
}: {
|
|
156
|
+
targetDir: string;
|
|
157
|
+
outfile: string;
|
|
158
|
+
excludeExts?: string[];
|
|
159
|
+
}) => Promise<string>;
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/createTarGz.d.ts
|
|
162
|
+
declare const createTarGzTargetFiles: ({
|
|
163
|
+
outfile,
|
|
164
|
+
targetFiles
|
|
165
|
+
}: {
|
|
166
|
+
targetFiles: {
|
|
167
|
+
path: string;
|
|
168
|
+
name: string;
|
|
169
|
+
}[];
|
|
170
|
+
outfile: string;
|
|
171
|
+
}) => Promise<string>;
|
|
172
|
+
declare const createTarGz: ({
|
|
173
|
+
outfile,
|
|
174
|
+
targetDir,
|
|
175
|
+
excludeExts
|
|
176
|
+
}: {
|
|
177
|
+
targetDir: string;
|
|
178
|
+
outfile: string;
|
|
179
|
+
excludeExts?: string[];
|
|
180
|
+
}) => Promise<string>;
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/createZip.d.ts
|
|
183
|
+
declare const createZipTargetFiles: ({
|
|
184
|
+
outfile,
|
|
185
|
+
targetFiles
|
|
186
|
+
}: {
|
|
187
|
+
targetFiles: {
|
|
188
|
+
path: string;
|
|
189
|
+
name: string;
|
|
190
|
+
}[];
|
|
191
|
+
outfile: string;
|
|
192
|
+
}) => Promise<string>;
|
|
193
|
+
declare const createZip: ({
|
|
194
|
+
outfile,
|
|
195
|
+
targetDir,
|
|
196
|
+
excludeExts
|
|
197
|
+
}: {
|
|
198
|
+
targetDir: string;
|
|
199
|
+
outfile: string;
|
|
200
|
+
excludeExts?: string[];
|
|
201
|
+
}) => Promise<string>;
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/crypto.d.ts
|
|
204
|
+
declare const encryptJson: (jsonData: Record<string, any>, secretKey: string) => string;
|
|
205
|
+
declare const decryptJson: <T>(encryptedData: string, secretKey: string) => T;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/cwd.d.ts
|
|
208
|
+
declare const getCwd: () => string;
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/ensureInstallPackages.d.ts
|
|
211
|
+
declare const ensureInstallPackages: (packages: {
|
|
212
|
+
dependencies?: string[];
|
|
213
|
+
devDependencies?: string[];
|
|
214
|
+
}, options?: {
|
|
215
|
+
versionResolver?: (pkg: string) => string;
|
|
216
|
+
}) => Promise<void>;
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/getAndroidSdkPath.d.ts
|
|
219
|
+
declare function getAndroidSdkPath(): string;
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/getPackageManager.d.ts
|
|
222
|
+
declare const getPackageManager: () => string;
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/getReactNativeMetadatas.d.ts
|
|
225
|
+
interface ReactNativeMetadata {
|
|
226
|
+
packagePath: string;
|
|
227
|
+
versionRaw: string;
|
|
228
|
+
version: {
|
|
229
|
+
major: number;
|
|
230
|
+
minor: number;
|
|
231
|
+
patch?: number;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
declare const getReactNativeMetadatas: (cwd?: string) => ReactNativeMetadata;
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/LogWriter.d.ts
|
|
237
|
+
type HotUpdaterLogWriter = {
|
|
238
|
+
logFilePath: string | null;
|
|
239
|
+
writeStream: (input: Readable) => Promise<void>;
|
|
240
|
+
writeError: (error: unknown) => void;
|
|
241
|
+
close: () => Promise<void>;
|
|
242
|
+
};
|
|
243
|
+
declare const stripAnsi: (value: string) => string;
|
|
244
|
+
declare const createLogWriter: ({
|
|
245
|
+
prefix,
|
|
246
|
+
logFilePath
|
|
247
|
+
}: {
|
|
248
|
+
prefix: string;
|
|
249
|
+
logFilePath?: string;
|
|
250
|
+
}) => Promise<HotUpdaterLogWriter>;
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/loadConfig.d.ts
|
|
253
|
+
type HotUpdaterConfigOptions = {
|
|
254
|
+
platform: Platform;
|
|
255
|
+
channel: string;
|
|
256
|
+
} | null;
|
|
257
|
+
type ConfigResponse = RequiredDeep<ConfigInput>;
|
|
258
|
+
declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/log.d.ts
|
|
261
|
+
declare const log: {
|
|
262
|
+
normal: (message: string | number | null | undefined) => void;
|
|
263
|
+
success: (message: string | number | null | undefined) => void;
|
|
264
|
+
info: (message: string | number | null | undefined) => void;
|
|
265
|
+
error: (message: string | number | null | undefined) => void;
|
|
266
|
+
warn: (message: string | number | null | undefined) => void;
|
|
267
|
+
debug: (message: string | number | null | undefined) => void;
|
|
268
|
+
};
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/makeEnv.d.ts
|
|
271
|
+
type EnvVarValue = string | {
|
|
272
|
+
comment: string;
|
|
273
|
+
value: string;
|
|
274
|
+
};
|
|
275
|
+
declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region ../../node_modules/.pnpm/@clack+core@1.0.1/node_modules/@clack/core/dist/index.d.mts
|
|
278
|
+
declare const actions: readonly ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
279
|
+
type Action = (typeof actions)[number];
|
|
280
|
+
/** Global settings for Clack programs, stored in memory */
|
|
281
|
+
interface InternalClackSettings {
|
|
282
|
+
actions: Set<Action>;
|
|
283
|
+
aliases: Map<string, Action>;
|
|
284
|
+
messages: {
|
|
285
|
+
cancel: string;
|
|
286
|
+
error: string;
|
|
287
|
+
};
|
|
288
|
+
withGuide: boolean;
|
|
289
|
+
}
|
|
290
|
+
declare const settings: InternalClackSettings;
|
|
291
|
+
interface ClackSettings {
|
|
292
|
+
/**
|
|
293
|
+
* Set custom global aliases for the default actions.
|
|
294
|
+
* This will not overwrite existing aliases, it will only add new ones!
|
|
295
|
+
*
|
|
296
|
+
* @param aliases - An object that maps aliases to actions
|
|
297
|
+
* @default { k: 'up', j: 'down', h: 'left', l: 'right', '\x03': 'cancel', 'escape': 'cancel' }
|
|
298
|
+
*/
|
|
299
|
+
aliases?: Record<string, Action>;
|
|
300
|
+
/**
|
|
301
|
+
* Custom messages for prompts
|
|
302
|
+
*/
|
|
303
|
+
messages?: {
|
|
304
|
+
/**
|
|
305
|
+
* Custom message to display when a spinner is cancelled
|
|
306
|
+
* @default "Canceled"
|
|
307
|
+
*/
|
|
308
|
+
cancel?: string;
|
|
309
|
+
/**
|
|
310
|
+
* Custom message to display when a spinner encounters an error
|
|
311
|
+
* @default "Something went wrong"
|
|
312
|
+
*/
|
|
313
|
+
error?: string;
|
|
314
|
+
};
|
|
315
|
+
withGuide?: boolean;
|
|
316
|
+
}
|
|
317
|
+
declare function updateSettings(updates: ClackSettings): void;
|
|
318
|
+
/**
|
|
319
|
+
* The state of the prompt
|
|
320
|
+
*/
|
|
321
|
+
type ClackState = 'initial' | 'active' | 'cancel' | 'submit' | 'error';
|
|
322
|
+
/**
|
|
323
|
+
* Typed event emitter for clack
|
|
324
|
+
*/
|
|
325
|
+
interface ClackEvents<TValue> {
|
|
326
|
+
initial: (value?: any) => void;
|
|
327
|
+
active: (value?: any) => void;
|
|
328
|
+
cancel: (value?: any) => void;
|
|
329
|
+
submit: (value?: any) => void;
|
|
330
|
+
error: (value?: any) => void;
|
|
331
|
+
cursor: (key?: Action) => void;
|
|
332
|
+
key: (key: string | undefined, info: Key$1) => void;
|
|
333
|
+
value: (value?: TValue) => void;
|
|
334
|
+
userInput: (value: string) => void;
|
|
335
|
+
confirm: (value?: boolean) => void;
|
|
336
|
+
finalize: () => void;
|
|
337
|
+
beforePrompt: () => void;
|
|
338
|
+
}
|
|
339
|
+
interface PromptOptions<TValue, Self extends Prompt<TValue>> {
|
|
340
|
+
render(this: Omit<Self, 'prompt'>): string | undefined;
|
|
341
|
+
initialValue?: any;
|
|
342
|
+
initialUserInput?: string;
|
|
343
|
+
validate?: ((value: TValue | undefined) => string | Error | undefined) | undefined;
|
|
344
|
+
input?: Readable$1;
|
|
345
|
+
output?: Writable;
|
|
346
|
+
debug?: boolean;
|
|
347
|
+
signal?: AbortSignal;
|
|
348
|
+
}
|
|
349
|
+
declare class Prompt<TValue> {
|
|
350
|
+
protected input: Readable$1;
|
|
351
|
+
protected output: Writable;
|
|
352
|
+
private _abortSignal?;
|
|
353
|
+
private rl;
|
|
354
|
+
private opts;
|
|
355
|
+
private _render;
|
|
356
|
+
private _track;
|
|
357
|
+
private _prevFrame;
|
|
358
|
+
private _subscribers;
|
|
359
|
+
protected _cursor: number;
|
|
360
|
+
state: ClackState;
|
|
361
|
+
error: string;
|
|
362
|
+
value: TValue | undefined;
|
|
363
|
+
userInput: string;
|
|
364
|
+
constructor(options: PromptOptions<TValue, Prompt<TValue>>, trackValue?: boolean);
|
|
365
|
+
/**
|
|
366
|
+
* Unsubscribe all listeners
|
|
367
|
+
*/
|
|
368
|
+
protected unsubscribe(): void;
|
|
369
|
+
/**
|
|
370
|
+
* Set a subscriber with opts
|
|
371
|
+
* @param event - The event name
|
|
372
|
+
*/
|
|
373
|
+
private setSubscriber;
|
|
374
|
+
/**
|
|
375
|
+
* Subscribe to an event
|
|
376
|
+
* @param event - The event name
|
|
377
|
+
* @param cb - The callback
|
|
378
|
+
*/
|
|
379
|
+
on<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[T]): void;
|
|
380
|
+
/**
|
|
381
|
+
* Subscribe to an event once
|
|
382
|
+
* @param event - The event name
|
|
383
|
+
* @param cb - The callback
|
|
384
|
+
*/
|
|
385
|
+
once<T extends keyof ClackEvents<TValue>>(event: T, cb: ClackEvents<TValue>[T]): void;
|
|
386
|
+
/**
|
|
387
|
+
* Emit an event with data
|
|
388
|
+
* @param event - The event name
|
|
389
|
+
* @param data - The data to pass to the callback
|
|
390
|
+
*/
|
|
391
|
+
emit<T extends keyof ClackEvents<TValue>>(event: T, ...data: Parameters<ClackEvents<TValue>[T]>): void;
|
|
392
|
+
prompt(): Promise<symbol | TValue | undefined>;
|
|
393
|
+
protected _isActionKey(char: string | undefined, _key: Key$1): boolean;
|
|
394
|
+
protected _setValue(value: TValue | undefined): void;
|
|
395
|
+
protected _setUserInput(value: string | undefined, write?: boolean): void;
|
|
396
|
+
protected _clearUserInput(): void;
|
|
397
|
+
private onKeypress;
|
|
398
|
+
protected close(): void;
|
|
399
|
+
private restoreCursor;
|
|
400
|
+
private render;
|
|
401
|
+
}
|
|
402
|
+
interface OptionLike$1 {
|
|
403
|
+
value: unknown;
|
|
404
|
+
label?: string;
|
|
405
|
+
disabled?: boolean;
|
|
406
|
+
}
|
|
407
|
+
type FilterFunction<T extends OptionLike$1> = (search: string, opt: T) => boolean;
|
|
408
|
+
interface AutocompleteOptions$1<T extends OptionLike$1> extends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> {
|
|
409
|
+
options: T[] | ((this: AutocompletePrompt<T>) => T[]);
|
|
410
|
+
filter?: FilterFunction<T>;
|
|
411
|
+
multiple?: boolean;
|
|
412
|
+
}
|
|
413
|
+
declare class AutocompletePrompt<T extends OptionLike$1> extends Prompt<T['value'] | T['value'][]> {
|
|
414
|
+
#private;
|
|
415
|
+
filteredOptions: T[];
|
|
416
|
+
multiple: boolean;
|
|
417
|
+
isNavigating: boolean;
|
|
418
|
+
selectedValues: Array<T['value']>;
|
|
419
|
+
focusedValue: T['value'] | undefined;
|
|
420
|
+
get cursor(): number;
|
|
421
|
+
get userInputWithCursor(): string;
|
|
422
|
+
get options(): T[];
|
|
423
|
+
constructor(opts: AutocompleteOptions$1<T>);
|
|
424
|
+
protected _isActionKey(char: string | undefined, key: Key$1): boolean;
|
|
425
|
+
deselectAll(): void;
|
|
426
|
+
toggleSelected(value: T['value']): void;
|
|
427
|
+
}
|
|
428
|
+
declare function isCancel(value: unknown): value is symbol;
|
|
429
|
+
declare namespace index_d_exports {
|
|
430
|
+
export { AutocompleteMultiSelectOptions, AutocompleteOptions, BoxAlignment, BoxOptions, ClackSettings, CommonOptions, ConfirmOptions, GroupMultiSelectOptions, LimitOptionsParams, LogMessageOptions, MultiSelectOptions, NoteOptions, Option, PasswordOptions, PathOptions, ProgressOptions, ProgressResult, PromptGroup, PromptGroupAwaitedReturn, PromptGroupOptions, S_BAR, S_BAR_END, S_BAR_END_RIGHT, S_BAR_H, S_BAR_START, S_BAR_START_RIGHT, S_CHECKBOX_ACTIVE, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, S_CONNECT_LEFT, S_CORNER_BOTTOM_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, S_ERROR, S_INFO, S_PASSWORD_MASK, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_SUCCESS, S_WARN, SelectKeyOptions, SelectOptions, SpinnerOptions, SpinnerResult, Task, TaskLogCompletionOptions, TaskLogMessageOptions, TaskLogOptions, TextOptions, autocomplete, autocompleteMultiselect, box, cancel, confirm, group, groupMultiselect, intro, isCI, isCancel, isTTY, limitOptions, log$1 as log, multiselect, note, outro, password, path, progress, select, selectKey, settings, spinner, stream, symbol, symbolBar, taskLog, tasks, text, unicode, unicodeOr, updateSettings };
|
|
431
|
+
}
|
|
432
|
+
declare const unicode: boolean;
|
|
433
|
+
declare const isCI: () => boolean;
|
|
434
|
+
declare const isTTY: (output: Writable) => boolean;
|
|
435
|
+
declare const unicodeOr: (c: string, fallback: string) => string;
|
|
436
|
+
declare const S_STEP_ACTIVE: string;
|
|
437
|
+
declare const S_STEP_CANCEL: string;
|
|
438
|
+
declare const S_STEP_ERROR: string;
|
|
439
|
+
declare const S_STEP_SUBMIT: string;
|
|
440
|
+
declare const S_BAR_START: string;
|
|
441
|
+
declare const S_BAR: string;
|
|
442
|
+
declare const S_BAR_END: string;
|
|
443
|
+
declare const S_BAR_START_RIGHT: string;
|
|
444
|
+
declare const S_BAR_END_RIGHT: string;
|
|
445
|
+
declare const S_RADIO_ACTIVE: string;
|
|
446
|
+
declare const S_RADIO_INACTIVE: string;
|
|
447
|
+
declare const S_CHECKBOX_ACTIVE: string;
|
|
448
|
+
declare const S_CHECKBOX_SELECTED: string;
|
|
449
|
+
declare const S_CHECKBOX_INACTIVE: string;
|
|
450
|
+
declare const S_PASSWORD_MASK: string;
|
|
451
|
+
declare const S_BAR_H: string;
|
|
452
|
+
declare const S_CORNER_TOP_RIGHT: string;
|
|
453
|
+
declare const S_CONNECT_LEFT: string;
|
|
454
|
+
declare const S_CORNER_BOTTOM_RIGHT: string;
|
|
455
|
+
declare const S_CORNER_BOTTOM_LEFT: string;
|
|
456
|
+
declare const S_CORNER_TOP_LEFT: string;
|
|
457
|
+
declare const S_INFO: string;
|
|
458
|
+
declare const S_SUCCESS: string;
|
|
459
|
+
declare const S_WARN: string;
|
|
460
|
+
declare const S_ERROR: string;
|
|
461
|
+
declare const symbol: (state: ClackState) => string;
|
|
462
|
+
declare const symbolBar: (state: ClackState) => string;
|
|
463
|
+
interface CommonOptions {
|
|
464
|
+
input?: Readable$1;
|
|
465
|
+
output?: Writable;
|
|
466
|
+
signal?: AbortSignal;
|
|
467
|
+
withGuide?: boolean;
|
|
468
|
+
}
|
|
469
|
+
type Primitive = Readonly<string | boolean | number>;
|
|
470
|
+
type Option<Value> = Value extends Primitive ? {
|
|
471
|
+
/**
|
|
472
|
+
* Internal data for this option.
|
|
473
|
+
*/
|
|
474
|
+
value: Value;
|
|
475
|
+
/**
|
|
476
|
+
* The optional, user-facing text for this option.
|
|
477
|
+
*
|
|
478
|
+
* By default, the `value` is converted to a string.
|
|
479
|
+
*/
|
|
480
|
+
label?: string;
|
|
481
|
+
/**
|
|
482
|
+
* An optional hint to display to the user when
|
|
483
|
+
* this option might be selected.
|
|
484
|
+
*
|
|
485
|
+
* By default, no `hint` is displayed.
|
|
486
|
+
*/
|
|
487
|
+
hint?: string;
|
|
488
|
+
/**
|
|
489
|
+
* Whether this option is disabled.
|
|
490
|
+
* Disabled options are visible but cannot be selected.
|
|
491
|
+
*
|
|
492
|
+
* By default, options are not disabled.
|
|
493
|
+
*/
|
|
494
|
+
disabled?: boolean;
|
|
495
|
+
} : {
|
|
496
|
+
/**
|
|
497
|
+
* Internal data for this option.
|
|
498
|
+
*/
|
|
499
|
+
value: Value;
|
|
500
|
+
/**
|
|
501
|
+
* Required. The user-facing text for this option.
|
|
502
|
+
*/
|
|
503
|
+
label: string;
|
|
504
|
+
/**
|
|
505
|
+
* An optional hint to display to the user when
|
|
506
|
+
* this option might be selected.
|
|
507
|
+
*
|
|
508
|
+
* By default, no `hint` is displayed.
|
|
509
|
+
*/
|
|
510
|
+
hint?: string;
|
|
511
|
+
/**
|
|
512
|
+
* Whether this option is disabled.
|
|
513
|
+
* Disabled options are visible but cannot be selected.
|
|
514
|
+
*
|
|
515
|
+
* By default, options are not disabled.
|
|
516
|
+
*/
|
|
517
|
+
disabled?: boolean;
|
|
518
|
+
};
|
|
519
|
+
interface SelectOptions<Value> extends CommonOptions {
|
|
520
|
+
message: string;
|
|
521
|
+
options: Option<Value>[];
|
|
522
|
+
initialValue?: Value;
|
|
523
|
+
maxItems?: number;
|
|
524
|
+
}
|
|
525
|
+
declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Value | symbol>;
|
|
526
|
+
interface AutocompleteSharedOptions<Value> extends CommonOptions {
|
|
527
|
+
/**
|
|
528
|
+
* The message to display to the user.
|
|
529
|
+
*/
|
|
530
|
+
message: string;
|
|
531
|
+
/**
|
|
532
|
+
* Available options for the autocomplete prompt.
|
|
533
|
+
*/
|
|
534
|
+
options: Option<Value>[] | ((this: AutocompletePrompt<Option<Value>>) => Option<Value>[]);
|
|
535
|
+
/**
|
|
536
|
+
* Maximum number of items to display at once.
|
|
537
|
+
*/
|
|
538
|
+
maxItems?: number;
|
|
539
|
+
/**
|
|
540
|
+
* Placeholder text to display when no input is provided.
|
|
541
|
+
*/
|
|
542
|
+
placeholder?: string;
|
|
543
|
+
/**
|
|
544
|
+
* Validates the value
|
|
545
|
+
*/
|
|
546
|
+
validate?: (value: Value | Value[] | undefined) => string | Error | undefined;
|
|
547
|
+
/**
|
|
548
|
+
* Custom filter function to match options against search input.
|
|
549
|
+
* If not provided, a default filter that matches label, hint, and value is used.
|
|
550
|
+
*/
|
|
551
|
+
filter?: (search: string, option: Option<Value>) => boolean;
|
|
552
|
+
}
|
|
553
|
+
interface AutocompleteOptions<Value> extends AutocompleteSharedOptions<Value> {
|
|
554
|
+
/**
|
|
555
|
+
* The initial selected value.
|
|
556
|
+
*/
|
|
557
|
+
initialValue?: Value;
|
|
558
|
+
/**
|
|
559
|
+
* The initial user input
|
|
560
|
+
*/
|
|
561
|
+
initialUserInput?: string;
|
|
562
|
+
}
|
|
563
|
+
declare const autocomplete: <Value>(opts: AutocompleteOptions<Value>) => Promise<Value | symbol>;
|
|
564
|
+
interface AutocompleteMultiSelectOptions<Value> extends AutocompleteSharedOptions<Value> {
|
|
565
|
+
/**
|
|
566
|
+
* The initial selected values
|
|
567
|
+
*/
|
|
568
|
+
initialValues?: Value[];
|
|
569
|
+
/**
|
|
570
|
+
* If true, at least one option must be selected
|
|
571
|
+
*/
|
|
572
|
+
required?: boolean;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Integrated autocomplete multiselect - combines type-ahead filtering with multiselect in one UI
|
|
576
|
+
*/
|
|
577
|
+
declare const autocompleteMultiselect: <Value>(opts: AutocompleteMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
|
|
578
|
+
type BoxAlignment = 'left' | 'center' | 'right';
|
|
579
|
+
interface BoxOptions extends CommonOptions {
|
|
580
|
+
contentAlign?: BoxAlignment;
|
|
581
|
+
titleAlign?: BoxAlignment;
|
|
582
|
+
width?: number | 'auto';
|
|
583
|
+
titlePadding?: number;
|
|
584
|
+
contentPadding?: number;
|
|
585
|
+
rounded?: boolean;
|
|
586
|
+
formatBorder?: (text: string) => string;
|
|
587
|
+
}
|
|
588
|
+
declare const box: (message?: string, title?: string, opts?: BoxOptions) => void;
|
|
589
|
+
interface ConfirmOptions extends CommonOptions {
|
|
590
|
+
message: string;
|
|
591
|
+
active?: string;
|
|
592
|
+
inactive?: string;
|
|
593
|
+
initialValue?: boolean;
|
|
594
|
+
vertical?: boolean;
|
|
595
|
+
}
|
|
596
|
+
declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
|
|
597
|
+
type Prettify<T> = { [P in keyof T]: T[P] } & {};
|
|
598
|
+
type PromptGroupAwaitedReturn<T> = { [P in keyof T]: Exclude<Awaited<T[P]>, symbol> };
|
|
599
|
+
interface PromptGroupOptions<T> {
|
|
600
|
+
/**
|
|
601
|
+
* Control how the group can be canceled
|
|
602
|
+
* if one of the prompts is canceled.
|
|
603
|
+
*/
|
|
604
|
+
onCancel?: (opts: {
|
|
605
|
+
results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
|
|
606
|
+
}) => void;
|
|
607
|
+
}
|
|
608
|
+
type PromptGroup<T> = { [P in keyof T]: (opts: {
|
|
609
|
+
results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
|
|
610
|
+
}) => undefined | Promise<T[P] | undefined> };
|
|
611
|
+
/**
|
|
612
|
+
* Define a group of prompts to be displayed
|
|
613
|
+
* and return a results of objects within the group
|
|
614
|
+
*/
|
|
615
|
+
declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>) => Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
|
|
616
|
+
interface GroupMultiSelectOptions<Value> extends CommonOptions {
|
|
617
|
+
message: string;
|
|
618
|
+
options: Record<string, Option<Value>[]>;
|
|
619
|
+
initialValues?: Value[];
|
|
620
|
+
required?: boolean;
|
|
621
|
+
cursorAt?: Value;
|
|
622
|
+
selectableGroups?: boolean;
|
|
623
|
+
groupSpacing?: number;
|
|
624
|
+
}
|
|
625
|
+
declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
|
|
626
|
+
interface LimitOptionsParams<TOption> extends CommonOptions {
|
|
627
|
+
options: TOption[];
|
|
628
|
+
maxItems: number | undefined;
|
|
629
|
+
cursor: number;
|
|
630
|
+
style: (option: TOption, active: boolean) => string;
|
|
631
|
+
columnPadding?: number;
|
|
632
|
+
rowPadding?: number;
|
|
633
|
+
}
|
|
634
|
+
declare const limitOptions: <TOption>(params: LimitOptionsParams<TOption>) => string[];
|
|
635
|
+
interface LogMessageOptions extends CommonOptions {
|
|
636
|
+
symbol?: string;
|
|
637
|
+
spacing?: number;
|
|
638
|
+
secondarySymbol?: string;
|
|
639
|
+
}
|
|
640
|
+
declare const log$1: {
|
|
641
|
+
message: (message?: string | string[], {
|
|
642
|
+
symbol,
|
|
643
|
+
secondarySymbol,
|
|
644
|
+
output,
|
|
645
|
+
spacing,
|
|
646
|
+
withGuide
|
|
647
|
+
}?: LogMessageOptions) => void;
|
|
648
|
+
info: (message: string, opts?: LogMessageOptions) => void;
|
|
649
|
+
success: (message: string, opts?: LogMessageOptions) => void;
|
|
650
|
+
step: (message: string, opts?: LogMessageOptions) => void;
|
|
651
|
+
warn: (message: string, opts?: LogMessageOptions) => void; /** alias for `log.warn()`. */
|
|
652
|
+
warning: (message: string, opts?: LogMessageOptions) => void;
|
|
653
|
+
error: (message: string, opts?: LogMessageOptions) => void;
|
|
654
|
+
};
|
|
655
|
+
declare const cancel: (message?: string, opts?: CommonOptions) => void;
|
|
656
|
+
declare const intro: (title?: string, opts?: CommonOptions) => void;
|
|
657
|
+
declare const outro: (message?: string, opts?: CommonOptions) => void;
|
|
658
|
+
interface MultiSelectOptions<Value> extends CommonOptions {
|
|
659
|
+
message: string;
|
|
660
|
+
options: Option<Value>[];
|
|
661
|
+
initialValues?: Value[];
|
|
662
|
+
maxItems?: number;
|
|
663
|
+
required?: boolean;
|
|
664
|
+
cursorAt?: Value;
|
|
665
|
+
}
|
|
666
|
+
declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[] | symbol>;
|
|
667
|
+
type FormatFn = (line: string) => string;
|
|
668
|
+
interface NoteOptions extends CommonOptions {
|
|
669
|
+
format?: FormatFn;
|
|
670
|
+
}
|
|
671
|
+
declare const note: (message?: string, title?: string, opts?: NoteOptions) => void;
|
|
672
|
+
interface PasswordOptions extends CommonOptions {
|
|
673
|
+
message: string;
|
|
674
|
+
mask?: string;
|
|
675
|
+
validate?: (value: string | undefined) => string | Error | undefined;
|
|
676
|
+
clearOnError?: boolean;
|
|
677
|
+
}
|
|
678
|
+
declare const password: (opts: PasswordOptions) => Promise<string | symbol>;
|
|
679
|
+
interface PathOptions extends CommonOptions {
|
|
680
|
+
root?: string;
|
|
681
|
+
directory?: boolean;
|
|
682
|
+
initialValue?: string;
|
|
683
|
+
message: string;
|
|
684
|
+
validate?: (value: string | undefined) => string | Error | undefined;
|
|
685
|
+
}
|
|
686
|
+
declare const path: (opts: PathOptions) => Promise<string | symbol>;
|
|
687
|
+
interface SpinnerOptions extends CommonOptions {
|
|
688
|
+
indicator?: 'dots' | 'timer';
|
|
689
|
+
onCancel?: () => void;
|
|
690
|
+
cancelMessage?: string;
|
|
691
|
+
errorMessage?: string;
|
|
692
|
+
frames?: string[];
|
|
693
|
+
delay?: number;
|
|
694
|
+
styleFrame?: (frame: string) => string;
|
|
695
|
+
}
|
|
696
|
+
interface SpinnerResult {
|
|
697
|
+
start(msg?: string): void;
|
|
698
|
+
stop(msg?: string): void;
|
|
699
|
+
cancel(msg?: string): void;
|
|
700
|
+
error(msg?: string): void;
|
|
701
|
+
message(msg?: string): void;
|
|
702
|
+
clear(): void;
|
|
703
|
+
readonly isCancelled: boolean;
|
|
704
|
+
}
|
|
705
|
+
declare const spinner: ({
|
|
706
|
+
indicator,
|
|
707
|
+
onCancel,
|
|
708
|
+
output,
|
|
709
|
+
cancelMessage,
|
|
710
|
+
errorMessage,
|
|
711
|
+
frames,
|
|
712
|
+
delay,
|
|
713
|
+
signal,
|
|
714
|
+
...opts
|
|
715
|
+
}?: SpinnerOptions) => SpinnerResult;
|
|
716
|
+
interface ProgressOptions extends SpinnerOptions {
|
|
717
|
+
style?: 'light' | 'heavy' | 'block';
|
|
718
|
+
max?: number;
|
|
719
|
+
size?: number;
|
|
720
|
+
}
|
|
721
|
+
interface ProgressResult extends SpinnerResult {
|
|
722
|
+
advance(step?: number, msg?: string): void;
|
|
723
|
+
}
|
|
724
|
+
declare function progress({
|
|
725
|
+
style,
|
|
726
|
+
max: userMax,
|
|
727
|
+
size: userSize,
|
|
728
|
+
...spinnerOptions
|
|
729
|
+
}?: ProgressOptions): ProgressResult;
|
|
730
|
+
interface SelectKeyOptions<Value extends string> extends CommonOptions {
|
|
731
|
+
message: string;
|
|
732
|
+
options: Option<Value>[];
|
|
733
|
+
initialValue?: Value;
|
|
734
|
+
caseSensitive?: boolean;
|
|
735
|
+
}
|
|
736
|
+
declare const selectKey: <Value extends string>(opts: SelectKeyOptions<Value>) => Promise<Value | symbol>;
|
|
737
|
+
declare const stream: {
|
|
738
|
+
message: (iterable: Iterable<string> | AsyncIterable<string>, {
|
|
739
|
+
symbol
|
|
740
|
+
}?: LogMessageOptions) => Promise<void>;
|
|
741
|
+
info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
742
|
+
success: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
743
|
+
step: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
744
|
+
warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>; /** alias for `log.warn()`. */
|
|
745
|
+
warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
746
|
+
error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
747
|
+
};
|
|
748
|
+
type Task = {
|
|
749
|
+
/**
|
|
750
|
+
* Task title
|
|
751
|
+
*/
|
|
752
|
+
title: string;
|
|
753
|
+
/**
|
|
754
|
+
* Task function
|
|
755
|
+
*/
|
|
756
|
+
task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
|
|
757
|
+
/**
|
|
758
|
+
* If enabled === false the task will be skipped
|
|
759
|
+
*/
|
|
760
|
+
enabled?: boolean;
|
|
761
|
+
};
|
|
762
|
+
/**
|
|
763
|
+
* Define a group of tasks to be executed
|
|
764
|
+
*/
|
|
765
|
+
declare const tasks: (tasks: Task[], opts?: CommonOptions) => Promise<void>;
|
|
766
|
+
interface TaskLogOptions extends CommonOptions {
|
|
767
|
+
title: string;
|
|
768
|
+
limit?: number;
|
|
769
|
+
spacing?: number;
|
|
770
|
+
retainLog?: boolean;
|
|
771
|
+
}
|
|
772
|
+
interface TaskLogMessageOptions {
|
|
773
|
+
raw?: boolean;
|
|
774
|
+
}
|
|
775
|
+
interface TaskLogCompletionOptions {
|
|
776
|
+
showLog?: boolean;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Renders a log which clears on success and remains on failure
|
|
780
|
+
*/
|
|
781
|
+
declare const taskLog: (opts: TaskLogOptions) => {
|
|
782
|
+
message(msg: string, mopts?: TaskLogMessageOptions): void;
|
|
783
|
+
group(name: string): {
|
|
784
|
+
message(msg: string, mopts?: TaskLogMessageOptions): void;
|
|
785
|
+
error(message: string): void;
|
|
786
|
+
success(message: string): void;
|
|
787
|
+
};
|
|
788
|
+
error(message: string, opts?: TaskLogCompletionOptions): void;
|
|
789
|
+
success(message: string, opts?: TaskLogCompletionOptions): void;
|
|
790
|
+
};
|
|
791
|
+
interface TextOptions extends CommonOptions {
|
|
792
|
+
message: string;
|
|
793
|
+
placeholder?: string;
|
|
794
|
+
defaultValue?: string;
|
|
795
|
+
initialValue?: string;
|
|
796
|
+
validate?: (value: string | undefined) => string | Error | undefined;
|
|
797
|
+
}
|
|
798
|
+
declare const text: (opts: TextOptions) => Promise<string | symbol>;
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/prompts.d.ts
|
|
801
|
+
type PromptProgress = ReturnType<typeof progress>;
|
|
802
|
+
type PromptSpinner = ReturnType<typeof spinner>;
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/resolvePackageVersion.d.ts
|
|
805
|
+
declare const HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV = "HOT_UPDATER_SERVER_PACKAGE_VERSION";
|
|
806
|
+
declare const resolvePackageVersion: (packageName: string, options?: {
|
|
807
|
+
searchFrom?: string;
|
|
808
|
+
}) => string;
|
|
809
|
+
declare const resolveHotUpdaterServerVersion: (currentPackageName: string, options?: {
|
|
810
|
+
searchFrom?: string;
|
|
811
|
+
}) => string;
|
|
812
|
+
//#endregion
|
|
813
|
+
//#region src/transformEnv.d.ts
|
|
814
|
+
declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region src/transformTemplate.d.ts
|
|
817
|
+
type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
|
|
818
|
+
type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
|
|
819
|
+
/**
|
|
820
|
+
* Replaces placeholders in the format %%key%% in a template string with values from the values object.
|
|
821
|
+
* Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
|
|
822
|
+
*
|
|
823
|
+
* @example
|
|
824
|
+
* const str = "Hello %%name%%, you are %%age%% years old."
|
|
825
|
+
* const result = transformTemplate(str, { name: "John", age: "20" })
|
|
826
|
+
* // Result: "Hello John, you are 20 years old."
|
|
827
|
+
*/
|
|
828
|
+
declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
|
|
829
|
+
//#endregion
|
|
830
|
+
export { BuildLogger, BuildLoggerConfig, BuildType, ConfigBuilder, ConfigResponse, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdaterConfigOptions, HotUpdaterLogWriter, IConfigBuilder, ImportInfo, PromptProgress, PromptSpinner, ProviderConfig, ReactNativeMetadata, banner, picocolors as colors, copyDirToTmp, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, encryptJson, ensureInstallPackages, getAndroidSdkPath, getCwd, getPackageManager, getReactNativeMetadatas, link, loadConfig, log, makeEnv, index_d_exports as p, printBanner, resolveHotUpdaterServerVersion, resolvePackageVersion, stripAnsi, transformEnv, transformTemplate };
|