@hot-updater/plugin-core 0.21.7 → 0.21.9
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/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/calculatePagination.cjs +27 -0
- package/dist/calculatePagination.d.cts +17 -0
- package/dist/calculatePagination.d.ts +17 -0
- package/dist/calculatePagination.js +26 -0
- package/dist/compressionFormat.cjs +59 -0
- package/dist/compressionFormat.d.cts +33 -0
- package/dist/compressionFormat.d.ts +33 -0
- package/dist/compressionFormat.js +54 -0
- package/dist/createBlobDatabasePlugin.cjs +312 -0
- package/dist/createBlobDatabasePlugin.d.cts +38 -0
- package/dist/createBlobDatabasePlugin.d.ts +38 -0
- package/dist/createBlobDatabasePlugin.js +309 -0
- package/dist/createDatabasePlugin.cjs +97 -0
- package/dist/createDatabasePlugin.d.cts +68 -0
- package/dist/createDatabasePlugin.d.ts +68 -0
- package/dist/createDatabasePlugin.js +95 -0
- package/dist/createStorageKeyBuilder.cjs +8 -0
- package/dist/createStorageKeyBuilder.d.cts +4 -0
- package/dist/createStorageKeyBuilder.d.ts +4 -0
- package/dist/createStorageKeyBuilder.js +7 -0
- package/dist/filterCompatibleAppVersions.cjs +17 -0
- package/dist/filterCompatibleAppVersions.d.cts +12 -0
- package/dist/filterCompatibleAppVersions.d.ts +12 -0
- package/dist/filterCompatibleAppVersions.js +17 -0
- package/dist/generateMinBundleId.cjs +11 -0
- package/dist/generateMinBundleId.d.cts +4 -0
- package/dist/generateMinBundleId.d.ts +4 -0
- package/dist/generateMinBundleId.js +10 -0
- package/dist/index.cjs +21 -27391
- package/dist/index.d.cts +12 -560
- package/dist/index.d.ts +12 -560
- package/dist/index.js +11 -27351
- package/dist/parseStorageUri.cjs +35 -0
- package/dist/parseStorageUri.d.cts +24 -0
- package/dist/parseStorageUri.d.ts +24 -0
- package/dist/parseStorageUri.js +34 -0
- package/dist/semverSatisfies.cjs +13 -0
- package/dist/semverSatisfies.d.cts +4 -0
- package/dist/semverSatisfies.d.ts +4 -0
- package/dist/semverSatisfies.js +11 -0
- package/dist/types/index.d.cts +201 -0
- package/dist/types/index.d.ts +201 -0
- package/dist/types/utils.d.cts +12 -0
- package/dist/types/utils.d.ts +12 -0
- package/package.json +4 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,560 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/types/utils.d.ts
|
|
51
|
-
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
52
|
-
type BuiltIns = Primitive | void | Date | RegExp;
|
|
53
|
-
type ExcludeUndefined<T> = Exclude<T, undefined>;
|
|
54
|
-
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
55
|
-
(...arguments_: infer A): unknown;
|
|
56
|
-
(...arguments_: infer B): unknown;
|
|
57
|
-
} ? B extends A ? A extends B ? false : true : true : false;
|
|
58
|
-
type RequiredDeep<T, E extends ExcludeUndefined<T> = ExcludeUndefined<T>> = E extends BuiltIns ? E : E extends Map<infer KeyType, infer ValueType> ? Map<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends Set<infer ItemType> ? Set<RequiredDeep<ItemType>> : E extends ReadonlyMap<infer KeyType, infer ValueType> ? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends ReadonlySet<infer ItemType> ? ReadonlySet<RequiredDeep<ItemType>> : E extends WeakMap<infer KeyType, infer ValueType> ? WeakMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>> : E extends WeakSet<infer ItemType> ? WeakSet<RequiredDeep<ItemType>> : E extends Promise<infer ValueType> ? Promise<RequiredDeep<ValueType>> : E extends ((...arguments_: any[]) => unknown) ? {} extends RequiredObjectDeep<E> ? E : HasMultipleCallSignatures<E> extends true ? E : ((...arguments_: Parameters<E>) => ReturnType<E>) & RequiredObjectDeep<E> : E extends object ? E extends Array<infer ItemType> ? ItemType[] extends E ? Array<RequiredDeep<ItemType>> : RequiredObjectDeep<E> : RequiredObjectDeep<E> : unknown;
|
|
59
|
-
type RequiredObjectDeep<ObjectType extends object> = { [KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]> };
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/types/index.d.ts
|
|
62
|
-
interface BasePluginArgs {
|
|
63
|
-
cwd: string;
|
|
64
|
-
}
|
|
65
|
-
interface PaginationInfo {
|
|
66
|
-
total: number;
|
|
67
|
-
hasNextPage: boolean;
|
|
68
|
-
hasPreviousPage: boolean;
|
|
69
|
-
currentPage: number;
|
|
70
|
-
totalPages: number;
|
|
71
|
-
}
|
|
72
|
-
interface BuildPluginConfig {
|
|
73
|
-
outDir?: string;
|
|
74
|
-
}
|
|
75
|
-
interface DatabasePlugin {
|
|
76
|
-
getChannels: () => Promise<string[]>;
|
|
77
|
-
getBundleById: (bundleId: string) => Promise<Bundle$1 | null>;
|
|
78
|
-
getBundles: (options: {
|
|
79
|
-
where?: {
|
|
80
|
-
channel?: string;
|
|
81
|
-
platform?: string;
|
|
82
|
-
};
|
|
83
|
-
limit: number;
|
|
84
|
-
offset: number;
|
|
85
|
-
}) => Promise<{
|
|
86
|
-
data: Bundle$1[];
|
|
87
|
-
pagination: PaginationInfo;
|
|
88
|
-
}>;
|
|
89
|
-
updateBundle: (targetBundleId: string, newBundle: Partial<Bundle$1>) => Promise<void>;
|
|
90
|
-
appendBundle: (insertBundle: Bundle$1) => Promise<void>;
|
|
91
|
-
commitBundle: () => Promise<void>;
|
|
92
|
-
onUnmount?: () => Promise<void>;
|
|
93
|
-
name: string;
|
|
94
|
-
deleteBundle: (deleteBundle: Bundle$1) => Promise<void>;
|
|
95
|
-
}
|
|
96
|
-
interface DatabasePluginHooks {
|
|
97
|
-
onDatabaseUpdated?: () => Promise<void>;
|
|
98
|
-
}
|
|
99
|
-
interface BuildPlugin {
|
|
100
|
-
nativeBuild?: {
|
|
101
|
-
prebuild?: (args: {
|
|
102
|
-
platform: Platform$1;
|
|
103
|
-
}) => Promise<void>;
|
|
104
|
-
postbuild?: (args: {
|
|
105
|
-
platform: Platform$1;
|
|
106
|
-
}) => Promise<void>;
|
|
107
|
-
};
|
|
108
|
-
build: (args: {
|
|
109
|
-
platform: Platform$1;
|
|
110
|
-
}) => Promise<{
|
|
111
|
-
buildPath: string;
|
|
112
|
-
bundleId: string;
|
|
113
|
-
stdout: string | null;
|
|
114
|
-
}>;
|
|
115
|
-
name: string;
|
|
116
|
-
}
|
|
117
|
-
interface PlatformConfig {
|
|
118
|
-
/**
|
|
119
|
-
* Android platform configuration.
|
|
120
|
-
*/
|
|
121
|
-
android?: {
|
|
122
|
-
/**
|
|
123
|
-
* Android string resource paths.
|
|
124
|
-
*
|
|
125
|
-
* @default all strings.xml files in the android directory
|
|
126
|
-
* @example ["android/app/src/main/res/values/strings.xml"]
|
|
127
|
-
*/
|
|
128
|
-
stringResourcePaths?: string[];
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* iOS platform configuration.
|
|
132
|
-
*/
|
|
133
|
-
ios?: {
|
|
134
|
-
/**
|
|
135
|
-
* iOS info.plist paths.
|
|
136
|
-
*
|
|
137
|
-
* @default all Info.plist files in the ios directory
|
|
138
|
-
* @example ["ios/HotUpdaterExample/Info.plist"]
|
|
139
|
-
*/
|
|
140
|
-
infoPlistPaths?: string[];
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
interface NativeBuildArgs {
|
|
144
|
-
/**
|
|
145
|
-
* Android specific configuration.
|
|
146
|
-
*/
|
|
147
|
-
android?: {
|
|
148
|
-
/**
|
|
149
|
-
* Android application module build variant.
|
|
150
|
-
*
|
|
151
|
-
* @example Debug, Release
|
|
152
|
-
* @default Release
|
|
153
|
-
*/
|
|
154
|
-
variant?: string;
|
|
155
|
-
/**
|
|
156
|
-
* Artifact type.
|
|
157
|
-
*
|
|
158
|
-
* If `true`, the generated artifact type is `.aab`.
|
|
159
|
-
* If `flase`, the generated artifact type is `apk`.
|
|
160
|
-
*
|
|
161
|
-
* @default true
|
|
162
|
-
*/
|
|
163
|
-
aab?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Android application module name.
|
|
166
|
-
*
|
|
167
|
-
* @default app
|
|
168
|
-
*/
|
|
169
|
-
appModuleName?: string;
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
interface StoragePlugin {
|
|
173
|
-
/**
|
|
174
|
-
* Protocol this storage plugin can resolve.
|
|
175
|
-
* @example "s3", "r2", "supabase-storage".
|
|
176
|
-
*/
|
|
177
|
-
supportedProtocol: string;
|
|
178
|
-
upload: (key: string, filePath: string) => Promise<{
|
|
179
|
-
storageUri: string;
|
|
180
|
-
}>;
|
|
181
|
-
delete: (storageUri: string) => Promise<void>;
|
|
182
|
-
getDownloadUrl: (storageUri: string) => Promise<{
|
|
183
|
-
fileUrl: string;
|
|
184
|
-
}>;
|
|
185
|
-
name: string;
|
|
186
|
-
}
|
|
187
|
-
interface StoragePluginHooks {
|
|
188
|
-
onStorageUploaded?: () => Promise<void>;
|
|
189
|
-
}
|
|
190
|
-
type ConfigInput = {
|
|
191
|
-
/**
|
|
192
|
-
* The channel used when building the native app.
|
|
193
|
-
* Used to replace __HOT_UPDATER_CHANNEL at build time.
|
|
194
|
-
*
|
|
195
|
-
* @deprecated Use the `hot-updater channel create` command to create a channel.
|
|
196
|
-
*/
|
|
197
|
-
releaseChannel?: string;
|
|
198
|
-
/**
|
|
199
|
-
* The strategy used to update the app.
|
|
200
|
-
*
|
|
201
|
-
* If `fingerprint`, the bundle will be updated if the fingerprint of the app is changed.
|
|
202
|
-
* @docs https://hot-updater.dev/docs/guides/update-strategies/fingerprint
|
|
203
|
-
* If `appVersion`, the bundle will be updated if the target app version is valid.
|
|
204
|
-
* @docs https://hot-updater.dev/docs/guides/update-strategies/app-version
|
|
205
|
-
*
|
|
206
|
-
* @default "appVersion"
|
|
207
|
-
*/
|
|
208
|
-
updateStrategy: "fingerprint" | "appVersion";
|
|
209
|
-
/**
|
|
210
|
-
* The compression strategy used for bundle deployment.
|
|
211
|
-
*
|
|
212
|
-
* - `zip`: Standard ZIP compression (default). Fast and widely supported.
|
|
213
|
-
* - `tar.br`: TAR archive with Brotli compression. Highest compression ratio, smaller bundle size.
|
|
214
|
-
* - `tar.gz`: TAR archive with Gzip compression. Balanced speed and compression ratio.
|
|
215
|
-
*
|
|
216
|
-
* The compression format is determined by the storage plugin used for bundle upload.
|
|
217
|
-
*
|
|
218
|
-
* @default "zip"
|
|
219
|
-
*/
|
|
220
|
-
compressStrategy?: "zip" | "tar.br" | "tar.gz";
|
|
221
|
-
/**
|
|
222
|
-
* The fingerprint configuration.
|
|
223
|
-
*/
|
|
224
|
-
fingerprint?: {
|
|
225
|
-
/**
|
|
226
|
-
* The extra sources to be included in the fingerprint.
|
|
227
|
-
* @example ["resources/**", ".gitignore"]
|
|
228
|
-
*/
|
|
229
|
-
extraSources?: string[];
|
|
230
|
-
/**
|
|
231
|
-
* The paths to be ignored in the fingerprint.
|
|
232
|
-
*/
|
|
233
|
-
ignorePaths?: string[];
|
|
234
|
-
/**
|
|
235
|
-
* When debug mode is enabled, more detailed information will be exposed in fingerprint.json.
|
|
236
|
-
*/
|
|
237
|
-
debug?: boolean;
|
|
238
|
-
};
|
|
239
|
-
console?: {
|
|
240
|
-
/**
|
|
241
|
-
* Git repository URL
|
|
242
|
-
* If git commit hash exists in console, it allows viewing commit history from the git repository
|
|
243
|
-
*/
|
|
244
|
-
gitUrl?: string;
|
|
245
|
-
/**
|
|
246
|
-
* Console port
|
|
247
|
-
* @default 1422
|
|
248
|
-
*/
|
|
249
|
-
port?: number;
|
|
250
|
-
};
|
|
251
|
-
platform?: PlatformConfig;
|
|
252
|
-
nativeBuild?: NativeBuildArgs;
|
|
253
|
-
build: (args: BasePluginArgs) => Promise<BuildPlugin> | BuildPlugin;
|
|
254
|
-
storage: (args: BasePluginArgs) => Promise<StoragePlugin> | StoragePlugin;
|
|
255
|
-
database: (args: BasePluginArgs) => Promise<DatabasePlugin> | DatabasePlugin;
|
|
256
|
-
};
|
|
257
|
-
//#endregion
|
|
258
|
-
//#region src/calculatePagination.d.ts
|
|
259
|
-
interface PaginationOptions {
|
|
260
|
-
limit: number;
|
|
261
|
-
offset: number;
|
|
262
|
-
}
|
|
263
|
-
interface PaginatedResult {
|
|
264
|
-
data: Bundle[];
|
|
265
|
-
pagination: PaginationInfo;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Calculate pagination information based on total count, limit, and offset
|
|
269
|
-
*/
|
|
270
|
-
declare function calculatePagination(total: number, options: PaginationOptions): PaginationInfo;
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region src/compressionFormat.d.ts
|
|
273
|
-
/**
|
|
274
|
-
* Compression format type definition
|
|
275
|
-
*/
|
|
276
|
-
type CompressionFormat = "zip" | "tar.br" | "tar.gz";
|
|
277
|
-
/**
|
|
278
|
-
* Compression format metadata
|
|
279
|
-
*/
|
|
280
|
-
interface CompressionFormatInfo {
|
|
281
|
-
format: CompressionFormat;
|
|
282
|
-
fileExtension: string;
|
|
283
|
-
mimeType?: string;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Detects compression format from filename
|
|
287
|
-
* @param filename The filename to detect format from
|
|
288
|
-
* @returns Compression format information
|
|
289
|
-
*/
|
|
290
|
-
declare function detectCompressionFormat(filename: string): CompressionFormatInfo;
|
|
291
|
-
/**
|
|
292
|
-
* Gets MIME type for a filename
|
|
293
|
-
* @param filename The filename to get MIME type for
|
|
294
|
-
* @returns MIME type string
|
|
295
|
-
*/
|
|
296
|
-
declare function getCompressionMimeType(filename: string): string | undefined;
|
|
297
|
-
/**
|
|
298
|
-
* Gets Content-Type for a bundle file with 3-tier fallback
|
|
299
|
-
* @param bundlePath The bundle file path
|
|
300
|
-
* @returns Content-Type string (never undefined, falls back to application/octet-stream)
|
|
301
|
-
*/
|
|
302
|
-
declare function getContentType(bundlePath: string): string;
|
|
303
|
-
//#endregion
|
|
304
|
-
//#region src/copyDirToTmp.d.ts
|
|
305
|
-
declare const copyDirToTmp: (dir: string, childDirname?: string) => Promise<{
|
|
306
|
-
tmpDir: string;
|
|
307
|
-
removeTmpDir: () => Promise<void>;
|
|
308
|
-
}>;
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/createBlobDatabasePlugin.d.ts
|
|
311
|
-
/**
|
|
312
|
-
*
|
|
313
|
-
* @param name - The name of the database plugin
|
|
314
|
-
* @param listObjects - Function to list objects in the storage
|
|
315
|
-
* @param loadObject - Function to load an JSON object from the storage
|
|
316
|
-
* @param uploadObject - Function to upload an JSON object to the storage
|
|
317
|
-
* @param deleteObject - Function to delete an object from the storage
|
|
318
|
-
* @param invalidatePaths - Function to invalidate paths in the CDN
|
|
319
|
-
* @param hooks - Optional hooks for additional functionality - see createDatabasePlugin
|
|
320
|
-
* @returns
|
|
321
|
-
*/
|
|
322
|
-
declare const createBlobDatabasePlugin: <TContext = object>({
|
|
323
|
-
name,
|
|
324
|
-
getContext,
|
|
325
|
-
listObjects,
|
|
326
|
-
loadObject,
|
|
327
|
-
uploadObject,
|
|
328
|
-
deleteObject,
|
|
329
|
-
invalidatePaths,
|
|
330
|
-
hooks,
|
|
331
|
-
apiBasePath
|
|
332
|
-
}: {
|
|
333
|
-
name: string;
|
|
334
|
-
getContext: () => TContext;
|
|
335
|
-
listObjects: (context: TContext, prefix: string) => Promise<string[]>;
|
|
336
|
-
loadObject: <T>(context: TContext, key: string) => Promise<T | null>;
|
|
337
|
-
uploadObject: <T>(context: TContext, key: string, data: T) => Promise<void>;
|
|
338
|
-
deleteObject: (context: TContext, key: string) => Promise<void>;
|
|
339
|
-
invalidatePaths: (context: TContext, paths: string[]) => Promise<void>;
|
|
340
|
-
hooks?: DatabasePluginHooks;
|
|
341
|
-
apiBasePath: string;
|
|
342
|
-
}) => (options: BasePluginArgs) => DatabasePlugin;
|
|
343
|
-
//#endregion
|
|
344
|
-
//#region src/createDatabasePlugin.d.ts
|
|
345
|
-
interface BaseDatabaseUtils {
|
|
346
|
-
cwd: string;
|
|
347
|
-
}
|
|
348
|
-
interface AbstractDatabasePlugin<TContext = object> {
|
|
349
|
-
getContext?: () => TContext;
|
|
350
|
-
getBundleById: (context: TContext, bundleId: string) => Promise<Bundle$1 | null>;
|
|
351
|
-
getBundles: (context: TContext, options: {
|
|
352
|
-
where?: {
|
|
353
|
-
channel?: string;
|
|
354
|
-
platform?: string;
|
|
355
|
-
};
|
|
356
|
-
limit: number;
|
|
357
|
-
offset: number;
|
|
358
|
-
}) => Promise<{
|
|
359
|
-
data: Bundle$1[];
|
|
360
|
-
pagination: PaginationInfo;
|
|
361
|
-
}>;
|
|
362
|
-
getChannels: (context: TContext) => Promise<string[]>;
|
|
363
|
-
onUnmount?: (context: TContext) => void;
|
|
364
|
-
commitBundle: (context: TContext, {
|
|
365
|
-
changedSets
|
|
366
|
-
}: {
|
|
367
|
-
changedSets: {
|
|
368
|
-
operation: "insert" | "update" | "delete";
|
|
369
|
-
data: Bundle$1;
|
|
370
|
-
}[];
|
|
371
|
-
}) => Promise<void>;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Creates a database plugin with the given implementation.
|
|
375
|
-
*
|
|
376
|
-
* @example
|
|
377
|
-
* ```ts
|
|
378
|
-
* const myDatabasePlugin = createDatabasePlugin("myDatabase", {
|
|
379
|
-
* getContext: () => ({
|
|
380
|
-
* // Your database client or connection
|
|
381
|
-
* dbClient: createDbClient()
|
|
382
|
-
* }),
|
|
383
|
-
* async getBundleById(context, bundleId) {
|
|
384
|
-
* // Implementation to get a bundle by ID using context.dbClient
|
|
385
|
-
* return bundle;
|
|
386
|
-
* },
|
|
387
|
-
* async getBundles(context, options) {
|
|
388
|
-
* // Implementation to get bundles with options using context.dbClient
|
|
389
|
-
* return bundles;
|
|
390
|
-
* },
|
|
391
|
-
* async getChannels(context) {
|
|
392
|
-
* // Implementation to get available channels using context.dbClient
|
|
393
|
-
* return channels;
|
|
394
|
-
* },
|
|
395
|
-
* async commitBundle(context, { changedSets }) {
|
|
396
|
-
* // Implementation to commit changed bundles using context.dbClient
|
|
397
|
-
* }
|
|
398
|
-
* });
|
|
399
|
-
* ```
|
|
400
|
-
*
|
|
401
|
-
* @param name - The name of the database plugin
|
|
402
|
-
* @param abstractPlugin - A plugin implementation with context support
|
|
403
|
-
* @param hooks - Optional hooks for plugin lifecycle events
|
|
404
|
-
* @returns A function that creates a database plugin instance
|
|
405
|
-
*/
|
|
406
|
-
declare function createDatabasePlugin<TContext = object>(name: string, abstractPlugin: AbstractDatabasePlugin<TContext>, hooks?: DatabasePluginHooks): (options: BasePluginArgs) => DatabasePlugin;
|
|
407
|
-
//#endregion
|
|
408
|
-
//#region src/createStorageKeyBuilder.d.ts
|
|
409
|
-
declare const createStorageKeyBuilder: (basePath: string | undefined) => (...args: string[]) => string;
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region src/createTarBr.d.ts
|
|
412
|
-
declare const createTarBrTargetFiles: ({
|
|
413
|
-
outfile,
|
|
414
|
-
targetFiles
|
|
415
|
-
}: {
|
|
416
|
-
targetFiles: {
|
|
417
|
-
path: string;
|
|
418
|
-
name: string;
|
|
419
|
-
}[];
|
|
420
|
-
outfile: string;
|
|
421
|
-
}) => Promise<string>;
|
|
422
|
-
declare const createTarBr: ({
|
|
423
|
-
outfile,
|
|
424
|
-
targetDir,
|
|
425
|
-
excludeExts
|
|
426
|
-
}: {
|
|
427
|
-
targetDir: string;
|
|
428
|
-
outfile: string;
|
|
429
|
-
excludeExts?: string[];
|
|
430
|
-
}) => Promise<string>;
|
|
431
|
-
//#endregion
|
|
432
|
-
//#region src/createTarGz.d.ts
|
|
433
|
-
declare const createTarGzTargetFiles: ({
|
|
434
|
-
outfile,
|
|
435
|
-
targetFiles
|
|
436
|
-
}: {
|
|
437
|
-
targetFiles: {
|
|
438
|
-
path: string;
|
|
439
|
-
name: string;
|
|
440
|
-
}[];
|
|
441
|
-
outfile: string;
|
|
442
|
-
}) => Promise<string>;
|
|
443
|
-
declare const createTarGz: ({
|
|
444
|
-
outfile,
|
|
445
|
-
targetDir,
|
|
446
|
-
excludeExts
|
|
447
|
-
}: {
|
|
448
|
-
targetDir: string;
|
|
449
|
-
outfile: string;
|
|
450
|
-
excludeExts?: string[];
|
|
451
|
-
}) => Promise<string>;
|
|
452
|
-
//#endregion
|
|
453
|
-
//#region src/createZip.d.ts
|
|
454
|
-
declare const createZipTargetFiles: ({
|
|
455
|
-
outfile,
|
|
456
|
-
targetFiles
|
|
457
|
-
}: {
|
|
458
|
-
targetFiles: {
|
|
459
|
-
path: string;
|
|
460
|
-
name: string;
|
|
461
|
-
}[];
|
|
462
|
-
outfile: string;
|
|
463
|
-
}) => Promise<string>;
|
|
464
|
-
declare const createZip: ({
|
|
465
|
-
outfile,
|
|
466
|
-
targetDir,
|
|
467
|
-
excludeExts
|
|
468
|
-
}: {
|
|
469
|
-
targetDir: string;
|
|
470
|
-
outfile: string;
|
|
471
|
-
excludeExts?: string[];
|
|
472
|
-
}) => Promise<string>;
|
|
473
|
-
//#endregion
|
|
474
|
-
//#region src/cwd.d.ts
|
|
475
|
-
declare const getCwd: () => string;
|
|
476
|
-
//#endregion
|
|
477
|
-
//#region src/filterCompatibleAppVersions.d.ts
|
|
478
|
-
/**
|
|
479
|
-
* Filters target app versions that are compatible with the current app version.
|
|
480
|
-
* Returns only versions that are compatible with the current version according to semver rules.
|
|
481
|
-
*
|
|
482
|
-
* @param targetAppVersionList - List of target app versions to filter
|
|
483
|
-
* @param currentVersion - Current app version
|
|
484
|
-
* @returns Array of target app versions compatible with the current version
|
|
485
|
-
*/
|
|
486
|
-
declare const filterCompatibleAppVersions: (targetAppVersionList: string[], currentVersion: string) => string[];
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region src/generateMinBundleId.d.ts
|
|
489
|
-
declare const generateMinBundleId: () => string;
|
|
490
|
-
//#endregion
|
|
491
|
-
//#region src/loadConfig.d.ts
|
|
492
|
-
type HotUpdaterConfigOptions = {
|
|
493
|
-
platform: Platform;
|
|
494
|
-
channel: string;
|
|
495
|
-
} | null;
|
|
496
|
-
type ConfigResponse = RequiredDeep<ConfigInput>;
|
|
497
|
-
declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
|
|
498
|
-
declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
|
|
499
|
-
//#endregion
|
|
500
|
-
//#region src/log.d.ts
|
|
501
|
-
declare const log: {
|
|
502
|
-
normal: (message: string | number | null | undefined) => void;
|
|
503
|
-
success: (message: string | number | null | undefined) => void;
|
|
504
|
-
info: (message: string | number | null | undefined) => void;
|
|
505
|
-
error: (message: string | number | null | undefined) => void;
|
|
506
|
-
warn: (message: string | number | null | undefined) => void;
|
|
507
|
-
debug: (message: string | number | null | undefined) => void;
|
|
508
|
-
};
|
|
509
|
-
//#endregion
|
|
510
|
-
//#region src/makeEnv.d.ts
|
|
511
|
-
type EnvVarValue = string | {
|
|
512
|
-
comment: string;
|
|
513
|
-
value: string;
|
|
514
|
-
};
|
|
515
|
-
declare const makeEnv: (newEnvVars: Record<string, EnvVarValue>, filePath?: string) => Promise<string>;
|
|
516
|
-
//#endregion
|
|
517
|
-
//#region src/parseStorageUri.d.ts
|
|
518
|
-
interface ParsedStorageUri {
|
|
519
|
-
protocol: string;
|
|
520
|
-
bucket: string;
|
|
521
|
-
key: string;
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Parses a storage URI and validates the protocol.
|
|
525
|
-
*
|
|
526
|
-
* @param storageUri - The storage URI to parse (e.g., "s3://bucket/path/to/file")
|
|
527
|
-
* @param expectedProtocol - The expected protocol without colon (e.g., "s3", "r2", "gs")
|
|
528
|
-
* @returns Parsed storage URI components
|
|
529
|
-
* @throws Error if the URI is invalid or protocol doesn't match
|
|
530
|
-
*
|
|
531
|
-
* @example
|
|
532
|
-
* ```typescript
|
|
533
|
-
* const { bucket, key } = parseStorageUri("s3://my-bucket/path/to/file.zip", "s3");
|
|
534
|
-
* // bucket: "my-bucket"
|
|
535
|
-
* // key: "path/to/file.zip"
|
|
536
|
-
* ```
|
|
537
|
-
*/
|
|
538
|
-
declare function parseStorageUri(storageUri: string, expectedProtocol: string): ParsedStorageUri;
|
|
539
|
-
//#endregion
|
|
540
|
-
//#region src/semverSatisfies.d.ts
|
|
541
|
-
declare const semverSatisfies: (targetAppVersion: string, currentVersion: string) => boolean;
|
|
542
|
-
//#endregion
|
|
543
|
-
//#region src/transformEnv.d.ts
|
|
544
|
-
declare const transformEnv: <T extends Record<string, string>>(filename: string, env: T) => string;
|
|
545
|
-
//#endregion
|
|
546
|
-
//#region src/transformTemplate.d.ts
|
|
547
|
-
type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
|
|
548
|
-
type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]: string };
|
|
549
|
-
/**
|
|
550
|
-
* Replaces placeholders in the format %%key%% in a template string with values from the values object.
|
|
551
|
-
* Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
|
|
552
|
-
*
|
|
553
|
-
* @example
|
|
554
|
-
* const str = "Hello %%name%%, you are %%age%% years old."
|
|
555
|
-
* const result = transformTemplate(str, { name: "John", age: "20" })
|
|
556
|
-
* // Result: "Hello John, you are 20 years old."
|
|
557
|
-
*/
|
|
558
|
-
declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
|
|
559
|
-
//#endregion
|
|
560
|
-
export { AbstractDatabasePlugin, BaseDatabaseUtils, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuildType, BuiltIns, type Bundle, CompressionFormat, CompressionFormatInfo, ConfigBuilder, ConfigInput, ConfigResponse, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, HotUpdaterConfigOptions, IConfigBuilder, ImportInfo, NativeBuildArgs, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, type Platform, PlatformConfig, Primitive, ProviderConfig, RequiredDeep, StoragePlugin, StoragePluginHooks, banner, calculatePagination, copyDirToTmp, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, getCwd, link, loadConfig, loadConfigSync, log, makeEnv, parseStorageUri, printBanner, semverSatisfies, transformEnv, transformTemplate };
|
|
1
|
+
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.js";
|
|
2
|
+
import { BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabasePlugin, DatabasePluginHooks, NativeBuildArgs, PaginationInfo, Platform, PlatformConfig, StoragePlugin, StoragePluginHooks } from "./types/index.js";
|
|
3
|
+
import { PaginatedResult, PaginationOptions, calculatePagination } from "./calculatePagination.js";
|
|
4
|
+
import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.js";
|
|
5
|
+
import { createBlobDatabasePlugin } from "./createBlobDatabasePlugin.js";
|
|
6
|
+
import { AbstractDatabasePlugin, BaseDatabaseUtils, createDatabasePlugin } from "./createDatabasePlugin.js";
|
|
7
|
+
import { createStorageKeyBuilder } from "./createStorageKeyBuilder.js";
|
|
8
|
+
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.js";
|
|
9
|
+
import { generateMinBundleId } from "./generateMinBundleId.js";
|
|
10
|
+
import { ParsedStorageUri, parseStorageUri } from "./parseStorageUri.js";
|
|
11
|
+
import { semverSatisfies } from "./semverSatisfies.js";
|
|
12
|
+
export { AbstractDatabasePlugin, BaseDatabaseUtils, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, DatabasePlugin, DatabasePluginHooks, HasMultipleCallSignatures, NativeBuildArgs, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequiredDeep, StoragePlugin, StoragePluginHooks, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createStorageKeyBuilder, detectCompressionFormat, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, parseStorageUri, semverSatisfies };
|