@lynx-js/lynxtron 0.0.1 → 0.0.2

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 (51) hide show
  1. package/README.md +80 -0
  2. package/apis/api/app.d.ts +1848 -0
  3. package/apis/api/asar.d.ts +124 -0
  4. package/apis/api/base-window.d.ts +1712 -0
  5. package/apis/api/clipboard.d.ts +54 -0
  6. package/apis/api/command-line.d.ts +46 -0
  7. package/apis/api/context-bridge.d.ts +8 -0
  8. package/apis/api/devtool.d.ts +34 -0
  9. package/apis/api/dialog.d.ts +633 -0
  10. package/apis/api/dock.d.ts +88 -0
  11. package/apis/api/environment.d.ts +9 -0
  12. package/apis/api/event.d.ts +8 -0
  13. package/apis/api/jump-list-item.d.ts +83 -0
  14. package/apis/api/lynx-library.d.ts +7 -0
  15. package/apis/api/lynx-template-bundle.d.ts +32 -0
  16. package/apis/api/lynx-template-data.d.ts +10 -0
  17. package/apis/api/lynx-update-meta.d.ts +16 -0
  18. package/apis/api/lynx-window.d.ts +405 -0
  19. package/apis/api/menu.d.ts +96 -0
  20. package/apis/api/native-image.d.ts +268 -0
  21. package/apis/api/notification-response.d.ts +26 -0
  22. package/apis/api/notification.d.ts +242 -0
  23. package/apis/api/power-monitor.d.ts +121 -0
  24. package/apis/api/process-metric.d.ts +93 -0
  25. package/apis/api/protocol.d.ts +54 -0
  26. package/apis/api/screen.d.ts +222 -0
  27. package/apis/api/shell.d.ts +124 -0
  28. package/apis/api/task.d.ts +39 -0
  29. package/apis/api/touch-bar.d.ts +206 -0
  30. package/apis/api/tray.d.ts +44 -0
  31. package/apis/api/utility-process.d.ts +73 -0
  32. package/apis/lynx.d.ts +15 -0
  33. package/apis/lynxtron.d.ts +39 -0
  34. package/apis/structures/point.d.ts +10 -0
  35. package/apis/structures/rectangle.d.ts +22 -0
  36. package/apis/structures/size.d.ts +8 -0
  37. package/apis/web-host.d.ts +24 -0
  38. package/cli.js +28 -0
  39. package/context-bridge.js +6 -0
  40. package/fuses-cli.js +143 -0
  41. package/fuses.js +299 -0
  42. package/install.js +127 -0
  43. package/lynx.js +1 -0
  44. package/lynxtron.js +43 -0
  45. package/lynxtron_bin.js +10 -0
  46. package/native-paths.cjs +38 -0
  47. package/package.json +71 -4
  48. package/utils/download.js +72 -0
  49. package/utils/env-config.js +35 -0
  50. package/web-host/index.js +110 -0
  51. package/web-worker.js +12 -0
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Lynxtron Front Package
2
+
3
+ A minimal npm package that distributes the Lynxtron runtime and exposes TypeScript type definitions with a simple CLI entry.
4
+
5
+ ## Installation & Usage
6
+ - Requires Node.js `>=16`
7
+ - Install:
8
+
9
+ ```bash
10
+ npm install lynxtron
11
+ # or
12
+ pnpm add lynxtron
13
+ ```
14
+
15
+ - CLI:
16
+
17
+ ```bash
18
+ npx lynxtron <args>
19
+ ```
20
+
21
+ - Fuse CLI:
22
+
23
+ ```bash
24
+ npx lynxtron-fuses read
25
+ npx lynxtron-fuses write runAsNode=off embeddedAsarIntegrityValidation=on onlyLoadAppFromAsar=on
26
+ npx lynxtron-fuses read --app "C:\\path\\to\\lynxtron"
27
+ npx lynxtron-fuses write --binary "C:\\path\\to\\lynxtron.exe" nodeOptions=off
28
+ ```
29
+
30
+ When `--app` points at a packaged app, Lynxtron prefers the real runtime binary:
31
+ - macOS: `Contents/Frameworks/Lynxtron Framework.framework/Lynxtron Framework`
32
+ - Windows: `lynxtron.dll`
33
+
34
+ - Fuse API:
35
+
36
+ ```js
37
+ import { flipFuses, FuseV1Options, FuseVersion, getCurrentFuses } from '@lynx-js/lynxtron/fuses';
38
+
39
+ await flipFuses('/Applications/Lynxtron.app', {
40
+ version: FuseVersion.V1,
41
+ [FuseV1Options.RunAsNode]: false,
42
+ [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
43
+ [FuseV1Options.OnlyLoadAppFromAsar]: true,
44
+ });
45
+
46
+ console.log(await getCurrentFuses('/Applications/Lynxtron.app'));
47
+ console.log(await getCurrentFuses('C:\\path\\to\\lynxtron'));
48
+ ```
49
+
50
+ ## Files (excluding `apis/`)
51
+ - `package.json` — ESM config (`type: "module"`), `bin` entry, `types` entry, `postinstall`, dependencies, publish `files`.
52
+ - `fuses.js` — Reads and flips Lynxtron fuse bytes embedded in the packaged runtime.
53
+ - `fuses-cli.js` — CLI wrapper for reading and writing fuse values.
54
+ - `install.js` — Postinstall script to download and extract the runtime to `dist/<platform>/<arch>/`; sets executable permission on macOS.
55
+ - `lynxtron_bin.js` — Resolves the platform-specific executable path under `dist/<platform>/<arch>/<exe>`.
56
+ - `utils/env-config.js` — Resolves platform, arch and version; builds the executable filename for each OS.
57
+ - `utils/download.js` — Download helper using `node-fetch` with timeout and single-write to disk.
58
+ - `scripts/scan-cjk-comments.js` — Dev utility to scan Chinese comments outside `front` (not published).
59
+
60
+ ## Type Definitions
61
+ - Types entry: `./apis/lynxtron.d.ts`
62
+
63
+ ## Multi-Environment Support
64
+
65
+ Lynxtron supports both **Desktop** (Node.js/Electron) and **Web** (Browser) environments. To ensure compatibility, use the correct import paths:
66
+
67
+ - **Main Process (Desktop)**: `import { app, LynxWindow } from '@lynx-js/lynxtron'`
68
+ - **Web Host (Browser)**: `import { setupSymmetricHost } from '@lynx-js/lynxtron/web-host'`
69
+ - **Worker / Preload (Cross-Platform)**: `import { contextBridge } from '@lynx-js/lynxtron/context-bridge'`
70
+
71
+ ### Context Bridge
72
+ When writing code that runs in the Lynx Background Thread (e.g., preload scripts or adapters), always import `contextBridge` from the subpath to ensure the correct implementation is loaded for the target environment (Native Module for Desktop, Polyfill for Web).
73
+
74
+ ```typescript
75
+ import { contextBridge } from '@lynx-js/lynxtron/context-bridge';
76
+
77
+ contextBridge.exposeInLynxBTS({
78
+ // ...
79
+ });
80
+ ```