Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/vscode-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"tsconfig": "*",
"typescript": "^4.5.2",
"vite": "^3.0.0",
"vite-plugin-static-copy": "^0.13.0"
"vite-plugin-static-copy": "^0.13.0",
"vite-plugin-top-level-await": "^1.6.0",
"vite-plugin-wasm": "^3.5.0"
}
}
6 changes: 3 additions & 3 deletions apps/vscode-editor/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ async function runEditor() {
const root = createRoot(document.getElementById('root')!);
setEditorTheme(editorThemeFromStore(store));
root.render(<App store={store} editorId={editorId} host={host} context={context} request={request}/>);


} catch (error) {
console.error(error);
console.error('error',error);
}
}

runEditor();


84 changes: 84 additions & 0 deletions apps/vscode-editor/src/wasm-qmd-parser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<div align="center">

<h1><code>wasm-pack-template</code></h1>

<strong>A template for kick starting a Rust and WebAssembly project using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong>

<p>
<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>
</p>

<h3>
<a href="https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html">Tutorial</a>
<span> | </span>
<a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a>
</h3>

<sub>Built with 🦀🕸 by <a href="https://rustwasm.github.io/">The Rust and WebAssembly Working Group</a></sub>
</div>

## About

[**📚 Read this template tutorial! 📚**][template-docs]

This template is designed for compiling Rust libraries into WebAssembly and
publishing the resulting package to NPM.

Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other
templates and usages of `wasm-pack`.

[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html
[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html

## 🚴 Usage

### 🐑 Use `cargo generate` to Clone this Template

[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate)

```
cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project
cd my-project
```

### 🛠️ Build with `wasm-pack build`

```
wasm-pack build
```

### 🔬 Test in Headless Browsers with `wasm-pack test`

```
wasm-pack test --headless --firefox
```

### 🎁 Publish to NPM with `wasm-pack publish`

```
wasm-pack publish
```

## 🔋 Batteries Included

* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating
between WebAssembly and JavaScript.
* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook)
for logging panic messages to the developer console.
* `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you

## License

Licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
15 changes: 15 additions & 0 deletions apps/vscode-editor/src/wasm-qmd-parser/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<html>
<head>
<meta charset="utf-8"/>
<title>wasm-qmd-parser</title>
</head>
<script type="module">
import main from "./wasm_qmd_parser.js";
let m = await main();
let parsed = m.parse_qmd("# Hello\n");
console.log(parsed);
</script>
</head>
<body>
</body>
</html>
18 changes: 18 additions & 0 deletions apps/vscode-editor/src/wasm-qmd-parser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "wasm-qmd-parser",
"type": "module",
"collaborators": [
"Carlos Scheidegger <[email protected]>"
],
"version": "0.1.0",
"files": [
"wasm_qmd_parser_bg.wasm",
"wasm_qmd_parser.js",
"wasm_qmd_parser.d.ts"
],
"main": "wasm_qmd_parser.js",
"types": "wasm_qmd_parser.d.ts",
"sideEffects": [
"./snippets/*"
]
}
64 changes: 64 additions & 0 deletions apps/vscode-editor/src/wasm-qmd-parser/wasm_qmd_parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* tslint:disable */
/* eslint-disable */
export function run(): void;
export function parse_qmd(input: any): any;
export function greet(): void;

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly parse_qmd: (a: any) => any;
readonly run: () => void;
readonly greet: () => void;
readonly abort: () => void;
readonly calloc: (a: number, b: number) => number;
readonly clock: () => bigint;
readonly fclose: (a: number) => number;
readonly fdopen: (a: number, b: number) => number;
readonly fprintf: (a: number, b: number, c: number) => number;
readonly fputc: (a: number, b: number) => number;
readonly fputs: (a: number, b: number) => number;
readonly free: (a: number) => void;
readonly fwrite: (a: number, b: number, c: number, d: number) => number;
readonly isprint: (a: number) => number;
readonly iswalnum: (a: number) => number;
readonly iswalpha: (a: number) => number;
readonly iswdigit: (a: number) => number;
readonly iswspace: (a: number) => number;
readonly malloc: (a: number) => number;
readonly memcmp: (a: number, b: number, c: number) => number;
readonly memcpy: (a: number, b: number, c: number) => number;
readonly memmove: (a: number, b: number, c: number) => number;
readonly memset: (a: number, b: number, c: number) => number;
readonly realloc: (a: number, b: number) => number;
readonly strncmp: (a: number, b: number, c: number) => number;
readonly towlower: (a: number) => number;
readonly vsnprintf: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_export_3: WebAssembly.Table;
readonly __wbindgen_start: () => void;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
Loading