|
1 | | -# [Rest] ⛱️ |
2 | | - |
3 | | -[Rest]: https://crates.io/crates/BinaryRest |
| 1 | +<table> |
| 2 | +<tr> |
| 3 | +<td align="left" valign="middle"> |
| 4 | +<h3 align="left">Rest</h3> |
| 5 | +</td> |
| 6 | +<td align="left" valign="middle"> |
| 7 | +<h3 align="left">⛱️</h3> |
| 8 | +</td> |
| 9 | +<td align="left" valign="middle"> |
| 10 | +<h3 align="left">+</h3> |
| 11 | +</td> |
| 12 | +<td align="left" valign="middle"> |
| 13 | +<h3 align="left"> |
| 14 | +<a href="https://Editor.Land" target="_blank"> |
| 15 | +<picture> |
| 16 | +<source media="(prefers-color-scheme: dark)" srcset="https://PlayForm.Cloud/Dark/Image/GitHub/Land.svg"> |
| 17 | +<source media="(prefers-color-scheme: light)" srcset="https://PlayForm.Cloud/Image/GitHub/Land.svg"> |
| 18 | +<img width="28" alt="Land Logo" src="https://PlayForm.Cloud/Image/GitHub/Land.svg"> |
| 19 | +</picture> |
| 20 | +</a> |
| 21 | +</h3> |
| 22 | +</td> |
| 23 | +<td align="left" valign="middle"> |
| 24 | +<h3 align="left"> |
| 25 | +<a href="https://Editor.Land" target="_blank"> |
| 26 | +Land |
| 27 | +</a> |
| 28 | +</h3> |
| 29 | +</td> |
| 30 | +<td align="left" valign="middle"> |
| 31 | +<h3 align="left">🏞️</h3> |
| 32 | +</td> |
| 33 | +</tr> |
| 34 | +</table> |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +# **Rest** ⛱️ The JavaScript/TypeScript Bundler for Land 🏞️ |
| 39 | + |
| 40 | +[](https://github.com/CodeEditorLand/Rest/tree/Current/LICENSE) |
| 41 | +[](https://crates.io/crates/Rest) |
| 42 | +[](https://www.rust-lang.org/) |
| 43 | +[](https://swc.rs/) |
| 44 | + |
| 45 | +Welcome to **Rest**, the Rust-based JavaScript/TypeScript bundler and build |
| 46 | +system for the **Land Code Editor**. Rest leverages the SWC (Speedy Web |
| 47 | +Compiler) ecosystem for fast compilation and transformation of JavaScript and |
| 48 | +TypeScript code, with parallel processing via rayon and intelligent watch mode |
| 49 | +support. |
| 50 | + |
| 51 | +**Rest** is engineered to: |
| 52 | + |
| 53 | +1. **Provide Fast Bundling:** Utilize SWC's Rust-based compiler for |
| 54 | + high-performance JavaScript/TypeScript transformation. |
| 55 | +2. **Enable Parallel Processing:** Leverage rayon for multi-threaded file |
| 56 | + processing and build group orchestration. |
| 57 | +3. **Support Watch Mode:** Implement file system watching via notify for |
| 58 | + incremental development builds. |
| 59 | +4. **Integrate with Git:** Provide Git repository operations for version |
| 60 | + tracking and change detection. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Key Features 🔐 |
| 65 | + |
| 66 | +- **SWC Compiler Stack:** Leverages the full SWC ecosystem for fast parsing, |
| 67 | + transformation, and code generation of JavaScript/TypeScript. |
| 68 | +- **Parallel Processing:** Multi-threaded file processing using rayon for |
| 69 | + maximum throughput during builds. |
| 70 | +- **Watch Mode:** File system watching via notify for incremental development |
| 71 | + builds with automatic recompilation. |
| 72 | +- **Build Groups:** Organized build task grouping for complex project structures |
| 73 | + with multiple output targets. |
| 74 | +- **Git Integration:** Built-in Git repository operations for version tracking |
| 75 | + and change detection during builds. |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## Core Architecture Principles 🏗️ |
| 80 | + |
| 81 | +| Principle | Description | Key Components Involved | |
| 82 | +| :--------------------- | :-------------------------------------------------------------------------------------- | :------------------------------------------------ | |
| 83 | +| **Performance** | Utilize Rust and SWC for maximum bundling speed with minimal overhead. | `SWC` compiler stack, `rayon` parallel processing | |
| 84 | +| **Incremental Builds** | Support watch mode for efficient development workflows with only changed files rebuilt. | `notify` file watcher, incremental cache | |
| 85 | +| **Modularity** | Organize builds into groups for clear separation of concerns and output targets. | Build Groups, task orchestration | |
| 86 | +| **Git Awareness** | Integrate with Git for version tracking and change-aware builds. | `git2` crate, change detection | |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +## `Rest` in the Land Ecosystem ⛱️ + 🏞️ |
| 91 | + |
| 92 | +| Component | Role & Key Responsibilities | |
| 93 | +| :------------------------- | :---------------------------------------------------------------------------------------------- | |
| 94 | +| **VSCode Source Consumer** | Reads and transforms VS Code platform code from `Microsoft/VSCode` and `CodeEditorLand/Editor`. | |
| 95 | +| **Output Producer** | Generates bundled JavaScript artifacts consumed by `Cocoon` and `Sky`. | |
| 96 | +| **Build Orchestrator** | Coordinates with `Maintain` for build configuration and execution. | |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Getting Started 🚀 |
| 101 | + |
| 102 | +### Installation |
| 103 | + |
| 104 | +To add `Rest` to your project: |
| 105 | + |
| 106 | +```toml |
| 107 | +[dependencies] |
| 108 | +Rest = { git = "https://github.com/CodeEditorLand/Rest.git", branch = "Current" } |
| 109 | +``` |
4 | 110 |
|
5 | | -## Installation 🚀 |
| 111 | +Or install the CLI: |
6 | 112 |
|
7 | 113 | ```sh |
8 | | -cargo install BinaryRest |
| 114 | +cargo install Rest |
9 | 115 | ``` |
10 | 116 |
|
11 | | -## 🛠️ Usage |
| 117 | +**Key Dependencies:** |
12 | 118 |
|
13 | | -``` |
14 | | -Rest ⛱️ |
| 119 | +- `swc_*` crates: SWC compiler stack for JavaScript/TypeScript transformation |
| 120 | +- `rayon`: Parallel processing for multi-threaded builds |
| 121 | +- `notify`: File system watching for watch mode |
| 122 | +- `git2`: Git repository operations |
| 123 | +- `clap`: CLI argument parsing |
15 | 124 |
|
16 | | -Usage: Rest [OPTIONS] |
| 125 | +### Usage Pattern |
17 | 126 |
|
18 | | -Options: |
19 | | - -P, --Parallel Parallel ⏩ |
20 | | - -R, --Root <ROOT> Root 📂 [default: .] |
21 | | - -E, --Exclude <EXCLUDE> Exclude 🚫 [default: node_modules] |
22 | | - --Pattern <PATTERN> Pattern 🔍 [default: .] |
23 | | - -h, --help Print help |
24 | | - -V, --version Print version |
25 | | -``` |
| 127 | +`Rest` is typically invoked through the build system: |
26 | 128 |
|
27 | | -## Options |
| 129 | +```sh |
| 130 | +# Run bundling with environment variables |
| 131 | +pnpm cross-env \ |
| 132 | + NODE_ENV=development \ |
| 133 | + Bundle=true \ |
| 134 | + Compile=false \ |
| 135 | + pnpm tauri build |
| 136 | +``` |
28 | 137 |
|
29 | | -The [Rest] tool can be used with various options: |
| 138 | +--- |
30 | 139 |
|
31 | | -#### --Exclude or -E: |
| 140 | +## Overview |
32 | 141 |
|
33 | | -Exclude certain files or directories. |
| 142 | +Rest is a Rust-based JavaScript/TypeScript bundler and build system CLI tool. It |
| 143 | +leverages the SWC (Speedy Web Compiler) ecosystem for fast compilation and |
| 144 | +transformation of JavaScript and TypeScript code. |
34 | 145 |
|
35 | | -Default is: |
| 146 | +## Installation 🚀 |
36 | 147 |
|
37 | 148 | ```sh |
38 | | -Rest -P -E node_modules |
| 149 | +cargo install Rest |
39 | 150 | ``` |
40 | 151 |
|
41 | | -#### --Parallel or -P: |
42 | | - |
43 | | -Run processing in parallel. |
| 152 | +## 🛠️ Usage |
44 | 153 |
|
45 | | -Default is: |
| 154 | +Rest uses a command structure based on `Struct::Binary::Command` pattern. The |
| 155 | +main entry point executes via: |
46 | 156 |
|
47 | | -```sh |
48 | | -Rest |
| 157 | +```rust |
| 158 | +#[tokio::main] |
| 159 | +async fn main() { |
| 160 | + (Struct::Binary::Command::Struct::Fn().Fn)().await |
| 161 | +} |
49 | 162 | ``` |
50 | 163 |
|
51 | | -#### --Pattern: |
| 164 | +--- |
52 | 165 |
|
53 | | -Specify a custom pattern for matching. |
| 166 | +## System Architecture Diagram 🏗️ |
54 | 167 |
|
55 | | -Default is: |
| 168 | +This diagram illustrates `Rest`'s role in the Land build pipeline. |
56 | 169 |
|
57 | | -```sh |
58 | | -Rest -P --Pattern . |
59 | | -``` |
| 170 | +```mermaid |
| 171 | +graph LR |
| 172 | +classDef rest fill:#f9f,stroke:#333,stroke-width:2px; |
| 173 | +classDef source fill:#ddd,stroke:#666,stroke-dasharray: 5 5; |
| 174 | +classDef output fill:#9cf,stroke:#333,stroke-width:2px; |
60 | 175 |
|
61 | | -#### --Root or -R: |
| 176 | +subgraph "Input Sources" |
| 177 | +VSCodeSource["VS Code Source"]:::source |
| 178 | +SkySource["Sky Source Files"]:::source |
| 179 | +end |
62 | 180 |
|
63 | | -Set the current working directory to a different folder. |
| 181 | +subgraph "Rest ⛱️ (Bundler)" |
| 182 | +SWCCompiler["SWC Compiler"]:::rest |
| 183 | +ParallelProc["Parallel Processor (rayon)"]:::rest |
| 184 | +WatchMode["Watch Mode (notify)"]:::rest |
| 185 | +BuildGroups["Build Groups"]:::rest |
64 | 186 |
|
65 | | -Default is: |
| 187 | +SWCCompiler --> ParallelProc |
| 188 | +ParallelProc --> BuildGroups |
| 189 | +WatchMode -.-> SWCCompiler |
| 190 | +end |
66 | 191 |
|
67 | | -```sh |
68 | | -Rest -P --Root . |
| 192 | +subgraph "Output" |
| 193 | +OutputBundle["Output Bundle"]:::output |
| 194 | +end |
| 195 | +
|
| 196 | +VSCodeSource --> SWCCompiler |
| 197 | +SkySource --> SWCCompiler |
| 198 | +BuildGroups --> OutputBundle |
69 | 199 | ``` |
70 | 200 |
|
71 | | -## Examples |
| 201 | +--- |
| 202 | + |
| 203 | +## Features 🔐 |
| 204 | + |
| 205 | +- **Parallel Processing**: Multi-threaded file processing using rayon |
| 206 | +- **SWC Integration**: Fast JavaScript/TypeScript compilation via SWC crates |
| 207 | +- **Watch Mode**: File system watching for development |
| 208 | +- **Git Integration**: Git repository operations support |
| 209 | +- **Build Groups**: Organized build task grouping |
72 | 210 |
|
73 | 211 | ## Dependencies |
74 | 212 |
|
75 | 213 | [Rest] relies on several Rust crates to provide its functionality: |
76 | 214 |
|
77 | | -- `clap` - For parsing command-line arguments. |
78 | | -- `futures` - For asynchronous programming abstractions. |
79 | | -- `git2` - For `Git` repository operations. |
80 | | -- `num_cpus` - For determining the number of CPUs for parallel processing. |
81 | | -- `rayon` - For parallel processing. |
82 | | -- `regex` - For pattern matching and text manipulation. |
83 | | -- `tokio` - For asynchronous runtime. |
84 | | -- `walkdir` - For efficient filesystem traversal. |
| 215 | +### Core Dependencies |
| 216 | + |
| 217 | +- `clap` - For parsing command-line arguments |
| 218 | +- `tokio` - Asynchronous runtime |
| 219 | +- `futures` - Asynchronous programming abstractions |
| 220 | +- `rayon` / `par-core` - Parallel processing |
85 | 221 |
|
86 | | -[Rest]: https://crates.io/crates/psummary |
| 222 | +### SWC Compiler Stack |
| 223 | + |
| 224 | +- `swc_common` - Common utilities for SWC |
| 225 | +- `swc_ecma_ast` - ECMAScript AST definitions |
| 226 | +- `swc_ecma_parser` - JavaScript/TypeScript parser |
| 227 | +- `swc_ecma_codegen` - Code generation |
| 228 | +- `swc_ecma_transforms_base` - Base transforms |
| 229 | +- `swc_ecma_transforms_proposal` - JavaScript proposal transforms |
| 230 | +- `swc_ecma_transforms_typescript` - TypeScript transforms |
| 231 | +- `swc_ecma_visit` - AST visitor traits |
| 232 | + |
| 233 | +### Additional Tools |
| 234 | + |
| 235 | +- `git2` - Git repository operations |
| 236 | +- `num_cpus` - CPU count detection |
| 237 | +- `regex` - Pattern matching |
| 238 | +- `walkdir` / `globset` - Filesystem traversal |
| 239 | +- `notify` - File system watching |
| 240 | +- `chrono` - Date/time handling |
| 241 | +- `serde` / `serde_json` - Serialization |
| 242 | + |
| 243 | +[Rest]: https://crates.io/crates/Rest |
| 244 | + |
| 245 | +--- |
| 246 | + |
| 247 | +## Deep Dive & Component Breakdown 🔬 |
| 248 | + |
| 249 | +To understand how `Rest`'s internal components interact to provide the |
| 250 | +JavaScript/TypeScript bundling functionality, see the following source files: |
| 251 | + |
| 252 | +- **[`Source/`](Source/)** - Main bundler implementation with SWC integration |
| 253 | +- **[`Source/Build/`](Source/Build/)** - Build group orchestration and task |
| 254 | + management |
| 255 | +- **[`Source/Watch/`](Source/Watch/)** - File system watching for development |
| 256 | + mode |
| 257 | + |
| 258 | +The source files explain the SWC compiler stack integration, parallel processing |
| 259 | +with rayon, and the build group configuration system. |
| 260 | + |
| 261 | +--- |
87 | 262 |
|
88 | 263 | ## Changelog |
89 | 264 |
|
90 | | -See [`CHANGELOG.md`](https://github.com/CodeEditorLand/Rest/tree/Current/) for a history of changes to this CLI. |
| 265 | +See [`CHANGELOG.md`](https://github.com/CodeEditorLand/Rest/tree/Current/) for a |
| 266 | +history of changes to this CLI. |
| 267 | + |
| 268 | +## License ⚖️ |
| 269 | + |
| 270 | +This project is released into the public domain under the **Creative Commons CC0 |
| 271 | +Universal** license. You are free to use, modify, distribute, and build upon |
| 272 | +this work for any purpose, without any restrictions. For the full legal text, |
| 273 | +see the [`LICENSE`](https://github.com/CodeEditorLand/Rest/tree/Current/) file. |
| 274 | + |
| 275 | +--- |
| 276 | + |
| 277 | +## Changelog 📜 |
| 278 | + |
| 279 | +Stay updated with our progress! See |
| 280 | +[`CHANGELOG.md`](https://github.com/CodeEditorLand/Rest/tree/Current/) for a |
| 281 | +history of changes specific to **Rest**. |
| 282 | + |
| 283 | +--- |
91 | 284 |
|
92 | | -## Funding |
| 285 | +## Funding & Acknowledgements 🙏🏻 |
93 | 286 |
|
94 | | -This project is funded through |
95 | | -[NGI0 Commons Fund](https://NLnet.NL/commonsfund), a fund established by |
| 287 | +**Rest** is a core element of the **Land** ecosystem. This project is funded |
| 288 | +through [NGI0 Commons Fund](https://NLnet.NL/commonsfund), a fund established by |
96 | 289 | [NLnet](https://NLnet.NL) with financial support from the European Commission's |
97 | 290 | [Next Generation Internet](https://ngi.eu) program. Learn more at the |
98 | 291 | [NLnet project page](https://NLnet.NL/project/Land). |
99 | 292 |
|
100 | | -| Land | PlayForm | NLnet | NGI0 Commons Fund | |
101 | | -| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | |
102 | | -| [<img src="https://raw.githubusercontent.com/CodeEditorLand/Asset/refs/heads/Current/Logo/Land.svg" height="80px" alt="Land" />](https://Editor.Land) | [<img src="https://raw.githubusercontent.com/PlayForm/Asset/refs/heads/Current/Logo/PlayForm.svg" height="80px" alt="PlayForm" />](https://PlayForm.Cloud) | [<img width="240px" src="https://NLnet.NL/logo/banner.svg" alt="NLnet" />](https://NLnet.NL) | [<img width="240px" src="https://NLnet.NL/image/logos/NGI0CommonsFund_tag_black_mono.svg" alt="NGI0 Commons Fund" />](https://NLnet.NL/commonsfund) | |
| 293 | +<table> |
| 294 | +<thead> |
| 295 | +<tr> |
| 296 | +<th align="left"><strong>Land</strong></th> |
| 297 | +<th align="left"><strong>PlayForm</strong></th> |
| 298 | +<th align="left"><strong>NLnet</strong></th> |
| 299 | +<th align="left"><strong>NGI0 Commons Fund</strong></th> |
| 300 | +</tr> |
| 301 | +</thead> |
| 302 | +<tbody> |
| 303 | +<tr> |
| 304 | +<td align="left" valign="middle"> |
| 305 | +<a href="https://Editor.Land"> |
| 306 | +<img width="60" src="https://raw.githubusercontent.com/CodeEditorLand/Asset/refs/heads/Current/Logo/Land.svg" alt="Land"> |
| 307 | +</a> |
| 308 | +</td> |
| 309 | +<td align="left" valign="middle"> |
| 310 | +<a href="https://PlayForm.Cloud"> |
| 311 | +<img width="76" src="https://raw.githubusercontent.com/PlayForm/Asset/refs/heads/Current/Logo/PlayForm.svg" alt="PlayForm"> |
| 312 | +</a> |
| 313 | +</td> |
| 314 | +<td align="left" valign="middle"> |
| 315 | +<a href="https://NLnet.NL"> |
| 316 | +<img width="240" src="https://NLnet.NL/logo/banner.svg" alt="NLnet"> |
| 317 | +</a> |
| 318 | +</td> |
| 319 | +<td align="left" valign="middle"> |
| 320 | +<a href="https://NLnet.NL/commonsfund"> |
| 321 | +<img width="240" src="https://NLnet.NL/image/logos/NGI0CommonsFund_tag_black_mono.svg" alt="NGI0 Commons Fund"> |
| 322 | +</a> |
| 323 | +</td> |
| 324 | +</tr> |
| 325 | +</tbody> |
| 326 | +</table> |
| 327 | + |
| 328 | +--- |
| 329 | + |
| 330 | +**Project Maintainers**: Source Open |
| 331 | +([Source/Open@Editor.Land](mailto:Source/Open@Editor.Land)) | |
| 332 | +[GitHub Repository](https://github.com/CodeEditorLand/Rest) | |
| 333 | +[Report an Issue](https://github.com/CodeEditorLand/Rest/issues) | |
| 334 | +[Security Policy](https://github.com/CodeEditorLand/Rest/security/policy) |
0 commit comments