muon-ui 0.17.0 → 0.19.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 (38) hide show
  1. package/dist/cli.cjs +35 -16
  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-builder +0 -0
  6. package/dist/native/linux-amd64/muon-launcher +0 -0
  7. package/dist/native/linux-amd64/muon-runtime-helper +0 -0
  8. package/dist/native/linux-arm64/muon-builder +0 -0
  9. package/dist/native/linux-arm64/muon-launcher +0 -0
  10. package/dist/native/linux-arm64/muon-runtime-helper +0 -0
  11. package/dist/native/linux-armhf/muon-builder +0 -0
  12. package/dist/native/linux-armhf/muon-launcher +0 -0
  13. package/dist/native/linux-armhf/muon-runtime-helper +0 -0
  14. package/dist/native/windows-amd64/muon-builder.exe +0 -0
  15. package/dist/native/windows-amd64/muon-launcher.exe +0 -0
  16. package/dist/native/windows-amd64/muon-plugin-inspector.exe +0 -0
  17. package/dist/native/windows-i686/muon-builder.exe +0 -0
  18. package/dist/native/windows-i686/muon-launcher.exe +0 -0
  19. package/dist/native/windows-i686/muon-plugin-inspector.exe +0 -0
  20. package/dist/runtime/linux-amd64/muon-core +0 -0
  21. package/dist/runtime/linux-arm64/muon-core +0 -0
  22. package/dist/runtime/linux-armhf/muon-core +0 -0
  23. package/dist/runtime/windows-amd64/libcardio.dll +0 -0
  24. package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
  25. package/dist/runtime/windows-amd64/muon-core.exe +0 -0
  26. package/dist/runtime/windows-i686/libcardio.dll +0 -0
  27. package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
  28. package/dist/runtime/windows-i686/muon-core.exe +0 -0
  29. package/dist/{vite-internals-BOAXlmwz.cjs → vite-internals-BqnOn7M6.cjs} +18 -12
  30. package/dist/{vite-internals-BOAXlmwz.cjs.map → vite-internals-BqnOn7M6.cjs.map} +1 -1
  31. package/dist/vite.cjs +6 -3
  32. package/dist/vite.cjs.map +1 -1
  33. package/dist/vite.mjs +11 -7
  34. package/dist/vite.mjs.map +1 -1
  35. package/muon-virtual-modules.d.ts +5 -0
  36. package/muon.d.ts +6 -0
  37. package/package.json +7 -7
  38. package/vite.d.ts +32 -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.17.0
4
+ * version: 0.19.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: 1092f3c406f2ebfe9f5938ec51b70bea9f84a6ca
9
+ * git.commit.hash: 7b7fb7ea982e11163531485618fa27453d547280
10
10
  */
11
- const require_vite_internals = require("./vite-internals-BOAXlmwz.cjs");
11
+ const require_vite_internals = require("./vite-internals-BqnOn7M6.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");
@@ -46,6 +46,7 @@ var isMissingVitePackageError = (error) => {
46
46
  const candidate = error;
47
47
  return candidate.code === "ERR_MODULE_NOT_FOUND" && typeof candidate.message === "string" && candidate.message.includes("vite");
48
48
  };
49
+ var hasViteServerProxyConfiguration = (proxy) => typeof proxy === "object" && proxy !== null && Object.keys(proxy).length > 0;
49
50
  var loadViteMuonOptions = async (cwd) => {
50
51
  let vite;
51
52
  try {
@@ -53,7 +54,8 @@ var loadViteMuonOptions = async (cwd) => {
53
54
  } catch (error) {
54
55
  if (isMissingVitePackageError(error)) return {
55
56
  root: (0, node_path.resolve)(cwd),
56
- pluginOptions: void 0
57
+ pluginOptions: void 0,
58
+ viteServerProxyConfigured: false
57
59
  };
58
60
  throw error;
59
61
  }
@@ -65,7 +67,8 @@ var loadViteMuonOptions = async (cwd) => {
65
67
  }, void 0, cwd, "silent");
66
68
  if (loaded === null) return {
67
69
  root: (0, node_path.resolve)(cwd),
68
- pluginOptions: void 0
70
+ pluginOptions: void 0,
71
+ viteServerProxyConfigured: false
69
72
  };
70
73
  const config = loaded.config;
71
74
  const root = typeof config.root === "string" ? (0, node_path.resolve)(cwd, config.root) : (0, node_path.resolve)(cwd);
@@ -73,7 +76,8 @@ var loadViteMuonOptions = async (cwd) => {
73
76
  if (muonPlugins.length > 1) throw new Error("Multiple muon() plugin definitions were found in vite.config.*.");
74
77
  return {
75
78
  root,
76
- pluginOptions: muonPlugins[0]
79
+ pluginOptions: muonPlugins[0],
80
+ viteServerProxyConfigured: hasViteServerProxyConfiguration(config.server?.proxy)
77
81
  };
78
82
  };
79
83
  var getRuntimePluginConfigFromViteBuild = async (root) => {
@@ -129,7 +133,8 @@ var prepareViteRunAssets = async (cwd) => {
129
133
  configPath: buildOptions.configPath,
130
134
  assetSourcePath,
131
135
  browserStartPage: packagedAssetOptions.browserStartPage,
132
- runtimePluginConfig
136
+ runtimePluginConfig,
137
+ viteServerProxyConfigured: project.viteServerProxyConfigured
133
138
  };
134
139
  };
135
140
  var resolveProjectConfigPath = async (root, configPath) => {
@@ -235,8 +240,8 @@ var writeMuonDevOverrideConfig = async (overrideConfigPath, overrideConfig) => {
235
240
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(overrideConfigPath), { recursive: true });
236
241
  await (0, node_fs_promises.writeFile)(overrideConfigPath, `${JSON.stringify(overrideConfig, null, 2)}\n`);
237
242
  };
238
- var runMuonExecutable = async (muonExecutablePath, configPaths, environment) => {
239
- const child = (0, node_child_process.spawn)(muonExecutablePath, configPaths.flatMap((configPath) => ["-c", configPath]), {
243
+ var runMuonExecutable = async (muonExecutablePath, configPaths, allowInsecureLocalhost, environment) => {
244
+ const child = (0, node_child_process.spawn)(muonExecutablePath, [...configPaths.flatMap((configPath) => ["-c", configPath]), ...allowInsecureLocalhost ? ["--allow-insecure-localhost"] : []], {
240
245
  cwd: (0, node_path.dirname)(muonExecutablePath),
241
246
  env: environment,
242
247
  stdio: [
@@ -252,12 +257,14 @@ var runMuonExecutable = async (muonExecutablePath, configPaths, environment) =>
252
257
  });
253
258
  });
254
259
  };
255
- var runMuonDevOnce = async (options, cwd) => {
260
+ var runMuonDevOnce = async (options, cwd, reportViteServerProxyWarning) => {
256
261
  const preparedViteAssets = options.assetSourcePath === void 0 ? await prepareViteRunAssets(cwd) : void 0;
257
262
  const loadedViteOptions = preparedViteAssets === void 0 ? await loadViteMuonOptions(cwd) : {
258
263
  root: preparedViteAssets.root,
259
- pluginOptions: preparedViteAssets.pluginOptions
264
+ pluginOptions: preparedViteAssets.pluginOptions,
265
+ viteServerProxyConfigured: preparedViteAssets.viteServerProxyConfigured
260
266
  };
267
+ if (loadedViteOptions.viteServerProxyConfigured) reportViteServerProxyWarning();
261
268
  const root = loadedViteOptions.root;
262
269
  const pluginOptions = loadedViteOptions.pluginOptions;
263
270
  const platform = options.platform ?? process.platform;
@@ -272,6 +279,7 @@ var runMuonDevOnce = async (options, cwd) => {
272
279
  const cefPath = options.cefPath !== void 0 ? resolveFromRoot(root, options.cefPath) : pluginOptions?.cefPath === void 0 ? void 0 : resolveFromRoot(root, pluginOptions.cefPath);
273
280
  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);
274
281
  const enableDebugger = options.enableDebugger ?? pluginOptions?.enableDebugger ?? true;
282
+ const allowInsecureLocalhost = options.allowInsecureLocalhost ?? pluginOptions?.allowInsecureLocalhost ?? false;
275
283
  const projectConfig = await resolveProjectConfig(root, options.configPath ?? preparedViteAssets?.configPath);
276
284
  const asset = preparedViteAssets === void 0 ? await resolveAssetSource(root, options.assetSourcePath, projectConfig) : {
277
285
  assetSourcePath: preparedViteAssets.assetSourcePath,
@@ -295,7 +303,7 @@ var runMuonDevOnce = async (options, cwd) => {
295
303
  if (preparedRuntime.stagePath === void 0) throw new Error("muon-builder did not return a staged runtime path.");
296
304
  await writeMuonDevOverrideConfig(overrideConfigPath, createMuonDevOverrideConfig(asset.overrideAssetSourcePath, enableDebugger, browserStartPage, preparedViteAssets?.runtimePluginConfig));
297
305
  const muonExecutablePath = require_vite_internals.getMuonExecutablePath(preparedRuntime.stagePath, platform);
298
- const exitCode = await runMuonExecutable(muonExecutablePath, [...projectConfig.configPath === void 0 ? [] : [projectConfig.configPath], overrideConfigPath], environment);
306
+ const exitCode = await runMuonExecutable(muonExecutablePath, [...projectConfig.configPath === void 0 ? [] : [projectConfig.configPath], overrideConfigPath], allowInsecureLocalhost, environment);
299
307
  return {
300
308
  root,
301
309
  target,
@@ -317,9 +325,16 @@ var runMuonDevOnce = async (options, cwd) => {
317
325
  */
318
326
  var runMuonDev = async (options = {}) => {
319
327
  const cwd = (0, node_path.resolve)(options.root ?? process.cwd());
328
+ const warning = options.warning;
329
+ let viteServerProxyWarningReported = false;
330
+ const reportViteServerProxyWarning = () => {
331
+ if (viteServerProxyWarningReported) return;
332
+ warning?.("Vite server proxy configuration is only available during Vite development and is not used by muon run.");
333
+ viteServerProxyWarningReported = true;
334
+ };
320
335
  let result;
321
336
  do
322
- result = await runMuonDevOnce(options, cwd);
337
+ result = await runMuonDevOnce(options, cwd, reportViteServerProxyWarning);
323
338
  while (result.exitCode === muonRecycleExitCode);
324
339
  return result;
325
340
  };
@@ -1093,8 +1108,8 @@ var packMuonApp = async (options) => {
1093
1108
  };
1094
1109
  //#endregion
1095
1110
  //#region src/generated/packageMetadata.ts
1096
- var version = "0.17.0";
1097
- var git_commit_hash = "1092f3c406f2ebfe9f5938ec51b70bea9f84a6ca";
1111
+ var version = "0.19.0";
1112
+ var git_commit_hash = "7b7fb7ea982e11163531485618fa27453d547280";
1098
1113
  //#endregion
1099
1114
  //#region src/cli.ts
1100
1115
  var readTargetValues = (value) => {
@@ -1256,12 +1271,16 @@ var runDevCommand = async (commandOptions, command) => {
1256
1271
  environment: process.env,
1257
1272
  quietPrepare: commandOptions.json === true
1258
1273
  };
1274
+ devOptions.warning = (message) => {
1275
+ console.warn(`Warning: ${message}`);
1276
+ };
1259
1277
  if (commandOptions.muonPath !== void 0) devOptions.muonPath = commandOptions.muonPath;
1260
1278
  if (commandOptions.cefPath !== void 0) devOptions.cefPath = commandOptions.cefPath;
1261
1279
  if (commandOptions.stageDir !== void 0) devOptions.stagePath = commandOptions.stageDir;
1262
1280
  if (commandOptions.config !== void 0) devOptions.configPath = commandOptions.config;
1263
1281
  if (commandOptions.assets !== void 0) devOptions.assetSourcePath = commandOptions.assets;
1264
1282
  if (command.getOptionValueSource("debugger") === "cli") devOptions.enableDebugger = commandOptions.debugger === true;
1283
+ if (commandOptions.allowInsecureLocalhost === true) devOptions.allowInsecureLocalhost = true;
1265
1284
  const result = await runMuonDev(devOptions);
1266
1285
  if (commandOptions.json === true) console.log(JSON.stringify(result, null, 2));
1267
1286
  if (result.exitCode !== 0) process.exitCode = result.exitCode;
@@ -1315,7 +1334,7 @@ var createCliCommand = () => {
1315
1334
  program.command("pack").description("Build and package a muon app").option("--type <type>", "package type or comma-separated package types: zip, tar.gz, tgz, deb, nsis (default: all)", appendPackTypeValues).option("--target <target>", "public target, platform, arch, or comma-separated selectors", appendTargetValues, []).option("--all", "build all supported targets").option("--config <path>", "muon config path").option("--icon <path>", "static application PNG icon path").option("--windows-icon <path>", "Windows PNG icon resource path").option("--windows-product-name <name>", "Windows product name").option("--windows-file-description <text>", "Windows file description").option("--windows-company-name <name>", "Windows company name").option("--windows-version <version>", "Windows resource version").option("--windows-copyright <text>", "Windows legal copyright").option("--windows-sign-command <command>", "Windows code signing command").option("--windows-sign-arg <arg>", "Windows code signing command argument", appendWindowsSignArgValue).option("--windows-sign-target <target>", "Windows code signing target or comma-separated targets", appendWindowsSignTargetValues).option("--no-windows-code-signing", "disable muon.json Windows signing").option("--linux-desktop-id <id>", "Linux desktop entry identifier").option("--linux-name <name>", "Linux desktop display name").option("--linux-comment <text>", "Linux desktop comment").option("--linux-icon <path>", "Linux desktop PNG icon path").option("--linux-categories <list>", "Linux desktop categories").option("--linux-startup-notify <boolean>", "Linux startup notification").option("--linux-sandbox <mode>", "Linux deb CEF sandbox mode: disabled, setuid").option("--name <name>", "launcher file name").option("--app-id <id>", "stable application identifier").option("--package-directory <path>", "muon package dist directory").option("--artifacts-dir <path>", "package artifact output directory").option("--package-name <name>", "package name override").option("--package-version <version>", "package version override").option("--description <text>", "package description override").option("--author <text>", "package author override").option("--json", "write result as JSON").action(async (options, command) => {
1316
1335
  await runPackCommand(options, command);
1317
1336
  });
1318
- const devCommand = program.command("run").description("Launch muon directly with local development assets").option("--muon-path <path>", "muon runtime file root").option("--cef-path <path>", "CEF file root").option("--stage-dir <path>", "prepared runtime output directory").option("--config <path>", "muon config path").option("--assets <path>", "development asset directory").option("--no-debugger", "disable muon debugger defaults").option("--json", "write result as JSON").action(async (options) => {
1337
+ const devCommand = program.command("run").description("Launch muon directly with local development assets").option("--muon-path <path>", "muon runtime file root").option("--cef-path <path>", "CEF file root").option("--stage-dir <path>", "prepared runtime output directory").option("--config <path>", "muon config path").option("--assets <path>", "development asset directory").option("--no-debugger", "disable muon debugger defaults").option("--allow-insecure-localhost", "ignore invalid HTTPS certificates for localhost").option("--json", "write result as JSON").action(async (options) => {
1319
1338
  await runDevCommand(options, devCommand);
1320
1339
  });
1321
1340
  program.command("init").description("Initialize muon project helper files").action(async () => {