muon-ui 0.8.0 → 0.9.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/README.md +9 -13
- package/dist/cli.cjs +48 -32
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/native/linux-amd64/muon-bootstrap +0 -0
- package/dist/native/linux-amd64/muon-builder +0 -0
- package/dist/native/linux-arm64/muon-bootstrap +0 -0
- package/dist/native/linux-arm64/muon-builder +0 -0
- package/dist/native/linux-armhf/muon-bootstrap +0 -0
- package/dist/native/linux-armhf/muon-builder +0 -0
- package/dist/native/muon-256.png +0 -0
- package/dist/native/windows-amd64/muon-bootstrap.exe +0 -0
- package/dist/native/windows-amd64/muon-builder.exe +0 -0
- package/dist/native/windows-i686/muon-bootstrap.exe +0 -0
- package/dist/native/windows-i686/muon-builder.exe +0 -0
- package/dist/runtime/linux-amd64/libmuon-ui.so +0 -0
- package/dist/runtime/linux-amd64/muon-core +0 -0
- package/dist/runtime/linux-arm64/libmuon-ui.so +0 -0
- package/dist/runtime/linux-arm64/muon-core +0 -0
- package/dist/runtime/linux-armhf/libmuon-ui.so +0 -0
- package/dist/runtime/linux-armhf/muon-core +0 -0
- package/dist/runtime/windows-amd64/libcardio.dll +0 -0
- package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
- package/dist/runtime/windows-amd64/muon-core.exe +0 -0
- package/dist/runtime/windows-i686/libcardio.dll +0 -0
- package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
- package/dist/runtime/windows-i686/muon-core.exe +0 -0
- package/dist/{vite-internals-ChWiL2TL.cjs → vite-internals-HXgH7b5M.cjs} +291 -75
- package/dist/vite-internals-HXgH7b5M.cjs.map +1 -0
- package/dist/vite.cjs +446 -6
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +748 -115
- package/dist/vite.mjs.map +1 -1
- package/muon.d.ts +12 -0
- package/package.json +7 -7
- package/vite.d.ts +118 -8
- package/dist/native/muon-bootstrap.png +0 -0
- package/dist/vite-internals-ChWiL2TL.cjs.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: muon-ui
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.9.0
|
|
4
4
|
* description: A multi-platform GUI application framework that uses CEF as its backend
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/muon-ui.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 3437b522a51d8772713b72722b109c5ff30fc711
|
|
9
9
|
*/
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
11
|
var __create = Object.create;
|
|
@@ -148,6 +148,20 @@ Object.fromEntries(allMuonTargets.map((target) => [targetDescriptors[target].cef
|
|
|
148
148
|
*/
|
|
149
149
|
var getMuonTargetDescriptor = (target) => targetDescriptors[target];
|
|
150
150
|
/**
|
|
151
|
+
* Returns the runtime app identifier embedded for one target distribution.
|
|
152
|
+
*
|
|
153
|
+
* @param appId Base sanitized application identifier.
|
|
154
|
+
* @param target Public Muon target.
|
|
155
|
+
* @returns Target runtime application identifier.
|
|
156
|
+
*
|
|
157
|
+
* @remarks Windows targets append their public architecture name so 32-bit and
|
|
158
|
+
* 64-bit packages do not share runtime state or installer identities.
|
|
159
|
+
*/
|
|
160
|
+
var getMuonTargetRuntimeAppId = (appId, target) => {
|
|
161
|
+
const descriptor = getMuonTargetDescriptor(target);
|
|
162
|
+
return descriptor.os === "windows" ? `${appId}.${descriptor.arch}` : appId;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
151
165
|
* Normalizes a user supplied public Muon target.
|
|
152
166
|
*
|
|
153
167
|
* @param target Target value supplied by the user.
|
|
@@ -1741,6 +1755,8 @@ var encodeTaggedBytes = (tag, bytes) => Buffer.concat([
|
|
|
1741
1755
|
]);
|
|
1742
1756
|
var isJsonObject$4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1743
1757
|
var isPath = (path, first, second) => path.length === 2 && path[0] === first && path[1] === second;
|
|
1758
|
+
var isPluginSignaturePath = (path) => path.length === 3 && path[0] === "plugin" && path[1] === "plugins" && path[2] === "signature";
|
|
1759
|
+
var isPluginSaltPath = (path) => path.length === 3 && path[0] === "plugin" && path[1] === "plugins" && path[2] === "salt";
|
|
1744
1760
|
var isHexString = (value) => value.length % 2 === 0 && /^[0-9a-fA-F]*$/.test(value);
|
|
1745
1761
|
var decodeHexString = (value) => {
|
|
1746
1762
|
const bytes = Buffer.alloc(value.length / 2);
|
|
@@ -1750,6 +1766,8 @@ var decodeHexString = (value) => {
|
|
|
1750
1766
|
var encodeKnownBinaryString = (path, value) => {
|
|
1751
1767
|
if (isPath(path, "asset", "signature")) return value.length === 40 && isHexString(value) ? decodeHexString(value) : void 0;
|
|
1752
1768
|
if (isPath(path, "asset", "salt")) return isHexString(value) ? decodeHexString(value) : void 0;
|
|
1769
|
+
if (isPluginSignaturePath(path)) return value.length === 40 && isHexString(value) ? decodeHexString(value) : void 0;
|
|
1770
|
+
if (isPluginSaltPath(path)) return isHexString(value) ? decodeHexString(value) : void 0;
|
|
1753
1771
|
if (isPath(path, "browser", "backgroundColor")) {
|
|
1754
1772
|
const hex = value.startsWith("#") ? value.slice(1) : value;
|
|
1755
1773
|
return hex.length === 6 && isHexString(hex) ? decodeHexString(hex) : void 0;
|
|
@@ -1797,8 +1815,8 @@ var encodeMuonConfigTlv = (config) => encodeTlvValue(config, []);
|
|
|
1797
1815
|
*/
|
|
1798
1816
|
var createMuonEmbeddedConfigSlot = (payload = void 0) => {
|
|
1799
1817
|
if (payload !== void 0 && payload.length > muonEmbeddedConfigPayloadCapacity) throw new Error(`Encoded muon config exceeds the embedded slot capacity: ${payload.length} > ${muonEmbeddedConfigPayloadCapacity}`);
|
|
1800
|
-
|
|
1801
|
-
|
|
1818
|
+
if (payload === void 0) return createEmptySlot();
|
|
1819
|
+
const slot = (0, node_crypto.randomBytes)(muonEmbeddedConfigSlotSize);
|
|
1802
1820
|
Buffer.from(payload).copy(slot, 0);
|
|
1803
1821
|
return slot;
|
|
1804
1822
|
};
|
|
@@ -1810,9 +1828,12 @@ var createMuonEmbeddedConfigSlot = (payload = void 0) => {
|
|
|
1810
1828
|
*/
|
|
1811
1829
|
var createMuonBootstrapEmbeddedConfigSlot = (payload = void 0) => {
|
|
1812
1830
|
if (payload !== void 0 && payload.length > muonBootstrapEmbeddedConfigPayloadCapacity) throw new Error(`Encoded muon config exceeds the embedded bootstrap slot capacity: ${payload.length} > ${muonBootstrapEmbeddedConfigPayloadCapacity}`);
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1831
|
+
if (payload === void 0) {
|
|
1832
|
+
const slot = Buffer.alloc(muonBootstrapEmbeddedConfigSlotSize, 0);
|
|
1833
|
+
muonBootstrapEmbeddedConfigEmptySlotMarker.copy(slot, 0);
|
|
1834
|
+
return slot;
|
|
1835
|
+
}
|
|
1836
|
+
const slot = (0, node_crypto.randomBytes)(muonBootstrapEmbeddedConfigSlotSize);
|
|
1816
1837
|
Buffer.from(payload).copy(slot, 0);
|
|
1817
1838
|
return slot;
|
|
1818
1839
|
};
|
|
@@ -1886,7 +1907,7 @@ var findMuonBootstrapEmbeddedConfigSlot = (content) => {
|
|
|
1886
1907
|
if (candidate === void 0) throw new Error("Embedded muon-bootstrap config slot was not found.");
|
|
1887
1908
|
return candidate;
|
|
1888
1909
|
};
|
|
1889
|
-
var fileExists$
|
|
1910
|
+
var fileExists$5 = async (path) => {
|
|
1890
1911
|
try {
|
|
1891
1912
|
return (await (0, node_fs_promises.stat)(path)).isFile();
|
|
1892
1913
|
} catch {
|
|
@@ -1902,10 +1923,10 @@ var resolveMuonConfigInputPath = async (configPath) => {
|
|
|
1902
1923
|
"muon.json"
|
|
1903
1924
|
]) {
|
|
1904
1925
|
const candidate = (0, node_path.join)(directory, fileName);
|
|
1905
|
-
if (await fileExists$
|
|
1926
|
+
if (await fileExists$5(candidate)) return candidate;
|
|
1906
1927
|
}
|
|
1907
1928
|
}
|
|
1908
|
-
if (!await fileExists$
|
|
1929
|
+
if (!await fileExists$5(configPath)) throw new Error(`muon config does not exist: ${configPath}`);
|
|
1909
1930
|
return configPath;
|
|
1910
1931
|
};
|
|
1911
1932
|
var readMuonConfigInput = async (configPath) => {
|
|
@@ -2192,6 +2213,68 @@ var createIco = (images) => {
|
|
|
2192
2213
|
return Buffer.concat([header, ...imageData]);
|
|
2193
2214
|
};
|
|
2194
2215
|
//#endregion
|
|
2216
|
+
//#region src/app-icon.ts
|
|
2217
|
+
/**
|
|
2218
|
+
* ZIP entry used for the generated static application icon asset.
|
|
2219
|
+
*/
|
|
2220
|
+
var appIconAssetEntryName = "main/.muon/app-icon.png";
|
|
2221
|
+
/**
|
|
2222
|
+
* Runtime asset URL injected as the generated initial title bar icon.
|
|
2223
|
+
*/
|
|
2224
|
+
var appIconAssetUrl = "asset://main/.muon/app-icon.png";
|
|
2225
|
+
/**
|
|
2226
|
+
* Creates a static application icon source from API or CLI options.
|
|
2227
|
+
*/
|
|
2228
|
+
var createAppIconOptionsSource = (iconPath, directory, label = "iconPath") => {
|
|
2229
|
+
if (iconPath === void 0) return;
|
|
2230
|
+
if (typeof iconPath !== "string") throw new Error(`${label} must be a string when present.`);
|
|
2231
|
+
if (iconPath.trim() === "") return;
|
|
2232
|
+
return {
|
|
2233
|
+
iconPath: iconPath.trim(),
|
|
2234
|
+
directory
|
|
2235
|
+
};
|
|
2236
|
+
};
|
|
2237
|
+
/**
|
|
2238
|
+
* Reads the top-level `iconPath` from a Muon config object.
|
|
2239
|
+
*/
|
|
2240
|
+
var readConfigAppIconSource = (config, directory, label) => {
|
|
2241
|
+
const value = config.iconPath;
|
|
2242
|
+
if (value === void 0) return;
|
|
2243
|
+
if (typeof value !== "string") throw new Error(`${label} iconPath must be a string when present.`);
|
|
2244
|
+
return createAppIconOptionsSource(value, directory);
|
|
2245
|
+
};
|
|
2246
|
+
/**
|
|
2247
|
+
* Reads the top-level `iconPath` from project metadata.
|
|
2248
|
+
*/
|
|
2249
|
+
var readProjectAppIconSource = (projectJson, directory) => {
|
|
2250
|
+
const value = projectJson.iconPath;
|
|
2251
|
+
return typeof value === "string" ? createAppIconOptionsSource(value, directory) : void 0;
|
|
2252
|
+
};
|
|
2253
|
+
/**
|
|
2254
|
+
* Resolves and validates the first available static application icon source.
|
|
2255
|
+
*/
|
|
2256
|
+
var resolveMuonAppIconPath = async (sources) => {
|
|
2257
|
+
for (const source of sources) {
|
|
2258
|
+
const iconPath = resolveResourcePath$2(source.directory, source.iconPath);
|
|
2259
|
+
await assertMuonAppIconPath(iconPath);
|
|
2260
|
+
return iconPath;
|
|
2261
|
+
}
|
|
2262
|
+
};
|
|
2263
|
+
var assertMuonAppIconPath = async (iconPath) => {
|
|
2264
|
+
if ((0, node_path.extname)(iconPath).toLowerCase() !== ".png") throw new Error(`Muon app icon must be a .png file: ${iconPath}`);
|
|
2265
|
+
if (!await fileExists$4(iconPath)) throw new Error(`Muon app icon does not exist: ${iconPath}`);
|
|
2266
|
+
await createNormalizedIconPngData(await (0, node_fs_promises.readFile)(iconPath), iconPath, "Muon app icon");
|
|
2267
|
+
};
|
|
2268
|
+
var resolveResourcePath$2 = (directory, value) => (0, node_path.isAbsolute)(value) ? value : (0, node_path.resolve)(directory, value);
|
|
2269
|
+
var fileExists$4 = async (path) => {
|
|
2270
|
+
try {
|
|
2271
|
+
await (0, node_fs_promises.access)(path, node_fs.constants.F_OK);
|
|
2272
|
+
return true;
|
|
2273
|
+
} catch {
|
|
2274
|
+
return false;
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
//#endregion
|
|
2195
2278
|
//#region src/windows-resource.ts
|
|
2196
2279
|
var defaultConfigFileNames$1 = [
|
|
2197
2280
|
"muon.json5",
|
|
@@ -2211,7 +2294,7 @@ var readMuonConfigForWindowsResource = async (root, configPath) => {
|
|
|
2211
2294
|
directory: root
|
|
2212
2295
|
};
|
|
2213
2296
|
return {
|
|
2214
|
-
config: await readJsonObjectFile$
|
|
2297
|
+
config: await readJsonObjectFile$2(resolvedConfigPath, "Muon config file"),
|
|
2215
2298
|
directory: (0, node_path.dirname)(resolvedConfigPath)
|
|
2216
2299
|
};
|
|
2217
2300
|
};
|
|
@@ -2236,13 +2319,22 @@ var mergeMuonWindowsResourceOptions = (primary, fallback) => {
|
|
|
2236
2319
|
* Resolves Windows resource metadata from options, config files, and package metadata.
|
|
2237
2320
|
*/
|
|
2238
2321
|
var resolveMuonWindowsResource = async (input) => {
|
|
2239
|
-
const projectJson = await readProjectJson(input.root);
|
|
2240
|
-
const
|
|
2322
|
+
const projectJson = await readProjectJson$1(input.root);
|
|
2323
|
+
const windowsSources = [
|
|
2241
2324
|
createOptionsSource$1(input.options, input.root, "windowsResource"),
|
|
2242
2325
|
readConfigWindowsResourceSource(input.muonConfig, input.muonConfigDirectory, "muon.json"),
|
|
2326
|
+
readConfigWindowsResourceSource(projectJson, input.root, "project.json")
|
|
2327
|
+
].filter((source) => source !== void 0);
|
|
2328
|
+
const sources = [
|
|
2329
|
+
...windowsSources,
|
|
2243
2330
|
createProjectSource(projectJson, input.root),
|
|
2244
2331
|
createPackageSource(input.packageJson, input.root)
|
|
2245
2332
|
].filter((source) => source !== void 0);
|
|
2333
|
+
const appIconSources = [
|
|
2334
|
+
createAppIconOptionsSource(input.appIconPath, input.root),
|
|
2335
|
+
readConfigAppIconSource(input.muonConfig, input.muonConfigDirectory, "muon.json"),
|
|
2336
|
+
readProjectAppIconSource(projectJson, input.root)
|
|
2337
|
+
].filter((source) => source !== void 0);
|
|
2246
2338
|
const productName = resolveStringField$1(sources, "productName", input.defaults.productName);
|
|
2247
2339
|
const fileDescription = resolveStringField$1(sources, "fileDescription", input.defaults.fileDescription);
|
|
2248
2340
|
const companyName = resolveStringField$1(sources, "companyName", input.defaults.companyName);
|
|
@@ -2252,7 +2344,7 @@ var resolveMuonWindowsResource = async (input) => {
|
|
|
2252
2344
|
const codePage = resolveNumericField(sources, "codePage", defaultCodePage);
|
|
2253
2345
|
const fixedVersion = normalizeWindowsVersion(version);
|
|
2254
2346
|
return {
|
|
2255
|
-
iconPath: await
|
|
2347
|
+
iconPath: await resolveWindowsIconPath(windowsSources, appIconSources, await resolveDefaultWindowsIcon(input.packageDirectory)),
|
|
2256
2348
|
productName,
|
|
2257
2349
|
fileDescription,
|
|
2258
2350
|
companyName,
|
|
@@ -2289,15 +2381,24 @@ var isWindowsPeExecutable = async (path) => {
|
|
|
2289
2381
|
* Applies resolved resource metadata to a Windows PE executable in place.
|
|
2290
2382
|
*/
|
|
2291
2383
|
var updateWindowsPeResources = async (input) => {
|
|
2384
|
+
return await updateWindowsPeResourceFile(input, createEngraverUpdate);
|
|
2385
|
+
};
|
|
2386
|
+
/**
|
|
2387
|
+
* Applies only resolved icon metadata to a Windows PE executable in place.
|
|
2388
|
+
*/
|
|
2389
|
+
var updateWindowsPeIconResource = async (input) => {
|
|
2390
|
+
return await updateWindowsPeResourceFile(input, createEngraverIconUpdate);
|
|
2391
|
+
};
|
|
2392
|
+
var updateWindowsPeResourceFile = async (input, createUpdate) => {
|
|
2292
2393
|
if (!await isWindowsPeExecutable(input.executablePath)) return false;
|
|
2293
2394
|
const mode = (await (0, node_fs_promises.stat)(input.executablePath)).mode & 511;
|
|
2294
2395
|
const tempDirectory = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "muon-windows-resource-"));
|
|
2295
2396
|
const updatesJsonPath = (0, node_path.join)(tempDirectory, "updates.json");
|
|
2296
2397
|
const outputPath = (0, node_path.join)(tempDirectory, "output.exe");
|
|
2297
|
-
const iconPath =
|
|
2398
|
+
const iconPath = (0, node_path.join)(tempDirectory, "icon.ico");
|
|
2298
2399
|
try {
|
|
2299
|
-
|
|
2300
|
-
await (0, node_fs_promises.writeFile)(updatesJsonPath, `${JSON.stringify(
|
|
2400
|
+
await createWindowsIconFromPngFile(input.resource.iconPath, iconPath);
|
|
2401
|
+
await (0, node_fs_promises.writeFile)(updatesJsonPath, `${JSON.stringify(createUpdate(input.resource, iconPath), null, 2)}\n`);
|
|
2301
2402
|
await runMuonPrepareResourceUpdate({
|
|
2302
2403
|
inputPath: input.executablePath,
|
|
2303
2404
|
updatesJsonPath,
|
|
@@ -2338,13 +2439,15 @@ var createEngraverUpdate = (resource, iconPath) => {
|
|
|
2338
2439
|
},
|
|
2339
2440
|
strings
|
|
2340
2441
|
},
|
|
2341
|
-
icons: iconPath
|
|
2342
|
-
id: 1,
|
|
2343
|
-
language: resource.language,
|
|
2344
|
-
path: iconPath
|
|
2345
|
-
}]
|
|
2442
|
+
icons: createEngraverIcons(resource, iconPath)
|
|
2346
2443
|
};
|
|
2347
2444
|
};
|
|
2445
|
+
var createEngraverIconUpdate = (resource, iconPath) => ({ icons: createEngraverIcons(resource, iconPath) });
|
|
2446
|
+
var createEngraverIcons = (resource, iconPath) => [{
|
|
2447
|
+
id: 1,
|
|
2448
|
+
language: resource.language,
|
|
2449
|
+
path: iconPath
|
|
2450
|
+
}];
|
|
2348
2451
|
var resolveConfigPath$1 = async (root, configPath) => {
|
|
2349
2452
|
if (configPath !== void 0) {
|
|
2350
2453
|
const resolvedPath = (0, node_path.resolve)(root, configPath);
|
|
@@ -2356,12 +2459,12 @@ var resolveConfigPath$1 = async (root, configPath) => {
|
|
|
2356
2459
|
if (await fileExists$3(candidatePath)) return candidatePath;
|
|
2357
2460
|
}
|
|
2358
2461
|
};
|
|
2359
|
-
var readProjectJson = async (root) => {
|
|
2462
|
+
var readProjectJson$1 = async (root) => {
|
|
2360
2463
|
const projectJsonPath = (0, node_path.join)(root, "project.json");
|
|
2361
2464
|
if (!await fileExists$3(projectJsonPath)) return {};
|
|
2362
|
-
return await readJsonObjectFile$
|
|
2465
|
+
return await readJsonObjectFile$2(projectJsonPath, "project.json");
|
|
2363
2466
|
};
|
|
2364
|
-
var readJsonObjectFile$
|
|
2467
|
+
var readJsonObjectFile$2 = async (filePath, label) => {
|
|
2365
2468
|
const parsed = (0, import_dist.parse)(await (0, node_fs_promises.readFile)(filePath, "utf8"));
|
|
2366
2469
|
if (!isJsonObject$3(parsed)) throw new Error(`${label} must contain a JSON object: ${filePath}`);
|
|
2367
2470
|
return parsed;
|
|
@@ -2383,7 +2486,6 @@ var readConfigWindowsResourceSource = (config, directory, label) => {
|
|
|
2383
2486
|
};
|
|
2384
2487
|
var createProjectSource = (projectJson, directory) => {
|
|
2385
2488
|
const topLevel = {};
|
|
2386
|
-
copyStringField(projectJson, "iconPath", topLevel, "iconPath");
|
|
2387
2489
|
copyStringField(projectJson, "productName", topLevel, "productName");
|
|
2388
2490
|
copyStringField(projectJson, "name", topLevel, "productName");
|
|
2389
2491
|
copyStringField(projectJson, "fileDescription", topLevel, "fileDescription");
|
|
@@ -2459,33 +2561,35 @@ var resolveNumericField = (sources, field, fallback) => {
|
|
|
2459
2561
|
}
|
|
2460
2562
|
return fallback;
|
|
2461
2563
|
};
|
|
2462
|
-
var
|
|
2463
|
-
for (const source of
|
|
2564
|
+
var resolveWindowsIconPath = async (windowsSources, appIconSources, defaultIconPath) => {
|
|
2565
|
+
for (const source of windowsSources) {
|
|
2464
2566
|
const value = source.options.iconPath;
|
|
2465
2567
|
if (value !== void 0 && value.trim() !== "") {
|
|
2466
2568
|
const iconPath = resolveResourcePath$1(source.directory, value);
|
|
2467
|
-
await assertIconPath$1(iconPath
|
|
2569
|
+
await assertIconPath$1(iconPath);
|
|
2468
2570
|
return iconPath;
|
|
2469
2571
|
}
|
|
2470
2572
|
}
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2573
|
+
const appIconPath = await resolveMuonAppIconPath(appIconSources);
|
|
2574
|
+
if (appIconPath !== void 0) return appIconPath;
|
|
2575
|
+
await assertIconPath$1(defaultIconPath);
|
|
2576
|
+
return defaultIconPath;
|
|
2475
2577
|
};
|
|
2476
|
-
var assertIconPath$1 = async (iconPath
|
|
2578
|
+
var assertIconPath$1 = async (iconPath) => {
|
|
2477
2579
|
if ((0, node_path.extname)(iconPath).toLowerCase() !== ".png") throw new Error(`Windows resource icon must be a .png file: ${iconPath}`);
|
|
2478
|
-
if (
|
|
2479
|
-
|
|
2580
|
+
if (!await fileExists$3(iconPath)) throw new Error(`Windows resource icon does not exist: ${iconPath}`);
|
|
2581
|
+
await createNormalizedMuonIconPngData(await (0, node_fs_promises.readFile)(iconPath), iconPath);
|
|
2480
2582
|
};
|
|
2481
2583
|
var resolveDefaultWindowsIcon = async (packageDirectory) => {
|
|
2584
|
+
const sourceIconPath = (0, node_path.join)(moduleDirectory$3, "..", "..", "images", "muon-256.png");
|
|
2482
2585
|
const candidates = [
|
|
2483
|
-
(0, node_path.join)((0, node_path.resolve)(packageDirectory), "native", "muon-
|
|
2484
|
-
(0, node_path.join)(moduleDirectory$3, "native", "muon-
|
|
2485
|
-
(0, node_path.join)(moduleDirectory$3, "..", "dist", "native", "muon-
|
|
2486
|
-
|
|
2586
|
+
(0, node_path.join)((0, node_path.resolve)(packageDirectory), "native", "muon-256.png"),
|
|
2587
|
+
(0, node_path.join)(moduleDirectory$3, "native", "muon-256.png"),
|
|
2588
|
+
(0, node_path.join)(moduleDirectory$3, "..", "dist", "native", "muon-256.png"),
|
|
2589
|
+
sourceIconPath
|
|
2487
2590
|
];
|
|
2488
2591
|
for (const candidate of candidates) if (await fileExists$3(candidate)) return candidate;
|
|
2592
|
+
return sourceIconPath;
|
|
2489
2593
|
};
|
|
2490
2594
|
var resolveResourcePath$1 = (directory, path) => {
|
|
2491
2595
|
return (0, node_path.isAbsolute)(path) ? path : (0, node_path.resolve)(directory, path);
|
|
@@ -2544,14 +2648,20 @@ var mergeMuonLinuxDesktopOptions = (primary, fallback) => {
|
|
|
2544
2648
|
* package metadata.
|
|
2545
2649
|
*/
|
|
2546
2650
|
var resolveMuonLinuxDesktop = async (input) => {
|
|
2651
|
+
const projectJson = await readProjectJson(input.root);
|
|
2547
2652
|
const sources = [createOptionsSource(input.options, input.root, "linuxDesktop"), readConfigLinuxDesktopSource(input.muonConfig, input.muonConfigDirectory, "muon.json")].filter((source) => source !== void 0);
|
|
2653
|
+
const appIconSources = [
|
|
2654
|
+
createAppIconOptionsSource(input.appIconPath, input.root),
|
|
2655
|
+
readConfigAppIconSource(input.muonConfig, input.muonConfigDirectory, "muon.json"),
|
|
2656
|
+
readProjectAppIconSource(projectJson, input.root)
|
|
2657
|
+
].filter((source) => source !== void 0);
|
|
2548
2658
|
return {
|
|
2549
2659
|
desktopId: sanitizeDesktopId(resolveStringField(sources, "desktopId", input.defaults.desktopId)),
|
|
2550
2660
|
name: resolveStringField(sources, "name", input.defaults.name),
|
|
2551
2661
|
comment: resolveStringField(sources, "comment", input.defaults.comment),
|
|
2552
2662
|
categories: resolveCategories(sources, input.defaults.categories),
|
|
2553
2663
|
startupNotify: resolveBooleanField(sources, "startupNotify", input.defaults.startupNotify),
|
|
2554
|
-
iconPath: await
|
|
2664
|
+
iconPath: await resolveLinuxIconPath(sources, appIconSources, await resolveDefaultLinuxDesktopIcon(input.packageDirectory)),
|
|
2555
2665
|
iconFileName: defaultIconFileName,
|
|
2556
2666
|
configFileName: defaultDesktopConfigFileName
|
|
2557
2667
|
};
|
|
@@ -2616,6 +2726,16 @@ var quoteDesktopExecArgument = (value) => {
|
|
|
2616
2726
|
}
|
|
2617
2727
|
return `${escaped}"`;
|
|
2618
2728
|
};
|
|
2729
|
+
var readJsonObjectFile$1 = async (filePath, label) => {
|
|
2730
|
+
const parsed = (0, import_dist.parse)(await (0, node_fs_promises.readFile)(filePath, "utf8"));
|
|
2731
|
+
if (!isJsonObject$2(parsed)) throw new Error(`${label} must contain a JSON object: ${filePath}`);
|
|
2732
|
+
return parsed;
|
|
2733
|
+
};
|
|
2734
|
+
var readProjectJson = async (root) => {
|
|
2735
|
+
const projectJsonPath = (0, node_path.join)(root, "project.json");
|
|
2736
|
+
if (!await fileExists$2(projectJsonPath)) return {};
|
|
2737
|
+
return await readJsonObjectFile$1(projectJsonPath, "project.json");
|
|
2738
|
+
};
|
|
2619
2739
|
var createOptionsSource = (options, directory, label) => {
|
|
2620
2740
|
if (options === void 0) return;
|
|
2621
2741
|
return {
|
|
@@ -2678,7 +2798,7 @@ var resolveBooleanField = (sources, field, fallback) => {
|
|
|
2678
2798
|
}
|
|
2679
2799
|
return fallback;
|
|
2680
2800
|
};
|
|
2681
|
-
var
|
|
2801
|
+
var resolveLinuxIconPath = async (sources, appIconSources, defaultIconPath) => {
|
|
2682
2802
|
for (const source of sources) {
|
|
2683
2803
|
const value = source.options.iconPath;
|
|
2684
2804
|
if (value !== void 0 && value.trim() !== "") {
|
|
@@ -2687,6 +2807,8 @@ var resolveIconPath = async (sources, defaultIconPath) => {
|
|
|
2687
2807
|
return iconPath;
|
|
2688
2808
|
}
|
|
2689
2809
|
}
|
|
2810
|
+
const appIconPath = await resolveMuonAppIconPath(appIconSources);
|
|
2811
|
+
if (appIconPath !== void 0) return appIconPath;
|
|
2690
2812
|
if (defaultIconPath !== void 0 && await fileExists$2(defaultIconPath)) {
|
|
2691
2813
|
await assertIconPath(defaultIconPath, false);
|
|
2692
2814
|
return defaultIconPath;
|
|
@@ -2700,10 +2822,10 @@ var assertIconPath = async (iconPath, required) => {
|
|
|
2700
2822
|
};
|
|
2701
2823
|
var resolveDefaultLinuxDesktopIcon = async (packageDirectory) => {
|
|
2702
2824
|
const candidates = [
|
|
2703
|
-
(0, node_path.join)((0, node_path.resolve)(packageDirectory), "native", "muon-
|
|
2704
|
-
(0, node_path.join)(moduleDirectory$2, "native", "muon-
|
|
2705
|
-
(0, node_path.join)(moduleDirectory$2, "..", "dist", "native", "muon-
|
|
2706
|
-
(0, node_path.join)(moduleDirectory$2, "..", "..", "images", "muon-
|
|
2825
|
+
(0, node_path.join)((0, node_path.resolve)(packageDirectory), "native", "muon-256.png"),
|
|
2826
|
+
(0, node_path.join)(moduleDirectory$2, "native", "muon-256.png"),
|
|
2827
|
+
(0, node_path.join)(moduleDirectory$2, "..", "dist", "native", "muon-256.png"),
|
|
2828
|
+
(0, node_path.join)(moduleDirectory$2, "..", "..", "images", "muon-256.png")
|
|
2707
2829
|
];
|
|
2708
2830
|
for (const candidate of candidates) if (await fileExists$2(candidate)) return candidate;
|
|
2709
2831
|
};
|
|
@@ -2783,14 +2905,21 @@ var buildMuonApp = async (options = {}) => {
|
|
|
2783
2905
|
const appName = resolveAppName(packageJson, options.appName);
|
|
2784
2906
|
const appId = resolveAppId(packageJson, options.appId);
|
|
2785
2907
|
const buildConfig = await readBuildConfig(root, options.configPath);
|
|
2786
|
-
const
|
|
2908
|
+
const sourceConfig = applyRuntimePluginConfig(buildConfig.config, options.runtimePluginConfig ?? { mode: "simple" });
|
|
2909
|
+
assertNoUserInitialTitleBarIcon(sourceConfig);
|
|
2910
|
+
const resolvedBuildConfig = {
|
|
2911
|
+
...buildConfig,
|
|
2912
|
+
config: sourceConfig
|
|
2913
|
+
};
|
|
2914
|
+
const assetInput = resolveAssetInput(root, options.assetSourcePath, options.assetPrefix, resolvedBuildConfig);
|
|
2787
2915
|
const windowsResource = await resolveMuonWindowsResource({
|
|
2788
2916
|
root,
|
|
2789
2917
|
packageDirectory,
|
|
2790
2918
|
packageJson,
|
|
2791
|
-
muonConfig:
|
|
2919
|
+
muonConfig: sourceConfig,
|
|
2792
2920
|
muonConfigDirectory: buildConfig.directory,
|
|
2793
2921
|
options: options.windowsResource,
|
|
2922
|
+
appIconPath: options.iconPath,
|
|
2794
2923
|
defaults: {
|
|
2795
2924
|
productName: appName,
|
|
2796
2925
|
fileDescription: appName,
|
|
@@ -2802,9 +2931,10 @@ var buildMuonApp = async (options = {}) => {
|
|
|
2802
2931
|
const linuxDesktop = await resolveMuonLinuxDesktop({
|
|
2803
2932
|
root,
|
|
2804
2933
|
packageDirectory,
|
|
2805
|
-
muonConfig:
|
|
2934
|
+
muonConfig: sourceConfig,
|
|
2806
2935
|
muonConfigDirectory: buildConfig.directory,
|
|
2807
2936
|
options: options.linuxDesktop,
|
|
2937
|
+
appIconPath: options.iconPath,
|
|
2808
2938
|
defaults: {
|
|
2809
2939
|
desktopId: appId,
|
|
2810
2940
|
name: resolveLinuxDesktopDefaultName(packageJson, appName),
|
|
@@ -2824,7 +2954,7 @@ var buildMuonApp = async (options = {}) => {
|
|
|
2824
2954
|
appId,
|
|
2825
2955
|
target,
|
|
2826
2956
|
assetInput,
|
|
2827
|
-
sourceConfig
|
|
2957
|
+
sourceConfig,
|
|
2828
2958
|
windowsResource,
|
|
2829
2959
|
linuxDesktop,
|
|
2830
2960
|
salt
|
|
@@ -2897,6 +3027,19 @@ var readBuildConfig = async (root, configPath) => {
|
|
|
2897
3027
|
directory: (0, node_path.dirname)(resolvedConfigPath)
|
|
2898
3028
|
};
|
|
2899
3029
|
};
|
|
3030
|
+
var applyRuntimePluginConfig = (sourceConfig, runtimePluginConfig) => {
|
|
3031
|
+
if (runtimePluginConfig === void 0) return sourceConfig;
|
|
3032
|
+
const sourcePlugin = sourceConfig.plugin;
|
|
3033
|
+
if (sourcePlugin !== void 0 && !isJsonObject$1(sourcePlugin)) throw new Error("muon.json plugin must be an object when runtime plugin config is applied.");
|
|
3034
|
+
const plugin = sourcePlugin ?? {};
|
|
3035
|
+
return {
|
|
3036
|
+
...sourceConfig,
|
|
3037
|
+
plugin: {
|
|
3038
|
+
...plugin,
|
|
3039
|
+
...runtimePluginConfig
|
|
3040
|
+
}
|
|
3041
|
+
};
|
|
3042
|
+
};
|
|
2900
3043
|
var readConfigAssetSourcePath = (sourceConfig) => {
|
|
2901
3044
|
const sourceAsset = sourceConfig.asset;
|
|
2902
3045
|
if (sourceAsset === void 0) return;
|
|
@@ -2940,6 +3083,8 @@ var buildMuonTarget = async (input) => {
|
|
|
2940
3083
|
const outputPath = (0, node_path.join)(input.outputRoot, descriptor.distributionDirectoryName);
|
|
2941
3084
|
const launcherPath = (0, node_path.join)(outputPath, getLauncherFileName(input.appName, descriptor));
|
|
2942
3085
|
const assetZipPath = (0, node_path.join)(outputPath, "assets.zip");
|
|
3086
|
+
const runtimeAppId = getMuonTargetRuntimeAppId(input.appId, input.target);
|
|
3087
|
+
const appIconPath = descriptor.os === "windows" ? input.windowsResource.iconPath : input.linuxDesktop.iconPath;
|
|
2943
3088
|
await verifyTargetInputs({
|
|
2944
3089
|
sourceRuntimePath,
|
|
2945
3090
|
sourceBootstrapPath,
|
|
@@ -2958,8 +3103,11 @@ var buildMuonTarget = async (input) => {
|
|
|
2958
3103
|
await (0, node_fs_promises.chmod)((0, node_path.join)(outputPath, descriptor.runtimeExecutableName), executableMode);
|
|
2959
3104
|
await (0, node_fs_promises.copyFile)(sourceBootstrapPath, launcherPath);
|
|
2960
3105
|
await (0, node_fs_promises.chmod)(launcherPath, executableMode);
|
|
2961
|
-
const asset = await writeAssetArchive(input.assetInput, assetZipPath, input.salt
|
|
2962
|
-
|
|
3106
|
+
const asset = await writeAssetArchive(input.assetInput, assetZipPath, input.salt, [{
|
|
3107
|
+
name: appIconAssetEntryName,
|
|
3108
|
+
data: await (0, node_fs_promises.readFile)(appIconPath)
|
|
3109
|
+
}]);
|
|
3110
|
+
const embeddedConfig = createEmbeddedConfig(input.sourceConfig, asset, runtimeAppId, input.linuxDesktop.desktopId, appIconAssetUrl);
|
|
2963
3111
|
await withTemporaryConfig(embeddedConfig, async (configPath) => {
|
|
2964
3112
|
await embedMuonConfigInRuntime({
|
|
2965
3113
|
runtimePath: outputPath,
|
|
@@ -2972,19 +3120,27 @@ var buildMuonTarget = async (input) => {
|
|
|
2972
3120
|
outputPath: void 0
|
|
2973
3121
|
});
|
|
2974
3122
|
});
|
|
2975
|
-
if (descriptor.os === "windows")
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
3123
|
+
if (descriptor.os === "windows") {
|
|
3124
|
+
await updateWindowsPeIconResource({
|
|
3125
|
+
executablePath: (0, node_path.join)(outputPath, descriptor.runtimeExecutableName),
|
|
3126
|
+
resource: input.windowsResource,
|
|
3127
|
+
environment: process.env,
|
|
3128
|
+
cwd: input.root
|
|
3129
|
+
});
|
|
3130
|
+
await updateWindowsPeResources({
|
|
3131
|
+
executablePath: launcherPath,
|
|
3132
|
+
resource: input.windowsResource,
|
|
3133
|
+
environment: process.env,
|
|
3134
|
+
cwd: input.root
|
|
3135
|
+
});
|
|
3136
|
+
} else if (descriptor.os === "linux") await writeLinuxDesktopDistributionFiles(outputPath, input.linuxDesktop);
|
|
2982
3137
|
return {
|
|
2983
3138
|
target: input.target,
|
|
2984
3139
|
distributionDirectoryName: descriptor.distributionDirectoryName,
|
|
2985
3140
|
outputPath,
|
|
2986
3141
|
launcherPath,
|
|
2987
3142
|
asset,
|
|
3143
|
+
runtimeAppId,
|
|
2988
3144
|
embeddedConfig,
|
|
2989
3145
|
...descriptor.os === "linux" ? { linuxDesktop: input.linuxDesktop } : {}
|
|
2990
3146
|
};
|
|
@@ -3007,10 +3163,10 @@ var copyRuntimeFiles = async (sourceRuntimePath, outputPath, descriptor) => {
|
|
|
3007
3163
|
}
|
|
3008
3164
|
await (0, node_fs_promises.copyFile)((0, node_path.join)(sourceRuntimePath, muonLicenseFileName), (0, node_path.join)(outputPath, muonLicenseFileName));
|
|
3009
3165
|
};
|
|
3010
|
-
var writeAssetArchive = async (input, outputPath, salt) => {
|
|
3166
|
+
var writeAssetArchive = async (input, outputPath, salt, extraEntries) => {
|
|
3011
3167
|
const sourceStats = await statOrUndefined(input.sourcePath);
|
|
3012
3168
|
if (sourceStats === void 0) throw new Error(`Muon asset source does not exist: ${input.sourcePath}`);
|
|
3013
|
-
const archive = sourceStats.isDirectory() ? await createAssetArchiveFromDirectory(input) : sourceStats.isFile() ? await (
|
|
3169
|
+
const archive = sourceStats.isDirectory() ? await createAssetArchiveFromDirectory(input, extraEntries) : sourceStats.isFile() ? await createAssetArchiveFromZipFile(input.sourcePath, extraEntries) : void 0;
|
|
3014
3170
|
if (archive === void 0) throw new Error(`Muon asset source is not a directory or file: ${input.sourcePath}`);
|
|
3015
3171
|
await (0, node_fs_promises.writeFile)(outputPath, archive);
|
|
3016
3172
|
return {
|
|
@@ -3020,10 +3176,30 @@ var writeAssetArchive = async (input, outputPath, salt) => {
|
|
|
3020
3176
|
entryCount: sourceStats.isDirectory() ? readZipEntryCount(archive, outputPath) : readZipEntryCount(archive, input.sourcePath)
|
|
3021
3177
|
};
|
|
3022
3178
|
};
|
|
3023
|
-
var createAssetArchiveFromDirectory = async (input) => {
|
|
3179
|
+
var createAssetArchiveFromDirectory = async (input, extraEntries) => {
|
|
3024
3180
|
const entries = await collectZipEntries(input.sourcePath, input.prefix);
|
|
3025
3181
|
if (entries.length === 0) throw new Error(`Muon asset source has no files: ${input.sourcePath}`);
|
|
3026
|
-
return createZipArchive(entries);
|
|
3182
|
+
return createZipArchive(appendZipEntries(entries, extraEntries));
|
|
3183
|
+
};
|
|
3184
|
+
var createAssetArchiveFromZipFile = async (sourcePath, extraEntries) => {
|
|
3185
|
+
const zip = new AdmZip(await (0, node_fs_promises.readFile)(sourcePath));
|
|
3186
|
+
for (const entry of extraEntries) {
|
|
3187
|
+
assertSafeZipEntryName(entry.name);
|
|
3188
|
+
if (zip.getEntry(entry.name) !== null) throw new Error(`Muon app icon asset entry already exists: ${entry.name}`);
|
|
3189
|
+
zip.addFile(entry.name, entry.data);
|
|
3190
|
+
}
|
|
3191
|
+
return zip.toBuffer();
|
|
3192
|
+
};
|
|
3193
|
+
var appendZipEntries = (entries, extraEntries) => {
|
|
3194
|
+
const output = [...entries];
|
|
3195
|
+
const names = new Set(entries.map((entry) => entry.name));
|
|
3196
|
+
for (const entry of extraEntries) {
|
|
3197
|
+
assertSafeZipEntryName(entry.name);
|
|
3198
|
+
if (names.has(entry.name)) throw new Error(`Muon app icon asset entry already exists: ${entry.name}`);
|
|
3199
|
+
names.add(entry.name);
|
|
3200
|
+
output.push(entry);
|
|
3201
|
+
}
|
|
3202
|
+
return output;
|
|
3027
3203
|
};
|
|
3028
3204
|
var readZipEntryCount = (archive, sourcePath) => {
|
|
3029
3205
|
const endSignature = 101010256;
|
|
@@ -3061,13 +3237,20 @@ var createZipArchive = (entries) => {
|
|
|
3061
3237
|
for (const entry of entries) zip.addFile(entry.name, entry.data);
|
|
3062
3238
|
return zip.toBuffer();
|
|
3063
3239
|
};
|
|
3064
|
-
var createEmbeddedConfig = (sourceConfig, asset, appId, desktopId) => {
|
|
3240
|
+
var createEmbeddedConfig = (sourceConfig, asset, appId, desktopId, initialTitleBarIcon) => {
|
|
3065
3241
|
const sourceAsset = sourceConfig.asset;
|
|
3066
3242
|
if (sourceAsset !== void 0 && !isJsonObject$1(sourceAsset)) throw new Error("muon.json asset must be an object when present.");
|
|
3067
3243
|
const sourceBootstrap = sourceConfig.bootstrap;
|
|
3068
3244
|
if (sourceBootstrap !== void 0 && !isJsonObject$1(sourceBootstrap)) throw new Error("muon.json bootstrap must be an object when present.");
|
|
3245
|
+
const runtimeConfig = stripBuildOnlyAppIconConfig(stripBuildOnlyLinuxDesktopConfig(stripBuildOnlyWindowsResourceConfig(sourceConfig)));
|
|
3246
|
+
const sourceBrowser = runtimeConfig.browser;
|
|
3247
|
+
if (sourceBrowser !== void 0 && !isJsonObject$1(sourceBrowser)) throw new Error("muon.json browser must be an object when present.");
|
|
3069
3248
|
return {
|
|
3070
|
-
...
|
|
3249
|
+
...runtimeConfig,
|
|
3250
|
+
browser: {
|
|
3251
|
+
...sourceBrowser ?? {},
|
|
3252
|
+
initialTitleBarIcon
|
|
3253
|
+
},
|
|
3071
3254
|
asset: {
|
|
3072
3255
|
...sourceAsset ?? {},
|
|
3073
3256
|
sourcePath: appConfigSourcePath,
|
|
@@ -3081,6 +3264,17 @@ var createEmbeddedConfig = (sourceConfig, asset, appId, desktopId) => {
|
|
|
3081
3264
|
}
|
|
3082
3265
|
};
|
|
3083
3266
|
};
|
|
3267
|
+
var assertNoUserInitialTitleBarIcon = (sourceConfig) => {
|
|
3268
|
+
const sourceBrowser = sourceConfig.browser;
|
|
3269
|
+
if (sourceBrowser === void 0) return;
|
|
3270
|
+
if (!isJsonObject$1(sourceBrowser)) throw new Error("muon.json browser must be an object when present.");
|
|
3271
|
+
if (sourceBrowser.initialTitleBarIcon !== void 0) throw new Error("muon.json browser.initialTitleBarIcon is generated by muon build; use top-level iconPath instead.");
|
|
3272
|
+
};
|
|
3273
|
+
var stripBuildOnlyAppIconConfig = (sourceConfig) => {
|
|
3274
|
+
const output = {};
|
|
3275
|
+
for (const [key, value] of Object.entries(sourceConfig)) if (key !== "iconPath") output[key] = value;
|
|
3276
|
+
return output;
|
|
3277
|
+
};
|
|
3084
3278
|
var withTemporaryConfig = async (config, callback) => {
|
|
3085
3279
|
const tempDirectory = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "muon-build-config-"));
|
|
3086
3280
|
const configPath = (0, node_path.join)(tempDirectory, "muon.json");
|
|
@@ -3139,11 +3333,23 @@ var isLinuxDesktopOptions = (value) => {
|
|
|
3139
3333
|
};
|
|
3140
3334
|
var isMuonViteBuildOptions = (value) => {
|
|
3141
3335
|
if (!isRecord(value)) return false;
|
|
3142
|
-
return (value.targets === void 0 || isStringArray(value.targets)) && (value.allTargets === void 0 || typeof value.allTargets === "boolean") && (value.appName === void 0 || typeof value.appName === "string") && (value.appId === void 0 || typeof value.appId === "string") && (value.outputRoot === void 0 || typeof value.outputRoot === "string") && (value.configPath === void 0 || typeof value.configPath === "string") && (value.windowsResource === void 0 || isWindowsResourceOptions(value.windowsResource)) && (value.linuxDesktop === void 0 || isLinuxDesktopOptions(value.linuxDesktop)) && (value.packageDirectory === void 0 || typeof value.packageDirectory === "string") && (value.assetSalt === void 0 || value.assetSalt instanceof Uint8Array);
|
|
3336
|
+
return (value.targets === void 0 || isStringArray(value.targets)) && (value.allTargets === void 0 || typeof value.allTargets === "boolean") && (value.appName === void 0 || typeof value.appName === "string") && (value.appId === void 0 || typeof value.appId === "string") && (value.outputRoot === void 0 || typeof value.outputRoot === "string") && (value.configPath === void 0 || typeof value.configPath === "string") && (value.iconPath === void 0 || typeof value.iconPath === "string") && (value.windowsResource === void 0 || isWindowsResourceOptions(value.windowsResource)) && (value.linuxDesktop === void 0 || isLinuxDesktopOptions(value.linuxDesktop)) && (value.packageDirectory === void 0 || typeof value.packageDirectory === "string") && (value.assetSalt === void 0 || value.assetSalt instanceof Uint8Array);
|
|
3337
|
+
};
|
|
3338
|
+
var isMuonVitePluginAccessImportOptions = (value) => {
|
|
3339
|
+
if (!isRecord(value)) return false;
|
|
3340
|
+
return (value.sources === void 0 || isStringArray(value.sources)) && (value.packages === void 0 || isStringArray(value.packages)) && (value.allow === void 0 || isStringArray(value.allow));
|
|
3341
|
+
};
|
|
3342
|
+
var isMuonVitePluginAccessEntryOptions = (value) => {
|
|
3343
|
+
if (!isRecord(value)) return false;
|
|
3344
|
+
return typeof value.name === "string" && (value.signature === void 0 || typeof value.signature === "string") && (value.salt === void 0 || typeof value.salt === "string") && (value.allow === void 0 || isStringArray(value.allow)) && (value.imports === void 0 || Array.isArray(value.imports) && value.imports.every(isMuonVitePluginAccessImportOptions));
|
|
3345
|
+
};
|
|
3346
|
+
var isMuonVitePluginAccessOptions = (value) => {
|
|
3347
|
+
if (!isRecord(value)) return false;
|
|
3348
|
+
return (value.path === void 0 || typeof value.path === "string") && (value.mode === void 0 || value.mode === "simple" || value.mode === "validate") && (value.pages === void 0 || isStringArray(value.pages)) && (value.plugins === void 0 || Array.isArray(value.plugins) && value.plugins.every(isMuonVitePluginAccessEntryOptions));
|
|
3143
3349
|
};
|
|
3144
3350
|
var isMuonVitePluginOptions = (value) => {
|
|
3145
3351
|
if (!isRecord(value)) return false;
|
|
3146
|
-
return (value.muonPath === void 0 || typeof value.muonPath === "string") && (value.cefPath === void 0 || typeof value.cefPath === "string") && (value.stagePath === void 0 || typeof value.stagePath === "string") && (value.open === void 0 || typeof value.open === "boolean") && (value.enableDebugger === void 0 || typeof value.enableDebugger === "boolean") && (value.build === void 0 || typeof value.build === "boolean" || isMuonViteBuildOptions(value.build));
|
|
3352
|
+
return (value.muonPath === void 0 || typeof value.muonPath === "string") && (value.cefPath === void 0 || typeof value.cefPath === "string") && (value.stagePath === void 0 || typeof value.stagePath === "string") && (value.open === void 0 || typeof value.open === "boolean") && (value.enableDebugger === void 0 || typeof value.enableDebugger === "boolean") && (value.pluginAccess === void 0 || value.pluginAccess === false || isMuonVitePluginAccessOptions(value.pluginAccess)) && (value.build === void 0 || typeof value.build === "boolean" || isMuonViteBuildOptions(value.build));
|
|
3147
3353
|
};
|
|
3148
3354
|
/**
|
|
3149
3355
|
* Attaches raw Muon Vite plugin options to a plugin instance.
|
|
@@ -3276,6 +3482,7 @@ var copyDefinedBuildOptions = (output, input, usesViteAssets) => {
|
|
|
3276
3482
|
if (input.appId !== void 0) output.appId = input.appId;
|
|
3277
3483
|
if (input.outputRoot !== void 0) output.outputRoot = input.outputRoot;
|
|
3278
3484
|
if (input.configPath !== void 0) output.configPath = input.configPath;
|
|
3485
|
+
if (input.iconPath !== void 0) output.iconPath = input.iconPath;
|
|
3279
3486
|
if (input.windowsResource !== void 0) {
|
|
3280
3487
|
const windowsResource = mergeMuonWindowsResourceOptions(input.windowsResource, output.windowsResource);
|
|
3281
3488
|
if (windowsResource !== void 0) output.windowsResource = windowsResource;
|
|
@@ -3411,7 +3618,7 @@ var getWebSocketOrigin = (startUrl) => {
|
|
|
3411
3618
|
else if (url.protocol === "http:") url.protocol = "ws:";
|
|
3412
3619
|
return url.origin;
|
|
3413
3620
|
};
|
|
3414
|
-
var createMuonOverrideConfig = (startUrl, enableDebugger) => {
|
|
3621
|
+
var createMuonOverrideConfig = (startUrl, enableDebugger, runtimePluginConfig) => {
|
|
3415
3622
|
const origin = new URL(startUrl).origin;
|
|
3416
3623
|
return {
|
|
3417
3624
|
...enableDebugger ? { cdp: { enable: true } } : {},
|
|
@@ -3420,19 +3627,22 @@ var createMuonOverrideConfig = (startUrl, enableDebugger) => {
|
|
|
3420
3627
|
...enableDebugger ? { keybind: {
|
|
3421
3628
|
devtools: "f12",
|
|
3422
3629
|
recycle: "ctrl+f12"
|
|
3423
|
-
} } : {}
|
|
3424
|
-
|
|
3630
|
+
} } : {}
|
|
3631
|
+
},
|
|
3632
|
+
plugin: {
|
|
3633
|
+
...runtimePluginConfig,
|
|
3634
|
+
pages: [`${origin}/**`]
|
|
3425
3635
|
},
|
|
3426
3636
|
network: { allow: [`${origin}/**`, `${getWebSocketOrigin(startUrl)}/**`] }
|
|
3427
3637
|
};
|
|
3428
3638
|
};
|
|
3429
|
-
var writeMuonOverrideConfig = (server, overrideConfigPath,
|
|
3639
|
+
var writeMuonOverrideConfig = (server, overrideConfigPath, pluginOptions, getRuntimePluginConfig) => {
|
|
3430
3640
|
const startUrl = getBaseUrl(server);
|
|
3431
3641
|
if (startUrl === void 0) {
|
|
3432
3642
|
server.config.logger.warn("Muon Vite plugin could not resolve a Vite URL.");
|
|
3433
3643
|
return false;
|
|
3434
3644
|
}
|
|
3435
|
-
(0, node_fs.writeFileSync)(overrideConfigPath, `${JSON.stringify(createMuonOverrideConfig(startUrl, enableDebugger), null, 2)}\n`);
|
|
3645
|
+
(0, node_fs.writeFileSync)(overrideConfigPath, `${JSON.stringify(createMuonOverrideConfig(startUrl, pluginOptions.enableDebugger !== false, getRuntimePluginConfig()), null, 2)}\n`);
|
|
3436
3646
|
return true;
|
|
3437
3647
|
};
|
|
3438
3648
|
var createRuntimePaths = async (server, stagePath, platform, projectConfigPath) => {
|
|
@@ -3495,7 +3705,7 @@ var launchMuon = (paths, platform, server) => {
|
|
|
3495
3705
|
});
|
|
3496
3706
|
child.unref();
|
|
3497
3707
|
};
|
|
3498
|
-
var startMuonViteBrowserBridge = async ({ server, pluginOptions, platform, architecture, environment }) => {
|
|
3708
|
+
var startMuonViteBrowserBridge = async ({ server, pluginOptions, getRuntimePluginConfig, platform, architecture, environment }) => {
|
|
3499
3709
|
await ensureMuonGitignoreEntry(server.config.root);
|
|
3500
3710
|
if (pluginOptions.open === false || server.httpServer === null) return;
|
|
3501
3711
|
const target = getDefaultMuonPrepareTarget(platform, architecture);
|
|
@@ -3541,7 +3751,7 @@ var startMuonViteBrowserBridge = async ({ server, pluginOptions, platform, archi
|
|
|
3541
3751
|
cleanup();
|
|
3542
3752
|
});
|
|
3543
3753
|
server.httpServer.once("listening", () => {
|
|
3544
|
-
if (writeMuonOverrideConfig(server, paths.overrideConfigPath, pluginOptions
|
|
3754
|
+
if (writeMuonOverrideConfig(server, paths.overrideConfigPath, pluginOptions, getRuntimePluginConfig)) launchMuon(paths, platform, server);
|
|
3545
3755
|
});
|
|
3546
3756
|
};
|
|
3547
3757
|
//#endregion
|
|
@@ -3725,6 +3935,12 @@ Object.defineProperty(exports, "startMuonViteBrowserBridge", {
|
|
|
3725
3935
|
return startMuonViteBrowserBridge;
|
|
3726
3936
|
}
|
|
3727
3937
|
});
|
|
3938
|
+
Object.defineProperty(exports, "updateWindowsPeIconResource", {
|
|
3939
|
+
enumerable: true,
|
|
3940
|
+
get: function() {
|
|
3941
|
+
return updateWindowsPeIconResource;
|
|
3942
|
+
}
|
|
3943
|
+
});
|
|
3728
3944
|
Object.defineProperty(exports, "updateWindowsPeResources", {
|
|
3729
3945
|
enumerable: true,
|
|
3730
3946
|
get: function() {
|
|
@@ -3732,4 +3948,4 @@ Object.defineProperty(exports, "updateWindowsPeResources", {
|
|
|
3732
3948
|
}
|
|
3733
3949
|
});
|
|
3734
3950
|
|
|
3735
|
-
//# sourceMappingURL=vite-internals-
|
|
3951
|
+
//# sourceMappingURL=vite-internals-HXgH7b5M.cjs.map
|