hot-updater 0.22.2 → 0.23.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/config.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_fingerprint = require('./fingerprint-B-Krd3Gt.cjs');
1
+ const require_fingerprint = require('./fingerprint-BHiixsXU.cjs');
2
2
 
3
3
  //#region src/config.ts
4
4
  const defineConfig = (config) => {
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as generateFingerprints, n as createFingerprintJSON, o as readLocalFingerprint, r as generateFingerprint, t as createAndInjectFingerprintFiles } from "./fingerprint-CrCon-HQ.js";
1
+ import { i as generateFingerprints, n as createFingerprintJSON, o as readLocalFingerprint, r as generateFingerprint, t as createAndInjectFingerprintFiles } from "./fingerprint-11-3nNgi.js";
2
2
 
3
3
  //#region src/config.ts
4
4
  const defineConfig = (config) => {
@@ -1530,6 +1530,28 @@ var AndroidConfigParser = class {
1530
1530
  paths: searchedPaths
1531
1531
  };
1532
1532
  }
1533
+ async remove(key) {
1534
+ const existingPaths = this.getExistingPaths();
1535
+ if (existingPaths.length === 0) return { paths: [] };
1536
+ const updatedPaths = [];
1537
+ for (const stringsXmlPath of existingPaths) try {
1538
+ const content = await fs.promises.readFile(stringsXmlPath, "utf-8");
1539
+ const result = this.parser.parse(content);
1540
+ if (!result.resources.string) continue;
1541
+ const strings = Array.isArray(result.resources.string) ? result.resources.string : [result.resources.string];
1542
+ const existingIndex = strings.findIndex((str) => str["@_name"] === key && str["@_moduleConfig"] === "true");
1543
+ if (existingIndex === -1) continue;
1544
+ strings.splice(existingIndex, 1);
1545
+ if (strings.length === 0) result.resources.string = void 0;
1546
+ else result.resources.string = strings.length === 1 ? strings[0] : strings;
1547
+ const newContent = this.builder.build(result);
1548
+ await fs.promises.writeFile(stringsXmlPath, newContent, "utf-8");
1549
+ updatedPaths.push(path.relative(getCwd(), stringsXmlPath));
1550
+ } catch (error) {
1551
+ throw new Error(`Failed to remove key from strings.xml: ${error}`);
1552
+ }
1553
+ return { paths: updatedPaths };
1554
+ }
1533
1555
  async set(key, value) {
1534
1556
  const existingPaths = this.getExistingPaths();
1535
1557
  if (existingPaths.length === 0) {
@@ -9107,6 +9129,29 @@ var IosConfigParser = class {
9107
9129
  paths: searchedPaths
9108
9130
  };
9109
9131
  }
9132
+ async remove(key) {
9133
+ const plistPaths = this.getPlistPaths();
9134
+ if (plistPaths.length === 0) return { paths: [] };
9135
+ const updatedPaths = [];
9136
+ for (const plistFile of plistPaths) {
9137
+ const relativePath = path.relative(getCwd(), plistFile);
9138
+ try {
9139
+ const plistXml = await fs.promises.readFile(plistFile, "utf-8");
9140
+ const plistObject = import_plist.default.parse(plistXml);
9141
+ if (!(key in plistObject)) continue;
9142
+ delete plistObject[key];
9143
+ const newPlistXml = import_plist.default.build(plistObject, {
9144
+ indent: " ",
9145
+ pretty: true
9146
+ });
9147
+ await fs.promises.writeFile(plistFile, newPlistXml);
9148
+ updatedPaths.push(relativePath);
9149
+ } catch (error) {
9150
+ throw new Error(`Failed to remove key from Info.plist at '${relativePath}': ${error instanceof Error ? error.message : String(error)}`);
9151
+ }
9152
+ }
9153
+ return { paths: updatedPaths };
9154
+ }
9110
9155
  async set(key, value) {
9111
9156
  const plistPaths = this.getPlistPaths();
9112
9157
  if (plistPaths.length === 0) {
@@ -1507,6 +1507,28 @@ var AndroidConfigParser = class {
1507
1507
  paths: searchedPaths
1508
1508
  };
1509
1509
  }
1510
+ async remove(key) {
1511
+ const existingPaths = this.getExistingPaths();
1512
+ if (existingPaths.length === 0) return { paths: [] };
1513
+ const updatedPaths = [];
1514
+ for (const stringsXmlPath of existingPaths) try {
1515
+ const content = await fs.default.promises.readFile(stringsXmlPath, "utf-8");
1516
+ const result = this.parser.parse(content);
1517
+ if (!result.resources.string) continue;
1518
+ const strings = Array.isArray(result.resources.string) ? result.resources.string : [result.resources.string];
1519
+ const existingIndex = strings.findIndex((str) => str["@_name"] === key && str["@_moduleConfig"] === "true");
1520
+ if (existingIndex === -1) continue;
1521
+ strings.splice(existingIndex, 1);
1522
+ if (strings.length === 0) result.resources.string = void 0;
1523
+ else result.resources.string = strings.length === 1 ? strings[0] : strings;
1524
+ const newContent = this.builder.build(result);
1525
+ await fs.default.promises.writeFile(stringsXmlPath, newContent, "utf-8");
1526
+ updatedPaths.push(path.default.relative((0, __hot_updater_cli_tools.getCwd)(), stringsXmlPath));
1527
+ } catch (error) {
1528
+ throw new Error(`Failed to remove key from strings.xml: ${error}`);
1529
+ }
1530
+ return { paths: updatedPaths };
1531
+ }
1510
1532
  async set(key, value) {
1511
1533
  const existingPaths = this.getExistingPaths();
1512
1534
  if (existingPaths.length === 0) {
@@ -9084,6 +9106,29 @@ var IosConfigParser = class {
9084
9106
  paths: searchedPaths
9085
9107
  };
9086
9108
  }
9109
+ async remove(key) {
9110
+ const plistPaths = this.getPlistPaths();
9111
+ if (plistPaths.length === 0) return { paths: [] };
9112
+ const updatedPaths = [];
9113
+ for (const plistFile of plistPaths) {
9114
+ const relativePath = path.default.relative((0, __hot_updater_cli_tools.getCwd)(), plistFile);
9115
+ try {
9116
+ const plistXml = await fs.default.promises.readFile(plistFile, "utf-8");
9117
+ const plistObject = import_plist.default.parse(plistXml);
9118
+ if (!(key in plistObject)) continue;
9119
+ delete plistObject[key];
9120
+ const newPlistXml = import_plist.default.build(plistObject, {
9121
+ indent: " ",
9122
+ pretty: true
9123
+ });
9124
+ await fs.default.promises.writeFile(plistFile, newPlistXml);
9125
+ updatedPaths.push(relativePath);
9126
+ } catch (error) {
9127
+ throw new Error(`Failed to remove key from Info.plist at '${relativePath}': ${error instanceof Error ? error.message : String(error)}`);
9128
+ }
9129
+ }
9130
+ return { paths: updatedPaths };
9131
+ }
9087
9132
  async set(key, value) {
9088
9133
  const plistPaths = this.getPlistPaths();
9089
9134
  if (plistPaths.length === 0) {