@hot-updater/cli-tools 1.0.0-rc.0 → 1.0.0-rc.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/index.d.mts +5 -2
- package/dist/index.mjs +13 -35
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -47,10 +47,13 @@ interface BundleSigningSession {
|
|
|
47
47
|
readonly publicKey: string;
|
|
48
48
|
readonly signFileHash: (fileHash: string) => Promise<string>;
|
|
49
49
|
}
|
|
50
|
+
declare const readBundleSigningPublicKeyFile: (publicKeyPath: string, options?: {
|
|
51
|
+
readonly cwd?: string;
|
|
52
|
+
}) => Promise<string>;
|
|
50
53
|
declare const prepareBundleSigning: (signing: SigningConfig | undefined, options?: {
|
|
51
54
|
readonly cwd?: string;
|
|
52
55
|
}) => Promise<BundleSigningSession | null>;
|
|
53
|
-
/** Resolves the
|
|
56
|
+
/** Resolves the public identity of the configured bundle signer. */
|
|
54
57
|
declare const getBundleSigningPublicKey: (signing: SigningConfig | undefined, options?: {
|
|
55
58
|
readonly cwd?: string;
|
|
56
59
|
}) => Promise<string | null>;
|
|
@@ -1842,4 +1845,4 @@ type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]
|
|
|
1842
1845
|
*/
|
|
1843
1846
|
declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
|
|
1844
1847
|
//#endregion
|
|
1845
|
-
export { BuildLogger, BuildLoggerConfig, BuildType, BundleSigningSession, ConfigBuilder, ConfigBuilderScaffold, ConfigResponse, CreateHotUpdaterConfigScaffoldFromBuilderOptions, CreateHotUpdaterConfigScaffoldOptions, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, HotUpdaterConfigOptions, HotUpdaterConfigScaffold, HotUpdaterInitEnv, HotUpdaterLogWriter, IConfigBuilder, ImportInfo, InitEnvFileError, InitError, InitProviderDefinition, InitProviderInputDefinition, InitProviderInputPersistence, LEGACY_BUNDLE_ERROR, LegacyInfrastructureError, ManagedHelperStatement, ManagedHelperStrategy, MissingInitInputsError, PromptProgress, PromptSpinner, ProviderConfig, ReactNativeMetadata, ReadPackageUpResult, RunInitOptions, WriteHotUpdaterConfigResult, assertInfrastructureGenerationAtUrl, assertInfrastructureGenerationPayload, assertInitInputs, assertInitProviderInputs, banner, typedColors as colors, confirmInitInputPersistence, copyDirToTmp, createCopiedBundleArchive, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, defineInitProvider, encryptJson, ensureInstallPackages, formatApiKeyNote, getAndroidSdkPath, getBundleSigningPublicKey, getCwd, getHotUpdaterEnvValue, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, getMissingInitInputs, getMissingInitProviderInputs, getPackageManager, getReactNativeMetadatas, getStorageFileByteSize, link, loadConfig, log, makeEnv, p, prepareBundleSigning, printBanner, putStorageFile, readHotUpdaterEnv, readHotUpdaterInitEnv, readPackageUp, renderImportStatements, resolveHotUpdaterServerVersion, resolveInitProviderInput, resolveInitProviderInputs, resolvePackageVersion, shouldAutoSelectOnlyInitResource, stripAnsi, transformEnv, transformTemplate, writeHotUpdaterConfig, writeStorageFile, writeStorageResponseFile };
|
|
1848
|
+
export { BuildLogger, BuildLoggerConfig, BuildType, BundleSigningSession, ConfigBuilder, ConfigBuilderScaffold, ConfigResponse, CreateHotUpdaterConfigScaffoldFromBuilderOptions, CreateHotUpdaterConfigScaffoldOptions, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, HotUpdaterConfigOptions, HotUpdaterConfigScaffold, HotUpdaterInitEnv, HotUpdaterLogWriter, IConfigBuilder, ImportInfo, InitEnvFileError, InitError, InitProviderDefinition, InitProviderInputDefinition, InitProviderInputPersistence, LEGACY_BUNDLE_ERROR, LegacyInfrastructureError, ManagedHelperStatement, ManagedHelperStrategy, MissingInitInputsError, PromptProgress, PromptSpinner, ProviderConfig, ReactNativeMetadata, ReadPackageUpResult, RunInitOptions, WriteHotUpdaterConfigResult, assertInfrastructureGenerationAtUrl, assertInfrastructureGenerationPayload, assertInitInputs, assertInitProviderInputs, banner, typedColors as colors, confirmInitInputPersistence, copyDirToTmp, createCopiedBundleArchive, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, defineInitProvider, encryptJson, ensureInstallPackages, formatApiKeyNote, getAndroidSdkPath, getBundleSigningPublicKey, getCwd, getHotUpdaterEnvValue, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, getMissingInitInputs, getMissingInitProviderInputs, getPackageManager, getReactNativeMetadatas, getStorageFileByteSize, link, loadConfig, log, makeEnv, p, prepareBundleSigning, printBanner, putStorageFile, readBundleSigningPublicKeyFile, readHotUpdaterEnv, readHotUpdaterInitEnv, readPackageUp, renderImportStatements, resolveHotUpdaterServerVersion, resolveInitProviderInput, resolveInitProviderInputs, resolvePackageVersion, shouldAutoSelectOnlyInitResource, stripAnsi, transformEnv, transformTemplate, writeHotUpdaterConfig, writeStorageFile, writeStorageResponseFile };
|
package/dist/index.mjs
CHANGED
|
@@ -24521,7 +24521,7 @@ const loadPrivateKey = async (privateKeyPath) => {
|
|
|
24521
24521
|
throw new Error("Failed to load the local bundle signing private key.");
|
|
24522
24522
|
}
|
|
24523
24523
|
};
|
|
24524
|
-
const createLocalSigningPlugin = ({ privateKeyPath
|
|
24524
|
+
const createLocalSigningPlugin = ({ privateKeyPath }) => {
|
|
24525
24525
|
const privateKeys = /* @__PURE__ */ new Map();
|
|
24526
24526
|
const getPrivateKey = (cwd = process.cwd()) => {
|
|
24527
24527
|
const resolvedPath = resolvePath$1(cwd, privateKeyPath);
|
|
@@ -24536,7 +24536,6 @@ const createLocalSigningPlugin = ({ privateKeyPath, publicKeyPath }) => {
|
|
|
24536
24536
|
};
|
|
24537
24537
|
return {
|
|
24538
24538
|
name: "localSigning",
|
|
24539
|
-
publicKeyPath,
|
|
24540
24539
|
async getPublicKey({ cwd } = {}) {
|
|
24541
24540
|
const privateKey = await getPrivateKey(cwd);
|
|
24542
24541
|
return { publicKey: crypto$1.createPublicKey(privateKey).export({
|
|
@@ -24564,21 +24563,18 @@ const normalizeSigningConfig = (signing) => {
|
|
|
24564
24563
|
].some((key) => Reflect.has(signing, key));
|
|
24565
24564
|
if ((hasPrivateKeyPath || hasEnabled) && hasPluginMembers) throw new Error("Bundle signing config cannot combine local signing fields with signing plugin fields.");
|
|
24566
24565
|
if (!hasPluginMembers) {
|
|
24567
|
-
if (Object.keys(signing).some((key) => key !== "enabled" && key !== "privateKeyPath"
|
|
24566
|
+
if (Object.keys(signing).some((key) => key !== "enabled" && key !== "privateKeyPath")) throw new Error("Local bundle signing accepts only enabled and privateKeyPath.");
|
|
24568
24567
|
const enabled = Reflect.get(signing, "enabled");
|
|
24569
|
-
if (enabled === false
|
|
24568
|
+
if (enabled === false) return void 0;
|
|
24570
24569
|
if (enabled !== true) throw invalidSigningConfig();
|
|
24571
24570
|
const privateKeyPath = Reflect.get(signing, "privateKeyPath");
|
|
24572
|
-
const publicKeyPath = Reflect.get(signing, "publicKeyPath");
|
|
24573
24571
|
if (typeof privateKeyPath !== "string" || !privateKeyPath.trim()) throw new Error("Enabled local bundle signing requires privateKeyPath.");
|
|
24574
|
-
if (publicKeyPath !== void 0 && (typeof publicKeyPath !== "string" || !publicKeyPath.trim())) throw new Error("Local bundle signing publicKeyPath must be a non-empty path when provided.");
|
|
24575
24572
|
return {
|
|
24576
24573
|
enabled: true,
|
|
24577
|
-
privateKeyPath
|
|
24578
|
-
...publicKeyPath === void 0 ? {} : { publicKeyPath }
|
|
24574
|
+
privateKeyPath
|
|
24579
24575
|
};
|
|
24580
24576
|
}
|
|
24581
|
-
if (typeof Reflect.get(signing, "name") !== "string" || typeof Reflect.get(signing, "
|
|
24577
|
+
if (typeof Reflect.get(signing, "name") !== "string" || typeof Reflect.get(signing, "getPublicKey") !== "function" || typeof Reflect.get(signing, "sign") !== "function") throw invalidSigningConfig();
|
|
24582
24578
|
return signing;
|
|
24583
24579
|
};
|
|
24584
24580
|
//#endregion
|
|
@@ -24600,20 +24596,10 @@ const exportPublicKey = (publicKey) => publicKey.export({
|
|
|
24600
24596
|
type: "spki",
|
|
24601
24597
|
format: "pem"
|
|
24602
24598
|
}).toString();
|
|
24603
|
-
const
|
|
24604
|
-
|
|
24605
|
-
type: "spki",
|
|
24606
|
-
format: "der"
|
|
24607
|
-
});
|
|
24608
|
-
const rightDer = right.export({
|
|
24609
|
-
type: "spki",
|
|
24610
|
-
format: "der"
|
|
24611
|
-
});
|
|
24612
|
-
return leftDer.byteLength === rightDer.byteLength && crypto$1.timingSafeEqual(leftDer, rightDer);
|
|
24613
|
-
};
|
|
24614
|
-
const readKeyFile = async (cwd, filePath) => {
|
|
24599
|
+
const readBundleSigningPublicKeyFile = async (publicKeyPath, options = {}) => {
|
|
24600
|
+
if (!publicKeyPath.trim()) throw new Error("Bundle signing public key path is required.");
|
|
24615
24601
|
try {
|
|
24616
|
-
return await fs$3.readFile(resolvePath(cwd,
|
|
24602
|
+
return exportPublicKey(parseRsaPublicKey(await fs$3.readFile(resolvePath(options.cwd ?? getCwd(), publicKeyPath), "utf8")));
|
|
24617
24603
|
} catch {
|
|
24618
24604
|
throw new Error("Failed to read the bundle signing public key file.");
|
|
24619
24605
|
}
|
|
@@ -24654,8 +24640,7 @@ const createMemoizedSigner = ({ publicKey, sign }) => {
|
|
|
24654
24640
|
};
|
|
24655
24641
|
};
|
|
24656
24642
|
const preparePluginSigning = async (signing, cwd) => {
|
|
24657
|
-
const
|
|
24658
|
-
if (!publicKeysMatch(configuredPublicKeyPEM === void 0 ? providerPublicKey : parseRsaPublicKey(configuredPublicKeyPEM), providerPublicKey)) throw new Error("Bundle signing provider public key does not match publicKeyPath.");
|
|
24643
|
+
const providerPublicKey = await getProviderPublicKey(signing, cwd);
|
|
24659
24644
|
return {
|
|
24660
24645
|
name: signing.name,
|
|
24661
24646
|
publicKey: exportPublicKey(providerPublicKey),
|
|
@@ -24676,19 +24661,12 @@ const prepareBundleSigning = async (signing, options = {}) => {
|
|
|
24676
24661
|
const cwd = options.cwd ?? getCwd();
|
|
24677
24662
|
return preparePluginSigning("enabled" in normalized ? createLocalSigningPlugin(normalized) : normalized, cwd);
|
|
24678
24663
|
};
|
|
24679
|
-
/** Resolves the
|
|
24664
|
+
/** Resolves the public identity of the configured bundle signer. */
|
|
24680
24665
|
const getBundleSigningPublicKey = async (signing, options = {}) => {
|
|
24681
24666
|
const normalized = normalizeSigningConfig(signing);
|
|
24682
24667
|
if (!normalized) return null;
|
|
24683
24668
|
const cwd = options.cwd ?? getCwd();
|
|
24684
|
-
|
|
24685
|
-
if ("enabled" in normalized) try {
|
|
24686
|
-
const { publicKey } = await createLocalSigningPlugin(normalized).getPublicKey({ cwd });
|
|
24687
|
-
return exportPublicKey(parseRsaPublicKey(publicKey));
|
|
24688
|
-
} catch {
|
|
24689
|
-
return exportPublicKey(parseRsaPublicKey(await readKeyFile(cwd, path$1.join(path$1.dirname(normalized.privateKeyPath), "public-key.pem"))));
|
|
24690
|
-
}
|
|
24691
|
-
throw new Error("Bundle signing plugins require publicKeyPath.");
|
|
24669
|
+
return exportPublicKey(await getProviderPublicKey("enabled" in normalized ? createLocalSigningPlugin(normalized) : normalized, cwd));
|
|
24692
24670
|
};
|
|
24693
24671
|
//#endregion
|
|
24694
24672
|
//#region src/ConfigBuilder.ts
|
|
@@ -43916,7 +43894,7 @@ const missingDatabase = createDatabasePlugin({
|
|
|
43916
43894
|
throw new Error("database plugin is required");
|
|
43917
43895
|
}
|
|
43918
43896
|
},
|
|
43919
|
-
|
|
43897
|
+
insights: {
|
|
43920
43898
|
append: async () => {
|
|
43921
43899
|
throw new Error("database plugin is required");
|
|
43922
43900
|
},
|
|
@@ -44592,4 +44570,4 @@ function transformTemplate(templateString, values) {
|
|
|
44592
44570
|
return result;
|
|
44593
44571
|
}
|
|
44594
44572
|
//#endregion
|
|
44595
|
-
export { BuildLogger, ConfigBuilder, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, InitEnvFileError, InitError, LEGACY_BUNDLE_ERROR, LegacyInfrastructureError, MissingInitInputsError, assertInfrastructureGenerationAtUrl, assertInfrastructureGenerationPayload, assertInitInputs, assertInitProviderInputs, banner, typedColors as colors, confirmInitInputPersistence, copyDirToTmp, createCopiedBundleArchive, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, defineInitProvider, encryptJson, ensureInstallPackages, formatApiKeyNote, getAndroidSdkPath, getBundleSigningPublicKey, getCwd, getHotUpdaterEnvValue, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, getMissingInitInputs, getMissingInitProviderInputs, getPackageManager, getReactNativeMetadatas, getStorageFileByteSize, link, loadConfig, log, makeEnv, p, prepareBundleSigning, printBanner, putStorageFile, readHotUpdaterEnv, readHotUpdaterInitEnv, readPackageUp, renderImportStatements, resolveHotUpdaterServerVersion, resolveInitProviderInput, resolveInitProviderInputs, resolvePackageVersion, shouldAutoSelectOnlyInitResource, stripAnsi, transformEnv, transformTemplate, writeHotUpdaterConfig, writeStorageFile, writeStorageResponseFile };
|
|
44573
|
+
export { BuildLogger, ConfigBuilder, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, InitEnvFileError, InitError, LEGACY_BUNDLE_ERROR, LegacyInfrastructureError, MissingInitInputsError, assertInfrastructureGenerationAtUrl, assertInfrastructureGenerationPayload, assertInitInputs, assertInitProviderInputs, banner, typedColors as colors, confirmInitInputPersistence, copyDirToTmp, createCopiedBundleArchive, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, defineInitProvider, encryptJson, ensureInstallPackages, formatApiKeyNote, getAndroidSdkPath, getBundleSigningPublicKey, getCwd, getHotUpdaterEnvValue, getHotUpdaterInitInputEnv, getInitProviderEnvVars, getInitProviderTextPromptValues, getMissingInitInputs, getMissingInitProviderInputs, getPackageManager, getReactNativeMetadatas, getStorageFileByteSize, link, loadConfig, log, makeEnv, p, prepareBundleSigning, printBanner, putStorageFile, readBundleSigningPublicKeyFile, readHotUpdaterEnv, readHotUpdaterInitEnv, readPackageUp, renderImportStatements, resolveHotUpdaterServerVersion, resolveInitProviderInput, resolveInitProviderInputs, resolvePackageVersion, shouldAutoSelectOnlyInitResource, stripAnsi, transformEnv, transformTemplate, writeHotUpdaterConfig, writeStorageFile, writeStorageResponseFile };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/cli-tools",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"oxc-parser": "0.141.0",
|
|
50
50
|
"oxc-transform": "0.141.0",
|
|
51
51
|
"unconfig": "7.5.0",
|
|
52
|
-
"@hot-updater/plugin-core": "1.0.0-rc.
|
|
52
|
+
"@hot-updater/plugin-core": "1.0.0-rc.1",
|
|
53
53
|
"@hot-updater/core": "1.0.0-rc.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"tar": "^7.5.16",
|
|
65
65
|
"verkit": "0.3.2",
|
|
66
66
|
"workspace-tools": "^0.41.7",
|
|
67
|
-
"@hot-updater/test-utils": "1.0.0-rc.
|
|
67
|
+
"@hot-updater/test-utils": "1.0.0-rc.1"
|
|
68
68
|
},
|
|
69
69
|
"inlinedDependencies": {
|
|
70
70
|
"@babel/code-frame": "7.29.0",
|