modcrawl 0.10.1 → 0.11.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 CHANGED
@@ -1,302 +1,164 @@
1
- # modcrawl
1
+ <div align="center">
2
+
3
+ <img src="./web/static/readme/banner.png" alt="Modcrawl banner" />
2
4
 
3
5
  [![Crates.io](https://img.shields.io/crates/v/modcrawl?style=flat-square)](https://crates.io/crates/modcrawl)
6
+ [![docs.rs](https://img.shields.io/docsrs/modcrawl?style=flat-square)](https://docs.rs/modcrawl)
7
+ [![npm](https://img.shields.io/npm/v/modcrawl?style=flat-square)](https://www.npmjs.com/package/modcrawl)
4
8
  [![CI](https://img.shields.io/github/actions/workflow/status/SirCesarium/modcrawl/ci.yml?branch=main&style=flat-square)](https://github.com/SirCesarium/modcrawl/actions)
5
- [![License](https://img.shields.io/github/license/SirCesarium/modcrawl?style=flat-square)]()
9
+ [![License](https://img.shields.io/github/license/SirCesarium/modcrawl?style=flat-square)](https://github.com/SirCesarium/modcrawl/blob/main/LICENSE)
6
10
 
7
- Detect, inspect, and analyze Minecraft mods and plugins from JARs.
11
+ </div>
8
12
 
9
- ```bash
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
- ```bash
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
- ## How it works
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
- Inspects the ZIP entries inside a JAR without extracting. Picks the first matching sentinel file (Paper > Bukkit > NeoForge > Forge mods.toml > Forge mcmod.info > Fabric), then parses the corresponding metadata file and extracts dependency declarations.
19
+ It helps you quickly answer the everyday questions that pop up while building or fixing a modpack:
32
20
 
33
- ## Supported loaders
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
- | Loader | Sentinel file | Metadata format |
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
- Adding a new loader means one new module implementing `ModHandler` and a single `register()` call — no core changes.
29
+ <div align="center">
45
30
 
46
- ## Install
31
+ ![Modcrawl analyzing Create Mod metadata](./web/static/readme/create-metadata.png)
47
32
 
48
- ```bash
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
- ## Library
36
+ ## Quickstart
55
37
 
56
38
  ```bash
57
- cargo add modcrawl --no-default-features
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
- let meta = read_metadata("MyMod.jar".as_ref())?;
68
- println!("{meta}"); // human-readable
69
- println!("{}", serde_json::to_string(&meta)?); // JSON
42
+ # Inspect metadata and dependencies
43
+ modcrawl deps MyMod.jar
70
44
 
71
- let report = analyze("MyMod.jar".as_ref(), false)?; // exclude jar-in-jar
72
- for dep in &report.dependencies {
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
- ```rust
80
- use std::io::Cursor;
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
- ## Dependency analysis
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
- Jar-in-jar entries (`META-INF/jars/*.jar`) are always scanned internally. If a dependency matches a bundled JAR's filename, it's removed from the external dependency list. The `--include-jar-in-jar` flag controls whether the jar-in-jar section appears in the output.
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
- ## FFI / C bindings
56
+ ### Quick downloads
99
57
 
100
- Every core function is exposed as a C-compatible export:
58
+ <div align="center">
101
59
 
102
- | Function | Returns |
103
- |----------|---------|
104
- | `modcrawl_identify(path)` | Type string |
105
- | `modcrawl_identify_bytes(data, len)` | Type string |
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/latest/download/modcrawl-windows-x86_64-msvc.exe"><img src="./web/static/readme/windows.png" alt="Modcrawl Windows binary"></a>
61
+ <a href="https://github.com/SirCesarium/modcrawl/releases/latest/download/modcrawl-linux-x86_64-musl"><img src="./web/static/readme/debian.png" alt="Modcrawl Debian binary"></a>
62
+ <a href="https://github.com/SirCesarium/modcrawl/releases/latest/download/modcrawl-linux-x86_64-musl"><img src="./web/static/readme/fedora.png" alt="Modcrawl Fedora binary"></a>
63
+ <a href="https://github.com/SirCesarium/modcrawl/releases/latest/download/modcrawl-macos-arm64"><img src="./web/static/readme/macos.png" alt="Modcrawl macOS binary"></a>
119
64
 
120
- The classes, grep, mixins and dupes exports require the `classfile` feature,
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
- ```c
126
- #include "modcrawl.h"
67
+ Those quick downloads point to the most common OS architectures (e.g., `Windows x86_64`, `Linux x86_64`, `macOS arm64`, ...). If you have an uncommon architecture (like `Linux ARM64`) you can check the [releases](https://github.com/SirCesarium/modcrawl/releases) page.
127
68
 
128
- char *type = modcrawl_identify("/path/to/MyMod.jar");
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
- ### Contract
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
- **The header describes a default-features build.** If you compile the crate
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
- One packaging note: the musl libraries ship a **static library only**
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
- ## CLI reference
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
- | Command | Alias | What |
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
- ### `type`
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
- Reads from stdin when given no file arguments. Stdin can be raw ZIP bytes (detects EOCD boundaries for `cat *.jar`) or newline-separated file paths.
93
+ ### Install with cargo
209
94
 
210
- ### `metadata`
95
+ - Just run `cargo install modcrawl` and you're good to go!
211
96
 
212
- Takes one or more JAR paths. Multi-file output prefixes each result with the filename. `--json` / `-j` for compact JSON (one line per file).
97
+ ### Build from source
213
98
 
214
- ### `dep` / `deps`
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
- Takes one or more JAR paths. `--json` / `-j` for pretty-printed JSON. `--include-jar-in-jar` / `--jij` to show embedded JARs. Bundled dependencies are always filtered out of the external dependency list regardless of this flag.
102
+ ## Library usage
217
103
 
218
- ### `classes` (requires `classfile` feature)
104
+ ### Rust
219
105
 
220
- Lists every `.class` file inside a JAR with its Java version and access flags.
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
- ### `grep` (requires `classfile` feature)
112
+ ```rust
113
+ use std::path::Path;
231
114
 
232
- Searches the **constant pool** of every `.class` file inside a JAR — no decompilation needed. Finds class references, method calls, field accesses, annotations, and raw UTF-8 strings.
115
+ use modcrawl::{analyze, identify, read_metadata};
233
116
 
234
- ```
235
- $ modcrawl grep "func_186724_a" MyMod.jar
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
- Useful for crash investigation: find which mod references an obfuscated function or class without opening a single JAR.
120
+ println!("{}", identify(jar)?);
121
+ println!("{}", read_metadata(jar)?);
122
+ print!("{}", analyze(jar, false)?);
247
123
 
248
- Flags: `--quiet` / `-q` (only show class file names), `--json` / `-j` (JSON output).
124
+ Ok(())
125
+ }
126
+ ```
249
127
 
250
- ### `mixins` (requires `classfile` feature)
128
+ ### npm
251
129
 
252
- Extracts `@Mixin` targets from SpongePowered mixin annotations at the class level. Parses `RuntimeVisibleAnnotations` / `RuntimeInvisibleAnnotations` attributes and resolves both `value` (Class ref) and `targets` (String ref) element pairs — no decompilation needed.
130
+ The WASM package exposes the same core functionality to JavaScript and TypeScript:
253
131
 
254
- ```
255
- $ modcrawl mixins MyMod.jar
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
- `--quiet` / `-q` (only show mixin class names), `--json` / `-j` (JSON output).
136
+ ```js
137
+ import init, { identify, metadata_json } from "modcrawl";
263
138
 
264
- ### `dupes` (requires `classfile` feature)
139
+ await init();
265
140
 
266
- Finds `.class` files that appear in more than one JAR — useful for detecting classpath conflicts between mods. Uses zip entry listing only, no classfile parsing needed.
267
-
268
- By default, output is grouped by conflict pair (two JARs that share classes):
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
- `--by-class` / `-b` groups by class instead (legacy format), showing how many JARs each class appears in:
146
+ ## Web
283
147
 
284
- ```
285
- $ modcrawl dupes a.jar b.jar c.jar --by-class
286
- com/example/SomeClass.class (in 2 JARs)
287
- a.jar
288
- b.jar
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
- `--json` / `-j` for machine-readable output. Combine with `--count` for a compact JSON summary.
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,7 +71,7 @@ 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
 
@@ -84,27 +84,13 @@ export interface InitOutput {
84
84
  readonly identify: (a: number, b: number) => [number, number, number, number];
85
85
  readonly metadata_json: (a: number, b: number) => [number, number, number, number];
86
86
  readonly mixins_json: (a: number, b: number) => [number, number, number, number];
87
- readonly modcrawl_classes_json: (a: number) => number;
88
- readonly modcrawl_deps: (a: number, b: number) => number;
89
- readonly modcrawl_deps_bytes: (a: number, b: number, c: number) => number;
90
- readonly modcrawl_deps_json_bytes: (a: number, b: number, c: number) => number;
91
- readonly modcrawl_dupes_json: (a: number) => number;
92
- readonly modcrawl_free_string: (a: number) => void;
93
- readonly modcrawl_grep_json: (a: number, b: number) => number;
94
- readonly modcrawl_identify: (a: number) => number;
95
- readonly modcrawl_identify_bytes: (a: number, b: number) => number;
96
- readonly modcrawl_metadata_bytes: (a: number, b: number) => number;
97
- readonly modcrawl_metadata_json_bytes: (a: number, b: number) => number;
98
- readonly modcrawl_metadata: (a: number) => number;
99
- readonly modcrawl_metadata_json: (a: number) => number;
100
- readonly modcrawl_mixins_json: (a: number) => number;
101
- readonly modcrawl_deps_json: (a: number, b: 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 deferred3_0;
48
- let deferred3_1;
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, include_jij);
53
- var ptr2 = ret[0];
54
- var len2 = ret[1];
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
- ptr2 = 0; len2 = 0;
57
+ ptr3 = 0; len3 = 0;
57
58
  throw takeFromExternrefTable0(ret[2]);
58
59
  }
59
- deferred3_0 = ptr2;
60
- deferred3_1 = len2;
61
- return getStringFromWasm0(ptr2, len2);
60
+ deferred4_0 = ptr3;
61
+ deferred4_1 = len3;
62
+ return getStringFromWasm0(ptr3, len3);
62
63
  } finally {
63
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
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
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
118
- const len0 = WASM_VECTOR_LEN;
119
- const ptr1 = passStringToWasm0(pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
120
- const len1 = WASM_VECTOR_LEN;
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
- __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
237
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
230
238
  const ret = Error(getStringFromWasm0(arg0, arg1));
231
239
  return ret;
232
240
  },
233
- __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
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
- __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
249
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
242
250
  throw new Error(getStringFromWasm0(arg0, arg1));
243
251
  },
244
- __wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
252
+ __wbg_get_unchecked_e6325ad374eff861: function(arg0, arg1) {
245
253
  const ret = arg0[arg1 >>> 0];
246
254
  return ret;
247
255
  },
248
- __wbg_length_7f3c00c40364105e: function(arg0) {
256
+ __wbg_length_186163212ffe79c3: function(arg0) {
249
257
  const ret = arg0.length;
250
258
  return ret;
251
259
  },
252
- __wbg_length_d4bdea10311bd9cf: function(arg0) {
260
+ __wbg_length_b03a0fabb109b1e9: function(arg0) {
253
261
  const ret = arg0.length;
254
262
  return ret;
255
263
  },
256
- __wbg_new_1dbf7428bba60a42: function(arg0) {
264
+ __wbg_new_13de428334042d26: function(arg0) {
257
265
  const ret = new Uint8Array(arg0);
258
266
  return ret;
259
267
  },
260
- __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
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(offset + 0, undefined);
268
- table.set(offset + 1, null);
269
- table.set(offset + 2, true);
270
- table.set(offset + 3, false);
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
- return decodeText(ptr >>> 0, len);
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, fatal: 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(ptr, len) {
379
- numBytesDecoded += len;
386
+ function decodeText(bytes) {
387
+ numBytesDecoded += bytes.length;
380
388
  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
381
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
389
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
382
390
  cachedTextDecoder.decode();
383
- numBytesDecoded = len;
391
+ numBytesDecoded = bytes.length;
384
392
  }
385
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
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.10.1",
8
+ "version": "0.11.1",
6
9
  "license": "MIT",
7
10
  "repository": {
8
11
  "type": "git",