geolibre-wasm 0.3.0 → 0.4.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 +1 -1
- package/geolibre-cli.wasm +0 -0
- package/geolibre_wasm_bg.wasm +0 -0
- package/package.json +2 -2
- package/tools.d.ts +3 -1
- package/tools.mjs +14 -3
package/README.md
CHANGED
package/geolibre-cli.wasm
CHANGED
|
Binary file
|
package/geolibre_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geolibre-wasm",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"description": "Pure-Rust geospatial toolkit (whitebox_next_gen) compiled to WebAssembly (WASI) for GeoLibre's in-browser tool execution",
|
|
6
|
-
"license": "MIT
|
|
6
|
+
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/opengeos/geolibre-rust"
|
package/tools.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export interface ToolResult {
|
|
|
4
4
|
exitCode: number;
|
|
5
5
|
/** Captured stdout/stderr lines. */
|
|
6
6
|
stdout: string[];
|
|
7
|
-
/** New files the tool wrote, keyed by
|
|
7
|
+
/** New files the tool wrote, keyed by path relative to /work. Top-level
|
|
8
|
+
* outputs use their basename (e.g. "slope.tif"); tools that write a tree
|
|
9
|
+
* (e.g. raster_to_tiles) use nested keys like "tiles/15/4779/16383.png". */
|
|
8
10
|
files: Record<string, Uint8Array>;
|
|
9
11
|
}
|
|
10
12
|
|
package/tools.mjs
CHANGED
|
@@ -52,10 +52,21 @@ async function exec(argv, inputFiles) {
|
|
|
52
52
|
let exitCode = 0;
|
|
53
53
|
try { exitCode = wasi.start(inst); }
|
|
54
54
|
catch (e) { if (e && e.constructor && e.constructor.name === "WASIProcExit") exitCode = e.code; else throw e; }
|
|
55
|
+
// Collect every new file under /work, recursing into subdirectories so tools
|
|
56
|
+
// that write a tree (e.g. raster_to_tiles' {z}/{x}/{y}.png) are surfaced too.
|
|
57
|
+
// Keys are paths relative to /work (nested files use "/" separators).
|
|
55
58
|
const files = {};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
const walk = (dir, prefix) => {
|
|
60
|
+
for (const [name, entry] of dir.contents) {
|
|
61
|
+
const rel = prefix ? `${prefix}/${name}` : name;
|
|
62
|
+
if (entry && entry.contents) {
|
|
63
|
+
walk(entry, rel); // subdirectory
|
|
64
|
+
} else if (entry && entry.data && !(prefix === "" && inNames.has(name))) {
|
|
65
|
+
files[rel] = entry.data; // new file (top-level inputs excluded)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
walk(work.dir, "");
|
|
59
70
|
return { exitCode, stdout, files };
|
|
60
71
|
}
|
|
61
72
|
|