@hot-updater/plugin-core 0.1.6-0 → 0.2.0
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/crypto.d.ts +2 -0
- package/dist/cwd.d.ts +1 -0
- package/dist/index.cjs +144 -82
- package/dist/index.d.ts +4 -53
- package/dist/index.js +120 -43
- package/dist/isObject.d.ts +1 -0
- package/dist/loadConfig.d.ts +2 -0
- package/dist/log.d.ts +8 -0
- package/dist/types.d.ts +58 -0
- package/package.json +4 -4
- package/dist/index.d.cts +0 -53
package/dist/crypto.d.ts
ADDED
package/dist/cwd.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCwd: () => string;
|
package/dist/index.cjs
CHANGED
|
@@ -1,85 +1,147 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// src/cwd.ts
|
|
51
|
-
var import_workspace_tools = require("workspace-tools");
|
|
52
|
-
var getCwd = () => (0, import_workspace_tools.findPackageRoot)(process.cwd());
|
|
53
|
-
|
|
54
|
-
// src/loadConfig.ts
|
|
55
|
-
var import_cosmiconfig = require("cosmiconfig");
|
|
56
|
-
var import_cosmiconfig_typescript_loader = require("cosmiconfig-typescript-loader");
|
|
57
|
-
var loadConfig = async () => {
|
|
58
|
-
const result = await (0, import_cosmiconfig.cosmiconfig)("hot-updater", {
|
|
59
|
-
stopDir: getCwd(),
|
|
60
|
-
searchPlaces: [
|
|
61
|
-
"hot-updater.config.js",
|
|
62
|
-
"hot-updater.config.cjs",
|
|
63
|
-
"hot-updater.config.ts",
|
|
64
|
-
"hot-updater.config.cts",
|
|
65
|
-
"hot-updater.config.mjs",
|
|
66
|
-
"hot-updater.config.cjs"
|
|
67
|
-
],
|
|
68
|
-
ignoreEmptySearchPlaces: false,
|
|
69
|
-
loaders: {
|
|
70
|
-
".ts": (0, import_cosmiconfig_typescript_loader.TypeScriptLoader)(),
|
|
71
|
-
".mts": (0, import_cosmiconfig_typescript_loader.TypeScriptLoader)(),
|
|
72
|
-
".cts": (0, import_cosmiconfig_typescript_loader.TypeScriptLoader)()
|
|
1
|
+
var __webpack_modules__ = {
|
|
2
|
+
"../../node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
3
|
+
let tty = __webpack_require__("tty");
|
|
4
|
+
let isColorSupported = !("NO_COLOR" in process.env || process.argv.includes("--no-color")) && ("FORCE_COLOR" in process.env || process.argv.includes("--color") || "win32" === process.platform || tty.isatty(1) && "dumb" !== process.env.TERM || "CI" in process.env);
|
|
5
|
+
let formatter = (open, close, replace = open)=>(input)=>{
|
|
6
|
+
let string = "" + input;
|
|
7
|
+
let index = string.indexOf(close, open.length);
|
|
8
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
9
|
+
};
|
|
10
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
11
|
+
let start = string.substring(0, index) + replace;
|
|
12
|
+
let end = string.substring(index + close.length);
|
|
13
|
+
let nextIndex = end.indexOf(close);
|
|
14
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
15
|
+
};
|
|
16
|
+
let createColors = (enabled = isColorSupported)=>({
|
|
17
|
+
isColorSupported: enabled,
|
|
18
|
+
reset: enabled ? (s)=>`\x1b[0m${s}\x1b[0m` : String,
|
|
19
|
+
bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
|
|
20
|
+
dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
|
|
21
|
+
italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
|
|
22
|
+
underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
|
|
23
|
+
inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
|
|
24
|
+
hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
|
|
25
|
+
strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
|
|
26
|
+
black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
|
|
27
|
+
red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
|
|
28
|
+
green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
|
|
29
|
+
yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
|
|
30
|
+
blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
|
|
31
|
+
magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
|
|
32
|
+
cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
|
|
33
|
+
white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
|
|
34
|
+
gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
|
|
35
|
+
bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
|
|
36
|
+
bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
|
|
37
|
+
bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
|
|
38
|
+
bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
|
|
39
|
+
bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
|
|
40
|
+
bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
|
|
41
|
+
bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
|
|
42
|
+
bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String
|
|
43
|
+
});
|
|
44
|
+
module.exports = createColors();
|
|
45
|
+
module.exports.createColors = createColors;
|
|
46
|
+
},
|
|
47
|
+
tty: function(module) {
|
|
48
|
+
"use strict";
|
|
49
|
+
module.exports = require("tty");
|
|
73
50
|
}
|
|
74
|
-
}).search();
|
|
75
|
-
if (!result?.config) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
return result.config;
|
|
79
51
|
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
52
|
+
var __webpack_module_cache__ = {};
|
|
53
|
+
function __webpack_require__(moduleId) {
|
|
54
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
55
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
56
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
57
|
+
exports: {}
|
|
58
|
+
};
|
|
59
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
60
|
+
return module.exports;
|
|
61
|
+
}
|
|
62
|
+
(()=>{
|
|
63
|
+
__webpack_require__.n = function(module) {
|
|
64
|
+
var getter = module && module.__esModule ? function() {
|
|
65
|
+
return module['default'];
|
|
66
|
+
} : function() {
|
|
67
|
+
return module;
|
|
68
|
+
};
|
|
69
|
+
__webpack_require__.d(getter, {
|
|
70
|
+
a: getter
|
|
71
|
+
});
|
|
72
|
+
return getter;
|
|
73
|
+
};
|
|
74
|
+
})();
|
|
75
|
+
(()=>{
|
|
76
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
77
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: definition[key]
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
})();
|
|
83
|
+
(()=>{
|
|
84
|
+
__webpack_require__.o = function(obj, prop) {
|
|
85
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
86
|
+
};
|
|
87
|
+
})();
|
|
88
|
+
(()=>{
|
|
89
|
+
__webpack_require__.r = function(exports1) {
|
|
90
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
91
|
+
value: 'Module'
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
94
|
+
value: true
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
})();
|
|
98
|
+
var __webpack_exports__ = {};
|
|
99
|
+
(()=>{
|
|
100
|
+
"use strict";
|
|
101
|
+
__webpack_require__.r(__webpack_exports__);
|
|
102
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
103
|
+
getCwd: ()=>getCwd,
|
|
104
|
+
loadConfig: ()=>loadConfig,
|
|
105
|
+
log: ()=>log
|
|
106
|
+
});
|
|
107
|
+
var picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js");
|
|
108
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
109
|
+
const log = {
|
|
110
|
+
normal: (message)=>console.log(message),
|
|
111
|
+
success: (message)=>console.log(picocolors_default().green(message)),
|
|
112
|
+
info: (message)=>console.log(picocolors_default().blue(message)),
|
|
113
|
+
error: (message)=>console.log(picocolors_default().red(message)),
|
|
114
|
+
warn: (message)=>console.log(picocolors_default().yellow(message)),
|
|
115
|
+
debug: (message)=>console.log(picocolors_default().gray(message))
|
|
116
|
+
};
|
|
117
|
+
const external_workspace_tools_namespaceObject = require("workspace-tools");
|
|
118
|
+
const getCwd = ()=>(0, external_workspace_tools_namespaceObject.findPackageRoot)(process.cwd());
|
|
119
|
+
const external_cosmiconfig_namespaceObject = require("cosmiconfig");
|
|
120
|
+
const external_cosmiconfig_typescript_loader_namespaceObject = require("cosmiconfig-typescript-loader");
|
|
121
|
+
const loadConfig = async ()=>{
|
|
122
|
+
const result = await (0, external_cosmiconfig_namespaceObject.cosmiconfig)("hot-updater", {
|
|
123
|
+
stopDir: getCwd(),
|
|
124
|
+
searchPlaces: [
|
|
125
|
+
"hot-updater.config.js",
|
|
126
|
+
"hot-updater.config.cjs",
|
|
127
|
+
"hot-updater.config.ts",
|
|
128
|
+
"hot-updater.config.cts",
|
|
129
|
+
"hot-updater.config.mjs",
|
|
130
|
+
"hot-updater.config.cjs"
|
|
131
|
+
],
|
|
132
|
+
ignoreEmptySearchPlaces: false,
|
|
133
|
+
loaders: {
|
|
134
|
+
".ts": (0, external_cosmiconfig_typescript_loader_namespaceObject.TypeScriptLoader)(),
|
|
135
|
+
".mts": (0, external_cosmiconfig_typescript_loader_namespaceObject.TypeScriptLoader)(),
|
|
136
|
+
".cts": (0, external_cosmiconfig_typescript_loader_namespaceObject.TypeScriptLoader)()
|
|
137
|
+
}
|
|
138
|
+
}).search();
|
|
139
|
+
if (!result?.config) return null;
|
|
140
|
+
return result.config;
|
|
141
|
+
};
|
|
142
|
+
})();
|
|
143
|
+
var __webpack_export_target__ = exports;
|
|
144
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
145
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
146
|
+
value: true
|
|
85
147
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,53 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
};
|
|
12
|
-
|
|
13
|
-
declare const getCwd: () => string;
|
|
14
|
-
|
|
15
|
-
interface BasePluginArgs {
|
|
16
|
-
cwd: string;
|
|
17
|
-
}
|
|
18
|
-
interface BuildPluginArgs extends BasePluginArgs {
|
|
19
|
-
platform: Platform;
|
|
20
|
-
}
|
|
21
|
-
interface DatabasePlugin {
|
|
22
|
-
getBundleById: (bundleId: string) => Promise<Bundle | null>;
|
|
23
|
-
getBundles: (refresh?: boolean) => Promise<Bundle[]>;
|
|
24
|
-
updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>) => Promise<void>;
|
|
25
|
-
setBundles: (bundles: Bundle[]) => Promise<void>;
|
|
26
|
-
appendBundle: (bundles: Bundle) => Promise<void>;
|
|
27
|
-
commitBundle: () => Promise<void>;
|
|
28
|
-
onUnmount?: () => Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
interface DatabasePluginHooks {
|
|
31
|
-
onDatabaseUpdated?: () => Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
interface StoragePlugin {
|
|
34
|
-
uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
|
|
35
|
-
fileUrl: string;
|
|
36
|
-
}>;
|
|
37
|
-
deleteBundle: (bundleId: string) => Promise<string>;
|
|
38
|
-
}
|
|
39
|
-
interface StoragePluginHooks {
|
|
40
|
-
onStorageUploaded?: () => Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
type Config = {
|
|
43
|
-
build: (args: BuildPluginArgs) => Promise<{
|
|
44
|
-
buildPath: string;
|
|
45
|
-
bundleId: string;
|
|
46
|
-
}>;
|
|
47
|
-
storage: (args: BasePluginArgs) => StoragePlugin;
|
|
48
|
-
database: (args: BasePluginArgs) => DatabasePlugin;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
declare const loadConfig: () => Promise<Config | null>;
|
|
52
|
-
|
|
53
|
-
export { type BasePluginArgs, type BuildPluginArgs, type Config, type DatabasePlugin, type DatabasePluginHooks, type StoragePlugin, type StoragePluginHooks, getCwd, loadConfig, log };
|
|
1
|
+
export * from "./log";
|
|
2
|
+
export * from "./cwd";
|
|
3
|
+
export * from "./loadConfig";
|
|
4
|
+
export * from "./types";
|
package/dist/index.js
CHANGED
|
@@ -1,46 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_workspace_tools__ from "workspace-tools";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_cosmiconfig__ from "cosmiconfig";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_cosmiconfig_typescript_loader__ from "cosmiconfig-typescript-loader";
|
|
5
|
+
var __webpack_modules__ = {
|
|
6
|
+
"../../node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
7
|
+
let tty = __webpack_require__("tty");
|
|
8
|
+
let isColorSupported = !("NO_COLOR" in process.env || process.argv.includes("--no-color")) && ("FORCE_COLOR" in process.env || process.argv.includes("--color") || "win32" === process.platform || tty.isatty(1) && "dumb" !== process.env.TERM || "CI" in process.env);
|
|
9
|
+
let formatter = (open, close, replace = open)=>(input)=>{
|
|
10
|
+
let string = "" + input;
|
|
11
|
+
let index = string.indexOf(close, open.length);
|
|
12
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
13
|
+
};
|
|
14
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
15
|
+
let start = string.substring(0, index) + replace;
|
|
16
|
+
let end = string.substring(index + close.length);
|
|
17
|
+
let nextIndex = end.indexOf(close);
|
|
18
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
19
|
+
};
|
|
20
|
+
let createColors = (enabled = isColorSupported)=>({
|
|
21
|
+
isColorSupported: enabled,
|
|
22
|
+
reset: enabled ? (s)=>`\x1b[0m${s}\x1b[0m` : String,
|
|
23
|
+
bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
|
|
24
|
+
dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
|
|
25
|
+
italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
|
|
26
|
+
underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
|
|
27
|
+
inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
|
|
28
|
+
hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
|
|
29
|
+
strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
|
|
30
|
+
black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
|
|
31
|
+
red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
|
|
32
|
+
green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
|
|
33
|
+
yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
|
|
34
|
+
blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
|
|
35
|
+
magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
|
|
36
|
+
cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
|
|
37
|
+
white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
|
|
38
|
+
gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
|
|
39
|
+
bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
|
|
40
|
+
bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
|
|
41
|
+
bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
|
|
42
|
+
bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
|
|
43
|
+
bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
|
|
44
|
+
bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
|
|
45
|
+
bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
|
|
46
|
+
bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String
|
|
47
|
+
});
|
|
48
|
+
module.exports = createColors();
|
|
49
|
+
module.exports.createColors = createColors;
|
|
50
|
+
},
|
|
51
|
+
tty: function(module) {
|
|
52
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_tty__;
|
|
35
53
|
}
|
|
36
|
-
}).search();
|
|
37
|
-
if (!result?.config) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
return result.config;
|
|
41
54
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
var __webpack_module_cache__ = {};
|
|
56
|
+
function __webpack_require__(moduleId) {
|
|
57
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
58
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
59
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
60
|
+
exports: {}
|
|
61
|
+
};
|
|
62
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
63
|
+
return module.exports;
|
|
64
|
+
}
|
|
65
|
+
(()=>{
|
|
66
|
+
__webpack_require__.n = function(module) {
|
|
67
|
+
var getter = module && module.__esModule ? function() {
|
|
68
|
+
return module['default'];
|
|
69
|
+
} : function() {
|
|
70
|
+
return module;
|
|
71
|
+
};
|
|
72
|
+
__webpack_require__.d(getter, {
|
|
73
|
+
a: getter
|
|
74
|
+
});
|
|
75
|
+
return getter;
|
|
76
|
+
};
|
|
77
|
+
})();
|
|
78
|
+
(()=>{
|
|
79
|
+
__webpack_require__.d = function(exports, definition) {
|
|
80
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: definition[key]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
})();
|
|
86
|
+
(()=>{
|
|
87
|
+
__webpack_require__.o = function(obj, prop) {
|
|
88
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
89
|
+
};
|
|
90
|
+
})();
|
|
91
|
+
var picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js");
|
|
92
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
93
|
+
const log = {
|
|
94
|
+
normal: (message)=>console.log(message),
|
|
95
|
+
success: (message)=>console.log(picocolors_default().green(message)),
|
|
96
|
+
info: (message)=>console.log(picocolors_default().blue(message)),
|
|
97
|
+
error: (message)=>console.log(picocolors_default().red(message)),
|
|
98
|
+
warn: (message)=>console.log(picocolors_default().yellow(message)),
|
|
99
|
+
debug: (message)=>console.log(picocolors_default().gray(message))
|
|
100
|
+
};
|
|
101
|
+
const getCwd = ()=>(0, __WEBPACK_EXTERNAL_MODULE_workspace_tools__.findPackageRoot)(process.cwd());
|
|
102
|
+
const loadConfig = async ()=>{
|
|
103
|
+
const result = await (0, __WEBPACK_EXTERNAL_MODULE_cosmiconfig__.cosmiconfig)("hot-updater", {
|
|
104
|
+
stopDir: getCwd(),
|
|
105
|
+
searchPlaces: [
|
|
106
|
+
"hot-updater.config.js",
|
|
107
|
+
"hot-updater.config.cjs",
|
|
108
|
+
"hot-updater.config.ts",
|
|
109
|
+
"hot-updater.config.cts",
|
|
110
|
+
"hot-updater.config.mjs",
|
|
111
|
+
"hot-updater.config.cjs"
|
|
112
|
+
],
|
|
113
|
+
ignoreEmptySearchPlaces: false,
|
|
114
|
+
loaders: {
|
|
115
|
+
".ts": (0, __WEBPACK_EXTERNAL_MODULE_cosmiconfig_typescript_loader__.TypeScriptLoader)(),
|
|
116
|
+
".mts": (0, __WEBPACK_EXTERNAL_MODULE_cosmiconfig_typescript_loader__.TypeScriptLoader)(),
|
|
117
|
+
".cts": (0, __WEBPACK_EXTERNAL_MODULE_cosmiconfig_typescript_loader__.TypeScriptLoader)()
|
|
118
|
+
}
|
|
119
|
+
}).search();
|
|
120
|
+
if (!result?.config) return null;
|
|
121
|
+
return result.config;
|
|
46
122
|
};
|
|
123
|
+
export { getCwd, loadConfig, log };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isObject: (value: any) => value is object;
|
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const log: {
|
|
2
|
+
normal: (message: string | number | null | undefined) => void;
|
|
3
|
+
success: (message: string | number | null | undefined) => void;
|
|
4
|
+
info: (message: string | number | null | undefined) => void;
|
|
5
|
+
error: (message: string | number | null | undefined) => void;
|
|
6
|
+
warn: (message: string | number | null | undefined) => void;
|
|
7
|
+
debug: (message: string | number | null | undefined) => void;
|
|
8
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Bundle, Platform } from "@hot-updater/core";
|
|
2
|
+
export type { Platform, Bundle } from "@hot-updater/core";
|
|
3
|
+
export interface BasePluginArgs {
|
|
4
|
+
cwd: string;
|
|
5
|
+
}
|
|
6
|
+
export interface BuildPluginConfig {
|
|
7
|
+
outDir?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DatabasePlugin {
|
|
10
|
+
getBundleById: (bundleId: string) => Promise<Bundle | null>;
|
|
11
|
+
getBundles: (refresh?: boolean) => Promise<Bundle[]>;
|
|
12
|
+
updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>) => Promise<void>;
|
|
13
|
+
setBundles: (bundles: Bundle[]) => Promise<void>;
|
|
14
|
+
appendBundle: (bundles: Bundle) => Promise<void>;
|
|
15
|
+
commitBundle: () => Promise<void>;
|
|
16
|
+
onUnmount?: () => Promise<void>;
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DatabasePluginHooks {
|
|
20
|
+
onDatabaseUpdated?: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export interface BuildPlugin {
|
|
23
|
+
build: (args: {
|
|
24
|
+
platform: Platform;
|
|
25
|
+
}) => Promise<{
|
|
26
|
+
buildPath: string;
|
|
27
|
+
bundleId: string;
|
|
28
|
+
}>;
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
export interface StoragePlugin {
|
|
32
|
+
uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
|
|
33
|
+
fileUrl: string;
|
|
34
|
+
}>;
|
|
35
|
+
deleteBundle: (bundleId: string) => Promise<string>;
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
export interface StoragePluginHooks {
|
|
39
|
+
transformFileUrl?: (key: string) => string;
|
|
40
|
+
onStorageUploaded?: () => Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export type Config = {
|
|
43
|
+
console: {
|
|
44
|
+
/**
|
|
45
|
+
* Git repository URL
|
|
46
|
+
* If git commit hash exists in console, it allows viewing commit history from the git repository
|
|
47
|
+
*/
|
|
48
|
+
gitUrl?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Console port
|
|
51
|
+
* @default 1422
|
|
52
|
+
*/
|
|
53
|
+
port?: number;
|
|
54
|
+
};
|
|
55
|
+
build: (args: BasePluginArgs) => BuildPlugin;
|
|
56
|
+
storage: (args: BasePluginArgs) => StoragePlugin;
|
|
57
|
+
database: (args: BasePluginArgs) => DatabasePlugin;
|
|
58
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@hot-updater/core": "0.
|
|
41
|
+
"@hot-updater/core": "0.2.0",
|
|
42
42
|
"cosmiconfig": "^9.0.0",
|
|
43
43
|
"cosmiconfig-typescript-loader": "^5.0.0",
|
|
44
|
-
"picocolors": "^1.0.0",
|
|
45
44
|
"workspace-tools": "^0.36.4"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
47
|
+
"picocolors": "^1.0.0",
|
|
48
48
|
"@types/node": "^22.7.5"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
|
-
"build": "
|
|
51
|
+
"build": "rslib build",
|
|
52
52
|
"test:type": "tsc --noEmit"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/dist/index.d.cts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Platform, Bundle } from '@hot-updater/core';
|
|
2
|
-
export { Bundle, Platform } from '@hot-updater/core';
|
|
3
|
-
|
|
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
|
-
};
|
|
12
|
-
|
|
13
|
-
declare const getCwd: () => string;
|
|
14
|
-
|
|
15
|
-
interface BasePluginArgs {
|
|
16
|
-
cwd: string;
|
|
17
|
-
}
|
|
18
|
-
interface BuildPluginArgs extends BasePluginArgs {
|
|
19
|
-
platform: Platform;
|
|
20
|
-
}
|
|
21
|
-
interface DatabasePlugin {
|
|
22
|
-
getBundleById: (bundleId: string) => Promise<Bundle | null>;
|
|
23
|
-
getBundles: (refresh?: boolean) => Promise<Bundle[]>;
|
|
24
|
-
updateBundle: (targetBundleId: string, newBundle: Partial<Bundle>) => Promise<void>;
|
|
25
|
-
setBundles: (bundles: Bundle[]) => Promise<void>;
|
|
26
|
-
appendBundle: (bundles: Bundle) => Promise<void>;
|
|
27
|
-
commitBundle: () => Promise<void>;
|
|
28
|
-
onUnmount?: () => Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
interface DatabasePluginHooks {
|
|
31
|
-
onDatabaseUpdated?: () => Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
interface StoragePlugin {
|
|
34
|
-
uploadBundle: (bundleId: string, bundlePath: string) => Promise<{
|
|
35
|
-
fileUrl: string;
|
|
36
|
-
}>;
|
|
37
|
-
deleteBundle: (bundleId: string) => Promise<string>;
|
|
38
|
-
}
|
|
39
|
-
interface StoragePluginHooks {
|
|
40
|
-
onStorageUploaded?: () => Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
type Config = {
|
|
43
|
-
build: (args: BuildPluginArgs) => Promise<{
|
|
44
|
-
buildPath: string;
|
|
45
|
-
bundleId: string;
|
|
46
|
-
}>;
|
|
47
|
-
storage: (args: BasePluginArgs) => StoragePlugin;
|
|
48
|
-
database: (args: BasePluginArgs) => DatabasePlugin;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
declare const loadConfig: () => Promise<Config | null>;
|
|
52
|
-
|
|
53
|
-
export { type BasePluginArgs, type BuildPluginArgs, type Config, type DatabasePlugin, type DatabasePluginHooks, type StoragePlugin, type StoragePluginHooks, getCwd, loadConfig, log };
|