muon-ui 0.5.0 → 0.7.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 (56) hide show
  1. package/dist/cli.cjs +368 -15
  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/{linux64 → linux-amd64}/muon-bootstrap +0 -0
  6. package/dist/native/{linux64 → linux-amd64}/muon-prepare +0 -0
  7. package/dist/native/{linuxarm64 → linux-arm64}/muon-bootstrap +0 -0
  8. package/dist/native/{linuxarm64 → linux-arm64}/muon-prepare +0 -0
  9. package/dist/native/{linuxarm → linux-armhf}/muon-bootstrap +0 -0
  10. package/dist/native/{linuxarm → linux-armhf}/muon-prepare +0 -0
  11. package/dist/native/{windows64 → windows-amd64}/muon-bootstrap.exe +0 -0
  12. package/dist/native/{windows64 → windows-amd64}/muon-prepare.exe +0 -0
  13. package/dist/native/{windows32/muon-prepare.exe → windows-i686/muon-bootstrap.exe} +0 -0
  14. package/dist/native/{windows32/muon-bootstrap.exe → windows-i686/muon-prepare.exe} +0 -0
  15. package/dist/runtime/{linux64/LICENSE_muon → linux-amd64/CREDITS.md} +0 -97
  16. package/dist/runtime/{linux64 → linux-amd64}/libmuon-ui.so +0 -0
  17. package/dist/runtime/linux-amd64/muon-core +0 -0
  18. package/dist/runtime/{linuxarm/LICENSE_muon → linux-arm64/CREDITS.md} +0 -97
  19. package/dist/runtime/linux-arm64/libmuon-ui.so +0 -0
  20. package/dist/runtime/linux-arm64/muon-core +0 -0
  21. package/dist/runtime/{windows32/LICENSE_muon → linux-armhf/CREDITS.md} +0 -97
  22. package/dist/runtime/{linuxarm → linux-armhf}/libmuon-ui.so +0 -0
  23. package/dist/runtime/linux-armhf/muon-core +0 -0
  24. package/dist/runtime/{linuxarm64/LICENSE_muon → windows-amd64/CREDITS.md} +0 -97
  25. package/dist/runtime/{windows64 → windows-amd64}/libcardio.dll +0 -0
  26. package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
  27. package/dist/runtime/{windows64 → windows-amd64}/muon-core.exe +0 -0
  28. package/dist/runtime/windows-i686/CREDITS.md +266 -0
  29. package/dist/runtime/{windows32 → windows-i686}/libcardio.dll +0 -0
  30. package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
  31. package/dist/runtime/{windows32 → windows-i686}/muon-core.exe +0 -0
  32. package/dist/{vite-options-D4u4kLQI.cjs → vite-options-FFh0NWUa.cjs} +228 -137
  33. package/dist/vite-options-FFh0NWUa.cjs.map +1 -0
  34. package/dist/vite.cjs +23 -3
  35. package/dist/vite.cjs.map +1 -1
  36. package/dist/vite.mjs +234 -135
  37. package/dist/vite.mjs.map +1 -1
  38. package/images/muon-120.png +0 -0
  39. package/muon.d.ts +33 -0
  40. package/package.json +7 -7
  41. package/vite.d.ts +9 -4
  42. package/dist/runtime/linux64/muon-core +0 -0
  43. package/dist/runtime/linuxarm/muon-core +0 -0
  44. package/dist/runtime/linuxarm64/libmuon-ui.so +0 -0
  45. package/dist/runtime/linuxarm64/muon-core +0 -0
  46. package/dist/runtime/windows32/libmuon-ui.dll +0 -0
  47. package/dist/runtime/windows64/LICENSE_muon +0 -363
  48. package/dist/runtime/windows64/libmuon-ui.dll +0 -0
  49. package/dist/vite-options-D4u4kLQI.cjs.map +0 -1
  50. /package/dist/runtime/{linux64 → linux-amd64}/libcardio.so +0 -0
  51. /package/dist/runtime/{linuxarm64 → linux-arm64}/libcardio.so +0 -0
  52. /package/dist/runtime/{linuxarm → linux-armhf}/libcardio.so +0 -0
  53. /package/dist/runtime/{windows64 → windows-amd64}/libgcc_s_seh-1.dll +0 -0
  54. /package/dist/runtime/{windows64 → windows-amd64}/libstdc++-6.dll +0 -0
  55. /package/dist/runtime/{windows32 → windows-i686}/libgcc_s_dw2-1.dll +0 -0
  56. /package/dist/runtime/{windows32 → windows-i686}/libstdc++-6.dll +0 -0
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: muon-ui
3
- * version: 0.5.0
3
+ * version: 0.7.0
4
4
  * description: A multi-platform GUI application framework that uses CEF as its backend
5
5
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
6
6
  * license: MIT
7
7
  * repository.url: https://github.com/kekyo/muon-ui.git
8
- * git.commit.hash: 122830dc7b35ced0c4c88c91d3a9dd8b3dee18e2
8
+ * git.commit.hash: fe80718aaa617c0c0ea5c816bbe38d22bf2e8402
9
9
  */
10
10
  //#region \0rolldown/runtime.js
11
11
  var __create = Object.create;
@@ -39,6 +39,144 @@ let node_crypto = require("node:crypto");
39
39
  let node_os = require("node:os");
40
40
  let adm_zip = require("adm-zip");
41
41
  adm_zip = __toESM(adm_zip, 1);
42
+ //#region src/targets.ts
43
+ /**
44
+ * Supported public Muon targets in deterministic build order.
45
+ */
46
+ var allMuonTargets = [
47
+ "linux-amd64",
48
+ "linux-armhf",
49
+ "linux-arm64",
50
+ "windows-i686",
51
+ "windows-amd64"
52
+ ];
53
+ var targetDescriptors = {
54
+ "linux-amd64": {
55
+ id: "linux-amd64",
56
+ cefTarget: "linux64",
57
+ os: "linux",
58
+ arch: "amd64",
59
+ distributionDirectoryName: "dist-muon-linux-amd64",
60
+ runtimeExecutableName: "muon-core",
61
+ bootstrapExecutableName: "muon-bootstrap",
62
+ launcherExtension: "",
63
+ runtimeFiles: [
64
+ "muon-core",
65
+ "libmuon-ui.so",
66
+ "libcardio.so"
67
+ ]
68
+ },
69
+ "linux-armhf": {
70
+ id: "linux-armhf",
71
+ cefTarget: "linuxarm",
72
+ os: "linux",
73
+ arch: "armhf",
74
+ distributionDirectoryName: "dist-muon-linux-armhf",
75
+ runtimeExecutableName: "muon-core",
76
+ bootstrapExecutableName: "muon-bootstrap",
77
+ launcherExtension: "",
78
+ runtimeFiles: [
79
+ "muon-core",
80
+ "libmuon-ui.so",
81
+ "libcardio.so"
82
+ ]
83
+ },
84
+ "linux-arm64": {
85
+ id: "linux-arm64",
86
+ cefTarget: "linuxarm64",
87
+ os: "linux",
88
+ arch: "arm64",
89
+ distributionDirectoryName: "dist-muon-linux-arm64",
90
+ runtimeExecutableName: "muon-core",
91
+ bootstrapExecutableName: "muon-bootstrap",
92
+ launcherExtension: "",
93
+ runtimeFiles: [
94
+ "muon-core",
95
+ "libmuon-ui.so",
96
+ "libcardio.so"
97
+ ]
98
+ },
99
+ "windows-i686": {
100
+ id: "windows-i686",
101
+ cefTarget: "windows32",
102
+ os: "windows",
103
+ arch: "i686",
104
+ distributionDirectoryName: "dist-muon-windows-i686",
105
+ runtimeExecutableName: "muon-core.exe",
106
+ bootstrapExecutableName: "muon-bootstrap.exe",
107
+ launcherExtension: ".exe",
108
+ runtimeFiles: [
109
+ "muon-core.exe",
110
+ "libmuon-ui.dll",
111
+ "libcardio.dll"
112
+ ],
113
+ optionalRuntimeFilePatterns: [
114
+ /^libgcc_s_.*-1\.dll$/,
115
+ /^libstdc\+\+-6\.dll$/,
116
+ /^libwinpthread-1\.dll$/
117
+ ]
118
+ },
119
+ "windows-amd64": {
120
+ id: "windows-amd64",
121
+ cefTarget: "windows64",
122
+ os: "windows",
123
+ arch: "amd64",
124
+ distributionDirectoryName: "dist-muon-windows-amd64",
125
+ runtimeExecutableName: "muon-core.exe",
126
+ bootstrapExecutableName: "muon-bootstrap.exe",
127
+ launcherExtension: ".exe",
128
+ runtimeFiles: [
129
+ "muon-core.exe",
130
+ "libmuon-ui.dll",
131
+ "libcardio.dll"
132
+ ],
133
+ optionalRuntimeFilePatterns: [
134
+ /^libgcc_s_.*-1\.dll$/,
135
+ /^libstdc\+\+-6\.dll$/,
136
+ /^libwinpthread-1\.dll$/
137
+ ]
138
+ }
139
+ };
140
+ Object.fromEntries(allMuonTargets.map((target) => [targetDescriptors[target].cefTarget, target]));
141
+ /**
142
+ * Returns metadata for a public Muon target.
143
+ *
144
+ * @param target Public Muon target.
145
+ * @returns Target descriptor.
146
+ */
147
+ var getMuonTargetDescriptor = (target) => targetDescriptors[target];
148
+ /**
149
+ * Normalizes a user supplied public Muon target.
150
+ *
151
+ * @param target Target value supplied by the user.
152
+ * @param label Error label used in diagnostics.
153
+ * @returns Public Muon target.
154
+ */
155
+ var normalizeMuonTarget = (target, label = "Muon target") => {
156
+ const normalized = target.trim().toLowerCase();
157
+ if (allMuonTargets.includes(normalized)) return normalized;
158
+ throw new Error(`Unsupported ${label}: ${target}`);
159
+ };
160
+ /**
161
+ * Resolves a Node platform and architecture pair to a public Muon target.
162
+ *
163
+ * @param platform Node platform.
164
+ * @param architecture Node architecture.
165
+ * @returns Public Muon target.
166
+ */
167
+ var getDefaultMuonTarget = (platform, architecture) => {
168
+ if (platform === "win32") {
169
+ if (architecture === "ia32") return "windows-i686";
170
+ if (architecture === "x64") return "windows-amd64";
171
+ }
172
+ if (platform === "linux") {
173
+ if (architecture === "x64") return "linux-amd64";
174
+ if (architecture === "arm") return "linux-armhf";
175
+ if (architecture === "arm64") return "linux-arm64";
176
+ }
177
+ throw new Error(`Unsupported Muon target: platform=${platform}, arch=${architecture}`);
178
+ };
179
+ //#endregion
42
180
  //#region src/prepare.ts
43
181
  /**
44
182
  * Returns the default Muon prepare target for a Node platform and architecture.
@@ -48,16 +186,11 @@ adm_zip = __toESM(adm_zip, 1);
48
186
  * @returns Muon prepare target name.
49
187
  */
50
188
  var getDefaultMuonPrepareTarget = (platform, architecture) => {
51
- if (platform === "win32") {
52
- if (architecture === "ia32") return "windows32";
53
- if (architecture === "x64") return "windows64";
54
- }
55
- if (platform === "linux") {
56
- if (architecture === "x64") return "linux64";
57
- if (architecture === "arm") return "linuxarm";
58
- if (architecture === "arm64") return "linuxarm64";
189
+ try {
190
+ return getDefaultMuonTarget(platform, architecture);
191
+ } catch {
192
+ throw new Error(`Unsupported Muon prepare target: platform=${platform}, arch=${architecture}`);
59
193
  }
60
- throw new Error(`Unsupported Muon prepare target: platform=${platform}, arch=${architecture}`);
61
194
  };
62
195
  var getPrepareExecutableName = (platform) => platform === "win32" ? "muon-prepare.exe" : "muon-prepare";
63
196
  var moduleDirectory$2 = typeof __dirname === "string" ? __dirname : (0, node_path.dirname)((0, node_url.fileURLToPath)({}.url));
@@ -87,7 +220,7 @@ var createMuonPrepareArguments = (options) => {
87
220
  ];
88
221
  if (options.cefPath !== void 0) args.push("--cef-path", options.cefPath);
89
222
  if (options.stageDir !== void 0) args.push("--stage-dir", options.stageDir);
90
- if (options.target !== void 0) args.push("--target", options.target);
223
+ if (options.target !== void 0) args.push("--target", normalizeMuonTarget(options.target, "Muon prepare target"));
91
224
  if (options.cacheDir !== void 0) args.push("--cache-dir", options.cacheDir);
92
225
  if (options.force) args.push("--force");
93
226
  if (options.quiet) args.push("--quiet");
@@ -138,11 +271,35 @@ var runMuonPrepare = async (options) => {
138
271
  };
139
272
  //#endregion
140
273
  //#region src/gitignore.ts
141
- var muonGitignoreEntry = ".muon/";
274
+ var muonGitignoreEntries = [
275
+ ".muon/",
276
+ "dist-muon-*/",
277
+ "artifacts/"
278
+ ];
279
+ var muonGitignoreEntryAliases = {
280
+ ".muon/": [
281
+ ".muon/",
282
+ "/.muon/",
283
+ ".muon",
284
+ "/.muon"
285
+ ],
286
+ "dist-muon-*/": [
287
+ "dist-muon-*/",
288
+ "/dist-muon-*/",
289
+ "dist-muon-*",
290
+ "/dist-muon-*"
291
+ ],
292
+ "artifacts/": [
293
+ "artifacts/",
294
+ "/artifacts/",
295
+ "artifacts",
296
+ "/artifacts"
297
+ ]
298
+ };
142
299
  var isMissingFileError = (error) => error instanceof Error && error.code === "ENOENT";
143
- var hasMuonGitignoreEntry = (content) => content.split(/\r?\n/).map((line) => line.trim()).some((line) => line === muonGitignoreEntry || line === `/${muonGitignoreEntry}` || line === ".muon" || line === "/.muon");
300
+ var hasMuonGitignoreEntry = (content, entry) => content.split(/\r?\n/).map((line) => line.trim()).some((line) => muonGitignoreEntryAliases[entry].includes(line));
144
301
  /**
145
- * Adds the Muon staging directory to a project .gitignore file.
302
+ * Adds Muon generated directories to a project .gitignore file.
146
303
  *
147
304
  * @param root Project root containing the .gitignore file.
148
305
  * @returns Gitignore update result.
@@ -155,12 +312,13 @@ var ensureMuonGitignoreEntry = async (root) => {
155
312
  } catch (error) {
156
313
  if (!isMissingFileError(error)) throw error;
157
314
  }
158
- if (hasMuonGitignoreEntry(content)) return {
315
+ const missingEntries = muonGitignoreEntries.filter((entry) => !hasMuonGitignoreEntry(content, entry));
316
+ if (missingEntries.length === 0) return {
159
317
  gitignorePath,
160
318
  changed: false
161
319
  };
162
320
  const separator = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
163
- await (0, node_fs_promises.writeFile)(gitignorePath, `${content}${separator}${muonGitignoreEntry}\n`);
321
+ await (0, node_fs_promises.writeFile)(gitignorePath, `${content}${separator}${missingEntries.join("\n")}\n`);
164
322
  return {
165
323
  gitignorePath,
166
324
  changed: true
@@ -1727,107 +1885,6 @@ function __resolveDefaultExport(module, isESM) {
1727
1885
  }
1728
1886
  return hasDefault ? resolvedDefault ?? module : module;
1729
1887
  }
1730
- var allTargets = [
1731
- "linux64",
1732
- "linuxarm",
1733
- "linuxarm64",
1734
- "windows32",
1735
- "windows64"
1736
- ];
1737
- var targetAliases = {
1738
- linux64: "linux64",
1739
- "linux-amd64": "linux64",
1740
- "linux-x64": "linux64",
1741
- amd64: "linux64",
1742
- x64: "linux64",
1743
- linuxarm: "linuxarm",
1744
- "linux-arm": "linuxarm",
1745
- "linux-armv7l": "linuxarm",
1746
- arm: "linuxarm",
1747
- armv7l: "linuxarm",
1748
- linuxarm64: "linuxarm64",
1749
- "linux-arm64": "linuxarm64",
1750
- "linux-aarch64": "linuxarm64",
1751
- arm64: "linuxarm64",
1752
- aarch64: "linuxarm64",
1753
- windows32: "windows32",
1754
- "windows-i686": "windows32",
1755
- "windows-ia32": "windows32",
1756
- win32: "windows32",
1757
- i686: "windows32",
1758
- ia32: "windows32",
1759
- windows64: "windows64",
1760
- "windows-amd64": "windows64",
1761
- "windows-x64": "windows64",
1762
- win64: "windows64"
1763
- };
1764
- var targetDescriptors = {
1765
- linux64: {
1766
- distributionDirectoryName: "dist-linux-amd64",
1767
- runtimeExecutableName: "muon-core",
1768
- bootstrapExecutableName: "muon-bootstrap",
1769
- launcherExtension: "",
1770
- runtimeFiles: [
1771
- "muon-core",
1772
- "libmuon-ui.so",
1773
- "libcardio.so"
1774
- ]
1775
- },
1776
- linuxarm: {
1777
- distributionDirectoryName: "dist-linux-armv7l",
1778
- runtimeExecutableName: "muon-core",
1779
- bootstrapExecutableName: "muon-bootstrap",
1780
- launcherExtension: "",
1781
- runtimeFiles: [
1782
- "muon-core",
1783
- "libmuon-ui.so",
1784
- "libcardio.so"
1785
- ]
1786
- },
1787
- linuxarm64: {
1788
- distributionDirectoryName: "dist-linux-arm64",
1789
- runtimeExecutableName: "muon-core",
1790
- bootstrapExecutableName: "muon-bootstrap",
1791
- launcherExtension: "",
1792
- runtimeFiles: [
1793
- "muon-core",
1794
- "libmuon-ui.so",
1795
- "libcardio.so"
1796
- ]
1797
- },
1798
- windows32: {
1799
- distributionDirectoryName: "dist-windows-i686",
1800
- runtimeExecutableName: "muon-core.exe",
1801
- bootstrapExecutableName: "muon-bootstrap.exe",
1802
- launcherExtension: ".exe",
1803
- runtimeFiles: [
1804
- "muon-core.exe",
1805
- "libmuon-ui.dll",
1806
- "libcardio.dll"
1807
- ],
1808
- optionalRuntimeFilePatterns: [
1809
- /^libgcc_s_.*-1\.dll$/,
1810
- /^libstdc\+\+-6\.dll$/,
1811
- /^libwinpthread-1\.dll$/
1812
- ]
1813
- },
1814
- windows64: {
1815
- distributionDirectoryName: "dist-windows-amd64",
1816
- runtimeExecutableName: "muon-core.exe",
1817
- bootstrapExecutableName: "muon-bootstrap.exe",
1818
- launcherExtension: ".exe",
1819
- runtimeFiles: [
1820
- "muon-core.exe",
1821
- "libmuon-ui.dll",
1822
- "libcardio.dll"
1823
- ],
1824
- optionalRuntimeFilePatterns: [
1825
- /^libgcc_s_.*-1\.dll$/,
1826
- /^libstdc\+\+-6\.dll$/,
1827
- /^libwinpthread-1\.dll$/
1828
- ]
1829
- }
1830
- };
1831
1888
  var defaultConfigFileNames = [
1832
1889
  "muon.json5",
1833
1890
  "muon.jsonc",
@@ -1835,7 +1892,8 @@ var defaultConfigFileNames = [
1835
1892
  ];
1836
1893
  var appConfigSourcePath = "./assets.zip";
1837
1894
  var defaultAppName = "muon-app";
1838
- var muonLicenseFileName = "LICENSE_muon";
1895
+ var defaultAppId = "muon-app";
1896
+ var muonLicenseFileName = "CREDITS.md";
1839
1897
  var directoryMode = 493;
1840
1898
  var executableMode = 493;
1841
1899
  var assetSaltByteLength = 16;
@@ -1844,17 +1902,13 @@ var moduleDirectory$1 = typeof __dirname === "string" ? __dirname : (0, node_pat
1844
1902
  * Returns the host target used by muon build when no explicit target is passed.
1845
1903
  */
1846
1904
  var getDefaultMuonBuildTarget = () => {
1847
- return normalizeMuonBuildTarget(getDefaultMuonPrepareTarget(process.platform, process.arch));
1905
+ return getDefaultMuonPrepareTarget(process.platform, process.arch);
1848
1906
  };
1849
1907
  /**
1850
- * Normalizes a user-facing target alias into the npm package target name.
1908
+ * Normalizes a user-facing public target identifier.
1851
1909
  */
1852
1910
  var normalizeMuonBuildTarget = (target) => {
1853
- const normalized = target.trim().toLowerCase();
1854
- if (normalized === "linux-i686" || normalized === "linux-ia32") throw new Error("Linux i686 is not supported by muon build.");
1855
- const resolvedTarget = targetAliases[normalized];
1856
- if (resolvedTarget === void 0) throw new Error(`Unsupported muon build target: ${target}`);
1857
- return resolvedTarget;
1911
+ return normalizeMuonTarget(target, "muon build target");
1858
1912
  };
1859
1913
  /**
1860
1914
  * Builds CEF-free Muon app distribution directories for one or more targets.
@@ -1864,7 +1918,9 @@ var buildMuonApp = async (options = {}) => {
1864
1918
  const packageDirectory = resolvePackageDirectory(options.packageDirectory);
1865
1919
  const targets = resolveBuildTargets(options);
1866
1920
  const outputRoot = (0, node_path.resolve)(root, options.outputRoot ?? ".");
1867
- const appName = await resolveAppName(root, options.appName);
1921
+ const packageJson = await readPackageJson(root);
1922
+ const appName = resolveAppName(packageJson, options.appName);
1923
+ const appId = resolveAppId(packageJson, options.appId);
1868
1924
  const buildConfig = await readBuildConfig(root, options.configPath);
1869
1925
  const assetInput = resolveAssetInput(root, options.assetSourcePath, options.assetPrefix, buildConfig);
1870
1926
  const salt = Buffer.from(options.assetSalt ?? (0, node_crypto.randomBytes)(assetSaltByteLength));
@@ -1874,6 +1930,7 @@ var buildMuonApp = async (options = {}) => {
1874
1930
  packageDirectory,
1875
1931
  outputRoot,
1876
1932
  appName,
1933
+ appId,
1877
1934
  target,
1878
1935
  assetInput,
1879
1936
  sourceConfig: buildConfig.config,
@@ -1884,6 +1941,7 @@ var buildMuonApp = async (options = {}) => {
1884
1941
  return {
1885
1942
  root,
1886
1943
  appName,
1944
+ appId,
1887
1945
  targets: results
1888
1946
  };
1889
1947
  };
@@ -1892,9 +1950,9 @@ var resolvePackageDirectory = (packageDirectory) => {
1892
1950
  return moduleDirectory$1;
1893
1951
  };
1894
1952
  var resolveBuildTargets = (options) => {
1895
- if (options.allTargets === true) return [...allTargets];
1953
+ if (options.allTargets === true) return [...allMuonTargets];
1896
1954
  if (options.targets !== void 0 && options.targets.length > 0) return [...new Set(options.targets.map((target) => normalizeMuonBuildTarget(target)))];
1897
- if (options.allTargets !== false) return [...allTargets];
1955
+ if (options.allTargets !== false) return [...allMuonTargets];
1898
1956
  return [getDefaultMuonBuildTarget()];
1899
1957
  };
1900
1958
  var resolveAssetInput = (root, assetSourcePath, assetPrefix, buildConfig) => {
@@ -1908,16 +1966,31 @@ var normalizeZipPrefix = (prefix) => {
1908
1966
  const normalized = prefix.replaceAll("\\", "/").split("/").filter((part) => part.length > 0).join("/");
1909
1967
  return normalized.length > 0 ? `${normalized}/` : "";
1910
1968
  };
1911
- var resolveAppName = async (root, appName) => {
1969
+ var readPackageJson = async (root) => {
1970
+ const packageJsonPath = (0, node_path.join)(root, "package.json");
1971
+ if (!await fileExists$1(packageJsonPath)) return {};
1972
+ return await readJsonObjectFile(packageJsonPath, "package.json");
1973
+ };
1974
+ var resolvePackageName = (packageJson) => {
1975
+ return typeof packageJson.name === "string" ? packageJson.name : defaultAppName;
1976
+ };
1977
+ var resolveAppName = (packageJson, appName) => {
1912
1978
  if (appName !== void 0) return sanitizeAppName(appName);
1913
- const packageJson = await readJsonObjectFile((0, node_path.join)(root, "package.json"), "package.json");
1914
- const packageName = typeof packageJson.name === "string" ? packageJson.name : defaultAppName;
1979
+ const packageName = resolvePackageName(packageJson);
1915
1980
  return sanitizeAppName(packageName.startsWith("@") ? packageName.slice(packageName.indexOf("/") + 1) : packageName);
1916
1981
  };
1917
1982
  var sanitizeAppName = (name) => {
1918
1983
  const sanitized = name.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[.-]+/g, "").replace(/[.-]+$/g, "");
1919
1984
  return sanitized.length > 0 ? sanitized : defaultAppName;
1920
1985
  };
1986
+ var resolveAppId = (packageJson, appId) => {
1987
+ if (appId !== void 0) return sanitizeAppId(appId);
1988
+ return sanitizeAppId(resolvePackageName(packageJson));
1989
+ };
1990
+ var sanitizeAppId = (value) => {
1991
+ const sanitized = (value.startsWith("@") ? value.slice(1) : value).trim().toLowerCase().replace("/", ".").replace(/[^a-z0-9._-]+/g, ".").replace(/^[.]+/g, "").replace(/[.]+$/g, "");
1992
+ return sanitized.length > 0 ? sanitized : defaultAppId;
1993
+ };
1921
1994
  var readBuildConfig = async (root, configPath) => {
1922
1995
  const resolvedConfigPath = await resolveConfigPath(root, configPath);
1923
1996
  if (resolvedConfigPath === void 0) return {
@@ -1966,7 +2039,7 @@ var readJsonObjectFile = async (filePath, label) => {
1966
2039
  return parsed;
1967
2040
  };
1968
2041
  var buildMuonTarget = async (input) => {
1969
- const descriptor = targetDescriptors[input.target];
2042
+ const descriptor = getMuonTargetDescriptor(input.target);
1970
2043
  const sourceRuntimePath = (0, node_path.join)(input.packageDirectory, "runtime", input.target);
1971
2044
  const sourceBootstrapPath = (0, node_path.join)(input.packageDirectory, "native", input.target, descriptor.bootstrapExecutableName);
1972
2045
  const outputPath = (0, node_path.join)(input.outputRoot, descriptor.distributionDirectoryName);
@@ -1991,7 +2064,7 @@ var buildMuonTarget = async (input) => {
1991
2064
  await (0, node_fs_promises.copyFile)(sourceBootstrapPath, launcherPath);
1992
2065
  await (0, node_fs_promises.chmod)(launcherPath, executableMode);
1993
2066
  const asset = await writeAssetArchive(input.assetInput, assetZipPath, input.salt);
1994
- const embeddedConfig = createEmbeddedConfig(input.sourceConfig, asset);
2067
+ const embeddedConfig = createEmbeddedConfig(input.sourceConfig, asset, input.appId);
1995
2068
  await withTemporaryConfig(embeddedConfig, async (configPath) => {
1996
2069
  await embedMuonConfigInRuntime({
1997
2070
  runtimePath: outputPath,
@@ -2085,9 +2158,11 @@ var createZipArchive = (entries) => {
2085
2158
  for (const entry of entries) zip.addFile(entry.name, entry.data);
2086
2159
  return zip.toBuffer();
2087
2160
  };
2088
- var createEmbeddedConfig = (sourceConfig, asset) => {
2161
+ var createEmbeddedConfig = (sourceConfig, asset, appId) => {
2089
2162
  const sourceAsset = sourceConfig.asset;
2090
2163
  if (sourceAsset !== void 0 && !isJsonObject$1(sourceAsset)) throw new Error("muon.json asset must be an object when present.");
2164
+ const sourceBootstrap = sourceConfig.bootstrap;
2165
+ if (sourceBootstrap !== void 0 && !isJsonObject$1(sourceBootstrap)) throw new Error("muon.json bootstrap must be an object when present.");
2091
2166
  return {
2092
2167
  ...sourceConfig,
2093
2168
  asset: {
@@ -2095,6 +2170,10 @@ var createEmbeddedConfig = (sourceConfig, asset) => {
2095
2170
  sourcePath: appConfigSourcePath,
2096
2171
  signature: asset.signature,
2097
2172
  salt: asset.salt
2173
+ },
2174
+ bootstrap: {
2175
+ ...sourceBootstrap ?? {},
2176
+ appId
2098
2177
  }
2099
2178
  };
2100
2179
  };
@@ -2387,7 +2466,7 @@ var isRecord = (value) => typeof value === "object" && value !== null && !Array.
2387
2466
  var isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
2388
2467
  var isMuonViteBuildOptions = (value) => {
2389
2468
  if (!isRecord(value)) return false;
2390
- return (value.targets === void 0 || isStringArray(value.targets)) && (value.allTargets === void 0 || typeof value.allTargets === "boolean") && (value.appName === void 0 || typeof value.appName === "string") && (value.outputRoot === void 0 || typeof value.outputRoot === "string") && (value.configPath === void 0 || typeof value.configPath === "string") && (value.packageDirectory === void 0 || typeof value.packageDirectory === "string") && (value.assetSalt === void 0 || value.assetSalt instanceof Uint8Array);
2469
+ return (value.targets === void 0 || isStringArray(value.targets)) && (value.allTargets === void 0 || typeof value.allTargets === "boolean") && (value.appName === void 0 || typeof value.appName === "string") && (value.appId === void 0 || typeof value.appId === "string") && (value.outputRoot === void 0 || typeof value.outputRoot === "string") && (value.configPath === void 0 || typeof value.configPath === "string") && (value.packageDirectory === void 0 || typeof value.packageDirectory === "string") && (value.assetSalt === void 0 || value.assetSalt instanceof Uint8Array);
2391
2470
  };
2392
2471
  var isMuonVitePluginOptions = (value) => {
2393
2472
  if (!isRecord(value)) return false;
@@ -2433,6 +2512,12 @@ var flattenVitePluginOptions = async (pluginOptions) => {
2433
2512
  return [resolvedValue];
2434
2513
  };
2435
2514
  //#endregion
2515
+ Object.defineProperty(exports, "__toESM", {
2516
+ enumerable: true,
2517
+ get: function() {
2518
+ return __toESM;
2519
+ }
2520
+ });
2436
2521
  Object.defineProperty(exports, "attachMuonVitePluginOptions", {
2437
2522
  enumerable: true,
2438
2523
  get: function() {
@@ -2487,6 +2572,12 @@ Object.defineProperty(exports, "getMuonExecutablePath", {
2487
2572
  return getMuonExecutablePath;
2488
2573
  }
2489
2574
  });
2575
+ Object.defineProperty(exports, "getMuonTargetDescriptor", {
2576
+ enumerable: true,
2577
+ get: function() {
2578
+ return getMuonTargetDescriptor;
2579
+ }
2580
+ });
2490
2581
  Object.defineProperty(exports, "getMuonVitePluginOptions", {
2491
2582
  enumerable: true,
2492
2583
  get: function() {
@@ -2518,4 +2609,4 @@ Object.defineProperty(exports, "startMuonViteBrowserBridge", {
2518
2609
  }
2519
2610
  });
2520
2611
 
2521
- //# sourceMappingURL=vite-options-D4u4kLQI.cjs.map
2612
+ //# sourceMappingURL=vite-options-FFh0NWUa.cjs.map