@hot-updater/cli-tools 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +49 -31
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -44127,13 +44127,16 @@ const MANAGED_IMPORT_PACKAGES = /* @__PURE__ */ new Set([
|
|
|
44127
44127
|
"@aws-sdk/credential-provider-sso",
|
|
44128
44128
|
"@aws-sdk/credential-providers",
|
|
44129
44129
|
"@hot-updater/aws",
|
|
44130
|
+
"@hot-updater/azure",
|
|
44130
44131
|
"@hot-updater/bare",
|
|
44131
44132
|
"@hot-updater/cloudflare",
|
|
44132
44133
|
"@hot-updater/expo",
|
|
44133
44134
|
"@hot-updater/firebase",
|
|
44135
|
+
"@hot-updater/postgres",
|
|
44134
44136
|
"@hot-updater/rock",
|
|
44135
44137
|
"@hot-updater/server/plugins",
|
|
44136
|
-
"@hot-updater/supabase"
|
|
44138
|
+
"@hot-updater/supabase",
|
|
44139
|
+
"@hot-updater/vercel"
|
|
44137
44140
|
]);
|
|
44138
44141
|
const MANAGED_HELPER_NAMES = /* @__PURE__ */ new Set([
|
|
44139
44142
|
"awsOptions",
|
|
@@ -45045,64 +45048,72 @@ function isUnsafeProperty(key) {
|
|
|
45045
45048
|
return key === "__proto__";
|
|
45046
45049
|
}
|
|
45047
45050
|
//#endregion
|
|
45048
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/object/
|
|
45051
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/object/mergeWith.mjs
|
|
45049
45052
|
/**
|
|
45050
45053
|
* Merges the properties of the source object into the target object.
|
|
45051
45054
|
*
|
|
45052
|
-
*
|
|
45053
|
-
*
|
|
45054
|
-
* If
|
|
45055
|
+
* You can provide a custom `merge` function to control how properties are merged. It should return the value to be set in the target object.
|
|
45056
|
+
*
|
|
45057
|
+
* If it returns `undefined`, a default deep merge will be applied for arrays and objects:
|
|
45058
|
+
*
|
|
45059
|
+
* - If a property in the source object is an array or an object and the corresponding property in the target object is also an array or object, they will be merged.
|
|
45060
|
+
* - If a property in the source object is undefined, it will not overwrite a defined property in the target object.
|
|
45055
45061
|
*
|
|
45056
45062
|
* Note that this function mutates the target object.
|
|
45057
45063
|
*
|
|
45058
45064
|
* @param {T} target - The target object into which the source object properties will be merged. This object is modified in place.
|
|
45059
45065
|
* @param {S} source - The source object whose properties will be merged into the target object.
|
|
45066
|
+
* @param {(targetValue: any, sourceValue: any, key: string, target: T, source: S) => any} merge - A custom merge function that defines how properties should be combined. It receives the following arguments:
|
|
45067
|
+
* - `targetValue`: The current value of the property in the target object.
|
|
45068
|
+
* - `sourceValue`: The value of the property in the source object.
|
|
45069
|
+
* - `key`: The key of the property being merged.
|
|
45070
|
+
* - `target`: The target object.
|
|
45071
|
+
* - `source`: The source object.
|
|
45072
|
+
*
|
|
45060
45073
|
* @returns {T & S} The updated target object with properties from the source object merged in.
|
|
45061
45074
|
*
|
|
45062
45075
|
* @template T - Type of the target object.
|
|
45063
45076
|
* @template S - Type of the source object.
|
|
45064
45077
|
*
|
|
45065
45078
|
* @example
|
|
45066
|
-
* const target = { a: 1, b:
|
|
45067
|
-
* const source = { b:
|
|
45068
|
-
*
|
|
45069
|
-
* const result = merge(target, source);
|
|
45070
|
-
* console.log(result);
|
|
45071
|
-
* // Output: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 5 }
|
|
45079
|
+
* const target = { a: 1, b: 2 };
|
|
45080
|
+
* const source = { b: 3, c: 4 };
|
|
45072
45081
|
*
|
|
45082
|
+
* mergeWith(target, source, (targetValue, sourceValue) => {
|
|
45083
|
+
* if (typeof targetValue === 'number' && typeof sourceValue === 'number') {
|
|
45084
|
+
* return targetValue + sourceValue;
|
|
45085
|
+
* }
|
|
45086
|
+
* });
|
|
45087
|
+
* // Returns { a: 1, b: 5, c: 4 }
|
|
45073
45088
|
* @example
|
|
45074
|
-
* const target = { a: [1
|
|
45075
|
-
* const source = { a: [3], b:
|
|
45089
|
+
* const target = { a: [1], b: [2] };
|
|
45090
|
+
* const source = { a: [3], b: [4] };
|
|
45076
45091
|
*
|
|
45077
|
-
* const result =
|
|
45078
|
-
*
|
|
45079
|
-
*
|
|
45092
|
+
* const result = mergeWith(target, source, (objValue, srcValue) => {
|
|
45093
|
+
* if (Array.isArray(objValue)) {
|
|
45094
|
+
* return objValue.concat(srcValue);
|
|
45095
|
+
* }
|
|
45096
|
+
* });
|
|
45080
45097
|
*
|
|
45081
|
-
*
|
|
45082
|
-
* const target = { a: null };
|
|
45083
|
-
* const source = { a: [1, 2, 3] };
|
|
45084
|
-
*
|
|
45085
|
-
* const result = merge(target, source);
|
|
45086
|
-
* console.log(result);
|
|
45087
|
-
* // Output: { a: [1, 2, 3] }
|
|
45098
|
+
* expect(result).toEqual({ a: [1, 3], b: [2, 4] });
|
|
45088
45099
|
*/
|
|
45089
|
-
function
|
|
45100
|
+
function mergeWith(target, source, merge) {
|
|
45090
45101
|
const sourceKeys = Object.keys(source);
|
|
45091
45102
|
for (let i = 0; i < sourceKeys.length; i++) {
|
|
45092
45103
|
const key = sourceKeys[i];
|
|
45093
45104
|
if (isUnsafeProperty(key)) continue;
|
|
45094
45105
|
const sourceValue = source[key];
|
|
45095
45106
|
const targetValue = target[key];
|
|
45096
|
-
|
|
45097
|
-
|
|
45098
|
-
else if (
|
|
45107
|
+
const merged = merge(targetValue, sourceValue, key, target, source);
|
|
45108
|
+
if (merged !== void 0) target[key] = merged;
|
|
45109
|
+
else if (Array.isArray(sourceValue)) if (Array.isArray(targetValue)) target[key] = mergeWith(targetValue, sourceValue, merge);
|
|
45110
|
+
else target[key] = mergeWith([], sourceValue, merge);
|
|
45111
|
+
else if (isPlainObject(sourceValue)) if (isPlainObject(targetValue)) target[key] = mergeWith(targetValue, sourceValue, merge);
|
|
45112
|
+
else target[key] = mergeWith({}, sourceValue, merge);
|
|
45099
45113
|
else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
|
|
45100
45114
|
}
|
|
45101
45115
|
return target;
|
|
45102
45116
|
}
|
|
45103
|
-
function isMergeableValue(value) {
|
|
45104
|
-
return isPlainObject(value) || Array.isArray(value);
|
|
45105
|
-
}
|
|
45106
45117
|
//#endregion
|
|
45107
45118
|
//#region src/loadConfig.ts
|
|
45108
45119
|
var import_out = /* @__PURE__ */ __toESM(require_out(), 1);
|
|
@@ -45159,8 +45170,15 @@ const getDefaultConfig = () => {
|
|
|
45159
45170
|
plugins: []
|
|
45160
45171
|
};
|
|
45161
45172
|
};
|
|
45173
|
+
/**
|
|
45174
|
+
* An array in the config replaces the default one. A plain deep merge goes
|
|
45175
|
+
* index by index, so `infoPlistPaths: ["ios/App/Info.plist"]` over three
|
|
45176
|
+
* discovered Info.plist files only overwrote the first and kept the others.
|
|
45177
|
+
* The array is still copied deeply, as `merge` copied it.
|
|
45178
|
+
*/
|
|
45179
|
+
const replaceArrays = (_targetValue, sourceValue) => Array.isArray(sourceValue) ? mergeWith([], sourceValue, replaceArrays) : void 0;
|
|
45162
45180
|
const mergeConfigSources = (...sources) => {
|
|
45163
|
-
const mergedConfig = sources.reduceRight((mergedConfig, source) =>
|
|
45181
|
+
const mergedConfig = sources.reduceRight((mergedConfig, source) => mergeWith(mergedConfig, source ?? {}, replaceArrays), {});
|
|
45164
45182
|
const database = sources.find((source) => source?.database)?.database;
|
|
45165
45183
|
const plugins = sources.find((source) => source?.plugins)?.plugins;
|
|
45166
45184
|
const signing = sources.find((source) => source?.signing)?.signing;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/cli-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"oxc-parser": "0.141.0",
|
|
50
50
|
"oxc-transform": "0.141.0",
|
|
51
51
|
"unconfig": "7.5.0",
|
|
52
|
-
"@hot-updater/
|
|
53
|
-
"@hot-updater/server": "1.0.
|
|
54
|
-
"@hot-updater/
|
|
52
|
+
"@hot-updater/plugin-core": "1.0.3",
|
|
53
|
+
"@hot-updater/server": "1.0.3",
|
|
54
|
+
"@hot-updater/protocol": "1.0.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@clack/prompts": "1.7.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"tar": "^7.5.16",
|
|
66
66
|
"verkit": "0.4.0",
|
|
67
67
|
"workspace-tools": "^0.41.7",
|
|
68
|
-
"@hot-updater/test-utils": "1.0.
|
|
68
|
+
"@hot-updater/test-utils": "1.0.3"
|
|
69
69
|
},
|
|
70
70
|
"inlinedDependencies": {
|
|
71
71
|
"@babel/code-frame": "7.29.0",
|