@vizejs/wasm 0.0.1-alpha.8
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/index.d.ts +240 -0
- package/index.js +227 -0
- package/package.json +51 -0
- package/vize_bindings.d.ts +111 -0
- package/vize_bindings.js +650 -0
- package/vize_bindings_bg.wasm +0 -0
- package/vize_bindings_bg.wasm.d.ts +24 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vize - WASM bindings
|
|
3
|
+
*
|
|
4
|
+
* This package provides WebAssembly bindings for the Vue compiler implemented in Rust.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Compiler options for template compilation */
|
|
8
|
+
export interface CompilerOptions {
|
|
9
|
+
/** Output mode: "module" or "function" */
|
|
10
|
+
mode?: "module" | "function";
|
|
11
|
+
/** Whether to prefix identifiers */
|
|
12
|
+
prefixIdentifiers?: boolean;
|
|
13
|
+
/** Whether to hoist static nodes */
|
|
14
|
+
hoistStatic?: boolean;
|
|
15
|
+
/** Whether to cache event handlers */
|
|
16
|
+
cacheHandlers?: boolean;
|
|
17
|
+
/** Scope ID for scoped CSS */
|
|
18
|
+
scopeId?: string;
|
|
19
|
+
/** Whether in SSR mode */
|
|
20
|
+
ssr?: boolean;
|
|
21
|
+
/** Whether to generate source map */
|
|
22
|
+
sourceMap?: boolean;
|
|
23
|
+
/** Filename for source map */
|
|
24
|
+
filename?: string;
|
|
25
|
+
/** Output mode: "vdom" or "vapor" */
|
|
26
|
+
outputMode?: "vdom" | "vapor";
|
|
27
|
+
/** Whether the template contains TypeScript */
|
|
28
|
+
isTs?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Result of template compilation */
|
|
32
|
+
export interface CompileResult {
|
|
33
|
+
/** Generated code */
|
|
34
|
+
code: string;
|
|
35
|
+
/** Preamble code (imports) */
|
|
36
|
+
preamble: string;
|
|
37
|
+
/** AST (serialized) */
|
|
38
|
+
ast: object;
|
|
39
|
+
/** Source map */
|
|
40
|
+
map?: object | null;
|
|
41
|
+
/** Used helpers */
|
|
42
|
+
helpers: string[];
|
|
43
|
+
/** Template strings for Vapor mode static parts */
|
|
44
|
+
templates?: string[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** SFC block (template, script, style) */
|
|
48
|
+
export interface SfcBlock {
|
|
49
|
+
/** Block content */
|
|
50
|
+
content: string;
|
|
51
|
+
/** Source location */
|
|
52
|
+
loc: { start: number; end: number };
|
|
53
|
+
/** Language (e.g., "ts", "scss") */
|
|
54
|
+
lang?: string;
|
|
55
|
+
/** External source URL */
|
|
56
|
+
src?: string;
|
|
57
|
+
/** Block attributes */
|
|
58
|
+
attrs: Record<string, string | true>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** SFC script block */
|
|
62
|
+
export interface SfcScriptBlock extends SfcBlock {
|
|
63
|
+
/** Whether this is a setup script */
|
|
64
|
+
setup: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** SFC style block */
|
|
68
|
+
export interface SfcStyleBlock extends SfcBlock {
|
|
69
|
+
/** Whether the style is scoped */
|
|
70
|
+
scoped: boolean;
|
|
71
|
+
/** CSS module name */
|
|
72
|
+
module?: string | true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** SFC descriptor (parsed .vue file) */
|
|
76
|
+
export interface SfcDescriptor {
|
|
77
|
+
/** Filename */
|
|
78
|
+
filename: string;
|
|
79
|
+
/** Original source */
|
|
80
|
+
source: string;
|
|
81
|
+
/** Template block */
|
|
82
|
+
template?: SfcBlock;
|
|
83
|
+
/** Script block */
|
|
84
|
+
script?: SfcScriptBlock;
|
|
85
|
+
/** Script setup block */
|
|
86
|
+
scriptSetup?: SfcScriptBlock;
|
|
87
|
+
/** Style blocks */
|
|
88
|
+
styles: SfcStyleBlock[];
|
|
89
|
+
/** Custom blocks */
|
|
90
|
+
customBlocks: Array<{
|
|
91
|
+
type: string;
|
|
92
|
+
content: string;
|
|
93
|
+
attrs: Record<string, string | true>;
|
|
94
|
+
}>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** SFC parse options */
|
|
98
|
+
export interface SfcParseOptions {
|
|
99
|
+
/** Filename for the SFC */
|
|
100
|
+
filename?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** SFC compile options */
|
|
104
|
+
export interface SfcCompileOptions extends CompilerOptions {
|
|
105
|
+
/** Filename for the SFC */
|
|
106
|
+
filename?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Result of SFC compilation */
|
|
110
|
+
export interface SfcCompileResult {
|
|
111
|
+
/** Parsed SFC descriptor */
|
|
112
|
+
descriptor: SfcDescriptor;
|
|
113
|
+
/** Compiled template result */
|
|
114
|
+
template?: CompileResult;
|
|
115
|
+
/** Compiled script result */
|
|
116
|
+
script: {
|
|
117
|
+
/** Generated JavaScript code */
|
|
118
|
+
code: string;
|
|
119
|
+
/** Binding metadata */
|
|
120
|
+
bindings?: object;
|
|
121
|
+
};
|
|
122
|
+
/** Generated CSS */
|
|
123
|
+
css?: string;
|
|
124
|
+
/** Compilation errors */
|
|
125
|
+
errors: string[];
|
|
126
|
+
/** Compilation warnings */
|
|
127
|
+
warnings: string[];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** CSS compile options */
|
|
131
|
+
export interface CssCompileOptions {
|
|
132
|
+
/** Scope ID for scoped CSS */
|
|
133
|
+
scopeId?: string;
|
|
134
|
+
/** Whether to scope the CSS */
|
|
135
|
+
scoped?: boolean;
|
|
136
|
+
/** Whether to minify */
|
|
137
|
+
minify?: boolean;
|
|
138
|
+
/** Whether to generate source map */
|
|
139
|
+
sourceMap?: boolean;
|
|
140
|
+
/** Filename for source map */
|
|
141
|
+
filename?: string;
|
|
142
|
+
/** Browser targets for CSS transformations */
|
|
143
|
+
targets?: {
|
|
144
|
+
chrome?: number;
|
|
145
|
+
firefox?: number;
|
|
146
|
+
safari?: number;
|
|
147
|
+
edge?: number;
|
|
148
|
+
ios?: number;
|
|
149
|
+
android?: number;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Result of CSS compilation */
|
|
154
|
+
export interface CssCompileResult {
|
|
155
|
+
/** Generated CSS code */
|
|
156
|
+
code: string;
|
|
157
|
+
/** Source map (if requested) */
|
|
158
|
+
map?: string;
|
|
159
|
+
/** CSS variables used via v-bind() */
|
|
160
|
+
cssVars: string[];
|
|
161
|
+
/** Compilation errors */
|
|
162
|
+
errors: string[];
|
|
163
|
+
/** Compilation warnings */
|
|
164
|
+
warnings: string[];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** WASM Compiler class */
|
|
168
|
+
export declare class Compiler {
|
|
169
|
+
constructor();
|
|
170
|
+
|
|
171
|
+
/** Compile template to VDom render function */
|
|
172
|
+
compile(template: string, options?: CompilerOptions): CompileResult;
|
|
173
|
+
|
|
174
|
+
/** Compile template to Vapor mode */
|
|
175
|
+
compileVapor(template: string, options?: CompilerOptions): CompileResult;
|
|
176
|
+
|
|
177
|
+
/** Parse template to AST */
|
|
178
|
+
parse(template: string, options?: CompilerOptions): object;
|
|
179
|
+
|
|
180
|
+
/** Parse SFC (.vue file) */
|
|
181
|
+
parseSfc(source: string, options?: SfcParseOptions): SfcDescriptor;
|
|
182
|
+
|
|
183
|
+
/** Compile SFC (.vue file) */
|
|
184
|
+
compileSfc(source: string, options?: SfcCompileOptions): SfcCompileResult;
|
|
185
|
+
|
|
186
|
+
/** Compile CSS with LightningCSS */
|
|
187
|
+
compileCss(css: string, options?: CssCompileOptions): CssCompileResult;
|
|
188
|
+
|
|
189
|
+
/** Free the WASM memory (called automatically via Symbol.dispose) */
|
|
190
|
+
free(): void;
|
|
191
|
+
|
|
192
|
+
/** Disposable interface */
|
|
193
|
+
[Symbol.dispose](): void;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Compile template to VDom render function */
|
|
197
|
+
export declare function compile(
|
|
198
|
+
template: string,
|
|
199
|
+
options?: CompilerOptions
|
|
200
|
+
): CompileResult;
|
|
201
|
+
|
|
202
|
+
/** Compile template to Vapor mode */
|
|
203
|
+
export declare function compileVapor(
|
|
204
|
+
template: string,
|
|
205
|
+
options?: CompilerOptions
|
|
206
|
+
): CompileResult;
|
|
207
|
+
|
|
208
|
+
/** Parse template to AST */
|
|
209
|
+
export declare function parseTemplate(
|
|
210
|
+
template: string,
|
|
211
|
+
options?: CompilerOptions
|
|
212
|
+
): object;
|
|
213
|
+
|
|
214
|
+
/** Parse SFC (.vue file) */
|
|
215
|
+
export declare function parseSfc(
|
|
216
|
+
source: string,
|
|
217
|
+
options?: SfcParseOptions
|
|
218
|
+
): SfcDescriptor;
|
|
219
|
+
|
|
220
|
+
/** Compile SFC (.vue file) */
|
|
221
|
+
export declare function compileSfc(
|
|
222
|
+
source: string,
|
|
223
|
+
options?: SfcCompileOptions
|
|
224
|
+
): SfcCompileResult;
|
|
225
|
+
|
|
226
|
+
/** Compile CSS with LightningCSS */
|
|
227
|
+
export declare function compileCss(
|
|
228
|
+
css: string,
|
|
229
|
+
options?: CssCompileOptions
|
|
230
|
+
): CssCompileResult;
|
|
231
|
+
|
|
232
|
+
/** Initialize the WASM module */
|
|
233
|
+
export declare function init(
|
|
234
|
+
moduleOrPath?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module
|
|
235
|
+
): Promise<void>;
|
|
236
|
+
|
|
237
|
+
/** Check if the WASM module is initialized */
|
|
238
|
+
export declare function isInitialized(): boolean;
|
|
239
|
+
|
|
240
|
+
export default init;
|
package/index.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vize - WASM bindings
|
|
3
|
+
*
|
|
4
|
+
* This module provides WebAssembly bindings for the Vue compiler implemented in Rust.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import initWasm, {
|
|
8
|
+
Compiler as WasmCompiler,
|
|
9
|
+
compile as wasmCompile,
|
|
10
|
+
compileVapor as wasmCompileVapor,
|
|
11
|
+
parseTemplate as wasmParseTemplate,
|
|
12
|
+
parseSfc as wasmParseSfc,
|
|
13
|
+
compileSfc as wasmCompileSfc,
|
|
14
|
+
compileCss as wasmCompileCss,
|
|
15
|
+
} from "./vize_bindings.js";
|
|
16
|
+
|
|
17
|
+
let initialized = false;
|
|
18
|
+
let initPromise = null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Initialize the WASM module.
|
|
22
|
+
* Must be called before using any other functions.
|
|
23
|
+
*
|
|
24
|
+
* @param {RequestInfo | URL | Response | BufferSource | WebAssembly.Module} [moduleOrPath]
|
|
25
|
+
* @returns {Promise<void>}
|
|
26
|
+
*/
|
|
27
|
+
export async function init(moduleOrPath) {
|
|
28
|
+
if (initialized) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (initPromise) {
|
|
33
|
+
return initPromise;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
initPromise = initWasm(moduleOrPath).then(() => {
|
|
37
|
+
initialized = true;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return initPromise;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Check if the WASM module is initialized.
|
|
45
|
+
*
|
|
46
|
+
* @returns {boolean}
|
|
47
|
+
*/
|
|
48
|
+
export function isInitialized() {
|
|
49
|
+
return initialized;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Ensure WASM is initialized, throwing if not.
|
|
54
|
+
*/
|
|
55
|
+
function ensureInitialized() {
|
|
56
|
+
if (!initialized) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
"WASM module not initialized. Call `await init()` first."
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* WASM Compiler class wrapper.
|
|
65
|
+
*/
|
|
66
|
+
export class Compiler {
|
|
67
|
+
#inner;
|
|
68
|
+
|
|
69
|
+
constructor() {
|
|
70
|
+
ensureInitialized();
|
|
71
|
+
this.#inner = new WasmCompiler();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Compile template to VDom render function.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} template
|
|
78
|
+
* @param {object} [options]
|
|
79
|
+
* @returns {object}
|
|
80
|
+
*/
|
|
81
|
+
compile(template, options = {}) {
|
|
82
|
+
return this.#inner.compile(template, options);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Compile template to Vapor mode.
|
|
87
|
+
*
|
|
88
|
+
* @param {string} template
|
|
89
|
+
* @param {object} [options]
|
|
90
|
+
* @returns {object}
|
|
91
|
+
*/
|
|
92
|
+
compileVapor(template, options = {}) {
|
|
93
|
+
return this.#inner.compileVapor(template, options);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Parse template to AST.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} template
|
|
100
|
+
* @param {object} [options]
|
|
101
|
+
* @returns {object}
|
|
102
|
+
*/
|
|
103
|
+
parse(template, options = {}) {
|
|
104
|
+
return this.#inner.parse(template, options);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Parse SFC (.vue file).
|
|
109
|
+
*
|
|
110
|
+
* @param {string} source
|
|
111
|
+
* @param {object} [options]
|
|
112
|
+
* @returns {object}
|
|
113
|
+
*/
|
|
114
|
+
parseSfc(source, options = {}) {
|
|
115
|
+
return this.#inner.parseSfc(source, options);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Compile SFC (.vue file).
|
|
120
|
+
*
|
|
121
|
+
* @param {string} source
|
|
122
|
+
* @param {object} [options]
|
|
123
|
+
* @returns {object}
|
|
124
|
+
*/
|
|
125
|
+
compileSfc(source, options = {}) {
|
|
126
|
+
return this.#inner.compileSfc(source, options);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Compile CSS with LightningCSS.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} css
|
|
133
|
+
* @param {object} [options]
|
|
134
|
+
* @returns {object}
|
|
135
|
+
*/
|
|
136
|
+
compileCss(css, options = {}) {
|
|
137
|
+
return this.#inner.compileCss(css, options);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Free the WASM memory.
|
|
142
|
+
*/
|
|
143
|
+
free() {
|
|
144
|
+
this.#inner.free();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Disposable interface.
|
|
149
|
+
*/
|
|
150
|
+
[Symbol.dispose]() {
|
|
151
|
+
this.free();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Compile template to VDom render function.
|
|
157
|
+
*
|
|
158
|
+
* @param {string} template
|
|
159
|
+
* @param {object} [options]
|
|
160
|
+
* @returns {object}
|
|
161
|
+
*/
|
|
162
|
+
export function compile(template, options = {}) {
|
|
163
|
+
ensureInitialized();
|
|
164
|
+
return wasmCompile(template, options);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Compile template to Vapor mode.
|
|
169
|
+
*
|
|
170
|
+
* @param {string} template
|
|
171
|
+
* @param {object} [options]
|
|
172
|
+
* @returns {object}
|
|
173
|
+
*/
|
|
174
|
+
export function compileVapor(template, options = {}) {
|
|
175
|
+
ensureInitialized();
|
|
176
|
+
return wasmCompileVapor(template, options);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Parse template to AST.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} template
|
|
183
|
+
* @param {object} [options]
|
|
184
|
+
* @returns {object}
|
|
185
|
+
*/
|
|
186
|
+
export function parseTemplate(template, options = {}) {
|
|
187
|
+
ensureInitialized();
|
|
188
|
+
return wasmParseTemplate(template, options);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Parse SFC (.vue file).
|
|
193
|
+
*
|
|
194
|
+
* @param {string} source
|
|
195
|
+
* @param {object} [options]
|
|
196
|
+
* @returns {object}
|
|
197
|
+
*/
|
|
198
|
+
export function parseSfc(source, options = {}) {
|
|
199
|
+
ensureInitialized();
|
|
200
|
+
return wasmParseSfc(source, options);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Compile SFC (.vue file).
|
|
205
|
+
*
|
|
206
|
+
* @param {string} source
|
|
207
|
+
* @param {object} [options]
|
|
208
|
+
* @returns {object}
|
|
209
|
+
*/
|
|
210
|
+
export function compileSfc(source, options = {}) {
|
|
211
|
+
ensureInitialized();
|
|
212
|
+
return wasmCompileSfc(source, options);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Compile CSS with LightningCSS.
|
|
217
|
+
*
|
|
218
|
+
* @param {string} css
|
|
219
|
+
* @param {object} [options]
|
|
220
|
+
* @returns {object}
|
|
221
|
+
*/
|
|
222
|
+
export function compileCss(css, options = {}) {
|
|
223
|
+
ensureInitialized();
|
|
224
|
+
return wasmCompileCss(css, options);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export default init;
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vizejs/wasm",
|
|
3
|
+
"version": "0.0.1-alpha.8",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"provenance": false,
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"description": "Vue compiler implemented in Rust - WASM bindings",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "index.js",
|
|
11
|
+
"module": "index.js",
|
|
12
|
+
"types": "index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"index.d.ts",
|
|
16
|
+
"vize_bindings.js",
|
|
17
|
+
"vize_bindings.d.ts",
|
|
18
|
+
"vize_bindings_bg.wasm",
|
|
19
|
+
"vize_bindings_bg.wasm.d.ts"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"import": "./index.js",
|
|
25
|
+
"default": "./index.js"
|
|
26
|
+
},
|
|
27
|
+
"./vize_bindings": {
|
|
28
|
+
"types": "./vize_bindings.d.ts",
|
|
29
|
+
"import": "./vize_bindings.js",
|
|
30
|
+
"default": "./vize_bindings.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "cargo build --release -p vize_vitrine --no-default-features --features wasm --target wasm32-unknown-unknown && wasm-bindgen ../../target/wasm32-unknown-unknown/release/vize_bindings.wasm --out-dir . --target web",
|
|
35
|
+
"build:debug": "cargo build -p vize_vitrine --no-default-features --features wasm --target wasm32-unknown-unknown && wasm-bindgen ../../target/wasm32-unknown-unknown/debug/vize_bindings.wasm --out-dir . --target web"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/ubugeeei/vize"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"vue",
|
|
43
|
+
"compiler",
|
|
44
|
+
"rust",
|
|
45
|
+
"wasm",
|
|
46
|
+
"webassembly",
|
|
47
|
+
"vize"
|
|
48
|
+
],
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"sideEffects": false
|
|
51
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class Compiler {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
/**
|
|
8
|
+
* Compile SFC template block
|
|
9
|
+
*/
|
|
10
|
+
compileSfc(source: string, options: any): any;
|
|
11
|
+
/**
|
|
12
|
+
* Compile template to Vapor mode
|
|
13
|
+
*/
|
|
14
|
+
compileVapor(template: string, options: any): any;
|
|
15
|
+
/**
|
|
16
|
+
* Parse SFC (.vue file)
|
|
17
|
+
*/
|
|
18
|
+
parseSfc(source: string, options: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* Compile CSS with LightningCSS
|
|
21
|
+
*/
|
|
22
|
+
compileCss(css: string, options: any): any;
|
|
23
|
+
constructor();
|
|
24
|
+
/**
|
|
25
|
+
* Parse template to AST
|
|
26
|
+
*/
|
|
27
|
+
parse(template: string, _options: any): any;
|
|
28
|
+
/**
|
|
29
|
+
* Compile template to VDom render function
|
|
30
|
+
*/
|
|
31
|
+
compile(template: string, options: any): any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Compile template to VDom (free function)
|
|
36
|
+
*/
|
|
37
|
+
export function compile(template: string, options: any): any;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Compile CSS (free function)
|
|
41
|
+
*/
|
|
42
|
+
export function compileCss(css: string, options: any): any;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Compile SFC (free function)
|
|
46
|
+
*/
|
|
47
|
+
export function compileSfc(source: string, options: any): any;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Compile template to Vapor mode (free function)
|
|
51
|
+
*/
|
|
52
|
+
export function compileVapor(template: string, options: any): any;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Parse SFC (free function)
|
|
56
|
+
*/
|
|
57
|
+
export function parseSfc(source: string, options: any): any;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Parse template to AST (free function)
|
|
61
|
+
*/
|
|
62
|
+
export function parseTemplate(template: string, options: any): any;
|
|
63
|
+
|
|
64
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
65
|
+
|
|
66
|
+
export interface InitOutput {
|
|
67
|
+
readonly memory: WebAssembly.Memory;
|
|
68
|
+
readonly __wbg_compiler_free: (a: number, b: number) => void;
|
|
69
|
+
readonly compile: (a: number, b: number, c: any) => [number, number, number];
|
|
70
|
+
readonly compileCss: (a: number, b: number, c: any) => [number, number, number];
|
|
71
|
+
readonly compileSfc: (a: number, b: number, c: any) => [number, number, number];
|
|
72
|
+
readonly compileVapor: (a: number, b: number, c: any) => [number, number, number];
|
|
73
|
+
readonly compiler_compile: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
74
|
+
readonly compiler_compileCss: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
75
|
+
readonly compiler_compileSfc: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
76
|
+
readonly compiler_compileVapor: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
77
|
+
readonly compiler_parse: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
78
|
+
readonly compiler_parseSfc: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
79
|
+
readonly parseSfc: (a: number, b: number, c: any) => [number, number, number];
|
|
80
|
+
readonly parseTemplate: (a: number, b: number, c: any) => [number, number, number];
|
|
81
|
+
readonly compiler_new: () => number;
|
|
82
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
83
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
84
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
85
|
+
readonly __externref_table_alloc: () => number;
|
|
86
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
87
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
88
|
+
readonly __wbindgen_start: () => void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
95
|
+
* a precompiled `WebAssembly.Module`.
|
|
96
|
+
*
|
|
97
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
98
|
+
*
|
|
99
|
+
* @returns {InitOutput}
|
|
100
|
+
*/
|
|
101
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
105
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
106
|
+
*
|
|
107
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
108
|
+
*
|
|
109
|
+
* @returns {Promise<InitOutput>}
|
|
110
|
+
*/
|
|
111
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/vize_bindings.js
ADDED
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function debugString(val) {
|
|
10
|
+
// primitive types
|
|
11
|
+
const type = typeof val;
|
|
12
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
13
|
+
return `${val}`;
|
|
14
|
+
}
|
|
15
|
+
if (type == 'string') {
|
|
16
|
+
return `"${val}"`;
|
|
17
|
+
}
|
|
18
|
+
if (type == 'symbol') {
|
|
19
|
+
const description = val.description;
|
|
20
|
+
if (description == null) {
|
|
21
|
+
return 'Symbol';
|
|
22
|
+
} else {
|
|
23
|
+
return `Symbol(${description})`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (type == 'function') {
|
|
27
|
+
const name = val.name;
|
|
28
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
29
|
+
return `Function(${name})`;
|
|
30
|
+
} else {
|
|
31
|
+
return 'Function';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// objects
|
|
35
|
+
if (Array.isArray(val)) {
|
|
36
|
+
const length = val.length;
|
|
37
|
+
let debug = '[';
|
|
38
|
+
if (length > 0) {
|
|
39
|
+
debug += debugString(val[0]);
|
|
40
|
+
}
|
|
41
|
+
for(let i = 1; i < length; i++) {
|
|
42
|
+
debug += ', ' + debugString(val[i]);
|
|
43
|
+
}
|
|
44
|
+
debug += ']';
|
|
45
|
+
return debug;
|
|
46
|
+
}
|
|
47
|
+
// Test for built-in
|
|
48
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
49
|
+
let className;
|
|
50
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
51
|
+
className = builtInMatches[1];
|
|
52
|
+
} else {
|
|
53
|
+
// Failed to match the standard '[object ClassName]'
|
|
54
|
+
return toString.call(val);
|
|
55
|
+
}
|
|
56
|
+
if (className == 'Object') {
|
|
57
|
+
// we're a user defined class or Object
|
|
58
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
59
|
+
// easier than looping through ownProperties of `val`.
|
|
60
|
+
try {
|
|
61
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
62
|
+
} catch (_) {
|
|
63
|
+
return 'Object';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// errors
|
|
67
|
+
if (val instanceof Error) {
|
|
68
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
69
|
+
}
|
|
70
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
71
|
+
return className;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
75
|
+
ptr = ptr >>> 0;
|
|
76
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let cachedDataViewMemory0 = null;
|
|
80
|
+
function getDataViewMemory0() {
|
|
81
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
82
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
83
|
+
}
|
|
84
|
+
return cachedDataViewMemory0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getStringFromWasm0(ptr, len) {
|
|
88
|
+
ptr = ptr >>> 0;
|
|
89
|
+
return decodeText(ptr, len);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let cachedUint8ArrayMemory0 = null;
|
|
93
|
+
function getUint8ArrayMemory0() {
|
|
94
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
95
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
96
|
+
}
|
|
97
|
+
return cachedUint8ArrayMemory0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function handleError(f, args) {
|
|
101
|
+
try {
|
|
102
|
+
return f.apply(this, args);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
const idx = addToExternrefTable0(e);
|
|
105
|
+
wasm.__wbindgen_exn_store(idx);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function isLikeNone(x) {
|
|
110
|
+
return x === undefined || x === null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
114
|
+
if (realloc === undefined) {
|
|
115
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
116
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
117
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
118
|
+
WASM_VECTOR_LEN = buf.length;
|
|
119
|
+
return ptr;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let len = arg.length;
|
|
123
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
124
|
+
|
|
125
|
+
const mem = getUint8ArrayMemory0();
|
|
126
|
+
|
|
127
|
+
let offset = 0;
|
|
128
|
+
|
|
129
|
+
for (; offset < len; offset++) {
|
|
130
|
+
const code = arg.charCodeAt(offset);
|
|
131
|
+
if (code > 0x7F) break;
|
|
132
|
+
mem[ptr + offset] = code;
|
|
133
|
+
}
|
|
134
|
+
if (offset !== len) {
|
|
135
|
+
if (offset !== 0) {
|
|
136
|
+
arg = arg.slice(offset);
|
|
137
|
+
}
|
|
138
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
139
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
140
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
141
|
+
|
|
142
|
+
offset += ret.written;
|
|
143
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
WASM_VECTOR_LEN = offset;
|
|
147
|
+
return ptr;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function takeFromExternrefTable0(idx) {
|
|
151
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
152
|
+
wasm.__externref_table_dealloc(idx);
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
157
|
+
cachedTextDecoder.decode();
|
|
158
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
159
|
+
let numBytesDecoded = 0;
|
|
160
|
+
function decodeText(ptr, len) {
|
|
161
|
+
numBytesDecoded += len;
|
|
162
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
163
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
164
|
+
cachedTextDecoder.decode();
|
|
165
|
+
numBytesDecoded = len;
|
|
166
|
+
}
|
|
167
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const cachedTextEncoder = new TextEncoder();
|
|
171
|
+
|
|
172
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
173
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
174
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
175
|
+
view.set(buf);
|
|
176
|
+
return {
|
|
177
|
+
read: arg.length,
|
|
178
|
+
written: buf.length
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
let WASM_VECTOR_LEN = 0;
|
|
184
|
+
|
|
185
|
+
const CompilerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
186
|
+
? { register: () => {}, unregister: () => {} }
|
|
187
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_compiler_free(ptr >>> 0, 1));
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* WASM Compiler instance
|
|
191
|
+
*/
|
|
192
|
+
export class Compiler {
|
|
193
|
+
__destroy_into_raw() {
|
|
194
|
+
const ptr = this.__wbg_ptr;
|
|
195
|
+
this.__wbg_ptr = 0;
|
|
196
|
+
CompilerFinalization.unregister(this);
|
|
197
|
+
return ptr;
|
|
198
|
+
}
|
|
199
|
+
free() {
|
|
200
|
+
const ptr = this.__destroy_into_raw();
|
|
201
|
+
wasm.__wbg_compiler_free(ptr, 0);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Compile SFC template block
|
|
205
|
+
* @param {string} source
|
|
206
|
+
* @param {any} options
|
|
207
|
+
* @returns {any}
|
|
208
|
+
*/
|
|
209
|
+
compileSfc(source, options) {
|
|
210
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
211
|
+
const len0 = WASM_VECTOR_LEN;
|
|
212
|
+
const ret = wasm.compiler_compileSfc(this.__wbg_ptr, ptr0, len0, options);
|
|
213
|
+
if (ret[2]) {
|
|
214
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
215
|
+
}
|
|
216
|
+
return takeFromExternrefTable0(ret[0]);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Compile template to Vapor mode
|
|
220
|
+
* @param {string} template
|
|
221
|
+
* @param {any} options
|
|
222
|
+
* @returns {any}
|
|
223
|
+
*/
|
|
224
|
+
compileVapor(template, options) {
|
|
225
|
+
const ptr0 = passStringToWasm0(template, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
226
|
+
const len0 = WASM_VECTOR_LEN;
|
|
227
|
+
const ret = wasm.compiler_compileVapor(this.__wbg_ptr, ptr0, len0, options);
|
|
228
|
+
if (ret[2]) {
|
|
229
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
230
|
+
}
|
|
231
|
+
return takeFromExternrefTable0(ret[0]);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Parse SFC (.vue file)
|
|
235
|
+
* @param {string} source
|
|
236
|
+
* @param {any} options
|
|
237
|
+
* @returns {any}
|
|
238
|
+
*/
|
|
239
|
+
parseSfc(source, options) {
|
|
240
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
241
|
+
const len0 = WASM_VECTOR_LEN;
|
|
242
|
+
const ret = wasm.compiler_parseSfc(this.__wbg_ptr, ptr0, len0, options);
|
|
243
|
+
if (ret[2]) {
|
|
244
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
245
|
+
}
|
|
246
|
+
return takeFromExternrefTable0(ret[0]);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Compile CSS with LightningCSS
|
|
250
|
+
* @param {string} css
|
|
251
|
+
* @param {any} options
|
|
252
|
+
* @returns {any}
|
|
253
|
+
*/
|
|
254
|
+
compileCss(css, options) {
|
|
255
|
+
const ptr0 = passStringToWasm0(css, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
256
|
+
const len0 = WASM_VECTOR_LEN;
|
|
257
|
+
const ret = wasm.compiler_compileCss(this.__wbg_ptr, ptr0, len0, options);
|
|
258
|
+
if (ret[2]) {
|
|
259
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
260
|
+
}
|
|
261
|
+
return takeFromExternrefTable0(ret[0]);
|
|
262
|
+
}
|
|
263
|
+
constructor() {
|
|
264
|
+
const ret = wasm.compiler_new();
|
|
265
|
+
this.__wbg_ptr = ret >>> 0;
|
|
266
|
+
CompilerFinalization.register(this, this.__wbg_ptr, this);
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Parse template to AST
|
|
271
|
+
* @param {string} template
|
|
272
|
+
* @param {any} _options
|
|
273
|
+
* @returns {any}
|
|
274
|
+
*/
|
|
275
|
+
parse(template, _options) {
|
|
276
|
+
const ptr0 = passStringToWasm0(template, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
277
|
+
const len0 = WASM_VECTOR_LEN;
|
|
278
|
+
const ret = wasm.compiler_parse(this.__wbg_ptr, ptr0, len0, _options);
|
|
279
|
+
if (ret[2]) {
|
|
280
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
281
|
+
}
|
|
282
|
+
return takeFromExternrefTable0(ret[0]);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Compile template to VDom render function
|
|
286
|
+
* @param {string} template
|
|
287
|
+
* @param {any} options
|
|
288
|
+
* @returns {any}
|
|
289
|
+
*/
|
|
290
|
+
compile(template, options) {
|
|
291
|
+
const ptr0 = passStringToWasm0(template, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
292
|
+
const len0 = WASM_VECTOR_LEN;
|
|
293
|
+
const ret = wasm.compiler_compile(this.__wbg_ptr, ptr0, len0, options);
|
|
294
|
+
if (ret[2]) {
|
|
295
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
296
|
+
}
|
|
297
|
+
return takeFromExternrefTable0(ret[0]);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (Symbol.dispose) Compiler.prototype[Symbol.dispose] = Compiler.prototype.free;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Compile template to VDom (free function)
|
|
304
|
+
* @param {string} template
|
|
305
|
+
* @param {any} options
|
|
306
|
+
* @returns {any}
|
|
307
|
+
*/
|
|
308
|
+
export function compile(template, options) {
|
|
309
|
+
const ptr0 = passStringToWasm0(template, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
310
|
+
const len0 = WASM_VECTOR_LEN;
|
|
311
|
+
const ret = wasm.compile(ptr0, len0, options);
|
|
312
|
+
if (ret[2]) {
|
|
313
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
314
|
+
}
|
|
315
|
+
return takeFromExternrefTable0(ret[0]);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Compile CSS (free function)
|
|
320
|
+
* @param {string} css
|
|
321
|
+
* @param {any} options
|
|
322
|
+
* @returns {any}
|
|
323
|
+
*/
|
|
324
|
+
export function compileCss(css, options) {
|
|
325
|
+
const ptr0 = passStringToWasm0(css, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
326
|
+
const len0 = WASM_VECTOR_LEN;
|
|
327
|
+
const ret = wasm.compileCss(ptr0, len0, options);
|
|
328
|
+
if (ret[2]) {
|
|
329
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
330
|
+
}
|
|
331
|
+
return takeFromExternrefTable0(ret[0]);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Compile SFC (free function)
|
|
336
|
+
* @param {string} source
|
|
337
|
+
* @param {any} options
|
|
338
|
+
* @returns {any}
|
|
339
|
+
*/
|
|
340
|
+
export function compileSfc(source, options) {
|
|
341
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
342
|
+
const len0 = WASM_VECTOR_LEN;
|
|
343
|
+
const ret = wasm.compileSfc(ptr0, len0, options);
|
|
344
|
+
if (ret[2]) {
|
|
345
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
346
|
+
}
|
|
347
|
+
return takeFromExternrefTable0(ret[0]);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Compile template to Vapor mode (free function)
|
|
352
|
+
* @param {string} template
|
|
353
|
+
* @param {any} options
|
|
354
|
+
* @returns {any}
|
|
355
|
+
*/
|
|
356
|
+
export function compileVapor(template, options) {
|
|
357
|
+
const ptr0 = passStringToWasm0(template, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
358
|
+
const len0 = WASM_VECTOR_LEN;
|
|
359
|
+
const ret = wasm.compileVapor(ptr0, len0, options);
|
|
360
|
+
if (ret[2]) {
|
|
361
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
362
|
+
}
|
|
363
|
+
return takeFromExternrefTable0(ret[0]);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Parse SFC (free function)
|
|
368
|
+
* @param {string} source
|
|
369
|
+
* @param {any} options
|
|
370
|
+
* @returns {any}
|
|
371
|
+
*/
|
|
372
|
+
export function parseSfc(source, options) {
|
|
373
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
374
|
+
const len0 = WASM_VECTOR_LEN;
|
|
375
|
+
const ret = wasm.parseSfc(ptr0, len0, options);
|
|
376
|
+
if (ret[2]) {
|
|
377
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
378
|
+
}
|
|
379
|
+
return takeFromExternrefTable0(ret[0]);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Parse template to AST (free function)
|
|
384
|
+
* @param {string} template
|
|
385
|
+
* @param {any} options
|
|
386
|
+
* @returns {any}
|
|
387
|
+
*/
|
|
388
|
+
export function parseTemplate(template, options) {
|
|
389
|
+
const ptr0 = passStringToWasm0(template, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
390
|
+
const len0 = WASM_VECTOR_LEN;
|
|
391
|
+
const ret = wasm.parseTemplate(ptr0, len0, options);
|
|
392
|
+
if (ret[2]) {
|
|
393
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
394
|
+
}
|
|
395
|
+
return takeFromExternrefTable0(ret[0]);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
399
|
+
|
|
400
|
+
async function __wbg_load(module, imports) {
|
|
401
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
402
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
403
|
+
try {
|
|
404
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
405
|
+
} catch (e) {
|
|
406
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
407
|
+
|
|
408
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
409
|
+
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", e);
|
|
410
|
+
|
|
411
|
+
} else {
|
|
412
|
+
throw e;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const bytes = await module.arrayBuffer();
|
|
418
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
419
|
+
} else {
|
|
420
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
421
|
+
|
|
422
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
423
|
+
return { instance, module };
|
|
424
|
+
} else {
|
|
425
|
+
return instance;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function __wbg_get_imports() {
|
|
431
|
+
const imports = {};
|
|
432
|
+
imports.wbg = {};
|
|
433
|
+
imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
|
|
434
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
435
|
+
return ret;
|
|
436
|
+
};
|
|
437
|
+
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
438
|
+
const ret = String(arg1);
|
|
439
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
440
|
+
const len1 = WASM_VECTOR_LEN;
|
|
441
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
442
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
443
|
+
};
|
|
444
|
+
imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
|
|
445
|
+
const v = arg0;
|
|
446
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
447
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
448
|
+
};
|
|
449
|
+
imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
|
|
450
|
+
const ret = debugString(arg1);
|
|
451
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
452
|
+
const len1 = WASM_VECTOR_LEN;
|
|
453
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
454
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
455
|
+
};
|
|
456
|
+
imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
|
|
457
|
+
const ret = arg0 in arg1;
|
|
458
|
+
return ret;
|
|
459
|
+
};
|
|
460
|
+
imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
|
|
461
|
+
const ret = arg0 === null;
|
|
462
|
+
return ret;
|
|
463
|
+
};
|
|
464
|
+
imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
|
|
465
|
+
const val = arg0;
|
|
466
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
467
|
+
return ret;
|
|
468
|
+
};
|
|
469
|
+
imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
|
|
470
|
+
const ret = typeof(arg0) === 'string';
|
|
471
|
+
return ret;
|
|
472
|
+
};
|
|
473
|
+
imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
474
|
+
const ret = arg0 === undefined;
|
|
475
|
+
return ret;
|
|
476
|
+
};
|
|
477
|
+
imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
|
|
478
|
+
const ret = arg0 == arg1;
|
|
479
|
+
return ret;
|
|
480
|
+
};
|
|
481
|
+
imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
|
|
482
|
+
const obj = arg1;
|
|
483
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
484
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
485
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
486
|
+
};
|
|
487
|
+
imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
488
|
+
const obj = arg1;
|
|
489
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
490
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
491
|
+
var len1 = WASM_VECTOR_LEN;
|
|
492
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
493
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
494
|
+
};
|
|
495
|
+
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
496
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
497
|
+
};
|
|
498
|
+
imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
|
|
499
|
+
const ret = Reflect.get(arg0, arg1);
|
|
500
|
+
return ret;
|
|
501
|
+
}, arguments) };
|
|
502
|
+
imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
|
|
503
|
+
const ret = arg0[arg1];
|
|
504
|
+
return ret;
|
|
505
|
+
};
|
|
506
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
|
|
507
|
+
let result;
|
|
508
|
+
try {
|
|
509
|
+
result = arg0 instanceof ArrayBuffer;
|
|
510
|
+
} catch (_) {
|
|
511
|
+
result = false;
|
|
512
|
+
}
|
|
513
|
+
const ret = result;
|
|
514
|
+
return ret;
|
|
515
|
+
};
|
|
516
|
+
imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
|
|
517
|
+
let result;
|
|
518
|
+
try {
|
|
519
|
+
result = arg0 instanceof Uint8Array;
|
|
520
|
+
} catch (_) {
|
|
521
|
+
result = false;
|
|
522
|
+
}
|
|
523
|
+
const ret = result;
|
|
524
|
+
return ret;
|
|
525
|
+
};
|
|
526
|
+
imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
|
|
527
|
+
const ret = arg0.length;
|
|
528
|
+
return ret;
|
|
529
|
+
};
|
|
530
|
+
imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
|
|
531
|
+
const ret = new Object();
|
|
532
|
+
return ret;
|
|
533
|
+
};
|
|
534
|
+
imports.wbg.__wbg_new_25f239778d6112b9 = function() {
|
|
535
|
+
const ret = new Array();
|
|
536
|
+
return ret;
|
|
537
|
+
};
|
|
538
|
+
imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
|
|
539
|
+
const ret = new Uint8Array(arg0);
|
|
540
|
+
return ret;
|
|
541
|
+
};
|
|
542
|
+
imports.wbg.__wbg_new_b546ae120718850e = function() {
|
|
543
|
+
const ret = new Map();
|
|
544
|
+
return ret;
|
|
545
|
+
};
|
|
546
|
+
imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
|
|
547
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
548
|
+
};
|
|
549
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
550
|
+
arg0[arg1] = arg2;
|
|
551
|
+
};
|
|
552
|
+
imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
|
|
553
|
+
arg0[arg1 >>> 0] = arg2;
|
|
554
|
+
};
|
|
555
|
+
imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
|
|
556
|
+
const ret = arg0.set(arg1, arg2);
|
|
557
|
+
return ret;
|
|
558
|
+
};
|
|
559
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
560
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
561
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
562
|
+
return ret;
|
|
563
|
+
};
|
|
564
|
+
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
565
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
566
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
567
|
+
return ret;
|
|
568
|
+
};
|
|
569
|
+
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
570
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
571
|
+
const ret = arg0;
|
|
572
|
+
return ret;
|
|
573
|
+
};
|
|
574
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
575
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
576
|
+
const ret = arg0;
|
|
577
|
+
return ret;
|
|
578
|
+
};
|
|
579
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
580
|
+
const table = wasm.__wbindgen_externrefs;
|
|
581
|
+
const offset = table.grow(4);
|
|
582
|
+
table.set(0, undefined);
|
|
583
|
+
table.set(offset + 0, undefined);
|
|
584
|
+
table.set(offset + 1, null);
|
|
585
|
+
table.set(offset + 2, true);
|
|
586
|
+
table.set(offset + 3, false);
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
return imports;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
function __wbg_finalize_init(instance, module) {
|
|
593
|
+
wasm = instance.exports;
|
|
594
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
595
|
+
cachedDataViewMemory0 = null;
|
|
596
|
+
cachedUint8ArrayMemory0 = null;
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
wasm.__wbindgen_start();
|
|
600
|
+
return wasm;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function initSync(module) {
|
|
604
|
+
if (wasm !== undefined) return wasm;
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
if (typeof module !== 'undefined') {
|
|
608
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
609
|
+
({module} = module)
|
|
610
|
+
} else {
|
|
611
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
const imports = __wbg_get_imports();
|
|
616
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
617
|
+
module = new WebAssembly.Module(module);
|
|
618
|
+
}
|
|
619
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
620
|
+
return __wbg_finalize_init(instance, module);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
async function __wbg_init(module_or_path) {
|
|
624
|
+
if (wasm !== undefined) return wasm;
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
if (typeof module_or_path !== 'undefined') {
|
|
628
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
629
|
+
({module_or_path} = module_or_path)
|
|
630
|
+
} else {
|
|
631
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
if (typeof module_or_path === 'undefined') {
|
|
636
|
+
module_or_path = new URL('vize_bindings_bg.wasm', import.meta.url);
|
|
637
|
+
}
|
|
638
|
+
const imports = __wbg_get_imports();
|
|
639
|
+
|
|
640
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
641
|
+
module_or_path = fetch(module_or_path);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
645
|
+
|
|
646
|
+
return __wbg_finalize_init(instance, module);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export { initSync };
|
|
650
|
+
export default __wbg_init;
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_compiler_free: (a: number, b: number) => void;
|
|
5
|
+
export const compile: (a: number, b: number, c: any) => [number, number, number];
|
|
6
|
+
export const compileCss: (a: number, b: number, c: any) => [number, number, number];
|
|
7
|
+
export const compileSfc: (a: number, b: number, c: any) => [number, number, number];
|
|
8
|
+
export const compileVapor: (a: number, b: number, c: any) => [number, number, number];
|
|
9
|
+
export const compiler_compile: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
10
|
+
export const compiler_compileCss: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
11
|
+
export const compiler_compileSfc: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
12
|
+
export const compiler_compileVapor: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
13
|
+
export const compiler_parse: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
14
|
+
export const compiler_parseSfc: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
15
|
+
export const parseSfc: (a: number, b: number, c: any) => [number, number, number];
|
|
16
|
+
export const parseTemplate: (a: number, b: number, c: any) => [number, number, number];
|
|
17
|
+
export const compiler_new: () => number;
|
|
18
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
19
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
20
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
21
|
+
export const __externref_table_alloc: () => number;
|
|
22
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
23
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
24
|
+
export const __wbindgen_start: () => void;
|