@lynx-js/lynxtron 0.0.1 → 0.0.3
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.
- package/README.md +80 -0
- package/apis/api/app.d.ts +1848 -0
- package/apis/api/asar.d.ts +124 -0
- package/apis/api/base-window.d.ts +1712 -0
- package/apis/api/clipboard.d.ts +54 -0
- package/apis/api/command-line.d.ts +46 -0
- package/apis/api/context-bridge.d.ts +8 -0
- package/apis/api/devtool.d.ts +34 -0
- package/apis/api/dialog.d.ts +633 -0
- package/apis/api/dock.d.ts +88 -0
- package/apis/api/environment.d.ts +9 -0
- package/apis/api/event.d.ts +8 -0
- package/apis/api/jump-list-item.d.ts +83 -0
- package/apis/api/lynx-library.d.ts +7 -0
- package/apis/api/lynx-template-bundle.d.ts +32 -0
- package/apis/api/lynx-template-data.d.ts +10 -0
- package/apis/api/lynx-update-meta.d.ts +16 -0
- package/apis/api/lynx-window.d.ts +405 -0
- package/apis/api/menu.d.ts +96 -0
- package/apis/api/native-image.d.ts +268 -0
- package/apis/api/notification-response.d.ts +26 -0
- package/apis/api/notification.d.ts +242 -0
- package/apis/api/power-monitor.d.ts +121 -0
- package/apis/api/process-metric.d.ts +93 -0
- package/apis/api/protocol.d.ts +54 -0
- package/apis/api/screen.d.ts +222 -0
- package/apis/api/shell.d.ts +124 -0
- package/apis/api/task.d.ts +39 -0
- package/apis/api/touch-bar.d.ts +206 -0
- package/apis/api/tray.d.ts +44 -0
- package/apis/api/utility-process.d.ts +73 -0
- package/apis/lynx.d.ts +15 -0
- package/apis/lynxtron.d.ts +39 -0
- package/apis/structures/point.d.ts +10 -0
- package/apis/structures/rectangle.d.ts +22 -0
- package/apis/structures/size.d.ts +8 -0
- package/apis/web-host.d.ts +24 -0
- package/cli.js +28 -0
- package/context-bridge.js +6 -0
- package/fuses-cli.js +143 -0
- package/fuses.js +299 -0
- package/install.js +127 -0
- package/lynx.js +1 -0
- package/lynxtron.js +43 -0
- package/lynxtron_bin.js +10 -0
- package/native-paths.cjs +38 -0
- package/package.json +71 -4
- package/utils/download.js +72 -0
- package/utils/env-config.js +35 -0
- package/web-host/index.js +110 -0
- 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
|
+
```
|