@laot/bridge 1.1.0 → 1.1.1
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 +109 -109
- package/dist/ltbridge.js +47 -47
- package/dist/modules.dat +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
# LTBridge
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@laot/bridge)
|
|
4
|
-
[](https://www.npmjs.com/package/@laot/bridge)
|
|
5
|
-
[](https://github.com/laot7490/ltbridge/releases)
|
|
6
|
-
[](https://github.com/laot7490/ltbridge/graphs/contributors)
|
|
7
|
-
[](https://github.com/laot7490/ltbridge/blob/main/LICENSE)
|
|
8
|
-
|
|
9
|
-
A next-generation **FiveM Script Bridge & Module Manager** designed to be incredibly fast, clean, and bloat-free.
|
|
10
|
-
|
|
11
|
-
Unlike traditional monolithic libraries that force every script to load hundreds of unused functions into memory, **LTBridge** acts as a smart build tool. It lets you maintain a central repository of your favorite utilities (like Inventory, Framework, Notify) and compiles **only the exact code you actually use** right into your FiveM resource.
|
|
12
|
-
|
|
13
|
-
By eliminating slow cross-resource exports and memory bloat, LTBridge helps you build highly independent, lightning-fast scripts with a perfect development experience.
|
|
14
|
-
|
|
15
|
-
## ✨ Why LTBridge?
|
|
16
|
-
|
|
17
|
-
- **AOT Compilation:** Our Ahead-of-Time compiler bundles everything in under ~200 milliseconds, meaning zero waiting.
|
|
18
|
-
- **Instant Intellisense:** Generates an `api.lua` stub file automatically. You get full autocomplete for everything as you type (`LT.Inventory.AddItem`).
|
|
19
|
-
- **Smart Dependencies:** If a module needs another module, LTBridge automatically brings it in. No more missing functions.
|
|
20
|
-
- **Live Watcher:** Just run `ltbridge build -w` and start coding. It detects what you type, bundles the necessary modules instantly, and updates your `fxmanifest.lua` on the fly.
|
|
21
|
-
|
|
22
|
-
## 📦 Installation
|
|
23
|
-
|
|
24
|
-
Install the CLI tool globally using npm:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install -g @laot/bridge
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Or run it directly via npx:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npx @laot/bridge [command]
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## 🚀 Quick Start
|
|
37
|
-
|
|
38
|
-
1. **Initialize** your project:
|
|
39
|
-
```bash
|
|
40
|
-
ltbridge init
|
|
41
|
-
```
|
|
42
|
-
*Follow the quick prompts to set up your preferences.*
|
|
43
|
-
|
|
44
|
-
2. **Start the Watcher**:
|
|
45
|
-
```bash
|
|
46
|
-
ltbridge build -w
|
|
47
|
-
```
|
|
48
|
-
*The watcher will run silently in the background and do all the heavy lifting.*
|
|
49
|
-
|
|
50
|
-
3. **Just Code**:
|
|
51
|
-
Use it in your script immediately. Everything else is automatic.
|
|
52
|
-
```lua
|
|
53
|
-
local name, lastname = LT.Framework.GetPlayerName()
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## ⚙️ Configuration (`ltbridge/ltbridge.config.json`)
|
|
57
|
-
|
|
58
|
-
When you run `init`, LTBridge creates a simple JSON config.
|
|
59
|
-
|
|
60
|
-
| Setting | Default | Description |
|
|
61
|
-
| --- | --- | --- |
|
|
62
|
-
| `buildAsBundle`| `false` (non-interactive `init`) / prompt on interactive `init` | Combine everything into 3 clean files (`shared`, `client`, `server`). Set to `true` for bundle mode. |
|
|
63
|
-
| `debug` | `false` | Turn this on if you want to see internal debug prints from the modules. |
|
|
64
|
-
| `minify` | `true` | Enables code optimization and global variable randomization for maximum performance. |
|
|
65
|
-
| `modules` | `[]` | List of installed modules. The tool manages this automatically! |
|
|
66
|
-
|
|
67
|
-
## 🛠️ Commands
|
|
68
|
-
|
|
69
|
-
| Command | Alias | Description |
|
|
70
|
-
| --- | --- | --- |
|
|
71
|
-
| `ltbridge` | - | **Interactive Menu**: Manage your modules visually. |
|
|
72
|
-
| `ltbridge init` | - | Set up LTBridge in a new project (runs an initial build unless `--no-build`). |
|
|
73
|
-
| `ltbridge api` | - | Regenerate `ltbridge/api.lua` IDE stubs only. |
|
|
74
|
-
| `ltbridge build` | `sync` | Build the project manually (use `-w` for live auto-build). |
|
|
75
|
-
| `ltbridge add <name>` | - | Add a specific module manually (e.g., `Target/*`). |
|
|
76
|
-
| `ltbridge remove <name>`| - | Remove a module. |
|
|
77
|
-
| `ltbridge why <name>` | `explain` | See exactly why a module was automatically included. |
|
|
78
|
-
| `ltbridge list` | - | View installed and available modules. |
|
|
79
|
-
| `ltbridge prune` | - | Clean up unused modules from your code. |
|
|
80
|
-
|
|
81
|
-
## 🤝 Contributing
|
|
82
|
-
|
|
83
|
-
Got a cool function or utility? We'd love to have it! The system is designed so anyone can easily add new modules without touching complex configs.
|
|
84
|
-
|
|
85
|
-
1. **Fork** the repository.
|
|
86
|
-
2. **Create a folder** in `modules/` (e.g., `modules/@MyCategory/MyFunction`).
|
|
87
|
-
3. **Write your code**:
|
|
88
|
-
- Put your code in `client.lua`, `server.lua`, or `shared.lua`.
|
|
89
|
-
- Write standard EmmyLua comments (`--- @param`, `--- @return`) for intellisense.
|
|
90
|
-
4. **Submit a Pull Request**: We will review and merge it.
|
|
91
|
-
|
|
92
|
-
### 🧠 Smart Annotations (`@ltbridge`)
|
|
93
|
-
|
|
94
|
-
If you are developing modules, you can use special comments to tell the compiler what to do. The compiler reads these, applies them, and then completely deletes the comments from the final build.
|
|
95
|
-
|
|
96
|
-
- `--- @ltbridge export: CustomName` - Change the exported name of the function.
|
|
97
|
-
- `--- @ltbridge alias: AnotherName` - Create an alternative name for the same function.
|
|
98
|
-
- `--- @ltbridge global` - Expose the function directly to the root `LT` object (e.g., `LT.SetResource`).
|
|
99
|
-
- `--- @ltbridge internal` - Marks the module as a "Ghost Module". It runs silently in the background when needed, but doesn't show up in the API or menus.
|
|
100
|
-
|
|
101
|
-
## 🙏 Credits
|
|
102
|
-
|
|
103
|
-
A huge thanks to the **[community_bridge](https://github.com/TheOrderFivem)** project for the inspiration behind some core concepts, and **[luamin.js](https://github.com/Herrtt/luamin.js/)** for the minification engine.
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
> **💡 Tip:** To stop your IDE from trying to read the bundled output files (which can cause duplicate intellisense warnings), add this to your VSCode settings (`.vscode/settings.json`):
|
|
107
|
-
> ```json
|
|
108
|
-
> "Lua.workspace.ignoreDir": ["**/ltbridge/modules/**"]
|
|
109
|
-
> ```
|
|
1
|
+
# LTBridge
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@laot/bridge)
|
|
4
|
+
[](https://www.npmjs.com/package/@laot/bridge)
|
|
5
|
+
[](https://github.com/laot7490/ltbridge/releases)
|
|
6
|
+
[](https://github.com/laot7490/ltbridge/graphs/contributors)
|
|
7
|
+
[](https://github.com/laot7490/ltbridge/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
A next-generation **FiveM Script Bridge & Module Manager** designed to be incredibly fast, clean, and bloat-free.
|
|
10
|
+
|
|
11
|
+
Unlike traditional monolithic libraries that force every script to load hundreds of unused functions into memory, **LTBridge** acts as a smart build tool. It lets you maintain a central repository of your favorite utilities (like Inventory, Framework, Notify) and compiles **only the exact code you actually use** right into your FiveM resource.
|
|
12
|
+
|
|
13
|
+
By eliminating slow cross-resource exports and memory bloat, LTBridge helps you build highly independent, lightning-fast scripts with a perfect development experience.
|
|
14
|
+
|
|
15
|
+
## ✨ Why LTBridge?
|
|
16
|
+
|
|
17
|
+
- **AOT Compilation:** Our Ahead-of-Time compiler bundles everything in under ~200 milliseconds, meaning zero waiting.
|
|
18
|
+
- **Instant Intellisense:** Generates an `api.lua` stub file automatically. You get full autocomplete for everything as you type (`LT.Inventory.AddItem`).
|
|
19
|
+
- **Smart Dependencies:** If a module needs another module, LTBridge automatically brings it in. No more missing functions.
|
|
20
|
+
- **Live Watcher:** Just run `ltbridge build -w` and start coding. It detects what you type, bundles the necessary modules instantly, and updates your `fxmanifest.lua` on the fly.
|
|
21
|
+
|
|
22
|
+
## 📦 Installation
|
|
23
|
+
|
|
24
|
+
Install the CLI tool globally using npm:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g @laot/bridge
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or run it directly via npx:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx @laot/bridge [command]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 🚀 Quick Start
|
|
37
|
+
|
|
38
|
+
1. **Initialize** your project:
|
|
39
|
+
```bash
|
|
40
|
+
ltbridge init
|
|
41
|
+
```
|
|
42
|
+
*Follow the quick prompts to set up your preferences.*
|
|
43
|
+
|
|
44
|
+
2. **Start the Watcher**:
|
|
45
|
+
```bash
|
|
46
|
+
ltbridge build -w
|
|
47
|
+
```
|
|
48
|
+
*The watcher will run silently in the background and do all the heavy lifting.*
|
|
49
|
+
|
|
50
|
+
3. **Just Code**:
|
|
51
|
+
Use it in your script immediately. Everything else is automatic.
|
|
52
|
+
```lua
|
|
53
|
+
local name, lastname = LT.Framework.GetPlayerName()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## ⚙️ Configuration (`ltbridge/ltbridge.config.json`)
|
|
57
|
+
|
|
58
|
+
When you run `init`, LTBridge creates a simple JSON config.
|
|
59
|
+
|
|
60
|
+
| Setting | Default | Description |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| `buildAsBundle`| `false` (non-interactive `init`) / prompt on interactive `init` | Combine everything into 3 clean files (`shared`, `client`, `server`). Set to `true` for bundle mode. |
|
|
63
|
+
| `debug` | `false` | Turn this on if you want to see internal debug prints from the modules. |
|
|
64
|
+
| `minify` | `true` | Enables code optimization and global variable randomization for maximum performance. |
|
|
65
|
+
| `modules` | `[]` | List of installed modules. The tool manages this automatically! |
|
|
66
|
+
|
|
67
|
+
## 🛠️ Commands
|
|
68
|
+
|
|
69
|
+
| Command | Alias | Description |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `ltbridge` | - | **Interactive Menu**: Manage your modules visually. |
|
|
72
|
+
| `ltbridge init` | - | Set up LTBridge in a new project (runs an initial build unless `--no-build`). |
|
|
73
|
+
| `ltbridge api` | - | Regenerate `ltbridge/api.lua` IDE stubs only. |
|
|
74
|
+
| `ltbridge build` | `sync` | Build the project manually (use `-w` for live auto-build). |
|
|
75
|
+
| `ltbridge add <name>` | - | Add a specific module manually (e.g., `Target/*`). |
|
|
76
|
+
| `ltbridge remove <name>`| - | Remove a module. |
|
|
77
|
+
| `ltbridge why <name>` | `explain` | See exactly why a module was automatically included. |
|
|
78
|
+
| `ltbridge list` | - | View installed and available modules. |
|
|
79
|
+
| `ltbridge prune` | - | Clean up unused modules from your code. |
|
|
80
|
+
|
|
81
|
+
## 🤝 Contributing
|
|
82
|
+
|
|
83
|
+
Got a cool function or utility? We'd love to have it! The system is designed so anyone can easily add new modules without touching complex configs.
|
|
84
|
+
|
|
85
|
+
1. **Fork** the repository.
|
|
86
|
+
2. **Create a folder** in `modules/` (e.g., `modules/@MyCategory/MyFunction`).
|
|
87
|
+
3. **Write your code**:
|
|
88
|
+
- Put your code in `client.lua`, `server.lua`, or `shared.lua`.
|
|
89
|
+
- Write standard EmmyLua comments (`--- @param`, `--- @return`) for intellisense.
|
|
90
|
+
4. **Submit a Pull Request**: We will review and merge it.
|
|
91
|
+
|
|
92
|
+
### 🧠 Smart Annotations (`@ltbridge`)
|
|
93
|
+
|
|
94
|
+
If you are developing modules, you can use special comments to tell the compiler what to do. The compiler reads these, applies them, and then completely deletes the comments from the final build.
|
|
95
|
+
|
|
96
|
+
- `--- @ltbridge export: CustomName` - Change the exported name of the function.
|
|
97
|
+
- `--- @ltbridge alias: AnotherName` - Create an alternative name for the same function.
|
|
98
|
+
- `--- @ltbridge global` - Expose the function directly to the root `LT` object (e.g., `LT.SetResource`).
|
|
99
|
+
- `--- @ltbridge internal` - Marks the module as a "Ghost Module". It runs silently in the background when needed, but doesn't show up in the API or menus.
|
|
100
|
+
|
|
101
|
+
## 🙏 Credits
|
|
102
|
+
|
|
103
|
+
A huge thanks to the **[community_bridge](https://github.com/TheOrderFivem)** project for the inspiration behind some core concepts, and **[luamin.js](https://github.com/Herrtt/luamin.js/)** for the minification engine.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
> **💡 Tip:** To stop your IDE from trying to read the bundled output files (which can cause duplicate intellisense warnings), add this to your VSCode settings (`.vscode/settings.json`):
|
|
107
|
+
> ```json
|
|
108
|
+
> "Lua.workspace.ignoreDir": ["**/ltbridge/modules/**"]
|
|
109
|
+
> ```
|