├── rustle ├── src │ └── lib.rs └── Cargo.toml ├── Cargo.toml ├── rustle_cli ├── src │ └── main.rs └── Cargo.toml ├── .gitignore ├── .github └── workflows │ └── rust.yml ├── README.md ├── LICENSE.md └── Cargo.lock /rustle/src/lib.rs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = ["rustle", "rustle_cli"] -------------------------------------------------------------------------------- /rustle_cli/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | todo!() 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /locate_character/target 3 | .idea 4 | .vscode 5 | .prettierrc 6 | *.code-workspace 7 | /examples/target 8 | /examples/*/target 9 | /examples/*/Cargo.lock 10 | /examples/Cargo.lock -------------------------------------------------------------------------------- /rustle/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rustle" 3 | version = "0.1.5" 4 | authors = ["pintariching"] 5 | license = "MIT" 6 | description = "A Svelte-like compiler written in Rust." 7 | readme = "../README.md" 8 | homepage = "https://github.com/pintariching/rustle" 9 | repository = "https://github.com/pintariching/rustle" 10 | keywords = ["svelte", "rust", "compiler", "cli"] 11 | edition = "2021" 12 | 13 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 14 | 15 | [dependencies] 16 | -------------------------------------------------------------------------------- /rustle_cli/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rustle_cli" 3 | version = "0.1.3" 4 | authors = ["pintariching"] 5 | license = "MIT" 6 | description = "The Rustle CLI" 7 | readme = "../README.md" 8 | homepage = "https://github.com/pintariching/rustle" 9 | repository = "https://github.com/pintariching/rustle" 10 | keywords = ["svelte", "rust", "compiler", "cli"] 11 | edition = "2021" 12 | 13 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 14 | 15 | [dependencies] 16 | clap = { version = "4.2.7", features = ["derive"] } 17 | serde_json = "1.0.96" 18 | 19 | [[bin]] 20 | name = "rustle" 21 | path = "src/main.rs" -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - uses: actions/cache@v3 20 | with: 21 | path: | 22 | ~/.cargo/bin/ 23 | ~/.cargo/registry/index/ 24 | ~/.cargo/registry/cache/ 25 | ~/.cargo/git/db/ 26 | target/ 27 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 28 | - name: Build 29 | run: cargo build --verbose 30 | - name: Run tests 31 | run: cargo test --verbose 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rustle 2 | 3 | A Svelte-like compiler, written in rust. 4 | 5 | ## Work in progress 6 | 7 | # Getting started 8 | 9 | ### Installation 10 | 11 | To install with cargo, run `cargo install rustle_cli` to install the CLI. 12 | 13 | ### Using rustle_cli 14 | 15 | 20 | 21 | # Development 22 | 23 | ## License 24 | 25 | This project is licensed under the MIT License - see the LICENSE.md file for details 26 | 27 | ## Acknowledgments 28 | 29 | * A big thank you to [lihautan](https://www.youtube.com/c/lihautan) on Youtube, for making the video series [Build your own Svelte](https://www.youtube.com/watch?v=mwvyKGw2CzU) which helped me a lot in understanding how the Svelte compiler actually works! 30 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 pintariching 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "anstream" 7 | version = "0.3.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" 10 | dependencies = [ 11 | "anstyle", 12 | "anstyle-parse", 13 | "anstyle-query", 14 | "anstyle-wincon", 15 | "colorchoice", 16 | "is-terminal", 17 | "utf8parse", 18 | ] 19 | 20 | [[package]] 21 | name = "anstyle" 22 | version = "1.0.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" 25 | 26 | [[package]] 27 | name = "anstyle-parse" 28 | version = "0.2.0" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" 31 | dependencies = [ 32 | "utf8parse", 33 | ] 34 | 35 | [[package]] 36 | name = "anstyle-query" 37 | version = "1.0.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" 40 | dependencies = [ 41 | "windows-sys", 42 | ] 43 | 44 | [[package]] 45 | name = "anstyle-wincon" 46 | version = "1.0.1" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" 49 | dependencies = [ 50 | "anstyle", 51 | "windows-sys", 52 | ] 53 | 54 | [[package]] 55 | name = "bitflags" 56 | version = "1.3.2" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 59 | 60 | [[package]] 61 | name = "cc" 62 | version = "1.0.79" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 65 | 66 | [[package]] 67 | name = "clap" 68 | version = "4.2.7" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938" 71 | dependencies = [ 72 | "clap_builder", 73 | "clap_derive", 74 | "once_cell", 75 | ] 76 | 77 | [[package]] 78 | name = "clap_builder" 79 | version = "4.2.7" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" 82 | dependencies = [ 83 | "anstream", 84 | "anstyle", 85 | "bitflags", 86 | "clap_lex", 87 | "strsim", 88 | ] 89 | 90 | [[package]] 91 | name = "clap_derive" 92 | version = "4.2.0" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" 95 | dependencies = [ 96 | "heck", 97 | "proc-macro2", 98 | "quote", 99 | "syn", 100 | ] 101 | 102 | [[package]] 103 | name = "clap_lex" 104 | version = "0.4.1" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" 107 | 108 | [[package]] 109 | name = "colorchoice" 110 | version = "1.0.0" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 113 | 114 | [[package]] 115 | name = "errno" 116 | version = "0.3.1" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 119 | dependencies = [ 120 | "errno-dragonfly", 121 | "libc", 122 | "windows-sys", 123 | ] 124 | 125 | [[package]] 126 | name = "errno-dragonfly" 127 | version = "0.1.2" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 130 | dependencies = [ 131 | "cc", 132 | "libc", 133 | ] 134 | 135 | [[package]] 136 | name = "heck" 137 | version = "0.4.1" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 140 | 141 | [[package]] 142 | name = "hermit-abi" 143 | version = "0.3.1" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" 146 | 147 | [[package]] 148 | name = "io-lifetimes" 149 | version = "1.0.10" 150 | source = "registry+https://github.com/rust-lang/crates.io-index" 151 | checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" 152 | dependencies = [ 153 | "hermit-abi", 154 | "libc", 155 | "windows-sys", 156 | ] 157 | 158 | [[package]] 159 | name = "is-terminal" 160 | version = "0.4.7" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" 163 | dependencies = [ 164 | "hermit-abi", 165 | "io-lifetimes", 166 | "rustix", 167 | "windows-sys", 168 | ] 169 | 170 | [[package]] 171 | name = "itoa" 172 | version = "1.0.6" 173 | source = "registry+https://github.com/rust-lang/crates.io-index" 174 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 175 | 176 | [[package]] 177 | name = "libc" 178 | version = "0.2.144" 179 | source = "registry+https://github.com/rust-lang/crates.io-index" 180 | checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" 181 | 182 | [[package]] 183 | name = "linux-raw-sys" 184 | version = "0.3.7" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f" 187 | 188 | [[package]] 189 | name = "once_cell" 190 | version = "1.17.1" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" 193 | 194 | [[package]] 195 | name = "proc-macro2" 196 | version = "1.0.56" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" 199 | dependencies = [ 200 | "unicode-ident", 201 | ] 202 | 203 | [[package]] 204 | name = "quote" 205 | version = "1.0.27" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" 208 | dependencies = [ 209 | "proc-macro2", 210 | ] 211 | 212 | [[package]] 213 | name = "rustix" 214 | version = "0.37.19" 215 | source = "registry+https://github.com/rust-lang/crates.io-index" 216 | checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" 217 | dependencies = [ 218 | "bitflags", 219 | "errno", 220 | "io-lifetimes", 221 | "libc", 222 | "linux-raw-sys", 223 | "windows-sys", 224 | ] 225 | 226 | [[package]] 227 | name = "rustle" 228 | version = "0.1.5" 229 | 230 | [[package]] 231 | name = "rustle_cli" 232 | version = "0.1.3" 233 | dependencies = [ 234 | "clap", 235 | "serde_json", 236 | ] 237 | 238 | [[package]] 239 | name = "ryu" 240 | version = "1.0.13" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 243 | 244 | [[package]] 245 | name = "serde" 246 | version = "1.0.163" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" 249 | 250 | [[package]] 251 | name = "serde_json" 252 | version = "1.0.96" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" 255 | dependencies = [ 256 | "itoa", 257 | "ryu", 258 | "serde", 259 | ] 260 | 261 | [[package]] 262 | name = "strsim" 263 | version = "0.10.0" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 266 | 267 | [[package]] 268 | name = "syn" 269 | version = "2.0.15" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" 272 | dependencies = [ 273 | "proc-macro2", 274 | "quote", 275 | "unicode-ident", 276 | ] 277 | 278 | [[package]] 279 | name = "unicode-ident" 280 | version = "1.0.8" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" 283 | 284 | [[package]] 285 | name = "utf8parse" 286 | version = "0.2.1" 287 | source = "registry+https://github.com/rust-lang/crates.io-index" 288 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 289 | 290 | [[package]] 291 | name = "windows-sys" 292 | version = "0.48.0" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 295 | dependencies = [ 296 | "windows-targets", 297 | ] 298 | 299 | [[package]] 300 | name = "windows-targets" 301 | version = "0.48.0" 302 | source = "registry+https://github.com/rust-lang/crates.io-index" 303 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 304 | dependencies = [ 305 | "windows_aarch64_gnullvm", 306 | "windows_aarch64_msvc", 307 | "windows_i686_gnu", 308 | "windows_i686_msvc", 309 | "windows_x86_64_gnu", 310 | "windows_x86_64_gnullvm", 311 | "windows_x86_64_msvc", 312 | ] 313 | 314 | [[package]] 315 | name = "windows_aarch64_gnullvm" 316 | version = "0.48.0" 317 | source = "registry+https://github.com/rust-lang/crates.io-index" 318 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 319 | 320 | [[package]] 321 | name = "windows_aarch64_msvc" 322 | version = "0.48.0" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 325 | 326 | [[package]] 327 | name = "windows_i686_gnu" 328 | version = "0.48.0" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 331 | 332 | [[package]] 333 | name = "windows_i686_msvc" 334 | version = "0.48.0" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 337 | 338 | [[package]] 339 | name = "windows_x86_64_gnu" 340 | version = "0.48.0" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 343 | 344 | [[package]] 345 | name = "windows_x86_64_gnullvm" 346 | version = "0.48.0" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 349 | 350 | [[package]] 351 | name = "windows_x86_64_msvc" 352 | version = "0.48.0" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 355 | --------------------------------------------------------------------------------