muon-ui 0.19.0 → 0.21.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 (55) hide show
  1. package/README.md +27 -21
  2. package/dist/cli.cjs +27 -11
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/index.cjs +2 -2
  5. package/dist/index.mjs +2 -2
  6. package/dist/native/linux-amd64/muon-builder +0 -0
  7. package/dist/native/linux-amd64/muon-launcher +0 -0
  8. package/dist/native/linux-amd64/muon-runtime-helper +0 -0
  9. package/dist/native/linux-arm64/muon-builder +0 -0
  10. package/dist/native/linux-arm64/muon-launcher +0 -0
  11. package/dist/native/linux-arm64/muon-runtime-helper +0 -0
  12. package/dist/native/linux-armhf/muon-builder +0 -0
  13. package/dist/native/linux-armhf/muon-launcher +0 -0
  14. package/dist/native/linux-armhf/muon-runtime-helper +0 -0
  15. package/dist/native/windows-amd64/muon-builder.exe +0 -0
  16. package/dist/native/windows-amd64/muon-launcher.exe +0 -0
  17. package/dist/native/windows-amd64/muon-plugin-inspector.exe +0 -0
  18. package/dist/native/windows-i686/muon-builder.exe +0 -0
  19. package/dist/native/windows-i686/muon-launcher.exe +0 -0
  20. package/dist/native/windows-i686/muon-plugin-inspector.exe +0 -0
  21. package/dist/runtime/linux-amd64/CREDITS.md +89 -0
  22. package/dist/runtime/linux-amd64/muon-core +0 -0
  23. package/dist/runtime/linux-amd64/plugins/node-bridge.mjs +2912 -0
  24. package/dist/runtime/linux-amd64/plugins/node.so +0 -0
  25. package/dist/runtime/linux-arm64/CREDITS.md +89 -0
  26. package/dist/runtime/linux-arm64/muon-core +0 -0
  27. package/dist/runtime/linux-arm64/plugins/node-bridge.mjs +2912 -0
  28. package/dist/runtime/linux-arm64/plugins/node.so +0 -0
  29. package/dist/runtime/linux-armhf/CREDITS.md +89 -0
  30. package/dist/runtime/linux-armhf/muon-core +0 -0
  31. package/dist/runtime/linux-armhf/plugins/node-bridge.mjs +2912 -0
  32. package/dist/runtime/linux-armhf/plugins/node.so +0 -0
  33. package/dist/runtime/windows-amd64/CREDITS.md +89 -0
  34. package/dist/runtime/windows-amd64/libcardio.dll +0 -0
  35. package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
  36. package/dist/runtime/windows-amd64/muon-core.exe +0 -0
  37. package/dist/runtime/windows-amd64/plugins/node-bridge.mjs +2912 -0
  38. package/dist/runtime/windows-amd64/plugins/node.dll +0 -0
  39. package/dist/runtime/windows-i686/CREDITS.md +89 -0
  40. package/dist/runtime/windows-i686/libcardio.dll +0 -0
  41. package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
  42. package/dist/runtime/windows-i686/muon-core.exe +0 -0
  43. package/dist/runtime/windows-i686/plugins/node-bridge.mjs +2912 -0
  44. package/dist/runtime/windows-i686/plugins/node.dll +0 -0
  45. package/dist/{vite-internals-BqnOn7M6.cjs → vite-internals-0JA6tPL0.cjs} +344 -40
  46. package/dist/vite-internals-0JA6tPL0.cjs.map +1 -0
  47. package/dist/vite.cjs +16 -3
  48. package/dist/vite.cjs.map +1 -1
  49. package/dist/vite.mjs +276 -31
  50. package/dist/vite.mjs.map +1 -1
  51. package/muon-virtual-modules.d.ts +1 -1
  52. package/muon.d.ts +99 -1
  53. package/package.json +7 -7
  54. package/vite.d.ts +1 -1
  55. package/dist/vite-internals-BqnOn7M6.cjs.map +0 -1
package/README.md CHANGED
@@ -17,7 +17,7 @@ Application replacement is extremely complex, and it has always been a hard prob
17
17
  The causes vary widely, so there is no magic solution that makes everything easy.
18
18
  Even so, everyone wants to modernize with as little cost as possible.
19
19
 
20
- muon (pronounced "muon") is a multi-platform GUI application framework that uses CEF (Chromium Embedded Framework).
20
+ muon (/ˈmjuːɒn/) is a multi-platform GUI application framework that uses CEF (Chromium Embedded Framework).
21
21
  You have probably heard of similar projects such as [Electron](https://www.electronjs.org/).
22
22
 
23
23
  Roughly speaking, muon is framework software in the same category.
@@ -73,35 +73,36 @@ With the minimal setup, installing the NPM package and adding one line to the co
73
73
 
74
74
  ---
75
75
 
76
- ## How to enable muon on your project
76
+ ## Getting started with muon (Quick version)
77
77
 
78
- ### Install the muon package
79
-
80
- Install the muon package, officially named `muon-ui`, into `devDependencies`:
78
+ Let's get started by creating an application with muon (a muon app).
79
+ Use a [Vite template](https://vite.dev/guide/) to create "my-muon-app" as you normally would:
81
80
 
82
81
  ```bash
83
- npm install -D muon-ui
82
+ npm create vite@latest my-muon-app -- --template react-ts
84
83
  ```
85
84
 
86
- The muon package includes the following:
85
+ This example uses React + TypeScript, but of course other choices are fine. Be sure to enable TypeScript.
86
+ Then run:
87
87
 
88
- - muon CLI
89
- - muon Vite plugin
90
- - TypeScript type definitions for muon built-in plugins
91
- - Platform-specific muon binary assets
88
+ ```bash
89
+ cd my-muon-app
90
+ npm install
91
+ npm run dev
92
+ ```
92
93
 
93
- The CEF binary itself is not included in the NPM package.
94
- CEF is downloaded from the official CDN when it becomes necessary.
94
+ This starts the Vite development server, and you can click the link to view the page in a browser.
95
95
 
96
- ### Configure the muon Vite plugin
96
+ Now add muon to this project:
97
97
 
98
- Installing the muon package almost completes the preparation, but you should enable the muon Vite plugin so that HMR (Hot Module Replacement) and muon app builds are available.
98
+ ```bash
99
+ npm install -D muon-ui
100
+ ```
99
101
 
100
- For anyone unfamiliar with HMR, Vite acts as a development server, lets a browser show the page, and updates the display almost in real time when the page is edited.
101
- In other words, it is a very useful feature that automatically previews edit results.
102
+ The CEF binary itself is not included in the NPM package.
103
+ CEF is downloaded from the official CDN when it is needed.
102
104
 
103
- The muon Vite plugin supports HMR by launching muon instead of a browser and making HMR work inside the muon app.
104
- Add the following code to `vite.config.ts` to enable it:
105
+ Next, add the muon Vite plugin to Vite so that you can build your muon app. Add the following code to `vite.config.ts`:
105
106
 
106
107
  ```ts
107
108
  import { defineConfig } from 'vite'
@@ -116,8 +117,13 @@ export default defineConfig({
116
117
  })
117
118
  ```
118
119
 
119
- Add `muon()` to the `plugins` array in the `defineConfig()` argument.
120
- This enables the muon Vite plugin. Preparation is now complete.
120
+ Everything is now ready. Launch muon:
121
+
122
+ ```bash
123
+ npm run dev
124
+ ```
125
+
126
+ The muon window should appear with your page!
121
127
 
122
128
  ---
123
129
 
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.19.0
4
+ * version: 0.21.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: 7b7fb7ea982e11163531485618fa27453d547280
9
+ * git.commit.hash: 2f3b7522d64ed4fad1398ccd66b8090fd40f5b09
10
10
  */
11
- const require_vite_internals = require("./vite-internals-BqnOn7M6.cjs");
11
+ const require_vite_internals = require("./vite-internals-0JA6tPL0.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");
@@ -115,12 +115,18 @@ var copyViteOutputAsRunAssets = async (project, assetSourcePath, assetPrefix) =>
115
115
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(destinationPath), { recursive: true });
116
116
  await (0, node_fs_promises.cp)(project.viteOutputDirectory, destinationPath, { recursive: true });
117
117
  };
118
- var prepareViteRunAssets = async (cwd) => {
118
+ var prepareViteRunAssets = async (cwd, configPath) => {
119
119
  const project = await require_vite_internals.loadMuonBuildSequenceProject(cwd);
120
120
  if (project.pluginOptions === void 0) return;
121
121
  const buildOptions = require_vite_internals.resolveMuonViteBuildOptions(project.pluginOptions);
122
122
  const packagedAssetOptions = require_vite_internals.createVitePackagedAssetOptions(project.viteBase ?? "/");
123
123
  const assetSourcePath = (0, node_path.join)(project.root, ".muon", "run", "assets");
124
+ const effectiveConfigPath = configPath ?? buildOptions.configPath;
125
+ const projectConfig = await resolveProjectConfig(project.root, effectiveConfigPath);
126
+ const nodeProject = await require_vite_internals.resolveMuonNodeProject(projectConfig.config, projectConfig.configPath === void 0 ? project.root : (0, node_path.dirname)(projectConfig.configPath));
127
+ if (project.viteOutputDirectory === void 0) throw new Error("Vite output directory could not be resolved.");
128
+ await require_vite_internals.assertMuonNodeProjectViteBuildIsSafe(nodeProject, project.viteOutputDirectory, project.vitePublicDirectory ?? "");
129
+ await require_vite_internals.assertMuonNodeProjectAssetSourceIsSafe(nodeProject, assetSourcePath);
124
130
  await (0, node_fs_promises.rm)(assetSourcePath, {
125
131
  recursive: true,
126
132
  force: true
@@ -130,7 +136,7 @@ var prepareViteRunAssets = async (cwd) => {
130
136
  return {
131
137
  root: project.root,
132
138
  pluginOptions: project.pluginOptions,
133
- configPath: buildOptions.configPath,
139
+ configPath: effectiveConfigPath,
134
140
  assetSourcePath,
135
141
  browserStartPage: packagedAssetOptions.browserStartPage,
136
142
  runtimePluginConfig,
@@ -221,7 +227,7 @@ var resolveAssetSource = async (root, assetSourcePath, projectConfig) => {
221
227
  overrideAssetSourcePath: defaultAssetSourcePath
222
228
  };
223
229
  };
224
- var createMuonDevOverrideConfig = (assetSourcePath, enableDebugger, browserStartPage, runtimePluginConfig) => {
230
+ var createMuonDevOverrideConfig = (assetSourcePath, enableDebugger, browserStartPage, runtimePluginConfig, nodeProjectPath) => {
225
231
  const browser = browserStartPage === void 0 && !enableDebugger ? void 0 : {
226
232
  ...browserStartPage === void 0 ? {} : { startPage: browserStartPage },
227
233
  ...enableDebugger ? { keybind: {
@@ -231,6 +237,7 @@ var createMuonDevOverrideConfig = (assetSourcePath, enableDebugger, browserStart
231
237
  };
232
238
  return {
233
239
  ...assetSourcePath === void 0 ? {} : { asset: { sourcePath: assetSourcePath } },
240
+ ...nodeProjectPath === void 0 ? {} : { node: { project: nodeProjectPath } },
234
241
  ...enableDebugger ? { cdp: { enable: true } } : {},
235
242
  ...browser === void 0 ? {} : { browser },
236
243
  ...runtimePluginConfig === void 0 ? {} : { plugin: runtimePluginConfig }
@@ -258,7 +265,7 @@ var runMuonExecutable = async (muonExecutablePath, configPaths, allowInsecureLoc
258
265
  });
259
266
  };
260
267
  var runMuonDevOnce = async (options, cwd, reportViteServerProxyWarning) => {
261
- const preparedViteAssets = options.assetSourcePath === void 0 ? await prepareViteRunAssets(cwd) : void 0;
268
+ const preparedViteAssets = options.assetSourcePath === void 0 ? await prepareViteRunAssets(cwd, options.configPath) : void 0;
262
269
  const loadedViteOptions = preparedViteAssets === void 0 ? await loadViteMuonOptions(cwd) : {
263
270
  root: preparedViteAssets.root,
264
271
  pluginOptions: preparedViteAssets.pluginOptions,
@@ -281,12 +288,15 @@ var runMuonDevOnce = async (options, cwd, reportViteServerProxyWarning) => {
281
288
  const enableDebugger = options.enableDebugger ?? pluginOptions?.enableDebugger ?? true;
282
289
  const allowInsecureLocalhost = options.allowInsecureLocalhost ?? pluginOptions?.allowInsecureLocalhost ?? false;
283
290
  const projectConfig = await resolveProjectConfig(root, options.configPath ?? preparedViteAssets?.configPath);
291
+ const nodeProject = await require_vite_internals.resolveMuonNodeProject(projectConfig.config, projectConfig.configPath === void 0 ? root : (0, node_path.dirname)(projectConfig.configPath));
284
292
  const asset = preparedViteAssets === void 0 ? await resolveAssetSource(root, options.assetSourcePath, projectConfig) : {
285
293
  assetSourcePath: preparedViteAssets.assetSourcePath,
286
294
  overrideAssetSourcePath: preparedViteAssets.assetSourcePath
287
295
  };
288
296
  const browserStartPage = preparedViteAssets?.browserStartPage !== void 0 && !hasConfigBrowserStartPage(projectConfig.config) ? preparedViteAssets.browserStartPage : void 0;
289
297
  const overrideConfigPath = (0, node_path.join)(root, ".muon", "run", "muon.run.json");
298
+ await require_vite_internals.assertMuonNodeProjectStagingIsSafe(nodeProject, stagePath);
299
+ await require_vite_internals.assertMuonNodeProjectAssetSourceIsSafe(nodeProject, asset.assetSourcePath);
290
300
  await require_vite_internals.ensureMuonGitignoreEntry(root);
291
301
  const preparedRuntime = await require_vite_internals.runMuonPrepare({
292
302
  muonPath,
@@ -301,7 +311,9 @@ var runMuonDevOnce = async (options, cwd, reportViteServerProxyWarning) => {
301
311
  cwd: root
302
312
  });
303
313
  if (preparedRuntime.stagePath === void 0) throw new Error("muon-builder did not return a staged runtime path.");
304
- await writeMuonDevOverrideConfig(overrideConfigPath, createMuonDevOverrideConfig(asset.overrideAssetSourcePath, enableDebugger, browserStartPage, preparedViteAssets?.runtimePluginConfig));
314
+ const nodeProjectPath = await require_vite_internals.stageMuonNodeProject(nodeProject, preparedRuntime.stagePath);
315
+ if (nodeProjectPath !== void 0) await require_vite_internals.assertMuonNodeHostArtifacts(preparedRuntime.stagePath, platform);
316
+ await writeMuonDevOverrideConfig(overrideConfigPath, createMuonDevOverrideConfig(asset.overrideAssetSourcePath, enableDebugger, browserStartPage, preparedViteAssets?.runtimePluginConfig, nodeProjectPath));
305
317
  const muonExecutablePath = require_vite_internals.getMuonExecutablePath(preparedRuntime.stagePath, platform);
306
318
  const exitCode = await runMuonExecutable(muonExecutablePath, [...projectConfig.configPath === void 0 ? [] : [projectConfig.configPath], overrideConfigPath], allowInsecureLocalhost, environment);
307
319
  return {
@@ -1006,7 +1018,11 @@ var packMuonApp = async (options) => {
1006
1018
  if (linuxDesktopOptions !== void 0) buildOptions.linuxDesktop = linuxDesktopOptions;
1007
1019
  if (progress !== void 0) buildOptions.progress = progress;
1008
1020
  buildOptions.environment = environment;
1009
- const windowsResourceConfig = await require_vite_internals.readMuonConfigForWindowsResource(root, options.configPath);
1021
+ const windowsResourceConfig = await require_vite_internals.readMuonConfigForWindowsResource(root, options.configPath ?? pluginBuildOptions.configPath);
1022
+ const nodeProject = await require_vite_internals.resolveMuonNodeProject(windowsResourceConfig.config, windowsResourceConfig.directory);
1023
+ await require_vite_internals.assertMuonNodeProjectPackCleanupIsSafe(nodeProject, packageBuildRoot);
1024
+ await require_vite_internals.assertMuonNodeProjectPackCleanupIsSafe(nodeProject, (0, node_path.join)(artifactsRoot, "deb"));
1025
+ await require_vite_internals.assertMuonNodeProjectPackCleanupIsSafe(nodeProject, (0, node_path.join)(artifactsRoot, "nsis"));
1010
1026
  const windowsResource = await require_vite_internals.resolveMuonWindowsResource({
1011
1027
  root,
1012
1028
  packageDirectory: options.packageDirectory ?? pluginBuildOptions.packageDirectory ?? "",
@@ -1108,8 +1124,8 @@ var packMuonApp = async (options) => {
1108
1124
  };
1109
1125
  //#endregion
1110
1126
  //#region src/generated/packageMetadata.ts
1111
- var version = "0.19.0";
1112
- var git_commit_hash = "7b7fb7ea982e11163531485618fa27453d547280";
1127
+ var version = "0.21.0";
1128
+ var git_commit_hash = "2f3b7522d64ed4fad1398ccd66b8090fd40f5b09";
1113
1129
  //#endregion
1114
1130
  //#region src/cli.ts
1115
1131
  var readTargetValues = (value) => {