@hot-updater/plugin-core 0.20.10 → 0.20.12

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.
Files changed (5) hide show
  1. package/dist/index.cjs +19106 -19325
  2. package/dist/index.d.cts +140 -136
  3. package/dist/index.d.ts +140 -136
  4. package/dist/index.js +25770 -25989
  5. package/package.json +3 -3
package/dist/index.d.cts CHANGED
@@ -1,17 +1,51 @@
1
1
  import { Bundle, Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/core";
2
2
 
3
- //#region src/log.d.ts
4
- declare const log: {
5
- normal: (message: string | number | null | undefined) => void;
6
- success: (message: string | number | null | undefined) => void;
7
- info: (message: string | number | null | undefined) => void;
8
- error: (message: string | number | null | undefined) => void;
9
- warn: (message: string | number | null | undefined) => void;
10
- debug: (message: string | number | null | undefined) => void;
11
- };
3
+ //#region src/banner.d.ts
4
+ declare const link: (url: string) => string;
5
+ declare const banner: (version?: string) => string;
6
+ declare const printBanner: (version?: string) => void;
12
7
  //#endregion
13
- //#region src/cwd.d.ts
14
- declare const getCwd: () => string;
8
+ //#region src/ConfigBuilder.d.ts
9
+ type BuildType = "bare" | "rock" | "expo";
10
+ type ImportInfo = {
11
+ pkg: string;
12
+ named?: string[];
13
+ defaultOrNamespace?: string;
14
+ sideEffect?: boolean;
15
+ };
16
+ type ProviderConfig = {
17
+ imports: ImportInfo[];
18
+ configString: string;
19
+ };
20
+ interface IConfigBuilder {
21
+ /** Sets the build type ('bare' or 'rock' or 'expo') and adds necessary build imports. */
22
+ setBuildType(buildType: BuildType): this;
23
+ /** Sets the storage configuration and adds its required imports. */
24
+ setStorage(storageConfig: ProviderConfig): this;
25
+ /** Sets the database configuration and adds its required imports. */
26
+ setDatabase(databaseConfig: ProviderConfig): this;
27
+ /** Sets the intermediate code block to be placed between imports and defineConfig. */
28
+ setIntermediateCode(code: string): this;
29
+ /** Assembles and returns the final configuration string. */
30
+ getResult(): string;
31
+ }
32
+ declare class ConfigBuilder implements IConfigBuilder {
33
+ private buildType;
34
+ private storageInfo;
35
+ private databaseInfo;
36
+ private intermediateCode;
37
+ private collectedImports;
38
+ constructor();
39
+ addImport(info: ImportInfo): this;
40
+ private addImports;
41
+ private generateImportStatements;
42
+ private generateBuildConfigString;
43
+ setBuildType(buildType: BuildType): this;
44
+ setStorage(storageConfig: ProviderConfig): this;
45
+ setDatabase(databaseConfig: ProviderConfig): this;
46
+ setIntermediateCode(code: string): this;
47
+ getResult(): string;
48
+ }
15
49
  //#endregion
16
50
  //#region src/types/utils.d.ts
17
51
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
@@ -175,6 +209,10 @@ type ConfigInput = {
175
209
  * @example ["resources/**", ".gitignore"]
176
210
  */
177
211
  extraSources?: string[];
212
+ /**
213
+ * The paths to be ignored in the fingerprint.
214
+ */
215
+ ignorePaths?: string[];
178
216
  /**
179
217
  * When debug mode is enabled, more detailed information will be exposed in fingerprint.json.
180
218
  */
@@ -199,14 +237,19 @@ type ConfigInput = {
199
237
  database: (args: BasePluginArgs) => Promise<DatabasePlugin> | DatabasePlugin;
200
238
  };
201
239
  //#endregion
202
- //#region src/loadConfig.d.ts
203
- type HotUpdaterConfigOptions = {
204
- platform: Platform;
205
- channel: string;
206
- } | null;
207
- type ConfigResponse = RequiredDeep<ConfigInput>;
208
- declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
209
- declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
240
+ //#region src/calculatePagination.d.ts
241
+ interface PaginationOptions {
242
+ limit: number;
243
+ offset: number;
244
+ }
245
+ interface PaginatedResult {
246
+ data: Bundle[];
247
+ pagination: PaginationInfo;
248
+ }
249
+ /**
250
+ * Calculate pagination information based on total count, limit, and offset
251
+ */
252
+ declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
210
253
  //#endregion
211
254
  //#region src/copyDirToTmp.d.ts
212
255
  declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
@@ -214,6 +257,40 @@ declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
214
257
  removeTmpDir: () => Promise<void>;
215
258
  }>;
216
259
  //#endregion
260
+ //#region src/createBlobDatabasePlugin.d.ts
261
+ /**
262
+ *
263
+ * @param name - The name of the database plugin
264
+ * @param listObjects - Function to list objects in the storage
265
+ * @param loadObject - Function to load an JSON object from the storage
266
+ * @param uploadObject - Function to upload an JSON object to the storage
267
+ * @param deleteObject - Function to delete an object from the storage
268
+ * @param invalidatePaths - Function to invalidate paths in the CDN
269
+ * @param hooks - Optional hooks for additional functionality - see createDatabasePlugin
270
+ * @returns
271
+ */
272
+ declare const createBlobDatabasePlugin: <TContext = object>({
273
+ name,
274
+ getContext,
275
+ listObjects,
276
+ loadObject,
277
+ uploadObject,
278
+ deleteObject,
279
+ invalidatePaths,
280
+ hooks,
281
+ apiBasePath
282
+ }: {
283
+ name: string;
284
+ getContext: () => TContext;
285
+ listObjects: (context: TContext, prefix: string) => Promise<string[]>;
286
+ loadObject: <T>(context: TContext, key: string) => Promise<T | null>;
287
+ uploadObject: <T>(context: TContext, key: string, data: T) => Promise<void>;
288
+ deleteObject: (context: TContext, key: string) => Promise<void>;
289
+ invalidatePaths: (context: TContext, paths: string[]) => Promise<void>;
290
+ hooks?: DatabasePluginHooks;
291
+ apiBasePath: string;
292
+ }) => (options: BasePluginArgs) => DatabasePlugin;
293
+ //#endregion
217
294
  //#region src/createDatabasePlugin.d.ts
218
295
  interface BaseDatabaseUtils {
219
296
  cwd: string;
@@ -278,34 +355,8 @@ interface AbstractDatabasePlugin<TContext = object> {
278
355
  */
279
356
  declare function createDatabasePlugin<TContext = object>(name: string, abstractPlugin: AbstractDatabasePlugin<TContext>, hooks?: DatabasePluginHooks): (options: BasePluginArgs) => DatabasePlugin;
280
357
  //#endregion
281
- //#region src/banner.d.ts
282
- declare const link: (url: string) => string;
283
- declare const banner: (version?: string) => string;
284
- declare const printBanner: (version?: string) => void;
285
- //#endregion
286
- //#region src/transformTemplate.d.ts
287
- type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
288
- type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
289
- /**
290
- * Replaces placeholders in the format %%key%% in a template string with values from the values object.
291
- * Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
292
- *
293
- * @example
294
- * const str = "Hello %%name%%, you are %%age%% years old."
295
- * const result = transformTemplate(str, { name: "John", age: "20" })
296
- * // Result: "Hello John, you are 20 years old."
297
- */
298
- declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
299
- //#endregion
300
- //#region src/transformEnv.d.ts
301
- declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
302
- //#endregion
303
- //#region src/makeEnv.d.ts
304
- type EnvVarValue = string | {
305
- comment: string;
306
- value: string;
307
- };
308
- declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
358
+ //#region src/createStorageKeyBuilder.d.ts
359
+ declare const createStorageKeyBuilder: (basePath: string | undefined) => (...args: string[]) => string;
309
360
  //#endregion
310
361
  //#region src/createZip.d.ts
311
362
  declare const createZipTargetFiles: ({
@@ -328,100 +379,53 @@ declare const createZip: ({
328
379
  excludeExts?: string[];
329
380
  }) => Promise<string>;
330
381
  //#endregion
331
- //#region src/createBlobDatabasePlugin.d.ts
332
- /**
333
- *
334
- * @param name - The name of the database plugin
335
- * @param listObjects - Function to list objects in the storage
336
- * @param loadObject - Function to load an JSON object from the storage
337
- * @param uploadObject - Function to upload an JSON object to the storage
338
- * @param deleteObject - Function to delete an object from the storage
339
- * @param invalidatePaths - Function to invalidate paths in the CDN
340
- * @param hooks - Optional hooks for additional functionality - see createDatabasePlugin
341
- * @returns
342
- */
343
- declare const createBlobDatabasePlugin: <TContext = object>({
344
- name,
345
- getContext,
346
- listObjects,
347
- loadObject,
348
- uploadObject,
349
- deleteObject,
350
- invalidatePaths,
351
- hooks,
352
- apiBasePath
353
- }: {
354
- name: string;
355
- getContext: () => TContext;
356
- listObjects: (context: TContext, prefix: string) => Promise<string[]>;
357
- loadObject: <T>(context: TContext, key: string) => Promise<T | null>;
358
- uploadObject: <T>(context: TContext, key: string, data: T) => Promise<void>;
359
- deleteObject: (context: TContext, key: string) => Promise<void>;
360
- invalidatePaths: (context: TContext, paths: string[]) => Promise<void>;
361
- hooks?: DatabasePluginHooks;
362
- apiBasePath: string;
363
- }) => (options: BasePluginArgs) => DatabasePlugin;
382
+ //#region src/cwd.d.ts
383
+ declare const getCwd: () => string;
364
384
  //#endregion
365
- //#region src/ConfigBuilder.d.ts
366
- type BuildType = "bare" | "rock" | "expo";
367
- type ImportInfo = {
368
- pkg: string;
369
- named?: string[];
370
- defaultOrNamespace?: string;
371
- sideEffect?: boolean;
385
+ //#region src/generateMinBundleId.d.ts
386
+ declare const generateMinBundleId: () => string;
387
+ //#endregion
388
+ //#region src/loadConfig.d.ts
389
+ type HotUpdaterConfigOptions = {
390
+ platform: Platform;
391
+ channel: string;
392
+ } | null;
393
+ type ConfigResponse = RequiredDeep<ConfigInput>;
394
+ declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
395
+ declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
396
+ //#endregion
397
+ //#region src/log.d.ts
398
+ declare const log: {
399
+ normal: (message: string | number | null | undefined) => void;
400
+ success: (message: string | number | null | undefined) => void;
401
+ info: (message: string | number | null | undefined) => void;
402
+ error: (message: string | number | null | undefined) => void;
403
+ warn: (message: string | number | null | undefined) => void;
404
+ debug: (message: string | number | null | undefined) => void;
372
405
  };
373
- type ProviderConfig = {
374
- imports: ImportInfo[];
375
- configString: string;
406
+ //#endregion
407
+ //#region src/makeEnv.d.ts
408
+ type EnvVarValue = string | {
409
+ comment: string;
410
+ value: string;
376
411
  };
377
- interface IConfigBuilder {
378
- /** Sets the build type ('bare' or 'rock' or 'expo') and adds necessary build imports. */
379
- setBuildType(buildType: BuildType): this;
380
- /** Sets the storage configuration and adds its required imports. */
381
- setStorage(storageConfig: ProviderConfig): this;
382
- /** Sets the database configuration and adds its required imports. */
383
- setDatabase(databaseConfig: ProviderConfig): this;
384
- /** Sets the intermediate code block to be placed between imports and defineConfig. */
385
- setIntermediateCode(code: string): this;
386
- /** Assembles and returns the final configuration string. */
387
- getResult(): string;
388
- }
389
- declare class ConfigBuilder implements IConfigBuilder {
390
- private buildType;
391
- private storageInfo;
392
- private databaseInfo;
393
- private intermediateCode;
394
- private collectedImports;
395
- constructor();
396
- addImport(info: ImportInfo): this;
397
- private addImports;
398
- private generateImportStatements;
399
- private generateBuildConfigString;
400
- setBuildType(buildType: BuildType): this;
401
- setStorage(storageConfig: ProviderConfig): this;
402
- setDatabase(databaseConfig: ProviderConfig): this;
403
- setIntermediateCode(code: string): this;
404
- getResult(): string;
405
- }
412
+ declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
406
413
  //#endregion
407
- //#region src/calculatePagination.d.ts
408
- interface PaginationOptions {
409
- limit: number;
410
- offset: number;
411
- }
412
- interface PaginatedResult {
413
- data: Bundle[];
414
- pagination: PaginationInfo;
415
- }
414
+ //#region src/transformEnv.d.ts
415
+ declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
416
+ //#endregion
417
+ //#region src/transformTemplate.d.ts
418
+ type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
419
+ type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
416
420
  /**
417
- * Calculate pagination information based on total count, limit, and offset
421
+ * Replaces placeholders in the format %%key%% in a template string with values from the values object.
422
+ * Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
423
+ *
424
+ * @example
425
+ * const str = "Hello %%name%%, you are %%age%% years old."
426
+ * const result = transformTemplate(str, { name: "John", age: "20" })
427
+ * // Result: "Hello John, you are 20 years old."
418
428
  */
419
- declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
420
- //#endregion
421
- //#region src/generateMinBundleId.d.ts
422
- declare const generateMinBundleId: () => string;
423
- //#endregion
424
- //#region src/createStorageKeyBuilder.d.ts
425
- declare const createStorageKeyBuilder: (basePath: string | undefined) => (...args: string[]) => string;
429
+ declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
426
430
  //#endregion
427
431
  export { AbstractDatabasePlugin, BaseDatabaseUtils, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuildType, BuiltIns, type Bundle, ConfigBuilder, ConfigInput, ConfigResponse, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, HotUpdaterConfigOptions, IConfigBuilder, ImportInfo, NativeBuildArgs, PaginatedResult, PaginationInfo, PaginationOptions, type Platform, PlatformConfig, Primitive, ProviderConfig, RequiredDeep, StoragePlugin, StoragePluginHooks, banner, calculatePagination, copyDirToTmp, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createZip, createZipTargetFiles, generateMinBundleId, getCwd, link, loadConfig, loadConfigSync, log, makeEnv, printBanner, transformEnv, transformTemplate };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,51 @@
1
1
  import { Bundle, Bundle as Bundle$1, Platform, Platform as Platform$1 } from "@hot-updater/core";
2
2
 
3
- //#region src/log.d.ts
4
- declare const log: {
5
- normal: (message: string | number | null | undefined) => void;
6
- success: (message: string | number | null | undefined) => void;
7
- info: (message: string | number | null | undefined) => void;
8
- error: (message: string | number | null | undefined) => void;
9
- warn: (message: string | number | null | undefined) => void;
10
- debug: (message: string | number | null | undefined) => void;
11
- };
3
+ //#region src/banner.d.ts
4
+ declare const link: (url: string) => string;
5
+ declare const banner: (version?: string) => string;
6
+ declare const printBanner: (version?: string) => void;
12
7
  //#endregion
13
- //#region src/cwd.d.ts
14
- declare const getCwd: () => string;
8
+ //#region src/ConfigBuilder.d.ts
9
+ type BuildType = "bare" | "rock" | "expo";
10
+ type ImportInfo = {
11
+ pkg: string;
12
+ named?: string[];
13
+ defaultOrNamespace?: string;
14
+ sideEffect?: boolean;
15
+ };
16
+ type ProviderConfig = {
17
+ imports: ImportInfo[];
18
+ configString: string;
19
+ };
20
+ interface IConfigBuilder {
21
+ /** Sets the build type ('bare' or 'rock' or 'expo') and adds necessary build imports. */
22
+ setBuildType(buildType: BuildType): this;
23
+ /** Sets the storage configuration and adds its required imports. */
24
+ setStorage(storageConfig: ProviderConfig): this;
25
+ /** Sets the database configuration and adds its required imports. */
26
+ setDatabase(databaseConfig: ProviderConfig): this;
27
+ /** Sets the intermediate code block to be placed between imports and defineConfig. */
28
+ setIntermediateCode(code: string): this;
29
+ /** Assembles and returns the final configuration string. */
30
+ getResult(): string;
31
+ }
32
+ declare class ConfigBuilder implements IConfigBuilder {
33
+ private buildType;
34
+ private storageInfo;
35
+ private databaseInfo;
36
+ private intermediateCode;
37
+ private collectedImports;
38
+ constructor();
39
+ addImport(info: ImportInfo): this;
40
+ private addImports;
41
+ private generateImportStatements;
42
+ private generateBuildConfigString;
43
+ setBuildType(buildType: BuildType): this;
44
+ setStorage(storageConfig: ProviderConfig): this;
45
+ setDatabase(databaseConfig: ProviderConfig): this;
46
+ setIntermediateCode(code: string): this;
47
+ getResult(): string;
48
+ }
15
49
  //#endregion
16
50
  //#region src/types/utils.d.ts
17
51
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
@@ -175,6 +209,10 @@ type ConfigInput = {
175
209
  * @example ["resources/**", ".gitignore"]
176
210
  */
177
211
  extraSources?: string[];
212
+ /**
213
+ * The paths to be ignored in the fingerprint.
214
+ */
215
+ ignorePaths?: string[];
178
216
  /**
179
217
  * When debug mode is enabled, more detailed information will be exposed in fingerprint.json.
180
218
  */
@@ -199,14 +237,19 @@ type ConfigInput = {
199
237
  database: (args: BasePluginArgs) => Promise<DatabasePlugin> | DatabasePlugin;
200
238
  };
201
239
  //#endregion
202
- //#region src/loadConfig.d.ts
203
- type HotUpdaterConfigOptions = {
204
- platform: Platform;
205
- channel: string;
206
- } | null;
207
- type ConfigResponse = RequiredDeep<ConfigInput>;
208
- declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
209
- declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
240
+ //#region src/calculatePagination.d.ts
241
+ interface PaginationOptions {
242
+ limit: number;
243
+ offset: number;
244
+ }
245
+ interface PaginatedResult {
246
+ data: Bundle[];
247
+ pagination: PaginationInfo;
248
+ }
249
+ /**
250
+ * Calculate pagination information based on total count, limit, and offset
251
+ */
252
+ declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
210
253
  //#endregion
211
254
  //#region src/copyDirToTmp.d.ts
212
255
  declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
@@ -214,6 +257,40 @@ declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
214
257
  removeTmpDir: () => Promise<void>;
215
258
  }>;
216
259
  //#endregion
260
+ //#region src/createBlobDatabasePlugin.d.ts
261
+ /**
262
+ *
263
+ * @param name - The name of the database plugin
264
+ * @param listObjects - Function to list objects in the storage
265
+ * @param loadObject - Function to load an JSON object from the storage
266
+ * @param uploadObject - Function to upload an JSON object to the storage
267
+ * @param deleteObject - Function to delete an object from the storage
268
+ * @param invalidatePaths - Function to invalidate paths in the CDN
269
+ * @param hooks - Optional hooks for additional functionality - see createDatabasePlugin
270
+ * @returns
271
+ */
272
+ declare const createBlobDatabasePlugin: <TContext = object>({
273
+ name,
274
+ getContext,
275
+ listObjects,
276
+ loadObject,
277
+ uploadObject,
278
+ deleteObject,
279
+ invalidatePaths,
280
+ hooks,
281
+ apiBasePath
282
+ }: {
283
+ name: string;
284
+ getContext: () => TContext;
285
+ listObjects: (context: TContext, prefix: string) => Promise<string[]>;
286
+ loadObject: <T>(context: TContext, key: string) => Promise<T | null>;
287
+ uploadObject: <T>(context: TContext, key: string, data: T) => Promise<void>;
288
+ deleteObject: (context: TContext, key: string) => Promise<void>;
289
+ invalidatePaths: (context: TContext, paths: string[]) => Promise<void>;
290
+ hooks?: DatabasePluginHooks;
291
+ apiBasePath: string;
292
+ }) => (options: BasePluginArgs) => DatabasePlugin;
293
+ //#endregion
217
294
  //#region src/createDatabasePlugin.d.ts
218
295
  interface BaseDatabaseUtils {
219
296
  cwd: string;
@@ -278,34 +355,8 @@ interface AbstractDatabasePlugin<TContext = object> {
278
355
  */
279
356
  declare function createDatabasePlugin<TContext = object>(name: string, abstractPlugin: AbstractDatabasePlugin<TContext>, hooks?: DatabasePluginHooks): (options: BasePluginArgs) => DatabasePlugin;
280
357
  //#endregion
281
- //#region src/banner.d.ts
282
- declare const link: (url: string) => string;
283
- declare const banner: (version?: string) => string;
284
- declare const printBanner: (version?: string) => void;
285
- //#endregion
286
- //#region src/transformTemplate.d.ts
287
- type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
288
- type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
289
- /**
290
- * Replaces placeholders in the format %%key%% in a template string with values from the values object.
291
- * Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
292
- *
293
- * @example
294
- * const str = "Hello %%name%%, you are %%age%% years old."
295
- * const result = transformTemplate(str, { name: "John", age: "20" })
296
- * // Result: "Hello John, you are 20 years old."
297
- */
298
- declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
299
- //#endregion
300
- //#region src/transformEnv.d.ts
301
- declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
302
- //#endregion
303
- //#region src/makeEnv.d.ts
304
- type EnvVarValue = string | {
305
- comment: string;
306
- value: string;
307
- };
308
- declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
358
+ //#region src/createStorageKeyBuilder.d.ts
359
+ declare const createStorageKeyBuilder: (basePath: string | undefined) => (...args: string[]) => string;
309
360
  //#endregion
310
361
  //#region src/createZip.d.ts
311
362
  declare const createZipTargetFiles: ({
@@ -328,100 +379,53 @@ declare const createZip: ({
328
379
  excludeExts?: string[];
329
380
  }) => Promise<string>;
330
381
  //#endregion
331
- //#region src/createBlobDatabasePlugin.d.ts
332
- /**
333
- *
334
- * @param name - The name of the database plugin
335
- * @param listObjects - Function to list objects in the storage
336
- * @param loadObject - Function to load an JSON object from the storage
337
- * @param uploadObject - Function to upload an JSON object to the storage
338
- * @param deleteObject - Function to delete an object from the storage
339
- * @param invalidatePaths - Function to invalidate paths in the CDN
340
- * @param hooks - Optional hooks for additional functionality - see createDatabasePlugin
341
- * @returns
342
- */
343
- declare const createBlobDatabasePlugin: <TContext = object>({
344
- name,
345
- getContext,
346
- listObjects,
347
- loadObject,
348
- uploadObject,
349
- deleteObject,
350
- invalidatePaths,
351
- hooks,
352
- apiBasePath
353
- }: {
354
- name: string;
355
- getContext: () => TContext;
356
- listObjects: (context: TContext, prefix: string) => Promise<string[]>;
357
- loadObject: <T>(context: TContext, key: string) => Promise<T | null>;
358
- uploadObject: <T>(context: TContext, key: string, data: T) => Promise<void>;
359
- deleteObject: (context: TContext, key: string) => Promise<void>;
360
- invalidatePaths: (context: TContext, paths: string[]) => Promise<void>;
361
- hooks?: DatabasePluginHooks;
362
- apiBasePath: string;
363
- }) => (options: BasePluginArgs) => DatabasePlugin;
382
+ //#region src/cwd.d.ts
383
+ declare const getCwd: () => string;
364
384
  //#endregion
365
- //#region src/ConfigBuilder.d.ts
366
- type BuildType = "bare" | "rock" | "expo";
367
- type ImportInfo = {
368
- pkg: string;
369
- named?: string[];
370
- defaultOrNamespace?: string;
371
- sideEffect?: boolean;
385
+ //#region src/generateMinBundleId.d.ts
386
+ declare const generateMinBundleId: () => string;
387
+ //#endregion
388
+ //#region src/loadConfig.d.ts
389
+ type HotUpdaterConfigOptions = {
390
+ platform: Platform;
391
+ channel: string;
392
+ } | null;
393
+ type ConfigResponse = RequiredDeep<ConfigInput>;
394
+ declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
395
+ declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
396
+ //#endregion
397
+ //#region src/log.d.ts
398
+ declare const log: {
399
+ normal: (message: string | number | null | undefined) => void;
400
+ success: (message: string | number | null | undefined) => void;
401
+ info: (message: string | number | null | undefined) => void;
402
+ error: (message: string | number | null | undefined) => void;
403
+ warn: (message: string | number | null | undefined) => void;
404
+ debug: (message: string | number | null | undefined) => void;
372
405
  };
373
- type ProviderConfig = {
374
- imports: ImportInfo[];
375
- configString: string;
406
+ //#endregion
407
+ //#region src/makeEnv.d.ts
408
+ type EnvVarValue = string | {
409
+ comment: string;
410
+ value: string;
376
411
  };
377
- interface IConfigBuilder {
378
- /** Sets the build type ('bare' or 'rock' or 'expo') and adds necessary build imports. */
379
- setBuildType(buildType: BuildType): this;
380
- /** Sets the storage configuration and adds its required imports. */
381
- setStorage(storageConfig: ProviderConfig): this;
382
- /** Sets the database configuration and adds its required imports. */
383
- setDatabase(databaseConfig: ProviderConfig): this;
384
- /** Sets the intermediate code block to be placed between imports and defineConfig. */
385
- setIntermediateCode(code: string): this;
386
- /** Assembles and returns the final configuration string. */
387
- getResult(): string;
388
- }
389
- declare class ConfigBuilder implements IConfigBuilder {
390
- private buildType;
391
- private storageInfo;
392
- private databaseInfo;
393
- private intermediateCode;
394
- private collectedImports;
395
- constructor();
396
- addImport(info: ImportInfo): this;
397
- private addImports;
398
- private generateImportStatements;
399
- private generateBuildConfigString;
400
- setBuildType(buildType: BuildType): this;
401
- setStorage(storageConfig: ProviderConfig): this;
402
- setDatabase(databaseConfig: ProviderConfig): this;
403
- setIntermediateCode(code: string): this;
404
- getResult(): string;
405
- }
412
+ declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
406
413
  //#endregion
407
- //#region src/calculatePagination.d.ts
408
- interface PaginationOptions {
409
- limit: number;
410
- offset: number;
411
- }
412
- interface PaginatedResult {
413
- data: Bundle[];
414
- pagination: PaginationInfo;
415
- }
414
+ //#region src/transformEnv.d.ts
415
+ declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
416
+ //#endregion
417
+ //#region src/transformTemplate.d.ts
418
+ type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
419
+ type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
416
420
  /**
417
- * Calculate pagination information based on total count, limit, and offset
421
+ * Replaces placeholders in the format %%key%% in a template string with values from the values object.
422
+ * Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
423
+ *
424
+ * @example
425
+ * const str = "Hello %%name%%, you are %%age%% years old."
426
+ * const result = transformTemplate(str, { name: "John", age: "20" })
427
+ * // Result: "Hello John, you are 20 years old."
418
428
  */
419
- declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
420
- //#endregion
421
- //#region src/generateMinBundleId.d.ts
422
- declare const generateMinBundleId: () => string;
423
- //#endregion
424
- //#region src/createStorageKeyBuilder.d.ts
425
- declare const createStorageKeyBuilder: (basePath: string | undefined) => (...args: string[]) => string;
429
+ declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
426
430
  //#endregion
427
431
  export { AbstractDatabasePlugin, BaseDatabaseUtils, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuildType, BuiltIns, type Bundle, ConfigBuilder, ConfigInput, ConfigResponse, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, HotUpdaterConfigOptions, IConfigBuilder, ImportInfo, NativeBuildArgs, PaginatedResult, PaginationInfo, PaginationOptions, type Platform, PlatformConfig, Primitive, ProviderConfig, RequiredDeep, StoragePlugin, StoragePluginHooks, banner, calculatePagination, copyDirToTmp, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createZip, createZipTargetFiles, generateMinBundleId, getCwd, link, loadConfig, loadConfigSync, log, makeEnv, printBanner, transformEnv, transformTemplate };