@hot-updater/plugin-core 0.18.1 → 0.18.2

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.js CHANGED
@@ -106,7 +106,7 @@ var require_picocolors = __commonJS({ "../../node_modules/.pnpm/picocolors@1.1.1
106
106
 
107
107
  //#endregion
108
108
  //#region src/log.ts
109
- var import_picocolors$1 = __toESM(require_picocolors(), 1);
109
+ var import_picocolors$1 = __toESM(require_picocolors());
110
110
  const log = {
111
111
  normal: (message) => console.log(message),
112
112
  success: (message) => console.log(import_picocolors$1.default.green(message)),
@@ -161,7 +161,7 @@ var require_transitiveDeps = __commonJS({ "../../node_modules/.pnpm/workspace-to
161
161
  exports.getTransitiveProviders = exports.getTransitiveConsumers = exports.getDependentMap = void 0;
162
162
  const getPackageDependencies_1$2 = require_getPackageDependencies();
163
163
  const isCachingEnabled_1$4 = require_isCachingEnabled();
164
- const graphCache = new Map();
164
+ const graphCache = /* @__PURE__ */ new Map();
165
165
  function memoizedKey(packages, scope = []) {
166
166
  return JSON.stringify({
167
167
  packages,
@@ -173,7 +173,7 @@ var require_transitiveDeps = __commonJS({ "../../node_modules/.pnpm/workspace-to
173
173
  const key = memoizedKey(packages, scope);
174
174
  if ((0, isCachingEnabled_1$4.isCachingEnabled)() && graphCache.has(key)) return graphCache.get(key);
175
175
  const edges = [];
176
- const visited = new Set();
176
+ const visited = /* @__PURE__ */ new Set();
177
177
  const stack = scope.length > 0 ? [...scope] : Object.keys(packages);
178
178
  while (stack.length > 0) {
179
179
  const pkg = stack.pop();
@@ -192,9 +192,9 @@ var require_transitiveDeps = __commonJS({ "../../node_modules/.pnpm/workspace-to
192
192
  }
193
193
  function getDependentMap$1(packages) {
194
194
  const graph = getPackageGraph(packages);
195
- const map = new Map();
195
+ const map = /* @__PURE__ */ new Map();
196
196
  for (const [from, to] of graph) {
197
- if (!map.has(to)) map.set(to, new Set());
197
+ if (!map.has(to)) map.set(to, /* @__PURE__ */ new Set());
198
198
  if (from) map.get(to).add(from);
199
199
  }
200
200
  return map;
@@ -208,7 +208,7 @@ var require_transitiveDeps = __commonJS({ "../../node_modules/.pnpm/workspace-to
208
208
  function getTransitiveConsumers(targets, packages, scope = []) {
209
209
  const graph = getPackageGraph(packages, scope);
210
210
  const pkgQueue = [...targets];
211
- const visited = new Set();
211
+ const visited = /* @__PURE__ */ new Set();
212
212
  while (pkgQueue.length > 0) {
213
213
  const pkg = pkgQueue.shift();
214
214
  if (!visited.has(pkg)) {
@@ -228,7 +228,7 @@ var require_transitiveDeps = __commonJS({ "../../node_modules/.pnpm/workspace-to
228
228
  function getTransitiveProviders(targets, packages) {
229
229
  const graph = getPackageGraph(packages);
230
230
  const pkgQueue = [...targets];
231
- const visited = new Set();
231
+ const visited = /* @__PURE__ */ new Set();
232
232
  while (pkgQueue.length > 0) {
233
233
  const pkg = pkgQueue.shift();
234
234
  if (!visited.has(pkg)) {
@@ -1310,7 +1310,7 @@ var require_gitUtilities = __commonJS({ "../../node_modules/.pnpm/workspace-tool
1310
1310
  }
1311
1311
  exports.stageAndCommit = stageAndCommit;
1312
1312
  function revertLocalChanges(cwd) {
1313
- const stash = `workspace-tools_${new Date().getTime()}`;
1313
+ const stash = `workspace-tools_${(/* @__PURE__ */ new Date()).getTime()}`;
1314
1314
  (0, git_1$3.git)([
1315
1315
  "stash",
1316
1316
  "push",
@@ -1552,7 +1552,7 @@ var require_getWorkspaceManagerAndRoot = __commonJS({ "../../node_modules/.pnpm/
1552
1552
  const path_1$10 = __importDefault$13(__require("path"));
1553
1553
  const paths_1$1 = require_paths();
1554
1554
  const isCachingEnabled_1$3 = require_isCachingEnabled();
1555
- const workspaceCache = new Map();
1555
+ const workspaceCache = /* @__PURE__ */ new Map();
1556
1556
  /**
1557
1557
  * Files indicating the workspace root for each manager.
1558
1558
  *
@@ -4640,9 +4640,9 @@ var require_micromatch$1 = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0
4640
4640
  const micromatch$2 = (list, patterns, options) => {
4641
4641
  patterns = [].concat(patterns);
4642
4642
  list = [].concat(list);
4643
- let omit = new Set();
4644
- let keep = new Set();
4645
- let items = new Set();
4643
+ let omit = /* @__PURE__ */ new Set();
4644
+ let keep = /* @__PURE__ */ new Set();
4645
+ let items = /* @__PURE__ */ new Set();
4646
4646
  let negatives = 0;
4647
4647
  let onResult = (state) => {
4648
4648
  items.add(state.output);
@@ -4736,7 +4736,7 @@ var require_micromatch$1 = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0
4736
4736
  */
4737
4737
  micromatch$2.not = (list, patterns, options = {}) => {
4738
4738
  patterns = [].concat(patterns).map(String);
4739
- let result = new Set();
4739
+ let result = /* @__PURE__ */ new Set();
4740
4740
  let items = [];
4741
4741
  let onResult = (state) => {
4742
4742
  if (options.onResult) options.onResult(state);
@@ -6357,7 +6357,7 @@ var require_sync$3 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2
6357
6357
  super(...arguments);
6358
6358
  this._scandir = fsScandir$1.scandirSync;
6359
6359
  this._storage = [];
6360
- this._queue = new Set();
6360
+ this._queue = /* @__PURE__ */ new Set();
6361
6361
  }
6362
6362
  read() {
6363
6363
  this._pushToQueue(this._root, this._settings.basePath);
@@ -6744,7 +6744,7 @@ var require_entry$1 = __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.2/nod
6744
6744
  constructor(_settings, _micromatchOptions) {
6745
6745
  this._settings = _settings;
6746
6746
  this._micromatchOptions = _micromatchOptions;
6747
- this.index = new Map();
6747
+ this.index = /* @__PURE__ */ new Map();
6748
6748
  }
6749
6749
  getFilter(positive, negative) {
6750
6750
  const positiveRe = utils$36.pattern.convertPatternsToRe(positive, this._micromatchOptions);
@@ -11065,16 +11065,16 @@ var require_createDependencyMap = __commonJS({ "../../node_modules/.pnpm/workspa
11065
11065
  withPeerDependencies: false
11066
11066
  }) {
11067
11067
  const map = {
11068
- dependencies: new Map(),
11069
- dependents: new Map()
11068
+ dependencies: /* @__PURE__ */ new Map(),
11069
+ dependents: /* @__PURE__ */ new Map()
11070
11070
  };
11071
11071
  const internalPackages = new Set(Object.keys(packages));
11072
11072
  for (const [pkg, info] of Object.entries(packages)) {
11073
11073
  const deps = (0, getPackageDependencies_1.getPackageDependencies)(info, internalPackages, options);
11074
11074
  for (const dep of deps) {
11075
- if (!map.dependencies.has(pkg)) map.dependencies.set(pkg, new Set());
11075
+ if (!map.dependencies.has(pkg)) map.dependencies.set(pkg, /* @__PURE__ */ new Set());
11076
11076
  map.dependencies.get(pkg).add(dep);
11077
- if (!map.dependents.has(dep)) map.dependents.set(dep, new Set());
11077
+ if (!map.dependents.has(dep)) map.dependents.set(dep, /* @__PURE__ */ new Set());
11078
11078
  map.dependents.get(dep).add(pkg);
11079
11079
  }
11080
11080
  }
@@ -11818,9 +11818,9 @@ var require_micromatch = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8
11818
11818
  const micromatch = (list, patterns, options) => {
11819
11819
  patterns = [].concat(patterns);
11820
11820
  list = [].concat(list);
11821
- let omit = new Set();
11822
- let keep = new Set();
11823
- let items = new Set();
11821
+ let omit = /* @__PURE__ */ new Set();
11822
+ let keep = /* @__PURE__ */ new Set();
11823
+ let items = /* @__PURE__ */ new Set();
11824
11824
  let negatives = 0;
11825
11825
  let onResult = (state) => {
11826
11826
  items.add(state.output);
@@ -11914,7 +11914,7 @@ var require_micromatch = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8
11914
11914
  */
11915
11915
  micromatch.not = (list, patterns, options = {}) => {
11916
11916
  patterns = [].concat(patterns).map(String);
11917
- let result = new Set();
11917
+ let result = /* @__PURE__ */ new Set();
11918
11918
  let items = [];
11919
11919
  let onResult = (state) => {
11920
11920
  if (options.onResult) options.onResult(state);
@@ -12196,10 +12196,10 @@ var require_createPackageGraph = __commonJS({ "../../node_modules/.pnpm/workspac
12196
12196
  const micromatch_1$2 = __importDefault$4(require_micromatch());
12197
12197
  function createPackageGraph(packages, filters) {
12198
12198
  /** set of packages being accumulated as the graph is filtered */
12199
- const packageSet = new Set();
12199
+ const packageSet = /* @__PURE__ */ new Set();
12200
12200
  /** array of package names & its dependency being accumulated as the graph is filtered */
12201
12201
  const edges = [];
12202
- const edgeKeys = new Set();
12202
+ const edgeKeys = /* @__PURE__ */ new Set();
12203
12203
  let dependencyMapWithPeerDevDeps = void 0;
12204
12204
  let dependencyMapWithPeerDeps = void 0;
12205
12205
  let dependencyMapWithDevDeps = void 0;
@@ -12270,13 +12270,13 @@ var require_createPackageGraph = __commonJS({ "../../node_modules/.pnpm/workspac
12270
12270
  }
12271
12271
  exports.createPackageGraph = createPackageGraph;
12272
12272
  function visitPackageGraph(packages, dependencyMap, visitor, filter) {
12273
- const visited = new Set();
12273
+ const visited = /* @__PURE__ */ new Set();
12274
12274
  const packageNames = Object.keys(packages);
12275
12275
  const stack = filter ? (0, micromatch_1$2.default)(packageNames, filter.namePatterns) : packageNames;
12276
12276
  while (stack.length > 0) {
12277
12277
  const pkg = stack.pop();
12278
12278
  if (visited.has(pkg)) continue;
12279
- const nextPkgs = new Set();
12279
+ const nextPkgs = /* @__PURE__ */ new Set();
12280
12280
  let dependencies = [];
12281
12281
  let dependents = [];
12282
12282
  if (!filter || filter.includeDependencies) {
@@ -12688,7 +12688,7 @@ var require_lockfile$1 = __commonJS({ "../../node_modules/.pnpm/@yarnpkg+lockfil
12688
12688
  };
12689
12689
  })();
12690
12690
  const artifactFiles = new Set(events.artifactFiles || []);
12691
- const files = new Set();
12691
+ const files = /* @__PURE__ */ new Set();
12692
12692
  for (var _iterator = queue$1, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
12693
12693
  var _ref2;
12694
12694
  if (_isArray) {
@@ -12892,7 +12892,7 @@ var require_lockfile$1 = __commonJS({ "../../node_modules/.pnpm/@yarnpkg+lockfil
12892
12892
  };
12893
12893
  })();
12894
12894
  const artifactFiles = new Set(events.artifactFiles || []);
12895
- const files = new Set();
12895
+ const files = /* @__PURE__ */ new Set();
12896
12896
  for (var _iterator7 = queue$1, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
12897
12897
  var _ref10;
12898
12898
  if (_isArray7) {
@@ -12960,14 +12960,14 @@ var require_lockfile$1 = __commonJS({ "../../node_modules/.pnpm/@yarnpkg+lockfil
12960
12960
  const events = {
12961
12961
  onStart: _events && _events.onStart || noop$1,
12962
12962
  onProgress: _events && _events.onProgress || noop$1,
12963
- possibleExtraneous: _events ? _events.possibleExtraneous : new Set(),
12963
+ possibleExtraneous: _events ? _events.possibleExtraneous : /* @__PURE__ */ new Set(),
12964
12964
  ignoreBasenames: _events && _events.ignoreBasenames || [],
12965
12965
  artifactFiles: _events && _events.artifactFiles || []
12966
12966
  };
12967
12967
  const actions = yield buildActionsForCopy(queue$1, events, events.possibleExtraneous, reporter);
12968
12968
  events.onStart(actions.file.length + actions.symlink.length + actions.link.length);
12969
12969
  const fileActions = actions.file;
12970
- const currentlyWriting = new Map();
12970
+ const currentlyWriting = /* @__PURE__ */ new Map();
12971
12971
  yield (_promise || _load_promise()).queue(fileActions, (() => {
12972
12972
  var _ref18 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) {
12973
12973
  let writePromise;
@@ -13000,7 +13000,7 @@ var require_lockfile$1 = __commonJS({ "../../node_modules/.pnpm/@yarnpkg+lockfil
13000
13000
  const events = {
13001
13001
  onStart: _events && _events.onStart || noop$1,
13002
13002
  onProgress: _events && _events.onProgress || noop$1,
13003
- possibleExtraneous: _events ? _events.possibleExtraneous : new Set(),
13003
+ possibleExtraneous: _events ? _events.possibleExtraneous : /* @__PURE__ */ new Set(),
13004
13004
  artifactFiles: _events && _events.artifactFiles || [],
13005
13005
  ignoreBasenames: []
13006
13006
  };
@@ -13117,7 +13117,7 @@ var require_lockfile$1 = __commonJS({ "../../node_modules/.pnpm/@yarnpkg+lockfil
13117
13117
  };
13118
13118
  })();
13119
13119
  let walk$1 = exports$1.walk = (() => {
13120
- var _ref27 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dir, relativeDir, ignoreBasenames = new Set()) {
13120
+ var _ref27 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dir, relativeDir, ignoreBasenames = /* @__PURE__ */ new Set()) {
13121
13121
  let files = [];
13122
13122
  let filenames = yield readdir$2(dir);
13123
13123
  if (ignoreBasenames.size) filenames = filenames.filter(function(name) {
@@ -13752,7 +13752,7 @@ var require_lockfile$1 = __commonJS({ "../../node_modules/.pnpm/@yarnpkg+lockfil
13752
13752
  }
13753
13753
  getLockfile(patterns) {
13754
13754
  const lockfile = {};
13755
- const seen = new Map();
13755
+ const seen = /* @__PURE__ */ new Map();
13756
13756
  const sortedPatternsKeys = Object.keys(patterns).sort((_misc || _load_misc()).sortAlpha);
13757
13757
  for (var _iterator = sortedPatternsKeys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
13758
13758
  var _ref;
@@ -16248,7 +16248,7 @@ var require_lockfile$1 = __commonJS({ "../../node_modules/.pnpm/@yarnpkg+lockfil
16248
16248
  function debug$1() {
16249
16249
  if (!debug$1.enabled) return;
16250
16250
  var self$1 = debug$1;
16251
- var curr = +new Date();
16251
+ var curr = +/* @__PURE__ */ new Date();
16252
16252
  var ms = curr - (prevTime || curr);
16253
16253
  self$1.diff = ms;
16254
16254
  self$1.prev = prevTime;
@@ -18428,7 +18428,7 @@ var require_lockfile$1 = __commonJS({ "../../node_modules/.pnpm/@yarnpkg+lockfil
18428
18428
  }
18429
18429
  function getDate() {
18430
18430
  if (exports$1.inspectOpts.hideDate) return "";
18431
- else return new Date().toISOString() + " ";
18431
+ else return (/* @__PURE__ */ new Date()).toISOString() + " ";
18432
18432
  }
18433
18433
  /**
18434
18434
  * Invokes `util.format()` with the specified arguments and writes to stderr.
@@ -19519,7 +19519,7 @@ var require_scope = __commonJS({ "../../node_modules/.pnpm/workspace-tools@0.36.
19519
19519
  */
19520
19520
  function getScopedPackages(search, packages) {
19521
19521
  const packageNames = Array.isArray(packages) ? packages : Object.keys(packages);
19522
- const results = new Set();
19522
+ const results = /* @__PURE__ */ new Set();
19523
19523
  const scopedSearch = search.filter((needle) => needle.startsWith("@") || needle.startsWith("!@"));
19524
19524
  if (scopedSearch.length > 0) {
19525
19525
  const matched = (0, micromatch_1$1.default)(packageNames, scopedSearch, { nocase: true });
@@ -19636,7 +19636,7 @@ var require_getPackagesByFiles = __commonJS({ "../../node_modules/.pnpm/workspac
19636
19636
  const workspaceInfo = (0, getWorkspaces_1.getWorkspaces)(workspaceRoot);
19637
19637
  const ignoreSet = new Set((0, micromatch_1.default)(files, ignoreGlobs));
19638
19638
  files = files.filter((change) => !ignoreSet.has(change));
19639
- const packages = new Set();
19639
+ const packages = /* @__PURE__ */ new Set();
19640
19640
  for (const file of files) {
19641
19641
  const candidates = workspaceInfo.filter((pkgPath) => file.indexOf(path_1$1.default.relative(workspaceRoot, pkgPath.path).replace(/\\/g, "/")) === 0);
19642
19642
  if (candidates && candidates.length > 0) {
@@ -19741,7 +19741,7 @@ var require_getAllPackageJsonFiles = __commonJS({ "../../node_modules/.pnpm/work
19741
19741
  const path_1 = __importDefault(__require("path"));
19742
19742
  const getWorkspacePackagePaths_1 = require_getWorkspacePackagePaths();
19743
19743
  const isCachingEnabled_1$1 = require_isCachingEnabled();
19744
- const cache = new Map();
19744
+ const cache = /* @__PURE__ */ new Map();
19745
19745
  /**
19746
19746
  * Get paths to every package.json in the workspace, given a cwd.
19747
19747
  */
@@ -19858,7 +19858,7 @@ var require_lib$3 = __commonJS({ "../../node_modules/.pnpm/workspace-tools@0.36.
19858
19858
 
19859
19859
  //#endregion
19860
19860
  //#region src/cwd.ts
19861
- var import_lib$1 = __toESM(require_lib$3(), 1);
19861
+ var import_lib$1 = __toESM(require_lib$3());
19862
19862
  const getCwd = () => (0, import_lib$1.findPackageRoot)(process.cwd());
19863
19863
 
19864
19864
  //#endregion
@@ -19890,7 +19890,7 @@ function orderBy(arr, criteria, orders) {
19890
19890
  //#endregion
19891
19891
  //#region ../../node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/memoize.mjs
19892
19892
  function memoize(fn, options = {}) {
19893
- const { cache: cache$1 = new Map(), getCacheKey } = options;
19893
+ const { cache: cache$1 = /* @__PURE__ */ new Map(), getCacheKey } = options;
19894
19894
  const memoizedFn = function(arg) {
19895
19895
  const key = getCacheKey ? getCacheKey(arg) : arg;
19896
19896
  if (cache$1.has(key)) return cache$1.get(key);
@@ -20035,7 +20035,7 @@ const copyDirToTmp = async (dir, childDirname) => {
20035
20035
  * @returns A function that creates a database plugin instance
20036
20036
  */
20037
20037
  function createDatabasePlugin(name, abstractPlugin, hooks) {
20038
- const changedMap = new Map();
20038
+ const changedMap = /* @__PURE__ */ new Map();
20039
20039
  const markChanged = (operation, data) => {
20040
20040
  changedMap.set(data.id, {
20041
20041
  operation,
@@ -20100,7 +20100,7 @@ function ansiRegex$1({ onlyFirst = false } = {}) {
20100
20100
  //#endregion
20101
20101
  //#region ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
20102
20102
  const regex = ansiRegex$1();
20103
- function stripAnsi$1(string$1) {
20103
+ function stripAnsi(string$1) {
20104
20104
  if (typeof string$1 !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string$1}\``);
20105
20105
  return string$1.replace(regex, "");
20106
20106
  }
@@ -20141,10 +20141,10 @@ var require_emoji_regex$1 = __commonJS({ "../../node_modules/.pnpm/emoji-regex@1
20141
20141
  var import_emoji_regex = __toESM(require_emoji_regex$1(), 1);
20142
20142
  const segmenter = new Intl.Segmenter();
20143
20143
  const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
20144
- function stringWidth$2(string$1, options = {}) {
20144
+ function stringWidth(string$1, options = {}) {
20145
20145
  if (typeof string$1 !== "string" || string$1.length === 0) return 0;
20146
20146
  const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
20147
- if (!countAnsiEscapeCodes) string$1 = stripAnsi$1(string$1);
20147
+ if (!countAnsiEscapeCodes) string$1 = stripAnsi(string$1);
20148
20148
  if (string$1.length === 0) return 0;
20149
20149
  let width = 0;
20150
20150
  const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
@@ -20229,7 +20229,7 @@ const foregroundColorNames$1 = Object.keys(styles$2.color);
20229
20229
  const backgroundColorNames$1 = Object.keys(styles$2.bgColor);
20230
20230
  const colorNames$1 = [...foregroundColorNames$1, ...backgroundColorNames$1];
20231
20231
  function assembleStyles$1() {
20232
- const codes = new Map();
20232
+ const codes = /* @__PURE__ */ new Map();
20233
20233
  for (const [groupName, group] of Object.entries(styles$2)) {
20234
20234
  for (const [styleName, style] of Object.entries(group)) {
20235
20235
  styles$2[styleName] = {
@@ -20578,7 +20578,7 @@ var source_default = chalk;
20578
20578
  //#region ../../node_modules/.pnpm/widest-line@5.0.0/node_modules/widest-line/index.js
20579
20579
  function widestLine(string$1) {
20580
20580
  let lineWidth = 0;
20581
- for (const line of string$1.split("\n")) lineWidth = Math.max(lineWidth, stringWidth$2(line));
20581
+ for (const line of string$1.split("\n")) lineWidth = Math.max(lineWidth, stringWidth(line));
20582
20582
  return lineWidth;
20583
20583
  }
20584
20584
 
@@ -20786,12 +20786,12 @@ var require_emoji_regex = __commonJS({ "../../node_modules/.pnpm/emoji-regex@8.0
20786
20786
  //#endregion
20787
20787
  //#region ../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js
20788
20788
  var require_string_width = __commonJS({ "../../node_modules/.pnpm/string-width@4.2.3/node_modules/string-width/index.js"(exports, module) {
20789
- const stripAnsi = require_strip_ansi();
20789
+ const stripAnsi$1 = require_strip_ansi();
20790
20790
  const isFullwidthCodePoint = require_is_fullwidth_code_point();
20791
20791
  const emojiRegex = require_emoji_regex();
20792
- const stringWidth$1 = (string$1) => {
20792
+ const stringWidth$2 = (string$1) => {
20793
20793
  if (typeof string$1 !== "string" || string$1.length === 0) return 0;
20794
- string$1 = stripAnsi(string$1);
20794
+ string$1 = stripAnsi$1(string$1);
20795
20795
  if (string$1.length === 0) return 0;
20796
20796
  string$1 = string$1.replace(emojiRegex(), " ");
20797
20797
  let width = 0;
@@ -20804,14 +20804,14 @@ var require_string_width = __commonJS({ "../../node_modules/.pnpm/string-width@4
20804
20804
  }
20805
20805
  return width;
20806
20806
  };
20807
- module.exports = stringWidth$1;
20808
- module.exports.default = stringWidth$1;
20807
+ module.exports = stringWidth$2;
20808
+ module.exports.default = stringWidth$2;
20809
20809
  } });
20810
20810
 
20811
20811
  //#endregion
20812
20812
  //#region ../../node_modules/.pnpm/ansi-align@3.0.1/node_modules/ansi-align/index.js
20813
20813
  var require_ansi_align = __commonJS({ "../../node_modules/.pnpm/ansi-align@3.0.1/node_modules/ansi-align/index.js"(exports, module) {
20814
- const stringWidth = require_string_width();
20814
+ const stringWidth$1 = require_string_width();
20815
20815
  function ansiAlign$1(text, opts) {
20816
20816
  if (!text) return text;
20817
20817
  opts = opts || {};
@@ -20829,7 +20829,7 @@ var require_ansi_align = __commonJS({ "../../node_modules/.pnpm/ansi-align@3.0.1
20829
20829
  let maxWidth = 0;
20830
20830
  text = text.map(function(str) {
20831
20831
  str = String(str);
20832
- width = stringWidth(str);
20832
+ width = stringWidth$1(str);
20833
20833
  maxWidth = Math.max(width, maxWidth);
20834
20834
  return {
20835
20835
  str,
@@ -20922,7 +20922,7 @@ const foregroundColorNames = Object.keys(styles.color);
20922
20922
  const backgroundColorNames = Object.keys(styles.bgColor);
20923
20923
  const colorNames = [...foregroundColorNames, ...backgroundColorNames];
20924
20924
  function assembleStyles() {
20925
- const codes = new Map();
20925
+ const codes = /* @__PURE__ */ new Map();
20926
20926
  for (const [groupName, group] of Object.entries(styles)) {
20927
20927
  for (const [styleName, style] of Object.entries(group)) {
20928
20928
  styles[styleName] = {
@@ -21035,14 +21035,14 @@ const ANSI_SGR_TERMINATOR = "m";
21035
21035
  const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
21036
21036
  const wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
21037
21037
  const wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
21038
- const wordLengths = (string$1) => string$1.split(" ").map((character) => stringWidth$2(character));
21038
+ const wordLengths = (string$1) => string$1.split(" ").map((character) => stringWidth(character));
21039
21039
  const wrapWord = (rows, word, columns) => {
21040
21040
  const characters = [...word];
21041
21041
  let isInsideEscape = false;
21042
21042
  let isInsideLinkEscape = false;
21043
- let visible = stringWidth$2(stripAnsi$1(rows.at(-1)));
21043
+ let visible = stringWidth(stripAnsi(rows.at(-1)));
21044
21044
  for (const [index, character] of characters.entries()) {
21045
- const characterLength = stringWidth$2(character);
21045
+ const characterLength = stringWidth(character);
21046
21046
  if (visible + characterLength <= columns) rows[rows.length - 1] += character;
21047
21047
  else {
21048
21048
  rows.push(character);
@@ -21074,7 +21074,7 @@ const stringVisibleTrimSpacesRight = (string$1) => {
21074
21074
  const words = string$1.split(" ");
21075
21075
  let last = words.length;
21076
21076
  while (last > 0) {
21077
- if (stringWidth$2(words[last - 1]) > 0) break;
21077
+ if (stringWidth(words[last - 1]) > 0) break;
21078
21078
  last--;
21079
21079
  }
21080
21080
  if (last === words.length) return string$1;
@@ -21089,7 +21089,7 @@ const exec = (string$1, columns, options = {}) => {
21089
21089
  let rows = [""];
21090
21090
  for (const [index, word] of string$1.split(" ").entries()) {
21091
21091
  if (options.trim !== false) rows[rows.length - 1] = rows.at(-1).trimStart();
21092
- let rowLength = stringWidth$2(rows.at(-1));
21092
+ let rowLength = stringWidth(rows.at(-1));
21093
21093
  if (index !== 0) {
21094
21094
  if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
21095
21095
  rows.push("");
@@ -21213,7 +21213,7 @@ const getBorderChars = (borderStyle) => {
21213
21213
  };
21214
21214
  const makeTitle = (text, horizontal, alignment) => {
21215
21215
  let title = "";
21216
- const textWidth = stringWidth$2(text);
21216
+ const textWidth = stringWidth(text);
21217
21217
  switch (alignment) {
21218
21218
  case "left": {
21219
21219
  title = text + horizontal.slice(textWidth);
@@ -21248,7 +21248,7 @@ const makeContentText = (text, { padding, width, textAlignment, height }) => {
21248
21248
  const createdLines = wrapAnsi(line, max, { hard: true });
21249
21249
  const alignedLines = (0, import_ansi_align.default)(createdLines, { align: textAlignment });
21250
21250
  const alignedLinesArray = alignedLines.split("\n");
21251
- const longestLength = Math.max(...alignedLinesArray.map((s) => stringWidth$2(s)));
21251
+ const longestLength = Math.max(...alignedLinesArray.map((s) => stringWidth(s)));
21252
21252
  for (const alignedLine of alignedLinesArray) {
21253
21253
  let paddedLine;
21254
21254
  switch (textAlignment) {
@@ -21276,7 +21276,7 @@ const makeContentText = (text, { padding, width, textAlignment, height }) => {
21276
21276
  const paddingRight = PAD.repeat(padding.right);
21277
21277
  lines = lines.map((line) => {
21278
21278
  const newLine = paddingLeft + line + paddingRight;
21279
- return newLine + PAD.repeat(width - stringWidth$2(newLine));
21279
+ return newLine + PAD.repeat(width - stringWidth(newLine));
21280
21280
  });
21281
21281
  if (padding.top > 0) lines = [...Array.from({ length: padding.top }).fill(PAD.repeat(width)), ...lines];
21282
21282
  if (padding.bottom > 0) lines = [...lines, ...Array.from({ length: padding.bottom }).fill(PAD.repeat(width))];
@@ -21338,7 +21338,7 @@ const determineDimensions = (text, options) => {
21338
21338
  options.title = options.title.slice(0, Math.max(0, maxWidth - 2));
21339
21339
  if (options.title) {
21340
21340
  options.title = formatTitle(options.title, options.borderStyle);
21341
- if (stringWidth$2(options.title) > widest) options.width = stringWidth$2(options.title);
21341
+ if (stringWidth(options.title) > widest) options.width = stringWidth(options.title);
21342
21342
  }
21343
21343
  }
21344
21344
  options.width ||= widest;
@@ -21387,7 +21387,7 @@ function boxen(text, options) {
21387
21387
 
21388
21388
  //#endregion
21389
21389
  //#region src/banner.ts
21390
- var import_picocolors = __toESM(require_picocolors(), 1);
21390
+ var import_picocolors = __toESM(require_picocolors());
21391
21391
  const link = (url) => {
21392
21392
  return import_picocolors.default.green(import_picocolors.default.underline(url));
21393
21393
  };
@@ -21439,7 +21439,7 @@ const makeEnv = async (newEnvVars, filePath = ".env") => {
21439
21439
  try {
21440
21440
  const existingContent = await fs$1.readFile(filePath, "utf-8").catch(() => "");
21441
21441
  const lines = existingContent ? existingContent.split("\n") : [];
21442
- const processedKeys = new Set();
21442
+ const processedKeys = /* @__PURE__ */ new Set();
21443
21443
  const updatedLines = [];
21444
21444
  for (let i$3 = 0; i$3 < lines.length; i$3++) {
21445
21445
  const line = lines[i$3] ?? "";
@@ -29512,7 +29512,7 @@ var require_object = __commonJS({ "../../node_modules/.pnpm/jszip@3.10.1/node_mo
29512
29512
  var fileAdd = function(name, data, originalOptions) {
29513
29513
  var dataType = utils$9.getTypeOf(data), parent;
29514
29514
  var o = utils$9.extend(originalOptions || {}, defaults);
29515
- o.date = o.date || new Date();
29515
+ o.date = o.date || /* @__PURE__ */ new Date();
29516
29516
  if (o.compression !== null) o.compression = o.compression.toUpperCase();
29517
29517
  if (typeof o.unixPermissions === "string") o.unixPermissions = parseInt(o.unixPermissions, 8);
29518
29518
  if (o.unixPermissions && o.unixPermissions & 16384) o.dir = true;
@@ -30284,7 +30284,7 @@ var require_lib = __commonJS({ "../../node_modules/.pnpm/jszip@3.10.1/node_modul
30284
30284
 
30285
30285
  //#endregion
30286
30286
  //#region src/createZip.ts
30287
- var import_lib = __toESM(require_lib(), 1);
30287
+ var import_lib = __toESM(require_lib());
30288
30288
  const createZipTargetFiles = async ({ outfile, targetFiles }) => {
30289
30289
  const zip$1 = new import_lib.default();
30290
30290
  await fs$1.rm(outfile, { force: true });
@@ -30345,7 +30345,7 @@ const createZip = async ({ outfile, targetDir, excludeExts = [] }) => {
30345
30345
  }
30346
30346
  await addFiles(targetDir, zip$1);
30347
30347
  zip$1.forEach((_, file) => {
30348
- file.date = new Date(0);
30348
+ file.date = /* @__PURE__ */ new Date(0);
30349
30349
  });
30350
30350
  const content = await zip$1.generateAsync({
30351
30351
  type: "nodebuffer",
@@ -30357,6 +30357,33 @@ const createZip = async ({ outfile, targetDir, excludeExts = [] }) => {
30357
30357
  return outfile;
30358
30358
  };
30359
30359
 
30360
+ //#endregion
30361
+ //#region src/calculatePagination.ts
30362
+ /**
30363
+ * Calculate pagination information based on total count, limit, and offset
30364
+ */
30365
+ function calculatePagination(total, options) {
30366
+ const { limit, offset } = options;
30367
+ if (total === 0) return {
30368
+ total: 0,
30369
+ hasNextPage: false,
30370
+ hasPreviousPage: false,
30371
+ currentPage: 1,
30372
+ totalPages: 0
30373
+ };
30374
+ const currentPage = Math.floor(offset / limit) + 1;
30375
+ const totalPages = Math.ceil(total / limit);
30376
+ const hasNextPage = offset + limit < total;
30377
+ const hasPreviousPage = offset > 0;
30378
+ return {
30379
+ total,
30380
+ hasNextPage,
30381
+ hasPreviousPage,
30382
+ currentPage,
30383
+ totalPages
30384
+ };
30385
+ }
30386
+
30360
30387
  //#endregion
30361
30388
  //#region src/createBlobDatabasePlugin.ts
30362
30389
  function removeBundleInternalKeys(bundle) {
@@ -30375,8 +30402,8 @@ function removeBundleInternalKeys(bundle) {
30375
30402
  * @returns
30376
30403
  */
30377
30404
  const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, uploadObject, deleteObject, invalidatePaths, hooks, apiBasePath }) => {
30378
- const bundlesMap = new Map();
30379
- const pendingBundlesMap = new Map();
30405
+ const bundlesMap = /* @__PURE__ */ new Map();
30406
+ const pendingBundlesMap = /* @__PURE__ */ new Map();
30380
30407
  const PLATFORMS = ["ios", "android"];
30381
30408
  async function reloadBundles(context) {
30382
30409
  bundlesMap.clear();
@@ -30411,7 +30438,7 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
30411
30438
  acc[channel$1].push(key);
30412
30439
  return acc;
30413
30440
  }, {});
30414
- const updatedTargetFiles = new Set();
30441
+ const updatedTargetFiles = /* @__PURE__ */ new Set();
30415
30442
  for (const channel$1 of Object.keys(keysByChannel)) {
30416
30443
  const updateKeys = keysByChannel[channel$1];
30417
30444
  const targetKey = `${channel$1}/${platform}/target-app-versions.json`;
@@ -30448,24 +30475,38 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
30448
30475
  return bundles.find((bundle$1) => bundle$1.id === bundleId) ?? null;
30449
30476
  },
30450
30477
  async getBundles(context, options) {
30451
- let bundles = await reloadBundles(context);
30452
- const { where, limit, offset = 0 } = options ?? {};
30453
- if (where) bundles = bundles.filter((bundle) => {
30478
+ let allBundles = await reloadBundles(context);
30479
+ const { where, limit, offset } = options;
30480
+ if (where) allBundles = allBundles.filter((bundle) => {
30454
30481
  return Object.entries(where).every(([key, value]) => value === void 0 || value === null || bundle[key] === value);
30455
30482
  });
30456
- if (offset > 0) bundles = bundles.slice(offset);
30457
- if (limit) bundles = bundles.slice(0, limit);
30458
- return bundles.map(removeBundleInternalKeys);
30483
+ const total = allBundles.length;
30484
+ const cleanBundles = allBundles.map(removeBundleInternalKeys);
30485
+ let paginatedData = cleanBundles;
30486
+ if (offset > 0) paginatedData = paginatedData.slice(offset);
30487
+ if (limit) paginatedData = paginatedData.slice(0, limit);
30488
+ return {
30489
+ data: paginatedData,
30490
+ pagination: calculatePagination(total, {
30491
+ limit,
30492
+ offset
30493
+ })
30494
+ };
30459
30495
  },
30460
30496
  async getChannels(context) {
30461
- const allBundles = await this.getBundles(context);
30462
- return [...new Set(allBundles.map((bundle) => bundle.channel))];
30497
+ const allBundles = await reloadBundles(context);
30498
+ const total = allBundles.length;
30499
+ const result = await this.getBundles(context, {
30500
+ limit: total,
30501
+ offset: 0
30502
+ });
30503
+ return [...new Set(result.data.map((bundle) => bundle.channel))];
30463
30504
  },
30464
30505
  async commitBundle(context, { changedSets }) {
30465
30506
  if (changedSets.length === 0) return;
30466
30507
  const changedBundlesByKey = {};
30467
30508
  const removalsByKey = {};
30468
- const pathsToInvalidate = new Set();
30509
+ const pathsToInvalidate = /* @__PURE__ */ new Set();
30469
30510
  let isTargetAppVersionChanged = false;
30470
30511
  for (const { operation, data } of changedSets) {
30471
30512
  if (data.targetAppVersion !== void 0) isTargetAppVersionChanged = true;
@@ -30547,7 +30588,7 @@ const createBlobDatabasePlugin = ({ name, getContext, listObjects, loadObject, u
30547
30588
  currentBundles.sort((a, b) => b.id.localeCompare(a.id));
30548
30589
  await uploadObject(context, key, currentBundles);
30549
30590
  })();
30550
- const updatedTargetFilePaths = new Set();
30591
+ const updatedTargetFilePaths = /* @__PURE__ */ new Set();
30551
30592
  if (isTargetAppVersionChanged) for (const platform of PLATFORMS) {
30552
30593
  const updatedPaths = await updateTargetVersionsForPlatform(context, platform);
30553
30594
  for (const path$11 of updatedPaths) updatedTargetFilePaths.add(path$11);
@@ -30567,7 +30608,7 @@ var ConfigBuilder = class {
30567
30608
  storageInfo = null;
30568
30609
  databaseInfo = null;
30569
30610
  intermediateCode = "";
30570
- collectedImports = new Map();
30611
+ collectedImports = /* @__PURE__ */ new Map();
30571
30612
  constructor() {
30572
30613
  this.addImport({
30573
30614
  pkg: "dotenv/config",
@@ -30680,4 +30721,4 @@ export default defineConfig({
30680
30721
  };
30681
30722
 
30682
30723
  //#endregion
30683
- export { ConfigBuilder, banner, copyDirToTmp, createBlobDatabasePlugin, createDatabasePlugin, createZip, createZipTargetFiles, getCwd, link, loadConfig, loadConfigSync, log, makeEnv, printBanner, transformEnv, transformTemplate };
30724
+ export { ConfigBuilder, banner, calculatePagination, copyDirToTmp, createBlobDatabasePlugin, createDatabasePlugin, createZip, createZipTargetFiles, getCwd, link, loadConfig, loadConfigSync, log, makeEnv, printBanner, transformEnv, transformTemplate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -41,7 +41,7 @@
41
41
  "cosmiconfig": "9.0.0",
42
42
  "cosmiconfig-typescript-loader": "5.0.0",
43
43
  "oxc-transform": "0.72.0",
44
- "@hot-updater/core": "0.18.1"
44
+ "@hot-updater/core": "0.18.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^22.7.5",