modcrawl 0.10.2 → 0.11.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.
- package/README.md +100 -238
- package/modcrawl.d.ts +8 -22
- package/modcrawl.js +58 -42
- package/modcrawl_bg.wasm +0 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,302 +1,164 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="./web/static/readme/banner.png" alt="Modcrawl banner" />
|
|
2
4
|
|
|
3
5
|
[](https://crates.io/crates/modcrawl)
|
|
6
|
+
[](https://docs.rs/modcrawl)
|
|
7
|
+
[](https://www.npmjs.com/package/modcrawl)
|
|
4
8
|
[](https://github.com/SirCesarium/modcrawl/actions)
|
|
5
|
-
[]()
|
|
9
|
+
[](https://github.com/SirCesarium/modcrawl/blob/main/LICENSE)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
</div>
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
modcrawl type MyMod.jar # → Fabric
|
|
11
|
-
modcrawl metadata MyMod.jar # mod name, version, authors, license
|
|
12
|
-
modcrawl metadata MyMod.jar --json # same, as JSON
|
|
13
|
-
modcrawl deps MyMod.jar # dependencies with version ranges
|
|
14
|
-
modcrawl deps MyMod.jar --include-jar-in-jar # include embedded JARs
|
|
15
|
-
modcrawl classes MyMod.jar # list .class files
|
|
16
|
-
modcrawl grep "func_" MyMod.jar # search constant pool
|
|
17
|
-
modcrawl mixins MyMod.jar # extract @Mixin targets
|
|
18
|
-
modcrawl dupes a.jar b.jar c.jar # find duplicate classes
|
|
19
|
-
```
|
|
13
|
+
Analyze **Minecraft mods and plugins** to find out which loader they belong to, which dependencies they have, and even **inspect their byte code** to find out **why your modpack is crashing**.
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
cat *.jar | modcrawl type # detect many at once
|
|
23
|
-
modcrawl deps *.jar # per-file, continues on error
|
|
24
|
-
modcrawl grep "net/minecraft/world" *.jar --quiet # which mods reference a class
|
|
25
|
-
modcrawl mixins *.jar --quiet # which jars have mixins
|
|
26
|
-
modcrawl dupes *.jar --json # JSON of all class dupes
|
|
27
|
-
```
|
|
15
|
+
## What is `modcrawl`
|
|
28
16
|
|
|
29
|
-
|
|
17
|
+
`modcrawl` is an all-in-one **Minecraft utility** as a **CLI**, a **Rust library**, and an **npm package** designed to **help modpackers** and **server admins** to inspect, organize, and debug modpacks without the headache.
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
It helps you quickly answer the everyday questions that pop up while building or fixing a modpack:
|
|
32
20
|
|
|
33
|
-
|
|
21
|
+
- **Clean up mixed mod loaders:** Easily spot and remove leftover Fabric mods in a NeoForge modpack (like when **moving away from Sinytra Connector**).
|
|
22
|
+
- **Separate Client, Server, and Both:** Quickly **identify client-only mods** mixed into a **server folder** so you can purge them before launching.
|
|
23
|
+
- **Find the culprit behind cryptic crashes:** When a crash log gives you an obfuscated Java method call but doesn't mention which mod broke, trace references directly back to the offending JAR.
|
|
24
|
+
- **Catch conflicts before they happen:** Identify duplicate classes or overlapping mixin targets across multiple mods that might collide on startup.
|
|
25
|
+
- **Inspect metadata instantly:** Check mod loaders, dependencies, versions, and internal file lists without manually unzipping every JAR.
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|--------|---------------|-----------------|
|
|
37
|
-
| Fabric | `fabric.mod.json` | JSON |
|
|
38
|
-
| Forge (mods.toml) | `META-INF/mods.toml` | TOML |
|
|
39
|
-
| NeoForge | `META-INF/neoforge.mods.toml` | TOML |
|
|
40
|
-
| Forge (mcmod.info) | `mcmod.info` | JSON |
|
|
41
|
-
| Bukkit / Spigot | `plugin.yml` | YAML |
|
|
42
|
-
| Paper | `paper-plugin.yml` | YAML |
|
|
27
|
+
### Example of `modcrawl`'s output
|
|
43
28
|
|
|
44
|
-
|
|
29
|
+
<div align="center">
|
|
45
30
|
|
|
46
|
-
|
|
31
|
+

|
|
47
32
|
|
|
48
|
-
|
|
49
|
-
cargo install modcrawl
|
|
50
|
-
```
|
|
33
|
+
</div>
|
|
51
34
|
|
|
52
|
-
Or download a prebuilt binary from [GitHub Releases](https://github.com/SirCesarium/modcrawl/releases) — the `modcrawl.h` header is shipped as a standalone asset (not inside archives).
|
|
53
35
|
|
|
54
|
-
##
|
|
36
|
+
## Quickstart
|
|
55
37
|
|
|
56
38
|
```bash
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```rust
|
|
61
|
-
use modcrawl::core::identify::identify;
|
|
62
|
-
use modcrawl::core::metadata::read_metadata;
|
|
63
|
-
use modcrawl::core::dep::analyze;
|
|
64
|
-
|
|
65
|
-
let mod_type = identify("MyMod.jar".as_ref())?;
|
|
39
|
+
# Detect mod loader
|
|
40
|
+
modcrawl type MyMod.jar
|
|
66
41
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
println!("{}", serde_json::to_string(&meta)?); // JSON
|
|
42
|
+
# Inspect metadata and dependencies
|
|
43
|
+
modcrawl deps MyMod.jar
|
|
70
44
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
println!(" {} {}", dep.kind.marker(), dep.name);
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Reader variants for in-memory buffers:
|
|
45
|
+
# Find duplicate classes causing conflicts
|
|
46
|
+
modcrawl dupes *.jar
|
|
78
47
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
use modcrawl::core::identify::identify_reader;
|
|
82
|
-
use modcrawl::core::metadata::read_metadata_reader;
|
|
83
|
-
use modcrawl::core::dep::analyze_reader;
|
|
84
|
-
|
|
85
|
-
let data = std::fs::read("MyMod.jar")?;
|
|
86
|
-
let mut cursor = Cursor::new(&data[..]);
|
|
87
|
-
let mod_type = identify_reader(&mut cursor)?;
|
|
48
|
+
# Search for obfuscated method references across all JARs
|
|
49
|
+
modcrawl grep "net/minecraft/world" *.jar --quiet
|
|
88
50
|
```
|
|
89
51
|
|
|
90
|
-
##
|
|
91
|
-
|
|
92
|
-
Dependencies are deduplicated by name. When the same dependency appears with different kinds (e.g. `depends` + `recommends`), the higher-priority kind wins:
|
|
93
|
-
|
|
94
|
-
Required > LoadBefore > Optional > Recommended > Suggested
|
|
52
|
+
## TL;DR - Shut up and let me download
|
|
95
53
|
|
|
96
|
-
|
|
54
|
+
The binaries are uploaded into the [releases](https://github.com/SirCesarium/modcrawl/releases) section of the GitHub repository. You can download the latest version of `modcrawl` for your platform from there.
|
|
97
55
|
|
|
98
|
-
|
|
56
|
+
### Quick downloads
|
|
99
57
|
|
|
100
|
-
|
|
58
|
+
<div align="center">
|
|
101
59
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
| `modcrawl_metadata(path)` | Human-readable metadata |
|
|
107
|
-
| `modcrawl_metadata_json(path)` | JSON metadata |
|
|
108
|
-
| `modcrawl_metadata_bytes(data, len)` | Human-readable metadata |
|
|
109
|
-
| `modcrawl_metadata_json_bytes(data, len)` | JSON metadata |
|
|
110
|
-
| `modcrawl_deps(path, include_jij)` | Human-readable deps |
|
|
111
|
-
| `modcrawl_deps_json(path, include_jij)` | JSON deps |
|
|
112
|
-
| `modcrawl_deps_bytes(data, len, include_jij)` | Human-readable deps |
|
|
113
|
-
| `modcrawl_deps_json_bytes(data, len, include_jij)` | JSON deps |
|
|
114
|
-
| `modcrawl_classes_json(path)` | JSON list of .class files |
|
|
115
|
-
| `modcrawl_grep_json(path, pattern)` | JSON grep matches |
|
|
116
|
-
| `modcrawl_mixins_json(path)` | JSON list of mixin targets |
|
|
117
|
-
| `modcrawl_dupes_json(paths)` | JSON list of duplicate classes |
|
|
118
|
-
| `modcrawl_free_string(s)` | — (frees returned strings) |
|
|
60
|
+
<a href="https://github.com/SirCesarium/modcrawl/releases/download/v0.11.2/modcrawl-0.11.2-x86_64.msi"><img src="./web/static/readme/windows.png" alt="Modcrawl Windows installer"></a>
|
|
61
|
+
<a href="https://github.com/SirCesarium/modcrawl/releases/download/v0.11.2/modcrawl_0.11.2-1_amd64.deb"><img src="./web/static/readme/debian.png" alt="Modcrawl Debian package"></a>
|
|
62
|
+
<a href="https://github.com/SirCesarium/modcrawl/releases/download/v0.11.2/modcrawl-0.11.2-1.x86_64.rpm"><img src="./web/static/readme/fedora.png" alt="Modcrawl Fedora package"></a>
|
|
63
|
+
<a href="https://github.com/SirCesarium/modcrawl/releases/download/v0.11.2/modcrawl-macos-arm64"><img src="./web/static/readme/macos.png" alt="Modcrawl macOS binary"></a>
|
|
119
64
|
|
|
120
|
-
|
|
121
|
-
which every published library is built with. `modcrawl_dupes_json` takes a
|
|
122
|
-
null-terminated `char *const *paths` — the canonical call passes a
|
|
123
|
-
`char *paths[]` array:
|
|
65
|
+
</div>
|
|
124
66
|
|
|
125
|
-
|
|
126
|
-
#include "modcrawl.h"
|
|
67
|
+
The Windows, Debian, and Fedora buttons download installers; macOS downloads the standalone binary. If you have an uncommon architecture (like `Linux ARM64`) you can check the [releases](https://github.com/SirCesarium/modcrawl/releases) page.
|
|
127
68
|
|
|
128
|
-
|
|
129
|
-
if (type) {
|
|
130
|
-
printf("Type: %s\n", type);
|
|
131
|
-
modcrawl_free_string(type);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Metadata as JSON
|
|
135
|
-
char *json = modcrawl_metadata_json("/path/to/MyMod.jar");
|
|
136
|
-
if (json) {
|
|
137
|
-
printf("%s\n", json);
|
|
138
|
-
modcrawl_free_string(json);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Duplicate classes across JARs
|
|
142
|
-
char *paths[] = {"/path/to/a.jar", "/path/to/b.jar", NULL};
|
|
143
|
-
char *dupes = modcrawl_dupes_json(paths);
|
|
144
|
-
if (dupes) {
|
|
145
|
-
printf("%s\n", dupes);
|
|
146
|
-
modcrawl_free_string(dupes);
|
|
147
|
-
}
|
|
148
|
-
```
|
|
69
|
+
Or even check the [Installation](#installation) section.
|
|
149
70
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- **Ownership**: every string-returning function hands you a null-terminated C
|
|
153
|
-
string that must be freed with `modcrawl_free_string` — never with `free()`,
|
|
154
|
-
the allocation belongs to Rust's allocator. Passing `NULL` to
|
|
155
|
-
`modcrawl_free_string` is a no-op.
|
|
156
|
-
- **Errors**: `NULL` means an error occurred, and the reason is printed to
|
|
157
|
-
stderr. A zero-length buffer is also an error.
|
|
158
|
-
- **Interior NULs**: mod metadata can legally contain a NUL character. These
|
|
159
|
-
are replaced with U+FFFD so a crafted JAR can never turn a successful parse
|
|
160
|
-
into an error return.
|
|
161
|
-
- **Paths**: `modcrawl_dupes_json` requires valid UTF-8 paths; one that is not
|
|
162
|
-
is an error, not a silently skipped JAR.
|
|
163
|
-
- **Thread safety**: every function may be called concurrently from any thread.
|
|
164
|
-
- **Panics**: contained. A panic inside the parser is reported on stderr and
|
|
165
|
-
surfaces as `NULL` instead of aborting your process.
|
|
166
|
-
|
|
167
|
-
### Using the header
|
|
168
|
-
|
|
169
|
-
The `modcrawl.h` header ships as a release asset and inside every library
|
|
170
|
-
archive. It compiles as both C and C++, and is generated by
|
|
171
|
-
[cbindgen](https://github.com/mozilla/cbindgen) from `cbindgen.toml`:
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
cbindgen --config cbindgen.toml --crate modcrawl --output modcrawl.h
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
CI verifies on every push that the header compiles as C and C++ with
|
|
178
|
-
`-Wall -Wextra -Werror`, that it matches the symbols each library actually
|
|
179
|
-
exports, and that a C smoke test runs end to end (`tests/ffi/smoke.c`).
|
|
71
|
+
## Supported loaders
|
|
180
72
|
|
|
181
|
-
|
|
182
|
-
yourself with `--no-default-features`, the `classfile` feature (and with it
|
|
183
|
-
`modcrawl_classes_json`, `modcrawl_grep_json`, `modcrawl_mixins_json` and
|
|
184
|
-
`modcrawl_dupes_json`) is compiled out — the library exports 11 symbols while
|
|
185
|
-
the header declares 15. Every library we publish is built with the default
|
|
186
|
-
features, so this only bites source builds; CI pins the contract so it cannot
|
|
187
|
-
drift silently.
|
|
73
|
+
These are the loaders that `modcrawl` currently supports.
|
|
188
74
|
|
|
189
|
-
|
|
190
|
-
(`libmodcrawl.a`). Rust drops the cdylib on static-by-default targets and the
|
|
191
|
-
musl toolchain used in CI cannot link a shared object. Every other ABI ships
|
|
192
|
-
both a static and a shared library.
|
|
75
|
+
*Feel free to contribute to the list while opening a **Pull request**!* ❤️
|
|
193
76
|
|
|
194
|
-
|
|
77
|
+
| Loader | Status | Type |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| NeoForge | ✅ | Mods |
|
|
80
|
+
| Fabric | ✅ | Mods |
|
|
81
|
+
| Forge | ✅ | Mods |
|
|
82
|
+
| Forge (legacy `<1.12`) | ✅ | Mods |
|
|
83
|
+
| Quilt | ✅ | Mods |
|
|
84
|
+
| Bukkit | ✅ | Plugins |
|
|
85
|
+
| Paper | Metadata, not dependencies | Plugins |
|
|
86
|
+
| Bungee | Metadata, not dependencies | Plugins |
|
|
87
|
+
| Velocity | Metadata, not dependencies | Plugins |
|
|
195
88
|
|
|
196
|
-
|
|
197
|
-
|---------|-------|------|
|
|
198
|
-
| `type` | `t`, `ty` | Detect mod/plugin type |
|
|
199
|
-
| `metadata` | `meta`, `md` | Read mod metadata (human or `-j` JSON) |
|
|
200
|
-
| `dep` | `d`, `deps`, `dependencies` | Analyze dependencies (`-j` JSON, `--include-jar-in-jar`/`--jij`) |
|
|
201
|
-
| `classes` | `c`, `cls` | List `.class` files with Java version and access flags |
|
|
202
|
-
| `grep` | `g`, `search` | Search constant pool strings across all `.class` files |
|
|
203
|
-
| `mixins` | `m`, `mixin` | Extract `@Mixin` targets from class-level annotations |
|
|
204
|
-
| `dupes` | `dp`, `duplicate` | Find duplicate `.class` entries across multiple JARs |
|
|
89
|
+
## Installation
|
|
205
90
|
|
|
206
|
-
|
|
91
|
+
First, **make sure** you have the **Rust Programming Language** installed on your machine, if not, [click here](https://rust-lang.org/).
|
|
207
92
|
|
|
208
|
-
|
|
93
|
+
### Install with cargo
|
|
209
94
|
|
|
210
|
-
|
|
95
|
+
- Just run `cargo install modcrawl` and you're good to go!
|
|
211
96
|
|
|
212
|
-
|
|
97
|
+
### Build from source
|
|
213
98
|
|
|
214
|
-
|
|
99
|
+
- Clone the repository `git clone https://github.com/SirCesarium/modcrawl.git` and navigate to the `modcrawl` directory.
|
|
100
|
+
- Install `modcrawl` with `cargo install --path .`.
|
|
215
101
|
|
|
216
|
-
|
|
102
|
+
## Library usage
|
|
217
103
|
|
|
218
|
-
###
|
|
104
|
+
### Rust
|
|
219
105
|
|
|
220
|
-
|
|
106
|
+
Add the crate with Cargo and use the exported detect, metadata, and dependency APIs:
|
|
221
107
|
|
|
108
|
+
```bash
|
|
109
|
+
cargo add modcrawl
|
|
222
110
|
```
|
|
223
|
-
$ modcrawl classes MyMod.jar
|
|
224
|
-
mezz/jei/JustEnoughItems.class Java 8 public
|
|
225
|
-
mezz/jei/color/ColorGetter.class Java 8 public final
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
`--json` / `-j` for machine-readable output.
|
|
229
111
|
|
|
230
|
-
|
|
112
|
+
```rust
|
|
113
|
+
use std::path::Path;
|
|
231
114
|
|
|
232
|
-
|
|
115
|
+
use modcrawl::{analyze, identify, read_metadata};
|
|
233
116
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
mezz/jei/color/ColorGetter.class:
|
|
237
|
-
Utf8: "(Lnet/minecraft/world/IBlockAccess;...)I"
|
|
238
|
-
MethodRef: "net/minecraft/client/renderer/color/BlockColors.func_186724_a:..."
|
|
239
|
-
|
|
240
|
-
$ modcrawl grep "net/minecraft/world" *.jar --quiet
|
|
241
|
-
jei_1.12.2-4.16.1.1013.jar:
|
|
242
|
-
mezz/jei/color/ColorGetter.class
|
|
243
|
-
mezz/jei/plugins/vanilla/anvil/AnvilRecipeMaker.class
|
|
244
|
-
```
|
|
117
|
+
fn main() -> modcrawl::Result<()> {
|
|
118
|
+
let jar = Path::new("MyMod.jar");
|
|
245
119
|
|
|
246
|
-
|
|
120
|
+
println!("{}", identify(jar)?);
|
|
121
|
+
println!("{}", read_metadata(jar)?);
|
|
122
|
+
print!("{}", analyze(jar, false)?);
|
|
247
123
|
|
|
248
|
-
|
|
124
|
+
Ok(())
|
|
125
|
+
}
|
|
126
|
+
```
|
|
249
127
|
|
|
250
|
-
###
|
|
128
|
+
### npm
|
|
251
129
|
|
|
252
|
-
|
|
130
|
+
The WASM package exposes the same core functionality to JavaScript and TypeScript:
|
|
253
131
|
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
some/mod/mixin/ExampleMixin.class ->
|
|
257
|
-
net/minecraft/world/entity/player/Player
|
|
258
|
-
another/mod/mixin/TitleScreenMixin.class ->
|
|
259
|
-
net/minecraft/client/gui/screens/TitleScreen
|
|
132
|
+
```bash
|
|
133
|
+
npm install modcrawl
|
|
260
134
|
```
|
|
261
135
|
|
|
262
|
-
|
|
136
|
+
```js
|
|
137
|
+
import init, { identify, metadata_json } from "modcrawl";
|
|
263
138
|
|
|
264
|
-
|
|
139
|
+
await init();
|
|
265
140
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
$ modcrawl dupes a.jar b.jar c.jar
|
|
272
|
-
── Classpath Conflicts ──
|
|
273
|
-
|
|
274
|
-
a.jar
|
|
275
|
-
b.jar
|
|
276
|
-
── 3 shared classes ──
|
|
277
|
-
com/example/SomeClass.class
|
|
278
|
-
com/example/OtherClass.class
|
|
279
|
-
com/example/ThirdClass.class
|
|
141
|
+
const data = new Uint8Array(await (await fetch("/MyMod.jar")).arrayBuffer());
|
|
142
|
+
console.log(identify(data));
|
|
143
|
+
console.log(metadata_json(data));
|
|
280
144
|
```
|
|
281
145
|
|
|
282
|
-
|
|
146
|
+
## Web
|
|
283
147
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
`--count` / `-c` shows only a summary:
|
|
148
|
+
There's a **WIP** web version of `modcrawl` that aims to provide all of the features of `modcrawl` in a more user-friendly way and will work completely offline (thanks to `WASM`!). It's still in development (currently there's not even a MVP), so expect some bugs and missing features. Stay tuned in [GitHub Discussions](https://github.com/SirCesarium/modcrawl/discussions) for any major updates :).
|
|
149
|
+
|
|
150
|
+
> [!NOTE]
|
|
151
|
+
> There will be a structured documentation when the web version reaches a stable state.
|
|
152
|
+
>
|
|
153
|
+
> The documentation will show a deep overview of all of the commands and the *API Reference* of the **Rust Library** and the **NPM (TypeScript) Library**
|
|
292
154
|
|
|
293
|
-
|
|
294
|
-
$ modcrawl dupes *.jar --count
|
|
295
|
-
Found 42 duplicate classes across 15 JAR files.
|
|
296
|
-
```
|
|
155
|
+
### Web setup
|
|
297
156
|
|
|
298
|
-
|
|
157
|
+
- Clone the repository `git clone https://github.com/SirCesarium/modcrawl.git` and navigate to the `modcrawl/web` directory.
|
|
158
|
+
- Make sure you have **Bun Runtime** installed on your machine, if not, click [here](https://bun.sh/) to install it.
|
|
159
|
+
- Run `bun install --frozen-lockfile` to install the dependencies.
|
|
160
|
+
- Run `bun run dev` and navigate to `http://127.0.0.1:5173` in your browser.
|
|
299
161
|
|
|
300
162
|
## License
|
|
301
163
|
|
|
302
|
-
MIT
|
|
164
|
+
This project is licensed under the terms of the MIT license. See [LICENSE](./LICENSE) for details.
|
package/modcrawl.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Returns a JS exception when the JAR is invalid.
|
|
10
10
|
*/
|
|
11
|
-
export function classes_json(data: Uint8Array): string;
|
|
11
|
+
export function classes_json(data: Uint8Array | number[]): string;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Analyze dependencies from a ZIP/JAR byte buffer, returning JSON.
|
|
@@ -20,7 +20,7 @@ export function classes_json(data: Uint8Array): string;
|
|
|
20
20
|
*
|
|
21
21
|
* Returns a JS exception when the JAR is invalid or cannot be parsed.
|
|
22
22
|
*/
|
|
23
|
-
export function deps_json(data: Uint8Array, include_jij: boolean): string;
|
|
23
|
+
export function deps_json(data: Uint8Array | number[], include_jij: boolean): string;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Find duplicate class entries across multiple ZIP/JAR byte buffers,
|
|
@@ -43,7 +43,7 @@ export function dupes_json(names: string[], jars: Array<any>): string;
|
|
|
43
43
|
*
|
|
44
44
|
* Returns a JS exception when the JAR is invalid.
|
|
45
45
|
*/
|
|
46
|
-
export function grep_json(data: Uint8Array, pattern: string): string;
|
|
46
|
+
export function grep_json(data: Uint8Array | number[], pattern: string): string;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Detect the mod/plugin type from a ZIP/JAR byte buffer.
|
|
@@ -52,7 +52,7 @@ export function grep_json(data: Uint8Array, pattern: string): string;
|
|
|
52
52
|
*
|
|
53
53
|
* Returns a JS exception when the data is not a valid ZIP archive.
|
|
54
54
|
*/
|
|
55
|
-
export function identify(data: Uint8Array): string;
|
|
55
|
+
export function identify(data: Uint8Array | number[]): string;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Read and parse metadata from a ZIP/JAR byte buffer, returning JSON.
|
|
@@ -62,7 +62,7 @@ export function identify(data: Uint8Array): string;
|
|
|
62
62
|
* Returns a JS exception when the JAR is invalid or its metadata cannot
|
|
63
63
|
* be parsed.
|
|
64
64
|
*/
|
|
65
|
-
export function metadata_json(data: Uint8Array): string;
|
|
65
|
+
export function metadata_json(data: Uint8Array | number[]): string;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Extract mixin targets from a ZIP/JAR byte buffer, returning JSON.
|
|
@@ -71,27 +71,12 @@ export function metadata_json(data: Uint8Array): string;
|
|
|
71
71
|
*
|
|
72
72
|
* Returns a JS exception when the JAR is invalid.
|
|
73
73
|
*/
|
|
74
|
-
export function mixins_json(data: Uint8Array): string;
|
|
74
|
+
export function mixins_json(data: Uint8Array | number[]): string;
|
|
75
75
|
|
|
76
76
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
77
77
|
|
|
78
78
|
export interface InitOutput {
|
|
79
79
|
readonly memory: WebAssembly.Memory;
|
|
80
|
-
readonly modcrawl_classes_json: (a: number) => number;
|
|
81
|
-
readonly modcrawl_deps: (a: number, b: number) => number;
|
|
82
|
-
readonly modcrawl_deps_bytes: (a: number, b: number, c: number) => number;
|
|
83
|
-
readonly modcrawl_deps_json_bytes: (a: number, b: number, c: number) => number;
|
|
84
|
-
readonly modcrawl_dupes_json: (a: number) => number;
|
|
85
|
-
readonly modcrawl_free_string: (a: number) => void;
|
|
86
|
-
readonly modcrawl_grep_json: (a: number, b: number) => number;
|
|
87
|
-
readonly modcrawl_identify: (a: number) => number;
|
|
88
|
-
readonly modcrawl_identify_bytes: (a: number, b: number) => number;
|
|
89
|
-
readonly modcrawl_metadata_bytes: (a: number, b: number) => number;
|
|
90
|
-
readonly modcrawl_metadata_json_bytes: (a: number, b: number) => number;
|
|
91
|
-
readonly modcrawl_metadata: (a: number) => number;
|
|
92
|
-
readonly modcrawl_metadata_json: (a: number) => number;
|
|
93
|
-
readonly modcrawl_mixins_json: (a: number) => number;
|
|
94
|
-
readonly modcrawl_deps_json: (a: number, b: number) => number;
|
|
95
80
|
readonly classes_json: (a: number, b: number) => [number, number, number, number];
|
|
96
81
|
readonly deps_json: (a: number, b: number, c: number) => [number, number, number, number];
|
|
97
82
|
readonly dupes_json: (a: number, b: number, c: any) => [number, number, number, number];
|
|
@@ -101,10 +86,11 @@ export interface InitOutput {
|
|
|
101
86
|
readonly mixins_json: (a: number, b: number) => [number, number, number, number];
|
|
102
87
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
103
88
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
89
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
104
90
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
105
91
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
106
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
107
92
|
readonly __externref_table_alloc: () => number;
|
|
93
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
108
94
|
readonly __wbindgen_start: () => void;
|
|
109
95
|
}
|
|
110
96
|
|
package/modcrawl.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* # Errors
|
|
7
7
|
*
|
|
8
8
|
* Returns a JS exception when the JAR is invalid.
|
|
9
|
-
* @param {Uint8Array} data
|
|
9
|
+
* @param {Uint8Array | number[]} data
|
|
10
10
|
* @returns {string}
|
|
11
11
|
*/
|
|
12
12
|
export function classes_json(data) {
|
|
@@ -39,28 +39,29 @@ export function classes_json(data) {
|
|
|
39
39
|
* # Errors
|
|
40
40
|
*
|
|
41
41
|
* Returns a JS exception when the JAR is invalid or cannot be parsed.
|
|
42
|
-
* @param {Uint8Array} data
|
|
42
|
+
* @param {Uint8Array | number[]} data
|
|
43
43
|
* @param {boolean} include_jij
|
|
44
44
|
* @returns {string}
|
|
45
45
|
*/
|
|
46
46
|
export function deps_json(data, include_jij) {
|
|
47
|
-
let
|
|
48
|
-
let
|
|
47
|
+
let deferred4_0;
|
|
48
|
+
let deferred4_1;
|
|
49
49
|
try {
|
|
50
|
+
const val2 = +include_jij;
|
|
50
51
|
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
51
52
|
const len0 = WASM_VECTOR_LEN;
|
|
52
|
-
const ret = wasm.deps_json(ptr0, len0,
|
|
53
|
-
var
|
|
54
|
-
var
|
|
53
|
+
const ret = wasm.deps_json(ptr0, len0, val2);
|
|
54
|
+
var ptr3 = ret[0];
|
|
55
|
+
var len3 = ret[1];
|
|
55
56
|
if (ret[3]) {
|
|
56
|
-
|
|
57
|
+
ptr3 = 0; len3 = 0;
|
|
57
58
|
throw takeFromExternrefTable0(ret[2]);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return getStringFromWasm0(
|
|
60
|
+
deferred4_0 = ptr3;
|
|
61
|
+
deferred4_1 = len3;
|
|
62
|
+
return getStringFromWasm0(ptr3, len3);
|
|
62
63
|
} finally {
|
|
63
|
-
wasm.__wbindgen_free(
|
|
64
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -106,7 +107,7 @@ export function dupes_json(names, jars) {
|
|
|
106
107
|
* # Errors
|
|
107
108
|
*
|
|
108
109
|
* Returns a JS exception when the JAR is invalid.
|
|
109
|
-
* @param {Uint8Array} data
|
|
110
|
+
* @param {Uint8Array | number[]} data
|
|
110
111
|
* @param {string} pattern
|
|
111
112
|
* @returns {string}
|
|
112
113
|
*/
|
|
@@ -114,10 +115,17 @@ export function grep_json(data, pattern) {
|
|
|
114
115
|
let deferred4_0;
|
|
115
116
|
let deferred4_1;
|
|
116
117
|
try {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
let ptr0, len0, ptr1, len1;
|
|
119
|
+
try {
|
|
120
|
+
ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
121
|
+
len0 = WASM_VECTOR_LEN;
|
|
122
|
+
ptr1 = passStringToWasm0(pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
123
|
+
len1 = WASM_VECTOR_LEN;
|
|
124
|
+
} catch (e) {
|
|
125
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
126
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
127
|
+
throw e;
|
|
128
|
+
}
|
|
121
129
|
const ret = wasm.grep_json(ptr0, len0, ptr1, len1);
|
|
122
130
|
var ptr3 = ret[0];
|
|
123
131
|
var len3 = ret[1];
|
|
@@ -139,7 +147,7 @@ export function grep_json(data, pattern) {
|
|
|
139
147
|
* # Errors
|
|
140
148
|
*
|
|
141
149
|
* Returns a JS exception when the data is not a valid ZIP archive.
|
|
142
|
-
* @param {Uint8Array} data
|
|
150
|
+
* @param {Uint8Array | number[]} data
|
|
143
151
|
* @returns {string}
|
|
144
152
|
*/
|
|
145
153
|
export function identify(data) {
|
|
@@ -170,7 +178,7 @@ export function identify(data) {
|
|
|
170
178
|
*
|
|
171
179
|
* Returns a JS exception when the JAR is invalid or its metadata cannot
|
|
172
180
|
* be parsed.
|
|
173
|
-
* @param {Uint8Array} data
|
|
181
|
+
* @param {Uint8Array | number[]} data
|
|
174
182
|
* @returns {string}
|
|
175
183
|
*/
|
|
176
184
|
export function metadata_json(data) {
|
|
@@ -200,7 +208,7 @@ export function metadata_json(data) {
|
|
|
200
208
|
* # Errors
|
|
201
209
|
*
|
|
202
210
|
* Returns a JS exception when the JAR is invalid.
|
|
203
|
-
* @param {Uint8Array} data
|
|
211
|
+
* @param {Uint8Array | number[]} data
|
|
204
212
|
* @returns {string}
|
|
205
213
|
*/
|
|
206
214
|
export function mixins_json(data) {
|
|
@@ -226,48 +234,47 @@ export function mixins_json(data) {
|
|
|
226
234
|
function __wbg_get_imports() {
|
|
227
235
|
const import0 = {
|
|
228
236
|
__proto__: null,
|
|
229
|
-
|
|
237
|
+
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
230
238
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
231
239
|
return ret;
|
|
232
240
|
},
|
|
233
|
-
|
|
241
|
+
__wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
|
|
234
242
|
const obj = arg1;
|
|
235
243
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
236
244
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
237
245
|
var len1 = WASM_VECTOR_LEN;
|
|
238
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
239
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
246
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
247
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
240
248
|
},
|
|
241
|
-
|
|
249
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
242
250
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
243
251
|
},
|
|
244
|
-
|
|
252
|
+
__wbg_get_unchecked_e6325ad374eff861: function(arg0, arg1) {
|
|
245
253
|
const ret = arg0[arg1 >>> 0];
|
|
246
254
|
return ret;
|
|
247
255
|
},
|
|
248
|
-
|
|
256
|
+
__wbg_length_186163212ffe79c3: function(arg0) {
|
|
249
257
|
const ret = arg0.length;
|
|
250
258
|
return ret;
|
|
251
259
|
},
|
|
252
|
-
|
|
260
|
+
__wbg_length_b03a0fabb109b1e9: function(arg0) {
|
|
253
261
|
const ret = arg0.length;
|
|
254
262
|
return ret;
|
|
255
263
|
},
|
|
256
|
-
|
|
264
|
+
__wbg_new_13de428334042d26: function(arg0) {
|
|
257
265
|
const ret = new Uint8Array(arg0);
|
|
258
266
|
return ret;
|
|
259
267
|
},
|
|
260
|
-
|
|
268
|
+
__wbg_prototypesetcall_13162965d1fe7aa3: function(arg0, arg1, arg2) {
|
|
261
269
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
262
270
|
},
|
|
263
271
|
__wbindgen_init_externref_table: function() {
|
|
264
272
|
const table = wasm.__wbindgen_externrefs;
|
|
265
|
-
const offset = table.grow(4);
|
|
266
273
|
table.set(0, undefined);
|
|
267
|
-
table.set(
|
|
268
|
-
table.set(
|
|
269
|
-
table.set(
|
|
270
|
-
table.set(
|
|
274
|
+
table.set(1024, undefined);
|
|
275
|
+
table.set(1025, null);
|
|
276
|
+
table.set(1026, true);
|
|
277
|
+
table.set(1027, false);
|
|
271
278
|
},
|
|
272
279
|
};
|
|
273
280
|
return {
|
|
@@ -296,7 +303,8 @@ function getDataViewMemory0() {
|
|
|
296
303
|
}
|
|
297
304
|
|
|
298
305
|
function getStringFromWasm0(ptr, len) {
|
|
299
|
-
|
|
306
|
+
ptr = ptr >>> 0;
|
|
307
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
300
308
|
}
|
|
301
309
|
|
|
302
310
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -371,18 +379,18 @@ function takeFromExternrefTable0(idx) {
|
|
|
371
379
|
return value;
|
|
372
380
|
}
|
|
373
381
|
|
|
374
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
382
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
375
383
|
cachedTextDecoder.decode();
|
|
376
384
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
377
385
|
let numBytesDecoded = 0;
|
|
378
|
-
function decodeText(
|
|
379
|
-
numBytesDecoded +=
|
|
386
|
+
function decodeText(bytes) {
|
|
387
|
+
numBytesDecoded += bytes.length;
|
|
380
388
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
381
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
389
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
382
390
|
cachedTextDecoder.decode();
|
|
383
|
-
numBytesDecoded =
|
|
391
|
+
numBytesDecoded = bytes.length;
|
|
384
392
|
}
|
|
385
|
-
return cachedTextDecoder.decode(
|
|
393
|
+
return cachedTextDecoder.decode(bytes);
|
|
386
394
|
}
|
|
387
395
|
|
|
388
396
|
const cachedTextEncoder = new TextEncoder();
|
|
@@ -470,9 +478,17 @@ function initSync(module) {
|
|
|
470
478
|
return __wbg_finalize_init(instance, module);
|
|
471
479
|
}
|
|
472
480
|
|
|
481
|
+
let __wbg_init_promise;
|
|
473
482
|
async function __wbg_init(module_or_path) {
|
|
474
483
|
if (wasm !== undefined) return wasm;
|
|
484
|
+
if (__wbg_init_promise === undefined) {
|
|
485
|
+
__wbg_init_promise = __wbg_init_once(module_or_path);
|
|
486
|
+
__wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
|
|
487
|
+
}
|
|
488
|
+
return __wbg_init_promise;
|
|
489
|
+
}
|
|
475
490
|
|
|
491
|
+
async function __wbg_init_once(module_or_path) {
|
|
476
492
|
|
|
477
493
|
if (module_or_path !== undefined) {
|
|
478
494
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
package/modcrawl_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modcrawl",
|
|
3
3
|
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"Cesarium <239650612+SirCesarium@users.noreply.github.com>"
|
|
6
|
+
],
|
|
4
7
|
"description": "Detect, inspect, and analyze Minecraft mods and plugins from JAR files",
|
|
5
|
-
"version": "0.
|
|
8
|
+
"version": "0.11.2",
|
|
6
9
|
"license": "MIT",
|
|
7
10
|
"repository": {
|
|
8
11
|
"type": "git",
|