@fervid/napi 0.2.0 → 0.3.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 +16 -6
- package/index.js +63 -38
- package/package.json +31 -30
package/index.d.ts
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
5
5
|
|
6
|
+
/** Raw options passed from the Node.js side */
|
6
7
|
export interface FervidJsCompilerOptions {
|
7
8
|
/** Apply production optimizations. Default: false */
|
8
9
|
isProduction?: boolean
|
@@ -42,16 +43,27 @@ export interface FervidJsCompilerOptionsScript {
|
|
42
43
|
* Default: true
|
43
44
|
*/
|
44
45
|
hoistStatic?: boolean
|
46
|
+
/** Produce source maps */
|
47
|
+
sourceMap?: boolean
|
45
48
|
}
|
46
49
|
export interface FervidJsCompilerOptionsStyle {
|
47
50
|
/** Ignored */
|
48
51
|
trim?: boolean
|
49
52
|
}
|
53
|
+
export interface FervidCompileOptions {
|
54
|
+
/** Scope ID for prefixing injected CSS variables */
|
55
|
+
id: string
|
56
|
+
/** Filename is used for automatic component name inference and self-referential imports */
|
57
|
+
filename: string
|
58
|
+
/** Generate a const instead of default export */
|
59
|
+
genDefaultAs?: string
|
60
|
+
}
|
50
61
|
export interface CompileResult {
|
51
62
|
code: string
|
52
63
|
styles: Array<Style>
|
53
64
|
errors: Array<SerializedError>
|
54
65
|
customBlocks: Array<CustomBlock>
|
66
|
+
sourceMap?: string
|
55
67
|
}
|
56
68
|
export interface Style {
|
57
69
|
code: string
|
@@ -72,11 +84,9 @@ export interface SerializedError {
|
|
72
84
|
}
|
73
85
|
export type FervidJsCompiler = Compiler
|
74
86
|
/** Fervid: a compiler for Vue.js written in Rust */
|
75
|
-
export class Compiler {
|
76
|
-
|
77
|
-
ssr: boolean
|
78
|
-
sourceMap: boolean
|
87
|
+
export declare class Compiler {
|
88
|
+
options: FervidJsCompilerOptions
|
79
89
|
constructor(options?: FervidJsCompilerOptions | undefined | null)
|
80
|
-
compileSync(source: string): CompileResult
|
81
|
-
compileAsync(source: string, signal?: AbortSignal | undefined | null): Promise<unknown>
|
90
|
+
compileSync(source: string, options: FervidCompileOptions): CompileResult
|
91
|
+
compileAsync(source: string, options: FervidCompileOptions, signal?: AbortSignal | undefined | null): Promise<unknown>
|
82
92
|
}
|
package/index.js
CHANGED
@@ -32,10 +32,10 @@ switch (platform) {
|
|
32
32
|
case 'android':
|
33
33
|
switch (arch) {
|
34
34
|
case 'arm64':
|
35
|
-
localFileExisted = existsSync(join(__dirname, '
|
35
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.android-arm64.node'))
|
36
36
|
try {
|
37
37
|
if (localFileExisted) {
|
38
|
-
nativeBinding = require('./
|
38
|
+
nativeBinding = require('./fervid.android-arm64.node')
|
39
39
|
} else {
|
40
40
|
nativeBinding = require('@fervid/napi-android-arm64')
|
41
41
|
}
|
@@ -44,10 +44,10 @@ switch (platform) {
|
|
44
44
|
}
|
45
45
|
break
|
46
46
|
case 'arm':
|
47
|
-
localFileExisted = existsSync(join(__dirname, '
|
47
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.android-arm-eabi.node'))
|
48
48
|
try {
|
49
49
|
if (localFileExisted) {
|
50
|
-
nativeBinding = require('./
|
50
|
+
nativeBinding = require('./fervid.android-arm-eabi.node')
|
51
51
|
} else {
|
52
52
|
nativeBinding = require('@fervid/napi-android-arm-eabi')
|
53
53
|
}
|
@@ -62,10 +62,10 @@ switch (platform) {
|
|
62
62
|
case 'win32':
|
63
63
|
switch (arch) {
|
64
64
|
case 'x64':
|
65
|
-
localFileExisted = existsSync(join(__dirname, '
|
65
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.win32-x64-msvc.node'))
|
66
66
|
try {
|
67
67
|
if (localFileExisted) {
|
68
|
-
nativeBinding = require('./
|
68
|
+
nativeBinding = require('./fervid.win32-x64-msvc.node')
|
69
69
|
} else {
|
70
70
|
nativeBinding = require('@fervid/napi-win32-x64-msvc')
|
71
71
|
}
|
@@ -74,10 +74,10 @@ switch (platform) {
|
|
74
74
|
}
|
75
75
|
break
|
76
76
|
case 'ia32':
|
77
|
-
localFileExisted = existsSync(join(__dirname, '
|
77
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.win32-ia32-msvc.node'))
|
78
78
|
try {
|
79
79
|
if (localFileExisted) {
|
80
|
-
nativeBinding = require('./
|
80
|
+
nativeBinding = require('./fervid.win32-ia32-msvc.node')
|
81
81
|
} else {
|
82
82
|
nativeBinding = require('@fervid/napi-win32-ia32-msvc')
|
83
83
|
}
|
@@ -86,10 +86,10 @@ switch (platform) {
|
|
86
86
|
}
|
87
87
|
break
|
88
88
|
case 'arm64':
|
89
|
-
localFileExisted = existsSync(join(__dirname, '
|
89
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.win32-arm64-msvc.node'))
|
90
90
|
try {
|
91
91
|
if (localFileExisted) {
|
92
|
-
nativeBinding = require('./
|
92
|
+
nativeBinding = require('./fervid.win32-arm64-msvc.node')
|
93
93
|
} else {
|
94
94
|
nativeBinding = require('@fervid/napi-win32-arm64-msvc')
|
95
95
|
}
|
@@ -102,10 +102,10 @@ switch (platform) {
|
|
102
102
|
}
|
103
103
|
break
|
104
104
|
case 'darwin':
|
105
|
-
localFileExisted = existsSync(join(__dirname, '
|
105
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.darwin-universal.node'))
|
106
106
|
try {
|
107
107
|
if (localFileExisted) {
|
108
|
-
nativeBinding = require('./
|
108
|
+
nativeBinding = require('./fervid.darwin-universal.node')
|
109
109
|
} else {
|
110
110
|
nativeBinding = require('@fervid/napi-darwin-universal')
|
111
111
|
}
|
@@ -113,10 +113,10 @@ switch (platform) {
|
|
113
113
|
} catch {}
|
114
114
|
switch (arch) {
|
115
115
|
case 'x64':
|
116
|
-
localFileExisted = existsSync(join(__dirname, '
|
116
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.darwin-x64.node'))
|
117
117
|
try {
|
118
118
|
if (localFileExisted) {
|
119
|
-
nativeBinding = require('./
|
119
|
+
nativeBinding = require('./fervid.darwin-x64.node')
|
120
120
|
} else {
|
121
121
|
nativeBinding = require('@fervid/napi-darwin-x64')
|
122
122
|
}
|
@@ -125,10 +125,10 @@ switch (platform) {
|
|
125
125
|
}
|
126
126
|
break
|
127
127
|
case 'arm64':
|
128
|
-
localFileExisted = existsSync(join(__dirname, '
|
128
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.darwin-arm64.node'))
|
129
129
|
try {
|
130
130
|
if (localFileExisted) {
|
131
|
-
nativeBinding = require('./
|
131
|
+
nativeBinding = require('./fervid.darwin-arm64.node')
|
132
132
|
} else {
|
133
133
|
nativeBinding = require('@fervid/napi-darwin-arm64')
|
134
134
|
}
|
@@ -144,10 +144,10 @@ switch (platform) {
|
|
144
144
|
if (arch !== 'x64') {
|
145
145
|
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
146
146
|
}
|
147
|
-
localFileExisted = existsSync(join(__dirname, '
|
147
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.freebsd-x64.node'))
|
148
148
|
try {
|
149
149
|
if (localFileExisted) {
|
150
|
-
nativeBinding = require('./
|
150
|
+
nativeBinding = require('./fervid.freebsd-x64.node')
|
151
151
|
} else {
|
152
152
|
nativeBinding = require('@fervid/napi-freebsd-x64')
|
153
153
|
}
|
@@ -159,10 +159,10 @@ switch (platform) {
|
|
159
159
|
switch (arch) {
|
160
160
|
case 'x64':
|
161
161
|
if (isMusl()) {
|
162
|
-
localFileExisted = existsSync(join(__dirname, '
|
162
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-x64-musl.node'))
|
163
163
|
try {
|
164
164
|
if (localFileExisted) {
|
165
|
-
nativeBinding = require('./
|
165
|
+
nativeBinding = require('./fervid.linux-x64-musl.node')
|
166
166
|
} else {
|
167
167
|
nativeBinding = require('@fervid/napi-linux-x64-musl')
|
168
168
|
}
|
@@ -170,10 +170,10 @@ switch (platform) {
|
|
170
170
|
loadError = e
|
171
171
|
}
|
172
172
|
} else {
|
173
|
-
localFileExisted = existsSync(join(__dirname, '
|
173
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-x64-gnu.node'))
|
174
174
|
try {
|
175
175
|
if (localFileExisted) {
|
176
|
-
nativeBinding = require('./
|
176
|
+
nativeBinding = require('./fervid.linux-x64-gnu.node')
|
177
177
|
} else {
|
178
178
|
nativeBinding = require('@fervid/napi-linux-x64-gnu')
|
179
179
|
}
|
@@ -184,10 +184,10 @@ switch (platform) {
|
|
184
184
|
break
|
185
185
|
case 'arm64':
|
186
186
|
if (isMusl()) {
|
187
|
-
localFileExisted = existsSync(join(__dirname, '
|
187
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-arm64-musl.node'))
|
188
188
|
try {
|
189
189
|
if (localFileExisted) {
|
190
|
-
nativeBinding = require('./
|
190
|
+
nativeBinding = require('./fervid.linux-arm64-musl.node')
|
191
191
|
} else {
|
192
192
|
nativeBinding = require('@fervid/napi-linux-arm64-musl')
|
193
193
|
}
|
@@ -195,10 +195,10 @@ switch (platform) {
|
|
195
195
|
loadError = e
|
196
196
|
}
|
197
197
|
} else {
|
198
|
-
localFileExisted = existsSync(join(__dirname, '
|
198
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-arm64-gnu.node'))
|
199
199
|
try {
|
200
200
|
if (localFileExisted) {
|
201
|
-
nativeBinding = require('./
|
201
|
+
nativeBinding = require('./fervid.linux-arm64-gnu.node')
|
202
202
|
} else {
|
203
203
|
nativeBinding = require('@fervid/napi-linux-arm64-gnu')
|
204
204
|
}
|
@@ -208,23 +208,36 @@ switch (platform) {
|
|
208
208
|
}
|
209
209
|
break
|
210
210
|
case 'arm':
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
211
|
+
if (isMusl()) {
|
212
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-arm-musleabihf.node'))
|
213
|
+
try {
|
214
|
+
if (localFileExisted) {
|
215
|
+
nativeBinding = require('./fervid.linux-arm-musleabihf.node')
|
216
|
+
} else {
|
217
|
+
nativeBinding = require('@fervid/napi-linux-arm-musleabihf')
|
218
|
+
}
|
219
|
+
} catch (e) {
|
220
|
+
loadError = e
|
221
|
+
}
|
222
|
+
} else {
|
223
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-arm-gnueabihf.node'))
|
224
|
+
try {
|
225
|
+
if (localFileExisted) {
|
226
|
+
nativeBinding = require('./fervid.linux-arm-gnueabihf.node')
|
227
|
+
} else {
|
228
|
+
nativeBinding = require('@fervid/napi-linux-arm-gnueabihf')
|
229
|
+
}
|
230
|
+
} catch (e) {
|
231
|
+
loadError = e
|
217
232
|
}
|
218
|
-
} catch (e) {
|
219
|
-
loadError = e
|
220
233
|
}
|
221
234
|
break
|
222
235
|
case 'riscv64':
|
223
236
|
if (isMusl()) {
|
224
|
-
localFileExisted = existsSync(join(__dirname, '
|
237
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-riscv64-musl.node'))
|
225
238
|
try {
|
226
239
|
if (localFileExisted) {
|
227
|
-
nativeBinding = require('./
|
240
|
+
nativeBinding = require('./fervid.linux-riscv64-musl.node')
|
228
241
|
} else {
|
229
242
|
nativeBinding = require('@fervid/napi-linux-riscv64-musl')
|
230
243
|
}
|
@@ -232,10 +245,10 @@ switch (platform) {
|
|
232
245
|
loadError = e
|
233
246
|
}
|
234
247
|
} else {
|
235
|
-
localFileExisted = existsSync(join(__dirname, '
|
248
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-riscv64-gnu.node'))
|
236
249
|
try {
|
237
250
|
if (localFileExisted) {
|
238
|
-
nativeBinding = require('./
|
251
|
+
nativeBinding = require('./fervid.linux-riscv64-gnu.node')
|
239
252
|
} else {
|
240
253
|
nativeBinding = require('@fervid/napi-linux-riscv64-gnu')
|
241
254
|
}
|
@@ -244,6 +257,18 @@ switch (platform) {
|
|
244
257
|
}
|
245
258
|
}
|
246
259
|
break
|
260
|
+
case 's390x':
|
261
|
+
localFileExisted = existsSync(join(__dirname, 'fervid.linux-s390x-gnu.node'))
|
262
|
+
try {
|
263
|
+
if (localFileExisted) {
|
264
|
+
nativeBinding = require('./fervid.linux-s390x-gnu.node')
|
265
|
+
} else {
|
266
|
+
nativeBinding = require('@fervid/napi-linux-s390x-gnu')
|
267
|
+
}
|
268
|
+
} catch (e) {
|
269
|
+
loadError = e
|
270
|
+
}
|
271
|
+
break
|
247
272
|
default:
|
248
273
|
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
249
274
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fervid/napi",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.3.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",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"index.js"
|
20
20
|
],
|
21
21
|
"napi": {
|
22
|
-
"name": "
|
22
|
+
"name": "fervid",
|
23
23
|
"triples": {
|
24
24
|
"defaults": true,
|
25
25
|
"additional": [
|
@@ -59,27 +59,28 @@
|
|
59
59
|
"version": "napi version"
|
60
60
|
},
|
61
61
|
"devDependencies": {
|
62
|
-
"@
|
63
|
-
"@
|
64
|
-
"@swc/
|
65
|
-
"@
|
66
|
-
"@
|
67
|
-
"@
|
68
|
-
"@typescript-eslint/
|
69
|
-
"@
|
62
|
+
"@babel/parser": "^7.25.4",
|
63
|
+
"@napi-rs/cli": "^2.18.4",
|
64
|
+
"@swc-node/register": "^1.10.9",
|
65
|
+
"@swc/core": "^1.7.18",
|
66
|
+
"@taplo/cli": "^0.7.0",
|
67
|
+
"@types/node": "^20.12.7",
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.3.0",
|
69
|
+
"@typescript-eslint/parser": "^8.3.0",
|
70
|
+
"@vue/compiler-sfc": "^3.4.38",
|
70
71
|
"benny": "^3.7.1",
|
71
72
|
"chalk": "^5.3.0",
|
72
|
-
"eslint": "^
|
73
|
+
"eslint": "^9.9.1",
|
73
74
|
"eslint-config-prettier": "^9.1.0",
|
74
75
|
"eslint-plugin-import": "^2.29.1",
|
75
|
-
"eslint-plugin-prettier": "^5.
|
76
|
+
"eslint-plugin-prettier": "^5.2.1",
|
76
77
|
"husky": "^8.0.3",
|
77
78
|
"kleur": "^4.1.5",
|
78
|
-
"lint-staged": "^
|
79
|
+
"lint-staged": "^15.2.7",
|
79
80
|
"npm-run-all": "^4.1.5",
|
80
|
-
"prettier": "^3.
|
81
|
-
"typescript": "^5.
|
82
|
-
"vitest": "^
|
81
|
+
"prettier": "^3.2.5",
|
82
|
+
"typescript": "^5.5.4",
|
83
|
+
"vitest": "^2.0.5"
|
83
84
|
},
|
84
85
|
"lint-staged": {
|
85
86
|
"*.@(js|ts|tsx)": [
|
@@ -100,21 +101,21 @@
|
|
100
101
|
"arrowParens": "always"
|
101
102
|
},
|
102
103
|
"optionalDependencies": {
|
103
|
-
"@fervid/napi-win32-x64-msvc": "0.
|
104
|
-
"@fervid/napi-darwin-x64": "0.
|
105
|
-
"@fervid/napi-linux-x64-gnu": "0.
|
106
|
-
"@fervid/napi-linux-x64-musl": "0.
|
107
|
-
"@fervid/napi-linux-arm64-gnu": "0.
|
108
|
-
"@fervid/napi-win32-ia32-msvc": "0.
|
109
|
-
"@fervid/napi-linux-arm-gnueabihf": "0.
|
110
|
-
"@fervid/napi-darwin-arm64": "0.
|
111
|
-
"@fervid/napi-android-arm64": "0.
|
112
|
-
"@fervid/napi-freebsd-x64": "0.
|
113
|
-
"@fervid/napi-linux-arm64-musl": "0.
|
114
|
-
"@fervid/napi-win32-arm64-msvc": "0.
|
115
|
-
"@fervid/napi-android-arm-eabi": "0.
|
104
|
+
"@fervid/napi-win32-x64-msvc": "0.3.0",
|
105
|
+
"@fervid/napi-darwin-x64": "0.3.0",
|
106
|
+
"@fervid/napi-linux-x64-gnu": "0.3.0",
|
107
|
+
"@fervid/napi-linux-x64-musl": "0.3.0",
|
108
|
+
"@fervid/napi-linux-arm64-gnu": "0.3.0",
|
109
|
+
"@fervid/napi-win32-ia32-msvc": "0.3.0",
|
110
|
+
"@fervid/napi-linux-arm-gnueabihf": "0.3.0",
|
111
|
+
"@fervid/napi-darwin-arm64": "0.3.0",
|
112
|
+
"@fervid/napi-android-arm64": "0.3.0",
|
113
|
+
"@fervid/napi-freebsd-x64": "0.3.0",
|
114
|
+
"@fervid/napi-linux-arm64-musl": "0.3.0",
|
115
|
+
"@fervid/napi-win32-arm64-msvc": "0.3.0",
|
116
|
+
"@fervid/napi-android-arm-eabi": "0.3.0"
|
116
117
|
},
|
117
|
-
"packageManager": "yarn@4.
|
118
|
+
"packageManager": "yarn@4.4.1",
|
118
119
|
"workspaces": [
|
119
120
|
"npm/*"
|
120
121
|
]
|