hot-updater 0.19.7 → 0.19.9
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 +2 -1
- package/dist/config.d.cts +3 -1
- package/dist/config.d.ts +3 -1
- package/dist/config.js +2 -1
- package/dist/{fingerprint-BlZWmtlc.cjs → fingerprint-BLWMqaEq.cjs} +189 -147
- package/dist/{fingerprint-BcVy8FPD.js → fingerprint-CHhBVEC9.js} +113 -82
- package/dist/index.cjs +34304 -34200
- package/dist/index.js +34219 -34115
- package/dist/{picocolors-DR-zskCv.js → picocolors-OFVOrezl.js} +29 -2
- package/dist/{picocolors--H0eYra-.cjs → picocolors-nLcU57DT.cjs} +39 -2
- package/dist/plugins/babel.cjs +4 -5
- package/dist/plugins/babel.js +1 -2
- package/package.json +8 -8
- package/dist/chunk-BLXvPPr8.js +0 -30
- package/dist/chunk-DWy1uDak.cjs +0 -39
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { __commonJS, __require, __toESM } from "./
|
|
2
|
-
import fs from "fs";
|
|
1
|
+
import { __commonJS, __require, __toESM, require_picocolors } from "./picocolors-OFVOrezl.js";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import fs$1 from "fs";
|
|
4
|
+
import * as p$1 from "@clack/prompts";
|
|
3
5
|
import * as p from "@clack/prompts";
|
|
4
6
|
import { getCwd, loadConfig } from "@hot-updater/plugin-core";
|
|
5
7
|
import path from "path";
|
|
6
|
-
import { createFingerprintAsync } from "@expo/fingerprint";
|
|
7
|
-
import fs$1 from "node:fs";
|
|
8
|
+
import { createFingerprintAsync, diffFingerprintChangesAsync } from "@expo/fingerprint";
|
|
8
9
|
|
|
9
10
|
//#region ../../node_modules/.pnpm/fast-xml-parser@5.2.3/node_modules/fast-xml-parser/src/util.js
|
|
10
11
|
const nameStartChar$1 = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
@@ -1487,7 +1488,7 @@ var AndroidConfigParser = class {
|
|
|
1487
1488
|
});
|
|
1488
1489
|
}
|
|
1489
1490
|
async exists() {
|
|
1490
|
-
return fs.existsSync(this.stringsXmlPath);
|
|
1491
|
+
return fs$1.existsSync(this.stringsXmlPath);
|
|
1491
1492
|
}
|
|
1492
1493
|
async get(key) {
|
|
1493
1494
|
if (!await this.exists()) return {
|
|
@@ -1495,7 +1496,7 @@ var AndroidConfigParser = class {
|
|
|
1495
1496
|
path: path.relative(getCwd(), this.stringsXmlPath)
|
|
1496
1497
|
};
|
|
1497
1498
|
try {
|
|
1498
|
-
const content = await fs.promises.readFile(this.stringsXmlPath, "utf-8");
|
|
1499
|
+
const content = await fs$1.promises.readFile(this.stringsXmlPath, "utf-8");
|
|
1499
1500
|
const result = this.parser.parse(content);
|
|
1500
1501
|
if (!result.resources.string) return {
|
|
1501
1502
|
value: null,
|
|
@@ -1519,7 +1520,7 @@ var AndroidConfigParser = class {
|
|
|
1519
1520
|
console.warn("hot-updater: strings.xml not found. Skipping Android-specific config modifications.");
|
|
1520
1521
|
return { path: null };
|
|
1521
1522
|
}
|
|
1522
|
-
const content = await fs.promises.readFile(this.stringsXmlPath, "utf-8");
|
|
1523
|
+
const content = await fs$1.promises.readFile(this.stringsXmlPath, "utf-8");
|
|
1523
1524
|
try {
|
|
1524
1525
|
const result = this.parser.parse(content);
|
|
1525
1526
|
if (!result.resources.string) result.resources.string = [];
|
|
@@ -1534,7 +1535,7 @@ var AndroidConfigParser = class {
|
|
|
1534
1535
|
else strings.push(stringElement);
|
|
1535
1536
|
result.resources.string = strings.length === 1 ? strings[0] : strings;
|
|
1536
1537
|
const newContent = this.builder.build(result);
|
|
1537
|
-
await fs.promises.writeFile(this.stringsXmlPath, newContent, "utf-8");
|
|
1538
|
+
await fs$1.promises.writeFile(this.stringsXmlPath, newContent, "utf-8");
|
|
1538
1539
|
return { path: path.relative(getCwd(), this.stringsXmlPath) };
|
|
1539
1540
|
} catch (error) {
|
|
1540
1541
|
throw new Error(`Failed to parse or update strings.xml: ${error}`);
|
|
@@ -2359,11 +2360,11 @@ var require_expand = __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_mo
|
|
|
2359
2360
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
2360
2361
|
const walk$1 = (node, parent = {}) => {
|
|
2361
2362
|
node.queue = [];
|
|
2362
|
-
let p$
|
|
2363
|
+
let p$2 = parent;
|
|
2363
2364
|
let q = parent.queue;
|
|
2364
|
-
while (p$
|
|
2365
|
-
p$
|
|
2366
|
-
q = p$
|
|
2365
|
+
while (p$2.type !== "brace" && p$2.type !== "root" && p$2.parent) {
|
|
2366
|
+
p$2 = p$2.parent;
|
|
2367
|
+
q = p$2.queue;
|
|
2367
2368
|
}
|
|
2368
2369
|
if (node.invalid || node.dollar) {
|
|
2369
2370
|
q.push(append(q.pop(), stringify$2(node, options)));
|
|
@@ -4434,7 +4435,7 @@ var require_picomatch$1 = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1
|
|
|
4434
4435
|
* @api public
|
|
4435
4436
|
*/
|
|
4436
4437
|
picomatch$1.parse = (pattern$1, options) => {
|
|
4437
|
-
if (Array.isArray(pattern$1)) return pattern$1.map((p$
|
|
4438
|
+
if (Array.isArray(pattern$1)) return pattern$1.map((p$2) => picomatch$1.parse(p$2, options));
|
|
4438
4439
|
return parse$2(pattern$1, {
|
|
4439
4440
|
...options,
|
|
4440
4441
|
fastpaths: false
|
|
@@ -4621,7 +4622,7 @@ var require_micromatch = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8
|
|
|
4621
4622
|
let matches = result.filter((item) => !omit.has(item));
|
|
4622
4623
|
if (options && matches.length === 0) {
|
|
4623
4624
|
if (options.failglob === true) throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
4624
|
-
if (options.nonull === true || options.nullglob === true) return options.unescape ? patterns.map((p$
|
|
4625
|
+
if (options.nonull === true || options.nullglob === true) return options.unescape ? patterns.map((p$2) => p$2.replace(/\\/g, "")) : patterns;
|
|
4625
4626
|
}
|
|
4626
4627
|
return matches;
|
|
4627
4628
|
};
|
|
@@ -4721,7 +4722,7 @@ var require_micromatch = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8
|
|
|
4721
4722
|
*/
|
|
4722
4723
|
micromatch$1.contains = (str, pattern$1, options) => {
|
|
4723
4724
|
if (typeof str !== "string") throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4724
|
-
if (Array.isArray(pattern$1)) return pattern$1.some((p$
|
|
4725
|
+
if (Array.isArray(pattern$1)) return pattern$1.some((p$2) => micromatch$1.contains(str, p$2, options));
|
|
4725
4726
|
if (typeof pattern$1 === "string") {
|
|
4726
4727
|
if (isEmptyString(str) || isEmptyString(pattern$1)) return false;
|
|
4727
4728
|
if (str.includes(pattern$1) || str.startsWith("./") && str.slice(2).includes(pattern$1)) return true;
|
|
@@ -4842,7 +4843,7 @@ var require_micromatch = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8
|
|
|
4842
4843
|
*/
|
|
4843
4844
|
micromatch$1.all = (str, patterns, options) => {
|
|
4844
4845
|
if (typeof str !== "string") throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
4845
|
-
return [].concat(patterns).every((p$
|
|
4846
|
+
return [].concat(patterns).every((p$2) => picomatch(p$2, options)(str));
|
|
4846
4847
|
};
|
|
4847
4848
|
/**
|
|
4848
4849
|
* Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
|
|
@@ -6083,7 +6084,7 @@ var require_queue = __commonJS({ "../../node_modules/.pnpm/fastq@1.17.1/node_mod
|
|
|
6083
6084
|
queue.drained = drained;
|
|
6084
6085
|
return queue;
|
|
6085
6086
|
function push(value) {
|
|
6086
|
-
var p$
|
|
6087
|
+
var p$2 = new Promise(function(resolve, reject) {
|
|
6087
6088
|
pushCb(value, function(err, result) {
|
|
6088
6089
|
if (err) {
|
|
6089
6090
|
reject(err);
|
|
@@ -6092,11 +6093,11 @@ var require_queue = __commonJS({ "../../node_modules/.pnpm/fastq@1.17.1/node_mod
|
|
|
6092
6093
|
resolve(result);
|
|
6093
6094
|
});
|
|
6094
6095
|
});
|
|
6095
|
-
p$
|
|
6096
|
-
return p$
|
|
6096
|
+
p$2.catch(noop);
|
|
6097
|
+
return p$2;
|
|
6097
6098
|
}
|
|
6098
6099
|
function unshift(value) {
|
|
6099
|
-
var p$
|
|
6100
|
+
var p$2 = new Promise(function(resolve, reject) {
|
|
6100
6101
|
unshiftCb(value, function(err, result) {
|
|
6101
6102
|
if (err) {
|
|
6102
6103
|
reject(err);
|
|
@@ -6105,21 +6106,21 @@ var require_queue = __commonJS({ "../../node_modules/.pnpm/fastq@1.17.1/node_mod
|
|
|
6105
6106
|
resolve(result);
|
|
6106
6107
|
});
|
|
6107
6108
|
});
|
|
6108
|
-
p$
|
|
6109
|
-
return p$
|
|
6109
|
+
p$2.catch(noop);
|
|
6110
|
+
return p$2;
|
|
6110
6111
|
}
|
|
6111
6112
|
function drained() {
|
|
6112
6113
|
if (queue.idle()) return new Promise(function(resolve) {
|
|
6113
6114
|
resolve();
|
|
6114
6115
|
});
|
|
6115
6116
|
var previousDrain = queue.drain;
|
|
6116
|
-
var p$
|
|
6117
|
+
var p$2 = new Promise(function(resolve) {
|
|
6117
6118
|
queue.drain = function() {
|
|
6118
6119
|
previousDrain();
|
|
6119
6120
|
resolve();
|
|
6120
6121
|
};
|
|
6121
6122
|
});
|
|
6122
|
-
return p$
|
|
6123
|
+
return p$2;
|
|
6123
6124
|
}
|
|
6124
6125
|
}
|
|
6125
6126
|
module.exports = fastqueue;
|
|
@@ -7322,7 +7323,7 @@ var require_dom = __commonJS({ "../../node_modules/.pnpm/@xmldom+xmldom@0.8.10/n
|
|
|
7322
7323
|
};
|
|
7323
7324
|
}
|
|
7324
7325
|
function copy(src, dest) {
|
|
7325
|
-
for (var p$
|
|
7326
|
+
for (var p$2 in src) if (Object.prototype.hasOwnProperty.call(src, p$2)) dest[p$2] = src[p$2];
|
|
7326
7327
|
}
|
|
7327
7328
|
/**
|
|
7328
7329
|
^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));?
|
|
@@ -10772,13 +10773,13 @@ var require_sax = __commonJS({ "../../node_modules/.pnpm/@xmldom+xmldom@0.8.10/n
|
|
|
10772
10773
|
start = end$1;
|
|
10773
10774
|
}
|
|
10774
10775
|
}
|
|
10775
|
-
function position$1(p$
|
|
10776
|
-
while (p$
|
|
10776
|
+
function position$1(p$2, m) {
|
|
10777
|
+
while (p$2 >= lineEnd && (m = linePattern.exec(source))) {
|
|
10777
10778
|
lineStart = m.index;
|
|
10778
10779
|
lineEnd = lineStart + m[0].length;
|
|
10779
10780
|
locator.lineNumber++;
|
|
10780
10781
|
}
|
|
10781
|
-
locator.columnNumber = p$
|
|
10782
|
+
locator.columnNumber = p$2 - lineStart + 1;
|
|
10782
10783
|
}
|
|
10783
10784
|
var lineStart = 0;
|
|
10784
10785
|
var lineEnd = 0;
|
|
@@ -10888,14 +10889,14 @@ var require_sax = __commonJS({ "../../node_modules/.pnpm/@xmldom+xmldom@0.8.10/n
|
|
|
10888
10889
|
}
|
|
10889
10890
|
var attrName;
|
|
10890
10891
|
var value;
|
|
10891
|
-
var p$
|
|
10892
|
+
var p$2 = ++start;
|
|
10892
10893
|
var s = S_TAG;
|
|
10893
10894
|
while (true) {
|
|
10894
|
-
var c = source.charAt(p$
|
|
10895
|
+
var c = source.charAt(p$2);
|
|
10895
10896
|
switch (c) {
|
|
10896
10897
|
case "=":
|
|
10897
10898
|
if (s === S_ATTR) {
|
|
10898
|
-
attrName = source.slice(start, p$
|
|
10899
|
+
attrName = source.slice(start, p$2);
|
|
10899
10900
|
s = S_EQ;
|
|
10900
10901
|
} else if (s === S_ATTR_SPACE) s = S_EQ;
|
|
10901
10902
|
else throw new Error("attribute equal must after attrName");
|
|
@@ -10905,26 +10906,26 @@ var require_sax = __commonJS({ "../../node_modules/.pnpm/@xmldom+xmldom@0.8.10/n
|
|
|
10905
10906
|
if (s === S_EQ || s === S_ATTR) {
|
|
10906
10907
|
if (s === S_ATTR) {
|
|
10907
10908
|
errorHandler.warning("attribute value must after \"=\"");
|
|
10908
|
-
attrName = source.slice(start, p$
|
|
10909
|
+
attrName = source.slice(start, p$2);
|
|
10909
10910
|
}
|
|
10910
|
-
start = p$
|
|
10911
|
-
p$
|
|
10912
|
-
if (p$
|
|
10913
|
-
value = source.slice(start, p$
|
|
10911
|
+
start = p$2 + 1;
|
|
10912
|
+
p$2 = source.indexOf(c, start);
|
|
10913
|
+
if (p$2 > 0) {
|
|
10914
|
+
value = source.slice(start, p$2);
|
|
10914
10915
|
addAttribute(attrName, value, start - 1);
|
|
10915
10916
|
s = S_ATTR_END;
|
|
10916
10917
|
} else throw new Error("attribute value no end '" + c + "' match");
|
|
10917
10918
|
} else if (s == S_ATTR_NOQUOT_VALUE) {
|
|
10918
|
-
value = source.slice(start, p$
|
|
10919
|
+
value = source.slice(start, p$2);
|
|
10919
10920
|
addAttribute(attrName, value, start);
|
|
10920
10921
|
errorHandler.warning("attribute \"" + attrName + "\" missed start quot(" + c + ")!!");
|
|
10921
|
-
start = p$
|
|
10922
|
+
start = p$2 + 1;
|
|
10922
10923
|
s = S_ATTR_END;
|
|
10923
10924
|
} else throw new Error("attribute value must after \"=\"");
|
|
10924
10925
|
break;
|
|
10925
10926
|
case "/":
|
|
10926
10927
|
switch (s) {
|
|
10927
|
-
case S_TAG: el.setTagName(source.slice(start, p$
|
|
10928
|
+
case S_TAG: el.setTagName(source.slice(start, p$2));
|
|
10928
10929
|
case S_ATTR_END:
|
|
10929
10930
|
case S_TAG_SPACE:
|
|
10930
10931
|
case S_TAG_CLOSE:
|
|
@@ -10940,17 +10941,17 @@ var require_sax = __commonJS({ "../../node_modules/.pnpm/@xmldom+xmldom@0.8.10/n
|
|
|
10940
10941
|
break;
|
|
10941
10942
|
case "":
|
|
10942
10943
|
errorHandler.error("unexpected end of input");
|
|
10943
|
-
if (s == S_TAG) el.setTagName(source.slice(start, p$
|
|
10944
|
-
return p$
|
|
10944
|
+
if (s == S_TAG) el.setTagName(source.slice(start, p$2));
|
|
10945
|
+
return p$2;
|
|
10945
10946
|
case ">":
|
|
10946
10947
|
switch (s) {
|
|
10947
|
-
case S_TAG: el.setTagName(source.slice(start, p$
|
|
10948
|
+
case S_TAG: el.setTagName(source.slice(start, p$2));
|
|
10948
10949
|
case S_ATTR_END:
|
|
10949
10950
|
case S_TAG_SPACE:
|
|
10950
10951
|
case S_TAG_CLOSE: break;
|
|
10951
10952
|
case S_ATTR_NOQUOT_VALUE:
|
|
10952
10953
|
case S_ATTR:
|
|
10953
|
-
value = source.slice(start, p$
|
|
10954
|
+
value = source.slice(start, p$2);
|
|
10954
10955
|
if (value.slice(-1) === "/") {
|
|
10955
10956
|
el.closed = true;
|
|
10956
10957
|
value = value.slice(0, -1);
|
|
@@ -10967,19 +10968,19 @@ var require_sax = __commonJS({ "../../node_modules/.pnpm/@xmldom+xmldom@0.8.10/n
|
|
|
10967
10968
|
break;
|
|
10968
10969
|
case S_EQ: throw new Error("attribute value missed!!");
|
|
10969
10970
|
}
|
|
10970
|
-
return p$
|
|
10971
|
+
return p$2;
|
|
10971
10972
|
case "": c = " ";
|
|
10972
10973
|
default: if (c <= " ") switch (s) {
|
|
10973
10974
|
case S_TAG:
|
|
10974
|
-
el.setTagName(source.slice(start, p$
|
|
10975
|
+
el.setTagName(source.slice(start, p$2));
|
|
10975
10976
|
s = S_TAG_SPACE;
|
|
10976
10977
|
break;
|
|
10977
10978
|
case S_ATTR:
|
|
10978
|
-
attrName = source.slice(start, p$
|
|
10979
|
+
attrName = source.slice(start, p$2);
|
|
10979
10980
|
s = S_ATTR_SPACE;
|
|
10980
10981
|
break;
|
|
10981
10982
|
case S_ATTR_NOQUOT_VALUE:
|
|
10982
|
-
var value = source.slice(start, p$
|
|
10983
|
+
var value = source.slice(start, p$2);
|
|
10983
10984
|
errorHandler.warning("attribute \"" + value + "\" missed quot(\")!!");
|
|
10984
10985
|
addAttribute(attrName, value, start);
|
|
10985
10986
|
case S_ATTR_END:
|
|
@@ -10991,22 +10992,22 @@ var require_sax = __commonJS({ "../../node_modules/.pnpm/@xmldom+xmldom@0.8.10/n
|
|
|
10991
10992
|
var tagName = el.tagName;
|
|
10992
10993
|
if (!NAMESPACE$1.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) errorHandler.warning("attribute \"" + attrName + "\" missed value!! \"" + attrName + "\" instead2!!");
|
|
10993
10994
|
addAttribute(attrName, attrName, start);
|
|
10994
|
-
start = p$
|
|
10995
|
+
start = p$2;
|
|
10995
10996
|
s = S_ATTR;
|
|
10996
10997
|
break;
|
|
10997
10998
|
case S_ATTR_END: errorHandler.warning("attribute space is required\"" + attrName + "\"!!");
|
|
10998
10999
|
case S_TAG_SPACE:
|
|
10999
11000
|
s = S_ATTR;
|
|
11000
|
-
start = p$
|
|
11001
|
+
start = p$2;
|
|
11001
11002
|
break;
|
|
11002
11003
|
case S_EQ:
|
|
11003
11004
|
s = S_ATTR_NOQUOT_VALUE;
|
|
11004
|
-
start = p$
|
|
11005
|
+
start = p$2;
|
|
11005
11006
|
break;
|
|
11006
11007
|
case S_TAG_CLOSE: throw new Error("elements closed character '/' and '>' must be connected to");
|
|
11007
11008
|
}
|
|
11008
11009
|
}
|
|
11009
|
-
p$
|
|
11010
|
+
p$2++;
|
|
11010
11011
|
}
|
|
11011
11012
|
}
|
|
11012
11013
|
/**
|
|
@@ -14781,7 +14782,7 @@ var IosConfigParser = class {
|
|
|
14781
14782
|
value: null,
|
|
14782
14783
|
path: null
|
|
14783
14784
|
};
|
|
14784
|
-
const plistXml = await fs.promises.readFile(plistFile, "utf-8");
|
|
14785
|
+
const plistXml = await fs$1.promises.readFile(plistFile, "utf-8");
|
|
14785
14786
|
const plistObject = import_plist.default.parse(plistXml);
|
|
14786
14787
|
if (key in plistObject) {
|
|
14787
14788
|
const value = plistObject[key];
|
|
@@ -14815,14 +14816,14 @@ var IosConfigParser = class {
|
|
|
14815
14816
|
console.warn("hot-updater: Info.plist not found. Skipping iOS-specific config modifications.");
|
|
14816
14817
|
return { path: null };
|
|
14817
14818
|
}
|
|
14818
|
-
const plistXml = await fs.promises.readFile(plistFile, "utf-8");
|
|
14819
|
+
const plistXml = await fs$1.promises.readFile(plistFile, "utf-8");
|
|
14819
14820
|
const plistObject = import_plist.default.parse(plistXml);
|
|
14820
14821
|
plistObject[key] = value;
|
|
14821
14822
|
const newPlistXml = import_plist.default.build(plistObject, {
|
|
14822
14823
|
indent: " ",
|
|
14823
14824
|
pretty: true
|
|
14824
14825
|
});
|
|
14825
|
-
await fs.promises.writeFile(plistFile, newPlistXml);
|
|
14826
|
+
await fs$1.promises.writeFile(plistFile, newPlistXml);
|
|
14826
14827
|
return { path: path.relative(getCwd(), plistFile) };
|
|
14827
14828
|
}
|
|
14828
14829
|
};
|
|
@@ -14863,8 +14864,8 @@ function processExtraSources(extraSources, cwd, ignorePaths) {
|
|
|
14863
14864
|
absolute: true,
|
|
14864
14865
|
onlyFiles: false
|
|
14865
14866
|
});
|
|
14866
|
-
for (const absolutePath of matches) if (fs
|
|
14867
|
-
const stats = fs
|
|
14867
|
+
for (const absolutePath of matches) if (fs.existsSync(absolutePath)) {
|
|
14868
|
+
const stats = fs.statSync(absolutePath);
|
|
14868
14869
|
if (stats.isDirectory()) processedSources.push({
|
|
14869
14870
|
type: "dir",
|
|
14870
14871
|
filePath: absolutePath,
|
|
@@ -14873,7 +14874,7 @@ function processExtraSources(extraSources, cwd, ignorePaths) {
|
|
|
14873
14874
|
else processedSources.push({
|
|
14874
14875
|
type: "contents",
|
|
14875
14876
|
id: absolutePath,
|
|
14876
|
-
contents: fs
|
|
14877
|
+
contents: fs.readFileSync(absolutePath, "utf-8"),
|
|
14877
14878
|
reasons: ["custom-user-config"]
|
|
14878
14879
|
});
|
|
14879
14880
|
}
|
|
@@ -14884,7 +14885,28 @@ function processExtraSources(extraSources, cwd, ignorePaths) {
|
|
|
14884
14885
|
}
|
|
14885
14886
|
|
|
14886
14887
|
//#endregion
|
|
14887
|
-
//#region src/utils/fingerprint/
|
|
14888
|
+
//#region src/utils/fingerprint/common.ts
|
|
14889
|
+
const ensureFingerprintConfig = async () => {
|
|
14890
|
+
const config = await loadConfig(null);
|
|
14891
|
+
if (config.updateStrategy === "appVersion") {
|
|
14892
|
+
p$1.log.error("The updateStrategy in hot-updater.config.ts is set to 'appVersion'. This command only works with 'fingerprint' strategy.");
|
|
14893
|
+
process.exit(1);
|
|
14894
|
+
}
|
|
14895
|
+
return config.fingerprint;
|
|
14896
|
+
};
|
|
14897
|
+
function getFingerprintOptions(platform, path$11, options) {
|
|
14898
|
+
return {
|
|
14899
|
+
platforms: [platform],
|
|
14900
|
+
ignorePaths: [
|
|
14901
|
+
"**/android/**/strings.xml",
|
|
14902
|
+
"**/ios/**/*.plist",
|
|
14903
|
+
"**/.gitignore",
|
|
14904
|
+
...options.ignorePaths
|
|
14905
|
+
],
|
|
14906
|
+
extraSources: processExtraSources(options.extraSources, path$11, options.ignorePaths),
|
|
14907
|
+
debug: options.debug
|
|
14908
|
+
};
|
|
14909
|
+
}
|
|
14888
14910
|
function isFingerprintEquals(lhs, rhs) {
|
|
14889
14911
|
if (!lhs || !rhs) return false;
|
|
14890
14912
|
if (isFingerprintResultsObject(lhs) && isFingerprintResultsObject(rhs)) return lhs.android.hash === rhs.android.hash && lhs.ios.hash === rhs.ios.hash;
|
|
@@ -14894,36 +14916,45 @@ function isFingerprintEquals(lhs, rhs) {
|
|
|
14894
14916
|
return typeof result["android"] === "object" && typeof result["ios"] === "object" && !!result["android"]?.hash && !!result["ios"]?.hash;
|
|
14895
14917
|
}
|
|
14896
14918
|
}
|
|
14919
|
+
|
|
14920
|
+
//#endregion
|
|
14921
|
+
//#region src/utils/fingerprint/diff.ts
|
|
14922
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
14923
|
+
async function getFingerprintDiff(oldFingerprint, options) {
|
|
14924
|
+
const projectPath = getCwd();
|
|
14925
|
+
return await diffFingerprintChangesAsync(oldFingerprint, projectPath, getFingerprintOptions(options.platform, projectPath, options));
|
|
14926
|
+
}
|
|
14927
|
+
function getSourcePath(source) {
|
|
14928
|
+
if (source.type === "file" || source.type === "dir") return source.filePath;
|
|
14929
|
+
return source.id || source.type;
|
|
14930
|
+
}
|
|
14931
|
+
function showFingerprintDiff(diff, platform) {
|
|
14932
|
+
if (diff.length === 0) return;
|
|
14933
|
+
p.log.info(`${import_picocolors.default.bold(`${platform} Fingerprint Changes:`)}`);
|
|
14934
|
+
const added = diff.filter((item) => item.op === "added");
|
|
14935
|
+
const removed = diff.filter((item) => item.op === "removed");
|
|
14936
|
+
const changed = diff.filter((item) => item.op === "changed");
|
|
14937
|
+
if (added.length > 0) p.log.info(` ${import_picocolors.default.green("Added:")} ${added.map((item) => getSourcePath(item.addedSource)).join(", ")}`);
|
|
14938
|
+
if (removed.length > 0) p.log.info(` ${import_picocolors.default.red("Removed:")} ${removed.map((item) => getSourcePath(item.removedSource)).join(", ")}`);
|
|
14939
|
+
if (changed.length > 0) p.log.info(` ${import_picocolors.default.yellow("Changed:")} ${changed.map((item) => getSourcePath(item.beforeSource)).join(", ")}`);
|
|
14940
|
+
}
|
|
14941
|
+
|
|
14942
|
+
//#endregion
|
|
14943
|
+
//#region src/utils/fingerprint/index.ts
|
|
14897
14944
|
/**
|
|
14898
14945
|
* Calculates the fingerprint of the native parts project of the project.
|
|
14899
14946
|
*/
|
|
14900
14947
|
async function nativeFingerprint(path$11, options) {
|
|
14901
14948
|
const platform = options.platform;
|
|
14902
|
-
return createFingerprintAsync(path$11,
|
|
14903
|
-
platforms: [platform],
|
|
14904
|
-
ignorePaths: [
|
|
14905
|
-
"**/android/**/strings.xml",
|
|
14906
|
-
"**/ios/**/*.plist",
|
|
14907
|
-
...options.ignorePaths
|
|
14908
|
-
],
|
|
14909
|
-
extraSources: processExtraSources(options.extraSources, path$11, options.ignorePaths),
|
|
14910
|
-
debug: options.debug
|
|
14911
|
-
});
|
|
14949
|
+
return createFingerprintAsync(path$11, getFingerprintOptions(platform, path$11, options));
|
|
14912
14950
|
}
|
|
14913
|
-
const ensureFingerprintConfig = async () => {
|
|
14914
|
-
const config = await loadConfig(null);
|
|
14915
|
-
if (config.updateStrategy === "appVersion") {
|
|
14916
|
-
p.log.error("The updateStrategy in hot-updater.config.ts is set to 'appVersion'. This command only works with 'fingerprint' strategy.");
|
|
14917
|
-
process.exit(1);
|
|
14918
|
-
}
|
|
14919
|
-
return config.fingerprint;
|
|
14920
|
-
};
|
|
14921
14951
|
const generateFingerprints = async () => {
|
|
14922
14952
|
const fingerprintConfig = await ensureFingerprintConfig();
|
|
14923
|
-
const
|
|
14953
|
+
const projectPath = getCwd();
|
|
14954
|
+
const [ios, android] = await Promise.all([nativeFingerprint(projectPath, {
|
|
14924
14955
|
platform: "ios",
|
|
14925
14956
|
...fingerprintConfig
|
|
14926
|
-
}), nativeFingerprint(
|
|
14957
|
+
}), nativeFingerprint(projectPath, {
|
|
14927
14958
|
platform: "android",
|
|
14928
14959
|
...fingerprintConfig
|
|
14929
14960
|
})]);
|
|
@@ -14944,7 +14975,7 @@ const createAndInjectFingerprintFiles = async ({ platform } = {}) => {
|
|
|
14944
14975
|
const FINGERPRINT_FILE_PATH = path.join(getCwd(), "fingerprint.json");
|
|
14945
14976
|
const newFingerprint = await generateFingerprints();
|
|
14946
14977
|
if (!localFingerprint || !platform) {
|
|
14947
|
-
await fs.promises.writeFile(FINGERPRINT_FILE_PATH, JSON.stringify(newFingerprint, null, 2));
|
|
14978
|
+
await fs$1.promises.writeFile(FINGERPRINT_FILE_PATH, JSON.stringify(newFingerprint, null, 2));
|
|
14948
14979
|
await setFingerprintHash("android", newFingerprint.android.hash);
|
|
14949
14980
|
await setFingerprintHash("ios", newFingerprint.ios.hash);
|
|
14950
14981
|
} else {
|
|
@@ -14953,7 +14984,7 @@ const createAndInjectFingerprintFiles = async ({ platform } = {}) => {
|
|
|
14953
14984
|
ios: localFingerprint.ios || newFingerprint.ios,
|
|
14954
14985
|
[platform]: newFingerprint[platform]
|
|
14955
14986
|
};
|
|
14956
|
-
await fs.promises.writeFile(FINGERPRINT_FILE_PATH, JSON.stringify(nextFingerprints, null, 2));
|
|
14987
|
+
await fs$1.promises.writeFile(FINGERPRINT_FILE_PATH, JSON.stringify(nextFingerprints, null, 2));
|
|
14957
14988
|
await setFingerprintHash(platform, newFingerprint[platform].hash);
|
|
14958
14989
|
}
|
|
14959
14990
|
return newFingerprint;
|
|
@@ -14961,7 +14992,7 @@ const createAndInjectFingerprintFiles = async ({ platform } = {}) => {
|
|
|
14961
14992
|
const readLocalFingerprint = async () => {
|
|
14962
14993
|
const FINGERPRINT_FILE_PATH = path.join(getCwd(), "fingerprint.json");
|
|
14963
14994
|
try {
|
|
14964
|
-
const content = await fs.promises.readFile(FINGERPRINT_FILE_PATH, "utf-8");
|
|
14995
|
+
const content = await fs$1.promises.readFile(FINGERPRINT_FILE_PATH, "utf-8");
|
|
14965
14996
|
return JSON.parse(content);
|
|
14966
14997
|
} catch {
|
|
14967
14998
|
return null;
|
|
@@ -14969,4 +15000,4 @@ const readLocalFingerprint = async () => {
|
|
|
14969
15000
|
};
|
|
14970
15001
|
|
|
14971
15002
|
//#endregion
|
|
14972
|
-
export { AndroidConfigParser, IosConfigParser, createAndInjectFingerprintFiles, generateFingerprint, generateFingerprints, isFingerprintEquals, nativeFingerprint, readLocalFingerprint, require_base64_js, require_out, require_plist };
|
|
15003
|
+
export { AndroidConfigParser, IosConfigParser, createAndInjectFingerprintFiles, generateFingerprint, generateFingerprints, getFingerprintDiff, isFingerprintEquals, nativeFingerprint, readLocalFingerprint, require_base64_js, require_out, require_plist, showFingerprintDiff };
|