@hot-updater/plugin-core 0.20.14 → 0.20.15

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.cjs CHANGED
@@ -17777,9 +17777,15 @@ function removeBundleInternalKeys(bundle) {
17777
17777
  const { _updateJsonKey, _oldUpdateJsonKey,...pureBundle } = bundle;
17778
17778
  return pureBundle;
17779
17779
  }
17780
+ function normalizeTargetAppVersion(version) {
17781
+ if (!version) return null;
17782
+ return version.replace(/\s+/g, "");
17783
+ }
17780
17784
  function isExactVersion(version) {
17781
17785
  if (!version) return false;
17782
- return semver.default.valid(version) !== null;
17786
+ const normalized = normalizeTargetAppVersion(version);
17787
+ if (!normalized) return false;
17788
+ return semver.default.valid(normalized) !== null;
17783
17789
  }
17784
17790
  /**
17785
17791
  * Get all normalized semver versions for a version string.
@@ -17791,8 +17797,9 @@ function isExactVersion(version) {
17791
17797
  * - "1.2.3" generates ["1.2.3"]
17792
17798
  */
17793
17799
  function getSemverNormalizedVersions(version) {
17794
- const coerced = semver.default.coerce(version);
17795
- if (!coerced) return [version];
17800
+ const normalized = normalizeTargetAppVersion(version) || version;
17801
+ const coerced = semver.default.coerce(normalized);
17802
+ if (!coerced) return [normalized];
17796
17803
  const versions = /* @__PURE__ */ new Set();
17797
17804
  versions.add(coerced.version);
17798
17805
  if (coerced.patch === 0) versions.add(`${coerced.major}.${coerced.minor}`);
@@ -17912,7 +17919,7 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
17912
17919
  for (const { operation, data } of changedSets) {
17913
17920
  if (data.targetAppVersion !== void 0) isTargetAppVersionChanged = true;
17914
17921
  if (operation === "insert") {
17915
- const target = data.targetAppVersion ?? data.fingerprintHash;
17922
+ const target = normalizeTargetAppVersion(data.targetAppVersion) ?? data.fingerprintHash;
17916
17923
  if (!target) throw new Error("target not found");
17917
17924
  const key = `${data.channel}/${data.platform}/${target}/update.json`;
17918
17925
  const bundleWithKey = {
@@ -17956,7 +17963,7 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
17956
17963
  if (operation === "update") {
17957
17964
  const newChannel = data.channel !== void 0 ? data.channel : bundle.channel;
17958
17965
  const newPlatform = data.platform !== void 0 ? data.platform : bundle.platform;
17959
- const target = data.fingerprintHash ?? bundle.fingerprintHash ?? data.targetAppVersion ?? bundle.targetAppVersion;
17966
+ const target = data.fingerprintHash ?? bundle.fingerprintHash ?? normalizeTargetAppVersion(data.targetAppVersion) ?? normalizeTargetAppVersion(bundle.targetAppVersion);
17960
17967
  if (!target) throw new Error("target not found");
17961
17968
  const newKey = `${newChannel}/${newPlatform}/${target}/update.json`;
17962
17969
  if (newKey !== bundle._updateJsonKey) {
@@ -18056,7 +18063,9 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
18056
18063
  for (const path$7 of updatedPaths) updatedTargetFilePaths.add(path$7);
18057
18064
  }
18058
18065
  for (const path$7 of updatedTargetFilePaths) pathsToInvalidate.add(path$7);
18059
- await invalidatePaths(context, Array.from(pathsToInvalidate));
18066
+ const encondedPaths = /* @__PURE__ */ new Set();
18067
+ for (const path$7 of pathsToInvalidate) encondedPaths.add(encodeURI(path$7));
18068
+ await invalidatePaths(context, Array.from(encondedPaths));
18060
18069
  pendingBundlesMap.clear();
18061
18070
  hooks?.onDatabaseUpdated?.();
18062
18071
  }
package/dist/index.js CHANGED
@@ -17768,9 +17768,15 @@ function removeBundleInternalKeys(bundle) {
17768
17768
  const { _updateJsonKey, _oldUpdateJsonKey,...pureBundle } = bundle;
17769
17769
  return pureBundle;
17770
17770
  }
17771
+ function normalizeTargetAppVersion(version) {
17772
+ if (!version) return null;
17773
+ return version.replace(/\s+/g, "");
17774
+ }
17771
17775
  function isExactVersion(version) {
17772
17776
  if (!version) return false;
17773
- return semver.valid(version) !== null;
17777
+ const normalized = normalizeTargetAppVersion(version);
17778
+ if (!normalized) return false;
17779
+ return semver.valid(normalized) !== null;
17774
17780
  }
17775
17781
  /**
17776
17782
  * Get all normalized semver versions for a version string.
@@ -17782,8 +17788,9 @@ function isExactVersion(version) {
17782
17788
  * - "1.2.3" generates ["1.2.3"]
17783
17789
  */
17784
17790
  function getSemverNormalizedVersions(version) {
17785
- const coerced = semver.coerce(version);
17786
- if (!coerced) return [version];
17791
+ const normalized = normalizeTargetAppVersion(version) || version;
17792
+ const coerced = semver.coerce(normalized);
17793
+ if (!coerced) return [normalized];
17787
17794
  const versions = /* @__PURE__ */ new Set();
17788
17795
  versions.add(coerced.version);
17789
17796
  if (coerced.patch === 0) versions.add(`${coerced.major}.${coerced.minor}`);
@@ -17903,7 +17910,7 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
17903
17910
  for (const { operation, data } of changedSets) {
17904
17911
  if (data.targetAppVersion !== void 0) isTargetAppVersionChanged = true;
17905
17912
  if (operation === "insert") {
17906
- const target = data.targetAppVersion ?? data.fingerprintHash;
17913
+ const target = normalizeTargetAppVersion(data.targetAppVersion) ?? data.fingerprintHash;
17907
17914
  if (!target) throw new Error("target not found");
17908
17915
  const key = `${data.channel}/${data.platform}/${target}/update.json`;
17909
17916
  const bundleWithKey = {
@@ -17947,7 +17954,7 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
17947
17954
  if (operation === "update") {
17948
17955
  const newChannel = data.channel !== void 0 ? data.channel : bundle.channel;
17949
17956
  const newPlatform = data.platform !== void 0 ? data.platform : bundle.platform;
17950
- const target = data.fingerprintHash ?? bundle.fingerprintHash ?? data.targetAppVersion ?? bundle.targetAppVersion;
17957
+ const target = data.fingerprintHash ?? bundle.fingerprintHash ?? normalizeTargetAppVersion(data.targetAppVersion) ?? normalizeTargetAppVersion(bundle.targetAppVersion);
17951
17958
  if (!target) throw new Error("target not found");
17952
17959
  const newKey = `${newChannel}/${newPlatform}/${target}/update.json`;
17953
17960
  if (newKey !== bundle._updateJsonKey) {
@@ -18047,7 +18054,9 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
18047
18054
  for (const path$4 of updatedPaths) updatedTargetFilePaths.add(path$4);
18048
18055
  }
18049
18056
  for (const path$4 of updatedTargetFilePaths) pathsToInvalidate.add(path$4);
18050
- await invalidatePaths(context, Array.from(pathsToInvalidate));
18057
+ const encondedPaths = /* @__PURE__ */ new Set();
18058
+ for (const path$4 of pathsToInvalidate) encondedPaths.add(encodeURI(path$4));
18059
+ await invalidatePaths(context, Array.from(encondedPaths));
18051
18060
  pendingBundlesMap.clear();
18052
18061
  hooks?.onDatabaseUpdated?.();
18053
18062
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.20.14",
3
+ "version": "0.20.15",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -47,7 +47,7 @@
47
47
  "fast-glob": "3.3.3",
48
48
  "oxc-transform": "0.82.1",
49
49
  "semver": "^7.7.2",
50
- "@hot-updater/core": "0.20.14"
50
+ "@hot-updater/core": "0.20.15"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^20",
@@ -58,7 +58,7 @@
58
58
  "picocolors": "1.1.1",
59
59
  "typescript": "5.8.2",
60
60
  "workspace-tools": "^0.36.4",
61
- "@hot-updater/plugin-core": "0.20.14"
61
+ "@hot-updater/plugin-core": "0.20.15"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "tsdown",