-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
locate wasm/data/so in the same directory with js
- Loading branch information
1 parent
d73378e
commit e3a62dc
Showing
6 changed files
with
51 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import antfu from '@antfu/eslint-config' | ||
|
||
export default antfu({ | ||
ignores: ['page/pre.js'] | ||
ignores: ['page/pre.ts'] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import ErrorStackParser from 'error-stack-parser' | ||
|
||
const urlPrefix = (() => { | ||
let err: Error | ||
try { | ||
throw new Error() | ||
} | ||
catch (e) { | ||
err = e as Error | ||
} | ||
const fileName = ErrorStackParser.parse(err)[0].fileName! | ||
return fileName.slice(0, fileName.lastIndexOf('/') + 1) | ||
})() | ||
|
||
// @ts-expect-error defined by emscripten | ||
Module = { | ||
printErr(message: string) { | ||
const match = message.match(/^[EWID]/) | ||
if (match) { | ||
({ | ||
E: console.error, | ||
W: console.warn, | ||
I: console.info, | ||
D: console.debug, | ||
})[message[0] as 'E' | 'W' | 'I' | 'D'](message.slice(1)) | ||
} | ||
else { | ||
console.error(message) | ||
} | ||
}, | ||
locateFile(file: string) { | ||
return urlPrefix + file | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
import { build } from 'esbuild' | ||
|
||
await build({ | ||
entryPoints: ['page/index.ts'], | ||
const common = { | ||
bundle: true, | ||
outfile: 'build/index.js', | ||
target: 'es2020', | ||
format: 'esm', | ||
platform: 'browser', | ||
minify: true, | ||
minify: false, // avoid name conflict since pre.js and index.js are simply concatenated | ||
sourcemap: false, // meaningless as index.js is appended to Fcitx5.js | ||
} | ||
|
||
await build({ | ||
...common, | ||
entryPoints: ['page/index.ts'], | ||
outfile: 'build/index.js', | ||
}) | ||
|
||
await build({ | ||
...common, | ||
entryPoints: ['page/pre.ts'], | ||
outfile: 'build/pre.js', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters