muon-ui 0.11.0 → 0.12.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 (39) hide show
  1. package/dist/cli.cjs +241 -31
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/index.cjs +2 -2
  4. package/dist/index.mjs +2 -2
  5. package/dist/native/linux-amd64/muon-bootstrap +0 -0
  6. package/dist/native/linux-amd64/muon-builder +0 -0
  7. package/dist/native/linux-amd64/muon-runtime-helper +0 -0
  8. package/dist/native/linux-arm64/muon-bootstrap +0 -0
  9. package/dist/native/linux-arm64/muon-builder +0 -0
  10. package/dist/native/linux-arm64/muon-runtime-helper +0 -0
  11. package/dist/native/linux-armhf/muon-bootstrap +0 -0
  12. package/dist/native/linux-armhf/muon-builder +0 -0
  13. package/dist/native/linux-armhf/muon-runtime-helper +0 -0
  14. package/dist/native/windows-amd64/muon-bootstrap.exe +0 -0
  15. package/dist/native/windows-amd64/muon-builder.exe +0 -0
  16. package/dist/native/windows-i686/muon-bootstrap.exe +0 -0
  17. package/dist/native/windows-i686/muon-builder.exe +0 -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/libmuon-ui.so +0 -0
  21. package/dist/runtime/linux-arm64/muon-core +0 -0
  22. package/dist/runtime/linux-armhf/libmuon-ui.so +0 -0
  23. package/dist/runtime/linux-armhf/muon-core +0 -0
  24. package/dist/runtime/windows-amd64/libcardio.dll +0 -0
  25. package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
  26. package/dist/runtime/windows-amd64/muon-core.exe +0 -0
  27. package/dist/runtime/windows-i686/libcardio.dll +0 -0
  28. package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
  29. package/dist/runtime/windows-i686/muon-core.exe +0 -0
  30. package/dist/{vite-internals-Dha0jYI8.cjs → vite-internals-BK3BM9YY.cjs} +113 -9
  31. package/dist/{vite-internals-Dha0jYI8.cjs.map → vite-internals-BK3BM9YY.cjs.map} +1 -1
  32. package/dist/vite.cjs +18 -8
  33. package/dist/vite.cjs.map +1 -1
  34. package/dist/vite.mjs +102 -12
  35. package/dist/vite.mjs.map +1 -1
  36. package/muon-virtual-modules.d.ts +90 -0
  37. package/muon.d.ts +6 -86
  38. package/package.json +10 -8
  39. package/vite.d.ts +10 -0
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.11.0
4
+ * version: 0.12.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: db70f7643ac9fb1f61ab79f1de55c3dd8686de8d
9
+ * git.commit.hash: e716d83ebb5283f31cbdf524872df61039e6a7f0
10
10
  */
11
- const require_vite_internals = require("./vite-internals-Dha0jYI8.cjs");
11
+ const require_vite_internals = require("./vite-internals-BK3BM9YY.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");
@@ -76,6 +76,62 @@ var loadViteMuonOptions = async (cwd) => {
76
76
  pluginOptions: muonPlugins[0]
77
77
  };
78
78
  };
79
+ var getRuntimePluginConfigFromViteBuild = async (root) => {
80
+ const vite = await import("vite");
81
+ let resolvedRuntimeStates = [];
82
+ const inspector = {
83
+ name: "muon-run-vite-build-inspector",
84
+ enforce: "post",
85
+ configResolved: (config) => {
86
+ const runtimeStates = config.plugins.map((plugin) => require_vite_internals.getMuonVitePluginRuntimeState(plugin)).filter((runtimeState) => runtimeState !== void 0);
87
+ if (runtimeStates.length > 1) throw new Error("Multiple muon() plugin definitions were found in vite.config.*.");
88
+ resolvedRuntimeStates = runtimeStates;
89
+ }
90
+ };
91
+ const previous = process.env[require_vite_internals.muonBuildSequenceSuppressViteBuildEnvironmentKey];
92
+ process.env[require_vite_internals.muonBuildSequenceSuppressViteBuildEnvironmentKey] = "1";
93
+ try {
94
+ await vite.build({
95
+ root,
96
+ logLevel: "silent",
97
+ plugins: [inspector]
98
+ });
99
+ } finally {
100
+ if (previous === void 0) delete process.env[require_vite_internals.muonBuildSequenceSuppressViteBuildEnvironmentKey];
101
+ else process.env[require_vite_internals.muonBuildSequenceSuppressViteBuildEnvironmentKey] = previous;
102
+ }
103
+ const runtimePluginConfig = resolvedRuntimeStates[0]?.getRuntimePluginConfig();
104
+ if (runtimePluginConfig === void 0) throw new Error("muon Vite plugin runtime config was not resolved.");
105
+ return runtimePluginConfig;
106
+ };
107
+ var copyViteOutputAsRunAssets = async (project, assetSourcePath, assetPrefix) => {
108
+ if (project.viteOutputDirectory === void 0) throw new Error("Vite output directory could not be resolved.");
109
+ await assertDevelopmentAssetDirectory(project.viteOutputDirectory);
110
+ const destinationPath = (0, node_path.join)(assetSourcePath, ...assetPrefix.split("/"));
111
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(destinationPath), { recursive: true });
112
+ await (0, node_fs_promises.cp)(project.viteOutputDirectory, destinationPath, { recursive: true });
113
+ };
114
+ var prepareViteRunAssets = async (cwd) => {
115
+ const project = await require_vite_internals.loadMuonBuildSequenceProject(cwd);
116
+ if (project.pluginOptions === void 0) return;
117
+ const buildOptions = require_vite_internals.resolveMuonViteBuildOptions(project.pluginOptions);
118
+ const packagedAssetOptions = require_vite_internals.createVitePackagedAssetOptions(project.viteBase ?? "/");
119
+ const assetSourcePath = (0, node_path.join)(project.root, ".muon", "run", "assets");
120
+ await (0, node_fs_promises.rm)(assetSourcePath, {
121
+ recursive: true,
122
+ force: true
123
+ });
124
+ const runtimePluginConfig = await getRuntimePluginConfigFromViteBuild(project.viteBuildRoot);
125
+ await copyViteOutputAsRunAssets(project, assetSourcePath, packagedAssetOptions.assetPrefix);
126
+ return {
127
+ root: project.root,
128
+ pluginOptions: project.pluginOptions,
129
+ configPath: buildOptions.configPath,
130
+ assetSourcePath,
131
+ browserStartPage: packagedAssetOptions.browserStartPage,
132
+ runtimePluginConfig
133
+ };
134
+ };
79
135
  var resolveProjectConfigPath = async (root, configPath) => {
80
136
  if (configPath !== void 0) {
81
137
  const resolvedPath = resolveFromRoot(root, configPath);
@@ -125,6 +181,11 @@ var readConfigAssetSourcePath = (config) => {
125
181
  if (sourcePath.trim().length === 0) throw new Error("muon config asset.sourcePath must not be empty.");
126
182
  return sourcePath;
127
183
  };
184
+ var hasConfigBrowserStartPage = (config) => {
185
+ if (config === void 0) return false;
186
+ const browser = config.browser;
187
+ return isJsonObject$1(browser) && browser.startPage !== void 0;
188
+ };
128
189
  var assertDevelopmentAssetDirectory = async (assetSourcePath) => {
129
190
  if (await directoryExists(assetSourcePath)) return;
130
191
  try {
@@ -155,16 +216,21 @@ var resolveAssetSource = async (root, assetSourcePath, projectConfig) => {
155
216
  overrideAssetSourcePath: defaultAssetSourcePath
156
217
  };
157
218
  };
158
- var createMuonDevOverrideConfig = (assetSourcePath, enableDebugger) => ({
159
- ...assetSourcePath === void 0 ? {} : { asset: { sourcePath: assetSourcePath } },
160
- ...enableDebugger ? {
161
- cdp: { enable: true },
162
- browser: { keybind: {
219
+ var createMuonDevOverrideConfig = (assetSourcePath, enableDebugger, browserStartPage, runtimePluginConfig) => {
220
+ const browser = browserStartPage === void 0 && !enableDebugger ? void 0 : {
221
+ ...browserStartPage === void 0 ? {} : { startPage: browserStartPage },
222
+ ...enableDebugger ? { keybind: {
163
223
  devtools: "f12",
164
224
  recycle: "ctrl+f12"
165
- } }
166
- } : {}
167
- });
225
+ } } : {}
226
+ };
227
+ return {
228
+ ...assetSourcePath === void 0 ? {} : { asset: { sourcePath: assetSourcePath } },
229
+ ...enableDebugger ? { cdp: { enable: true } } : {},
230
+ ...browser === void 0 ? {} : { browser },
231
+ ...runtimePluginConfig === void 0 ? {} : { plugin: runtimePluginConfig }
232
+ };
233
+ };
168
234
  var writeMuonDevOverrideConfig = async (overrideConfigPath, overrideConfig) => {
169
235
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(overrideConfigPath), { recursive: true });
170
236
  await (0, node_fs_promises.writeFile)(overrideConfigPath, `${JSON.stringify(overrideConfig, null, 2)}\n`);
@@ -198,7 +264,12 @@ var runMuonExecutable = async (muonExecutablePath, configPaths, environment) =>
198
264
  * @returns Development startup result after the muon process exits.
199
265
  */
200
266
  var runMuonDev = async (options = {}) => {
201
- const loadedViteOptions = await loadViteMuonOptions((0, node_path.resolve)(options.root ?? process.cwd()));
267
+ const cwd = (0, node_path.resolve)(options.root ?? process.cwd());
268
+ const preparedViteAssets = options.assetSourcePath === void 0 ? await prepareViteRunAssets(cwd) : void 0;
269
+ const loadedViteOptions = preparedViteAssets === void 0 ? await loadViteMuonOptions(cwd) : {
270
+ root: preparedViteAssets.root,
271
+ pluginOptions: preparedViteAssets.pluginOptions
272
+ };
202
273
  const root = loadedViteOptions.root;
203
274
  const pluginOptions = loadedViteOptions.pluginOptions;
204
275
  const platform = options.platform ?? process.platform;
@@ -213,8 +284,12 @@ var runMuonDev = async (options = {}) => {
213
284
  const cefPath = options.cefPath !== void 0 ? resolveFromRoot(root, options.cefPath) : pluginOptions?.cefPath === void 0 ? void 0 : resolveFromRoot(root, pluginOptions.cefPath);
214
285
  const stagePath = options.stagePath !== void 0 ? resolveFromRoot(root, options.stagePath) : pluginOptions?.stagePath === void 0 ? (0, node_path.resolve)(root, ".muon", target) : resolveFromRoot(root, pluginOptions.stagePath);
215
286
  const enableDebugger = options.enableDebugger ?? pluginOptions?.enableDebugger ?? true;
216
- const projectConfig = await resolveProjectConfig(root, options.configPath);
217
- const asset = await resolveAssetSource(root, options.assetSourcePath, projectConfig);
287
+ const projectConfig = await resolveProjectConfig(root, options.configPath ?? preparedViteAssets?.configPath);
288
+ const asset = preparedViteAssets === void 0 ? await resolveAssetSource(root, options.assetSourcePath, projectConfig) : {
289
+ assetSourcePath: preparedViteAssets.assetSourcePath,
290
+ overrideAssetSourcePath: preparedViteAssets.assetSourcePath
291
+ };
292
+ const browserStartPage = preparedViteAssets?.browserStartPage !== void 0 && !hasConfigBrowserStartPage(projectConfig.config) ? preparedViteAssets.browserStartPage : void 0;
218
293
  const overrideConfigPath = (0, node_path.join)(root, ".muon", "run", "muon.run.json");
219
294
  await require_vite_internals.ensureMuonGitignoreEntry(root);
220
295
  const preparedRuntime = await require_vite_internals.runMuonPrepare({
@@ -230,7 +305,7 @@ var runMuonDev = async (options = {}) => {
230
305
  cwd: root
231
306
  });
232
307
  if (preparedRuntime.stagePath === void 0) throw new Error("muon-builder did not return a staged runtime path.");
233
- await writeMuonDevOverrideConfig(overrideConfigPath, createMuonDevOverrideConfig(asset.overrideAssetSourcePath, enableDebugger));
308
+ await writeMuonDevOverrideConfig(overrideConfigPath, createMuonDevOverrideConfig(asset.overrideAssetSourcePath, enableDebugger, browserStartPage, preparedViteAssets?.runtimePluginConfig));
234
309
  const muonExecutablePath = require_vite_internals.getMuonExecutablePath(preparedRuntime.stagePath, platform);
235
310
  const exitCode = await runMuonExecutable(muonExecutablePath, [...projectConfig.configPath === void 0 ? [] : [projectConfig.configPath], overrideConfigPath], environment);
236
311
  return {
@@ -280,7 +355,41 @@ var defaultPackageBuildDirectory = ".muon/pack";
280
355
  var systemRuntimeRoot = "/var/lib/muon/apps";
281
356
  var systemCefCacheRoot = "/var/cache/muon/cef";
282
357
  var runtimeHelperExecutableName = "muon-runtime-helper";
283
- var debGtk3RuntimeDependency = "libgtk-3-0t64 | libgtk-3-0";
358
+ var portableProfilePath = "profile";
359
+ var portableInstallMetadata = {
360
+ type: "portable",
361
+ runtimeMode: "in-place"
362
+ };
363
+ var debRuntimeDependencies = [
364
+ "libc6",
365
+ "libgcc-s1",
366
+ "libstdc++6",
367
+ "libffi8",
368
+ "libexpat1",
369
+ "libdbus-1-3",
370
+ "libglib2.0-0t64 | libglib2.0-0",
371
+ "libgtk-3-0t64 | libgtk-3-0",
372
+ "libatk-bridge2.0-0t64 | libatk-bridge2.0-0",
373
+ "libatk1.0-0t64 | libatk1.0-0",
374
+ "libatspi2.0-0t64 | libatspi2.0-0",
375
+ "libcups2t64 | libcups2",
376
+ "libnspr4",
377
+ "libnss3",
378
+ "libgbm1",
379
+ "libasound2t64 | libasound2",
380
+ "libudev1",
381
+ "libx11-6",
382
+ "libxcb1",
383
+ "libxcomposite1",
384
+ "libxdamage1",
385
+ "libxext6",
386
+ "libxfixes3",
387
+ "libxi6",
388
+ "libxkbcommon0",
389
+ "libxrandr2",
390
+ "libcairo2",
391
+ "libpango-1.0-0"
392
+ ];
284
393
  var isJsonObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
285
394
  var readJsonObjectFile = async (path) => {
286
395
  const parsed = (0, import_dist.parse)(await (0, node_fs_promises.readFile)(path, "utf8"));
@@ -369,6 +478,7 @@ var packTypeSupportsTarget = (type, target) => {
369
478
  const descriptor = require_vite_internals.getMuonTargetDescriptor(target);
370
479
  return type === "zip" && descriptor.os === "windows" || type === "tar.gz" && descriptor.os === "linux" || type === "deb" && descriptor.os === "linux" || type === "nsis" && descriptor.os === "windows";
371
480
  };
481
+ var isPortablePackType = (type) => type === "zip" || type === "tar.gz";
372
482
  var createPackTargetPlan = (types, targets) => {
373
483
  const plan = targets.map((target) => ({
374
484
  target,
@@ -404,6 +514,17 @@ var runTool = async (executable, args, cwd, environment) => {
404
514
  });
405
515
  if (exitCode !== 0) throw new Error(`${executable} failed with exit code ${exitCode}: ${stderr.trim()}`);
406
516
  };
517
+ var isUnavailableToolError = (error, executable) => {
518
+ if (!(error instanceof Error)) return false;
519
+ const nodeError = error;
520
+ return nodeError.code === "ENOENT" && (nodeError.syscall === `spawn ${executable}` || nodeError.path === executable);
521
+ };
522
+ var reportSkippedUnavailableTool = (progress, executable, type, target) => {
523
+ progress?.({
524
+ phase: "pack",
525
+ status: `Warning: ${executable} is not available; skipping ${type} package for ${target}.`
526
+ });
527
+ };
407
528
  var statOrUndefined = async (path) => {
408
529
  try {
409
530
  return await (0, node_fs_promises.stat)(path);
@@ -427,9 +548,10 @@ var addDirectoryToZip = async (zip, directory, entryRoot) => {
427
548
  };
428
549
  await walk(directory);
429
550
  };
551
+ var getPortableArchiveEntryRoot = (target, metadata) => `${metadata.packageName}/${target.target}`;
430
552
  var packageZip = async (target, metadata, artifactsRoot) => {
431
553
  const zip = new AdmZip();
432
- await addDirectoryToZip(zip, target.outputPath, target.distributionDirectoryName);
554
+ await addDirectoryToZip(zip, target.outputPath, getPortableArchiveEntryRoot(target, metadata));
433
555
  const outputPath = (0, node_path.join)(artifactsRoot, `${metadata.packageName}-${metadata.version}-${target.target}.zip`);
434
556
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(outputPath), { recursive: true });
435
557
  await (0, node_fs_promises.writeFile)(outputPath, zip.toBuffer());
@@ -459,13 +581,16 @@ var createTarGzEntryGenerator = async function* (directory, entryRoot) {
459
581
  var packageTarGz = async (target, metadata, artifactsRoot) => {
460
582
  const outputPath = (0, node_path.join)(artifactsRoot, `${metadata.packageName}-${metadata.version}-${target.target}.tar.gz`);
461
583
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(outputPath), { recursive: true });
462
- await (0, tar_vern.storeReaderToFile)((0, tar_vern.createTarPacker)(createTarGzEntryGenerator(target.outputPath, target.distributionDirectoryName), "gzip"), outputPath);
584
+ await (0, tar_vern.storeReaderToFile)((0, tar_vern.createTarPacker)(createTarGzEntryGenerator(target.outputPath, getPortableArchiveEntryRoot(target, metadata)), "gzip"), outputPath);
463
585
  return {
464
586
  type: "tar.gz",
465
587
  target: target.target,
466
588
  path: outputPath
467
589
  };
468
590
  };
591
+ var writePortableInstallMetadata = async (target) => {
592
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(target.outputPath, "muon-install.json"), `${JSON.stringify(portableInstallMetadata, void 0, 2)}\n`);
593
+ };
469
594
  var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot, environment, linuxSandbox, progress) => {
470
595
  const descriptor = require_vite_internals.getMuonTargetDescriptor(target.target);
471
596
  if (descriptor.os !== "linux") throw new Error(`Unsupported deb target: ${target.target}`);
@@ -523,7 +648,7 @@ var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot,
523
648
  `Version: ${metadata.version}`,
524
649
  `Architecture: ${architecture}`,
525
650
  `Maintainer: ${metadata.author}`,
526
- `Depends: ${debGtk3RuntimeDependency}`,
651
+ `Depends: ${debRuntimeDependencies.join(", ")}`,
527
652
  `Description: ${metadata.description}`,
528
653
  ""
529
654
  ].join("\n"));
@@ -562,12 +687,20 @@ var packageDeb = async (root, target, metadata, artifactsRoot, packageBuildRoot,
562
687
  phase: "pack",
563
688
  status: "Running dpkg-deb"
564
689
  });
565
- await runTool("dpkg-deb", [
566
- "--root-owner-group",
567
- "--build",
568
- packageRoot,
569
- outputPath
570
- ], root, environment);
690
+ try {
691
+ await runTool("dpkg-deb", [
692
+ "--root-owner-group",
693
+ "--build",
694
+ packageRoot,
695
+ outputPath
696
+ ], root, environment);
697
+ } catch (error) {
698
+ if (isUnavailableToolError(error, "dpkg-deb")) {
699
+ reportSkippedUnavailableTool(progress, "dpkg-deb", "deb", target.target);
700
+ return;
701
+ }
702
+ throw error;
703
+ }
571
704
  return {
572
705
  type: "deb",
573
706
  target: target.target,
@@ -634,7 +767,15 @@ var packageNsis = async (root, target, metadata, windowsResource, artifactsRoot,
634
767
  phase: "pack",
635
768
  status: "Running makensis"
636
769
  });
637
- await runTool("makensis", [scriptPath], root, environment);
770
+ try {
771
+ await runTool("makensis", [scriptPath], root, environment);
772
+ } catch (error) {
773
+ if (isUnavailableToolError(error, "makensis")) {
774
+ reportSkippedUnavailableTool(progress, "makensis", "nsis", target.target);
775
+ return;
776
+ }
777
+ throw error;
778
+ }
638
779
  if (await statOrUndefined(outputPath) === void 0) throw new Error(`makensis did not create installer: ${outputPath}`);
639
780
  return {
640
781
  type: "nsis",
@@ -675,6 +816,55 @@ var reapplyPackWindowsResources = async (targets, resource, root, environment) =
675
816
  }
676
817
  }
677
818
  };
819
+ var createPortableBuildOptions = (input) => {
820
+ const buildOptions = {
821
+ root: input.project.root,
822
+ targets: input.targets,
823
+ allTargets: false,
824
+ outputRoot: input.outputRoot
825
+ };
826
+ if (input.project.pluginOptions !== void 0) {
827
+ if (input.project.viteOutputDirectory === void 0) throw new Error("Vite output directory could not be resolved.");
828
+ Object.assign(buildOptions, input.pluginBuildOptions);
829
+ const packagedAssetOptions = require_vite_internals.createVitePackagedAssetOptions(input.project.viteBase ?? "/");
830
+ buildOptions.assetSourcePath = input.project.viteOutputDirectory;
831
+ buildOptions.assetPrefix = packagedAssetOptions.assetPrefix;
832
+ if (packagedAssetOptions.browserStartPage !== void 0) buildOptions.browserStartPage = packagedAssetOptions.browserStartPage;
833
+ }
834
+ buildOptions.targets = input.targets;
835
+ buildOptions.allTargets = false;
836
+ buildOptions.outputRoot = input.outputRoot;
837
+ if (input.options.configPath !== void 0) buildOptions.configPath = input.options.configPath;
838
+ if (input.iconPath !== void 0) buildOptions.iconPath = input.iconPath;
839
+ if (input.options.appName !== void 0) buildOptions.appName = input.options.appName;
840
+ if (input.options.appId !== void 0) buildOptions.appId = input.options.appId;
841
+ if (input.options.packageDirectory !== void 0) buildOptions.packageDirectory = input.options.packageDirectory;
842
+ if (input.windowsResourceOptions !== void 0) buildOptions.windowsResource = input.windowsResourceOptions;
843
+ if (input.linuxDesktopOptions !== void 0) buildOptions.linuxDesktop = input.linuxDesktopOptions;
844
+ if (input.progress !== void 0) buildOptions.progress = input.progress;
845
+ buildOptions.browserProfilePathOverride = portableProfilePath;
846
+ return buildOptions;
847
+ };
848
+ var buildPortableTargets = async (input) => {
849
+ if (input.targets.length === 0) return /* @__PURE__ */ new Map();
850
+ input.progress?.({
851
+ phase: "pack",
852
+ status: "Building portable distributions"
853
+ });
854
+ const build = await require_vite_internals.buildMuonApp(createPortableBuildOptions({
855
+ project: input.project,
856
+ pluginBuildOptions: input.pluginBuildOptions,
857
+ options: input.options,
858
+ outputRoot: (0, node_path.join)(input.packageBuildRoot, "portable-build"),
859
+ targets: input.targets,
860
+ windowsResourceOptions: input.windowsResourceOptions,
861
+ linuxDesktopOptions: input.linuxDesktopOptions,
862
+ iconPath: input.iconPath,
863
+ progress: input.progress
864
+ }));
865
+ await Promise.all(build.targets.map(writePortableInstallMetadata));
866
+ return new Map(build.targets.map((target) => [target.target, target]));
867
+ };
678
868
  /**
679
869
  * Runs the muon build sequence and creates redistributable packages.
680
870
  *
@@ -737,6 +927,7 @@ var packMuonApp = async (options) => {
737
927
  const build = await require_vite_internals.runMuonBuildSequence(buildOptions, project);
738
928
  if (options.packageVersion !== void 0) await reapplyPackWindowsResources(build.targets, windowsResource, root, environment);
739
929
  const typesByTarget = new Map(targetPlan.map((entry) => [entry.target, entry.types]));
930
+ const portableTargets = targetPlan.filter((entry) => entry.types.some(isPortablePackType)).map((entry) => entry.target);
740
931
  await (0, node_fs_promises.rm)(packageBuildRoot, {
741
932
  recursive: true,
742
933
  force: true
@@ -750,6 +941,18 @@ var packMuonApp = async (options) => {
750
941
  force: true
751
942
  });
752
943
  await (0, node_fs_promises.mkdir)(artifactsRoot, { recursive: true });
944
+ const portableTargetsByTarget = await buildPortableTargets({
945
+ project,
946
+ pluginBuildOptions,
947
+ options,
948
+ packageBuildRoot,
949
+ targets: portableTargets,
950
+ windowsResourceOptions,
951
+ linuxDesktopOptions,
952
+ iconPath,
953
+ progress
954
+ });
955
+ if (options.packageVersion !== void 0) await reapplyPackWindowsResources([...portableTargetsByTarget.values()], windowsResource, root, environment);
753
956
  const artifacts = [];
754
957
  const totalArtifacts = targetPlan.reduce((sum, entry) => sum + entry.types.length, 0);
755
958
  let artifactIndex = 0;
@@ -760,10 +963,17 @@ var packMuonApp = async (options) => {
760
963
  status: `Packaging ${type} ${target.target} (${artifactIndex}/${totalArtifacts})`
761
964
  });
762
965
  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);
966
+ if (type === "zip") {
967
+ const portableTarget = portableTargetsByTarget.get(target.target);
968
+ if (portableTarget === void 0) throw new Error(`Portable target was not built: ${target.target}`);
969
+ artifact = await packageZip(portableTarget, metadata, artifactsRoot);
970
+ } else if (type === "tar.gz") {
971
+ const portableTarget = portableTargetsByTarget.get(target.target);
972
+ if (portableTarget === void 0) throw new Error(`Portable target was not built: ${target.target}`);
973
+ artifact = await packageTarGz(portableTarget, metadata, artifactsRoot);
974
+ } else if (type === "deb") artifact = await packageDeb(root, target, metadata, artifactsRoot, packageBuildRoot, environment, linuxSandbox, progress);
766
975
  else artifact = await packageNsis(root, target, metadata, windowsResource, artifactsRoot, packageBuildRoot, environment, progress);
976
+ if (artifact === void 0) continue;
767
977
  artifacts.push(artifact);
768
978
  progress?.({
769
979
  phase: "pack",
@@ -783,8 +993,8 @@ var packMuonApp = async (options) => {
783
993
  };
784
994
  //#endregion
785
995
  //#region src/generated/packageMetadata.ts
786
- var version = "0.11.0";
787
- var git_commit_hash = "db70f7643ac9fb1f61ab79f1de55c3dd8686de8d";
996
+ var version = "0.12.0";
997
+ var git_commit_hash = "e716d83ebb5283f31cbdf524872df61039e6a7f0";
788
998
  //#endregion
789
999
  //#region src/cli.ts
790
1000
  var readTargetValues = (value) => {