@vizejs/wasm 0.204.0 → 0.210.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/index.d.ts +36 -0
- package/index.js +13 -0
- package/package.json +1 -1
- package/vize_vitrine.d.ts +6 -0
- package/vize_vitrine.js +16 -0
- package/vize_vitrine_bg.wasm +0 -0
package/index.d.ts
CHANGED
|
@@ -151,6 +151,36 @@ export interface SfcCompileResult {
|
|
|
151
151
|
macroArtifacts?: MacroArtifact[];
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/** JSX/TSX compile options */
|
|
155
|
+
export interface JsxCompileOptions {
|
|
156
|
+
/** Source filename, used to infer the language when `lang` is omitted. */
|
|
157
|
+
filename?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Source language. Defaults to `"jsx"` (or is inferred from a `.tsx`
|
|
160
|
+
* `filename`).
|
|
161
|
+
*/
|
|
162
|
+
lang?: "jsx" | "tsx";
|
|
163
|
+
/**
|
|
164
|
+
* Default output mode: `true` compiles components to Vapor, `false`
|
|
165
|
+
* (default) to VDOM. Per-component `"use vue:vapor"` / `"use vue:vdom"`
|
|
166
|
+
* directives override this.
|
|
167
|
+
*/
|
|
168
|
+
vapor?: boolean;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Result of JSX/TSX compilation */
|
|
172
|
+
export interface JsxCompileResult {
|
|
173
|
+
/**
|
|
174
|
+
* Generated render code for every component in the module, in source order,
|
|
175
|
+
* concatenated.
|
|
176
|
+
*/
|
|
177
|
+
code: string;
|
|
178
|
+
/** Compilation errors */
|
|
179
|
+
errors: string[];
|
|
180
|
+
/** Compilation warnings */
|
|
181
|
+
warnings: string[];
|
|
182
|
+
}
|
|
183
|
+
|
|
154
184
|
/** CSS compile options */
|
|
155
185
|
export interface CssCompileOptions {
|
|
156
186
|
/** Scope ID for scoped CSS */
|
|
@@ -247,6 +277,12 @@ export declare function compileSfc(
|
|
|
247
277
|
options?: SfcCompileOptions
|
|
248
278
|
): SfcCompileResult;
|
|
249
279
|
|
|
280
|
+
/** Compile JSX/TSX to render code */
|
|
281
|
+
export declare function compileJsx(
|
|
282
|
+
source: string,
|
|
283
|
+
options?: JsxCompileOptions
|
|
284
|
+
): JsxCompileResult;
|
|
285
|
+
|
|
250
286
|
/** Compile CSS with LightningCSS */
|
|
251
287
|
export declare function compileCss(
|
|
252
288
|
css: string,
|
package/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import initWasm, {
|
|
|
11
11
|
parseTemplate as wasmParseTemplate,
|
|
12
12
|
parseSfc as wasmParseSfc,
|
|
13
13
|
compileSfc as wasmCompileSfc,
|
|
14
|
+
compileJsx as wasmCompileJsx,
|
|
14
15
|
compileCss as wasmCompileCss,
|
|
15
16
|
} from "./vize_vitrine.js";
|
|
16
17
|
|
|
@@ -212,6 +213,18 @@ export function compileSfc(source, options = {}) {
|
|
|
212
213
|
return wasmCompileSfc(source, options);
|
|
213
214
|
}
|
|
214
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Compile JSX/TSX to render code.
|
|
218
|
+
*
|
|
219
|
+
* @param {string} source
|
|
220
|
+
* @param {object} [options]
|
|
221
|
+
* @returns {object}
|
|
222
|
+
*/
|
|
223
|
+
export function compileJsx(source, options = {}) {
|
|
224
|
+
ensureInitialized();
|
|
225
|
+
return wasmCompileJsx(source, options);
|
|
226
|
+
}
|
|
227
|
+
|
|
215
228
|
/**
|
|
216
229
|
* Compile CSS with LightningCSS.
|
|
217
230
|
*
|
package/package.json
CHANGED
package/vize_vitrine.d.ts
CHANGED
|
@@ -71,6 +71,11 @@ export function compile(template: string, options: any): any;
|
|
|
71
71
|
*/
|
|
72
72
|
export function compileCss(css: string, options: any): any;
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Compile JSX/TSX to render code (free function).
|
|
76
|
+
*/
|
|
77
|
+
export function compileJsx(source: string, options: any): any;
|
|
78
|
+
|
|
74
79
|
/**
|
|
75
80
|
* Compile SFC (free function)
|
|
76
81
|
*/
|
|
@@ -181,6 +186,7 @@ export interface InitOutput {
|
|
|
181
186
|
readonly buildInspectorGraph: (a: any) => [number, number, number];
|
|
182
187
|
readonly compile: (a: number, b: number, c: any) => [number, number, number];
|
|
183
188
|
readonly compileCss: (a: number, b: number, c: any) => [number, number, number];
|
|
189
|
+
readonly compileJsx: (a: number, b: number, c: any) => [number, number, number];
|
|
184
190
|
readonly compileSfc: (a: number, b: number, c: any) => [number, number, number];
|
|
185
191
|
readonly compileVapor: (a: number, b: number, c: any) => [number, number, number];
|
|
186
192
|
readonly compiler_compile: (a: number, b: number, c: number, d: any) => [number, number, number];
|
package/vize_vitrine.js
CHANGED
|
@@ -248,6 +248,22 @@ export function compileCss(css, options) {
|
|
|
248
248
|
return takeFromExternrefTable0(ret[0]);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Compile JSX/TSX to render code (free function).
|
|
253
|
+
* @param {string} source
|
|
254
|
+
* @param {any} options
|
|
255
|
+
* @returns {any}
|
|
256
|
+
*/
|
|
257
|
+
export function compileJsx(source, options) {
|
|
258
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
259
|
+
const len0 = WASM_VECTOR_LEN;
|
|
260
|
+
const ret = wasm.compileJsx(ptr0, len0, options);
|
|
261
|
+
if (ret[2]) {
|
|
262
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
263
|
+
}
|
|
264
|
+
return takeFromExternrefTable0(ret[0]);
|
|
265
|
+
}
|
|
266
|
+
|
|
251
267
|
/**
|
|
252
268
|
* Compile SFC (free function)
|
|
253
269
|
* @param {string} source
|
package/vize_vitrine_bg.wasm
CHANGED
|
Binary file
|