@codonsplice/wasm 0.1.10 → 0.1.12
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/astro/index.js +1 -1
- package/astro/package.json +1 -1
- package/codonsplice_wasm.d.ts +6 -0
- package/codonsplice_wasm.js +26 -0
- package/codonsplice_wasm_bg.wasm +0 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/react/index.js +1 -1
- package/react/package.json +1 -1
- package/svelte/index.js +1 -1
- package/svelte/package.json +1 -1
- package/vue/index.js +1 -1
- package/vue/package.json +1 -1
package/astro/index.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
// Astro components are framework-agnostic, so this simply re-exports the core
|
|
4
4
|
// helpers; use them inside a client:* island (or any of the framework wrappers
|
|
5
5
|
// for reactive state).
|
|
6
|
-
export { execute, stream, compile, check, initEngine, CodonSplice } from '@codonsplice/wasm/helpers'
|
|
6
|
+
export { execute, stream, compile, check, ast, initEngine, CodonSplice } from '@codonsplice/wasm/helpers'
|
package/astro/package.json
CHANGED
package/codonsplice_wasm.d.ts
CHANGED
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
export class CodonSplice {
|
|
8
8
|
free(): void;
|
|
9
9
|
[Symbol.dispose](): void;
|
|
10
|
+
/**
|
|
11
|
+
* Parse a query and return its AST as a readable tree (for the demo's AST
|
|
12
|
+
* view). Errors as the parse error string.
|
|
13
|
+
*/
|
|
14
|
+
ast(source: string): string;
|
|
10
15
|
/**
|
|
11
16
|
* Parse + type-check only. Returns `null` on success, the error string on
|
|
12
17
|
* failure.
|
|
@@ -68,6 +73,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
68
73
|
export interface InitOutput {
|
|
69
74
|
readonly memory: WebAssembly.Memory;
|
|
70
75
|
readonly __wbg_codonsplice_free: (a: number, b: number) => void;
|
|
76
|
+
readonly codonsplice_ast: (a: number, b: number, c: number) => [number, number, number, number];
|
|
71
77
|
readonly codonsplice_check: (a: number, b: number, c: number) => [number, number];
|
|
72
78
|
readonly codonsplice_compile: (a: number, b: number, c: number) => [number, number, number, number];
|
|
73
79
|
readonly codonsplice_execute: (a: number, b: number, c: number, d: any, e: any) => [number, number, number];
|
package/codonsplice_wasm.js
CHANGED
|
@@ -14,6 +14,32 @@ export class CodonSplice {
|
|
|
14
14
|
const ptr = this.__destroy_into_raw();
|
|
15
15
|
wasm.__wbg_codonsplice_free(ptr, 0);
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Parse a query and return its AST as a readable tree (for the demo's AST
|
|
19
|
+
* view). Errors as the parse error string.
|
|
20
|
+
* @param {string} source
|
|
21
|
+
* @returns {string}
|
|
22
|
+
*/
|
|
23
|
+
ast(source) {
|
|
24
|
+
let deferred3_0;
|
|
25
|
+
let deferred3_1;
|
|
26
|
+
try {
|
|
27
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28
|
+
const len0 = WASM_VECTOR_LEN;
|
|
29
|
+
const ret = wasm.codonsplice_ast(this.__wbg_ptr, ptr0, len0);
|
|
30
|
+
var ptr2 = ret[0];
|
|
31
|
+
var len2 = ret[1];
|
|
32
|
+
if (ret[3]) {
|
|
33
|
+
ptr2 = 0; len2 = 0;
|
|
34
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
35
|
+
}
|
|
36
|
+
deferred3_0 = ptr2;
|
|
37
|
+
deferred3_1 = len2;
|
|
38
|
+
return getStringFromWasm0(ptr2, len2);
|
|
39
|
+
} finally {
|
|
40
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
17
43
|
/**
|
|
18
44
|
* Parse + type-check only. Returns `null` on success, the error string on
|
|
19
45
|
* failure.
|
package/codonsplice_wasm_bg.wasm
CHANGED
|
Binary file
|
package/index.js
CHANGED
|
@@ -70,3 +70,9 @@ export async function check(query) {
|
|
|
70
70
|
const engine = await initEngine()
|
|
71
71
|
return engine.check(query)
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/** Parse a query and return its AST as a readable tree (throws on parse error). */
|
|
75
|
+
export async function ast(query) {
|
|
76
|
+
const engine = await initEngine()
|
|
77
|
+
return engine.ast(query)
|
|
78
|
+
}
|
package/package.json
CHANGED
package/react/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { execute as csExecute } from '@codonsplice/wasm/helpers'
|
|
|
4
4
|
|
|
5
5
|
// Re-export the core tooling so apps can `import { useSpliceQL, compile, check }
|
|
6
6
|
// from '@codonsplice/react'` without depending on @codonsplice/wasm directly.
|
|
7
|
-
export { execute, stream, compile, check, initEngine } from '@codonsplice/wasm/helpers'
|
|
7
|
+
export { execute, stream, compile, check, ast, initEngine } from '@codonsplice/wasm/helpers'
|
|
8
8
|
|
|
9
9
|
export function useSpliceQL() {
|
|
10
10
|
const [result, setResult] = useState(null)
|
package/react/package.json
CHANGED
package/svelte/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { execute as csExecute } from '@codonsplice/wasm/helpers'
|
|
|
4
4
|
|
|
5
5
|
// Re-export the core tooling so apps can `import { createSpliceQL, compile,
|
|
6
6
|
// check } from '@codonsplice/svelte'` without depending on @codonsplice/wasm.
|
|
7
|
-
export { execute, stream, compile, check, initEngine } from '@codonsplice/wasm/helpers'
|
|
7
|
+
export { execute, stream, compile, check, ast, initEngine } from '@codonsplice/wasm/helpers'
|
|
8
8
|
|
|
9
9
|
export function createSpliceQL() {
|
|
10
10
|
const result = writable(null)
|
package/svelte/package.json
CHANGED
package/vue/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { execute as csExecute } from '@codonsplice/wasm/helpers'
|
|
|
4
4
|
|
|
5
5
|
// Re-export the core tooling so apps can `import { useSpliceQL, compile, check }
|
|
6
6
|
// from '@codonsplice/vue'` without depending on @codonsplice/wasm directly.
|
|
7
|
-
export { execute, stream, compile, check, initEngine } from '@codonsplice/wasm/helpers'
|
|
7
|
+
export { execute, stream, compile, check, ast, initEngine } from '@codonsplice/wasm/helpers'
|
|
8
8
|
|
|
9
9
|
export function useSpliceQL() {
|
|
10
10
|
const result = ref(null)
|