@hot-updater/plugin-core 0.20.5 → 0.20.6

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
@@ -34,6 +34,7 @@ const node_process = __toESM(require("node:process"));
34
34
  const node_os = __toESM(require("node:os"));
35
35
  const node_tty = __toESM(require("node:tty"));
36
36
  const oxc_transform = __toESM(require("oxc-transform"));
37
+ const semver = __toESM(require("semver"));
37
38
 
38
39
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
39
40
  var require_picocolors = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": ((exports, module) => {
@@ -16803,6 +16804,7 @@ function assembleStyles$1() {
16803
16804
  return styles$2;
16804
16805
  }
16805
16806
  const ansiStyles$1 = assembleStyles$1();
16807
+ var ansi_styles_default$1 = ansiStyles$1;
16806
16808
 
16807
16809
  //#endregion
16808
16810
  //#region ../../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
@@ -16891,6 +16893,7 @@ const supportsColor = {
16891
16893
  stdout: createSupportsColor({ isTTY: node_tty.default.isatty(1) }),
16892
16894
  stderr: createSupportsColor({ isTTY: node_tty.default.isatty(2) })
16893
16895
  };
16896
+ var supports_color_default = supportsColor;
16894
16897
 
16895
16898
  //#endregion
16896
16899
  //#region ../../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
@@ -16923,7 +16926,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
16923
16926
 
16924
16927
  //#endregion
16925
16928
  //#region ../../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
16926
- const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
16929
+ const { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
16927
16930
  const GENERATOR = Symbol("GENERATOR");
16928
16931
  const STYLER = Symbol("STYLER");
16929
16932
  const IS_EMPTY = Symbol("IS_EMPTY");
@@ -16949,7 +16952,7 @@ function createChalk(options) {
16949
16952
  return chalkFactory(options);
16950
16953
  }
16951
16954
  Object.setPrototypeOf(createChalk.prototype, Function.prototype);
16952
- for (const [styleName, style] of Object.entries(ansiStyles$1)) styles$1[styleName] = { get() {
16955
+ for (const [styleName, style] of Object.entries(ansi_styles_default$1)) styles$1[styleName] = { get() {
16953
16956
  const builder$1 = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
16954
16957
  Object.defineProperty(this, styleName, { value: builder$1 });
16955
16958
  return builder$1;
@@ -16961,12 +16964,12 @@ styles$1.visible = { get() {
16961
16964
  } };
16962
16965
  const getModelAnsi = (model, level, type, ...arguments_) => {
16963
16966
  if (model === "rgb") {
16964
- if (level === "ansi16m") return ansiStyles$1[type].ansi16m(...arguments_);
16965
- if (level === "ansi256") return ansiStyles$1[type].ansi256(ansiStyles$1.rgbToAnsi256(...arguments_));
16966
- return ansiStyles$1[type].ansi(ansiStyles$1.rgbToAnsi(...arguments_));
16967
+ if (level === "ansi16m") return ansi_styles_default$1[type].ansi16m(...arguments_);
16968
+ if (level === "ansi256") return ansi_styles_default$1[type].ansi256(ansi_styles_default$1.rgbToAnsi256(...arguments_));
16969
+ return ansi_styles_default$1[type].ansi(ansi_styles_default$1.rgbToAnsi(...arguments_));
16967
16970
  }
16968
- if (model === "hex") return getModelAnsi("rgb", level, type, ...ansiStyles$1.hexToRgb(...arguments_));
16969
- return ansiStyles$1[type][model](...arguments_);
16971
+ if (model === "hex") return getModelAnsi("rgb", level, type, ...ansi_styles_default$1.hexToRgb(...arguments_));
16972
+ return ansi_styles_default$1[type][model](...arguments_);
16970
16973
  };
16971
16974
  const usedModels = [
16972
16975
  "rgb",
@@ -16977,7 +16980,7 @@ for (const model of usedModels) {
16977
16980
  styles$1[model] = { get() {
16978
16981
  const { level } = this;
16979
16982
  return function(...arguments_) {
16980
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansiStyles$1.color.close, this[STYLER]);
16983
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default$1.color.close, this[STYLER]);
16981
16984
  return createBuilder(this, styler, this[IS_EMPTY]);
16982
16985
  };
16983
16986
  } };
@@ -16985,7 +16988,7 @@ for (const model of usedModels) {
16985
16988
  styles$1[bgModel] = { get() {
16986
16989
  const { level } = this;
16987
16990
  return function(...arguments_) {
16988
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansiStyles$1.bgColor.close, this[STYLER]);
16991
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default$1.bgColor.close, this[STYLER]);
16989
16992
  return createBuilder(this, styler, this[IS_EMPTY]);
16990
16993
  };
16991
16994
  } };
@@ -17044,6 +17047,7 @@ const applyStyle = (self$1, string) => {
17044
17047
  Object.defineProperties(createChalk.prototype, styles$1);
17045
17048
  const chalk = createChalk();
17046
17049
  const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
17050
+ var source_default = chalk;
17047
17051
 
17048
17052
  //#endregion
17049
17053
  //#region ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
@@ -17495,6 +17499,7 @@ function assembleStyles() {
17495
17499
  return styles;
17496
17500
  }
17497
17501
  const ansiStyles = assembleStyles();
17502
+ var ansi_styles_default = ansiStyles;
17498
17503
 
17499
17504
  //#endregion
17500
17505
  //#region ../../node_modules/.pnpm/wrap-ansi@9.0.0/node_modules/wrap-ansi/index.js
@@ -17606,7 +17611,7 @@ const exec = (string, columns, options = {}) => {
17606
17611
  escapeCode = code$1 === END_CODE ? void 0 : code$1;
17607
17612
  } else if (groups.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
17608
17613
  }
17609
- const code = ansiStyles.codes.get(Number(escapeCode));
17614
+ const code = ansi_styles_default.codes.get(Number(escapeCode));
17610
17615
  if (pre[index + 1] === "\n") {
17611
17616
  if (escapeUrl) returnValue += wrapAnsiHyperlink("");
17612
17617
  if (escapeCode && code) returnValue += wrapAnsiCode(code);
@@ -17751,7 +17756,7 @@ const makeContentText = (text, { padding, width, textAlignment, height }) => {
17751
17756
  const boxContent = (content, contentWidth, options) => {
17752
17757
  const colorizeBorder = (border) => {
17753
17758
  const newBorder = options.borderColor ? getColorFunction(options.borderColor)(border) : border;
17754
- return options.dimBorder ? chalk.dim(newBorder) : newBorder;
17759
+ return options.dimBorder ? source_default.dim(newBorder) : newBorder;
17755
17760
  };
17756
17761
  const colorizeContent = (content$1) => options.backgroundColor ? getBGColorFunction(options.backgroundColor)(content$1) : content$1;
17757
17762
  const chars = getBorderChars(options.borderStyle);
@@ -17826,9 +17831,9 @@ const determineDimensions = (text, options) => {
17826
17831
  return options;
17827
17832
  };
17828
17833
  const isHex = (color) => color.match(/^#(?:[0-f]{3}){1,2}$/i);
17829
- const isColorValid = (color) => typeof color === "string" && (chalk[color] ?? isHex(color));
17830
- const getColorFunction = (color) => isHex(color) ? chalk.hex(color) : chalk[color];
17831
- const getBGColorFunction = (color) => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(["bg", color])];
17834
+ const isColorValid = (color) => typeof color === "string" && (source_default[color] ?? isHex(color));
17835
+ const getColorFunction = (color) => isHex(color) ? source_default.hex(color) : source_default[color];
17836
+ const getBGColorFunction = (color) => isHex(color) ? source_default.bgHex(color) : source_default[camelCase(["bg", color])];
17832
17837
  function boxen(text, options) {
17833
17838
  options = {
17834
17839
  padding: 0,
@@ -26851,6 +26856,10 @@ function removeBundleInternalKeys(bundle) {
26851
26856
  const { _updateJsonKey, _oldUpdateJsonKey,...pureBundle } = bundle;
26852
26857
  return pureBundle;
26853
26858
  }
26859
+ function isExactVersion(version) {
26860
+ if (!version) return false;
26861
+ return semver.default.valid(version) !== null;
26862
+ }
26854
26863
  /**
26855
26864
  *
26856
26865
  * @param name - The name of the database plugin
@@ -26985,7 +26994,8 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
26985
26994
  changedBundlesByKey[key].push(removeBundleInternalKeys(bundleWithKey));
26986
26995
  pathsToInvalidate.add(`/${key}`);
26987
26996
  if (data.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${data.platform}/${data.fingerprintHash}/${data.channel}/*`);
26988
- else if (data.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${data.targetAppVersion}/${data.channel}/*`);
26997
+ else if (data.targetAppVersion) if (!isExactVersion(data.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/*`);
26998
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${data.targetAppVersion}/${data.channel}/*`);
26989
26999
  continue;
26990
27000
  }
26991
27001
  if (operation === "delete") {
@@ -26999,7 +27009,8 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
26999
27009
  removalsByKey[key].push(bundle$1.id);
27000
27010
  pathsToInvalidate.add(`/${key}`);
27001
27011
  if (bundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle$1.platform}/${bundle$1.fingerprintHash}/${bundle$1.channel}/*`);
27002
- else if (bundle$1.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${bundle$1.targetAppVersion}/${bundle$1.channel}/*`);
27012
+ else if (bundle$1.targetAppVersion) if (!isExactVersion(bundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/*`);
27013
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${bundle$1.targetAppVersion}/${bundle$1.channel}/*`);
27003
27014
  continue;
27004
27015
  }
27005
27016
  let bundle = pendingBundlesMap.get(data.id);
@@ -27036,13 +27047,19 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
27036
27047
  pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${bundle.fingerprintHash}/${oldChannel}/*`);
27037
27048
  pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${bundle.fingerprintHash}/${newChannel$1}/*`);
27038
27049
  }
27039
- if (bundle.targetAppVersion) {
27050
+ if (bundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
27051
+ else {
27040
27052
  pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${oldChannel}/*`);
27041
27053
  pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${newChannel$1}/*`);
27042
27054
  }
27043
27055
  }
27044
- if (bundle.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${bundle.fingerprintHash}/${bundle.channel}/*`);
27045
- else if (bundle.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${bundle.channel}/*`);
27056
+ if (updatedBundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${updatedBundle$1.fingerprintHash}/${updatedBundle$1.channel}/*`);
27057
+ else if (updatedBundle$1.targetAppVersion) {
27058
+ if (!isExactVersion(updatedBundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/*`);
27059
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/${updatedBundle$1.targetAppVersion}/${updatedBundle$1.channel}/*`);
27060
+ if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle$1.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
27061
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${bundle.channel}/*`);
27062
+ }
27046
27063
  continue;
27047
27064
  }
27048
27065
  const currentKey = bundle._updateJsonKey;
@@ -27055,8 +27072,13 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
27055
27072
  changedBundlesByKey[currentKey] = changedBundlesByKey[currentKey] || [];
27056
27073
  changedBundlesByKey[currentKey].push(removeBundleInternalKeys(updatedBundle));
27057
27074
  pathsToInvalidate.add(`/${currentKey}`);
27058
- if (bundle.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${bundle.fingerprintHash}/${bundle.channel}/*`);
27059
- else if (bundle.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${bundle.channel}/*`);
27075
+ if (updatedBundle.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${updatedBundle.platform}/${updatedBundle.fingerprintHash}/${updatedBundle.channel}/*`);
27076
+ else if (updatedBundle.targetAppVersion) {
27077
+ if (!isExactVersion(updatedBundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/*`);
27078
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/${updatedBundle.targetAppVersion}/${updatedBundle.channel}/*`);
27079
+ if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
27080
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${bundle.channel}/*`);
27081
+ }
27060
27082
  }
27061
27083
  }
27062
27084
  for (const oldKey of Object.keys(removalsByKey)) await (async () => {
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ import process$1 from "node:process";
9
9
  import os from "node:os";
10
10
  import tty from "node:tty";
11
11
  import { transform } from "oxc-transform";
12
+ import semver from "semver";
12
13
 
13
14
  //#region rolldown:runtime
14
15
  var __create = Object.create;
@@ -16805,6 +16806,7 @@ function assembleStyles$1() {
16805
16806
  return styles$2;
16806
16807
  }
16807
16808
  const ansiStyles$1 = assembleStyles$1();
16809
+ var ansi_styles_default$1 = ansiStyles$1;
16808
16810
 
16809
16811
  //#endregion
16810
16812
  //#region ../../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
@@ -16893,6 +16895,7 @@ const supportsColor = {
16893
16895
  stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
16894
16896
  stderr: createSupportsColor({ isTTY: tty.isatty(2) })
16895
16897
  };
16898
+ var supports_color_default = supportsColor;
16896
16899
 
16897
16900
  //#endregion
16898
16901
  //#region ../../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
@@ -16925,7 +16928,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
16925
16928
 
16926
16929
  //#endregion
16927
16930
  //#region ../../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
16928
- const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
16931
+ const { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
16929
16932
  const GENERATOR = Symbol("GENERATOR");
16930
16933
  const STYLER = Symbol("STYLER");
16931
16934
  const IS_EMPTY = Symbol("IS_EMPTY");
@@ -16951,7 +16954,7 @@ function createChalk(options) {
16951
16954
  return chalkFactory(options);
16952
16955
  }
16953
16956
  Object.setPrototypeOf(createChalk.prototype, Function.prototype);
16954
- for (const [styleName, style] of Object.entries(ansiStyles$1)) styles$1[styleName] = { get() {
16957
+ for (const [styleName, style] of Object.entries(ansi_styles_default$1)) styles$1[styleName] = { get() {
16955
16958
  const builder$1 = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
16956
16959
  Object.defineProperty(this, styleName, { value: builder$1 });
16957
16960
  return builder$1;
@@ -16963,12 +16966,12 @@ styles$1.visible = { get() {
16963
16966
  } };
16964
16967
  const getModelAnsi = (model, level, type, ...arguments_) => {
16965
16968
  if (model === "rgb") {
16966
- if (level === "ansi16m") return ansiStyles$1[type].ansi16m(...arguments_);
16967
- if (level === "ansi256") return ansiStyles$1[type].ansi256(ansiStyles$1.rgbToAnsi256(...arguments_));
16968
- return ansiStyles$1[type].ansi(ansiStyles$1.rgbToAnsi(...arguments_));
16969
+ if (level === "ansi16m") return ansi_styles_default$1[type].ansi16m(...arguments_);
16970
+ if (level === "ansi256") return ansi_styles_default$1[type].ansi256(ansi_styles_default$1.rgbToAnsi256(...arguments_));
16971
+ return ansi_styles_default$1[type].ansi(ansi_styles_default$1.rgbToAnsi(...arguments_));
16969
16972
  }
16970
- if (model === "hex") return getModelAnsi("rgb", level, type, ...ansiStyles$1.hexToRgb(...arguments_));
16971
- return ansiStyles$1[type][model](...arguments_);
16973
+ if (model === "hex") return getModelAnsi("rgb", level, type, ...ansi_styles_default$1.hexToRgb(...arguments_));
16974
+ return ansi_styles_default$1[type][model](...arguments_);
16972
16975
  };
16973
16976
  const usedModels = [
16974
16977
  "rgb",
@@ -16979,7 +16982,7 @@ for (const model of usedModels) {
16979
16982
  styles$1[model] = { get() {
16980
16983
  const { level } = this;
16981
16984
  return function(...arguments_) {
16982
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansiStyles$1.color.close, this[STYLER]);
16985
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default$1.color.close, this[STYLER]);
16983
16986
  return createBuilder(this, styler, this[IS_EMPTY]);
16984
16987
  };
16985
16988
  } };
@@ -16987,7 +16990,7 @@ for (const model of usedModels) {
16987
16990
  styles$1[bgModel] = { get() {
16988
16991
  const { level } = this;
16989
16992
  return function(...arguments_) {
16990
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansiStyles$1.bgColor.close, this[STYLER]);
16993
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default$1.bgColor.close, this[STYLER]);
16991
16994
  return createBuilder(this, styler, this[IS_EMPTY]);
16992
16995
  };
16993
16996
  } };
@@ -17046,6 +17049,7 @@ const applyStyle = (self$1, string) => {
17046
17049
  Object.defineProperties(createChalk.prototype, styles$1);
17047
17050
  const chalk = createChalk();
17048
17051
  const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
17052
+ var source_default = chalk;
17049
17053
 
17050
17054
  //#endregion
17051
17055
  //#region ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
@@ -17497,6 +17501,7 @@ function assembleStyles() {
17497
17501
  return styles;
17498
17502
  }
17499
17503
  const ansiStyles = assembleStyles();
17504
+ var ansi_styles_default = ansiStyles;
17500
17505
 
17501
17506
  //#endregion
17502
17507
  //#region ../../node_modules/.pnpm/wrap-ansi@9.0.0/node_modules/wrap-ansi/index.js
@@ -17608,7 +17613,7 @@ const exec = (string, columns, options = {}) => {
17608
17613
  escapeCode = code$1 === END_CODE ? void 0 : code$1;
17609
17614
  } else if (groups.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
17610
17615
  }
17611
- const code = ansiStyles.codes.get(Number(escapeCode));
17616
+ const code = ansi_styles_default.codes.get(Number(escapeCode));
17612
17617
  if (pre[index + 1] === "\n") {
17613
17618
  if (escapeUrl) returnValue += wrapAnsiHyperlink("");
17614
17619
  if (escapeCode && code) returnValue += wrapAnsiCode(code);
@@ -17753,7 +17758,7 @@ const makeContentText = (text, { padding, width, textAlignment, height }) => {
17753
17758
  const boxContent = (content, contentWidth, options) => {
17754
17759
  const colorizeBorder = (border) => {
17755
17760
  const newBorder = options.borderColor ? getColorFunction(options.borderColor)(border) : border;
17756
- return options.dimBorder ? chalk.dim(newBorder) : newBorder;
17761
+ return options.dimBorder ? source_default.dim(newBorder) : newBorder;
17757
17762
  };
17758
17763
  const colorizeContent = (content$1) => options.backgroundColor ? getBGColorFunction(options.backgroundColor)(content$1) : content$1;
17759
17764
  const chars = getBorderChars(options.borderStyle);
@@ -17828,9 +17833,9 @@ const determineDimensions = (text, options) => {
17828
17833
  return options;
17829
17834
  };
17830
17835
  const isHex = (color) => color.match(/^#(?:[0-f]{3}){1,2}$/i);
17831
- const isColorValid = (color) => typeof color === "string" && (chalk[color] ?? isHex(color));
17832
- const getColorFunction = (color) => isHex(color) ? chalk.hex(color) : chalk[color];
17833
- const getBGColorFunction = (color) => isHex(color) ? chalk.bgHex(color) : chalk[camelCase(["bg", color])];
17836
+ const isColorValid = (color) => typeof color === "string" && (source_default[color] ?? isHex(color));
17837
+ const getColorFunction = (color) => isHex(color) ? source_default.hex(color) : source_default[color];
17838
+ const getBGColorFunction = (color) => isHex(color) ? source_default.bgHex(color) : source_default[camelCase(["bg", color])];
17834
17839
  function boxen(text, options) {
17835
17840
  options = {
17836
17841
  padding: 0,
@@ -26853,6 +26858,10 @@ function removeBundleInternalKeys(bundle) {
26853
26858
  const { _updateJsonKey, _oldUpdateJsonKey,...pureBundle } = bundle;
26854
26859
  return pureBundle;
26855
26860
  }
26861
+ function isExactVersion(version) {
26862
+ if (!version) return false;
26863
+ return semver.valid(version) !== null;
26864
+ }
26856
26865
  /**
26857
26866
  *
26858
26867
  * @param name - The name of the database plugin
@@ -26987,7 +26996,8 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
26987
26996
  changedBundlesByKey[key].push(removeBundleInternalKeys(bundleWithKey));
26988
26997
  pathsToInvalidate.add(`/${key}`);
26989
26998
  if (data.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${data.platform}/${data.fingerprintHash}/${data.channel}/*`);
26990
- else if (data.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${data.targetAppVersion}/${data.channel}/*`);
26999
+ else if (data.targetAppVersion) if (!isExactVersion(data.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/*`);
27000
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${data.platform}/${data.targetAppVersion}/${data.channel}/*`);
26991
27001
  continue;
26992
27002
  }
26993
27003
  if (operation === "delete") {
@@ -27001,7 +27011,8 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
27001
27011
  removalsByKey[key].push(bundle$1.id);
27002
27012
  pathsToInvalidate.add(`/${key}`);
27003
27013
  if (bundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle$1.platform}/${bundle$1.fingerprintHash}/${bundle$1.channel}/*`);
27004
- else if (bundle$1.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${bundle$1.targetAppVersion}/${bundle$1.channel}/*`);
27014
+ else if (bundle$1.targetAppVersion) if (!isExactVersion(bundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/*`);
27015
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle$1.platform}/${bundle$1.targetAppVersion}/${bundle$1.channel}/*`);
27005
27016
  continue;
27006
27017
  }
27007
27018
  let bundle = pendingBundlesMap.get(data.id);
@@ -27038,13 +27049,19 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
27038
27049
  pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${bundle.fingerprintHash}/${oldChannel}/*`);
27039
27050
  pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${bundle.fingerprintHash}/${newChannel$1}/*`);
27040
27051
  }
27041
- if (bundle.targetAppVersion) {
27052
+ if (bundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
27053
+ else {
27042
27054
  pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${oldChannel}/*`);
27043
27055
  pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${newChannel$1}/*`);
27044
27056
  }
27045
27057
  }
27046
- if (bundle.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${bundle.fingerprintHash}/${bundle.channel}/*`);
27047
- else if (bundle.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${bundle.channel}/*`);
27058
+ if (updatedBundle$1.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${updatedBundle$1.fingerprintHash}/${updatedBundle$1.channel}/*`);
27059
+ else if (updatedBundle$1.targetAppVersion) {
27060
+ if (!isExactVersion(updatedBundle$1.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/*`);
27061
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle$1.platform}/${updatedBundle$1.targetAppVersion}/${updatedBundle$1.channel}/*`);
27062
+ if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle$1.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
27063
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${bundle.channel}/*`);
27064
+ }
27048
27065
  continue;
27049
27066
  }
27050
27067
  const currentKey = bundle._updateJsonKey;
@@ -27057,8 +27074,13 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
27057
27074
  changedBundlesByKey[currentKey] = changedBundlesByKey[currentKey] || [];
27058
27075
  changedBundlesByKey[currentKey].push(removeBundleInternalKeys(updatedBundle));
27059
27076
  pathsToInvalidate.add(`/${currentKey}`);
27060
- if (bundle.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${bundle.platform}/${bundle.fingerprintHash}/${bundle.channel}/*`);
27061
- else if (bundle.targetAppVersion) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${bundle.channel}/*`);
27077
+ if (updatedBundle.fingerprintHash) pathsToInvalidate.add(`${apiBasePath}/fingerprint/${updatedBundle.platform}/${updatedBundle.fingerprintHash}/${updatedBundle.channel}/*`);
27078
+ else if (updatedBundle.targetAppVersion) {
27079
+ if (!isExactVersion(updatedBundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/*`);
27080
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${updatedBundle.platform}/${updatedBundle.targetAppVersion}/${updatedBundle.channel}/*`);
27081
+ if (bundle.targetAppVersion && bundle.targetAppVersion !== updatedBundle.targetAppVersion) if (!isExactVersion(bundle.targetAppVersion)) pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/*`);
27082
+ else pathsToInvalidate.add(`${apiBasePath}/app-version/${bundle.platform}/${bundle.targetAppVersion}/${bundle.channel}/*`);
27083
+ }
27062
27084
  }
27063
27085
  }
27064
27086
  for (const oldKey of Object.keys(removalsByKey)) await (async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.20.5",
3
+ "version": "0.20.6",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -46,17 +46,19 @@
46
46
  "cosmiconfig-typescript-loader": "5.0.0",
47
47
  "fast-glob": "3.3.3",
48
48
  "oxc-transform": "0.82.1",
49
- "@hot-updater/core": "0.20.5"
49
+ "semver": "^7.7.2",
50
+ "@hot-updater/core": "0.20.6"
50
51
  },
51
52
  "devDependencies": {
52
- "@types/node": "^22.7.5",
53
+ "@types/node": "^20",
54
+ "@types/semver": "^7.5.8",
53
55
  "boxen": "^8.0.1",
54
56
  "es-toolkit": "^1.32.0",
55
57
  "jszip": "^3.10.1",
56
- "picocolors": "^1.0.0",
58
+ "picocolors": "1.1.1",
57
59
  "typescript": "5.8.2",
58
60
  "workspace-tools": "^0.36.4",
59
- "@hot-updater/plugin-core": "0.20.5"
61
+ "@hot-updater/plugin-core": "0.20.6"
60
62
  },
61
63
  "scripts": {
62
64
  "build": "tsdown",