Skip to content

Commit 526370b

Browse files
committed
chore: fix build playground
1 parent cb0037e commit 526370b

File tree

8 files changed

+112
-138
lines changed

8 files changed

+112
-138
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ jobs:
416416
npm publish --access public
417417
cd ../../
418418
pnpm install --no-frozen-lockfile
419-
pnpm run --filter="!compiler-rs" --parallel build
420-
pnpm publish --filter="!compiler-rs" --access public --no-git-checks
419+
pnpm run --filter="./packages/*" --filter="!compiler-rs" --parallel build
420+
pnpm publish --filter="./packages/*" --filter="!compiler-rs" --access public --no-git-checks
421421
else
422422
echo "Not a release, skipping publish"
423423
fi

eslint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { sxzz } from '@sxzz/eslint-config'
22
import vueJsxVapor from './packages/eslint/src/index'
33

44
export default [
5+
{
6+
ignores: ['**/wasi-worker**', '**/compiler-rs.wasi**'],
7+
},
58
...(await sxzz()
69
.removeRules(
710
'unicorn/filename-case',

packages/compiler-rs/compiler-rs.wasi-browser.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
/* eslint-disable */
2-
/* prettier-ignore */
3-
41
import {
2+
createOnMessage as __wasmCreateOnMessageForFsProxy,
53
getDefaultContext as __emnapiGetDefaultContext,
64
instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync,
75
WASI as __WASI,
8-
createOnMessage as __wasmCreateOnMessageForFsProxy,
96
} from '@napi-rs/wasm-runtime'
107

8+
9+
1110
const __wasi = new __WASI({
1211
version: 'preview1',
1312
})
1413

15-
const __wasmUrl = new URL('./compiler-rs.wasm32-wasi.wasm', import.meta.url)
16-
.href
14+
const __wasmUrl = new URL('./compiler-rs.wasm32-wasi.wasm', import.meta.url).href
1715
const __emnapiContext = __emnapiGetDefaultContext()
1816

17+
1918
const __sharedMemory = new WebAssembly.Memory({
2019
initial: 4000,
2120
maximum: 65536,
@@ -33,12 +32,9 @@ const {
3332
asyncWorkPoolSize: 4,
3433
wasi: __wasi,
3534
onCreateWorker() {
36-
const worker = new Worker(
37-
new URL('./wasi-worker-browser.mjs', import.meta.url),
38-
{
39-
type: 'module',
40-
},
41-
)
35+
const worker = new Worker(new URL('./wasi-worker-browser.mjs', import.meta.url), {
36+
type: 'module',
37+
})
4238

4339
return worker
4440
},

packages/compiler-rs/compiler-rs.wasi.cjs

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const __wasi = new __nodeWASI({
2121
env: process.env,
2222
preopens: {
2323
[__rootDir]: __rootDir,
24-
},
24+
}
2525
})
2626

2727
const __emnapiContext = __emnapiGetDefaultContext()
@@ -33,36 +33,22 @@ const __sharedMemory = new WebAssembly.Memory({
3333
})
3434

3535
let __wasmFilePath = __nodePath.join(__dirname, 'compiler-rs.wasm32-wasi.wasm')
36-
const __wasmDebugFilePath = __nodePath.join(
37-
__dirname,
38-
'compiler-rs.wasm32-wasi.debug.wasm',
39-
)
36+
const __wasmDebugFilePath = __nodePath.join(__dirname, 'compiler-rs.wasm32-wasi.debug.wasm')
4037

4138
if (__nodeFs.existsSync(__wasmDebugFilePath)) {
4239
__wasmFilePath = __wasmDebugFilePath
4340
} else if (!__nodeFs.existsSync(__wasmFilePath)) {
4441
try {
45-
__wasmFilePath = __nodePath.resolve(
46-
'@vue-jsx-vapor/compiler-rs-wasm32-wasi',
47-
)
42+
__wasmFilePath = __nodePath.resolve('@vue-jsx-vapor/compiler-rs-wasm32-wasi')
4843
} catch {
49-
throw new Error(
50-
'Cannot find compiler-rs.wasm32-wasi.wasm file, and @vue-jsx-vapor/compiler-rs-wasm32-wasi package is not installed.',
51-
)
44+
throw new Error('Cannot find compiler-rs.wasm32-wasi.wasm file, and @vue-jsx-vapor/compiler-rs-wasm32-wasi package is not installed.')
5245
}
5346
}
5447

55-
const {
56-
instance: __napiInstance,
57-
module: __wasiModule,
58-
napiModule: __napiModule,
59-
} = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), {
48+
const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), {
6049
context: __emnapiContext,
61-
asyncWorkPoolSize: (function () {
62-
const threadsSizeFromEnv = Number(
63-
process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ??
64-
process.env.UV_THREADPOOL_SIZE,
65-
)
50+
asyncWorkPoolSize: (function() {
51+
const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE)
6652
// NaN > 0 is false
6753
if (threadsSizeFromEnv > 0) {
6854
return threadsSizeFromEnv
@@ -86,21 +72,21 @@ const {
8672
// According to https://github.com/nodejs/node/blob/19e0d472728c79d418b74bddff588bea70a403d0/lib/internal/worker.js#L415,
8773
// a worker is consist of two handles: kPublicPort and kHandle.
8874
{
89-
const kPublicPort = Object.getOwnPropertySymbols(worker).find((s) =>
90-
s.toString().includes('kPublicPort'),
91-
)
75+
const kPublicPort = Object.getOwnPropertySymbols(worker).find(s =>
76+
s.toString().includes("kPublicPort")
77+
);
9278
if (kPublicPort) {
93-
worker[kPublicPort].ref = () => {}
79+
worker[kPublicPort].ref = () => {};
9480
}
9581

96-
const kHandle = Object.getOwnPropertySymbols(worker).find((s) =>
97-
s.toString().includes('kHandle'),
98-
)
82+
const kHandle = Object.getOwnPropertySymbols(worker).find(s =>
83+
s.toString().includes("kHandle")
84+
);
9985
if (kHandle) {
100-
worker[kHandle].ref = () => {}
86+
worker[kHandle].ref = () => {};
10187
}
10288

103-
worker.unref()
89+
worker.unref();
10490
}
10591
return worker
10692
},

0 commit comments

Comments
 (0)