Compare commits

..

2 Commits

Author SHA1 Message Date
f5e3a25197 [wasm] fix: NCMFile & loader issue 2024-09-14 19:18:37 +01:00
0aa46fd46e [wasm] chore: change npm package namespace 2024-09-14 18:45:51 +01:00
5 changed files with 16 additions and 6 deletions

View File

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

View File

@ -1 +1,2 @@
@um:registry=https://git.unlock-music.dev/api/packages/um/npm/ @um:registry=https://git.unlock-music.dev/api/packages/um/npm/
@unlock-music:registry=https://git.unlock-music.dev/api/packages/um/npm/

View File

@ -1,4 +1,4 @@
# @um/crypto # @unlock-music/crypto
用于 Unlock Music 的加解密支持库。 用于 Unlock Music 的加解密支持库。
@ -9,17 +9,17 @@
在项目根目录下,建立或更改 `.npmrc` 文件,确保下述行存在: 在项目根目录下,建立或更改 `.npmrc` 文件,确保下述行存在:
``` ```
@um:registry=https://git.unlock-music.dev/api/packages/um/npm/ @unlock-music:registry=https://git.unlock-music.dev/api/packages/um/npm/
``` ```
使用你喜欢的包管理器安装,例如 `npm` 或 `pnpm` 使用你喜欢的包管理器安装,例如 `npm` 或 `pnpm`
```sh ```sh
# 使用 npm # 使用 npm
npm install @um/crypto npm install @unlock-music/crypto
# 使用 pnpm # 使用 pnpm
pnpm install @um/crypto pnpm install @unlock-music/crypto
``` ```
具体能干啥… 参考源码吧。 具体能干啥… 参考源码吧。

View File

@ -92,6 +92,9 @@ async function main() {
// Ask rollup to build bundles. // Ask rollup to build bundles.
await run(['pnpm', 'build:bundle']); await run(['pnpm', 'build:bundle']);
await run(['pnpm', 'exec', 'prettier', '--ignore-path', '', '-w', 'dist/loader.d.ts']); 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() main()

View File

@ -1,5 +1,5 @@
{ {
"name": "@um/crypto", "name": "@unlock-music/crypto",
"version": "0.0.0-alpha.2", "version": "0.0.0-alpha.2",
"description": "Project Unlock Music: 加解密支持库", "description": "Project Unlock Music: 加解密支持库",
"scripts": { "scripts": {