wasp1 0.1.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/README.md ADDED
@@ -0,0 +1,69 @@
1
+ <div align="center">
2
+
3
+ <h1><code>wasm-pack-template</code></h1>
4
+
5
+ <strong>A template for kick starting a Rust and WebAssembly project using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong>
6
+
7
+ <p>
8
+ <a href="https://travis-ci.org/rustwasm/wasm-pack-template"><img src="https://img.shields.io/travis/rustwasm/wasm-pack-template.svg?style=flat-square" alt="Build Status" /></a>
9
+ </p>
10
+
11
+ <h3>
12
+ <a href="https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html">Tutorial</a>
13
+ <span> | </span>
14
+ <a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a>
15
+ </h3>
16
+
17
+ <sub>Built with 🦀🕸 by <a href="https://rustwasm.github.io/">The Rust and WebAssembly Working Group</a></sub>
18
+ </div>
19
+
20
+ ## About
21
+
22
+ [**📚 Read this template tutorial! 📚**][template-docs]
23
+
24
+ This template is designed for compiling Rust libraries into WebAssembly and
25
+ publishing the resulting package to NPM.
26
+
27
+ Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other
28
+ templates and usages of `wasm-pack`.
29
+
30
+ [tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html
31
+ [template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html
32
+
33
+ ## 🚴 Usage
34
+
35
+ ### 🐑 Use `cargo generate` to Clone this Template
36
+
37
+ [Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate)
38
+
39
+ ```
40
+ cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project
41
+ cd my-project
42
+ ```
43
+
44
+ ### 🛠️ Build with `wasm-pack build`
45
+
46
+ ```
47
+ wasm-pack build
48
+ ```
49
+
50
+ ### 🔬 Test in Headless Browsers with `wasm-pack test`
51
+
52
+ ```
53
+ wasm-pack test --headless --firefox
54
+ ```
55
+
56
+ ### 🎁 Publish to NPM with `wasm-pack publish`
57
+
58
+ ```
59
+ wasm-pack publish
60
+ ```
61
+
62
+ ## 🔋 Batteries Included
63
+
64
+ * [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating
65
+ between WebAssembly and JavaScript.
66
+ * [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook)
67
+ for logging panic messages to the developer console.
68
+ * [`wee_alloc`](https://github.com/rustwasm/wee_alloc), an allocator optimized
69
+ for small code size.
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "wasp1",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "vasiliydagdzhi <vasiliy.dagdzhi@namecheap.com>"
6
+ ],
7
+ "version": "0.1.0",
8
+ "files": [
9
+ "wasp1_bg.wasm",
10
+ "wasp1.js",
11
+ "wasp1_bg.js",
12
+ "wasp1.d.ts"
13
+ ],
14
+ "main": "wasp1.js",
15
+ "types": "wasp1.d.ts",
16
+ "sideEffects": [
17
+ "./wasp1.js",
18
+ "./snippets/*"
19
+ ]
20
+ }
package/wasp1.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function greet(): void;
package/wasp1.js ADDED
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./wasp1.d.ts" */
2
+
3
+ import * as wasm from "./wasp1_bg.wasm";
4
+ import { __wbg_set_wasm } from "./wasp1_bg.js";
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ greet
9
+ } from "./wasp1_bg.js";
package/wasp1_bg.js ADDED
@@ -0,0 +1,47 @@
1
+ export function greet() {
2
+ wasm.greet();
3
+ }
4
+ export function __wbg_alert_f0980c78aa44e222(arg0, arg1) {
5
+ alert(getStringFromWasm0(arg0, arg1));
6
+ }
7
+ export function __wbindgen_init_externref_table() {
8
+ const table = wasm.__wbindgen_externrefs;
9
+ const offset = table.grow(4);
10
+ table.set(0, undefined);
11
+ table.set(offset + 0, undefined);
12
+ table.set(offset + 1, null);
13
+ table.set(offset + 2, true);
14
+ table.set(offset + 3, false);
15
+ }
16
+ function getStringFromWasm0(ptr, len) {
17
+ ptr = ptr >>> 0;
18
+ return decodeText(ptr, len);
19
+ }
20
+
21
+ let cachedUint8ArrayMemory0 = null;
22
+ function getUint8ArrayMemory0() {
23
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
24
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
25
+ }
26
+ return cachedUint8ArrayMemory0;
27
+ }
28
+
29
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
30
+ cachedTextDecoder.decode();
31
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
32
+ let numBytesDecoded = 0;
33
+ function decodeText(ptr, len) {
34
+ numBytesDecoded += len;
35
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
36
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
37
+ cachedTextDecoder.decode();
38
+ numBytesDecoded = len;
39
+ }
40
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
41
+ }
42
+
43
+
44
+ let wasm;
45
+ export function __wbg_set_wasm(val) {
46
+ wasm = val;
47
+ }
package/wasp1_bg.wasm ADDED
Binary file