@hot-updater/plugin-core 0.12.7 → 0.13.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/banner.d.ts +3 -0
- package/dist/copyDirToTmp.d.ts +1 -1
- package/dist/createDatabasePlugin.d.ts +44 -0
- package/dist/createZip.d.ts +12 -0
- package/dist/index.cjs +84915 -61
- package/dist/index.cjs.LICENSE.txt +48 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +84452 -62
- package/dist/index.js.LICENSE.txt +48 -0
- package/dist/loadConfig.d.ts +9 -5
- package/dist/makeEnv.d.ts +6 -0
- package/dist/transformEnv.d.ts +1 -0
- package/dist/transformEnv.spec.d.ts +1 -0
- package/dist/transformTemplate.d.ts +15 -0
- package/dist/transformTsEnv.d.ts +1 -0
- package/dist/transformTsEnv.spec.d.ts +1 -0
- package/dist/{types.d.ts → types/index.d.ts} +21 -4
- package/dist/types/utils.d.ts +12 -0
- package/package.json +26 -6
- package/LICENSE +0 -21
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* buildToken
|
|
3
|
+
* Builds OAuth token prefix (helper function)
|
|
4
|
+
*
|
|
5
|
+
* @name buildToken
|
|
6
|
+
* @function
|
|
7
|
+
* @param {GitUrl} obj The parsed Git url object.
|
|
8
|
+
* @return {String} token prefix
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/*!
|
|
12
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
15
|
+
* Licensed under the MIT License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/*!
|
|
19
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
22
|
+
* Licensed under the MIT License.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/*!
|
|
26
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
27
|
+
*
|
|
28
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
29
|
+
* Released under the MIT License.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/*!
|
|
33
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
36
|
+
* Released under the MIT License.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/*!
|
|
40
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
41
|
+
*
|
|
42
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
43
|
+
* Released under the MIT License.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
47
|
+
|
|
48
|
+
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
package/dist/loadConfig.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { ConfigInput, Platform } from "./types/index.js";
|
|
2
|
+
import type { RequiredDeep } from "./types/utils.js";
|
|
3
|
+
export type HotUpdaterConfigOptions = {
|
|
4
|
+
platform: Platform;
|
|
5
|
+
channel: string;
|
|
6
|
+
} | null;
|
|
7
|
+
export type ConfigResponse = RequiredDeep<ConfigInput>;
|
|
8
|
+
export declare const loadConfig: (options: HotUpdaterConfigOptions) => Promise<ConfigResponse>;
|
|
9
|
+
export declare const loadConfigSync: (options: HotUpdaterConfigOptions) => ConfigResponse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const transformEnv: <T extends Record<string, string>>(code: string, env: T) => Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ExtractPlaceholders<T extends string> = T extends `${infer _Start}%%${infer Key}%%${infer Rest}` ? Key | ExtractPlaceholders<Rest> : never;
|
|
2
|
+
type TransformTemplateArgs<T extends string> = {
|
|
3
|
+
[Key in ExtractPlaceholders<T>]: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Replaces placeholders in the format %%key%% in a template string with values from the values object.
|
|
7
|
+
* Uses generic type T to automatically infer placeholder keys from the template string to ensure type safety.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const str = "Hello %%name%%, you are %%age%% years old."
|
|
11
|
+
* const result = transformTemplate(str, { name: "John", age: "20" })
|
|
12
|
+
* // Result: "Hello John, you are 20 years old."
|
|
13
|
+
*/
|
|
14
|
+
export declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const transformTsEnv: <T extends Record<string, string>>(code: string, env: T) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,8 +7,16 @@ export interface BuildPluginConfig {
|
|
|
7
7
|
outDir?: string;
|
|
8
8
|
}
|
|
9
9
|
export interface DatabasePlugin {
|
|
10
|
+
getChannels: () => Promise<string[]>;
|
|
10
11
|
getBundleById: (bundleId: string) => Promise<Bundle | null>;
|
|
11
|
-
getBundles: (
|
|
12
|
+
getBundles: (options?: {
|
|
13
|
+
where?: {
|
|
14
|
+
channel?: string;
|
|
15
|
+
platform?: Platform;
|
|
16
|
+
};
|
|
17
|
+
limit?: number;
|
|
18
|
+
offset?: number;
|
|
19
|
+
}) => Promise<Bundle[]>;
|
|
12
20
|
updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>) => Promise<void>;
|
|
13
21
|
appendBundle: (bundles: Bundle) => Promise<void>;
|
|
14
22
|
commitBundle: () => Promise<void>;
|
|
@@ -21,25 +29,34 @@ export interface DatabasePluginHooks {
|
|
|
21
29
|
export interface BuildPlugin {
|
|
22
30
|
build: (args: {
|
|
23
31
|
platform: Platform;
|
|
32
|
+
channel: string;
|
|
24
33
|
}) => Promise<{
|
|
25
34
|
buildPath: string;
|
|
26
35
|
bundleId: string;
|
|
36
|
+
channel: string;
|
|
27
37
|
stdout: string | null;
|
|
28
38
|
}>;
|
|
29
39
|
name: string;
|
|
30
40
|
}
|
|
31
41
|
export interface StoragePlugin {
|
|
32
42
|
uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
|
|
33
|
-
|
|
43
|
+
bucketName: string;
|
|
44
|
+
key: string;
|
|
34
45
|
}>;
|
|
35
46
|
deleteBundle: (bundleId: string) => Promise<string>;
|
|
36
47
|
name: string;
|
|
37
48
|
}
|
|
38
49
|
export interface StoragePluginHooks {
|
|
39
|
-
transformFileUrl?: (key: string) => string;
|
|
40
50
|
onStorageUploaded?: () => Promise<void>;
|
|
41
51
|
}
|
|
42
|
-
export type
|
|
52
|
+
export type ConfigInput = {
|
|
53
|
+
/**
|
|
54
|
+
* The channel used when building the native app.
|
|
55
|
+
* Used to replace HotUpdater.CHANNEL at build time.
|
|
56
|
+
*
|
|
57
|
+
* @default "production"
|
|
58
|
+
*/
|
|
59
|
+
releaseChannel?: string;
|
|
43
60
|
console?: {
|
|
44
61
|
/**
|
|
45
62
|
* Git repository URL
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
2
|
+
export type BuiltIns = Primitive | void | Date | RegExp;
|
|
3
|
+
type ExcludeUndefined<T> = Exclude<T, undefined>;
|
|
4
|
+
export type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
5
|
+
(...arguments_: infer A): unknown;
|
|
6
|
+
(...arguments_: infer B): unknown;
|
|
7
|
+
} ? B extends A ? A extends B ? false : true : true : false;
|
|
8
|
+
export 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;
|
|
9
|
+
type RequiredObjectDeep<ObjectType extends object> = {
|
|
10
|
+
[KeyType in keyof ObjectType]-?: RequiredDeep<ObjectType[KeyType]>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,14 +38,34 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@hot-updater/core": "0.
|
|
41
|
+
"@hot-updater/core": "0.13.1",
|
|
42
42
|
"cosmiconfig": "^9.0.0",
|
|
43
|
-
"cosmiconfig-typescript-loader": "^5.0.0"
|
|
44
|
-
"workspace-tools": "^0.36.4"
|
|
43
|
+
"cosmiconfig-typescript-loader": "^5.0.0"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
|
-
"
|
|
48
|
-
"@
|
|
46
|
+
"typescript": "5.8.2",
|
|
47
|
+
"@babel/parser": "7.26.9",
|
|
48
|
+
"@babel/generator": "7.26.9",
|
|
49
|
+
"@types/babel__generator": "7.6.8",
|
|
50
|
+
"@babel/core": "7.26.0",
|
|
51
|
+
"@babel/traverse": "7.25.9",
|
|
52
|
+
"@babel/types": "7.26.0",
|
|
53
|
+
"@types/babel__core": "7.20.5",
|
|
54
|
+
"@types/babel__traverse": "7.20.6",
|
|
55
|
+
"workspace-tools": "^0.36.4",
|
|
56
|
+
"@types/node": "^22.7.5",
|
|
57
|
+
"boxen": "^8.0.1",
|
|
58
|
+
"es-toolkit": "^1.32.0",
|
|
59
|
+
"jszip": "^3.10.1",
|
|
60
|
+
"picocolors": "^1.0.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"typescript": ">=4.5.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"typescript": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
49
69
|
},
|
|
50
70
|
"scripts": {
|
|
51
71
|
"build": "rslib build",
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Sungyu Kang
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|