@vizejs/native 0.206.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.
Files changed (3) hide show
  1. package/index.d.ts +82 -0
  2. package/index.js +1 -0
  3. package/package.json +11 -7
package/index.d.ts CHANGED
@@ -220,6 +220,88 @@ export interface CompilerOptions {
220
220
  scriptExt?: string;
221
221
  }
222
222
 
223
+ export declare function compileJsx(
224
+ source: string,
225
+ options?: JsxCompileOptionsNapi | undefined | null,
226
+ ): JsxCompileResultNapi;
227
+
228
+ /** Options for `compileJsx`. */
229
+ export interface JsxCompileOptionsNapi {
230
+ /** Source filename, used to infer the language when `lang` is omitted. */
231
+ filename?: string;
232
+ /**
233
+ * Source language: "jsx" or "tsx". Defaults to "jsx" (or is inferred from a
234
+ * `.tsx` `filename`).
235
+ */
236
+ lang?: string;
237
+ /**
238
+ * Default output mode: "vdom" (default) or "vapor". Mirrors the
239
+ * `compiler.jsxMode` config key and takes precedence over `vapor`.
240
+ * Per-component "use vue:vapor" / "use vue:vdom" directives override it.
241
+ */
242
+ jsxMode?: string;
243
+ /**
244
+ * Legacy default-mode toggle: `true` compiles components to Vapor, `false`
245
+ * (default) to VDOM. Kept for back-compat; prefer `jsxMode`. Ignored when
246
+ * `jsxMode` is set.
247
+ */
248
+ vapor?: boolean;
249
+ /**
250
+ * Emit a v3 source map for the generated render code. When `true`, the
251
+ * result's `map` carries the map JSON; when `false` (default), `map` is
252
+ * `null` and no mapping work is done (#1533).
253
+ */
254
+ sourceMap?: boolean;
255
+ }
256
+
257
+ /** Result of `compileJsx`. */
258
+ export interface JsxCompileResultNapi {
259
+ /**
260
+ * Generated render code for the module: the deduplicated runtime-helper
261
+ * preamble (`import { … } from "vue"`) followed by every component's render
262
+ * code in source order. A self-contained module string, matching the shape
263
+ * `compileSfc` returns (the runtime-helper imports are no longer dropped,
264
+ * #1533).
265
+ */
266
+ code: string;
267
+ /**
268
+ * v3 source map (JSON) for `code`, present only when `sourceMap` was
269
+ * requested and the module is a single component (the per-file shape the
270
+ * bundler plugins consume). `null` otherwise (#1533).
271
+ */
272
+ map?: string;
273
+ /** Error-severity diagnostic messages. */
274
+ errors: Array<string>;
275
+ /** Warning-severity diagnostic messages. */
276
+ warnings: Array<string>;
277
+ /**
278
+ * Extracted `<style scoped>` blocks across the module's components, in
279
+ * source order (#1495). Empty when no component had a `<style scoped>`. Each
280
+ * entry's CSS is already scope-rewritten; the bundler plugins emit it
281
+ * through the same path SFC styles use (#1533).
282
+ */
283
+ scopedStyles: Array<JsxScopedStyleNapi>;
284
+ }
285
+
286
+ /**
287
+ * A JSX component's extracted `<style scoped>` block, surfaced to the bundler
288
+ * plugins so a `.jsx`/`.tsx` component's scoped CSS reaches the same emission
289
+ * path as SFC `<style>` blocks (#1495, #1533).
290
+ */
291
+ export interface JsxScopedStyleNapi {
292
+ /**
293
+ * The generated scope id, e.g. `data-v-1a2b3c4d`. Already injected into the
294
+ * component's rendered elements; surfaced here so the bundler can name the
295
+ * emitted stylesheet deterministically.
296
+ */
297
+ scopeId: string;
298
+ /**
299
+ * The scoped-rewritten CSS, with the `data-v-<hash>` attribute already
300
+ * applied to selectors. A bundler emits this verbatim.
301
+ */
302
+ css: string;
303
+ }
304
+
223
305
  export declare function compileSfc(
224
306
  source: string,
225
307
  options?: SfcCompileOptionsNapi | undefined | null,
package/index.js CHANGED
@@ -767,6 +767,7 @@ module.exports.classifyVitePluginRequest = nativeBinding.classifyVitePluginReque
767
767
  module.exports.collectSfcTemplateAssetUrls = nativeBinding.collectSfcTemplateAssetUrls;
768
768
  module.exports.compile = nativeBinding.compile;
769
769
  module.exports.compileCss = nativeBinding.compileCss;
770
+ module.exports.compileJsx = nativeBinding.compileJsx;
770
771
  module.exports.compileSfc = nativeBinding.compileSfc;
771
772
  module.exports.compileSfcBatch = nativeBinding.compileSfcBatch;
772
773
  module.exports.compileSfcBatchWithResults = nativeBinding.compileSfcBatchWithResults;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/native",
3
- "version": "0.206.0",
3
+ "version": "0.210.0",
4
4
  "description": "High-performance Vue.js compiler - Native bindings",
5
5
  "keywords": [
6
6
  "compiler",
@@ -36,18 +36,22 @@
36
36
  "@napi-rs/cli": "3.6.2"
37
37
  },
38
38
  "optionalDependencies": {
39
- "@vizejs/native-darwin-arm64": "0.206.0",
40
- "@vizejs/native-linux-arm64-gnu": "0.206.0",
41
- "@vizejs/native-linux-arm64-musl": "0.206.0",
42
- "@vizejs/native-linux-x64-gnu": "0.206.0",
43
- "@vizejs/native-linux-x64-musl": "0.206.0",
44
- "@vizejs/native-win32-x64-msvc": "0.206.0"
39
+ "@vizejs/native-darwin-arm64": "0.210.0",
40
+ "@vizejs/native-darwin-x64": "0.210.0",
41
+ "@vizejs/native-linux-arm64-gnu": "0.210.0",
42
+ "@vizejs/native-linux-arm64-musl": "0.210.0",
43
+ "@vizejs/native-linux-x64-gnu": "0.210.0",
44
+ "@vizejs/native-linux-x64-musl": "0.210.0",
45
+ "@vizejs/native-win32-arm64-msvc": "0.210.0",
46
+ "@vizejs/native-win32-x64-msvc": "0.210.0"
45
47
  },
46
48
  "napi": {
47
49
  "binaryName": "vize-vitrine",
48
50
  "targets": [
51
+ "x86_64-apple-darwin",
49
52
  "aarch64-apple-darwin",
50
53
  "x86_64-pc-windows-msvc",
54
+ "aarch64-pc-windows-msvc",
51
55
  "x86_64-unknown-linux-gnu",
52
56
  "x86_64-unknown-linux-musl",
53
57
  "aarch64-unknown-linux-gnu",