[wasm] fix: NCMFile & loader issue

This commit is contained in:
鲁树人 2024-09-14 19:18:37 +01:00
parent 0aa46fd46e
commit f5e3a25197
2 changed files with 10 additions and 1 deletions

View File

@ -3,7 +3,7 @@ use umc_ncm::NetEaseCryptoError;
use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::JsError;
/// QMC Footer.
/// NCMFile
#[wasm_bindgen(js_name=NCMFile)]
pub struct JsNCMFile {
ncm: Option<NCMFile>,
@ -11,6 +11,12 @@ pub struct JsNCMFile {
#[wasm_bindgen(js_class=NCMFile)]
impl JsNCMFile {
/// Create a NCMFile instance
#[wasm_bindgen(constructor)]
pub fn new() -> Result<JsNCMFile, JsError> {
Ok(JsNCMFile { ncm: None })
}
/// Open NCM file.
/// If everything is ok, return `0`.
///

View File

@ -92,6 +92,9 @@ async function main() {
// Ask rollup to build bundles.
await run(['pnpm', 'build:bundle']);
await run(['pnpm', 'exec', 'prettier', '--ignore-path', '', '-w', 'dist/loader.d.ts']);
await replaceFileByRegex(path.join(wasmDistDir, 'loader.mjs'), [
['fetch(filepath)', 'fetch(new URL(filepath, import.meta.url))'],
]);
}
main()