minwgsl 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rob
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.
@@ -0,0 +1,40 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Returns minified WGSL string
6
+ */
7
+ export function minify(source: string): string;
8
+
9
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
10
+
11
+ export interface InitOutput {
12
+ readonly memory: WebAssembly.Memory;
13
+ readonly minify: (a: number, b: number, c: number) => void;
14
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
15
+ readonly __wbindgen_export: (a: number, b: number) => number;
16
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
17
+ readonly __wbindgen_export3: (a: number, b: number, c: number) => void;
18
+ }
19
+
20
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
21
+
22
+ /**
23
+ * Instantiates the given `module`, which can either be bytes or
24
+ * a precompiled `WebAssembly.Module`.
25
+ *
26
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
27
+ *
28
+ * @returns {InitOutput}
29
+ */
30
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
31
+
32
+ /**
33
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
34
+ * for everything else, calls `WebAssembly.instantiate` directly.
35
+ *
36
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
37
+ *
38
+ * @returns {Promise<InitOutput>}
39
+ */
40
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1 @@
1
+ function y(q){let G,K;try{let X=P.__wbindgen_add_to_stack_pointer(-16),U=T(q,P.__wbindgen_export,P.__wbindgen_export2),S=j;P.minify(X,U,S);var J=L().getInt32(X+0,!0),Z=L().getInt32(X+4,!0),F=L().getInt32(X+8,!0),Q=L().getInt32(X+12,!0),$=J,k=Z;if(Q)throw $=0,k=0,b(F);return G=$,K=k,W($,k)}finally{P.__wbindgen_add_to_stack_pointer(16),P.__wbindgen_export3(G,K,1)}}function R(){return{__proto__:null,"./minwgsl_bg.js":{__proto__:null,__wbindgen_cast_0000000000000001:function(G,K){let J=W(G,K);return V(J)}}}}function V(q){if(z===H.length)H.push(H.length+1);let G=z;return z=H[G],H[G]=q,G}function A(q){if(q<132)return;H[q]=z,z=q}var I=null;function L(){if(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==P.memory.buffer)I=new DataView(P.memory.buffer);return I}function W(q,G){return q=q>>>0,M(q,G)}var Y=null;function N(){if(Y===null||Y.byteLength===0)Y=new Uint8Array(P.memory.buffer);return Y}function E(q){return H[q]}var H=Array(128).fill(void 0);H.push(void 0,null,!0,!1);var z=H.length;function T(q,G,K){if(K===void 0){let $=v.encode(q),k=G($.length,1)>>>0;return N().subarray(k,k+$.length).set($),j=$.length,k}let J=q.length,Z=G(J,1)>>>0,F=N(),Q=0;for(;Q<J;Q++){let $=q.charCodeAt(Q);if($>127)break;F[Z+Q]=$}if(Q!==J){if(Q!==0)q=q.slice(Q);Z=K(Z,J,J=Q+q.length*3,1)>>>0;let $=N().subarray(Z+Q,Z+J),k=v.encodeInto(q,$);Q+=k.written,Z=K(Z,J,Q,1)>>>0}return j=Q,Z}function b(q){let G=E(q);return A(q),G}var B=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});B.decode();var D=2146435072,C=0;function M(q,G){if(C+=G,C>=D)B=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),B.decode(),C=G;return B.decode(N().subarray(q,q+G))}var v=new TextEncoder;if(!("encodeInto"in v))v.encodeInto=function(q,G){let K=v.encode(q);return G.set(K),{read:q.length,written:K.length}};var j=0,x,P;function O(q,G){return P=q.exports,x=G,I=null,Y=null,P}async function w(q,G){if(typeof Response==="function"&&q instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(q,G)}catch(Z){if(q.ok&&K(q.type)&&q.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",Z);else throw Z}let J=await q.arrayBuffer();return await WebAssembly.instantiate(J,G)}else{let J=await WebAssembly.instantiate(q,G);if(J instanceof WebAssembly.Instance)return{instance:J,module:q};else return J}function K(J){switch(J){case"basic":case"cors":case"default":return!0}return!1}}function f(q){if(P!==void 0)return P;if(q!==void 0)if(Object.getPrototypeOf(q)===Object.prototype)({module:q}=q);else console.warn("using deprecated parameters for `initSync()`; pass a single object instead");let G=R();if(!(q instanceof WebAssembly.Module))q=new WebAssembly.Module(q);let K=new WebAssembly.Instance(q,G);return O(K,q)}async function g(q){if(P!==void 0)return P;if(q!==void 0)if(Object.getPrototypeOf(q)===Object.prototype)({module_or_path:q}=q);else console.warn("using deprecated parameters for the initialization function; pass a single object instead");if(q===void 0)q=new URL("minwgsl_bg.wasm",import.meta.url);let G=R();if(typeof q==="string"||typeof Request==="function"&&q instanceof Request||typeof URL==="function"&&q instanceof URL)q=fetch(q);let{instance:K,module:J}=await w(await q,G);return O(K,J)}export{y as minify,f as initSync,g as default};
Binary file
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "minwgsl",
3
+ "version": "1.0.0",
4
+ "scripts": {
5
+ "build": "bun run pack-wasm && bun build pkg/minwgsl.js --outdir dist --minify && bun run copy-files",
6
+ "extract": "bun run build && wasm2wat pkg/minwgsl_bg.wasm -o pkg/.wat",
7
+ "opt": "wasm-opt -Oz pkg/minwgsl_bg.wasm -o pkg/minwgsl_bg.wasm --enable-bulk-memory --enable-nontrapping-float-to-int --strip-debug --strip-dwarf --strip-producers --strip-target-features",
8
+ "test": "cargo test --target x86_64-pc-windows-msvc",
9
+ "pack-wasm": "cargo build -r && wasm-bindgen target/wasm32-unknown-unknown/release/minwgsl.wasm --out-dir pkg --target web && bun run opt",
10
+ "copy-files": "cp pkg/{minwgsl_bg.wasm,minwgsl.d.ts} dist/"
11
+ },
12
+ "files": [
13
+ "dist/minwgsl.js",
14
+ "dist/minwgsl_bg.wasm",
15
+ "dist/minwgsl.d.ts"
16
+ ],
17
+ "license": "MIT",
18
+ "main": "dist/minwgsl.js"
19
+ }