@vue-jsx-vapor/compiler-rs 2.6.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/README.md +85 -0
- package/browser.js +1 -0
- package/index.d.ts +78 -0
- package/index.js +757 -0
- package/package.json +86 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# `@napi-rs/package-template`
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
> Template project for writing node packages with napi-rs.
|
|
6
|
+
|
|
7
|
+
# Usage
|
|
8
|
+
|
|
9
|
+
1. Click **Use this template**.
|
|
10
|
+
2. **Clone** your project.
|
|
11
|
+
3. Run `pnpm install` to install dependencies.
|
|
12
|
+
4. Run `npx napi rename -n [name]` command under the project folder to rename your package.
|
|
13
|
+
|
|
14
|
+
## Install this test package
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
pnpm add @napi-rs/package-template
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Build
|
|
23
|
+
|
|
24
|
+
After `pnpm build` command, you can see `package-template.[darwin|win32|linux].node` file in project root. This is the native addon built from [lib.rs](./src/lib.rs).
|
|
25
|
+
|
|
26
|
+
### Test
|
|
27
|
+
|
|
28
|
+
With [ava](https://github.com/avajs/ava), run `pnpm test` to testing native addon. You can also switch to another testing framework if you want.
|
|
29
|
+
|
|
30
|
+
### CI
|
|
31
|
+
|
|
32
|
+
With GitHub Actions, each commit and pull request will be built and tested automatically in [`node@18`, `node@20`] x [`macOS`, `Linux`, `Windows`] matrix. You will never be afraid of the native addon broken in these platforms.
|
|
33
|
+
|
|
34
|
+
### Release
|
|
35
|
+
|
|
36
|
+
Release native package is very difficult in old days. Native packages may ask developers who use it to install `build toolchain` like `gcc/llvm`, `node-gyp` or something more.
|
|
37
|
+
|
|
38
|
+
With `GitHub actions`, we can easily prebuild a `binary` for major platforms. And with `N-API`, we should never be afraid of **ABI Compatible**.
|
|
39
|
+
|
|
40
|
+
The other problem is how to deliver prebuild `binary` to users. Downloading it in `postinstall` script is a common way that most packages do it right now. The problem with this solution is it introduced many other packages to download binary that has not been used by `runtime codes`. The other problem is some users may not easily download the binary from `GitHub/CDN` if they are behind a private network (But in most cases, they have a private NPM mirror).
|
|
41
|
+
|
|
42
|
+
In this package, we choose a better way to solve this problem. We release different `npm packages` for different platforms. And add it to `optionalDependencies` before releasing the `Major` package to npm.
|
|
43
|
+
|
|
44
|
+
`NPM` will choose which native package should download from `registry` automatically. You can see [npm](./npm) dir for details. And you can also run `pnpm add @napi-rs/package-template` to see how it works.
|
|
45
|
+
|
|
46
|
+
## Develop requirements
|
|
47
|
+
|
|
48
|
+
- Install the latest `Rust`
|
|
49
|
+
- Install `Node.js@16+` which fully supported `Node-API`
|
|
50
|
+
- Run `corepack enable`
|
|
51
|
+
|
|
52
|
+
## Test in local
|
|
53
|
+
|
|
54
|
+
- pnpm
|
|
55
|
+
- pnpm build
|
|
56
|
+
- pnpm test
|
|
57
|
+
|
|
58
|
+
And you will see:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
$ ava --verbose
|
|
62
|
+
|
|
63
|
+
✔ sync function from native code
|
|
64
|
+
✔ sleep function from native code (201ms)
|
|
65
|
+
─
|
|
66
|
+
|
|
67
|
+
2 tests passed
|
|
68
|
+
✨ Done in 1.12s.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Release package
|
|
72
|
+
|
|
73
|
+
Ensure you have set your **NPM_TOKEN** in the `GitHub` project setting.
|
|
74
|
+
|
|
75
|
+
In `Settings -> Secrets`, add **NPM_TOKEN** into it.
|
|
76
|
+
|
|
77
|
+
When you want to release the package:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
|
|
81
|
+
|
|
82
|
+
git push
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
GitHub actions will do the rest job for you.
|
package/browser.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@vue-jsx-vapor/compiler-rs-wasm32-wasi'
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export declare function compile(
|
|
4
|
+
source: string,
|
|
5
|
+
options?: CompilerOptions | undefined | null,
|
|
6
|
+
): CompileCodegenResult
|
|
7
|
+
|
|
8
|
+
export interface CompileCodegenResult {
|
|
9
|
+
helpers: Set<string>
|
|
10
|
+
templates: Array<Template>
|
|
11
|
+
delegates: Set<string>
|
|
12
|
+
code: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface CompilerError extends SyntaxError {
|
|
16
|
+
code: number
|
|
17
|
+
loc?: [number, number]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CompilerOptions {
|
|
21
|
+
/** * Whether to compile components to createComponentWithFallback.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
withFallback?: boolean
|
|
25
|
+
/** * Separate option for end users to extend the native elements list
|
|
26
|
+
*/
|
|
27
|
+
isCustomElement?: (arg: string) => boolean
|
|
28
|
+
onError?: (arg: object) => void
|
|
29
|
+
/** * Generate source map?
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
sourceMap?: boolean
|
|
33
|
+
/** * Filename for source map generation.
|
|
34
|
+
* Also used for self-recursive reference in templates
|
|
35
|
+
* @default 'index.jsx'
|
|
36
|
+
*/
|
|
37
|
+
filename?: string
|
|
38
|
+
/** * When enabled, JSX within `defineVaporComponent` is transformed to Vapor DOM,
|
|
39
|
+
* while all other JSX is transformed to Virtual DOM.
|
|
40
|
+
*/
|
|
41
|
+
interop?: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare const enum ErrorCodes {
|
|
45
|
+
VIfNoExpression = 28,
|
|
46
|
+
VElseNoAdjacentIf = 30,
|
|
47
|
+
VForNoExpression = 31,
|
|
48
|
+
VForMalformedExpression = 32,
|
|
49
|
+
VOnNoExpression = 35,
|
|
50
|
+
VSlotMixedSlotUsage = 37,
|
|
51
|
+
VSlotDuplicateSlotNames = 38,
|
|
52
|
+
VSlotExtraneousDefaultSlotChildren = 39,
|
|
53
|
+
VSlotMisplaced = 40,
|
|
54
|
+
VModelNoExpression = 41,
|
|
55
|
+
VModelMalformedExpression = 42,
|
|
56
|
+
VHtmlNoExpression = 53,
|
|
57
|
+
VHtmlWithChildren = 54,
|
|
58
|
+
VTextNoExpression = 55,
|
|
59
|
+
VTextWithChildren = 56,
|
|
60
|
+
VModelOnInvalidElement = 57,
|
|
61
|
+
VModelArgOnElement = 58,
|
|
62
|
+
VModelOnFileInputElement = 59,
|
|
63
|
+
VModelUnnecessaryValue = 60,
|
|
64
|
+
VShowNoExpression = 61,
|
|
65
|
+
VSlotsNoExpression = 62,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type Template = [string, boolean]
|
|
69
|
+
|
|
70
|
+
export declare function transform(
|
|
71
|
+
source: string,
|
|
72
|
+
options?: CompilerOptions | undefined | null,
|
|
73
|
+
): TransformReturn
|
|
74
|
+
|
|
75
|
+
export interface TransformReturn {
|
|
76
|
+
code: string
|
|
77
|
+
map?: string
|
|
78
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,757 @@
|
|
|
1
|
+
// prettier-ignore
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
const { createRequire } = require('node:module')
|
|
7
|
+
require = createRequire(__filename)
|
|
8
|
+
|
|
9
|
+
const { readFileSync } = require('node:fs')
|
|
10
|
+
let nativeBinding = null
|
|
11
|
+
const loadErrors = []
|
|
12
|
+
|
|
13
|
+
const isMusl = () => {
|
|
14
|
+
let musl = false
|
|
15
|
+
if (process.platform === 'linux') {
|
|
16
|
+
musl = isMuslFromFilesystem()
|
|
17
|
+
if (musl === null) {
|
|
18
|
+
musl = isMuslFromReport()
|
|
19
|
+
}
|
|
20
|
+
if (musl === null) {
|
|
21
|
+
musl = isMuslFromChildProcess()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return musl
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
|
28
|
+
|
|
29
|
+
const isMuslFromFilesystem = () => {
|
|
30
|
+
try {
|
|
31
|
+
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
|
32
|
+
} catch {
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const isMuslFromReport = () => {
|
|
38
|
+
let report = null
|
|
39
|
+
if (typeof process.report?.getReport === 'function') {
|
|
40
|
+
process.report.excludeNetwork = true
|
|
41
|
+
report = process.report.getReport()
|
|
42
|
+
}
|
|
43
|
+
if (!report) {
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
50
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
51
|
+
return true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return false
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const isMuslFromChildProcess = () => {
|
|
58
|
+
try {
|
|
59
|
+
return require('child_process')
|
|
60
|
+
.execSync('ldd --version', { encoding: 'utf8' })
|
|
61
|
+
.includes('musl')
|
|
62
|
+
} catch (e) {
|
|
63
|
+
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
64
|
+
return false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function requireNative() {
|
|
69
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
70
|
+
try {
|
|
71
|
+
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
72
|
+
} catch (err) {
|
|
73
|
+
loadErrors.push(err)
|
|
74
|
+
}
|
|
75
|
+
} else if (process.platform === 'android') {
|
|
76
|
+
if (process.arch === 'arm64') {
|
|
77
|
+
try {
|
|
78
|
+
return require('./compiler-rs.android-arm64.node')
|
|
79
|
+
} catch (e) {
|
|
80
|
+
loadErrors.push(e)
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-android-arm64')
|
|
84
|
+
const bindingPackageVersion =
|
|
85
|
+
require('@vue-jsx-vapor/compiler-rs-android-arm64/package.json').version
|
|
86
|
+
if (
|
|
87
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
88
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
89
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
90
|
+
) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
return binding
|
|
96
|
+
} catch (e) {
|
|
97
|
+
loadErrors.push(e)
|
|
98
|
+
}
|
|
99
|
+
} else if (process.arch === 'arm') {
|
|
100
|
+
try {
|
|
101
|
+
return require('./compiler-rs.android-arm-eabi.node')
|
|
102
|
+
} catch (e) {
|
|
103
|
+
loadErrors.push(e)
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-android-arm-eabi')
|
|
107
|
+
const bindingPackageVersion =
|
|
108
|
+
require('@vue-jsx-vapor/compiler-rs-android-arm-eabi/package.json').version
|
|
109
|
+
if (
|
|
110
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
111
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
112
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
113
|
+
) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
return binding
|
|
119
|
+
} catch (e) {
|
|
120
|
+
loadErrors.push(e)
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
loadErrors.push(
|
|
124
|
+
new Error(`Unsupported architecture on Android ${process.arch}`),
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
} else if (process.platform === 'win32') {
|
|
128
|
+
if (process.arch === 'x64') {
|
|
129
|
+
try {
|
|
130
|
+
return require('./compiler-rs.win32-x64-msvc.node')
|
|
131
|
+
} catch (e) {
|
|
132
|
+
loadErrors.push(e)
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-win32-x64-msvc')
|
|
136
|
+
const bindingPackageVersion =
|
|
137
|
+
require('@vue-jsx-vapor/compiler-rs-win32-x64-msvc/package.json').version
|
|
138
|
+
if (
|
|
139
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
140
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
141
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
142
|
+
) {
|
|
143
|
+
throw new Error(
|
|
144
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
return binding
|
|
148
|
+
} catch (e) {
|
|
149
|
+
loadErrors.push(e)
|
|
150
|
+
}
|
|
151
|
+
} else if (process.arch === 'ia32') {
|
|
152
|
+
try {
|
|
153
|
+
return require('./compiler-rs.win32-ia32-msvc.node')
|
|
154
|
+
} catch (e) {
|
|
155
|
+
loadErrors.push(e)
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-win32-ia32-msvc')
|
|
159
|
+
const bindingPackageVersion =
|
|
160
|
+
require('@vue-jsx-vapor/compiler-rs-win32-ia32-msvc/package.json').version
|
|
161
|
+
if (
|
|
162
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
163
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
164
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
165
|
+
) {
|
|
166
|
+
throw new Error(
|
|
167
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
return binding
|
|
171
|
+
} catch (e) {
|
|
172
|
+
loadErrors.push(e)
|
|
173
|
+
}
|
|
174
|
+
} else if (process.arch === 'arm64') {
|
|
175
|
+
try {
|
|
176
|
+
return require('./compiler-rs.win32-arm64-msvc.node')
|
|
177
|
+
} catch (e) {
|
|
178
|
+
loadErrors.push(e)
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-win32-arm64-msvc')
|
|
182
|
+
const bindingPackageVersion =
|
|
183
|
+
require('@vue-jsx-vapor/compiler-rs-win32-arm64-msvc/package.json').version
|
|
184
|
+
if (
|
|
185
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
186
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
187
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
188
|
+
) {
|
|
189
|
+
throw new Error(
|
|
190
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
return binding
|
|
194
|
+
} catch (e) {
|
|
195
|
+
loadErrors.push(e)
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
loadErrors.push(
|
|
199
|
+
new Error(`Unsupported architecture on Windows: ${process.arch}`),
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
} else if (process.platform === 'darwin') {
|
|
203
|
+
try {
|
|
204
|
+
return require('./compiler-rs.darwin-universal.node')
|
|
205
|
+
} catch (e) {
|
|
206
|
+
loadErrors.push(e)
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-darwin-universal')
|
|
210
|
+
const bindingPackageVersion =
|
|
211
|
+
require('@vue-jsx-vapor/compiler-rs-darwin-universal/package.json').version
|
|
212
|
+
if (
|
|
213
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
214
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
215
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
216
|
+
) {
|
|
217
|
+
throw new Error(
|
|
218
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
return binding
|
|
222
|
+
} catch (e) {
|
|
223
|
+
loadErrors.push(e)
|
|
224
|
+
}
|
|
225
|
+
if (process.arch === 'x64') {
|
|
226
|
+
try {
|
|
227
|
+
return require('./compiler-rs.darwin-x64.node')
|
|
228
|
+
} catch (e) {
|
|
229
|
+
loadErrors.push(e)
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-darwin-x64')
|
|
233
|
+
const bindingPackageVersion =
|
|
234
|
+
require('@vue-jsx-vapor/compiler-rs-darwin-x64/package.json').version
|
|
235
|
+
if (
|
|
236
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
237
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
238
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
239
|
+
) {
|
|
240
|
+
throw new Error(
|
|
241
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
return binding
|
|
245
|
+
} catch (e) {
|
|
246
|
+
loadErrors.push(e)
|
|
247
|
+
}
|
|
248
|
+
} else if (process.arch === 'arm64') {
|
|
249
|
+
try {
|
|
250
|
+
return require('./compiler-rs.darwin-arm64.node')
|
|
251
|
+
} catch (e) {
|
|
252
|
+
loadErrors.push(e)
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-darwin-arm64')
|
|
256
|
+
const bindingPackageVersion =
|
|
257
|
+
require('@vue-jsx-vapor/compiler-rs-darwin-arm64/package.json').version
|
|
258
|
+
if (
|
|
259
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
260
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
261
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
262
|
+
) {
|
|
263
|
+
throw new Error(
|
|
264
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
return binding
|
|
268
|
+
} catch (e) {
|
|
269
|
+
loadErrors.push(e)
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
loadErrors.push(
|
|
273
|
+
new Error(`Unsupported architecture on macOS: ${process.arch}`),
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
} else if (process.platform === 'freebsd') {
|
|
277
|
+
if (process.arch === 'x64') {
|
|
278
|
+
try {
|
|
279
|
+
return require('./compiler-rs.freebsd-x64.node')
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e)
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-freebsd-x64')
|
|
285
|
+
const bindingPackageVersion =
|
|
286
|
+
require('@vue-jsx-vapor/compiler-rs-freebsd-x64/package.json').version
|
|
287
|
+
if (
|
|
288
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
289
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
290
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
291
|
+
) {
|
|
292
|
+
throw new Error(
|
|
293
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
294
|
+
)
|
|
295
|
+
}
|
|
296
|
+
return binding
|
|
297
|
+
} catch (e) {
|
|
298
|
+
loadErrors.push(e)
|
|
299
|
+
}
|
|
300
|
+
} else if (process.arch === 'arm64') {
|
|
301
|
+
try {
|
|
302
|
+
return require('./compiler-rs.freebsd-arm64.node')
|
|
303
|
+
} catch (e) {
|
|
304
|
+
loadErrors.push(e)
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-freebsd-arm64')
|
|
308
|
+
const bindingPackageVersion =
|
|
309
|
+
require('@vue-jsx-vapor/compiler-rs-freebsd-arm64/package.json').version
|
|
310
|
+
if (
|
|
311
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
312
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
313
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
314
|
+
) {
|
|
315
|
+
throw new Error(
|
|
316
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
return binding
|
|
320
|
+
} catch (e) {
|
|
321
|
+
loadErrors.push(e)
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
loadErrors.push(
|
|
325
|
+
new Error(`Unsupported architecture on FreeBSD: ${process.arch}`),
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
} else if (process.platform === 'linux') {
|
|
329
|
+
if (process.arch === 'x64') {
|
|
330
|
+
if (isMusl()) {
|
|
331
|
+
try {
|
|
332
|
+
return require('./compiler-rs.linux-x64-musl.node')
|
|
333
|
+
} catch (e) {
|
|
334
|
+
loadErrors.push(e)
|
|
335
|
+
}
|
|
336
|
+
try {
|
|
337
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-x64-musl')
|
|
338
|
+
const bindingPackageVersion =
|
|
339
|
+
require('@vue-jsx-vapor/compiler-rs-linux-x64-musl/package.json').version
|
|
340
|
+
if (
|
|
341
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
342
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
343
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
344
|
+
) {
|
|
345
|
+
throw new Error(
|
|
346
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
347
|
+
)
|
|
348
|
+
}
|
|
349
|
+
return binding
|
|
350
|
+
} catch (e) {
|
|
351
|
+
loadErrors.push(e)
|
|
352
|
+
}
|
|
353
|
+
} else {
|
|
354
|
+
try {
|
|
355
|
+
return require('./compiler-rs.linux-x64-gnu.node')
|
|
356
|
+
} catch (e) {
|
|
357
|
+
loadErrors.push(e)
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-x64-gnu')
|
|
361
|
+
const bindingPackageVersion =
|
|
362
|
+
require('@vue-jsx-vapor/compiler-rs-linux-x64-gnu/package.json').version
|
|
363
|
+
if (
|
|
364
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
365
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
366
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
367
|
+
) {
|
|
368
|
+
throw new Error(
|
|
369
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
370
|
+
)
|
|
371
|
+
}
|
|
372
|
+
return binding
|
|
373
|
+
} catch (e) {
|
|
374
|
+
loadErrors.push(e)
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} else if (process.arch === 'arm64') {
|
|
378
|
+
if (isMusl()) {
|
|
379
|
+
try {
|
|
380
|
+
return require('./compiler-rs.linux-arm64-musl.node')
|
|
381
|
+
} catch (e) {
|
|
382
|
+
loadErrors.push(e)
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-arm64-musl')
|
|
386
|
+
const bindingPackageVersion =
|
|
387
|
+
require('@vue-jsx-vapor/compiler-rs-linux-arm64-musl/package.json').version
|
|
388
|
+
if (
|
|
389
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
390
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
391
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
392
|
+
) {
|
|
393
|
+
throw new Error(
|
|
394
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
return binding
|
|
398
|
+
} catch (e) {
|
|
399
|
+
loadErrors.push(e)
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
try {
|
|
403
|
+
return require('./compiler-rs.linux-arm64-gnu.node')
|
|
404
|
+
} catch (e) {
|
|
405
|
+
loadErrors.push(e)
|
|
406
|
+
}
|
|
407
|
+
try {
|
|
408
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-arm64-gnu')
|
|
409
|
+
const bindingPackageVersion =
|
|
410
|
+
require('@vue-jsx-vapor/compiler-rs-linux-arm64-gnu/package.json').version
|
|
411
|
+
if (
|
|
412
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
413
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
414
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
415
|
+
) {
|
|
416
|
+
throw new Error(
|
|
417
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
return binding
|
|
421
|
+
} catch (e) {
|
|
422
|
+
loadErrors.push(e)
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
} else if (process.arch === 'arm') {
|
|
426
|
+
if (isMusl()) {
|
|
427
|
+
try {
|
|
428
|
+
return require('./compiler-rs.linux-arm-musleabihf.node')
|
|
429
|
+
} catch (e) {
|
|
430
|
+
loadErrors.push(e)
|
|
431
|
+
}
|
|
432
|
+
try {
|
|
433
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-arm-musleabihf')
|
|
434
|
+
const bindingPackageVersion =
|
|
435
|
+
require('@vue-jsx-vapor/compiler-rs-linux-arm-musleabihf/package.json').version
|
|
436
|
+
if (
|
|
437
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
438
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
439
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
440
|
+
) {
|
|
441
|
+
throw new Error(
|
|
442
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
443
|
+
)
|
|
444
|
+
}
|
|
445
|
+
return binding
|
|
446
|
+
} catch (e) {
|
|
447
|
+
loadErrors.push(e)
|
|
448
|
+
}
|
|
449
|
+
} else {
|
|
450
|
+
try {
|
|
451
|
+
return require('./compiler-rs.linux-arm-gnueabihf.node')
|
|
452
|
+
} catch (e) {
|
|
453
|
+
loadErrors.push(e)
|
|
454
|
+
}
|
|
455
|
+
try {
|
|
456
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-arm-gnueabihf')
|
|
457
|
+
const bindingPackageVersion =
|
|
458
|
+
require('@vue-jsx-vapor/compiler-rs-linux-arm-gnueabihf/package.json').version
|
|
459
|
+
if (
|
|
460
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
461
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
462
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
463
|
+
) {
|
|
464
|
+
throw new Error(
|
|
465
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
466
|
+
)
|
|
467
|
+
}
|
|
468
|
+
return binding
|
|
469
|
+
} catch (e) {
|
|
470
|
+
loadErrors.push(e)
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
} else if (process.arch === 'loong64') {
|
|
474
|
+
if (isMusl()) {
|
|
475
|
+
try {
|
|
476
|
+
return require('./compiler-rs.linux-loong64-musl.node')
|
|
477
|
+
} catch (e) {
|
|
478
|
+
loadErrors.push(e)
|
|
479
|
+
}
|
|
480
|
+
try {
|
|
481
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-loong64-musl')
|
|
482
|
+
const bindingPackageVersion =
|
|
483
|
+
require('@vue-jsx-vapor/compiler-rs-linux-loong64-musl/package.json').version
|
|
484
|
+
if (
|
|
485
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
486
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
487
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
488
|
+
) {
|
|
489
|
+
throw new Error(
|
|
490
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
491
|
+
)
|
|
492
|
+
}
|
|
493
|
+
return binding
|
|
494
|
+
} catch (e) {
|
|
495
|
+
loadErrors.push(e)
|
|
496
|
+
}
|
|
497
|
+
} else {
|
|
498
|
+
try {
|
|
499
|
+
return require('./compiler-rs.linux-loong64-gnu.node')
|
|
500
|
+
} catch (e) {
|
|
501
|
+
loadErrors.push(e)
|
|
502
|
+
}
|
|
503
|
+
try {
|
|
504
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-loong64-gnu')
|
|
505
|
+
const bindingPackageVersion =
|
|
506
|
+
require('@vue-jsx-vapor/compiler-rs-linux-loong64-gnu/package.json').version
|
|
507
|
+
if (
|
|
508
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
509
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
510
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
511
|
+
) {
|
|
512
|
+
throw new Error(
|
|
513
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
514
|
+
)
|
|
515
|
+
}
|
|
516
|
+
return binding
|
|
517
|
+
} catch (e) {
|
|
518
|
+
loadErrors.push(e)
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
} else if (process.arch === 'riscv64') {
|
|
522
|
+
if (isMusl()) {
|
|
523
|
+
try {
|
|
524
|
+
return require('./compiler-rs.linux-riscv64-musl.node')
|
|
525
|
+
} catch (e) {
|
|
526
|
+
loadErrors.push(e)
|
|
527
|
+
}
|
|
528
|
+
try {
|
|
529
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-riscv64-musl')
|
|
530
|
+
const bindingPackageVersion =
|
|
531
|
+
require('@vue-jsx-vapor/compiler-rs-linux-riscv64-musl/package.json').version
|
|
532
|
+
if (
|
|
533
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
534
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
535
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
536
|
+
) {
|
|
537
|
+
throw new Error(
|
|
538
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
539
|
+
)
|
|
540
|
+
}
|
|
541
|
+
return binding
|
|
542
|
+
} catch (e) {
|
|
543
|
+
loadErrors.push(e)
|
|
544
|
+
}
|
|
545
|
+
} else {
|
|
546
|
+
try {
|
|
547
|
+
return require('./compiler-rs.linux-riscv64-gnu.node')
|
|
548
|
+
} catch (e) {
|
|
549
|
+
loadErrors.push(e)
|
|
550
|
+
}
|
|
551
|
+
try {
|
|
552
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-riscv64-gnu')
|
|
553
|
+
const bindingPackageVersion =
|
|
554
|
+
require('@vue-jsx-vapor/compiler-rs-linux-riscv64-gnu/package.json').version
|
|
555
|
+
if (
|
|
556
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
557
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
558
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
559
|
+
) {
|
|
560
|
+
throw new Error(
|
|
561
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
562
|
+
)
|
|
563
|
+
}
|
|
564
|
+
return binding
|
|
565
|
+
} catch (e) {
|
|
566
|
+
loadErrors.push(e)
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
} else if (process.arch === 'ppc64') {
|
|
570
|
+
try {
|
|
571
|
+
return require('./compiler-rs.linux-ppc64-gnu.node')
|
|
572
|
+
} catch (e) {
|
|
573
|
+
loadErrors.push(e)
|
|
574
|
+
}
|
|
575
|
+
try {
|
|
576
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-ppc64-gnu')
|
|
577
|
+
const bindingPackageVersion =
|
|
578
|
+
require('@vue-jsx-vapor/compiler-rs-linux-ppc64-gnu/package.json').version
|
|
579
|
+
if (
|
|
580
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
581
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
582
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
583
|
+
) {
|
|
584
|
+
throw new Error(
|
|
585
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
return binding
|
|
589
|
+
} catch (e) {
|
|
590
|
+
loadErrors.push(e)
|
|
591
|
+
}
|
|
592
|
+
} else if (process.arch === 's390x') {
|
|
593
|
+
try {
|
|
594
|
+
return require('./compiler-rs.linux-s390x-gnu.node')
|
|
595
|
+
} catch (e) {
|
|
596
|
+
loadErrors.push(e)
|
|
597
|
+
}
|
|
598
|
+
try {
|
|
599
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-linux-s390x-gnu')
|
|
600
|
+
const bindingPackageVersion =
|
|
601
|
+
require('@vue-jsx-vapor/compiler-rs-linux-s390x-gnu/package.json').version
|
|
602
|
+
if (
|
|
603
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
604
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
605
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
606
|
+
) {
|
|
607
|
+
throw new Error(
|
|
608
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
609
|
+
)
|
|
610
|
+
}
|
|
611
|
+
return binding
|
|
612
|
+
} catch (e) {
|
|
613
|
+
loadErrors.push(e)
|
|
614
|
+
}
|
|
615
|
+
} else {
|
|
616
|
+
loadErrors.push(
|
|
617
|
+
new Error(`Unsupported architecture on Linux: ${process.arch}`),
|
|
618
|
+
)
|
|
619
|
+
}
|
|
620
|
+
} else if (process.platform === 'openharmony') {
|
|
621
|
+
if (process.arch === 'arm64') {
|
|
622
|
+
try {
|
|
623
|
+
return require('./compiler-rs.openharmony-arm64.node')
|
|
624
|
+
} catch (e) {
|
|
625
|
+
loadErrors.push(e)
|
|
626
|
+
}
|
|
627
|
+
try {
|
|
628
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-openharmony-arm64')
|
|
629
|
+
const bindingPackageVersion =
|
|
630
|
+
require('@vue-jsx-vapor/compiler-rs-openharmony-arm64/package.json').version
|
|
631
|
+
if (
|
|
632
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
633
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
634
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
635
|
+
) {
|
|
636
|
+
throw new Error(
|
|
637
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
638
|
+
)
|
|
639
|
+
}
|
|
640
|
+
return binding
|
|
641
|
+
} catch (e) {
|
|
642
|
+
loadErrors.push(e)
|
|
643
|
+
}
|
|
644
|
+
} else if (process.arch === 'x64') {
|
|
645
|
+
try {
|
|
646
|
+
return require('./compiler-rs.openharmony-x64.node')
|
|
647
|
+
} catch (e) {
|
|
648
|
+
loadErrors.push(e)
|
|
649
|
+
}
|
|
650
|
+
try {
|
|
651
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-openharmony-x64')
|
|
652
|
+
const bindingPackageVersion =
|
|
653
|
+
require('@vue-jsx-vapor/compiler-rs-openharmony-x64/package.json').version
|
|
654
|
+
if (
|
|
655
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
656
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
657
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
658
|
+
) {
|
|
659
|
+
throw new Error(
|
|
660
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
661
|
+
)
|
|
662
|
+
}
|
|
663
|
+
return binding
|
|
664
|
+
} catch (e) {
|
|
665
|
+
loadErrors.push(e)
|
|
666
|
+
}
|
|
667
|
+
} else if (process.arch === 'arm') {
|
|
668
|
+
try {
|
|
669
|
+
return require('./compiler-rs.openharmony-arm.node')
|
|
670
|
+
} catch (e) {
|
|
671
|
+
loadErrors.push(e)
|
|
672
|
+
}
|
|
673
|
+
try {
|
|
674
|
+
const binding = require('@vue-jsx-vapor/compiler-rs-openharmony-arm')
|
|
675
|
+
const bindingPackageVersion =
|
|
676
|
+
require('@vue-jsx-vapor/compiler-rs-openharmony-arm/package.json').version
|
|
677
|
+
if (
|
|
678
|
+
bindingPackageVersion !== '1.1.1' &&
|
|
679
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
|
680
|
+
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
|
681
|
+
) {
|
|
682
|
+
throw new Error(
|
|
683
|
+
`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
|
|
684
|
+
)
|
|
685
|
+
}
|
|
686
|
+
return binding
|
|
687
|
+
} catch (e) {
|
|
688
|
+
loadErrors.push(e)
|
|
689
|
+
}
|
|
690
|
+
} else {
|
|
691
|
+
loadErrors.push(
|
|
692
|
+
new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`),
|
|
693
|
+
)
|
|
694
|
+
}
|
|
695
|
+
} else {
|
|
696
|
+
loadErrors.push(
|
|
697
|
+
new Error(
|
|
698
|
+
`Unsupported OS: ${process.platform}, architecture: ${process.arch}`,
|
|
699
|
+
),
|
|
700
|
+
)
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
nativeBinding = requireNative()
|
|
705
|
+
|
|
706
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
707
|
+
let wasiBinding = null
|
|
708
|
+
let wasiBindingError = null
|
|
709
|
+
try {
|
|
710
|
+
wasiBinding = require('./compiler-rs.wasi.cjs')
|
|
711
|
+
nativeBinding = wasiBinding
|
|
712
|
+
} catch (err) {
|
|
713
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
714
|
+
wasiBindingError = err
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
if (!nativeBinding) {
|
|
718
|
+
try {
|
|
719
|
+
wasiBinding = require('@vue-jsx-vapor/compiler-rs-wasm32-wasi')
|
|
720
|
+
nativeBinding = wasiBinding
|
|
721
|
+
} catch (err) {
|
|
722
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
723
|
+
wasiBindingError.cause = err
|
|
724
|
+
loadErrors.push(err)
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
729
|
+
const error = new Error(
|
|
730
|
+
'WASI binding not found and NAPI_RS_FORCE_WASI is set to error',
|
|
731
|
+
)
|
|
732
|
+
error.cause = wasiBindingError
|
|
733
|
+
throw error
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
if (!nativeBinding) {
|
|
738
|
+
if (loadErrors.length > 0) {
|
|
739
|
+
throw new Error(
|
|
740
|
+
`Cannot find native binding. ` +
|
|
741
|
+
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
|
742
|
+
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
|
743
|
+
{
|
|
744
|
+
cause: loadErrors.reduce((err, cur) => {
|
|
745
|
+
cur.cause = err
|
|
746
|
+
return cur
|
|
747
|
+
}),
|
|
748
|
+
},
|
|
749
|
+
)
|
|
750
|
+
}
|
|
751
|
+
throw new Error(`Failed to load native binding`)
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
module.exports = nativeBinding
|
|
755
|
+
module.exports.compile = nativeBinding.compile
|
|
756
|
+
module.exports.ErrorCodes = nativeBinding.ErrorCodes
|
|
757
|
+
module.exports.transform = nativeBinding.transform
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vue-jsx-vapor/compiler-rs",
|
|
3
|
+
"version": "2.6.8",
|
|
4
|
+
"packageManager": "pnpm@10.17.1",
|
|
5
|
+
"description": "Template project for writing node package with napi-rs",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"napi-rs",
|
|
8
|
+
"NAPI",
|
|
9
|
+
"N-API",
|
|
10
|
+
"Rust",
|
|
11
|
+
"node-addon",
|
|
12
|
+
"node-addon-api"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"url": "git+ssh://git@github.com/napi-rs/package-template-pnpm.git",
|
|
17
|
+
"type": "git"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"browser.js",
|
|
21
|
+
"index.d.ts",
|
|
22
|
+
"index.js"
|
|
23
|
+
],
|
|
24
|
+
"main": "index.js",
|
|
25
|
+
"types": "index.d.ts",
|
|
26
|
+
"browser": "browser.js",
|
|
27
|
+
"napi": {
|
|
28
|
+
"binaryName": "compiler-rs",
|
|
29
|
+
"targets": [
|
|
30
|
+
"x86_64-apple-darwin",
|
|
31
|
+
"aarch64-apple-darwin",
|
|
32
|
+
"x86_64-unknown-linux-gnu",
|
|
33
|
+
"x86_64-pc-windows-msvc",
|
|
34
|
+
"x86_64-unknown-linux-musl",
|
|
35
|
+
"aarch64-unknown-linux-gnu",
|
|
36
|
+
"i686-pc-windows-msvc",
|
|
37
|
+
"armv7-unknown-linux-gnueabihf",
|
|
38
|
+
"aarch64-linux-android",
|
|
39
|
+
"x86_64-unknown-freebsd",
|
|
40
|
+
"aarch64-unknown-linux-musl",
|
|
41
|
+
"aarch64-pc-windows-msvc",
|
|
42
|
+
"armv7-linux-androideabi",
|
|
43
|
+
"wasm32-wasi-preview1-threads"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"registry": "https://registry.npmjs.org/",
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"artifacts": "napi artifacts",
|
|
52
|
+
"build": "napi build --platform --release",
|
|
53
|
+
"dev": "nodemon -w src -e rs -x 'napi build --platform'",
|
|
54
|
+
"format": "taplo format",
|
|
55
|
+
"prepublishOnly": "napi prepublish -t npm",
|
|
56
|
+
"version": "napi version",
|
|
57
|
+
"bench": "cargo bench --no-default-features",
|
|
58
|
+
"test": "cargo test --no-default-features -- --nocapture",
|
|
59
|
+
"test-watch": "nodemon -w src -e rs -x 'cargo test --no-default-features -- --nocapture'",
|
|
60
|
+
"flamegraph": "CARGO_PROFILE_RELEASE_STRIP=false CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --bench bench --no-default-features"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@emnapi/core": "^1.5.0",
|
|
64
|
+
"@emnapi/runtime": "^1.5.0",
|
|
65
|
+
"@napi-rs/cli": "^3.2.0",
|
|
66
|
+
"@napi-rs/wasm-runtime": "^1.0.4",
|
|
67
|
+
"@taplo/cli": "^0.7.0",
|
|
68
|
+
"emnapi": "^1.5.0"
|
|
69
|
+
},
|
|
70
|
+
"optionalDependencies": {
|
|
71
|
+
"@vue-jsx-vapor/compiler-rs-darwin-x64": "2.6.8",
|
|
72
|
+
"@vue-jsx-vapor/compiler-rs-darwin-arm64": "2.6.8",
|
|
73
|
+
"@vue-jsx-vapor/compiler-rs-linux-x64-gnu": "2.6.8",
|
|
74
|
+
"@vue-jsx-vapor/compiler-rs-win32-x64-msvc": "2.6.8",
|
|
75
|
+
"@vue-jsx-vapor/compiler-rs-linux-x64-musl": "2.6.8",
|
|
76
|
+
"@vue-jsx-vapor/compiler-rs-linux-arm64-gnu": "2.6.8",
|
|
77
|
+
"@vue-jsx-vapor/compiler-rs-win32-ia32-msvc": "2.6.8",
|
|
78
|
+
"@vue-jsx-vapor/compiler-rs-linux-arm-gnueabihf": "2.6.8",
|
|
79
|
+
"@vue-jsx-vapor/compiler-rs-android-arm64": "2.6.8",
|
|
80
|
+
"@vue-jsx-vapor/compiler-rs-freebsd-x64": "2.6.8",
|
|
81
|
+
"@vue-jsx-vapor/compiler-rs-linux-arm64-musl": "2.6.8",
|
|
82
|
+
"@vue-jsx-vapor/compiler-rs-win32-arm64-msvc": "2.6.8",
|
|
83
|
+
"@vue-jsx-vapor/compiler-rs-android-arm-eabi": "2.6.8",
|
|
84
|
+
"@vue-jsx-vapor/compiler-rs-wasm32-wasi": "2.6.8"
|
|
85
|
+
}
|
|
86
|
+
}
|