@hot-updater/firebase 0.35.12 → 0.36.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.
@@ -32,7 +32,7 @@ path = __toESM(path);
32
32
  let firebase_admin_storage = require("firebase-admin/storage");
33
33
  //#endregion
34
34
  //#region ../../packages/server/dist/version.mjs
35
- const HOT_UPDATER_SERVER_VERSION = "0.35.12";
35
+ const HOT_UPDATER_SERVER_VERSION = "0.36.0";
36
36
  //#endregion
37
37
  //#region ../../packages/server/dist/internalRouter.mjs
38
38
  const normalizePath = (path) => {
@@ -2345,6 +2345,8 @@ const getContentAddressedAssetStoragePath = ({ assetPath, fileHash }) => {
2345
2345
  const getLegacyManifestAssetStoragePath = ({ assetPath }) => assetPath;
2346
2346
  //#endregion
2347
2347
  //#region ../plugin-core/dist/assetStorageLayout.mjs
2348
+ const isBrotliManifestAssetPath = (assetPath) => /(^|\/)index\.[^/]+\.bundle$/.test(assetPath.replace(/\\/g, "/"));
2349
+ const getManifestAssetDownloadPath = (assetPath) => isBrotliManifestAssetPath(assetPath) ? `${assetPath}.br` : assetPath;
2348
2350
  const createStorageUriWithRelativePath = ({ baseStorageUri, relativePath }) => {
2349
2351
  const storageUrl = new URL(baseStorageUri);
2350
2352
  storageUrl.pathname = `${storageUrl.pathname.replace(/\/+$/, "")}/${relativePath.replace(/\\/g, "/").split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
@@ -3538,21 +3540,39 @@ const createProfiledStoragePlugin = ({ createProfiles, name, profileShape, suppo
3538
3540
  return runtime;
3539
3541
  };
3540
3542
  const profiles = {};
3541
- if (profileShape?.node) profiles.node = {
3542
- async delete(storageUri) {
3543
- return requireNodeProfile().delete(storageUri);
3544
- },
3545
- async downloadFile(storageUri, filePath) {
3546
- return requireNodeProfile().downloadFile(storageUri, filePath);
3547
- },
3548
- async exists(storageUri) {
3549
- return requireNodeProfile().exists(storageUri);
3550
- },
3551
- async upload(key, filePath) {
3552
- return requireNodeProfile().upload(key, filePath);
3553
- }
3554
- };
3555
- else if (profileShape?.node !== false) Object.defineProperty(profiles, "node", {
3543
+ if (profileShape?.node) {
3544
+ const nodeProfile = {
3545
+ async delete(storageUri) {
3546
+ return requireNodeProfile().delete(storageUri);
3547
+ },
3548
+ async downloadFile(storageUri, filePath) {
3549
+ return requireNodeProfile().downloadFile(storageUri, filePath);
3550
+ },
3551
+ async exists(storageUri) {
3552
+ return requireNodeProfile().exists(storageUri);
3553
+ },
3554
+ async upload(key, filePath) {
3555
+ return requireNodeProfile().upload(key, filePath);
3556
+ }
3557
+ };
3558
+ Object.defineProperties(nodeProfile, {
3559
+ deleteObjects: {
3560
+ enumerable: true,
3561
+ get: () => {
3562
+ const deleteObjects = requireNodeProfile().deleteObjects;
3563
+ return deleteObjects ? (keys) => deleteObjects(keys) : void 0;
3564
+ }
3565
+ },
3566
+ listObjects: {
3567
+ enumerable: true,
3568
+ get: () => {
3569
+ const listObjects = requireNodeProfile().listObjects;
3570
+ return listObjects ? (prefix) => listObjects(prefix) : void 0;
3571
+ }
3572
+ }
3573
+ });
3574
+ profiles.node = nodeProfile;
3575
+ } else if (profileShape?.node !== false) Object.defineProperty(profiles, "node", {
3556
3576
  enumerable: true,
3557
3577
  get: getNodeProfile
3558
3578
  });
@@ -3649,7 +3669,6 @@ function assertRuntimeStoragePlugin(plugin) {
3649
3669
  //#endregion
3650
3670
  //#region ../../packages/server/dist/db/updateArtifacts.mjs
3651
3671
  const HBC_ASSET_PATH_RE = /\.bundle$/;
3652
- const BR_COMPRESSED_ASSET_PATH_RE = /(^|\/)index\.[^/]+\.bundle$/;
3653
3672
  const resolveUniqueHbcAssetPath = (manifest) => {
3654
3673
  const candidates = Object.keys(manifest.assets).sort((left, right) => left.localeCompare(right)).filter((candidate) => HBC_ASSET_PATH_RE.test(candidate));
3655
3674
  return candidates.length === 1 ? candidates[0] : null;
@@ -3691,10 +3710,11 @@ async function resolveChangedAssets({ assetBaseStorageUri, currentManifest, curr
3691
3710
  });
3692
3711
  const changedEntries = await Promise.all(Object.entries(targetManifest.assets).map(async ([assetPath, asset]) => {
3693
3712
  if ((currentManifest?.assets[assetPath])?.fileHash === asset.fileHash) return null;
3694
- const usesBrotliAsset = BR_COMPRESSED_ASSET_PATH_RE.test(assetPath);
3713
+ const downloadPath = getManifestAssetDownloadPath(assetPath);
3714
+ const usesBrotliAsset = downloadPath !== assetPath;
3695
3715
  const storageUri = resolveManifestAssetStorageUri({
3696
3716
  assetBaseStorageUri,
3697
- assetPath: usesBrotliAsset ? `${assetPath}.br` : assetPath,
3717
+ assetPath: downloadPath,
3698
3718
  fileHash: asset.fileHash
3699
3719
  });
3700
3720
  const patch = patchDescriptor?.assetPath === assetPath ? patchDescriptor.patch : null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/firebase",
3
3
  "type": "module",
4
- "version": "0.35.12",
4
+ "version": "0.36.0",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "types": "dist/index.d.cts",
@@ -43,10 +43,10 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "hono": "4.12.9",
46
- "@hot-updater/core": "0.35.12",
47
- "@hot-updater/cli-tools": "0.35.12",
48
- "@hot-updater/plugin-core": "0.35.12",
49
- "@hot-updater/server": "0.35.12"
46
+ "@hot-updater/cli-tools": "0.36.0",
47
+ "@hot-updater/core": "0.36.0",
48
+ "@hot-updater/plugin-core": "0.36.0",
49
+ "@hot-updater/server": "0.36.0"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
@@ -61,9 +61,9 @@
61
61
  "firebase-tools": "^13.32.0",
62
62
  "fkill": "^9.0.0",
63
63
  "mime": "^4.0.4",
64
- "@hot-updater/test-utils": "0.35.12",
65
- "@hot-updater/js": "0.35.12",
66
- "@hot-updater/mock": "0.35.12"
64
+ "@hot-updater/js": "0.36.0",
65
+ "@hot-updater/mock": "0.36.0",
66
+ "@hot-updater/test-utils": "0.36.0"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "firebase-admin": "*",