@hot-updater/plugin-core 0.31.4 → 0.32.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/assetStorageLayout.cjs +34 -0
- package/dist/assetStorageLayout.d.cts +31 -0
- package/dist/assetStorageLayout.d.mts +31 -0
- package/dist/assetStorageLayout.mjs +30 -0
- package/dist/compressionFormat.cjs +2 -2
- package/dist/contentAddressedAssets.cjs +7 -0
- package/dist/contentAddressedAssets.d.cts +10 -0
- package/dist/contentAddressedAssets.d.mts +10 -0
- package/dist/contentAddressedAssets.mjs +7 -0
- package/dist/createBlobDatabasePlugin.cjs +1 -1
- package/dist/createStoragePlugin.cjs +3 -0
- package/dist/createStoragePlugin.mjs +3 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +3 -1
- package/dist/legacyAssetStorageLayout.cjs +12 -0
- package/dist/legacyAssetStorageLayout.mjs +12 -0
- package/dist/semverSatisfies.cjs +1 -1
- package/dist/types/index.d.cts +23 -0
- package/dist/types/index.d.mts +23 -0
- package/package.json +4 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_contentAddressedAssets = require("./contentAddressedAssets.cjs");
|
|
2
|
+
const require_legacyAssetStorageLayout = require("./legacyAssetStorageLayout.cjs");
|
|
3
|
+
//#region src/assetStorageLayout.ts
|
|
4
|
+
const createStorageUriWithRelativePath = ({ baseStorageUri, relativePath }) => {
|
|
5
|
+
const storageUrl = new URL(baseStorageUri);
|
|
6
|
+
storageUrl.pathname = `${storageUrl.pathname.replace(/\/+$/, "")}/${relativePath.replace(/\\/g, "/").split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
7
|
+
return storageUrl.toString();
|
|
8
|
+
};
|
|
9
|
+
const getAssetStorageLayout = (assetBaseStorageUri) => {
|
|
10
|
+
const pathname = new URL(assetBaseStorageUri).pathname.replace(/\/+$/, "");
|
|
11
|
+
return pathname.endsWith("/assets") || pathname === "/assets" ? "content-addressed" : "legacy-files";
|
|
12
|
+
};
|
|
13
|
+
const isContentAddressedAssetBaseStorageUri = (assetBaseStorageUri) => getAssetStorageLayout(assetBaseStorageUri) === "content-addressed";
|
|
14
|
+
const getManifestAssetStoragePath = ({ assetBaseStorageUri, assetPath, fileHash }) => {
|
|
15
|
+
if (getAssetStorageLayout(assetBaseStorageUri) === "content-addressed") return require_contentAddressedAssets.getContentAddressedAssetStoragePath({
|
|
16
|
+
assetPath,
|
|
17
|
+
fileHash
|
|
18
|
+
});
|
|
19
|
+
return require_legacyAssetStorageLayout.getLegacyManifestAssetStoragePath({ assetPath });
|
|
20
|
+
};
|
|
21
|
+
const resolveManifestAssetStorageUri = ({ assetBaseStorageUri, assetPath, fileHash }) => createStorageUriWithRelativePath({
|
|
22
|
+
baseStorageUri: assetBaseStorageUri,
|
|
23
|
+
relativePath: getManifestAssetStoragePath({
|
|
24
|
+
assetBaseStorageUri,
|
|
25
|
+
assetPath,
|
|
26
|
+
fileHash
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.createStorageUriWithRelativePath = createStorageUriWithRelativePath;
|
|
31
|
+
exports.getAssetStorageLayout = getAssetStorageLayout;
|
|
32
|
+
exports.getManifestAssetStoragePath = getManifestAssetStoragePath;
|
|
33
|
+
exports.isContentAddressedAssetBaseStorageUri = isContentAddressedAssetBaseStorageUri;
|
|
34
|
+
exports.resolveManifestAssetStorageUri = resolveManifestAssetStorageUri;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/assetStorageLayout.d.ts
|
|
2
|
+
type AssetStorageLayout = "content-addressed" | "legacy-files";
|
|
3
|
+
declare const createStorageUriWithRelativePath: ({
|
|
4
|
+
baseStorageUri,
|
|
5
|
+
relativePath
|
|
6
|
+
}: {
|
|
7
|
+
baseStorageUri: string;
|
|
8
|
+
relativePath: string;
|
|
9
|
+
}) => string;
|
|
10
|
+
declare const getAssetStorageLayout: (assetBaseStorageUri: string) => AssetStorageLayout;
|
|
11
|
+
declare const isContentAddressedAssetBaseStorageUri: (assetBaseStorageUri: string) => boolean;
|
|
12
|
+
declare const getManifestAssetStoragePath: ({
|
|
13
|
+
assetBaseStorageUri,
|
|
14
|
+
assetPath,
|
|
15
|
+
fileHash
|
|
16
|
+
}: {
|
|
17
|
+
assetBaseStorageUri: string;
|
|
18
|
+
assetPath: string;
|
|
19
|
+
fileHash: string;
|
|
20
|
+
}) => string;
|
|
21
|
+
declare const resolveManifestAssetStorageUri: ({
|
|
22
|
+
assetBaseStorageUri,
|
|
23
|
+
assetPath,
|
|
24
|
+
fileHash
|
|
25
|
+
}: {
|
|
26
|
+
assetBaseStorageUri: string;
|
|
27
|
+
assetPath: string;
|
|
28
|
+
fileHash: string;
|
|
29
|
+
}) => string;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/assetStorageLayout.d.ts
|
|
2
|
+
type AssetStorageLayout = "content-addressed" | "legacy-files";
|
|
3
|
+
declare const createStorageUriWithRelativePath: ({
|
|
4
|
+
baseStorageUri,
|
|
5
|
+
relativePath
|
|
6
|
+
}: {
|
|
7
|
+
baseStorageUri: string;
|
|
8
|
+
relativePath: string;
|
|
9
|
+
}) => string;
|
|
10
|
+
declare const getAssetStorageLayout: (assetBaseStorageUri: string) => AssetStorageLayout;
|
|
11
|
+
declare const isContentAddressedAssetBaseStorageUri: (assetBaseStorageUri: string) => boolean;
|
|
12
|
+
declare const getManifestAssetStoragePath: ({
|
|
13
|
+
assetBaseStorageUri,
|
|
14
|
+
assetPath,
|
|
15
|
+
fileHash
|
|
16
|
+
}: {
|
|
17
|
+
assetBaseStorageUri: string;
|
|
18
|
+
assetPath: string;
|
|
19
|
+
fileHash: string;
|
|
20
|
+
}) => string;
|
|
21
|
+
declare const resolveManifestAssetStorageUri: ({
|
|
22
|
+
assetBaseStorageUri,
|
|
23
|
+
assetPath,
|
|
24
|
+
fileHash
|
|
25
|
+
}: {
|
|
26
|
+
assetBaseStorageUri: string;
|
|
27
|
+
assetPath: string;
|
|
28
|
+
fileHash: string;
|
|
29
|
+
}) => string;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
|
|
2
|
+
import { getLegacyManifestAssetStoragePath } from "./legacyAssetStorageLayout.mjs";
|
|
3
|
+
//#region src/assetStorageLayout.ts
|
|
4
|
+
const createStorageUriWithRelativePath = ({ baseStorageUri, relativePath }) => {
|
|
5
|
+
const storageUrl = new URL(baseStorageUri);
|
|
6
|
+
storageUrl.pathname = `${storageUrl.pathname.replace(/\/+$/, "")}/${relativePath.replace(/\\/g, "/").split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
7
|
+
return storageUrl.toString();
|
|
8
|
+
};
|
|
9
|
+
const getAssetStorageLayout = (assetBaseStorageUri) => {
|
|
10
|
+
const pathname = new URL(assetBaseStorageUri).pathname.replace(/\/+$/, "");
|
|
11
|
+
return pathname.endsWith("/assets") || pathname === "/assets" ? "content-addressed" : "legacy-files";
|
|
12
|
+
};
|
|
13
|
+
const isContentAddressedAssetBaseStorageUri = (assetBaseStorageUri) => getAssetStorageLayout(assetBaseStorageUri) === "content-addressed";
|
|
14
|
+
const getManifestAssetStoragePath = ({ assetBaseStorageUri, assetPath, fileHash }) => {
|
|
15
|
+
if (getAssetStorageLayout(assetBaseStorageUri) === "content-addressed") return getContentAddressedAssetStoragePath({
|
|
16
|
+
assetPath,
|
|
17
|
+
fileHash
|
|
18
|
+
});
|
|
19
|
+
return getLegacyManifestAssetStoragePath({ assetPath });
|
|
20
|
+
};
|
|
21
|
+
const resolveManifestAssetStorageUri = ({ assetBaseStorageUri, assetPath, fileHash }) => createStorageUriWithRelativePath({
|
|
22
|
+
baseStorageUri: assetBaseStorageUri,
|
|
23
|
+
relativePath: getManifestAssetStoragePath({
|
|
24
|
+
assetBaseStorageUri,
|
|
25
|
+
assetPath,
|
|
26
|
+
fileHash
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let node_path = require("node:path");
|
|
3
|
-
node_path = require_runtime.__toESM(node_path
|
|
3
|
+
node_path = require_runtime.__toESM(node_path);
|
|
4
4
|
let mime = require("mime");
|
|
5
|
-
mime = require_runtime.__toESM(mime
|
|
5
|
+
mime = require_runtime.__toESM(mime);
|
|
6
6
|
//#region src/compressionFormat.ts
|
|
7
7
|
/**
|
|
8
8
|
* Compression formats registry
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/contentAddressedAssets.ts
|
|
2
|
+
const getContentAddressedAssetStoragePath = ({ assetPath, fileHash }) => {
|
|
3
|
+
const extension = assetPath.endsWith(".br") ? ".br" : assetPath.includes(".") ? `.${assetPath.split(".").pop()}` : "";
|
|
4
|
+
return `sha256/${fileHash.slice(0, 2)}/${fileHash}${extension}`;
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.getContentAddressedAssetStoragePath = getContentAddressedAssetStoragePath;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/contentAddressedAssets.ts
|
|
2
|
+
const getContentAddressedAssetStoragePath = ({ assetPath, fileHash }) => {
|
|
3
|
+
const extension = assetPath.endsWith(".br") ? ".br" : assetPath.includes(".") ? `.${assetPath.split(".").pop()}` : "";
|
|
4
|
+
return `sha256/${fileHash.slice(0, 2)}/${fileHash}${extension}`;
|
|
5
|
+
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { getContentAddressedAssetStoragePath };
|
|
@@ -7,7 +7,7 @@ const require_paginateBundles = require("./paginateBundles.cjs");
|
|
|
7
7
|
let _hot_updater_js = require("@hot-updater/js");
|
|
8
8
|
let es_toolkit = require("es-toolkit");
|
|
9
9
|
let semver = require("semver");
|
|
10
|
-
semver = require_runtime.__toESM(semver
|
|
10
|
+
semver = require_runtime.__toESM(semver);
|
|
11
11
|
//#region src/createBlobDatabasePlugin.ts
|
|
12
12
|
function removeBundleInternalKeys(bundle) {
|
|
13
13
|
const { _updateJsonKey, _oldUpdateJsonKey, ...pureBundle } = bundle;
|
|
@@ -45,6 +45,9 @@ const createProfiledStoragePlugin = ({ createProfiles, name, profileShape, suppo
|
|
|
45
45
|
async downloadFile(storageUri, filePath) {
|
|
46
46
|
return requireNodeProfile().downloadFile(storageUri, filePath);
|
|
47
47
|
},
|
|
48
|
+
async exists(storageUri) {
|
|
49
|
+
return requireNodeProfile().exists(storageUri);
|
|
50
|
+
},
|
|
48
51
|
async upload(key, filePath) {
|
|
49
52
|
return requireNodeProfile().upload(key, filePath);
|
|
50
53
|
}
|
|
@@ -45,6 +45,9 @@ const createProfiledStoragePlugin = ({ createProfiles, name, profileShape, suppo
|
|
|
45
45
|
async downloadFile(storageUri, filePath) {
|
|
46
46
|
return requireNodeProfile().downloadFile(storageUri, filePath);
|
|
47
47
|
},
|
|
48
|
+
async exists(storageUri) {
|
|
49
|
+
return requireNodeProfile().exists(storageUri);
|
|
50
|
+
},
|
|
48
51
|
async upload(key, filePath) {
|
|
49
52
|
return requireNodeProfile().upload(key, filePath);
|
|
50
53
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_calculatePagination = require("./calculatePagination.cjs");
|
|
3
3
|
const require_compressionFormat = require("./compressionFormat.cjs");
|
|
4
|
+
const require_contentAddressedAssets = require("./contentAddressedAssets.cjs");
|
|
5
|
+
const require_assetStorageLayout = require("./assetStorageLayout.cjs");
|
|
4
6
|
const require_createDatabasePlugin = require("./createDatabasePlugin.cjs");
|
|
5
7
|
const require_semverSatisfies = require("./semverSatisfies.cjs");
|
|
6
8
|
const require_filterCompatibleAppVersions = require("./filterCompatibleAppVersions.cjs");
|
|
@@ -26,6 +28,7 @@ exports.createDatabasePluginGetUpdateInfo = require_createDatabasePluginGetUpdat
|
|
|
26
28
|
exports.createNodeStoragePlugin = require_createStoragePlugin.createNodeStoragePlugin;
|
|
27
29
|
exports.createRuntimeStoragePlugin = require_createStoragePlugin.createRuntimeStoragePlugin;
|
|
28
30
|
exports.createStorageKeyBuilder = require_createStorageKeyBuilder.createStorageKeyBuilder;
|
|
31
|
+
exports.createStorageUriWithRelativePath = require_assetStorageLayout.createStorageUriWithRelativePath;
|
|
29
32
|
exports.createUUIDv7 = require_uuidv7.createUUIDv7;
|
|
30
33
|
exports.createUUIDv7WithSameTimestamp = require_uuidv7.createUUIDv7WithSameTimestamp;
|
|
31
34
|
exports.createUniversalStoragePlugin = require_createStoragePlugin.createUniversalStoragePlugin;
|
|
@@ -33,12 +36,17 @@ exports.detectCompressionFormat = require_compressionFormat.detectCompressionFor
|
|
|
33
36
|
exports.extractTimestampFromUUIDv7 = require_uuidv7.extractTimestampFromUUIDv7;
|
|
34
37
|
exports.filterCompatibleAppVersions = require_filterCompatibleAppVersions.filterCompatibleAppVersions;
|
|
35
38
|
exports.generateMinBundleId = require_generateMinBundleId.generateMinBundleId;
|
|
39
|
+
exports.getAssetStorageLayout = require_assetStorageLayout.getAssetStorageLayout;
|
|
36
40
|
exports.getCompressionMimeType = require_compressionFormat.getCompressionMimeType;
|
|
41
|
+
exports.getContentAddressedAssetStoragePath = require_contentAddressedAssets.getContentAddressedAssetStoragePath;
|
|
37
42
|
exports.getContentType = require_compressionFormat.getContentType;
|
|
43
|
+
exports.getManifestAssetStoragePath = require_assetStorageLayout.getManifestAssetStoragePath;
|
|
44
|
+
exports.isContentAddressedAssetBaseStorageUri = require_assetStorageLayout.isContentAddressedAssetBaseStorageUri;
|
|
38
45
|
exports.isNodeStoragePlugin = require_storageProfile.isNodeStoragePlugin;
|
|
39
46
|
exports.isRuntimeStoragePlugin = require_storageProfile.isRuntimeStoragePlugin;
|
|
40
47
|
exports.paginateBundles = require_paginateBundles.paginateBundles;
|
|
41
48
|
exports.parseStorageUri = require_parseStorageUri.parseStorageUri;
|
|
49
|
+
exports.resolveManifestAssetStorageUri = require_assetStorageLayout.resolveManifestAssetStorageUri;
|
|
42
50
|
exports.semverSatisfies = require_semverSatisfies.semverSatisfies;
|
|
43
51
|
exports.sortBundles = require_queryBundles.sortBundles;
|
|
44
52
|
exports.supportedIosPlatforms = require_index.supportedIosPlatforms;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,8 @@ import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./
|
|
|
2
2
|
import { AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, supportedIosPlatforms } from "./types/index.cjs";
|
|
3
3
|
import { PaginationOptions, calculatePagination } from "./calculatePagination.cjs";
|
|
4
4
|
import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.cjs";
|
|
5
|
+
import { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.cjs";
|
|
6
|
+
import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.cjs";
|
|
5
7
|
import { BlobDatabasePluginConfig, BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.cjs";
|
|
6
8
|
import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.cjs";
|
|
7
9
|
import { CreateDatabasePluginGetUpdateInfoOptions, createDatabasePluginGetUpdateInfo } from "./createDatabasePluginGetUpdateInfo.cjs";
|
|
@@ -15,4 +17,4 @@ import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./q
|
|
|
15
17
|
import { semverSatisfies } from "./semverSatisfies.cjs";
|
|
16
18
|
import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.cjs";
|
|
17
19
|
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.cjs";
|
|
18
|
-
export { AbstractDatabasePlugin,
|
|
20
|
+
export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BasePluginArgs, BlobDatabasePluginConfig, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginGetUpdateInfoOptions, CreateDatabasePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createDatabasePluginGetUpdateInfo, createNodeStoragePlugin, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,8 @@ import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./
|
|
|
2
2
|
import { AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, supportedIosPlatforms } from "./types/index.mjs";
|
|
3
3
|
import { PaginationOptions, calculatePagination } from "./calculatePagination.mjs";
|
|
4
4
|
import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
|
|
5
|
+
import { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
|
|
6
|
+
import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
|
|
5
7
|
import { BlobDatabasePluginConfig, BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.mjs";
|
|
6
8
|
import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.mjs";
|
|
7
9
|
import { CreateDatabasePluginGetUpdateInfoOptions, createDatabasePluginGetUpdateInfo } from "./createDatabasePluginGetUpdateInfo.mjs";
|
|
@@ -15,4 +17,4 @@ import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./q
|
|
|
15
17
|
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
16
18
|
import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.mjs";
|
|
17
19
|
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.mjs";
|
|
18
|
-
export { AbstractDatabasePlugin,
|
|
20
|
+
export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BasePluginArgs, BlobDatabasePluginConfig, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginGetUpdateInfoOptions, CreateDatabasePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createDatabasePluginGetUpdateInfo, createNodeStoragePlugin, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { calculatePagination } from "./calculatePagination.mjs";
|
|
2
2
|
import { detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
|
|
3
|
+
import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
|
|
4
|
+
import { createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
|
|
3
5
|
import { createDatabasePlugin } from "./createDatabasePlugin.mjs";
|
|
4
6
|
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
5
7
|
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
|
|
@@ -14,4 +16,4 @@ import { parseStorageUri } from "./parseStorageUri.mjs";
|
|
|
14
16
|
import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.mjs";
|
|
15
17
|
import { supportedIosPlatforms } from "./types/index.mjs";
|
|
16
18
|
import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.mjs";
|
|
17
|
-
export { assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createDatabasePluginGetUpdateInfo, createNodeStoragePlugin, createRuntimeStoragePlugin, createStorageKeyBuilder, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentType, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
|
19
|
+
export { assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createDatabasePluginGetUpdateInfo, createNodeStoragePlugin, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, semverSatisfies, sortBundles, supportedIosPlatforms };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/legacyAssetStorageLayout.ts
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* Legacy manifest assets were stored below each bundle's `/files` directory
|
|
6
|
+
* using their manifest-relative path. Keep all old-layout path decisions here
|
|
7
|
+
* so support can be removed by deleting this module and the entrypoint branch
|
|
8
|
+
* that imports it.
|
|
9
|
+
*/
|
|
10
|
+
const getLegacyManifestAssetStoragePath = ({ assetPath }) => assetPath;
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.getLegacyManifestAssetStoragePath = getLegacyManifestAssetStoragePath;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/legacyAssetStorageLayout.ts
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*
|
|
5
|
+
* Legacy manifest assets were stored below each bundle's `/files` directory
|
|
6
|
+
* using their manifest-relative path. Keep all old-layout path decisions here
|
|
7
|
+
* so support can be removed by deleting this module and the entrypoint branch
|
|
8
|
+
* that imports it.
|
|
9
|
+
*/
|
|
10
|
+
const getLegacyManifestAssetStoragePath = ({ assetPath }) => assetPath;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getLegacyManifestAssetStoragePath };
|
package/dist/semverSatisfies.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let semver = require("semver");
|
|
3
|
-
semver = require_runtime.__toESM(semver
|
|
3
|
+
semver = require_runtime.__toESM(semver);
|
|
4
4
|
//#region src/semverSatisfies.ts
|
|
5
5
|
const semverSatisfies = (targetAppVersion, currentVersion) => {
|
|
6
6
|
const currentCoerce = semver.default.coerce(currentVersion);
|
package/dist/types/index.d.cts
CHANGED
|
@@ -232,9 +232,19 @@ interface PlatformConfig {
|
|
|
232
232
|
* Android platform configuration.
|
|
233
233
|
*/
|
|
234
234
|
android?: {
|
|
235
|
+
/**
|
|
236
|
+
* Android manifest paths.
|
|
237
|
+
*
|
|
238
|
+
* @default all AndroidManifest.xml files in the android directory
|
|
239
|
+
* @example ["android/app/src/main/AndroidManifest.xml"]
|
|
240
|
+
*/
|
|
241
|
+
androidManifestPaths?: string[];
|
|
235
242
|
/**
|
|
236
243
|
* Android string resource paths.
|
|
237
244
|
*
|
|
245
|
+
* @deprecated Android Hot Updater config is stored in AndroidManifest.xml.
|
|
246
|
+
* This remains supported as a legacy read fallback.
|
|
247
|
+
*
|
|
238
248
|
* @default all strings.xml files in the android directory
|
|
239
249
|
* @example ["android/app/src/main/res/values/strings.xml"]
|
|
240
250
|
*/
|
|
@@ -273,6 +283,12 @@ interface NodeStorageProfile {
|
|
|
273
283
|
upload: (key: string, filePath: string) => Promise<{
|
|
274
284
|
storageUri: string;
|
|
275
285
|
}>;
|
|
286
|
+
/**
|
|
287
|
+
* Returns true when the object can be safely reused by deploy without
|
|
288
|
+
* uploading it again. Providers may validate more than physical existence
|
|
289
|
+
* when runtime access needs an additional readiness check.
|
|
290
|
+
*/
|
|
291
|
+
exists: (storageUri: string) => Promise<boolean>;
|
|
276
292
|
delete: (storageUri: string) => Promise<void>;
|
|
277
293
|
downloadFile: (storageUri: string, filePath: string) => Promise<void>;
|
|
278
294
|
}
|
|
@@ -363,6 +379,13 @@ type SigningConfig = {
|
|
|
363
379
|
privateKeyPath: string;
|
|
364
380
|
};
|
|
365
381
|
type ConfigInput = {
|
|
382
|
+
/**
|
|
383
|
+
* @hidden
|
|
384
|
+
* Local cache directory used by Hot Updater CLI. Set to `null` to disable.
|
|
385
|
+
*
|
|
386
|
+
* @default "node_modules/.hot-updater"
|
|
387
|
+
*/
|
|
388
|
+
cacheDir?: string | null;
|
|
366
389
|
/**
|
|
367
390
|
* The channel used when building the native app.
|
|
368
391
|
* Used to replace __HOT_UPDATER_CHANNEL at build time.
|
package/dist/types/index.d.mts
CHANGED
|
@@ -232,9 +232,19 @@ interface PlatformConfig {
|
|
|
232
232
|
* Android platform configuration.
|
|
233
233
|
*/
|
|
234
234
|
android?: {
|
|
235
|
+
/**
|
|
236
|
+
* Android manifest paths.
|
|
237
|
+
*
|
|
238
|
+
* @default all AndroidManifest.xml files in the android directory
|
|
239
|
+
* @example ["android/app/src/main/AndroidManifest.xml"]
|
|
240
|
+
*/
|
|
241
|
+
androidManifestPaths?: string[];
|
|
235
242
|
/**
|
|
236
243
|
* Android string resource paths.
|
|
237
244
|
*
|
|
245
|
+
* @deprecated Android Hot Updater config is stored in AndroidManifest.xml.
|
|
246
|
+
* This remains supported as a legacy read fallback.
|
|
247
|
+
*
|
|
238
248
|
* @default all strings.xml files in the android directory
|
|
239
249
|
* @example ["android/app/src/main/res/values/strings.xml"]
|
|
240
250
|
*/
|
|
@@ -273,6 +283,12 @@ interface NodeStorageProfile {
|
|
|
273
283
|
upload: (key: string, filePath: string) => Promise<{
|
|
274
284
|
storageUri: string;
|
|
275
285
|
}>;
|
|
286
|
+
/**
|
|
287
|
+
* Returns true when the object can be safely reused by deploy without
|
|
288
|
+
* uploading it again. Providers may validate more than physical existence
|
|
289
|
+
* when runtime access needs an additional readiness check.
|
|
290
|
+
*/
|
|
291
|
+
exists: (storageUri: string) => Promise<boolean>;
|
|
276
292
|
delete: (storageUri: string) => Promise<void>;
|
|
277
293
|
downloadFile: (storageUri: string, filePath: string) => Promise<void>;
|
|
278
294
|
}
|
|
@@ -363,6 +379,13 @@ type SigningConfig = {
|
|
|
363
379
|
privateKeyPath: string;
|
|
364
380
|
};
|
|
365
381
|
type ConfigInput = {
|
|
382
|
+
/**
|
|
383
|
+
* @hidden
|
|
384
|
+
* Local cache directory used by Hot Updater CLI. Set to `null` to disable.
|
|
385
|
+
*
|
|
386
|
+
* @default "node_modules/.hot-updater"
|
|
387
|
+
*/
|
|
388
|
+
cacheDir?: string | null;
|
|
366
389
|
/**
|
|
367
390
|
* The channel used when building the native app.
|
|
368
391
|
* Used to replace __HOT_UPDATER_CHANNEL at build time.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"es-toolkit": "^1.32.0",
|
|
43
43
|
"mime": "^4.0.4",
|
|
44
44
|
"semver": "^7.7.2",
|
|
45
|
-
"@hot-updater/core": "0.
|
|
46
|
-
"@hot-updater/js": "0.
|
|
45
|
+
"@hot-updater/core": "0.32.0",
|
|
46
|
+
"@hot-updater/js": "0.32.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^20",
|
|
50
50
|
"@types/semver": "^7.5.8",
|
|
51
51
|
"typescript": "6.0.2",
|
|
52
|
-
"@hot-updater/test-utils": "0.
|
|
52
|
+
"@hot-updater/test-utils": "0.32.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsdown",
|