muon-ui 0.3.0 → 0.5.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 (42) hide show
  1. package/README.md +2 -1
  2. package/dist/cli.cjs +265 -12
  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/linux64/muon-bootstrap +0 -0
  7. package/dist/native/linux64/muon-prepare +0 -0
  8. package/dist/native/linuxarm/muon-bootstrap +0 -0
  9. package/dist/native/linuxarm/muon-prepare +0 -0
  10. package/dist/native/linuxarm64/muon-bootstrap +0 -0
  11. package/dist/native/linuxarm64/muon-prepare +0 -0
  12. package/dist/native/windows32/muon-bootstrap.exe +0 -0
  13. package/dist/native/windows32/muon-prepare.exe +0 -0
  14. package/dist/native/windows64/muon-bootstrap.exe +0 -0
  15. package/dist/native/windows64/muon-prepare.exe +0 -0
  16. package/dist/runtime/linux64/libmuon-ui.so +0 -0
  17. package/dist/runtime/linux64/muon-core +0 -0
  18. package/dist/runtime/linuxarm/libmuon-ui.so +0 -0
  19. package/dist/runtime/linuxarm/muon-core +0 -0
  20. package/dist/runtime/linuxarm64/libmuon-ui.so +0 -0
  21. package/dist/runtime/linuxarm64/muon-core +0 -0
  22. package/dist/runtime/windows32/libcardio.dll +0 -0
  23. package/dist/runtime/windows32/libgcc_s_dw2-1.dll +0 -0
  24. package/dist/runtime/windows32/libmuon-ui.dll +0 -0
  25. package/dist/runtime/windows32/libstdc++-6.dll +0 -0
  26. package/dist/runtime/windows32/muon-core.exe +0 -0
  27. package/dist/runtime/windows64/libcardio.dll +0 -0
  28. package/dist/runtime/windows64/libgcc_s_seh-1.dll +0 -0
  29. package/dist/runtime/windows64/libmuon-ui.dll +0 -0
  30. package/dist/runtime/windows64/libstdc++-6.dll +0 -0
  31. package/dist/runtime/windows64/muon-core.exe +0 -0
  32. package/dist/{build-xwfaxosJ.cjs → vite-options-D4u4kLQI.cjs} +366 -21
  33. package/dist/vite-options-D4u4kLQI.cjs.map +1 -0
  34. package/dist/vite.cjs +7 -236
  35. package/dist/vite.cjs.map +1 -1
  36. package/dist/vite.mjs +59 -6
  37. package/dist/vite.mjs.map +1 -1
  38. package/images/vscode.png +0 -0
  39. package/muon.d.ts +12 -2
  40. package/package.json +9 -8
  41. package/vite.d.ts +3 -0
  42. package/dist/build-xwfaxosJ.cjs.map +0 -1
package/README.md CHANGED
@@ -59,6 +59,7 @@ you can develop modern local GUI applications using the web-based technology eco
59
59
  - The browser responsible for rendering is CEF (Chromium Embedded Framework).
60
60
  This means that, from the perspective of your web application, it is virtually equivalent to using Chromium or Chrome.
61
61
  - Supports Vite plugins (optional). With support for Vite’s HMR, you can update previews in real time during development.
62
+ - Provides `muon dev` for launching local development assets directly without starting an HTTP server.
62
63
  - You can use Chromium DevTools. Furthermore, because it supports CDP (Chromium DevTools Protocol), you can perform remote debugging from an external source.
63
64
  - You can display multiple browser windows. Browser windows can also be organized into a parent-child hierarchy.
64
65
  - It features a plugin system. Additionally, plugin functionality can be restricted using a whitelist filter.
@@ -71,7 +72,7 @@ you can develop modern local GUI applications using the web-based technology eco
71
72
  - Windows: i686, amd64
72
73
  - Build Environment
73
74
  - Node.js 20 or later
74
- - Vite 7 or later (optional)
75
+ - Vite 5 or later (optional)
75
76
 
76
77
  ---
77
78
 
package/dist/cli.cjs CHANGED
@@ -1,18 +1,252 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  * name: muon-ui
4
- * version: 0.3.0
4
+ * version: 0.5.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: e3c2c87d50dddb0bf6c2b4d5ebf0a37ab2d3b433
9
+ * git.commit.hash: 122830dc7b35ced0c4c88c91d3a9dd8b3dee18e2
10
10
  */
11
- const require_build = require("./build-xwfaxosJ.cjs");
11
+ const require_vite_options = require("./vite-options-D4u4kLQI.cjs");
12
12
  let commander = require("commander");
13
+ let node_child_process = require("node:child_process");
14
+ let node_fs = require("node:fs");
15
+ let node_fs_promises = require("node:fs/promises");
16
+ let node_path = require("node:path");
17
+ //#region src/dev.ts
18
+ var import_dist = require_vite_options.require_dist();
19
+ var muonRecycleExitCode = 88;
20
+ var defaultProjectConfigFileNames = [
21
+ "muon.json5",
22
+ "muon.jsonc",
23
+ "muon.json"
24
+ ];
25
+ var resolveFromRoot = (root, path) => (0, node_path.isAbsolute)(path) ? path : (0, node_path.resolve)(root, path);
26
+ var isJsonObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
27
+ var getErrorMessage = (error) => error instanceof Error ? error.message : String(error);
28
+ var fileExists = async (path) => {
29
+ try {
30
+ return (await (0, node_fs_promises.stat)(path)).isFile();
31
+ } catch {
32
+ return false;
33
+ }
34
+ };
35
+ var directoryExists = async (path) => {
36
+ try {
37
+ return (await (0, node_fs_promises.stat)(path)).isDirectory();
38
+ } catch {
39
+ return false;
40
+ }
41
+ };
42
+ var isMissingVitePackageError = (error) => {
43
+ const candidate = error;
44
+ return candidate.code === "ERR_MODULE_NOT_FOUND" && typeof candidate.message === "string" && candidate.message.includes("vite");
45
+ };
46
+ var loadViteMuonOptions = async (cwd) => {
47
+ let vite;
48
+ try {
49
+ vite = await import("vite");
50
+ } catch (error) {
51
+ if (isMissingVitePackageError(error)) return {
52
+ root: (0, node_path.resolve)(cwd),
53
+ pluginOptions: void 0
54
+ };
55
+ throw error;
56
+ }
57
+ const loaded = await vite.loadConfigFromFile({
58
+ command: "serve",
59
+ mode: "development",
60
+ isPreview: false,
61
+ isSsrBuild: false
62
+ }, void 0, cwd, "silent");
63
+ if (loaded === null) return {
64
+ root: (0, node_path.resolve)(cwd),
65
+ pluginOptions: void 0
66
+ };
67
+ const config = loaded.config;
68
+ const root = typeof config.root === "string" ? (0, node_path.resolve)(cwd, config.root) : (0, node_path.resolve)(cwd);
69
+ const muonPlugins = (await require_vite_options.flattenVitePluginOptions(config.plugins)).map((plugin) => require_vite_options.getMuonVitePluginOptions(plugin)).filter((pluginOptions) => pluginOptions !== void 0);
70
+ if (muonPlugins.length > 1) throw new Error("Multiple muon() plugin definitions were found in vite.config.*.");
71
+ return {
72
+ root,
73
+ pluginOptions: muonPlugins[0]
74
+ };
75
+ };
76
+ var resolveProjectConfigPath = async (root, configPath) => {
77
+ if (configPath !== void 0) {
78
+ const resolvedPath = resolveFromRoot(root, configPath);
79
+ if (!await fileExists(resolvedPath)) throw new Error(`Muon config file does not exist: ${resolvedPath}`);
80
+ return resolvedPath;
81
+ }
82
+ for (const fileName of defaultProjectConfigFileNames) {
83
+ const candidatePath = (0, node_path.join)(root, fileName);
84
+ if (await fileExists(candidatePath)) return candidatePath;
85
+ }
86
+ };
87
+ var readJsonObjectFile = async (filePath, label) => {
88
+ let content;
89
+ try {
90
+ content = await (0, node_fs_promises.readFile)(filePath, "utf8");
91
+ } catch (error) {
92
+ throw new Error(`${label} could not be read: ${filePath}: ${getErrorMessage(error)}`);
93
+ }
94
+ let parsed;
95
+ try {
96
+ parsed = (0, import_dist.parse)(content);
97
+ } catch (error) {
98
+ throw new Error(`${label} could not be parsed: ${filePath}: ${getErrorMessage(error)}`);
99
+ }
100
+ if (!isJsonObject(parsed)) throw new Error(`${label} must contain a JSON object: ${filePath}`);
101
+ return parsed;
102
+ };
103
+ var resolveProjectConfig = async (root, configPath) => {
104
+ const resolvedConfigPath = await resolveProjectConfigPath(root, configPath);
105
+ if (resolvedConfigPath === void 0) return {
106
+ configPath: void 0,
107
+ config: void 0
108
+ };
109
+ return {
110
+ configPath: resolvedConfigPath,
111
+ config: await readJsonObjectFile(resolvedConfigPath, "muon config")
112
+ };
113
+ };
114
+ var readConfigAssetSourcePath = (config) => {
115
+ if (config === void 0) return;
116
+ const asset = config.asset;
117
+ if (asset === void 0) return;
118
+ if (!isJsonObject(asset)) throw new Error("muon config asset must be an object when present.");
119
+ const sourcePath = asset.sourcePath;
120
+ if (sourcePath === void 0) return;
121
+ if (typeof sourcePath !== "string") throw new Error("muon config asset.sourcePath must be a string.");
122
+ if (sourcePath.trim().length === 0) throw new Error("muon config asset.sourcePath must not be empty.");
123
+ return sourcePath;
124
+ };
125
+ var assertDevelopmentAssetDirectory = async (assetSourcePath) => {
126
+ if (await directoryExists(assetSourcePath)) return;
127
+ try {
128
+ await (0, node_fs_promises.access)(assetSourcePath, node_fs.constants.F_OK);
129
+ } catch {
130
+ throw new Error(`Muon dev asset source does not exist: ${assetSourcePath}`);
131
+ }
132
+ throw new Error(`Muon dev asset source must be a directory: ${assetSourcePath}`);
133
+ };
134
+ var resolveAssetSource = async (root, assetSourcePath, projectConfig) => {
135
+ const configuredAssetSourcePath = readConfigAssetSourcePath(projectConfig.config);
136
+ if (assetSourcePath !== void 0) {
137
+ const resolvedPath = resolveFromRoot(root, assetSourcePath);
138
+ await assertDevelopmentAssetDirectory(resolvedPath);
139
+ return {
140
+ assetSourcePath: resolvedPath,
141
+ overrideAssetSourcePath: resolvedPath
142
+ };
143
+ }
144
+ if (configuredAssetSourcePath !== void 0 && projectConfig.configPath !== void 0) return {
145
+ assetSourcePath: (0, node_path.resolve)((0, node_path.dirname)(projectConfig.configPath), configuredAssetSourcePath),
146
+ overrideAssetSourcePath: void 0
147
+ };
148
+ const defaultAssetSourcePath = (0, node_path.resolve)(root, "assets");
149
+ await assertDevelopmentAssetDirectory(defaultAssetSourcePath);
150
+ return {
151
+ assetSourcePath: defaultAssetSourcePath,
152
+ overrideAssetSourcePath: defaultAssetSourcePath
153
+ };
154
+ };
155
+ var createMuonDevOverrideConfig = (assetSourcePath, enableDebugger) => ({
156
+ ...assetSourcePath === void 0 ? {} : { asset: { sourcePath: assetSourcePath } },
157
+ ...enableDebugger ? {
158
+ cdp: { enable: true },
159
+ browser: { keybind: {
160
+ devtools: "f12",
161
+ recycle: "ctrl+f12"
162
+ } }
163
+ } : {}
164
+ });
165
+ var writeMuonDevOverrideConfig = async (overrideConfigPath, overrideConfig) => {
166
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(overrideConfigPath), { recursive: true });
167
+ await (0, node_fs_promises.writeFile)(overrideConfigPath, `${JSON.stringify(overrideConfig, null, 2)}\n`);
168
+ };
169
+ var runMuonExecutable = async (muonExecutablePath, configPaths, environment) => {
170
+ const args = configPaths.flatMap((configPath) => ["-c", configPath]);
171
+ let exitCode = 0;
172
+ do {
173
+ const child = (0, node_child_process.spawn)(muonExecutablePath, args, {
174
+ cwd: (0, node_path.dirname)(muonExecutablePath),
175
+ env: environment,
176
+ stdio: [
177
+ "ignore",
178
+ "inherit",
179
+ "inherit"
180
+ ]
181
+ });
182
+ exitCode = await new Promise((resolvePromise, reject) => {
183
+ child.once("error", reject);
184
+ child.once("close", (code) => {
185
+ resolvePromise(code ?? 1);
186
+ });
187
+ });
188
+ } while (exitCode === muonRecycleExitCode);
189
+ return exitCode;
190
+ };
191
+ /**
192
+ * Launches Muon directly against local development assets.
193
+ *
194
+ * @param options Development startup options.
195
+ * @returns Development startup result after the Muon process exits.
196
+ */
197
+ var runMuonDev = async (options = {}) => {
198
+ const loadedViteOptions = await loadViteMuonOptions((0, node_path.resolve)(options.root ?? process.cwd()));
199
+ const root = loadedViteOptions.root;
200
+ const pluginOptions = loadedViteOptions.pluginOptions;
201
+ const platform = options.platform ?? process.platform;
202
+ const architecture = options.architecture ?? process.arch;
203
+ const environment = options.environment ?? process.env;
204
+ const target = require_vite_options.getDefaultMuonPrepareTarget(platform, architecture);
205
+ const muonPath = require_vite_options.resolveMuonRuntimePath({
206
+ root,
207
+ target,
208
+ muonPath: options.muonPath ?? pluginOptions?.muonPath
209
+ });
210
+ const cefPath = options.cefPath !== void 0 ? resolveFromRoot(root, options.cefPath) : pluginOptions?.cefPath === void 0 ? void 0 : resolveFromRoot(root, pluginOptions.cefPath);
211
+ 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);
212
+ const enableDebugger = options.enableDebugger ?? pluginOptions?.enableDebugger ?? true;
213
+ const projectConfig = await resolveProjectConfig(root, options.configPath);
214
+ const asset = await resolveAssetSource(root, options.assetSourcePath, projectConfig);
215
+ const overrideConfigPath = (0, node_path.join)(root, ".muon", "dev", "muon.dev.json");
216
+ await require_vite_options.ensureMuonGitignoreEntry(root);
217
+ const preparedRuntime = await require_vite_options.runMuonPrepare({
218
+ muonPath,
219
+ cefPath,
220
+ stageDir: stagePath,
221
+ target,
222
+ cacheDir: environment.MUON_CACHE_DIR,
223
+ force: false,
224
+ quiet: options.quietPrepare === true,
225
+ prepareExecutablePath: void 0,
226
+ environment,
227
+ cwd: root
228
+ });
229
+ if (preparedRuntime.stagePath === void 0) throw new Error("muon-prepare did not return a staged runtime path.");
230
+ await writeMuonDevOverrideConfig(overrideConfigPath, createMuonDevOverrideConfig(asset.overrideAssetSourcePath, enableDebugger));
231
+ const muonExecutablePath = require_vite_options.getMuonExecutablePath(preparedRuntime.stagePath, platform);
232
+ const exitCode = await runMuonExecutable(muonExecutablePath, [...projectConfig.configPath === void 0 ? [] : [projectConfig.configPath], overrideConfigPath], environment);
233
+ return {
234
+ root,
235
+ target,
236
+ muonPath: preparedRuntime.muonPath,
237
+ cefPath: preparedRuntime.cefPath,
238
+ stagePath: preparedRuntime.stagePath,
239
+ muonExecutablePath,
240
+ ...projectConfig.configPath === void 0 ? {} : { projectConfigPath: projectConfig.configPath },
241
+ overrideConfigPath,
242
+ assetSourcePath: asset.assetSourcePath,
243
+ exitCode
244
+ };
245
+ };
246
+ //#endregion
13
247
  //#region src/generated/packageMetadata.ts
14
- var version = "0.3.0";
15
- var git_commit_hash = "e3c2c87d50dddb0bf6c2b4d5ebf0a37ab2d3b433";
248
+ var version = "0.5.0";
249
+ var git_commit_hash = "122830dc7b35ced0c4c88c91d3a9dd8b3dee18e2";
16
250
  //#endregion
17
251
  //#region src/cli.ts
18
252
  var readTargetValues = (value) => {
@@ -40,16 +274,16 @@ var runBuildCommand = async (commandOptions) => {
40
274
  if (commandOptions.config !== void 0) buildOptions.configPath = commandOptions.config;
41
275
  if (commandOptions.outDir !== void 0) buildOptions.outputRoot = commandOptions.outDir;
42
276
  if (commandOptions.name !== void 0) buildOptions.appName = commandOptions.name;
43
- const result = await require_build.buildMuonApp(buildOptions);
277
+ const result = await require_vite_options.buildMuonApp(buildOptions);
44
278
  if (commandOptions.json === true) console.log(JSON.stringify(result, null, 2));
45
279
  else for (const target of result.targets) console.log(target.outputPath);
46
280
  };
47
281
  var runPrepareCommand = async (commandOptions) => {
48
- const result = await require_build.runMuonPrepare({
282
+ const result = await require_vite_options.runMuonPrepare({
49
283
  muonPath: commandOptions.muonPath ?? "",
50
284
  cefPath: commandOptions.cefPath,
51
285
  stageDir: commandOptions.stageDir,
52
- target: commandOptions.target ?? require_build.getDefaultMuonPrepareTarget(process.platform, process.arch),
286
+ target: commandOptions.target ?? require_vite_options.getDefaultMuonPrepareTarget(process.platform, process.arch),
53
287
  cacheDir: commandOptions.cacheDir,
54
288
  force: commandOptions.force === true,
55
289
  quiet: commandOptions.quiet === true,
@@ -60,8 +294,24 @@ var runPrepareCommand = async (commandOptions) => {
60
294
  if (commandOptions.json === true) console.log(JSON.stringify(result, null, 2));
61
295
  else console.log(result.stagePath ?? result.cefPath);
62
296
  };
297
+ var runDevCommand = async (commandOptions, command) => {
298
+ const devOptions = {
299
+ root: process.cwd(),
300
+ environment: process.env,
301
+ quietPrepare: commandOptions.json === true
302
+ };
303
+ if (commandOptions.muonPath !== void 0) devOptions.muonPath = commandOptions.muonPath;
304
+ if (commandOptions.cefPath !== void 0) devOptions.cefPath = commandOptions.cefPath;
305
+ if (commandOptions.stageDir !== void 0) devOptions.stagePath = commandOptions.stageDir;
306
+ if (commandOptions.config !== void 0) devOptions.configPath = commandOptions.config;
307
+ if (commandOptions.assets !== void 0) devOptions.assetSourcePath = commandOptions.assets;
308
+ if (command.getOptionValueSource("debugger") === "cli") devOptions.enableDebugger = commandOptions.debugger === true;
309
+ const result = await runMuonDev(devOptions);
310
+ if (commandOptions.json === true) console.log(JSON.stringify(result, null, 2));
311
+ if (result.exitCode !== 0) process.exitCode = result.exitCode;
312
+ };
63
313
  var runInitCommand = async () => {
64
- const result = await require_build.ensureMuonGitignoreEntry(process.cwd());
314
+ const result = await require_vite_options.ensureMuonGitignoreEntry(process.cwd());
65
315
  console.log(result.changed ? `Updated ${result.gitignorePath}` : result.gitignorePath);
66
316
  };
67
317
  var printEmbedConfigResult = (result, json) => {
@@ -71,16 +321,16 @@ var printEmbedConfigResult = (result, json) => {
71
321
  var runEmbedConfigCommand = async (commandOptions) => {
72
322
  validateEmbedConfigOptions(commandOptions);
73
323
  const configPath = commandOptions.config ?? "";
74
- const coreResult = commandOptions.corePath !== void 0 ? await require_build.embedMuonConfigInCoreFile({
324
+ const coreResult = commandOptions.corePath !== void 0 ? await require_vite_options.embedMuonConfigInCoreFile({
75
325
  corePath: commandOptions.corePath,
76
326
  configPath,
77
327
  outputPath: commandOptions.output
78
- }) : commandOptions.runtimePath !== void 0 ? await require_build.embedMuonConfigInRuntime({
328
+ }) : commandOptions.runtimePath !== void 0 ? await require_vite_options.embedMuonConfigInRuntime({
79
329
  runtimePath: commandOptions.runtimePath,
80
330
  configPath,
81
331
  outputRuntimePath: commandOptions.outputRuntimePath
82
332
  }) : void 0;
83
- const bootstrapResult = commandOptions.bootstrapPath === void 0 ? void 0 : await require_build.embedMuonConfigInBootstrapFile({
333
+ const bootstrapResult = commandOptions.bootstrapPath === void 0 ? void 0 : await require_vite_options.embedMuonConfigInBootstrapFile({
84
334
  bootstrapPath: commandOptions.bootstrapPath,
85
335
  configPath,
86
336
  outputPath: commandOptions.outputBootstrap
@@ -106,6 +356,9 @@ var createCliCommand = () => {
106
356
  program.command("build").description("Build CEF-free Muon app distribution directories").option("--target <target>", "target alias or comma-separated target aliases", 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("--json", "write result as JSON").action(async (options) => {
107
357
  await runBuildCommand(options);
108
358
  });
359
+ 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) => {
360
+ await runDevCommand(options, devCommand);
361
+ });
109
362
  program.command("init").description("Initialize Muon project helper files").action(async () => {
110
363
  await runInitCommand();
111
364
  });
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":[],"sources":["../src/generated/packageMetadata.ts","../src/cli.ts"],"sourcesContent":["// @ts-nocheck\n// This file is auto-generated by screw-up plugin\n// Do not edit manually\n\nexport const name = \"muon-ui\";\nexport const version = \"0.3.0\";\nexport const description = \"A multi-platform GUI application framework that uses CEF as its backend\";\nexport const author = \"Kouji Matsui (@kekyo@mi.kekyo.net)\";\nexport const license = \"MIT\";\nexport const repository_url = \"https://github.com/kekyo/muon-ui.git\";\nexport const git_commit_hash = \"e3c2c87d50dddb0bf6c2b4d5ebf0a37ab2d3b433\";\n","#!/usr/bin/env node\n// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon\n\nimport { Command } from \"commander\";\n\nimport {\n getDefaultMuonPrepareTarget,\n runMuonPrepare,\n type MuonPrepareOptions,\n} from \"./prepare.js\";\nimport { ensureMuonGitignoreEntry } from \"./gitignore.js\";\nimport {\n embedMuonConfigInBootstrapFile,\n embedMuonConfigInCoreFile,\n embedMuonConfigInRuntime,\n type EmbedMuonConfigResult,\n} from \"./embed-config.js\";\nimport { buildMuonApp, type MuonBuildOptions } from \"./build.js\";\nimport { git_commit_hash, version } from \"./generated/packageMetadata.js\";\n\ninterface PrepareCommandOptions {\n muonPath: string | undefined;\n cefPath: string | undefined;\n stageDir: string | undefined;\n target: string | undefined;\n cacheDir: string | undefined;\n force: boolean | undefined;\n quiet: boolean | undefined;\n json: boolean | undefined;\n}\n\ninterface EmbedConfigCommandOptions {\n runtimePath: string | undefined;\n corePath: string | undefined;\n bootstrapPath: string | undefined;\n config: string | undefined;\n outputRuntimePath: string | undefined;\n output: string | undefined;\n outputBootstrap: string | undefined;\n json: boolean | undefined;\n}\n\ninterface BuildCommandOptions {\n target: string[];\n all: boolean | undefined;\n assets: string | undefined;\n config: string | undefined;\n outDir: string | undefined;\n name: string | undefined;\n json: boolean | undefined;\n}\n\nconst readTargetValues = (value: string): string[] => {\n return value\n .split(\",\")\n .map((value) => value.trim())\n .filter((value) => value.length > 0);\n};\n\nconst appendTargetValues = (value: string, previous: string[]): string[] => {\n return [...previous, ...readTargetValues(value)];\n};\n\nconst validateEmbedConfigOptions = (\n options: EmbedConfigCommandOptions,\n): void => {\n if (options.runtimePath !== undefined && options.corePath !== undefined) {\n throw new Error(\"Specify at most one of --runtime-path or --core-path.\");\n }\n if (\n options.runtimePath === undefined &&\n options.corePath === undefined &&\n options.bootstrapPath === undefined\n ) {\n throw new Error(\n \"Specify at least one of --runtime-path, --core-path, or --bootstrap-path.\",\n );\n }\n if (\n options.corePath !== undefined &&\n options.outputRuntimePath !== undefined\n ) {\n throw new Error(\"--output-runtime-path requires --runtime-path.\");\n }\n if (options.runtimePath !== undefined && options.output !== undefined) {\n throw new Error(\"--output requires --core-path.\");\n }\n if (\n options.bootstrapPath === undefined &&\n options.outputBootstrap !== undefined\n ) {\n throw new Error(\"--output-bootstrap requires --bootstrap-path.\");\n }\n};\n\nconst runBuildCommand = async (\n commandOptions: BuildCommandOptions,\n): Promise<void> => {\n const targets = commandOptions.target;\n if (commandOptions.all === true && targets.length > 0) {\n throw new Error(\"Specify either --all or --target, not both.\");\n }\n\n const buildOptions: MuonBuildOptions = {\n root: process.cwd(),\n allTargets: commandOptions.all === true,\n };\n\n if (targets.length > 0) {\n buildOptions.targets = targets;\n }\n if (commandOptions.assets !== undefined) {\n buildOptions.assetSourcePath = commandOptions.assets;\n }\n if (commandOptions.config !== undefined) {\n buildOptions.configPath = commandOptions.config;\n }\n if (commandOptions.outDir !== undefined) {\n buildOptions.outputRoot = commandOptions.outDir;\n }\n if (commandOptions.name !== undefined) {\n buildOptions.appName = commandOptions.name;\n }\n\n const result = await buildMuonApp(buildOptions);\n if (commandOptions.json === true) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n for (const target of result.targets) {\n console.log(target.outputPath);\n }\n }\n};\n\nconst runPrepareCommand = async (\n commandOptions: PrepareCommandOptions,\n): Promise<void> => {\n const prepareOptions: MuonPrepareOptions = {\n muonPath: commandOptions.muonPath ?? \"\",\n cefPath: commandOptions.cefPath,\n stageDir: commandOptions.stageDir,\n target:\n commandOptions.target ??\n getDefaultMuonPrepareTarget(process.platform, process.arch),\n cacheDir: commandOptions.cacheDir,\n force: commandOptions.force === true,\n quiet: commandOptions.quiet === true,\n prepareExecutablePath: undefined,\n environment: process.env,\n cwd: process.cwd(),\n };\n const result = await runMuonPrepare(prepareOptions);\n if (commandOptions.json === true) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(result.stagePath ?? result.cefPath);\n }\n};\n\nconst runInitCommand = async (): Promise<void> => {\n const result = await ensureMuonGitignoreEntry(process.cwd());\n console.log(\n result.changed ? `Updated ${result.gitignorePath}` : result.gitignorePath,\n );\n};\n\nconst printEmbedConfigResult = (\n result: EmbedMuonConfigResult,\n json: boolean | undefined,\n): void => {\n if (json === true) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(result.outputPath);\n }\n};\n\nconst runEmbedConfigCommand = async (\n commandOptions: EmbedConfigCommandOptions,\n): Promise<void> => {\n validateEmbedConfigOptions(commandOptions);\n const configPath = commandOptions.config ?? \"\";\n const coreResult =\n commandOptions.corePath !== undefined\n ? await embedMuonConfigInCoreFile({\n corePath: commandOptions.corePath,\n configPath,\n outputPath: commandOptions.output,\n })\n : commandOptions.runtimePath !== undefined\n ? await embedMuonConfigInRuntime({\n runtimePath: commandOptions.runtimePath,\n configPath,\n outputRuntimePath: commandOptions.outputRuntimePath,\n })\n : undefined;\n const bootstrapResult =\n commandOptions.bootstrapPath === undefined\n ? undefined\n : await embedMuonConfigInBootstrapFile({\n bootstrapPath: commandOptions.bootstrapPath,\n configPath,\n outputPath: commandOptions.outputBootstrap,\n });\n if (coreResult !== undefined && bootstrapResult !== undefined) {\n if (commandOptions.json === true) {\n console.log(\n JSON.stringify(\n {\n core: coreResult,\n bootstrap: bootstrapResult,\n },\n null,\n 2,\n ),\n );\n } else {\n console.log(`${coreResult.outputPath}\\n${bootstrapResult.outputPath}`);\n }\n return;\n }\n const result = coreResult ?? bootstrapResult;\n if (result === undefined) {\n throw new Error(\"No embed-config target was specified.\");\n }\n printEmbedConfigResult(result, commandOptions.json);\n};\n\nconst createCliCommand = (): Command => {\n const program = new Command();\n\n program\n .name(\"muon\")\n .description(\n \"Multi-platform GUI application framework that uses CEF as its backend\",\n )\n .version(`${version}-${git_commit_hash}`)\n .showSuggestionAfterError()\n .action(() => {\n program.outputHelp({ error: true });\n process.exitCode = 1;\n });\n\n program\n .command(\"build\")\n .description(\"Build CEF-free Muon app distribution directories\")\n .option(\n \"--target <target>\",\n \"target alias or comma-separated target aliases\",\n appendTargetValues,\n [],\n )\n .option(\"--all\", \"build all supported targets\")\n .option(\"--assets <path>\", \"asset root path\")\n .option(\"--config <path>\", \"muon config path\")\n .option(\"--out-dir <path>\", \"output root directory\")\n .option(\"--name <name>\", \"launcher file name\")\n .option(\"--json\", \"write result as JSON\")\n .action(async (options: BuildCommandOptions) => {\n await runBuildCommand(options);\n });\n\n program\n .command(\"init\")\n .description(\"Initialize Muon project helper files\")\n .action(async () => {\n await runInitCommand();\n });\n\n program\n .command(\"prepare\")\n .description(\"Prepare a Muon runtime with CEF files\")\n .requiredOption(\"--muon-path <path>\", \"Muon runtime file root\")\n .option(\"--cef-path <path>\", \"CEF file root\")\n .option(\"--stage-dir <path>\", \"prepared runtime output directory\")\n .option(\"--target <target>\", \"prepare target\")\n .option(\"--cache-dir <path>\", \"CEF artifact cache directory\")\n .option(\"--force\", \"rebuild an existing prepared runtime\")\n .option(\"-q, --quiet\", \"suppress native prepare progress messages\")\n .option(\"--json\", \"write result as JSON\")\n .action(async (options: PrepareCommandOptions) => {\n await runPrepareCommand(options);\n });\n\n program\n .command(\"embed-config\")\n .description(\"Embed muon.json into Muon runtime files\")\n .option(\"--runtime-path <path>\", \"prepared runtime directory\")\n .option(\"--core-path <path>\", \"muon-core executable path\")\n .option(\"--bootstrap-path <path>\", \"muon-bootstrap executable path\")\n .requiredOption(\"--config <path>\", \"muon config path\")\n .option(\"--output-runtime-path <path>\", \"patched runtime output directory\")\n .option(\"--output <path>\", \"patched muon-core output path\")\n .option(\"--output-bootstrap <path>\", \"patched bootstrap output path\")\n .option(\"--json\", \"write result as JSON\")\n .action(async (options: EmbedConfigCommandOptions) => {\n await runEmbedConfigCommand(options);\n });\n\n return program;\n};\n\nconst main = async (): Promise<void> => {\n try {\n await createCliCommand().parseAsync(process.argv);\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exitCode = 1;\n }\n};\n\nvoid main();\n"],"mappings":";;;;;;;;;;;;;AAKA,IAAa,UAAU;AAKvB,IAAa,kBAAkB;;;AC6C/B,IAAM,oBAAoB,UAA4B;CACpD,OAAO,MACJ,MAAM,GAAG,EACT,KAAK,UAAU,MAAM,KAAK,CAAC,EAC3B,QAAQ,UAAU,MAAM,SAAS,CAAC;AACvC;AAEA,IAAM,sBAAsB,OAAe,aAAiC;CAC1E,OAAO,CAAC,GAAG,UAAU,GAAG,iBAAiB,KAAK,CAAC;AACjD;AAEA,IAAM,8BACJ,YACS;CACT,IAAI,QAAQ,gBAAgB,KAAA,KAA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EH,QACG,QAAQ,cAAc,EACtB,YAAY,yCAAyC,EACrD,OAAO,yBAAyB,4BAA4B,EAC5D,OAAO,sBAAsB,2BAA2B,EACxD,OAAO,2BAA2B,gCAAgC,EAClE,eAAe,mBAAmB,kBAAkB,EACpD,OAAO,gCAAgC,kCAAkC,EACzE,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,6BAA6B,+BAA+B,EACnE,OAAO,UAAU,sBAAsB,EACvC,OAAO,OAAO,YAAuC;EACpD,MAAM,sBAAsB,OAAO;CACrC,CAAC;CAEH,OAAO;AACT;AAEA,IAAM,OAAO,YAA2B;CACtC,IAAI;EACF,MAAM,iBAAiB,EAAE,WAAW,QAAQ,IAAI;CAClD,SAAS,OAAO;EACd,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EACpE,QAAQ,WAAW;CACrB;AACF;AAEK,KAAK"}
1
+ {"version":3,"file":"cli.cjs","names":[],"sources":["../src/dev.ts","../src/generated/packageMetadata.ts","../src/cli.ts"],"sourcesContent":["// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon\n\nimport { spawn } from \"node:child_process\";\nimport { constants } from \"node:fs\";\nimport { access, mkdir, readFile, stat, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\n\nimport { parse } from \"json5\";\nimport type { UserConfig } from \"vite\";\n\nimport { ensureMuonGitignoreEntry } from \"./gitignore.js\";\nimport { getDefaultMuonPrepareTarget, runMuonPrepare } from \"./prepare.js\";\nimport {\n getMuonExecutablePath,\n resolveMuonRuntimePath,\n} from \"./vite-internals.js\";\nimport {\n flattenVitePluginOptions,\n getMuonVitePluginOptions,\n} from \"./vite-options.js\";\nimport type { MuonVitePluginOptions } from \"./vite.js\";\n\nconst muonRecycleExitCode = 88;\n\ntype JsonObject = Record<string, unknown>;\n\ninterface LoadedViteMuonOptions {\n root: string;\n pluginOptions: MuonVitePluginOptions | undefined;\n}\n\ninterface ProjectConfigResolution {\n configPath: string | undefined;\n config: JsonObject | undefined;\n}\n\ninterface MuonDevOverrideConfig {\n asset?: {\n sourcePath: string;\n };\n cdp?: {\n enable: true;\n };\n browser?: {\n keybind: {\n devtools: \"f12\";\n recycle: \"ctrl+f12\";\n };\n };\n}\n\n/**\n * Options for launching Muon directly against local development assets.\n */\nexport interface MuonDevOptions {\n /**\n * Directory used as the project root.\n */\n root?: string;\n\n /**\n * Directory containing muon-core runtime files such as muon-core and plugins.\n */\n muonPath?: string;\n\n /**\n * Directory containing CEF files, or a CEF archive root with Release/Resources.\n */\n cefPath?: string;\n\n /**\n * Runtime staging directory used for development startup.\n */\n stagePath?: string;\n\n /**\n * Muon config path passed before the generated development override.\n */\n configPath?: string;\n\n /**\n * Local development asset directory.\n */\n assetSourcePath?: string;\n\n /**\n * Enable the Muon debugger defaults during development startup.\n */\n enableDebugger?: boolean;\n\n /**\n * Platform used for runtime target resolution.\n *\n * @remarks This is injectable for tests. Production code uses process.platform.\n */\n platform?: NodeJS.Platform;\n\n /**\n * Architecture used for runtime target resolution.\n *\n * @remarks This is injectable for tests. Production code uses process.arch.\n */\n architecture?: NodeJS.Architecture;\n\n /**\n * Environment used for child processes.\n */\n environment?: NodeJS.ProcessEnv;\n\n /**\n * Suppress native prepare progress messages.\n */\n quietPrepare?: boolean;\n}\n\n/**\n * Result returned after the Muon development process exits.\n */\nexport interface MuonDevResult {\n /**\n * Absolute project root used for development startup.\n */\n root: string;\n\n /**\n * Muon runtime target used for prepare.\n */\n target: string;\n\n /**\n * Directory containing muon-core files used as the staging source.\n */\n muonPath: string;\n\n /**\n * Directory or cached archive containing CEF files used as the staging source.\n */\n cefPath: string;\n\n /**\n * Directory containing the prepared Muon runtime.\n */\n stagePath: string;\n\n /**\n * Prepared muon-core executable path.\n */\n muonExecutablePath: string;\n\n /**\n * Project config path passed before the generated development override.\n */\n projectConfigPath?: string;\n\n /**\n * Generated development override config path.\n */\n overrideConfigPath: string;\n\n /**\n * Effective local asset source path.\n */\n assetSourcePath: string;\n\n /**\n * Exit code returned by the Muon process.\n */\n exitCode: number;\n}\n\nconst defaultProjectConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\n\nconst resolveFromRoot = (root: string, path: string): string =>\n isAbsolute(path) ? path : resolve(root, path);\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n const stats = await stat(path);\n return stats.isFile();\n } catch {\n return false;\n }\n};\n\nconst directoryExists = async (path: string): Promise<boolean> => {\n try {\n const stats = await stat(path);\n return stats.isDirectory();\n } catch {\n return false;\n }\n};\n\nconst isMissingVitePackageError = (error: unknown): boolean => {\n const candidate = error as { code?: unknown; message?: unknown };\n return (\n candidate.code === \"ERR_MODULE_NOT_FOUND\" &&\n typeof candidate.message === \"string\" &&\n candidate.message.includes(\"vite\")\n );\n};\n\nconst loadViteMuonOptions = async (\n cwd: string,\n): Promise<LoadedViteMuonOptions> => {\n let vite: typeof import(\"vite\");\n try {\n vite = await import(\"vite\");\n } catch (error) {\n if (isMissingVitePackageError(error)) {\n return {\n root: resolve(cwd),\n pluginOptions: undefined,\n };\n }\n throw error;\n }\n\n const loaded = await vite.loadConfigFromFile(\n {\n command: \"serve\",\n mode: \"development\",\n isPreview: false,\n isSsrBuild: false,\n },\n undefined,\n cwd,\n \"silent\",\n );\n if (loaded === null) {\n return {\n root: resolve(cwd),\n pluginOptions: undefined,\n };\n }\n\n const config = loaded.config as UserConfig;\n const root =\n typeof config.root === \"string\" ? resolve(cwd, config.root) : resolve(cwd);\n const plugins = await flattenVitePluginOptions(config.plugins);\n const muonPlugins = plugins\n .map((plugin) => getMuonVitePluginOptions(plugin))\n .filter(\n (pluginOptions): pluginOptions is MuonVitePluginOptions =>\n pluginOptions !== undefined,\n );\n\n if (muonPlugins.length > 1) {\n throw new Error(\n \"Multiple muon() plugin definitions were found in vite.config.*.\",\n );\n }\n\n return {\n root,\n pluginOptions: muonPlugins[0],\n };\n};\n\nconst resolveProjectConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolveFromRoot(root, configPath);\n if (!(await fileExists(resolvedPath))) {\n throw new Error(`Muon config file does not exist: ${resolvedPath}`);\n }\n return resolvedPath;\n }\n\n for (const fileName of defaultProjectConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n\n return undefined;\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n let content: string;\n try {\n content = await readFile(filePath, \"utf8\");\n } catch (error) {\n throw new Error(\n `${label} could not be read: ${filePath}: ${getErrorMessage(error)}`,\n );\n }\n\n let parsed: unknown;\n try {\n parsed = parse(content);\n } catch (error) {\n throw new Error(\n `${label} could not be parsed: ${filePath}: ${getErrorMessage(error)}`,\n );\n }\n\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n\n return parsed;\n};\n\nconst resolveProjectConfig = async (\n root: string,\n configPath: string | undefined,\n): Promise<ProjectConfigResolution> => {\n const resolvedConfigPath = await resolveProjectConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n configPath: undefined,\n config: undefined,\n };\n }\n\n return {\n configPath: resolvedConfigPath,\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config\"),\n };\n};\n\nconst readConfigAssetSourcePath = (\n config: JsonObject | undefined,\n): string | undefined => {\n if (config === undefined) {\n return undefined;\n }\n\n const asset = config.asset;\n if (asset === undefined) {\n return undefined;\n }\n if (!isJsonObject(asset)) {\n throw new Error(\"muon config asset must be an object when present.\");\n }\n\n const sourcePath = asset.sourcePath;\n if (sourcePath === undefined) {\n return undefined;\n }\n if (typeof sourcePath !== \"string\") {\n throw new Error(\"muon config asset.sourcePath must be a string.\");\n }\n if (sourcePath.trim().length === 0) {\n throw new Error(\"muon config asset.sourcePath must not be empty.\");\n }\n return sourcePath;\n};\n\nconst assertDevelopmentAssetDirectory = async (\n assetSourcePath: string,\n): Promise<void> => {\n if (await directoryExists(assetSourcePath)) {\n return;\n }\n\n try {\n await access(assetSourcePath, constants.F_OK);\n } catch {\n throw new Error(`Muon dev asset source does not exist: ${assetSourcePath}`);\n }\n\n throw new Error(\n `Muon dev asset source must be a directory: ${assetSourcePath}`,\n );\n};\n\nconst resolveAssetSource = async (\n root: string,\n assetSourcePath: string | undefined,\n projectConfig: ProjectConfigResolution,\n): Promise<{\n assetSourcePath: string;\n overrideAssetSourcePath: string | undefined;\n}> => {\n const configuredAssetSourcePath = readConfigAssetSourcePath(\n projectConfig.config,\n );\n if (assetSourcePath !== undefined) {\n const resolvedPath = resolveFromRoot(root, assetSourcePath);\n await assertDevelopmentAssetDirectory(resolvedPath);\n return {\n assetSourcePath: resolvedPath,\n overrideAssetSourcePath: resolvedPath,\n };\n }\n\n if (\n configuredAssetSourcePath !== undefined &&\n projectConfig.configPath !== undefined\n ) {\n return {\n assetSourcePath: resolve(\n dirname(projectConfig.configPath),\n configuredAssetSourcePath,\n ),\n overrideAssetSourcePath: undefined,\n };\n }\n\n const defaultAssetSourcePath = resolve(root, \"assets\");\n await assertDevelopmentAssetDirectory(defaultAssetSourcePath);\n return {\n assetSourcePath: defaultAssetSourcePath,\n overrideAssetSourcePath: defaultAssetSourcePath,\n };\n};\n\nconst createMuonDevOverrideConfig = (\n assetSourcePath: string | undefined,\n enableDebugger: boolean,\n): MuonDevOverrideConfig => ({\n ...(assetSourcePath === undefined\n ? {}\n : {\n asset: {\n sourcePath: assetSourcePath,\n },\n }),\n ...(enableDebugger\n ? {\n cdp: {\n enable: true,\n },\n browser: {\n keybind: {\n devtools: \"f12\",\n recycle: \"ctrl+f12\",\n },\n },\n }\n : {}),\n});\n\nconst writeMuonDevOverrideConfig = async (\n overrideConfigPath: string,\n overrideConfig: MuonDevOverrideConfig,\n): Promise<void> => {\n await mkdir(dirname(overrideConfigPath), { recursive: true });\n await writeFile(\n overrideConfigPath,\n `${JSON.stringify(overrideConfig, null, 2)}\\n`,\n );\n};\n\nconst runMuonExecutable = async (\n muonExecutablePath: string,\n configPaths: readonly string[],\n environment: NodeJS.ProcessEnv,\n): Promise<number> => {\n const args = configPaths.flatMap((configPath) => [\"-c\", configPath]);\n let exitCode = 0;\n do {\n const child = spawn(muonExecutablePath, args, {\n cwd: dirname(muonExecutablePath),\n env: environment,\n stdio: [\"ignore\", \"inherit\", \"inherit\"],\n });\n\n exitCode = await new Promise<number>((resolvePromise, reject) => {\n child.once(\"error\", reject);\n child.once(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n } while (exitCode === muonRecycleExitCode);\n return exitCode;\n};\n\n/**\n * Launches Muon directly against local development assets.\n *\n * @param options Development startup options.\n * @returns Development startup result after the Muon process exits.\n */\nexport const runMuonDev = async (\n options: MuonDevOptions = {},\n): Promise<MuonDevResult> => {\n const cwd = resolve(options.root ?? process.cwd());\n const loadedViteOptions = await loadViteMuonOptions(cwd);\n const root = loadedViteOptions.root;\n const pluginOptions = loadedViteOptions.pluginOptions;\n const platform = options.platform ?? process.platform;\n const architecture = options.architecture ?? process.arch;\n const environment = options.environment ?? process.env;\n const target = getDefaultMuonPrepareTarget(platform, architecture);\n const muonPath = resolveMuonRuntimePath({\n root,\n target,\n muonPath: options.muonPath ?? pluginOptions?.muonPath,\n });\n const cefPath =\n options.cefPath !== undefined\n ? resolveFromRoot(root, options.cefPath)\n : pluginOptions?.cefPath === undefined\n ? undefined\n : resolveFromRoot(root, pluginOptions.cefPath);\n const stagePath =\n options.stagePath !== undefined\n ? resolveFromRoot(root, options.stagePath)\n : pluginOptions?.stagePath === undefined\n ? resolve(root, \".muon\", target)\n : resolveFromRoot(root, pluginOptions.stagePath);\n const enableDebugger =\n options.enableDebugger ?? pluginOptions?.enableDebugger ?? true;\n const projectConfig = await resolveProjectConfig(root, options.configPath);\n const asset = await resolveAssetSource(\n root,\n options.assetSourcePath,\n projectConfig,\n );\n const overrideConfigPath = join(root, \".muon\", \"dev\", \"muon.dev.json\");\n\n await ensureMuonGitignoreEntry(root);\n\n const preparedRuntime = await runMuonPrepare({\n muonPath,\n cefPath,\n stageDir: stagePath,\n target,\n cacheDir: environment.MUON_CACHE_DIR,\n force: false,\n quiet: options.quietPrepare === true,\n prepareExecutablePath: undefined,\n environment,\n cwd: root,\n });\n if (preparedRuntime.stagePath === undefined) {\n throw new Error(\"muon-prepare did not return a staged runtime path.\");\n }\n\n await writeMuonDevOverrideConfig(\n overrideConfigPath,\n createMuonDevOverrideConfig(asset.overrideAssetSourcePath, enableDebugger),\n );\n const muonExecutablePath = getMuonExecutablePath(\n preparedRuntime.stagePath,\n platform,\n );\n const configPaths = [\n ...(projectConfig.configPath === undefined\n ? []\n : [projectConfig.configPath]),\n overrideConfigPath,\n ];\n const exitCode = await runMuonExecutable(\n muonExecutablePath,\n configPaths,\n environment,\n );\n\n return {\n root,\n target,\n muonPath: preparedRuntime.muonPath,\n cefPath: preparedRuntime.cefPath,\n stagePath: preparedRuntime.stagePath,\n muonExecutablePath,\n ...(projectConfig.configPath === undefined\n ? {}\n : { projectConfigPath: projectConfig.configPath }),\n overrideConfigPath,\n assetSourcePath: asset.assetSourcePath,\n exitCode,\n };\n};\n","// @ts-nocheck\n// This file is auto-generated by screw-up plugin\n// Do not edit manually\n\nexport const name = \"muon-ui\";\nexport const version = \"0.5.0\";\nexport const description = \"A multi-platform GUI application framework that uses CEF as its backend\";\nexport const author = \"Kouji Matsui (@kekyo@mi.kekyo.net)\";\nexport const license = \"MIT\";\nexport const repository_url = \"https://github.com/kekyo/muon-ui.git\";\nexport const git_commit_hash = \"122830dc7b35ced0c4c88c91d3a9dd8b3dee18e2\";\n","#!/usr/bin/env node\n// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon\n\nimport { Command } from \"commander\";\n\nimport {\n getDefaultMuonPrepareTarget,\n runMuonPrepare,\n type MuonPrepareOptions,\n} from \"./prepare.js\";\nimport { ensureMuonGitignoreEntry } from \"./gitignore.js\";\nimport {\n embedMuonConfigInBootstrapFile,\n embedMuonConfigInCoreFile,\n embedMuonConfigInRuntime,\n type EmbedMuonConfigResult,\n} from \"./embed-config.js\";\nimport { buildMuonApp, type MuonBuildOptions } from \"./build.js\";\nimport { runMuonDev, type MuonDevOptions } from \"./dev.js\";\nimport { git_commit_hash, version } from \"./generated/packageMetadata.js\";\n\ninterface PrepareCommandOptions {\n muonPath: string | undefined;\n cefPath: string | undefined;\n stageDir: string | undefined;\n target: string | undefined;\n cacheDir: string | undefined;\n force: boolean | undefined;\n quiet: boolean | undefined;\n json: boolean | undefined;\n}\n\ninterface EmbedConfigCommandOptions {\n runtimePath: string | undefined;\n corePath: string | undefined;\n bootstrapPath: string | undefined;\n config: string | undefined;\n outputRuntimePath: string | undefined;\n output: string | undefined;\n outputBootstrap: string | undefined;\n json: boolean | undefined;\n}\n\ninterface BuildCommandOptions {\n target: string[];\n all: boolean | undefined;\n assets: string | undefined;\n config: string | undefined;\n outDir: string | undefined;\n name: string | undefined;\n json: boolean | undefined;\n}\n\ninterface DevCommandOptions {\n muonPath: string | undefined;\n cefPath: string | undefined;\n stageDir: string | undefined;\n config: string | undefined;\n assets: string | undefined;\n debugger: boolean | undefined;\n json: boolean | undefined;\n}\n\nconst readTargetValues = (value: string): string[] => {\n return value\n .split(\",\")\n .map((value) => value.trim())\n .filter((value) => value.length > 0);\n};\n\nconst appendTargetValues = (value: string, previous: string[]): string[] => {\n return [...previous, ...readTargetValues(value)];\n};\n\nconst validateEmbedConfigOptions = (\n options: EmbedConfigCommandOptions,\n): void => {\n if (options.runtimePath !== undefined && options.corePath !== undefined) {\n throw new Error(\"Specify at most one of --runtime-path or --core-path.\");\n }\n if (\n options.runtimePath === undefined &&\n options.corePath === undefined &&\n options.bootstrapPath === undefined\n ) {\n throw new Error(\n \"Specify at least one of --runtime-path, --core-path, or --bootstrap-path.\",\n );\n }\n if (\n options.corePath !== undefined &&\n options.outputRuntimePath !== undefined\n ) {\n throw new Error(\"--output-runtime-path requires --runtime-path.\");\n }\n if (options.runtimePath !== undefined && options.output !== undefined) {\n throw new Error(\"--output requires --core-path.\");\n }\n if (\n options.bootstrapPath === undefined &&\n options.outputBootstrap !== undefined\n ) {\n throw new Error(\"--output-bootstrap requires --bootstrap-path.\");\n }\n};\n\nconst runBuildCommand = async (\n commandOptions: BuildCommandOptions,\n): Promise<void> => {\n const targets = commandOptions.target;\n if (commandOptions.all === true && targets.length > 0) {\n throw new Error(\"Specify either --all or --target, not both.\");\n }\n\n const buildOptions: MuonBuildOptions = {\n root: process.cwd(),\n allTargets: commandOptions.all === true,\n };\n\n if (targets.length > 0) {\n buildOptions.targets = targets;\n }\n if (commandOptions.assets !== undefined) {\n buildOptions.assetSourcePath = commandOptions.assets;\n }\n if (commandOptions.config !== undefined) {\n buildOptions.configPath = commandOptions.config;\n }\n if (commandOptions.outDir !== undefined) {\n buildOptions.outputRoot = commandOptions.outDir;\n }\n if (commandOptions.name !== undefined) {\n buildOptions.appName = commandOptions.name;\n }\n\n const result = await buildMuonApp(buildOptions);\n if (commandOptions.json === true) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n for (const target of result.targets) {\n console.log(target.outputPath);\n }\n }\n};\n\nconst runPrepareCommand = async (\n commandOptions: PrepareCommandOptions,\n): Promise<void> => {\n const prepareOptions: MuonPrepareOptions = {\n muonPath: commandOptions.muonPath ?? \"\",\n cefPath: commandOptions.cefPath,\n stageDir: commandOptions.stageDir,\n target:\n commandOptions.target ??\n getDefaultMuonPrepareTarget(process.platform, process.arch),\n cacheDir: commandOptions.cacheDir,\n force: commandOptions.force === true,\n quiet: commandOptions.quiet === true,\n prepareExecutablePath: undefined,\n environment: process.env,\n cwd: process.cwd(),\n };\n const result = await runMuonPrepare(prepareOptions);\n if (commandOptions.json === true) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(result.stagePath ?? result.cefPath);\n }\n};\n\nconst runDevCommand = async (\n commandOptions: DevCommandOptions,\n command: Command,\n): Promise<void> => {\n const devOptions: MuonDevOptions = {\n root: process.cwd(),\n environment: process.env,\n quietPrepare: commandOptions.json === true,\n };\n\n if (commandOptions.muonPath !== undefined) {\n devOptions.muonPath = commandOptions.muonPath;\n }\n if (commandOptions.cefPath !== undefined) {\n devOptions.cefPath = commandOptions.cefPath;\n }\n if (commandOptions.stageDir !== undefined) {\n devOptions.stagePath = commandOptions.stageDir;\n }\n if (commandOptions.config !== undefined) {\n devOptions.configPath = commandOptions.config;\n }\n if (commandOptions.assets !== undefined) {\n devOptions.assetSourcePath = commandOptions.assets;\n }\n if (command.getOptionValueSource(\"debugger\") === \"cli\") {\n devOptions.enableDebugger = commandOptions.debugger === true;\n }\n\n const result = await runMuonDev(devOptions);\n if (commandOptions.json === true) {\n console.log(JSON.stringify(result, null, 2));\n }\n if (result.exitCode !== 0) {\n process.exitCode = result.exitCode;\n }\n};\n\nconst runInitCommand = async (): Promise<void> => {\n const result = await ensureMuonGitignoreEntry(process.cwd());\n console.log(\n result.changed ? `Updated ${result.gitignorePath}` : result.gitignorePath,\n );\n};\n\nconst printEmbedConfigResult = (\n result: EmbedMuonConfigResult,\n json: boolean | undefined,\n): void => {\n if (json === true) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(result.outputPath);\n }\n};\n\nconst runEmbedConfigCommand = async (\n commandOptions: EmbedConfigCommandOptions,\n): Promise<void> => {\n validateEmbedConfigOptions(commandOptions);\n const configPath = commandOptions.config ?? \"\";\n const coreResult =\n commandOptions.corePath !== undefined\n ? await embedMuonConfigInCoreFile({\n corePath: commandOptions.corePath,\n configPath,\n outputPath: commandOptions.output,\n })\n : commandOptions.runtimePath !== undefined\n ? await embedMuonConfigInRuntime({\n runtimePath: commandOptions.runtimePath,\n configPath,\n outputRuntimePath: commandOptions.outputRuntimePath,\n })\n : undefined;\n const bootstrapResult =\n commandOptions.bootstrapPath === undefined\n ? undefined\n : await embedMuonConfigInBootstrapFile({\n bootstrapPath: commandOptions.bootstrapPath,\n configPath,\n outputPath: commandOptions.outputBootstrap,\n });\n if (coreResult !== undefined && bootstrapResult !== undefined) {\n if (commandOptions.json === true) {\n console.log(\n JSON.stringify(\n {\n core: coreResult,\n bootstrap: bootstrapResult,\n },\n null,\n 2,\n ),\n );\n } else {\n console.log(`${coreResult.outputPath}\\n${bootstrapResult.outputPath}`);\n }\n return;\n }\n const result = coreResult ?? bootstrapResult;\n if (result === undefined) {\n throw new Error(\"No embed-config target was specified.\");\n }\n printEmbedConfigResult(result, commandOptions.json);\n};\n\nconst createCliCommand = (): Command => {\n const program = new Command();\n\n program\n .name(\"muon\")\n .description(\n \"Multi-platform GUI application framework that uses CEF as its backend\",\n )\n .version(`${version}-${git_commit_hash}`)\n .showSuggestionAfterError()\n .action(() => {\n program.outputHelp({ error: true });\n process.exitCode = 1;\n });\n\n program\n .command(\"build\")\n .description(\"Build CEF-free Muon app distribution directories\")\n .option(\n \"--target <target>\",\n \"target alias or comma-separated target aliases\",\n appendTargetValues,\n [],\n )\n .option(\"--all\", \"build all supported targets\")\n .option(\"--assets <path>\", \"asset root path\")\n .option(\"--config <path>\", \"muon config path\")\n .option(\"--out-dir <path>\", \"output root directory\")\n .option(\"--name <name>\", \"launcher file name\")\n .option(\"--json\", \"write result as JSON\")\n .action(async (options: BuildCommandOptions) => {\n await runBuildCommand(options);\n });\n\n const devCommand = program\n .command(\"dev\")\n .description(\"Launch Muon directly with local development assets\")\n .option(\"--muon-path <path>\", \"Muon runtime file root\")\n .option(\"--cef-path <path>\", \"CEF file root\")\n .option(\"--stage-dir <path>\", \"prepared runtime output directory\")\n .option(\"--config <path>\", \"muon config path\")\n .option(\"--assets <path>\", \"development asset directory\")\n .option(\"--no-debugger\", \"disable Muon debugger defaults\")\n .option(\"--json\", \"write result as JSON\")\n .action(async (options: DevCommandOptions) => {\n await runDevCommand(options, devCommand);\n });\n\n program\n .command(\"init\")\n .description(\"Initialize Muon project helper files\")\n .action(async () => {\n await runInitCommand();\n });\n\n program\n .command(\"prepare\")\n .description(\"Prepare a Muon runtime with CEF files\")\n .requiredOption(\"--muon-path <path>\", \"Muon runtime file root\")\n .option(\"--cef-path <path>\", \"CEF file root\")\n .option(\"--stage-dir <path>\", \"prepared runtime output directory\")\n .option(\"--target <target>\", \"prepare target\")\n .option(\"--cache-dir <path>\", \"CEF artifact cache directory\")\n .option(\"--force\", \"rebuild an existing prepared runtime\")\n .option(\"-q, --quiet\", \"suppress native prepare progress messages\")\n .option(\"--json\", \"write result as JSON\")\n .action(async (options: PrepareCommandOptions) => {\n await runPrepareCommand(options);\n });\n\n program\n .command(\"embed-config\")\n .description(\"Embed muon.json into Muon runtime files\")\n .option(\"--runtime-path <path>\", \"prepared runtime directory\")\n .option(\"--core-path <path>\", \"muon-core executable path\")\n .option(\"--bootstrap-path <path>\", \"muon-bootstrap executable path\")\n .requiredOption(\"--config <path>\", \"muon config path\")\n .option(\"--output-runtime-path <path>\", \"patched runtime output directory\")\n .option(\"--output <path>\", \"patched muon-core output path\")\n .option(\"--output-bootstrap <path>\", \"patched bootstrap output path\")\n .option(\"--json\", \"write result as JSON\")\n .action(async (options: EmbedConfigCommandOptions) => {\n await runEmbedConfigCommand(options);\n });\n\n return program;\n};\n\nconst main = async (): Promise<void> => {\n try {\n await createCliCommand().parseAsync(process.argv);\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exitCode = 1;\n }\n};\n\nvoid main();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,IAAM,sBAAsB;AAoJ5B,IAAM,gCAAgC;CAAC;CAAc;CAAc;AAAW;AAE9E,IAAM,mBAAmB,MAAc,UAAA,GAAA,UAAA,YAC1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EAC3D,OAAO,WAAW,sCAAsC,EACxD,OAAO,eAAe,2CAA2C,EACjE,OAAO,UAAU,sBAAsB,EACvC,OAAO,OAAO,YAAmC;EAChD,MAAM,kBAAkB,OAAO;CACjC,CAAC;CAEH,QACG,QAAQ,cAAc,EACtB,YAAY,yCAAyC,EACrD,OAAO,yBAAyB,4BAA4B,EAC5D,OAAO,sBAAsB,2BAA2B,EACxD,OAAO,2BAA2B,gCAAgC,EAClE,eAAe,mBAAmB,kBAAkB,EACpD,OAAO,gCAAgC,kCAAkC,EACzE,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,6BAA6B,+BAA+B,EACnE,OAAO,UAAU,sBAAsB,EACvC,OAAO,OAAO,YAAuC;EACpD,MAAM,sBAAsB,OAAO;CACrC,CAAC;CAEH,OAAO;AACT;AAEA,IAAM,OAAO,YAA2B;CACtC,IAAI;EACF,MAAM,iBAAiB,EAAE,WAAW,QAAQ,IAAI;CAClD,SAAS,OAAO;EACd,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EACpE,QAAQ,WAAW;CACrB;AACF;AAEK,KAAK"}
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * name: muon-ui
3
- * version: 0.3.0
3
+ * version: 0.5.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: e3c2c87d50dddb0bf6c2b4d5ebf0a37ab2d3b433
8
+ * git.commit.hash: 122830dc7b35ced0c4c88c91d3a9dd8b3dee18e2
9
9
  */
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * name: muon-ui
3
- * version: 0.3.0
3
+ * version: 0.5.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: e3c2c87d50dddb0bf6c2b4d5ebf0a37ab2d3b433
8
+ * git.commit.hash: 122830dc7b35ced0c4c88c91d3a9dd8b3dee18e2
9
9
  */
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file