@hot-updater/cli-tools 1.0.0-rc.1 → 1.0.0-rc.14

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/index.d.mts CHANGED
@@ -2,8 +2,6 @@ import { Readable } from "stream";
2
2
  import { Key as Key$1 } from "node:readline";
3
3
  import { Readable as Readable$1, Writable } from "node:stream";
4
4
  import { Bundle, BundleSigningPlugin, ConfigInput, LocalSigningConfig, Platform, RequiredDeep, SigningConfig, StoragePluginWith, StoragePutResult } from "@hot-updater/plugin-core";
5
- import * as _$_hot_updater_core0 from "@hot-updater/core";
6
-
7
5
  //#region src/BuildLogger.d.ts
8
6
  type LinePattern = string | RegExp;
9
7
  interface BuildLoggerConfig {
@@ -165,63 +163,42 @@ declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
165
163
  }>;
166
164
  //#endregion
167
165
  //#region src/createTarBr.d.ts
168
- declare const createTarBrTargetFiles: ({
169
- outfile,
170
- targetFiles
171
- }: {
166
+ declare const createTarBrTargetFiles: ({ outfile, targetFiles }: {
172
167
  targetFiles: {
173
168
  path: string;
174
169
  name: string;
175
170
  }[];
176
171
  outfile: string;
177
172
  }) => Promise<string>;
178
- declare const createTarBr: ({
179
- outfile,
180
- targetDir,
181
- excludeExts
182
- }: {
173
+ declare const createTarBr: ({ outfile, targetDir, excludeExts }: {
183
174
  targetDir: string;
184
175
  outfile: string;
185
176
  excludeExts?: string[];
186
177
  }) => Promise<string>;
187
178
  //#endregion
188
179
  //#region src/createTarGz.d.ts
189
- declare const createTarGzTargetFiles: ({
190
- outfile,
191
- targetFiles
192
- }: {
180
+ declare const createTarGzTargetFiles: ({ outfile, targetFiles }: {
193
181
  targetFiles: {
194
182
  path: string;
195
183
  name: string;
196
184
  }[];
197
185
  outfile: string;
198
186
  }) => Promise<string>;
199
- declare const createTarGz: ({
200
- outfile,
201
- targetDir,
202
- excludeExts
203
- }: {
187
+ declare const createTarGz: ({ outfile, targetDir, excludeExts }: {
204
188
  targetDir: string;
205
189
  outfile: string;
206
190
  excludeExts?: string[];
207
191
  }) => Promise<string>;
208
192
  //#endregion
209
193
  //#region src/createZip.d.ts
210
- declare const createZipTargetFiles: ({
211
- outfile,
212
- targetFiles
213
- }: {
194
+ declare const createZipTargetFiles: ({ outfile, targetFiles }: {
214
195
  targetFiles: {
215
196
  path: string;
216
197
  name: string;
217
198
  }[];
218
199
  outfile: string;
219
200
  }) => Promise<string>;
220
- declare const createZip: ({
221
- outfile,
222
- targetDir,
223
- excludeExts
224
- }: {
201
+ declare const createZip: ({ outfile, targetDir, excludeExts }: {
225
202
  targetDir: string;
226
203
  outfile: string;
227
204
  excludeExts?: string[];
@@ -303,18 +280,8 @@ type WriteHotUpdaterConfigResult = {
303
280
  path: string;
304
281
  reason?: string;
305
282
  };
306
- declare const createHotUpdaterConfigScaffold: ({
307
- build,
308
- storage,
309
- database,
310
- extraImports,
311
- helperStatements,
312
- updateStrategy
313
- }: CreateHotUpdaterConfigScaffoldOptions) => HotUpdaterConfigScaffold;
314
- declare const createHotUpdaterConfigScaffoldFromBuilder: (builder: ConfigBuilder, {
315
- helperStatements,
316
- updateStrategy
317
- }?: CreateHotUpdaterConfigScaffoldFromBuilderOptions) => HotUpdaterConfigScaffold;
283
+ declare const createHotUpdaterConfigScaffold: ({ build, storage, database, extraImports, helperStatements, updateStrategy }: CreateHotUpdaterConfigScaffoldOptions) => HotUpdaterConfigScaffold;
284
+ declare const createHotUpdaterConfigScaffoldFromBuilder: (builder: ConfigBuilder, { helperStatements, updateStrategy }?: CreateHotUpdaterConfigScaffoldFromBuilderOptions) => HotUpdaterConfigScaffold;
318
285
  declare const writeHotUpdaterConfig: (scaffold: HotUpdaterConfigScaffold, filePath?: string) => Promise<WriteHotUpdaterConfigResult>;
319
286
  //#endregion
320
287
  //#region src/hotUpdaterEnv.d.ts
@@ -323,10 +290,7 @@ type HotUpdaterInitEnv = {
323
290
  readonly inputEnv?: Readonly<Record<string, string>>;
324
291
  readonly managedEnv: Readonly<Record<string, string>>;
325
292
  };
326
- declare const getHotUpdaterInitInputEnv: ({
327
- env,
328
- managedEnv
329
- }: HotUpdaterInitEnv, nonInteractive: boolean) => Readonly<Record<string, string>>;
293
+ declare const getHotUpdaterInitInputEnv: ({ env, managedEnv }: HotUpdaterInitEnv, nonInteractive: boolean) => Readonly<Record<string, string>>;
330
294
  declare const readHotUpdaterInitEnv: (cwd: string, envFile?: string) => Promise<HotUpdaterInitEnv>;
331
295
  declare const readHotUpdaterEnv: (cwd: string) => Promise<Readonly<Record<string, string>>>;
332
296
  declare const getHotUpdaterEnvValue: (env: Readonly<Record<string, string>>, key: string) => string | undefined;
@@ -338,41 +302,25 @@ declare const HotUpdateDirUtil: {
338
302
  readonly logDirName: "log";
339
303
  readonly outputGitignorePath: ".hot-updater/output";
340
304
  readonly logGitignorePath: ".hot-updater/log";
341
- readonly getDirPath: ({
342
- cwd
343
- }: {
305
+ readonly getDirPath: ({ cwd }: {
344
306
  cwd: string;
345
307
  }) => string;
346
- readonly getDefaultOutputPath: ({
347
- cwd
348
- }: {
308
+ readonly getDefaultOutputPath: ({ cwd }: {
349
309
  cwd: string;
350
310
  }) => string;
351
- readonly getLogDirPath: ({
352
- cwd
353
- }: {
311
+ readonly getLogDirPath: ({ cwd }: {
354
312
  cwd: string;
355
313
  }) => string;
356
314
  };
357
315
  //#endregion
358
316
  //#region src/infrastructureGeneration.d.ts
359
317
  type Fetch = typeof fetch;
360
- declare const assertInfrastructureGenerationPayload: ({
361
- payload,
362
- provider,
363
- resource
364
- }: {
318
+ declare const assertInfrastructureGenerationPayload: ({ payload, provider, resource }: {
365
319
  readonly payload: unknown;
366
320
  readonly provider: string;
367
321
  readonly resource: string;
368
322
  }) => void;
369
- declare const assertInfrastructureGenerationAtUrl: ({
370
- fetchImpl,
371
- legacyStatuses,
372
- provider,
373
- resource,
374
- versionUrl
375
- }: {
323
+ declare const assertInfrastructureGenerationAtUrl: ({ fetchImpl, legacyStatuses, provider, resource, versionUrl }: {
376
324
  readonly fetchImpl?: Fetch;
377
325
  readonly legacyStatuses?: readonly number[];
378
326
  readonly provider: string;
@@ -410,10 +358,7 @@ type InitProviderDefinition<TInputs extends InitProviderInputsDefinition = InitP
410
358
  readonly label: string;
411
359
  };
412
360
  declare const defineInitProvider: <const TInputs extends InitProviderInputsDefinition>(provider: InitProviderDefinition<TInputs>) => InitProviderDefinition<TInputs>;
413
- declare const shouldAutoSelectOnlyInitResource: ({
414
- availableResourceCount,
415
- savedIdentifier
416
- }: {
361
+ declare const shouldAutoSelectOnlyInitResource: ({ availableResourceCount, savedIdentifier }: {
417
362
  readonly availableResourceCount: number;
418
363
  readonly savedIdentifier?: string;
419
364
  }) => boolean;
@@ -423,40 +368,23 @@ declare const getInitProviderTextPromptValues: (prompt: InitProviderTextPromptDe
423
368
  };
424
369
  declare const resolveInitProviderInput: (env: Readonly<Record<string, string>>, input: InitProviderInputDefinition) => string | undefined;
425
370
  declare const resolveInitProviderInputs: (env: Readonly<Record<string, string>>, provider: InitProviderDefinition) => Readonly<Record<string, string | undefined>>;
426
- declare const getMissingInitProviderInputs: ({
427
- inputs,
428
- preflightOnly,
429
- provider
430
- }: {
371
+ declare const getMissingInitProviderInputs: ({ inputs, preflightOnly, provider }: {
431
372
  readonly inputs: Readonly<Record<string, string | undefined>>;
432
373
  readonly preflightOnly?: boolean;
433
374
  readonly provider: InitProviderDefinition;
434
375
  }) => readonly string[];
435
- declare const assertInitProviderInputs: <TInputs extends InitProviderInputsDefinition>({
436
- inputs,
437
- provider,
438
- strict
439
- }: {
376
+ declare const assertInitProviderInputs: <TInputs extends InitProviderInputsDefinition>({ inputs, provider, strict }: {
440
377
  readonly inputs: Readonly<Record<string, string | undefined>>;
441
378
  readonly provider: InitProviderDefinition<TInputs>;
442
379
  readonly strict?: boolean;
443
380
  }) => void;
444
- declare const confirmInitInputPersistence: <TInputs extends InitProviderInputsDefinition>({
445
- existingEnv,
446
- inputs,
447
- nonInteractive,
448
- provider
449
- }: {
381
+ declare const confirmInitInputPersistence: <TInputs extends InitProviderInputsDefinition>({ existingEnv, inputs, nonInteractive, provider }: {
450
382
  readonly existingEnv: Readonly<Record<string, string>>;
451
383
  readonly inputs: Readonly<Record<string, string | undefined>>;
452
384
  readonly nonInteractive: boolean;
453
385
  readonly provider: InitProviderDefinition<TInputs>;
454
386
  }) => Promise<boolean>;
455
- declare const getInitProviderEnvVars: <TInputs extends InitProviderInputsDefinition>({
456
- includeConsentInputs,
457
- inputs,
458
- provider
459
- }: {
387
+ declare const getInitProviderEnvVars: <TInputs extends InitProviderInputsDefinition>({ includeConsentInputs, inputs, provider }: {
460
388
  readonly includeConsentInputs: boolean;
461
389
  readonly inputs: Readonly<Record<string, string | undefined>>;
462
390
  readonly provider: InitProviderDefinition<TInputs>;
@@ -482,10 +410,7 @@ declare class LegacyInfrastructureError extends InitError {
482
410
  readonly name = "LegacyInfrastructureError";
483
411
  constructor(provider: string, resource: string);
484
412
  }
485
- declare const assertInitInputs: ({
486
- inputs,
487
- strict
488
- }: {
413
+ declare const assertInitInputs: ({ inputs, strict }: {
489
414
  readonly inputs: Readonly<Record<string, string | undefined>>;
490
415
  readonly strict?: boolean;
491
416
  }) => void;
@@ -499,10 +424,7 @@ type HotUpdaterLogWriter = {
499
424
  close: () => Promise<void>;
500
425
  };
501
426
  declare const stripAnsi: (value: string) => string;
502
- declare const createLogWriter: ({
503
- prefix,
504
- logFilePath
505
- }: {
427
+ declare const createLogWriter: ({ prefix, logFilePath }: {
506
428
  prefix: string;
507
429
  logFilePath?: string;
508
430
  }) => Promise<HotUpdaterLogWriter>;
@@ -545,12 +467,7 @@ declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: stri
545
467
  //#region src/promoteBundle.d.ts
546
468
  type PromoteStoragePlugin = StoragePluginWith<"get" | "put" | "exists" | "delete">;
547
469
  declare const LEGACY_BUNDLE_ERROR = "This OTA bundle was created by a version that does not support manifest.json. Copy bundle is not available.";
548
- declare function createCopiedBundleArchive({
549
- bundle,
550
- config,
551
- nextBundleId,
552
- storagePlugin
553
- }: {
470
+ declare function createCopiedBundleArchive({ bundle, config, nextBundleId, storagePlugin }: {
554
471
  bundle: Bundle;
555
472
  config: ConfigResponse;
556
473
  nextBundleId: string;
@@ -561,12 +478,12 @@ declare function createCopiedBundleArchive({
561
478
  archiveByteSize: number;
562
479
  storageUri: string;
563
480
  fileHash: string;
564
- metadata: _$_hot_updater_core0.BundleMetadata | undefined;
481
+ metadata: import("@hot-updater/core").BundleMetadata | undefined;
565
482
  assetBaseStorageUri: string;
566
483
  patches: never[];
567
484
  manifestFileHash: string;
568
485
  manifestStorageUri: string;
569
- platform: _$_hot_updater_core0.Platform;
486
+ platform: import("@hot-updater/core").Platform;
570
487
  gitCommitHash: string | null;
571
488
  };
572
489
  uploadedStorageUris: string[];
@@ -625,12 +542,18 @@ interface ClackSettings {
625
542
  * Date prompt localization
626
543
  */
627
544
  date?: {
628
- /** Month names for validation messages (January, February, ...) */monthNames?: string[];
545
+ /** Month names for validation messages (January, February, ...) */
546
+ monthNames?: string[];
629
547
  messages?: {
630
- /** Shown when date is missing */required?: string; /** Shown when month > 12 */
631
- invalidMonth?: string; /** (days, monthName) => message for invalid day */
632
- invalidDay?: (days: number, month: string) => string; /** (min) => message when date is before minDate */
633
- afterMin?: (min: Date) => string; /** (max) => message when date is after maxDate */
548
+ /** Shown when date is missing */
549
+ required?: string;
550
+ /** Shown when month > 12 */
551
+ invalidMonth?: string;
552
+ /** (days, monthName) => message for invalid day */
553
+ invalidDay?: (days: number, month: string) => string;
554
+ /** (min) => message when date is before minDate */
555
+ afterMin?: (min: Date) => string;
556
+ /** (max) => message when date is after maxDate */
634
557
  beforeMax?: (max: Date) => string;
635
558
  };
636
559
  };
@@ -749,12 +672,6 @@ declare namespace StandardSchemaV1 {
749
672
  * ```
750
673
  */
751
674
  type Validate<TValue> = ((value: TValue | undefined) => string | Error | undefined) | StandardSchemaV1<TValue | undefined, unknown>;
752
- /**
753
- * Runs the `validate()` option and normalizes the result
754
- * @param validate - The validate option
755
- * @param value - The user input
756
- * @returns the validation result
757
- */
758
675
  interface PromptOptions<TValue, Self extends Prompt<TValue>> {
759
676
  render(this: Omit<Self, 'prompt'>): string | undefined;
760
677
  initialValue?: any;
@@ -1246,12 +1163,12 @@ interface DateOptions extends CommonOptions {
1246
1163
  * ```
1247
1164
  */
1248
1165
  declare const date: (opts: DateOptions) => Promise<Date | symbol>;
1249
- type Prettify<T> = { [P in keyof T]: T[P] } & {};
1166
+ type Prettify<T> = { [P in keyof T]: T[P]; } & {};
1250
1167
  /**
1251
1168
  * The return type of a {@link PromptGroup}.
1252
1169
  * Resolves all prompt results, excluding the cancel symbol.
1253
1170
  */
1254
- type PromptGroupAwaitedReturn<T> = { [P in keyof T]: Exclude<Awaited<T[P]>, symbol> };
1171
+ type PromptGroupAwaitedReturn<T> = { [P in keyof T]: Exclude<Awaited<T[P]>, symbol>; };
1255
1172
  /**
1256
1173
  * Options for the {@link group} utility.
1257
1174
  */
@@ -1269,7 +1186,7 @@ interface PromptGroupOptions<T> {
1269
1186
  */
1270
1187
  type PromptGroup<T> = { [P in keyof T]: (opts: {
1271
1188
  results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
1272
- }) => undefined | Promise<T[P] | undefined> };
1189
+ }) => undefined | Promise<T[P] | undefined>; };
1273
1190
  /**
1274
1191
  * The `group` utility provides a consistent way to combine a series of prompts,
1275
1192
  * combining each answer into one object. Each prompt receives the results of
@@ -1427,32 +1344,19 @@ interface LimitOptionsParams<TOption> extends CommonOptions {
1427
1344
  * });
1428
1345
  * ```
1429
1346
  */
1430
- declare const limitOptions: <TOption>({
1431
- cursor,
1432
- options,
1433
- style,
1434
- output,
1435
- maxItems,
1436
- columnPadding,
1437
- rowPadding
1438
- }: LimitOptionsParams<TOption>) => string[];
1347
+ declare const limitOptions: <TOption>({ cursor, options, style, output, maxItems, columnPadding, rowPadding }: LimitOptionsParams<TOption>) => string[];
1439
1348
  interface LogMessageOptions extends CommonOptions {
1440
1349
  symbol?: string;
1441
1350
  spacing?: number;
1442
1351
  secondarySymbol?: string;
1443
1352
  }
1444
1353
  declare const log$1: {
1445
- message: (message?: string | string[], {
1446
- symbol,
1447
- secondarySymbol,
1448
- output,
1449
- spacing,
1450
- withGuide
1451
- }?: LogMessageOptions) => void;
1354
+ message: (message?: string | string[], { symbol, secondarySymbol, output, spacing, withGuide }?: LogMessageOptions) => void;
1452
1355
  info: (message: string, opts?: LogMessageOptions) => void;
1453
1356
  success: (message: string, opts?: LogMessageOptions) => void;
1454
1357
  step: (message: string, opts?: LogMessageOptions) => void;
1455
- warn: (message: string, opts?: LogMessageOptions) => void; /** alias for `log.warn()`. */
1358
+ warn: (message: string, opts?: LogMessageOptions) => void;
1359
+ /** alias for `log.warn()`. */
1456
1360
  warning: (message: string, opts?: LogMessageOptions) => void;
1457
1361
  error: (message: string, opts?: LogMessageOptions) => void;
1458
1362
  };
@@ -1712,17 +1616,7 @@ interface SpinnerResult {
1712
1616
  clear(): void;
1713
1617
  readonly isCancelled: boolean;
1714
1618
  }
1715
- declare const spinner: ({
1716
- indicator,
1717
- onCancel,
1718
- output,
1719
- cancelMessage,
1720
- errorMessage,
1721
- frames,
1722
- delay,
1723
- signal,
1724
- ...opts
1725
- }?: SpinnerOptions) => SpinnerResult;
1619
+ declare const spinner: ({ indicator, onCancel, output, cancelMessage, errorMessage, frames, delay, signal, ...opts }?: SpinnerOptions) => SpinnerResult;
1726
1620
  interface ProgressOptions extends SpinnerOptions {
1727
1621
  style?: 'light' | 'heavy' | 'block';
1728
1622
  max?: number;
@@ -1731,12 +1625,7 @@ interface ProgressOptions extends SpinnerOptions {
1731
1625
  interface ProgressResult extends SpinnerResult {
1732
1626
  advance(step?: number, msg?: string): void;
1733
1627
  }
1734
- declare function progress({
1735
- style,
1736
- max: userMax,
1737
- size: userSize,
1738
- ...spinnerOptions
1739
- }?: ProgressOptions): ProgressResult;
1628
+ declare function progress({ style, max: userMax, size: userSize, ...spinnerOptions }?: ProgressOptions): ProgressResult;
1740
1629
  interface SelectKeyOptions<Value extends string> extends CommonOptions {
1741
1630
  message: string;
1742
1631
  options: Option<Value>[];
@@ -1745,13 +1634,12 @@ interface SelectKeyOptions<Value extends string> extends CommonOptions {
1745
1634
  }
1746
1635
  declare const selectKey: <Value extends string>(opts: SelectKeyOptions<Value>) => Promise<Value | symbol>;
1747
1636
  declare const stream: {
1748
- message: (iterable: Iterable<string> | AsyncIterable<string>, {
1749
- symbol
1750
- }?: LogMessageOptions) => Promise<void>;
1637
+ message: (iterable: Iterable<string> | AsyncIterable<string>, { symbol }?: LogMessageOptions) => Promise<void>;
1751
1638
  info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
1752
1639
  success: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
1753
1640
  step: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
1754
- warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>; /** alias for `log.warn()`. */
1641
+ warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
1642
+ /** alias for `log.warn()`. */
1755
1643
  warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
1756
1644
  error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
1757
1645
  };
@@ -1833,7 +1721,7 @@ declare const transformEnv: <T extends Record<string, string>>(filename: string,
1833
1721
  //#endregion
1834
1722
  //#region src/transformTemplate.d.ts
1835
1723
  type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
1836
- type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
1724
+ type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string; };
1837
1725
  /**
1838
1726
  * Replaces placeholders in the format %%key%% in a template string with values from the values object.
1839
1727
  * Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.