@fervid/napi 0.1.4 → 0.2.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 +53 -8
  2. package/index.js +2 -3
  3. package/package.json +14 -14
package/index.d.ts CHANGED
@@ -3,8 +3,49 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- export interface CompileSyncOptions {
7
- isProd: boolean
6
+ export interface FervidJsCompilerOptions {
7
+ /** Apply production optimizations. Default: false */
8
+ isProduction?: boolean
9
+ /**
10
+ * TODO Support SSR
11
+ * Enable SSR. Default: false
12
+ */
13
+ ssr?: boolean
14
+ /**
15
+ * TODO Find a performant solution to source-maps
16
+ * TODO Implement source-maps
17
+ * Enable source maps
18
+ */
19
+ sourceMap?: boolean
20
+ /** Script compilation options */
21
+ script?: FervidJsCompilerOptionsScript
22
+ /** Template compilation options */
23
+ template?: FervidJsCompilerOptionsTemplate
24
+ /** Style compilation options */
25
+ style?: FervidJsCompilerOptionsStyle
26
+ /**
27
+ * TODO Regex handling logic is needed (plus sanitation)
28
+ * TODO Implement custom element mode (low priority)
29
+ * Transform Vue SFCs into custom elements.
30
+ * - `true`: all `*.vue` imports are converted into custom elements
31
+ * - `string | RegExp`: matched files are converted into custom elements
32
+ * Default: files ending with `.ce.vue`
33
+ */
34
+ customElement?: undefined
35
+ }
36
+ export interface FervidJsCompilerOptionsTemplate {}
37
+ export interface FervidJsCompilerOptionsScript {
38
+ /**
39
+ * Ignored
40
+ * Hoist <script setup> static constants.
41
+ * - Only enabled when one `<script setup>` exists.
42
+ * Default: true
43
+ */
44
+ hoistStatic?: boolean
45
+ }
46
+ export interface FervidJsCompilerOptionsStyle {
47
+ /** Ignored */
48
+ trim?: boolean
8
49
  }
9
50
  export interface CompileResult {
10
51
  code: string
@@ -29,9 +70,13 @@ export interface SerializedError {
29
70
  hi: number
30
71
  message: string
31
72
  }
32
- export function compileSync(source: string, options?: CompileSyncOptions | undefined | null): CompileResult
33
- export function compileAsync(
34
- source: string,
35
- options?: CompileSyncOptions | undefined | null,
36
- signal?: AbortSignal | undefined | null,
37
- ): Promise<unknown>
73
+ export type FervidJsCompiler = Compiler
74
+ /** Fervid: a compiler for Vue.js written in Rust */
75
+ export class Compiler {
76
+ isProduction: boolean
77
+ ssr: boolean
78
+ sourceMap: boolean
79
+ constructor(options?: FervidJsCompilerOptions | undefined | null)
80
+ compileSync(source: string): CompileResult
81
+ compileAsync(source: string, signal?: AbortSignal | undefined | null): Promise<unknown>
82
+ }
package/index.js CHANGED
@@ -259,7 +259,6 @@ if (!nativeBinding) {
259
259
  throw new Error(`Failed to load native binding`)
260
260
  }
261
261
 
262
- const { compileSync, compileAsync } = nativeBinding
262
+ const { Compiler } = nativeBinding
263
263
 
264
- module.exports.compileSync = compileSync
265
- module.exports.compileAsync = compileAsync
264
+ module.exports.Compiler = Compiler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fervid/napi",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "All-in-One Vue compiler written in Rust",
5
5
  "main": "index.js",
6
6
  "repository": "git@github.com:phoenix-ru/fervid.git",
@@ -100,19 +100,19 @@
100
100
  "arrowParens": "always"
101
101
  },
102
102
  "optionalDependencies": {
103
- "@fervid/napi-win32-x64-msvc": "0.1.4",
104
- "@fervid/napi-darwin-x64": "0.1.4",
105
- "@fervid/napi-linux-x64-gnu": "0.1.4",
106
- "@fervid/napi-linux-x64-musl": "0.1.4",
107
- "@fervid/napi-linux-arm64-gnu": "0.1.4",
108
- "@fervid/napi-win32-ia32-msvc": "0.1.4",
109
- "@fervid/napi-linux-arm-gnueabihf": "0.1.4",
110
- "@fervid/napi-darwin-arm64": "0.1.4",
111
- "@fervid/napi-android-arm64": "0.1.4",
112
- "@fervid/napi-freebsd-x64": "0.1.4",
113
- "@fervid/napi-linux-arm64-musl": "0.1.4",
114
- "@fervid/napi-win32-arm64-msvc": "0.1.4",
115
- "@fervid/napi-android-arm-eabi": "0.1.4"
103
+ "@fervid/napi-win32-x64-msvc": "0.2.0",
104
+ "@fervid/napi-darwin-x64": "0.2.0",
105
+ "@fervid/napi-linux-x64-gnu": "0.2.0",
106
+ "@fervid/napi-linux-x64-musl": "0.2.0",
107
+ "@fervid/napi-linux-arm64-gnu": "0.2.0",
108
+ "@fervid/napi-win32-ia32-msvc": "0.2.0",
109
+ "@fervid/napi-linux-arm-gnueabihf": "0.2.0",
110
+ "@fervid/napi-darwin-arm64": "0.2.0",
111
+ "@fervid/napi-android-arm64": "0.2.0",
112
+ "@fervid/napi-freebsd-x64": "0.2.0",
113
+ "@fervid/napi-linux-arm64-musl": "0.2.0",
114
+ "@fervid/napi-win32-arm64-msvc": "0.2.0",
115
+ "@fervid/napi-android-arm-eabi": "0.2.0"
116
116
  },
117
117
  "packageManager": "yarn@4.0.2",
118
118
  "workspaces": [