@mutmutco/installer-launcher 0.1.17 → 1.0.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/launcher.js +15 -6
- package/dist/launcher.sea.cjs +16 -6
- package/package.json +1 -1
package/dist/launcher.js
CHANGED
|
@@ -1243,11 +1243,15 @@ function createInstallerRun(value, options = {}) {
|
|
|
1243
1243
|
const fold = operation === "update" && UPDATE_CHECK_PHASES.has(id) && state !== "fail";
|
|
1244
1244
|
const title = PHASES[fold ? "check" : id][state === "ok" ? 1 : 0];
|
|
1245
1245
|
if (state === "running") {
|
|
1246
|
-
if (
|
|
1247
|
-
|
|
1246
|
+
if (facts.runningTitle !== void 0 && (typeof facts.runningTitle !== "string" || !facts.runningTitle.trim() || /[\r\n\x00-\x1f]/u.test(facts.runningTitle))) {
|
|
1247
|
+
throw new Error("installer run: invalid runningTitle");
|
|
1248
|
+
}
|
|
1249
|
+
const runningTitle = facts.runningTitle?.trim() ?? title;
|
|
1250
|
+
if (face.progress(runningTitle, facts.measure ?? null)) return;
|
|
1251
|
+
if (activeTitle === runningTitle) spinner.say(runningTitle, facts.measure ?? null);
|
|
1248
1252
|
else {
|
|
1249
|
-
activeTitle =
|
|
1250
|
-
spinner.start(
|
|
1253
|
+
activeTitle = runningTitle;
|
|
1254
|
+
spinner.start(runningTitle, facts.measure ?? null);
|
|
1251
1255
|
}
|
|
1252
1256
|
return;
|
|
1253
1257
|
}
|
|
@@ -1806,7 +1810,7 @@ function page(title, body) {
|
|
|
1806
1810
|
}
|
|
1807
1811
|
|
|
1808
1812
|
// src/index.ts
|
|
1809
|
-
var LAUNCHER_VERSION = true ? "0.
|
|
1813
|
+
var LAUNCHER_VERSION = true ? "1.0.0" : readVersionFromPackage();
|
|
1810
1814
|
function defaultPrint(message) {
|
|
1811
1815
|
process.stdout.write(`${message}
|
|
1812
1816
|
`);
|
|
@@ -2090,6 +2094,9 @@ function faceProduct(config) {
|
|
|
2090
2094
|
const known = { mmi: "mmi-hub", jerv: "jerv-hub" };
|
|
2091
2095
|
return known[config.product] ?? config.product;
|
|
2092
2096
|
}
|
|
2097
|
+
function formatMb(bytes) {
|
|
2098
|
+
return (bytes / 1048576).toFixed(1).replace(/\.0$/, "");
|
|
2099
|
+
}
|
|
2093
2100
|
async function installOrUpdate(config, dir, options, print, update) {
|
|
2094
2101
|
const product = faceProduct(config);
|
|
2095
2102
|
const installer = createInstallerRun({
|
|
@@ -2148,7 +2155,8 @@ async function installOrUpdate(config, dir, options, print, update) {
|
|
|
2148
2155
|
const candidateDir = join6(dir, "candidates", candidate);
|
|
2149
2156
|
const onProgress = ({ done, total }) => installer.phase("download", {
|
|
2150
2157
|
state: "running",
|
|
2151
|
-
measure: total ? `${Math.floor(done / total * 100)}% \xB7 ${done}
|
|
2158
|
+
measure: total ? `${Math.floor(done / total * 100)}% \xB7 ${formatMb(done)} of ${formatMb(total)} MB` : `${formatMb(done)} MB`,
|
|
2159
|
+
...total ? { runningTitle: `Downloading ${config.product} ${version} (${formatMb(total)} MB)` } : {}
|
|
2152
2160
|
});
|
|
2153
2161
|
if (!cached) await downloadAndUnpack(config, candidateDir, manifest, accessToken, { fetchImpl, onProgress, cacheDir: dir });
|
|
2154
2162
|
const acquisition = existsSync7(join6(candidateDir, "payload", "payload.json")) ? readAcquisition(join6(candidateDir, "payload")) : null;
|
|
@@ -2502,6 +2510,7 @@ export {
|
|
|
2502
2510
|
LAUNCHER_VERSION,
|
|
2503
2511
|
defaultRunEntry,
|
|
2504
2512
|
ensureFreshToken,
|
|
2513
|
+
formatMb,
|
|
2505
2514
|
readPayloadEntry,
|
|
2506
2515
|
readPayloadRun,
|
|
2507
2516
|
readPayloadVerbs,
|
package/dist/launcher.sea.cjs
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
LAUNCHER_VERSION: () => LAUNCHER_VERSION,
|
|
24
24
|
defaultRunEntry: () => defaultRunEntry,
|
|
25
25
|
ensureFreshToken: () => ensureFreshToken,
|
|
26
|
+
formatMb: () => formatMb,
|
|
26
27
|
readPayloadEntry: () => readPayloadEntry,
|
|
27
28
|
readPayloadRun: () => readPayloadRun,
|
|
28
29
|
readPayloadVerbs: () => readPayloadVerbs,
|
|
@@ -1275,11 +1276,15 @@ function createInstallerRun(value, options = {}) {
|
|
|
1275
1276
|
const fold = operation === "update" && UPDATE_CHECK_PHASES.has(id) && state !== "fail";
|
|
1276
1277
|
const title = PHASES[fold ? "check" : id][state === "ok" ? 1 : 0];
|
|
1277
1278
|
if (state === "running") {
|
|
1278
|
-
if (
|
|
1279
|
-
|
|
1279
|
+
if (facts.runningTitle !== void 0 && (typeof facts.runningTitle !== "string" || !facts.runningTitle.trim() || /[\r\n\x00-\x1f]/u.test(facts.runningTitle))) {
|
|
1280
|
+
throw new Error("installer run: invalid runningTitle");
|
|
1281
|
+
}
|
|
1282
|
+
const runningTitle = facts.runningTitle?.trim() ?? title;
|
|
1283
|
+
if (face.progress(runningTitle, facts.measure ?? null)) return;
|
|
1284
|
+
if (activeTitle === runningTitle) spinner.say(runningTitle, facts.measure ?? null);
|
|
1280
1285
|
else {
|
|
1281
|
-
activeTitle =
|
|
1282
|
-
spinner.start(
|
|
1286
|
+
activeTitle = runningTitle;
|
|
1287
|
+
spinner.start(runningTitle, facts.measure ?? null);
|
|
1283
1288
|
}
|
|
1284
1289
|
return;
|
|
1285
1290
|
}
|
|
@@ -1838,7 +1843,7 @@ function page(title, body) {
|
|
|
1838
1843
|
}
|
|
1839
1844
|
|
|
1840
1845
|
// src/index.ts
|
|
1841
|
-
var LAUNCHER_VERSION = true ? "0.
|
|
1846
|
+
var LAUNCHER_VERSION = true ? "1.0.0" : readVersionFromPackage();
|
|
1842
1847
|
function defaultPrint(message) {
|
|
1843
1848
|
process.stdout.write(`${message}
|
|
1844
1849
|
`);
|
|
@@ -2122,6 +2127,9 @@ function faceProduct(config) {
|
|
|
2122
2127
|
const known = { mmi: "mmi-hub", jerv: "jerv-hub" };
|
|
2123
2128
|
return known[config.product] ?? config.product;
|
|
2124
2129
|
}
|
|
2130
|
+
function formatMb(bytes) {
|
|
2131
|
+
return (bytes / 1048576).toFixed(1).replace(/\.0$/, "");
|
|
2132
|
+
}
|
|
2125
2133
|
async function installOrUpdate(config, dir, options, print, update) {
|
|
2126
2134
|
const product = faceProduct(config);
|
|
2127
2135
|
const installer = createInstallerRun({
|
|
@@ -2180,7 +2188,8 @@ async function installOrUpdate(config, dir, options, print, update) {
|
|
|
2180
2188
|
const candidateDir = (0, import_node_path6.join)(dir, "candidates", candidate);
|
|
2181
2189
|
const onProgress = ({ done, total }) => installer.phase("download", {
|
|
2182
2190
|
state: "running",
|
|
2183
|
-
measure: total ? `${Math.floor(done / total * 100)}% \xB7 ${done}
|
|
2191
|
+
measure: total ? `${Math.floor(done / total * 100)}% \xB7 ${formatMb(done)} of ${formatMb(total)} MB` : `${formatMb(done)} MB`,
|
|
2192
|
+
...total ? { runningTitle: `Downloading ${config.product} ${version} (${formatMb(total)} MB)` } : {}
|
|
2184
2193
|
});
|
|
2185
2194
|
if (!cached) await downloadAndUnpack(config, candidateDir, manifest, accessToken, { fetchImpl, onProgress, cacheDir: dir });
|
|
2186
2195
|
const acquisition = (0, import_node_fs11.existsSync)((0, import_node_path6.join)(candidateDir, "payload", "payload.json")) ? readAcquisition((0, import_node_path6.join)(candidateDir, "payload")) : null;
|
|
@@ -2535,6 +2544,7 @@ if (invokedAsMain) {
|
|
|
2535
2544
|
LAUNCHER_VERSION,
|
|
2536
2545
|
defaultRunEntry,
|
|
2537
2546
|
ensureFreshToken,
|
|
2547
|
+
formatMb,
|
|
2538
2548
|
readPayloadEntry,
|
|
2539
2549
|
readPayloadRun,
|
|
2540
2550
|
readPayloadVerbs,
|
package/package.json
CHANGED