muon-ui 0.7.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.
Files changed (46) hide show
  1. package/README.md +9 -12
  2. package/dist/cli.cjs +291 -126
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/index.cjs +2 -2
  5. package/dist/index.mjs +2 -2
  6. package/dist/native/linux-amd64/muon-bootstrap +0 -0
  7. package/dist/native/linux-amd64/muon-builder +0 -0
  8. package/dist/native/linux-arm64/muon-bootstrap +0 -0
  9. package/dist/native/linux-arm64/{muon-prepare → muon-builder} +0 -0
  10. package/dist/native/linux-armhf/muon-bootstrap +0 -0
  11. package/dist/native/linux-armhf/{muon-prepare → muon-builder} +0 -0
  12. package/dist/native/muon-256.png +0 -0
  13. package/dist/native/windows-amd64/muon-bootstrap.exe +0 -0
  14. package/dist/native/windows-amd64/muon-builder.exe +0 -0
  15. package/dist/native/windows-i686/muon-bootstrap.exe +0 -0
  16. package/dist/native/windows-i686/muon-builder.exe +0 -0
  17. package/dist/runtime/linux-amd64/CREDITS.md +24 -0
  18. package/dist/runtime/linux-amd64/libmuon-ui.so +0 -0
  19. package/dist/runtime/linux-amd64/muon-core +0 -0
  20. package/dist/runtime/linux-arm64/CREDITS.md +24 -0
  21. package/dist/runtime/linux-arm64/libmuon-ui.so +0 -0
  22. package/dist/runtime/linux-arm64/muon-core +0 -0
  23. package/dist/runtime/linux-armhf/CREDITS.md +24 -0
  24. package/dist/runtime/linux-armhf/libmuon-ui.so +0 -0
  25. package/dist/runtime/linux-armhf/muon-core +0 -0
  26. package/dist/runtime/windows-amd64/CREDITS.md +24 -0
  27. package/dist/runtime/windows-amd64/libcardio.dll +0 -0
  28. package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
  29. package/dist/runtime/windows-amd64/muon-core.exe +0 -0
  30. package/dist/runtime/windows-i686/CREDITS.md +24 -0
  31. package/dist/runtime/windows-i686/libcardio.dll +0 -0
  32. package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
  33. package/dist/runtime/windows-i686/muon-core.exe +0 -0
  34. package/dist/{vite-options-FFh0NWUa.cjs → vite-internals-HXgH7b5M.cjs} +1460 -121
  35. package/dist/vite-internals-HXgH7b5M.cjs.map +1 -0
  36. package/dist/vite.cjs +452 -10
  37. package/dist/vite.cjs.map +1 -1
  38. package/dist/vite.mjs +1552 -92
  39. package/dist/vite.mjs.map +1 -1
  40. package/muon.d.ts +141 -27
  41. package/package.json +14 -10
  42. package/vite.d.ts +276 -14
  43. package/dist/native/linux-amd64/muon-prepare +0 -0
  44. package/dist/native/windows-amd64/muon-prepare.exe +0 -0
  45. package/dist/native/windows-i686/muon-prepare.exe +0 -0
  46. package/dist/vite-options-FFh0NWUa.cjs.map +0 -1
package/dist/cli.cjs CHANGED
@@ -1,23 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  * name: muon-ui
4
- * version: 0.7.0
4
+ * version: 0.9.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: fe80718aaa617c0c0ea5c816bbe38d22bf2e8402
9
+ * git.commit.hash: 3437b522a51d8772713b72722b109c5ff30fc711
10
10
  */
11
- const require_vite_options = require("./vite-options-FFh0NWUa.cjs");
11
+ const require_vite_internals = require("./vite-internals-HXgH7b5M.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");
15
15
  let node_fs_promises = require("node:fs/promises");
16
16
  let node_path = require("node:path");
17
17
  let adm_zip = require("adm-zip");
18
- adm_zip = require_vite_options.__toESM(adm_zip, 1);
18
+ adm_zip = require_vite_internals.__toESM(adm_zip, 1);
19
+ let tar_vern = require("tar-vern");
19
20
  //#region src/dev.ts
20
- var import_dist = require_vite_options.require_dist();
21
+ var import_dist = require_vite_internals.require_dist();
21
22
  var muonRecycleExitCode = 88;
22
23
  var defaultProjectConfigFileNames = [
23
24
  "muon.json5",
@@ -41,16 +42,16 @@ var directoryExists = async (path) => {
41
42
  return false;
42
43
  }
43
44
  };
44
- var isMissingVitePackageError$1 = (error) => {
45
+ var isMissingVitePackageError = (error) => {
45
46
  const candidate = error;
46
47
  return candidate.code === "ERR_MODULE_NOT_FOUND" && typeof candidate.message === "string" && candidate.message.includes("vite");
47
48
  };
48
- var loadViteMuonOptions$1 = async (cwd) => {
49
+ var loadViteMuonOptions = async (cwd) => {
49
50
  let vite;
50
51
  try {
51
52
  vite = await import("vite");
52
53
  } catch (error) {
53
- if (isMissingVitePackageError$1(error)) return {
54
+ if (isMissingVitePackageError(error)) return {
54
55
  root: (0, node_path.resolve)(cwd),
55
56
  pluginOptions: void 0
56
57
  };
@@ -68,7 +69,7 @@ var loadViteMuonOptions$1 = async (cwd) => {
68
69
  };
69
70
  const config = loaded.config;
70
71
  const root = typeof config.root === "string" ? (0, node_path.resolve)(cwd, config.root) : (0, node_path.resolve)(cwd);
71
- const muonPlugins = (await require_vite_options.flattenVitePluginOptions(config.plugins)).map((plugin) => require_vite_options.getMuonVitePluginOptions(plugin)).filter((pluginOptions) => pluginOptions !== void 0);
72
+ const muonPlugins = (await require_vite_internals.flattenVitePluginOptions(config.plugins)).map((plugin) => require_vite_internals.getMuonVitePluginOptions(plugin)).filter((pluginOptions) => pluginOptions !== void 0);
72
73
  if (muonPlugins.length > 1) throw new Error("Multiple muon() plugin definitions were found in vite.config.*.");
73
74
  return {
74
75
  root,
@@ -129,9 +130,9 @@ var assertDevelopmentAssetDirectory = async (assetSourcePath) => {
129
130
  try {
130
131
  await (0, node_fs_promises.access)(assetSourcePath, node_fs.constants.F_OK);
131
132
  } catch {
132
- throw new Error(`Muon dev asset source does not exist: ${assetSourcePath}`);
133
+ throw new Error(`Muon run asset source does not exist: ${assetSourcePath}`);
133
134
  }
134
- throw new Error(`Muon dev asset source must be a directory: ${assetSourcePath}`);
135
+ throw new Error(`Muon run asset source must be a directory: ${assetSourcePath}`);
135
136
  };
136
137
  var resolveAssetSource = async (root, assetSourcePath, projectConfig) => {
137
138
  const configuredAssetSourcePath = readConfigAssetSourcePath(projectConfig.config);
@@ -197,14 +198,14 @@ var runMuonExecutable = async (muonExecutablePath, configPaths, environment) =>
197
198
  * @returns Development startup result after the Muon process exits.
198
199
  */
199
200
  var runMuonDev = async (options = {}) => {
200
- const loadedViteOptions = await loadViteMuonOptions$1((0, node_path.resolve)(options.root ?? process.cwd()));
201
+ const loadedViteOptions = await loadViteMuonOptions((0, node_path.resolve)(options.root ?? process.cwd()));
201
202
  const root = loadedViteOptions.root;
202
203
  const pluginOptions = loadedViteOptions.pluginOptions;
203
204
  const platform = options.platform ?? process.platform;
204
205
  const architecture = options.architecture ?? process.arch;
205
206
  const environment = options.environment ?? process.env;
206
- const target = require_vite_options.getDefaultMuonPrepareTarget(platform, architecture);
207
- const muonPath = require_vite_options.resolveMuonRuntimePath({
207
+ const target = require_vite_internals.getDefaultMuonPrepareTarget(platform, architecture);
208
+ const muonPath = require_vite_internals.resolveMuonRuntimePath({
208
209
  root,
209
210
  target,
210
211
  muonPath: options.muonPath ?? pluginOptions?.muonPath
@@ -214,9 +215,9 @@ var runMuonDev = async (options = {}) => {
214
215
  const enableDebugger = options.enableDebugger ?? pluginOptions?.enableDebugger ?? true;
215
216
  const projectConfig = await resolveProjectConfig(root, options.configPath);
216
217
  const asset = await resolveAssetSource(root, options.assetSourcePath, projectConfig);
217
- const overrideConfigPath = (0, node_path.join)(root, ".muon", "dev", "muon.dev.json");
218
- await require_vite_options.ensureMuonGitignoreEntry(root);
219
- const preparedRuntime = await require_vite_options.runMuonPrepare({
218
+ const overrideConfigPath = (0, node_path.join)(root, ".muon", "run", "muon.run.json");
219
+ await require_vite_internals.ensureMuonGitignoreEntry(root);
220
+ const preparedRuntime = await require_vite_internals.runMuonPrepare({
220
221
  muonPath,
221
222
  cefPath,
222
223
  stageDir: stagePath,
@@ -228,9 +229,9 @@ var runMuonDev = async (options = {}) => {
228
229
  environment,
229
230
  cwd: root
230
231
  });
231
- if (preparedRuntime.stagePath === void 0) throw new Error("muon-prepare did not return a staged runtime path.");
232
+ if (preparedRuntime.stagePath === void 0) throw new Error("muon-builder did not return a staged runtime path.");
232
233
  await writeMuonDevOverrideConfig(overrideConfigPath, createMuonDevOverrideConfig(asset.overrideAssetSourcePath, enableDebugger));
233
- const muonExecutablePath = require_vite_options.getMuonExecutablePath(preparedRuntime.stagePath, platform);
234
+ const muonExecutablePath = require_vite_internals.getMuonExecutablePath(preparedRuntime.stagePath, platform);
234
235
  const exitCode = await runMuonExecutable(muonExecutablePath, [...projectConfig.configPath === void 0 ? [] : [projectConfig.configPath], overrideConfigPath], environment);
235
236
  return {
236
237
  root,
@@ -269,47 +270,13 @@ function __resolveDefaultExport(module, isESM) {
269
270
  }
270
271
  var supportedPackTypes = [
271
272
  "zip",
273
+ "tar.gz",
272
274
  "deb",
273
275
  "nsis"
274
276
  ];
275
277
  var defaultArtifactsDirectory = "artifacts";
276
278
  var defaultPackageBuildDirectory = ".muon/pack";
277
- var suppressViteMuonBuildEnvironmentKey = "MUON_SUPPRESS_VITE_MUON_BUILD";
278
279
  var isJsonObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
279
- var isMissingVitePackageError = (error) => {
280
- const candidate = error;
281
- return candidate.code === "ERR_MODULE_NOT_FOUND" && typeof candidate.message === "string" && candidate.message.includes("vite");
282
- };
283
- var loadViteMuonOptions = async (cwd) => {
284
- let vite;
285
- try {
286
- vite = await import("vite");
287
- } catch (error) {
288
- if (isMissingVitePackageError(error)) return {
289
- root: (0, node_path.resolve)(cwd),
290
- pluginOptions: void 0
291
- };
292
- throw error;
293
- }
294
- const loaded = await vite.loadConfigFromFile({
295
- command: "build",
296
- mode: "production",
297
- isPreview: false,
298
- isSsrBuild: false
299
- }, void 0, cwd, "silent");
300
- if (loaded === null) return {
301
- root: (0, node_path.resolve)(cwd),
302
- pluginOptions: void 0
303
- };
304
- const config = loaded.config;
305
- const root = typeof config.root === "string" ? (0, node_path.resolve)(cwd, config.root) : (0, node_path.resolve)(cwd);
306
- const muonPlugins = (await require_vite_options.flattenVitePluginOptions(config.plugins)).map((plugin) => require_vite_options.getMuonVitePluginOptions(plugin)).filter((pluginOptions) => pluginOptions !== void 0);
307
- if (muonPlugins.length > 1) throw new Error("Multiple muon() plugin definitions were found in vite.config.*.");
308
- return {
309
- root,
310
- pluginOptions: muonPlugins[0]
311
- };
312
- };
313
280
  var readJsonObjectFile = async (path) => {
314
281
  const parsed = (0, import_dist.parse)(await (0, node_fs_promises.readFile)(path, "utf8"));
315
282
  if (!isJsonObject(parsed)) throw new Error(`JSON file must contain an object: ${path}`);
@@ -341,51 +308,63 @@ var resolveMetadata = (packageJson, options) => {
341
308
  author
342
309
  };
343
310
  };
311
+ var createPackMetadataPackageJson = (packageJson, metadata) => ({
312
+ ...packageJson,
313
+ version: metadata.version
314
+ });
344
315
  var normalizePackTypes = (types) => {
345
- const normalized = types.flatMap((value) => value.split(",")).map((value) => value.trim().toLowerCase()).filter((value) => value.length > 0);
316
+ if (types === void 0) return [...supportedPackTypes];
317
+ const normalized = types.flatMap((value) => value.split(",")).map((value) => value.trim().toLowerCase()).map((value) => value === "tgz" ? "tar.gz" : value).filter((value) => value.length > 0);
346
318
  if (normalized.length === 0) throw new Error("Specify at least one package type with --type.");
347
319
  for (const type of normalized) if (!supportedPackTypes.includes(type)) throw new Error(`Unsupported muon pack type: ${type}`);
348
320
  return [...new Set(normalized)];
349
321
  };
350
- var getPluginBuildOptions = (pluginOptions) => {
351
- return typeof pluginOptions?.build === "object" ? pluginOptions.build : {};
352
- };
353
- var resolveBuildOutputDirectory = async (root) => {
354
- const resolved = await (await import("vite")).resolveConfig({ root }, "build", "production", "production");
355
- return (0, node_path.isAbsolute)(resolved.build.outDir) ? resolved.build.outDir : (0, node_path.resolve)(resolved.root, resolved.build.outDir);
356
- };
357
- var runViteBuild = async (root, _environment) => {
358
- const vite = await import("vite");
359
- const previous = process.env[suppressViteMuonBuildEnvironmentKey];
360
- process.env[suppressViteMuonBuildEnvironmentKey] = "1";
361
- try {
362
- await vite.build({ root });
363
- } finally {
364
- if (previous === void 0) delete process.env[suppressViteMuonBuildEnvironmentKey];
365
- else process.env[suppressViteMuonBuildEnvironmentKey] = previous;
366
- }
367
- };
368
- var createBuildOptions = (root, assetSourcePath, pluginBuildOptions, options) => {
369
- const buildOptions = {
370
- root,
371
- assetSourcePath,
372
- assetPrefix: "main"
373
- };
374
- Object.assign(buildOptions, pluginBuildOptions);
375
- if (options.targets !== void 0 && options.targets.length > 0) {
376
- buildOptions.targets = options.targets;
377
- buildOptions.allTargets = false;
378
- } else if (options.allTargets !== void 0) buildOptions.allTargets = options.allTargets;
379
- if (options.configPath !== void 0) buildOptions.configPath = options.configPath;
380
- if (options.appName !== void 0) buildOptions.appName = options.appName;
381
- if (options.appId !== void 0) buildOptions.appId = options.appId;
382
- if (options.packageDirectory !== void 0) buildOptions.packageDirectory = options.packageDirectory;
383
- return buildOptions;
384
- };
385
- var assertPackTypeSupportsTarget = (type, target) => {
386
- const descriptor = require_vite_options.getMuonTargetDescriptor(target);
387
- if (type === "deb" && descriptor.os !== "linux") throw new Error("deb packaging supports only Linux targets.");
388
- if (type === "nsis" && descriptor.os !== "windows") throw new Error("nsis packaging supports only Windows targets.");
322
+ var packTargetSelectorTargets = {
323
+ linux: [
324
+ "linux-amd64",
325
+ "linux-armhf",
326
+ "linux-arm64"
327
+ ],
328
+ windows: ["windows-i686", "windows-amd64"],
329
+ amd64: ["linux-amd64", "windows-amd64"],
330
+ arm64: ["linux-arm64"],
331
+ armhf: ["linux-armhf"],
332
+ i686: ["windows-i686"]
333
+ };
334
+ var normalizePackTargetSelector = (selector) => {
335
+ const normalized = selector.trim().toLowerCase();
336
+ if (require_vite_internals.allMuonTargets.includes(normalized)) return [normalized];
337
+ const targets = packTargetSelectorTargets[normalized];
338
+ if (targets !== void 0) return targets;
339
+ throw new Error(`Unsupported muon pack target selector: ${selector}`);
340
+ };
341
+ var normalizePackTargetSelectors = (selectors) => {
342
+ const targets = selectors.flatMap((selector) => selector.split(",")).map((selector) => selector.trim()).filter((selector) => selector.length > 0).flatMap((selector) => normalizePackTargetSelector(selector));
343
+ return [...new Set(targets)];
344
+ };
345
+ var normalizePluginBuildTargets = (targets) => {
346
+ return [...new Set(targets.map((target) => require_vite_internals.normalizeMuonTarget(target, "muon pack target")))];
347
+ };
348
+ var resolvePackTargetCandidates = (options, pluginBuildOptions) => {
349
+ if (options.allTargets === true) return [...require_vite_internals.allMuonTargets];
350
+ if (options.targets !== void 0 && options.targets.length > 0) return normalizePackTargetSelectors(options.targets);
351
+ if (options.allTargets === false) return [require_vite_internals.getDefaultMuonBuildTarget()];
352
+ if (pluginBuildOptions.allTargets === true) return [...require_vite_internals.allMuonTargets];
353
+ if (pluginBuildOptions.targets !== void 0 && pluginBuildOptions.targets.length > 0) return normalizePluginBuildTargets(pluginBuildOptions.targets);
354
+ if (pluginBuildOptions.allTargets === false) return [require_vite_internals.getDefaultMuonBuildTarget()];
355
+ return [...require_vite_internals.allMuonTargets];
356
+ };
357
+ var packTypeSupportsTarget = (type, target) => {
358
+ const descriptor = require_vite_internals.getMuonTargetDescriptor(target);
359
+ return type === "zip" && descriptor.os === "windows" || type === "tar.gz" && descriptor.os === "linux" || type === "deb" && descriptor.os === "linux" || type === "nsis" && descriptor.os === "windows";
360
+ };
361
+ var createPackTargetPlan = (types, targets) => {
362
+ const plan = targets.map((target) => ({
363
+ target,
364
+ types: types.filter((type) => packTypeSupportsTarget(type, target))
365
+ })).filter((entry) => entry.types.length > 0);
366
+ if (plan.length === 0) throw new Error("No valid muon pack target and type combinations.");
367
+ return plan;
389
368
  };
390
369
  var runTool = async (executable, args, cwd, environment) => {
391
370
  const child = (0, node_child_process.spawn)(executable, [...args], {
@@ -445,8 +424,35 @@ var packageZip = async (target, metadata, artifactsRoot) => {
445
424
  path: outputPath
446
425
  };
447
426
  };
427
+ var toArchivePath = (path) => path.split(node_path.sep).join("/");
428
+ var createTarGzEntryGenerator = async function* (directory, entryRoot) {
429
+ yield await (0, tar_vern.createDirectoryItem)(entryRoot, "exceptName", { directoryPath: directory });
430
+ const walk = async function* (currentDirectory) {
431
+ const entries = await (0, node_fs_promises.readdir)(currentDirectory, { withFileTypes: true });
432
+ entries.sort((left, right) => left.name.localeCompare(right.name));
433
+ for (const entry of entries) {
434
+ const path = (0, node_path.join)(currentDirectory, entry.name);
435
+ const entryName = `${entryRoot}/${toArchivePath((0, node_path.relative)(directory, path))}`;
436
+ if (entry.isDirectory()) {
437
+ yield await (0, tar_vern.createDirectoryItem)(entryName, "exceptName", { directoryPath: path });
438
+ yield* walk(path);
439
+ } else if (entry.isFile()) yield await (0, tar_vern.createReadFileItem)(entryName, path, "exceptName");
440
+ }
441
+ };
442
+ yield* walk(directory);
443
+ };
444
+ var packageTarGz = async (target, metadata, artifactsRoot) => {
445
+ const outputPath = (0, node_path.join)(artifactsRoot, `${metadata.packageName}-${metadata.version}-${target.target}.tar.gz`);
446
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(outputPath), { recursive: true });
447
+ await (0, tar_vern.storeReaderToFile)((0, tar_vern.createTarPacker)(createTarGzEntryGenerator(target.outputPath, target.distributionDirectoryName), "gzip"), outputPath);
448
+ return {
449
+ type: "tar.gz",
450
+ target: target.target,
451
+ path: outputPath
452
+ };
453
+ };
448
454
  var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot, environment) => {
449
- const descriptor = require_vite_options.getMuonTargetDescriptor(target.target);
455
+ const descriptor = require_vite_internals.getMuonTargetDescriptor(target.target);
450
456
  if (descriptor.os !== "linux") throw new Error(`Unsupported deb target: ${target.target}`);
451
457
  const architecture = descriptor.arch;
452
458
  const packageRoot = (0, node_path.join)(packageBuildRoot, "deb", `${metadata.packageName}-${target.target}`);
@@ -457,6 +463,11 @@ var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot,
457
463
  const installedDist = (0, node_path.join)((0, node_path.join)(packageRoot, "usr", "lib", metadata.packageName), target.distributionDirectoryName);
458
464
  await (0, node_fs_promises.mkdir)(installedDist, { recursive: true });
459
465
  await (0, node_fs_promises.cp)(target.outputPath, installedDist, { recursive: true });
466
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(installedDist, "muon-install.json"), `${JSON.stringify({
467
+ type: "deb",
468
+ packageName: metadata.packageName,
469
+ launcherPath: `/usr/bin/${metadata.packageName}`
470
+ }, void 0, 2)}\n`);
460
471
  const binPath = (0, node_path.join)(packageRoot, "usr", "bin", metadata.packageName);
461
472
  const launcherName = (0, node_path.basename)(target.launcherPath);
462
473
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(binPath), { recursive: true });
@@ -467,6 +478,18 @@ var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot,
467
478
  ""
468
479
  ].join("\n"));
469
480
  await (0, node_fs_promises.chmod)(binPath, 493);
481
+ if (target.linuxDesktop === void 0) throw new Error(`Linux desktop metadata is unavailable: ${target.target}`);
482
+ const applicationsPath = (0, node_path.join)(packageRoot, "usr", "share", "applications", `${target.linuxDesktop.desktopId}.desktop`);
483
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(applicationsPath), { recursive: true });
484
+ await (0, node_fs_promises.writeFile)(applicationsPath, require_vite_internals.createLinuxDesktopEntry({
485
+ desktop: target.linuxDesktop,
486
+ exec: `${require_vite_internals.quoteDesktopExecArgument(`/usr/bin/${metadata.packageName}`)} --muon-launch-from=normal`,
487
+ tryExec: `/usr/bin/${metadata.packageName}`,
488
+ icon: target.linuxDesktop.desktopId
489
+ }));
490
+ const iconPath = (0, node_path.join)(packageRoot, "usr", "share", "icons", "hicolor", "256x256", "apps", `${target.linuxDesktop.desktopId}.png`);
491
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(iconPath), { recursive: true });
492
+ await (0, node_fs_promises.cp)((0, node_path.join)(target.outputPath, target.linuxDesktop.iconFileName), iconPath);
470
493
  const controlPath = (0, node_path.join)(packageRoot, "DEBIAN", "control");
471
494
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(controlPath), { recursive: true });
472
495
  await (0, node_fs_promises.writeFile)(controlPath, [
@@ -491,24 +514,59 @@ var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot,
491
514
  };
492
515
  };
493
516
  var escapeNsis = (value) => value.replaceAll("\\", "\\\\").replaceAll("\"", "$\\\"");
494
- var packageNsis = async (root, target, metadata, artifactsRoot, packageBuildRoot, environment) => {
495
- const descriptor = require_vite_options.getMuonTargetDescriptor(target.target);
517
+ var nsisUninstallRegistryRoot = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
518
+ var createNsisUninstallRegistryKey = (appId) => `${nsisUninstallRegistryRoot}\\${appId}`;
519
+ var packageNsis = async (root, target, metadata, windowsResource, artifactsRoot, packageBuildRoot, environment) => {
520
+ const descriptor = require_vite_internals.getMuonTargetDescriptor(target.target);
496
521
  if (descriptor.os !== "windows") throw new Error(`Unsupported nsis target: ${target.target}`);
497
522
  const scriptPath = (0, node_path.join)(packageBuildRoot, "nsis", `${metadata.packageName}-${target.target}.nsi`);
498
523
  const outputPath = (0, node_path.join)(artifactsRoot, `${metadata.packageName}-${metadata.version}-${descriptor.arch}-setup.exe`);
524
+ const launcherFileName = (0, node_path.basename)(target.launcherPath);
525
+ const nsisDisplayName = `${metadata.packageName} (${descriptor.arch})`;
526
+ const nsisInstallDirectoryName = `${metadata.packageName}-${descriptor.arch}`;
527
+ const uninstallRegistryKey = createNsisUninstallRegistryKey(target.runtimeAppId);
499
528
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(scriptPath), { recursive: true });
500
529
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(outputPath), { recursive: true });
530
+ const iconPath = (0, node_path.join)((0, node_path.dirname)(scriptPath), `${metadata.packageName}-${target.target}.ico`);
531
+ await require_vite_internals.createWindowsIconFromPngFile(windowsResource.iconPath, iconPath);
501
532
  await (0, node_fs_promises.writeFile)(scriptPath, [
502
533
  "Unicode true",
503
- `Name "${escapeNsis(metadata.packageName)}"`,
534
+ `Name "${escapeNsis(nsisDisplayName)}"`,
504
535
  `OutFile "${escapeNsis(outputPath)}"`,
505
- `InstallDir "$LOCALAPPDATA\\Programs\\${escapeNsis(metadata.packageName)}"`,
536
+ `InstallDir "$LOCALAPPDATA\\Programs\\${escapeNsis(nsisInstallDirectoryName)}"`,
506
537
  "RequestExecutionLevel user",
538
+ "ShowInstDetails nevershow",
539
+ "AutoCloseWindow true",
540
+ ...createNsisResourceDirectives(windowsResource, iconPath),
541
+ "Page instfiles",
507
542
  "Section",
508
543
  " SetOutPath \"$INSTDIR\"",
509
544
  ` File /r "${escapeNsis(target.outputPath)}\\*"`,
510
- ` CreateShortCut "$SMPROGRAMS\\${escapeNsis(metadata.packageName)}.lnk" "$INSTDIR\\${escapeNsis((0, node_path.basename)(target.launcherPath))}"`,
545
+ ` CreateShortCut "$SMPROGRAMS\\${escapeNsis(nsisDisplayName)}.lnk" "$INSTDIR\\${escapeNsis(launcherFileName)}"`,
546
+ " WriteUninstaller \"$INSTDIR\\Uninstall.exe\"",
547
+ ` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "DisplayName" "${escapeNsis(nsisDisplayName)}"`,
548
+ ` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "DisplayVersion" "${escapeNsis(metadata.version)}"`,
549
+ ` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "Publisher" "${escapeNsis(metadata.author)}"`,
550
+ ` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "InstallLocation" "$INSTDIR"`,
551
+ ` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "DisplayIcon" "$\\"$INSTDIR\\${escapeNsis(launcherFileName)}$\\""`,
552
+ ` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "UninstallString" "$\\"$INSTDIR\\Uninstall.exe$\\" /S"`,
553
+ ` WriteRegStr HKCU "${escapeNsis(uninstallRegistryKey)}" "QuietUninstallString" "$\\"$INSTDIR\\Uninstall.exe$\\" /S"`,
554
+ ` WriteRegDWORD HKCU "${escapeNsis(uninstallRegistryKey)}" "NoModify" 1`,
555
+ ` WriteRegDWORD HKCU "${escapeNsis(uninstallRegistryKey)}" "NoRepair" 1`,
556
+ "SectionEnd",
557
+ "",
558
+ "Section \"Uninstall\"",
559
+ ` Delete "$SMPROGRAMS\\${escapeNsis(nsisDisplayName)}.lnk"`,
560
+ ` DeleteRegKey HKCU "${escapeNsis(uninstallRegistryKey)}"`,
561
+ " RMDir /r \"$INSTDIR\"",
562
+ ` RMDir /r "$LOCALAPPDATA\\${escapeNsis(target.runtimeAppId)}"`,
511
563
  "SectionEnd",
564
+ "",
565
+ "Function .onInstSuccess",
566
+ " IfSilent +3",
567
+ " SetOutPath \"$INSTDIR\"",
568
+ ` Exec "$\\"$INSTDIR\\${escapeNsis(launcherFileName)}$\\""`,
569
+ "FunctionEnd",
512
570
  ""
513
571
  ].join("\n"));
514
572
  await runTool("makensis", [scriptPath], root, environment);
@@ -519,8 +577,41 @@ var packageNsis = async (root, target, metadata, artifactsRoot, packageBuildRoot
519
577
  path: outputPath
520
578
  };
521
579
  };
580
+ var createNsisResourceDirectives = (resource, iconPath) => {
581
+ const lines = [];
582
+ lines.push(`Icon "${escapeNsis(iconPath)}"`);
583
+ lines.push(`UninstallIcon "${escapeNsis(iconPath)}"`);
584
+ lines.push(`VIProductVersion "${escapeNsis(resource.fixedVersion)}"`);
585
+ lines.push(`VIFileVersion "${escapeNsis(resource.fixedVersion)}"`);
586
+ lines.push(`VIAddVersionKey /LANG=${resource.language} "CompanyName" "${escapeNsis(resource.companyName)}"`);
587
+ lines.push(`VIAddVersionKey /LANG=${resource.language} "FileDescription" "${escapeNsis(resource.fileDescription)}"`);
588
+ lines.push(`VIAddVersionKey /LANG=${resource.language} "FileVersion" "${escapeNsis(resource.version)}"`);
589
+ lines.push(`VIAddVersionKey /LANG=${resource.language} "ProductName" "${escapeNsis(resource.productName)}"`);
590
+ lines.push(`VIAddVersionKey /LANG=${resource.language} "ProductVersion" "${escapeNsis(resource.version)}"`);
591
+ if (resource.copyright !== void 0) lines.push(`VIAddVersionKey /LANG=${resource.language} "LegalCopyright" "${escapeNsis(resource.copyright)}"`);
592
+ return lines;
593
+ };
594
+ var reapplyPackWindowsResources = async (targets, resource, root, environment) => {
595
+ for (const target of targets) {
596
+ const descriptor = require_vite_internals.getMuonTargetDescriptor(target.target);
597
+ if (descriptor.os === "windows") {
598
+ await require_vite_internals.updateWindowsPeIconResource({
599
+ executablePath: (0, node_path.join)(target.outputPath, descriptor.runtimeExecutableName),
600
+ resource,
601
+ environment,
602
+ cwd: root
603
+ });
604
+ await require_vite_internals.updateWindowsPeResources({
605
+ executablePath: target.launcherPath,
606
+ resource,
607
+ environment,
608
+ cwd: root
609
+ });
610
+ }
611
+ }
612
+ };
522
613
  /**
523
- * Builds a Vite app, creates Muon dist directories, and packages them.
614
+ * Runs the Muon build sequence and creates redistributable packages.
524
615
  *
525
616
  * @param options Pack options.
526
617
  * @returns Generated package artifacts.
@@ -528,16 +619,50 @@ var packageNsis = async (root, target, metadata, artifactsRoot, packageBuildRoot
528
619
  var packMuonApp = async (options) => {
529
620
  const cwd = (0, node_path.resolve)(options.root ?? process.cwd());
530
621
  const environment = options.environment ?? process.env;
531
- const loadedOptions = await loadViteMuonOptions(cwd);
532
- const root = loadedOptions.root;
533
- const metadata = resolveMetadata(await readPackageJson(root), options);
622
+ const project = await require_vite_internals.loadMuonBuildSequenceProject(cwd);
623
+ const root = project.root;
624
+ const packageJson = await readPackageJson(root);
625
+ const metadata = resolveMetadata(packageJson, options);
534
626
  const artifactsRoot = (0, node_path.resolve)(root, options.artifactsDir ?? defaultArtifactsDirectory);
535
627
  const packageBuildRoot = (0, node_path.resolve)(root, defaultPackageBuildDirectory);
536
628
  const types = normalizePackTypes(options.types);
537
- const viteOutputDirectory = await resolveBuildOutputDirectory(root);
538
- await runViteBuild(root, environment);
539
- const build = await require_vite_options.buildMuonApp(createBuildOptions(root, viteOutputDirectory, getPluginBuildOptions(loadedOptions.pluginOptions), options));
540
- for (const type of types) for (const target of build.targets) assertPackTypeSupportsTarget(type, target.target);
629
+ const pluginBuildOptions = require_vite_internals.resolveMuonViteBuildOptions(project.pluginOptions);
630
+ const targetPlan = createPackTargetPlan(types, resolvePackTargetCandidates(options, pluginBuildOptions));
631
+ const buildOptions = {
632
+ root: cwd,
633
+ targets: targetPlan.map((entry) => entry.target),
634
+ allTargets: false
635
+ };
636
+ const windowsResourceOptions = require_vite_internals.mergeMuonWindowsResourceOptions(options.windowsResource, pluginBuildOptions.windowsResource);
637
+ const linuxDesktopOptions = require_vite_internals.mergeMuonLinuxDesktopOptions(options.linuxDesktop, pluginBuildOptions.linuxDesktop);
638
+ const iconPath = options.iconPath ?? pluginBuildOptions.iconPath;
639
+ if (options.configPath !== void 0) buildOptions.configPath = options.configPath;
640
+ if (iconPath !== void 0) buildOptions.iconPath = iconPath;
641
+ if (options.appName !== void 0) buildOptions.appName = options.appName;
642
+ if (options.appId !== void 0) buildOptions.appId = options.appId;
643
+ if (options.packageDirectory !== void 0) buildOptions.packageDirectory = options.packageDirectory;
644
+ if (windowsResourceOptions !== void 0) buildOptions.windowsResource = windowsResourceOptions;
645
+ if (linuxDesktopOptions !== void 0) buildOptions.linuxDesktop = linuxDesktopOptions;
646
+ const windowsResourceConfig = await require_vite_internals.readMuonConfigForWindowsResource(root, options.configPath);
647
+ const windowsResource = await require_vite_internals.resolveMuonWindowsResource({
648
+ root,
649
+ packageDirectory: options.packageDirectory ?? pluginBuildOptions.packageDirectory ?? "",
650
+ packageJson: createPackMetadataPackageJson(packageJson, metadata),
651
+ muonConfig: windowsResourceConfig.config,
652
+ muonConfigDirectory: windowsResourceConfig.directory,
653
+ options: windowsResourceOptions,
654
+ appIconPath: iconPath,
655
+ defaults: {
656
+ productName: metadata.packageName,
657
+ fileDescription: metadata.description,
658
+ companyName: metadata.author,
659
+ version: metadata.version,
660
+ copyright: void 0
661
+ }
662
+ });
663
+ const build = await require_vite_internals.runMuonBuildSequence(buildOptions, project);
664
+ if (options.packageVersion !== void 0) await reapplyPackWindowsResources(build.targets, windowsResource, root, environment);
665
+ const typesByTarget = new Map(targetPlan.map((entry) => [entry.target, entry.types]));
541
666
  await (0, node_fs_promises.rm)(packageBuildRoot, {
542
667
  recursive: true,
543
668
  force: true
@@ -552,9 +677,10 @@ var packMuonApp = async (options) => {
552
677
  });
553
678
  await (0, node_fs_promises.mkdir)(artifactsRoot, { recursive: true });
554
679
  const artifacts = [];
555
- for (const target of build.targets) for (const type of types) if (type === "zip") artifacts.push(await packageZip(target, metadata, artifactsRoot));
680
+ for (const target of build.targets) for (const type of typesByTarget.get(target.target) ?? []) if (type === "zip") artifacts.push(await packageZip(target, metadata, artifactsRoot));
681
+ else if (type === "tar.gz") artifacts.push(await packageTarGz(target, metadata, artifactsRoot));
556
682
  else if (type === "deb") artifacts.push(await packageDeb(root, target, metadata, artifactsRoot, packageBuildRoot, environment));
557
- else artifacts.push(await packageNsis(root, target, metadata, artifactsRoot, packageBuildRoot, environment));
683
+ else artifacts.push(await packageNsis(root, target, metadata, windowsResource, artifactsRoot, packageBuildRoot, environment));
558
684
  return {
559
685
  root,
560
686
  packageName: metadata.packageName,
@@ -568,8 +694,8 @@ var packMuonApp = async (options) => {
568
694
  };
569
695
  //#endregion
570
696
  //#region src/generated/packageMetadata.ts
571
- var version = "0.7.0";
572
- var git_commit_hash = "fe80718aaa617c0c0ea5c816bbe38d22bf2e8402";
697
+ var version = "0.9.0";
698
+ var git_commit_hash = "3437b522a51d8772713b72722b109c5ff30fc711";
573
699
  //#endregion
574
700
  //#region src/cli.ts
575
701
  var readTargetValues = (value) => {
@@ -579,7 +705,14 @@ var appendTargetValues = (value, previous) => {
579
705
  return [...previous, ...readTargetValues(value)];
580
706
  };
581
707
  var appendPackTypeValues = (value, previous) => {
582
- return [...previous, ...readTargetValues(value)];
708
+ return [...previous ?? [], ...readTargetValues(value)];
709
+ };
710
+ var readCommaSeparatedValues = (value) => value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
711
+ var readBooleanValue = (value, label) => {
712
+ const normalized = value.trim().toLowerCase();
713
+ if (normalized === "true" || normalized === "1" || normalized === "yes") return true;
714
+ if (normalized === "false" || normalized === "0" || normalized === "no") return false;
715
+ throw new Error(`${label} must be true or false.`);
583
716
  };
584
717
  var validateEmbedConfigOptions = (options) => {
585
718
  if (options.runtimePath !== void 0 && options.corePath !== void 0) throw new Error("Specify at most one of --runtime-path or --core-path.");
@@ -588,20 +721,47 @@ var validateEmbedConfigOptions = (options) => {
588
721
  if (options.runtimePath !== void 0 && options.output !== void 0) throw new Error("--output requires --core-path.");
589
722
  if (options.bootstrapPath === void 0 && options.outputBootstrap !== void 0) throw new Error("--output-bootstrap requires --bootstrap-path.");
590
723
  };
724
+ var createWindowsResourceOptions = (commandOptions) => {
725
+ const options = {};
726
+ if (commandOptions.windowsIcon !== void 0) options.iconPath = commandOptions.windowsIcon;
727
+ if (commandOptions.windowsProductName !== void 0) options.productName = commandOptions.windowsProductName;
728
+ if (commandOptions.windowsFileDescription !== void 0) options.fileDescription = commandOptions.windowsFileDescription;
729
+ if (commandOptions.windowsCompanyName !== void 0) options.companyName = commandOptions.windowsCompanyName;
730
+ if (commandOptions.windowsVersion !== void 0) options.version = commandOptions.windowsVersion;
731
+ if (commandOptions.windowsCopyright !== void 0) options.copyright = commandOptions.windowsCopyright;
732
+ return Object.keys(options).length === 0 ? void 0 : options;
733
+ };
734
+ var createLinuxDesktopOptions = (commandOptions) => {
735
+ const options = {};
736
+ if (commandOptions.linuxDesktopId !== void 0) options.desktopId = commandOptions.linuxDesktopId;
737
+ if (commandOptions.linuxName !== void 0) options.name = commandOptions.linuxName;
738
+ if (commandOptions.linuxComment !== void 0) options.comment = commandOptions.linuxComment;
739
+ if (commandOptions.linuxIcon !== void 0) options.iconPath = commandOptions.linuxIcon;
740
+ if (commandOptions.linuxCategories !== void 0) options.categories = readCommaSeparatedValues(commandOptions.linuxCategories);
741
+ if (commandOptions.linuxStartupNotify !== void 0) options.startupNotify = readBooleanValue(commandOptions.linuxStartupNotify, "--linux-startup-notify");
742
+ return Object.keys(options).length === 0 ? void 0 : options;
743
+ };
591
744
  var runBuildCommand = async (commandOptions) => {
592
745
  const targets = commandOptions.target;
593
746
  if (commandOptions.all === true && targets.length > 0) throw new Error("Specify either --all or --target, not both.");
594
747
  const buildOptions = {
595
748
  root: process.cwd(),
596
- allTargets: commandOptions.all === true
749
+ defaultAllTargets: false
597
750
  };
598
751
  if (targets.length > 0) buildOptions.targets = targets;
752
+ if (commandOptions.all === true) buildOptions.allTargets = true;
599
753
  if (commandOptions.assets !== void 0) buildOptions.assetSourcePath = commandOptions.assets;
600
754
  if (commandOptions.config !== void 0) buildOptions.configPath = commandOptions.config;
755
+ if (commandOptions.icon !== void 0) buildOptions.iconPath = commandOptions.icon;
756
+ const windowsResource = createWindowsResourceOptions(commandOptions);
757
+ if (windowsResource !== void 0) buildOptions.windowsResource = windowsResource;
758
+ const linuxDesktop = createLinuxDesktopOptions(commandOptions);
759
+ if (linuxDesktop !== void 0) buildOptions.linuxDesktop = linuxDesktop;
601
760
  if (commandOptions.outDir !== void 0) buildOptions.outputRoot = commandOptions.outDir;
602
761
  if (commandOptions.name !== void 0) buildOptions.appName = commandOptions.name;
603
762
  if (commandOptions.appId !== void 0) buildOptions.appId = commandOptions.appId;
604
- const result = await require_vite_options.buildMuonApp(buildOptions);
763
+ if (commandOptions.packageDirectory !== void 0) buildOptions.packageDirectory = commandOptions.packageDirectory;
764
+ const result = await require_vite_internals.runMuonBuildSequence(buildOptions);
605
765
  if (commandOptions.json === true) console.log(JSON.stringify(result, null, 2));
606
766
  else for (const target of result.targets) console.log(target.outputPath);
607
767
  };
@@ -610,12 +770,17 @@ var runPackCommand = async (commandOptions) => {
610
770
  if (commandOptions.all === true && targets.length > 0) throw new Error("Specify either --all or --target, not both.");
611
771
  const packOptions = {
612
772
  root: process.cwd(),
613
- types: commandOptions.type,
614
773
  environment: process.env
615
774
  };
775
+ if (commandOptions.type !== void 0) packOptions.types = commandOptions.type;
616
776
  if (targets.length > 0) packOptions.targets = targets;
617
777
  if (commandOptions.all !== void 0) packOptions.allTargets = commandOptions.all;
618
778
  if (commandOptions.config !== void 0) packOptions.configPath = commandOptions.config;
779
+ if (commandOptions.icon !== void 0) packOptions.iconPath = commandOptions.icon;
780
+ const windowsResource = createWindowsResourceOptions(commandOptions);
781
+ if (windowsResource !== void 0) packOptions.windowsResource = windowsResource;
782
+ const linuxDesktop = createLinuxDesktopOptions(commandOptions);
783
+ if (linuxDesktop !== void 0) packOptions.linuxDesktop = linuxDesktop;
619
784
  if (commandOptions.name !== void 0) packOptions.appName = commandOptions.name;
620
785
  if (commandOptions.appId !== void 0) packOptions.appId = commandOptions.appId;
621
786
  if (commandOptions.packageDirectory !== void 0) packOptions.packageDirectory = commandOptions.packageDirectory;
@@ -629,11 +794,11 @@ var runPackCommand = async (commandOptions) => {
629
794
  else for (const artifact of result.artifacts) console.log(artifact.path);
630
795
  };
631
796
  var runPrepareCommand = async (commandOptions) => {
632
- const result = await require_vite_options.runMuonPrepare({
797
+ const result = await require_vite_internals.runMuonPrepare({
633
798
  muonPath: commandOptions.muonPath ?? "",
634
799
  cefPath: commandOptions.cefPath,
635
800
  stageDir: commandOptions.stageDir,
636
- target: commandOptions.target ?? require_vite_options.getDefaultMuonPrepareTarget(process.platform, process.arch),
801
+ target: commandOptions.target ?? require_vite_internals.getDefaultMuonPrepareTarget(process.platform, process.arch),
637
802
  cacheDir: commandOptions.cacheDir,
638
803
  force: commandOptions.force === true,
639
804
  quiet: commandOptions.quiet === true,
@@ -661,7 +826,7 @@ var runDevCommand = async (commandOptions, command) => {
661
826
  if (result.exitCode !== 0) process.exitCode = result.exitCode;
662
827
  };
663
828
  var runInitCommand = async () => {
664
- const result = await require_vite_options.ensureMuonGitignoreEntry(process.cwd());
829
+ const result = await require_vite_internals.ensureMuonGitignoreEntry(process.cwd());
665
830
  console.log(result.changed ? `Updated ${result.gitignorePath}` : result.gitignorePath);
666
831
  };
667
832
  var printEmbedConfigResult = (result, json) => {
@@ -671,16 +836,16 @@ var printEmbedConfigResult = (result, json) => {
671
836
  var runEmbedConfigCommand = async (commandOptions) => {
672
837
  validateEmbedConfigOptions(commandOptions);
673
838
  const configPath = commandOptions.config ?? "";
674
- const coreResult = commandOptions.corePath !== void 0 ? await require_vite_options.embedMuonConfigInCoreFile({
839
+ const coreResult = commandOptions.corePath !== void 0 ? await require_vite_internals.embedMuonConfigInCoreFile({
675
840
  corePath: commandOptions.corePath,
676
841
  configPath,
677
842
  outputPath: commandOptions.output
678
- }) : commandOptions.runtimePath !== void 0 ? await require_vite_options.embedMuonConfigInRuntime({
843
+ }) : commandOptions.runtimePath !== void 0 ? await require_vite_internals.embedMuonConfigInRuntime({
679
844
  runtimePath: commandOptions.runtimePath,
680
845
  configPath,
681
846
  outputRuntimePath: commandOptions.outputRuntimePath
682
847
  }) : void 0;
683
- const bootstrapResult = commandOptions.bootstrapPath === void 0 ? void 0 : await require_vite_options.embedMuonConfigInBootstrapFile({
848
+ const bootstrapResult = commandOptions.bootstrapPath === void 0 ? void 0 : await require_vite_internals.embedMuonConfigInBootstrapFile({
684
849
  bootstrapPath: commandOptions.bootstrapPath,
685
850
  configPath,
686
851
  outputPath: commandOptions.outputBootstrap
@@ -703,19 +868,19 @@ var createCliCommand = () => {
703
868
  program.outputHelp({ error: true });
704
869
  process.exitCode = 1;
705
870
  });
706
- 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("--out-dir <path>", "output root directory").option("--name <name>", "launcher file name").option("--app-id <id>", "stable application identifier").option("--json", "write result as JSON").action(async (options) => {
871
+ 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) => {
707
872
  await runBuildCommand(options);
708
873
  });
709
- program.command("pack").description("Build and package a Muon app").requiredOption("-t, --type <type>", "package type or comma-separated package types: zip, deb, nsis", appendPackTypeValues, []).option("--target <target>", "public target or comma-separated public targets", appendTargetValues, []).option("--all", "build all supported targets").option("--config <path>", "muon config path").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) => {
874
+ 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("--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) => {
710
875
  await runPackCommand(options);
711
876
  });
712
- const devCommand = program.command("dev").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) => {
877
+ 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) => {
713
878
  await runDevCommand(options, devCommand);
714
879
  });
715
880
  program.command("init").description("Initialize Muon project helper files").action(async () => {
716
881
  await runInitCommand();
717
882
  });
718
- program.command("prepare").description("Prepare a Muon runtime with CEF files").requiredOption("--muon-path <path>", "Muon runtime file root").option("--cef-path <path>", "CEF file root").option("--stage-dir <path>", "prepared runtime output directory").option("--target <target>", "prepare target").option("--cache-dir <path>", "CEF artifact cache directory").option("--force", "rebuild an existing prepared runtime").option("-q, --quiet", "suppress native prepare progress messages").option("--json", "write result as JSON").action(async (options) => {
883
+ program.command("prepare").description("Prepare a Muon runtime with CEF files").requiredOption("--muon-path <path>", "Muon runtime file root").option("--cef-path <path>", "CEF file root").option("--stage-dir <path>", "prepared runtime output directory").option("--target <target>", "prepare target").option("--cache-dir <path>", "CEF artifact cache directory").option("--force", "rebuild an existing prepared runtime").option("-q, --quiet", "suppress native builder progress messages").option("--json", "write result as JSON").action(async (options) => {
719
884
  await runPrepareCommand(options);
720
885
  });
721
886
  program.command("embed-config").description("Embed muon.json into Muon runtime files").option("--runtime-path <path>", "prepared runtime directory").option("--core-path <path>", "muon-core executable path").option("--bootstrap-path <path>", "muon-bootstrap executable path").requiredOption("--config <path>", "muon config path").option("--output-runtime-path <path>", "patched runtime output directory").option("--output <path>", "patched muon-core output path").option("--output-bootstrap <path>", "patched bootstrap output path").option("--json", "write result as JSON").action(async (options) => {