muon-ui 0.8.0 → 0.10.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 +162 -40
- 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-amd64/muon-runtime-helper +0 -0
- package/dist/native/linux-arm64/muon-bootstrap +0 -0
- package/dist/native/linux-arm64/muon-builder +0 -0
- package/dist/native/linux-arm64/muon-runtime-helper +0 -0
- package/dist/native/linux-armhf/muon-bootstrap +0 -0
- package/dist/native/linux-armhf/muon-builder +0 -0
- package/dist/native/linux-armhf/muon-runtime-helper +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-DnxA6RxV.cjs} +501 -142
- package/dist/vite-internals-DnxA6RxV.cjs.map +1 -0
- package/dist/vite.cjs +766 -7
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +1253 -182
- package/dist/vite.mjs.map +1 -1
- package/muon.d.ts +412 -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
package/README.md
CHANGED
|
@@ -11,9 +11,6 @@ A multi-platform GUI application framework that uses CEF as its backend.
|
|
|
11
11
|
|
|
12
12
|
## What is This?
|
|
13
13
|
|
|
14
|
-
WIP: This project is still in a very early prototype phase.
|
|
15
|
-
I intend to complete it, but please note that it is not yet at the stage of active implementation.
|
|
16
|
-
|
|
17
14
|
Have you ever thought about how to update an outdated native GUI application into a modern one?
|
|
18
15
|
Replacing applications is extremely complex and has always been a challenge for us.
|
|
19
16
|
|
|
@@ -45,7 +42,7 @@ It also features a plugin system that supports fully asynchronous processing, en
|
|
|
45
42
|
Since these features become available based on pre-configured settings, there's no risk of unused functionality running unchecked.
|
|
46
43
|
|
|
47
44
|
Since it's CEF-based, you can naturally use features expected in Chromium, such as WebGL, WebGPU, WebAssembly, Web Workers, and Local Storage.
|
|
48
|
-
You can also display
|
|
45
|
+
You can also display DevTools. Because it supports CDP (Chromium DevTools Protocol), you can debug using tools like VS Code or connect and control it via Playwright.
|
|
49
46
|
You can also use remote DevTools from Chromium/Chrome via `chrome://inspect/`.
|
|
50
47
|
|
|
51
48
|
In short, by clearly eliminating one of the major issues that arise when migrating native GTK/Qt/Windows applications to web applications,
|
|
@@ -54,17 +51,16 @@ you can develop modern local GUI applications using the web-based technology eco
|
|
|
54
51
|
### Features
|
|
55
52
|
|
|
56
53
|
- By restricting all network access with a whitelist filter, you can completely block problematic content.
|
|
57
|
-
- It is provided as an easy-to-use NPM package, allowing you to easily turn your web application project into a native GUI application.
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
- Linux desktop launcher and icon metadata can be bundled at distribution build time.
|
|
64
|
-
- You can use Chromium DevTools. Furthermore, because it supports CDP (Chromium DevTools Protocol), you can perform remote debugging from an external source.
|
|
54
|
+
- It is provided as an easy-to-use NPM package, allowing you to easily turn your web application project into a native GUI application. No complex configuration or modifications are required.
|
|
55
|
+
- The browser responsible for rendering is CEF (Chromium Embedded Framework). This means that, from the perspective of the web application, it is virtually equivalent to using Chromium or Chrome.
|
|
56
|
+
- It supports Vite plugins. Since it supports Vite’s HMR, you can preview real-time updates during development.
|
|
57
|
+
- With `muon run`, you can launch a development environment that uses local assets directly without starting an HTTP server.
|
|
58
|
+
- You can include the Linux desktop launcher and icon metadata in your distribution build.
|
|
59
|
+
- You can use DevTools. Furthermore, since it supports CDP (Chromium DevTools Protocol), you can perform remote debugging from an external source.
|
|
65
60
|
- You can display multiple browser windows. Browser windows can also be organized into a parent-child hierarchy.
|
|
66
|
-
- It features a plugin system.
|
|
61
|
+
- It features a plugin system. Plugin functionality can be restricted using a whitelist filter.
|
|
67
62
|
- Using built-in plugins, you can access local files, open dialogs, launch child processes, and manipulate windows.
|
|
63
|
+
- It supports packages for Linux (deb) and Windows (NSIS), as well as portable operation.
|
|
68
64
|
|
|
69
65
|
### Environment
|
|
70
66
|
|
package/dist/cli.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*!
|
|
3
3
|
* name: muon-ui
|
|
4
|
-
* version: 0.
|
|
4
|
+
* version: 0.10.0
|
|
5
5
|
* description: A multi-platform GUI application framework that uses CEF as its backend
|
|
6
6
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
7
7
|
* license: MIT
|
|
8
8
|
* repository.url: https://github.com/kekyo/muon-ui.git
|
|
9
|
-
* git.commit.hash:
|
|
9
|
+
* git.commit.hash: 7bf3c14f4ebc9ae604525ea66a10289463c086ab
|
|
10
10
|
*/
|
|
11
|
-
const require_vite_internals = require("./vite-internals-
|
|
11
|
+
const require_vite_internals = require("./vite-internals-DnxA6RxV.cjs");
|
|
12
12
|
let commander = require("commander");
|
|
13
13
|
let node_child_process = require("node:child_process");
|
|
14
14
|
let node_fs = require("node:fs");
|
|
@@ -130,9 +130,9 @@ var assertDevelopmentAssetDirectory = async (assetSourcePath) => {
|
|
|
130
130
|
try {
|
|
131
131
|
await (0, node_fs_promises.access)(assetSourcePath, node_fs.constants.F_OK);
|
|
132
132
|
} catch {
|
|
133
|
-
throw new Error(`Muon
|
|
133
|
+
throw new Error(`Muon run asset source does not exist: ${assetSourcePath}`);
|
|
134
134
|
}
|
|
135
|
-
throw new Error(`Muon
|
|
135
|
+
throw new Error(`Muon run asset source must be a directory: ${assetSourcePath}`);
|
|
136
136
|
};
|
|
137
137
|
var resolveAssetSource = async (root, assetSourcePath, projectConfig) => {
|
|
138
138
|
const configuredAssetSourcePath = readConfigAssetSourcePath(projectConfig.config);
|
|
@@ -215,7 +215,7 @@ var runMuonDev = async (options = {}) => {
|
|
|
215
215
|
const enableDebugger = options.enableDebugger ?? pluginOptions?.enableDebugger ?? true;
|
|
216
216
|
const projectConfig = await resolveProjectConfig(root, options.configPath);
|
|
217
217
|
const asset = await resolveAssetSource(root, options.assetSourcePath, projectConfig);
|
|
218
|
-
const overrideConfigPath = (0, node_path.join)(root, ".muon", "
|
|
218
|
+
const overrideConfigPath = (0, node_path.join)(root, ".muon", "run", "muon.run.json");
|
|
219
219
|
await require_vite_internals.ensureMuonGitignoreEntry(root);
|
|
220
220
|
const preparedRuntime = await require_vite_internals.runMuonPrepare({
|
|
221
221
|
muonPath,
|
|
@@ -274,8 +274,13 @@ var supportedPackTypes = [
|
|
|
274
274
|
"deb",
|
|
275
275
|
"nsis"
|
|
276
276
|
];
|
|
277
|
+
var supportedLinuxSandboxModes = ["disabled", "setuid"];
|
|
277
278
|
var defaultArtifactsDirectory = "artifacts";
|
|
278
279
|
var defaultPackageBuildDirectory = ".muon/pack";
|
|
280
|
+
var systemRuntimeRoot = "/var/lib/muon/apps";
|
|
281
|
+
var systemCefCacheRoot = "/var/cache/muon/cef";
|
|
282
|
+
var runtimeHelperExecutableName = "muon-runtime-helper";
|
|
283
|
+
var debGtk3RuntimeDependency = "libgtk-3-0t64 | libgtk-3-0";
|
|
279
284
|
var isJsonObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
280
285
|
var readJsonObjectFile = async (path) => {
|
|
281
286
|
const parsed = (0, import_dist.parse)(await (0, node_fs_promises.readFile)(path, "utf8"));
|
|
@@ -319,6 +324,12 @@ var normalizePackTypes = (types) => {
|
|
|
319
324
|
for (const type of normalized) if (!supportedPackTypes.includes(type)) throw new Error(`Unsupported muon pack type: ${type}`);
|
|
320
325
|
return [...new Set(normalized)];
|
|
321
326
|
};
|
|
327
|
+
var normalizeLinuxSandboxMode = (mode) => {
|
|
328
|
+
if (mode === void 0) return "disabled";
|
|
329
|
+
const normalized = mode.trim().toLowerCase();
|
|
330
|
+
if (supportedLinuxSandboxModes.includes(normalized)) return normalized;
|
|
331
|
+
throw new Error(`Unsupported Linux sandbox mode: ${mode}`);
|
|
332
|
+
};
|
|
322
333
|
var packTargetSelectorTargets = {
|
|
323
334
|
linux: [
|
|
324
335
|
"linux-amd64",
|
|
@@ -366,6 +377,10 @@ var createPackTargetPlan = (types, targets) => {
|
|
|
366
377
|
if (plan.length === 0) throw new Error("No valid muon pack target and type combinations.");
|
|
367
378
|
return plan;
|
|
368
379
|
};
|
|
380
|
+
var validateLinuxSandboxModeForPlan = (mode, plan) => {
|
|
381
|
+
if (mode === "disabled") return;
|
|
382
|
+
for (const entry of plan) if (require_vite_internals.getMuonTargetDescriptor(entry.target).os !== "linux" || entry.types.length !== 1 || entry.types[0] !== "deb") throw new Error("--linux-sandbox=setuid is supported only for Linux deb packages. Specify --type deb with Linux targets.");
|
|
383
|
+
};
|
|
369
384
|
var runTool = async (executable, args, cwd, environment) => {
|
|
370
385
|
const child = (0, node_child_process.spawn)(executable, [...args], {
|
|
371
386
|
cwd,
|
|
@@ -451,7 +466,7 @@ var packageTarGz = async (target, metadata, artifactsRoot) => {
|
|
|
451
466
|
path: outputPath
|
|
452
467
|
};
|
|
453
468
|
};
|
|
454
|
-
var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot, environment) => {
|
|
469
|
+
var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot, environment, linuxSandbox, progress) => {
|
|
455
470
|
const descriptor = require_vite_internals.getMuonTargetDescriptor(target.target);
|
|
456
471
|
if (descriptor.os !== "linux") throw new Error(`Unsupported deb target: ${target.target}`);
|
|
457
472
|
const architecture = descriptor.arch;
|
|
@@ -461,12 +476,23 @@ var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot,
|
|
|
461
476
|
force: true
|
|
462
477
|
});
|
|
463
478
|
const installedDist = (0, node_path.join)((0, node_path.join)(packageRoot, "usr", "lib", metadata.packageName), target.distributionDirectoryName);
|
|
479
|
+
const privilegedPreparePath = `/usr/lib/${metadata.packageName}/${target.distributionDirectoryName}/${runtimeHelperExecutableName}`;
|
|
480
|
+
const systemRuntimePath = `${systemRuntimeRoot}/${metadata.packageName}/${target.target}/runtime`;
|
|
464
481
|
await (0, node_fs_promises.mkdir)(installedDist, { recursive: true });
|
|
465
482
|
await (0, node_fs_promises.cp)(target.outputPath, installedDist, { recursive: true });
|
|
483
|
+
if (linuxSandbox === "setuid") {
|
|
484
|
+
if (target.runtimeHelperPath === void 0) throw new Error(`Muon runtime helper is unavailable for setuid deb target: ${target.target}`);
|
|
485
|
+
await (0, node_fs_promises.chmod)((0, node_path.join)(installedDist, runtimeHelperExecutableName), 2541);
|
|
486
|
+
}
|
|
466
487
|
await (0, node_fs_promises.writeFile)((0, node_path.join)(installedDist, "muon-install.json"), `${JSON.stringify({
|
|
467
488
|
type: "deb",
|
|
468
489
|
packageName: metadata.packageName,
|
|
469
|
-
launcherPath: `/usr/bin/${metadata.packageName}
|
|
490
|
+
launcherPath: `/usr/bin/${metadata.packageName}`,
|
|
491
|
+
...linuxSandbox === "setuid" ? {
|
|
492
|
+
runtimeMode: "system-setuid",
|
|
493
|
+
systemRuntimePath,
|
|
494
|
+
privilegedPreparePath
|
|
495
|
+
} : {}
|
|
470
496
|
}, void 0, 2)}\n`);
|
|
471
497
|
const binPath = (0, node_path.join)(packageRoot, "usr", "bin", metadata.packageName);
|
|
472
498
|
const launcherName = (0, node_path.basename)(target.launcherPath);
|
|
@@ -497,12 +523,47 @@ var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot,
|
|
|
497
523
|
`Version: ${metadata.version}`,
|
|
498
524
|
`Architecture: ${architecture}`,
|
|
499
525
|
`Maintainer: ${metadata.author}`,
|
|
526
|
+
`Depends: ${debGtk3RuntimeDependency}`,
|
|
500
527
|
`Description: ${metadata.description}`,
|
|
501
528
|
""
|
|
502
529
|
].join("\n"));
|
|
530
|
+
if (linuxSandbox === "setuid") {
|
|
531
|
+
const postinstPath = (0, node_path.join)(packageRoot, "DEBIAN", "postinst");
|
|
532
|
+
await (0, node_fs_promises.writeFile)(postinstPath, [
|
|
533
|
+
"#!/bin/sh",
|
|
534
|
+
"set -e",
|
|
535
|
+
`helper=${JSON.stringify(privilegedPreparePath)}`,
|
|
536
|
+
"if [ ! -f \"$helper\" ]; then",
|
|
537
|
+
" echo \"muon-runtime-helper is missing: $helper\" >&2",
|
|
538
|
+
" exit 1",
|
|
539
|
+
"fi",
|
|
540
|
+
"chown root:root \"$helper\"",
|
|
541
|
+
"chmod 4755 \"$helper\"",
|
|
542
|
+
"exit 0",
|
|
543
|
+
""
|
|
544
|
+
].join("\n"));
|
|
545
|
+
await (0, node_fs_promises.chmod)(postinstPath, 493);
|
|
546
|
+
const postrmPath = (0, node_path.join)(packageRoot, "DEBIAN", "postrm");
|
|
547
|
+
await (0, node_fs_promises.writeFile)(postrmPath, [
|
|
548
|
+
"#!/bin/sh",
|
|
549
|
+
"set -e",
|
|
550
|
+
"if [ \"$1\" = \"purge\" ]; then",
|
|
551
|
+
` rm -rf ${JSON.stringify(`${systemRuntimeRoot}/${metadata.packageName}`)}`,
|
|
552
|
+
` # Shared CEF cache ${systemCefCacheRoot} is intentionally preserved.`,
|
|
553
|
+
"fi",
|
|
554
|
+
"exit 0",
|
|
555
|
+
""
|
|
556
|
+
].join("\n"));
|
|
557
|
+
await (0, node_fs_promises.chmod)(postrmPath, 493);
|
|
558
|
+
}
|
|
503
559
|
const outputPath = (0, node_path.join)(artifactsRoot, `${metadata.packageName}-${metadata.version}-${architecture}.deb`);
|
|
504
560
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(outputPath), { recursive: true });
|
|
561
|
+
progress?.({
|
|
562
|
+
phase: "pack",
|
|
563
|
+
status: "Running dpkg-deb"
|
|
564
|
+
});
|
|
505
565
|
await runTool("dpkg-deb", [
|
|
566
|
+
"--root-owner-group",
|
|
506
567
|
"--build",
|
|
507
568
|
packageRoot,
|
|
508
569
|
outputPath
|
|
@@ -516,22 +577,24 @@ var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot,
|
|
|
516
577
|
var escapeNsis = (value) => value.replaceAll("\\", "\\\\").replaceAll("\"", "$\\\"");
|
|
517
578
|
var nsisUninstallRegistryRoot = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
|
|
518
579
|
var createNsisUninstallRegistryKey = (appId) => `${nsisUninstallRegistryRoot}\\${appId}`;
|
|
519
|
-
var packageNsis = async (root, target, metadata,
|
|
580
|
+
var packageNsis = async (root, target, metadata, windowsResource, artifactsRoot, packageBuildRoot, environment, progress) => {
|
|
520
581
|
const descriptor = require_vite_internals.getMuonTargetDescriptor(target.target);
|
|
521
582
|
if (descriptor.os !== "windows") throw new Error(`Unsupported nsis target: ${target.target}`);
|
|
522
583
|
const scriptPath = (0, node_path.join)(packageBuildRoot, "nsis", `${metadata.packageName}-${target.target}.nsi`);
|
|
523
584
|
const outputPath = (0, node_path.join)(artifactsRoot, `${metadata.packageName}-${metadata.version}-${descriptor.arch}-setup.exe`);
|
|
524
585
|
const launcherFileName = (0, node_path.basename)(target.launcherPath);
|
|
525
|
-
const
|
|
586
|
+
const nsisDisplayName = `${metadata.packageName} (${descriptor.arch})`;
|
|
587
|
+
const nsisInstallDirectoryName = `${metadata.packageName}-${descriptor.arch}`;
|
|
588
|
+
const uninstallRegistryKey = createNsisUninstallRegistryKey(target.runtimeAppId);
|
|
526
589
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(scriptPath), { recursive: true });
|
|
527
590
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(outputPath), { recursive: true });
|
|
528
|
-
const iconPath =
|
|
529
|
-
|
|
591
|
+
const iconPath = (0, node_path.join)((0, node_path.dirname)(scriptPath), `${metadata.packageName}-${target.target}.ico`);
|
|
592
|
+
await require_vite_internals.createWindowsIconFromPngFile(windowsResource.iconPath, iconPath);
|
|
530
593
|
await (0, node_fs_promises.writeFile)(scriptPath, [
|
|
531
594
|
"Unicode true",
|
|
532
|
-
`Name "${escapeNsis(
|
|
595
|
+
`Name "${escapeNsis(nsisDisplayName)}"`,
|
|
533
596
|
`OutFile "${escapeNsis(outputPath)}"`,
|
|
534
|
-
`InstallDir "$LOCALAPPDATA\\Programs\\${escapeNsis(
|
|
597
|
+
`InstallDir "$LOCALAPPDATA\\Programs\\${escapeNsis(nsisInstallDirectoryName)}"`,
|
|
535
598
|
"RequestExecutionLevel user",
|
|
536
599
|
"ShowInstDetails nevershow",
|
|
537
600
|
"AutoCloseWindow true",
|
|
@@ -540,9 +603,9 @@ var packageNsis = async (root, target, metadata, appId, windowsResource, artifac
|
|
|
540
603
|
"Section",
|
|
541
604
|
" SetOutPath \"$INSTDIR\"",
|
|
542
605
|
` File /r "${escapeNsis(target.outputPath)}\\*"`,
|
|
543
|
-
` CreateShortCut "$SMPROGRAMS\\${escapeNsis(
|
|
606
|
+
` CreateShortCut "$SMPROGRAMS\\${escapeNsis(nsisDisplayName)}.lnk" "$INSTDIR\\${escapeNsis(launcherFileName)}"`,
|
|
544
607
|
" WriteUninstaller \"$INSTDIR\\Uninstall.exe\"",
|
|
545
|
-
` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "DisplayName" "${escapeNsis(
|
|
608
|
+
` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "DisplayName" "${escapeNsis(nsisDisplayName)}"`,
|
|
546
609
|
` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "DisplayVersion" "${escapeNsis(metadata.version)}"`,
|
|
547
610
|
` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "Publisher" "${escapeNsis(metadata.author)}"`,
|
|
548
611
|
` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "InstallLocation" "$INSTDIR"`,
|
|
@@ -554,10 +617,10 @@ var packageNsis = async (root, target, metadata, appId, windowsResource, artifac
|
|
|
554
617
|
"SectionEnd",
|
|
555
618
|
"",
|
|
556
619
|
"Section \"Uninstall\"",
|
|
557
|
-
` Delete "$SMPROGRAMS\\${escapeNsis(
|
|
620
|
+
` Delete "$SMPROGRAMS\\${escapeNsis(nsisDisplayName)}.lnk"`,
|
|
558
621
|
` DeleteRegKey HKCU "${escapeNsis(uninstallRegistryKey)}"`,
|
|
559
622
|
" RMDir /r \"$INSTDIR\"",
|
|
560
|
-
` RMDir /r "$LOCALAPPDATA\\${escapeNsis(
|
|
623
|
+
` RMDir /r "$LOCALAPPDATA\\${escapeNsis(target.runtimeAppId)}"`,
|
|
561
624
|
"SectionEnd",
|
|
562
625
|
"",
|
|
563
626
|
"Function .onInstSuccess",
|
|
@@ -567,6 +630,10 @@ var packageNsis = async (root, target, metadata, appId, windowsResource, artifac
|
|
|
567
630
|
"FunctionEnd",
|
|
568
631
|
""
|
|
569
632
|
].join("\n"));
|
|
633
|
+
progress?.({
|
|
634
|
+
phase: "pack",
|
|
635
|
+
status: "Running makensis"
|
|
636
|
+
});
|
|
570
637
|
await runTool("makensis", [scriptPath], root, environment);
|
|
571
638
|
if (await statOrUndefined(outputPath) === void 0) throw new Error(`makensis did not create installer: ${outputPath}`);
|
|
572
639
|
return {
|
|
@@ -577,10 +644,8 @@ var packageNsis = async (root, target, metadata, appId, windowsResource, artifac
|
|
|
577
644
|
};
|
|
578
645
|
var createNsisResourceDirectives = (resource, iconPath) => {
|
|
579
646
|
const lines = [];
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
lines.push(`UninstallIcon "${escapeNsis(iconPath)}"`);
|
|
583
|
-
}
|
|
647
|
+
lines.push(`Icon "${escapeNsis(iconPath)}"`);
|
|
648
|
+
lines.push(`UninstallIcon "${escapeNsis(iconPath)}"`);
|
|
584
649
|
lines.push(`VIProductVersion "${escapeNsis(resource.fixedVersion)}"`);
|
|
585
650
|
lines.push(`VIFileVersion "${escapeNsis(resource.fixedVersion)}"`);
|
|
586
651
|
lines.push(`VIAddVersionKey /LANG=${resource.language} "CompanyName" "${escapeNsis(resource.companyName)}"`);
|
|
@@ -592,12 +657,23 @@ var createNsisResourceDirectives = (resource, iconPath) => {
|
|
|
592
657
|
return lines;
|
|
593
658
|
};
|
|
594
659
|
var reapplyPackWindowsResources = async (targets, resource, root, environment) => {
|
|
595
|
-
for (const target of targets)
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
660
|
+
for (const target of targets) {
|
|
661
|
+
const descriptor = require_vite_internals.getMuonTargetDescriptor(target.target);
|
|
662
|
+
if (descriptor.os === "windows") {
|
|
663
|
+
await require_vite_internals.updateWindowsPeIconResource({
|
|
664
|
+
executablePath: (0, node_path.join)(target.outputPath, descriptor.runtimeExecutableName),
|
|
665
|
+
resource,
|
|
666
|
+
environment,
|
|
667
|
+
cwd: root
|
|
668
|
+
});
|
|
669
|
+
await require_vite_internals.updateWindowsPeResources({
|
|
670
|
+
executablePath: target.launcherPath,
|
|
671
|
+
resource,
|
|
672
|
+
environment,
|
|
673
|
+
cwd: root
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
}
|
|
601
677
|
};
|
|
602
678
|
/**
|
|
603
679
|
* Runs the Muon build sequence and creates redistributable packages.
|
|
@@ -606,6 +682,7 @@ var reapplyPackWindowsResources = async (targets, resource, root, environment) =
|
|
|
606
682
|
* @returns Generated package artifacts.
|
|
607
683
|
*/
|
|
608
684
|
var packMuonApp = async (options) => {
|
|
685
|
+
const progress = options.progress;
|
|
609
686
|
const cwd = (0, node_path.resolve)(options.root ?? process.cwd());
|
|
610
687
|
const environment = options.environment ?? process.env;
|
|
611
688
|
const project = await require_vite_internals.loadMuonBuildSequenceProject(cwd);
|
|
@@ -615,21 +692,27 @@ var packMuonApp = async (options) => {
|
|
|
615
692
|
const artifactsRoot = (0, node_path.resolve)(root, options.artifactsDir ?? defaultArtifactsDirectory);
|
|
616
693
|
const packageBuildRoot = (0, node_path.resolve)(root, defaultPackageBuildDirectory);
|
|
617
694
|
const types = normalizePackTypes(options.types);
|
|
695
|
+
const linuxSandbox = normalizeLinuxSandboxMode(options.linuxSandbox);
|
|
618
696
|
const pluginBuildOptions = require_vite_internals.resolveMuonViteBuildOptions(project.pluginOptions);
|
|
619
697
|
const targetPlan = createPackTargetPlan(types, resolvePackTargetCandidates(options, pluginBuildOptions));
|
|
698
|
+
validateLinuxSandboxModeForPlan(linuxSandbox, targetPlan);
|
|
620
699
|
const buildOptions = {
|
|
621
700
|
root: cwd,
|
|
622
701
|
targets: targetPlan.map((entry) => entry.target),
|
|
623
|
-
allTargets: false
|
|
702
|
+
allTargets: false,
|
|
703
|
+
includeRuntimeHelper: linuxSandbox === "setuid"
|
|
624
704
|
};
|
|
625
705
|
const windowsResourceOptions = require_vite_internals.mergeMuonWindowsResourceOptions(options.windowsResource, pluginBuildOptions.windowsResource);
|
|
626
706
|
const linuxDesktopOptions = require_vite_internals.mergeMuonLinuxDesktopOptions(options.linuxDesktop, pluginBuildOptions.linuxDesktop);
|
|
707
|
+
const iconPath = options.iconPath ?? pluginBuildOptions.iconPath;
|
|
627
708
|
if (options.configPath !== void 0) buildOptions.configPath = options.configPath;
|
|
709
|
+
if (iconPath !== void 0) buildOptions.iconPath = iconPath;
|
|
628
710
|
if (options.appName !== void 0) buildOptions.appName = options.appName;
|
|
629
711
|
if (options.appId !== void 0) buildOptions.appId = options.appId;
|
|
630
712
|
if (options.packageDirectory !== void 0) buildOptions.packageDirectory = options.packageDirectory;
|
|
631
713
|
if (windowsResourceOptions !== void 0) buildOptions.windowsResource = windowsResourceOptions;
|
|
632
714
|
if (linuxDesktopOptions !== void 0) buildOptions.linuxDesktop = linuxDesktopOptions;
|
|
715
|
+
if (progress !== void 0) buildOptions.progress = progress;
|
|
633
716
|
const windowsResourceConfig = await require_vite_internals.readMuonConfigForWindowsResource(root, options.configPath);
|
|
634
717
|
const windowsResource = await require_vite_internals.resolveMuonWindowsResource({
|
|
635
718
|
root,
|
|
@@ -638,6 +721,7 @@ var packMuonApp = async (options) => {
|
|
|
638
721
|
muonConfig: windowsResourceConfig.config,
|
|
639
722
|
muonConfigDirectory: windowsResourceConfig.directory,
|
|
640
723
|
options: windowsResourceOptions,
|
|
724
|
+
appIconPath: iconPath,
|
|
641
725
|
defaults: {
|
|
642
726
|
productName: metadata.packageName,
|
|
643
727
|
fileDescription: metadata.description,
|
|
@@ -646,6 +730,10 @@ var packMuonApp = async (options) => {
|
|
|
646
730
|
copyright: void 0
|
|
647
731
|
}
|
|
648
732
|
});
|
|
733
|
+
progress?.({
|
|
734
|
+
phase: "pack",
|
|
735
|
+
status: "Building distributions"
|
|
736
|
+
});
|
|
649
737
|
const build = await require_vite_internals.runMuonBuildSequence(buildOptions, project);
|
|
650
738
|
if (options.packageVersion !== void 0) await reapplyPackWindowsResources(build.targets, windowsResource, root, environment);
|
|
651
739
|
const typesByTarget = new Map(targetPlan.map((entry) => [entry.target, entry.types]));
|
|
@@ -663,10 +751,25 @@ var packMuonApp = async (options) => {
|
|
|
663
751
|
});
|
|
664
752
|
await (0, node_fs_promises.mkdir)(artifactsRoot, { recursive: true });
|
|
665
753
|
const artifacts = [];
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
754
|
+
const totalArtifacts = targetPlan.reduce((sum, entry) => sum + entry.types.length, 0);
|
|
755
|
+
let artifactIndex = 0;
|
|
756
|
+
for (const target of build.targets) for (const type of typesByTarget.get(target.target) ?? []) {
|
|
757
|
+
artifactIndex += 1;
|
|
758
|
+
progress?.({
|
|
759
|
+
phase: "pack",
|
|
760
|
+
status: `Packaging ${type} ${target.target} (${artifactIndex}/${totalArtifacts})`
|
|
761
|
+
});
|
|
762
|
+
let artifact;
|
|
763
|
+
if (type === "zip") artifact = await packageZip(target, metadata, artifactsRoot);
|
|
764
|
+
else if (type === "tar.gz") artifact = await packageTarGz(target, metadata, artifactsRoot);
|
|
765
|
+
else if (type === "deb") artifact = await packageDeb(root, target, metadata, artifactsRoot, packageBuildRoot, environment, linuxSandbox, progress);
|
|
766
|
+
else artifact = await packageNsis(root, target, metadata, windowsResource, artifactsRoot, packageBuildRoot, environment, progress);
|
|
767
|
+
artifacts.push(artifact);
|
|
768
|
+
progress?.({
|
|
769
|
+
phase: "pack",
|
|
770
|
+
status: `Wrote ${artifact.path}`
|
|
771
|
+
});
|
|
772
|
+
}
|
|
670
773
|
return {
|
|
671
774
|
root,
|
|
672
775
|
packageName: metadata.packageName,
|
|
@@ -680,8 +783,8 @@ var packMuonApp = async (options) => {
|
|
|
680
783
|
};
|
|
681
784
|
//#endregion
|
|
682
785
|
//#region src/generated/packageMetadata.ts
|
|
683
|
-
var version = "0.
|
|
684
|
-
var git_commit_hash = "
|
|
786
|
+
var version = "0.10.0";
|
|
787
|
+
var git_commit_hash = "7bf3c14f4ebc9ae604525ea66a10289463c086ab";
|
|
685
788
|
//#endregion
|
|
686
789
|
//#region src/cli.ts
|
|
687
790
|
var readTargetValues = (value) => {
|
|
@@ -738,6 +841,7 @@ var runBuildCommand = async (commandOptions) => {
|
|
|
738
841
|
if (commandOptions.all === true) buildOptions.allTargets = true;
|
|
739
842
|
if (commandOptions.assets !== void 0) buildOptions.assetSourcePath = commandOptions.assets;
|
|
740
843
|
if (commandOptions.config !== void 0) buildOptions.configPath = commandOptions.config;
|
|
844
|
+
if (commandOptions.icon !== void 0) buildOptions.iconPath = commandOptions.icon;
|
|
741
845
|
const windowsResource = createWindowsResourceOptions(commandOptions);
|
|
742
846
|
if (windowsResource !== void 0) buildOptions.windowsResource = windowsResource;
|
|
743
847
|
const linuxDesktop = createLinuxDesktopOptions(commandOptions);
|
|
@@ -746,7 +850,15 @@ var runBuildCommand = async (commandOptions) => {
|
|
|
746
850
|
if (commandOptions.name !== void 0) buildOptions.appName = commandOptions.name;
|
|
747
851
|
if (commandOptions.appId !== void 0) buildOptions.appId = commandOptions.appId;
|
|
748
852
|
if (commandOptions.packageDirectory !== void 0) buildOptions.packageDirectory = commandOptions.packageDirectory;
|
|
749
|
-
const
|
|
853
|
+
const progressRenderer = require_vite_internals.createMuonProgressRenderer();
|
|
854
|
+
buildOptions.progress = progressRenderer.report;
|
|
855
|
+
const result = await (async () => {
|
|
856
|
+
try {
|
|
857
|
+
return await require_vite_internals.runMuonBuildSequence(buildOptions);
|
|
858
|
+
} finally {
|
|
859
|
+
progressRenderer.flush();
|
|
860
|
+
}
|
|
861
|
+
})();
|
|
750
862
|
if (commandOptions.json === true) console.log(JSON.stringify(result, null, 2));
|
|
751
863
|
else for (const target of result.targets) console.log(target.outputPath);
|
|
752
864
|
};
|
|
@@ -761,10 +873,12 @@ var runPackCommand = async (commandOptions) => {
|
|
|
761
873
|
if (targets.length > 0) packOptions.targets = targets;
|
|
762
874
|
if (commandOptions.all !== void 0) packOptions.allTargets = commandOptions.all;
|
|
763
875
|
if (commandOptions.config !== void 0) packOptions.configPath = commandOptions.config;
|
|
876
|
+
if (commandOptions.icon !== void 0) packOptions.iconPath = commandOptions.icon;
|
|
764
877
|
const windowsResource = createWindowsResourceOptions(commandOptions);
|
|
765
878
|
if (windowsResource !== void 0) packOptions.windowsResource = windowsResource;
|
|
766
879
|
const linuxDesktop = createLinuxDesktopOptions(commandOptions);
|
|
767
880
|
if (linuxDesktop !== void 0) packOptions.linuxDesktop = linuxDesktop;
|
|
881
|
+
if (commandOptions.linuxSandbox !== void 0) packOptions.linuxSandbox = commandOptions.linuxSandbox;
|
|
768
882
|
if (commandOptions.name !== void 0) packOptions.appName = commandOptions.name;
|
|
769
883
|
if (commandOptions.appId !== void 0) packOptions.appId = commandOptions.appId;
|
|
770
884
|
if (commandOptions.packageDirectory !== void 0) packOptions.packageDirectory = commandOptions.packageDirectory;
|
|
@@ -773,7 +887,15 @@ var runPackCommand = async (commandOptions) => {
|
|
|
773
887
|
if (commandOptions.packageVersion !== void 0) packOptions.packageVersion = commandOptions.packageVersion;
|
|
774
888
|
if (commandOptions.description !== void 0) packOptions.description = commandOptions.description;
|
|
775
889
|
if (commandOptions.author !== void 0) packOptions.author = commandOptions.author;
|
|
776
|
-
const
|
|
890
|
+
const progressRenderer = require_vite_internals.createMuonProgressRenderer();
|
|
891
|
+
packOptions.progress = progressRenderer.report;
|
|
892
|
+
const result = await (async () => {
|
|
893
|
+
try {
|
|
894
|
+
return await packMuonApp(packOptions);
|
|
895
|
+
} finally {
|
|
896
|
+
progressRenderer.flush();
|
|
897
|
+
}
|
|
898
|
+
})();
|
|
777
899
|
if (commandOptions.json === true) console.log(JSON.stringify(result, null, 2));
|
|
778
900
|
else for (const artifact of result.artifacts) console.log(artifact.path);
|
|
779
901
|
};
|
|
@@ -852,13 +974,13 @@ var createCliCommand = () => {
|
|
|
852
974
|
program.outputHelp({ error: true });
|
|
853
975
|
process.exitCode = 1;
|
|
854
976
|
});
|
|
855
|
-
program.command("build").description("Build CEF-free Muon app distribution directories").option("--target <target>", "public target or comma-separated public targets", appendTargetValues, []).option("--all", "build all supported targets").option("--assets <path>", "asset root path").option("--config <path>", "muon config path").option("--windows-icon <path>", "Windows PNG icon resource path").option("--windows-product-name <name>", "Windows product name").option("--windows-file-description <text>", "Windows file description").option("--windows-company-name <name>", "Windows company name").option("--windows-version <version>", "Windows resource version").option("--windows-copyright <text>", "Windows legal copyright").option("--linux-desktop-id <id>", "Linux desktop entry identifier").option("--linux-name <name>", "Linux desktop display name").option("--linux-comment <text>", "Linux desktop comment").option("--linux-icon <path>", "Linux desktop PNG icon path").option("--linux-categories <list>", "Linux desktop categories").option("--linux-startup-notify <boolean>", "Linux startup notification").option("--out-dir <path>", "output root directory").option("--name <name>", "launcher file name").option("--app-id <id>", "stable application identifier").option("--package-directory <path>", "Muon package dist directory").option("--json", "write result as JSON").action(async (options) => {
|
|
977
|
+
program.command("build").description("Build CEF-free Muon app distribution directories").option("--target <target>", "public target or comma-separated public targets", appendTargetValues, []).option("--all", "build all supported targets").option("--assets <path>", "asset root path").option("--config <path>", "muon config path").option("--icon <path>", "static application PNG icon path").option("--windows-icon <path>", "Windows PNG icon resource path").option("--windows-product-name <name>", "Windows product name").option("--windows-file-description <text>", "Windows file description").option("--windows-company-name <name>", "Windows company name").option("--windows-version <version>", "Windows resource version").option("--windows-copyright <text>", "Windows legal copyright").option("--linux-desktop-id <id>", "Linux desktop entry identifier").option("--linux-name <name>", "Linux desktop display name").option("--linux-comment <text>", "Linux desktop comment").option("--linux-icon <path>", "Linux desktop PNG icon path").option("--linux-categories <list>", "Linux desktop categories").option("--linux-startup-notify <boolean>", "Linux startup notification").option("--out-dir <path>", "output root directory").option("--name <name>", "launcher file name").option("--app-id <id>", "stable application identifier").option("--package-directory <path>", "Muon package dist directory").option("--json", "write result as JSON").action(async (options) => {
|
|
856
978
|
await runBuildCommand(options);
|
|
857
979
|
});
|
|
858
|
-
program.command("pack").description("Build and package a Muon app").option("--type <type>", "package type or comma-separated package types: zip, tar.gz, tgz, deb, nsis (default: all)", appendPackTypeValues).option("--target <target>", "public target, platform, arch, or comma-separated selectors", appendTargetValues, []).option("--all", "build all supported targets").option("--config <path>", "muon config path").option("--windows-icon <path>", "Windows PNG icon resource path").option("--windows-product-name <name>", "Windows product name").option("--windows-file-description <text>", "Windows file description").option("--windows-company-name <name>", "Windows company name").option("--windows-version <version>", "Windows resource version").option("--windows-copyright <text>", "Windows legal copyright").option("--linux-desktop-id <id>", "Linux desktop entry identifier").option("--linux-name <name>", "Linux desktop display name").option("--linux-comment <text>", "Linux desktop comment").option("--linux-icon <path>", "Linux desktop PNG icon path").option("--linux-categories <list>", "Linux desktop categories").option("--linux-startup-notify <boolean>", "Linux startup notification").option("--name <name>", "launcher file name").option("--app-id <id>", "stable application identifier").option("--package-directory <path>", "Muon package dist directory").option("--artifacts-dir <path>", "package artifact output directory").option("--package-name <name>", "package name override").option("--package-version <version>", "package version override").option("--description <text>", "package description override").option("--author <text>", "package author override").option("--json", "write result as JSON").action(async (options) => {
|
|
980
|
+
program.command("pack").description("Build and package a Muon app").option("--type <type>", "package type or comma-separated package types: zip, tar.gz, tgz, deb, nsis (default: all)", appendPackTypeValues).option("--target <target>", "public target, platform, arch, or comma-separated selectors", appendTargetValues, []).option("--all", "build all supported targets").option("--config <path>", "muon config path").option("--icon <path>", "static application PNG icon path").option("--windows-icon <path>", "Windows PNG icon resource path").option("--windows-product-name <name>", "Windows product name").option("--windows-file-description <text>", "Windows file description").option("--windows-company-name <name>", "Windows company name").option("--windows-version <version>", "Windows resource version").option("--windows-copyright <text>", "Windows legal copyright").option("--linux-desktop-id <id>", "Linux desktop entry identifier").option("--linux-name <name>", "Linux desktop display name").option("--linux-comment <text>", "Linux desktop comment").option("--linux-icon <path>", "Linux desktop PNG icon path").option("--linux-categories <list>", "Linux desktop categories").option("--linux-startup-notify <boolean>", "Linux startup notification").option("--linux-sandbox <mode>", "Linux deb CEF sandbox mode: disabled, setuid").option("--name <name>", "launcher file name").option("--app-id <id>", "stable application identifier").option("--package-directory <path>", "Muon package dist directory").option("--artifacts-dir <path>", "package artifact output directory").option("--package-name <name>", "package name override").option("--package-version <version>", "package version override").option("--description <text>", "package description override").option("--author <text>", "package author override").option("--json", "write result as JSON").action(async (options) => {
|
|
859
981
|
await runPackCommand(options);
|
|
860
982
|
});
|
|
861
|
-
const devCommand = program.command("
|
|
983
|
+
const devCommand = program.command("run").description("Launch Muon directly with local development assets").option("--muon-path <path>", "Muon runtime file root").option("--cef-path <path>", "CEF file root").option("--stage-dir <path>", "prepared runtime output directory").option("--config <path>", "muon config path").option("--assets <path>", "development asset directory").option("--no-debugger", "disable Muon debugger defaults").option("--json", "write result as JSON").action(async (options) => {
|
|
862
984
|
await runDevCommand(options, devCommand);
|
|
863
985
|
});
|
|
864
986
|
program.command("init").description("Initialize Muon project helper files").action(async () => {
|