muon-ui 0.26.0 → 0.26.47

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 (75) hide show
  1. package/README.md +5 -0
  2. package/android.d.ts +4 -4
  3. package/dist/android/lib/index.cjs +13 -10
  4. package/dist/android/lib/index.cjs.map +1 -1
  5. package/dist/android/lib/index.mjs +14 -11
  6. package/dist/android/lib/index.mjs.map +1 -1
  7. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar +0 -0
  8. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar.md5 +1 -1
  9. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar.sha1 +1 -1
  10. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar.sha256 +1 -1
  11. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar.sha512 +1 -1
  12. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module +10 -10
  13. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module.md5 +1 -1
  14. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module.sha1 +1 -1
  15. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module.sha256 +1 -1
  16. package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module.sha512 +1 -1
  17. package/dist/android/maven/dev/muon/runtime/maven-metadata.xml +1 -1
  18. package/dist/android/maven/dev/muon/runtime/maven-metadata.xml.md5 +1 -1
  19. package/dist/android/maven/dev/muon/runtime/maven-metadata.xml.sha1 +1 -1
  20. package/dist/android/maven/dev/muon/runtime/maven-metadata.xml.sha256 +1 -1
  21. package/dist/android/maven/dev/muon/runtime/maven-metadata.xml.sha512 +1 -1
  22. package/dist/android/renderer/renderer.js +41 -14
  23. package/dist/android/renderer/renderer.js.map +1 -1
  24. package/dist/cli.cjs +82 -56
  25. package/dist/cli.cjs.map +1 -1
  26. package/dist/index.cjs +2 -2
  27. package/dist/index.mjs +2 -2
  28. package/dist/native/linux-amd64/muon-builder +0 -0
  29. package/dist/native/linux-amd64/muon-launcher +0 -0
  30. package/dist/native/linux-amd64/muon-runtime-helper +0 -0
  31. package/dist/native/linux-arm64/muon-builder +0 -0
  32. package/dist/native/linux-arm64/muon-launcher +0 -0
  33. package/dist/native/linux-arm64/muon-runtime-helper +0 -0
  34. package/dist/native/linux-armhf/muon-builder +0 -0
  35. package/dist/native/linux-armhf/muon-launcher +0 -0
  36. package/dist/native/linux-armhf/muon-runtime-helper +0 -0
  37. package/dist/native/windows-amd64/muon-builder.exe +0 -0
  38. package/dist/native/windows-amd64/muon-launcher.exe +0 -0
  39. package/dist/native/windows-amd64/muon-plugin-inspector.exe +0 -0
  40. package/dist/native/windows-i686/muon-builder.exe +0 -0
  41. package/dist/native/windows-i686/muon-launcher.exe +0 -0
  42. package/dist/native/windows-i686/muon-plugin-inspector.exe +0 -0
  43. package/dist/runtime/linux-amd64/libmuon-ui.so +0 -0
  44. package/dist/runtime/linux-amd64/muon-core +0 -0
  45. package/dist/runtime/linux-amd64/plugins/node-bridge.mjs +5 -5
  46. package/dist/runtime/linux-amd64/plugins/node.so +0 -0
  47. package/dist/runtime/linux-arm64/libmuon-ui.so +0 -0
  48. package/dist/runtime/linux-arm64/muon-core +0 -0
  49. package/dist/runtime/linux-arm64/plugins/node-bridge.mjs +5 -5
  50. package/dist/runtime/linux-arm64/plugins/node.so +0 -0
  51. package/dist/runtime/linux-armhf/libmuon-ui.so +0 -0
  52. package/dist/runtime/linux-armhf/muon-core +0 -0
  53. package/dist/runtime/linux-armhf/plugins/node-bridge.mjs +5 -5
  54. package/dist/runtime/linux-armhf/plugins/node.so +0 -0
  55. package/dist/runtime/windows-amd64/libcardio.dll +0 -0
  56. package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
  57. package/dist/runtime/windows-amd64/muon-core.exe +0 -0
  58. package/dist/runtime/windows-amd64/plugins/node-bridge.mjs +5 -5
  59. package/dist/runtime/windows-amd64/plugins/node.dll +0 -0
  60. package/dist/runtime/windows-i686/libcardio.dll +0 -0
  61. package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
  62. package/dist/runtime/windows-i686/muon-core.exe +0 -0
  63. package/dist/runtime/windows-i686/plugins/node-bridge.mjs +5 -5
  64. package/dist/runtime/windows-i686/plugins/node.dll +0 -0
  65. package/dist/{vite-internals-DseKep-X.cjs → vite-internals-CueaxMaY.cjs} +4225 -1963
  66. package/dist/vite-internals-CueaxMaY.cjs.map +1 -0
  67. package/dist/vite.cjs +100 -1294
  68. package/dist/vite.cjs.map +1 -1
  69. package/dist/vite.mjs +6102 -5128
  70. package/dist/vite.mjs.map +1 -1
  71. package/images/get-started-android.png +0 -0
  72. package/muon-virtual-modules.d.ts +53 -0
  73. package/package.json +13 -13
  74. package/vite.d.ts +8 -0
  75. package/dist/vite-internals-DseKep-X.cjs.map +0 -1
@@ -1,14 +1,15 @@
1
1
  /*!
2
2
  * name: muon-android
3
- * version: 0.26.0
4
- * description: Shared Android runtime and build components for muon-ui.
3
+ * version: 0.26.47
4
+ * description: Android runtime for muon-ui.
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: 4bceacb2bf609778560407d23f4cba0e36315098
8
+ * git.commit.hash: 95dc2712686873c8a022483fd9abf18598019bd7
9
9
  */
10
10
  (function() {
11
- //#region src/renderer/android-api.ts
11
+ //#region function-paths.ts
12
+ /** Browser functions implemented by Android. */
12
13
  var browserFunctionNames = [
13
14
  "reload",
14
15
  "toggleFullscreen",
@@ -19,12 +20,14 @@
19
20
  "resetZoom",
20
21
  "close"
21
22
  ];
23
+ /** Environment functions implemented by Android. */
22
24
  var environmentFunctionNames = [
23
25
  "getVariables",
24
26
  "getConfigValues",
25
27
  "getProcessId",
26
28
  "getRuntimeInfo"
27
29
  ];
30
+ /** Filesystem functions implemented by Android. */
28
31
  var filesystemFunctionNames = [
29
32
  "readFile",
30
33
  "writeFile",
@@ -49,11 +52,14 @@
49
52
  "symlink",
50
53
  "watch"
51
54
  ];
52
- [
55
+ /** Fully-qualified built-in function paths implemented by the Android backend. */
56
+ var muonAndroidBuiltinFunctionPaths = [
53
57
  ...browserFunctionNames.map((name) => `muon.browser.${name}`),
54
58
  ...environmentFunctionNames.map((name) => `muon.environments.${name}`),
55
59
  ...filesystemFunctionNames.map((name) => `muon.fs.${name}`)
56
60
  ];
61
+ //#endregion
62
+ //#region renderer/android-api.ts
57
63
  var createVoidNamespace = (client, capabilityId, namespace, functionNames) => {
58
64
  const entries = functionNames.map((name) => [name, async () => {
59
65
  await client.call(capabilityId, `${namespace}.${name}`, []);
@@ -440,7 +446,7 @@
440
446
  fs: createMuonAndroidFsApi(client, capabilityIds["muon.fs"])
441
447
  });
442
448
  //#endregion
443
- //#region src/renderer/native-plugin-api.ts
449
+ //#region renderer/native-plugin-api.ts
444
450
  var getNamespaceSegments = (namespace) => namespace.split(".");
445
451
  var getOrCreateNamespace = (roots, namespace) => {
446
452
  const segments = getNamespaceSegments(namespace);
@@ -531,7 +537,7 @@
531
537
  };
532
538
  };
533
539
  //#endregion
534
- //#region src/renderer/webview-rpc.ts
540
+ //#region renderer/webview-rpc.ts
535
541
  var binaryHeaderLength = 16;
536
542
  var binaryMagic = [
537
543
  77,
@@ -1249,7 +1255,21 @@
1249
1255
  };
1250
1256
  };
1251
1257
  //#endregion
1252
- //#region src/renderer/bootstrap.ts
1258
+ //#region renderer/bootstrap.ts
1259
+ var createCapabilityClient = (client) => ({
1260
+ ...client,
1261
+ call: async (id, path, args, options) => {
1262
+ if (!muonAndroidBuiltinFunctionPaths.includes(path)) return await client.call(id, path, args, options);
1263
+ const api = createMuonAndroidSimpleApi(client, {
1264
+ "muon.browser": id,
1265
+ "muon.environments": id,
1266
+ "muon.fs": id
1267
+ });
1268
+ const [, namespace, name] = path.split(".");
1269
+ const functions = Reflect.get(api, namespace);
1270
+ return await Reflect.get(functions, name)(...args);
1271
+ }
1272
+ });
1253
1273
  /**
1254
1274
  * Installs the packaged Android API before application scripts execute.
1255
1275
  * @param bridge - Native WebView transport restricted to the trusted origin.
@@ -1259,12 +1279,18 @@
1259
1279
  */
1260
1280
  var bootstrapMuonAndroid = (bridge, metadata, target) => {
1261
1281
  const client = createMuonWebViewRpcClient(createMuonWebViewRpcTransport(bridge), metadata);
1262
- const uninstallCapabilities = installMuonWebViewCapabilityBridge(client, target);
1263
- const uninstallApi = installMuonAndroidNativePluginApi(client, metadata, { muon: createMuonAndroidSimpleApi(client, {
1282
+ const uninstallCapabilities = installMuonWebViewCapabilityBridge(metadata.mode === "validate" ? createCapabilityClient(client) : client, target);
1283
+ const api = createMuonAndroidSimpleApi(client, {
1264
1284
  "muon.browser": "browser-capability",
1265
1285
  "muon.environments": "environment-capability",
1266
1286
  "muon.fs": "fs-capability"
1267
- }) }, target);
1287
+ });
1288
+ const allowed = new Set(metadata.builtinFunctions);
1289
+ const builtin = Object.fromEntries(Object.entries(api).flatMap(([namespace, functions]) => {
1290
+ const selected = Object.entries(functions).filter(([name]) => allowed.has(`muon.${namespace}.${name}`));
1291
+ return selected.length === 0 ? [] : [[namespace, Object.fromEntries(selected)]];
1292
+ }));
1293
+ const uninstallApi = installMuonAndroidNativePluginApi(client, metadata, Object.keys(builtin).length === 0 ? {} : { muon: builtin }, target);
1268
1294
  return () => {
1269
1295
  uninstallApi();
1270
1296
  uninstallCapabilities();
@@ -1272,7 +1298,7 @@
1272
1298
  };
1273
1299
  };
1274
1300
  //#endregion
1275
- //#region src/renderer/native-plugin-metadata.ts
1301
+ //#region renderer/native-plugin-metadata.ts
1276
1302
  var valueTypes = /* @__PURE__ */ new Set([
1277
1303
  "void",
1278
1304
  "bool",
@@ -1322,7 +1348,7 @@
1322
1348
  * @returns A deeply immutable metadata snapshot.
1323
1349
  */
1324
1350
  var readMuonAndroidRendererMetadata = (value) => {
1325
- if (!isRecord(value) || value.version !== 1 || !Number.isInteger(value.contextId) || typeof value.contextId !== "number" || value.contextId <= 0 || value.contextId > 2147483647 || value.mode !== "simple" && value.mode !== "validate" || !Array.isArray(value.namespaces) || !Array.isArray(value.functions)) throw new TypeError("Android native plugin renderer metadata is invalid");
1351
+ if (!isRecord(value) || value.version !== 1 || !Number.isInteger(value.contextId) || typeof value.contextId !== "number" || value.contextId <= 0 || value.contextId > 2147483647 || value.mode !== "simple" && value.mode !== "validate" || !Array.isArray(value.builtinFunctions) || value.builtinFunctions.some((path) => typeof path !== "string") || !Array.isArray(value.namespaces) || !Array.isArray(value.functions)) throw new TypeError("Android native plugin renderer metadata is invalid");
1326
1352
  const namespaces = value.namespaces.map((candidate) => {
1327
1353
  if (!isRecord(candidate) || typeof candidate.setupScript !== "string" || !Array.isArray(candidate.allowedFunctions)) throw new TypeError("Android native plugin namespace metadata is invalid");
1328
1354
  const allowedFunctions = candidate.allowedFunctions.map((name) => readIdentifier(name, "allowed function name"));
@@ -1348,12 +1374,13 @@
1348
1374
  version: 1,
1349
1375
  contextId: value.contextId,
1350
1376
  mode: value.mode,
1377
+ builtinFunctions: Object.freeze([...value.builtinFunctions]),
1351
1378
  namespaces: Object.freeze(namespaces),
1352
1379
  functions: Object.freeze(functions)
1353
1380
  });
1354
1381
  };
1355
1382
  //#endregion
1356
- //#region src/renderer/entry.ts
1383
+ //#region renderer/entry.ts
1357
1384
  if (window === window.top) {
1358
1385
  const dispose = bootstrapMuonAndroid(Reflect.get(globalThis, "muonAndroidRpc"), readMuonAndroidRendererMetadata(Reflect.get(globalThis, "__muon_android_plugin_metadata")), globalThis);
1359
1386
  window.addEventListener("pagehide", dispose, { once: true });