Compare commits
No commits in common. "2cca297bcc2d28bc11ff7c3e67c15f0895238333" and "5590b86c04b65671fac8c4d9d5b1993f0b207f26" have entirely different histories.
2cca297bcc
...
5590b86c04
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@unlock-music/crypto",
|
"name": "@unlock-music/crypto",
|
||||||
"version": "0.0.0-alpha.5",
|
"version": "0.0.0-alpha.3",
|
||||||
"description": "Project Unlock Music: 加解密支持库",
|
"description": "Project Unlock Music: 加解密支持库",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build.js",
|
"build": "node build.js",
|
||||||
|
@ -257,13 +257,11 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@rollup/pluginutils': 5.1.0(rollup@4.21.2)
|
'@rollup/pluginutils': 5.1.0(rollup@4.21.2)
|
||||||
magic-string: 0.30.11
|
magic-string: 0.30.11
|
||||||
optionalDependencies:
|
|
||||||
rollup: 4.21.2
|
rollup: 4.21.2
|
||||||
|
|
||||||
'@rollup/plugin-wasm@6.2.2(rollup@4.21.2)':
|
'@rollup/plugin-wasm@6.2.2(rollup@4.21.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@rollup/pluginutils': 5.1.0(rollup@4.21.2)
|
'@rollup/pluginutils': 5.1.0(rollup@4.21.2)
|
||||||
optionalDependencies:
|
|
||||||
rollup: 4.21.2
|
rollup: 4.21.2
|
||||||
|
|
||||||
'@rollup/pluginutils@5.1.0(rollup@4.21.2)':
|
'@rollup/pluginutils@5.1.0(rollup@4.21.2)':
|
||||||
@ -271,7 +269,6 @@ snapshots:
|
|||||||
'@types/estree': 1.0.5
|
'@types/estree': 1.0.5
|
||||||
estree-walker: 2.0.2
|
estree-walker: 2.0.2
|
||||||
picomatch: 2.3.1
|
picomatch: 2.3.1
|
||||||
optionalDependencies:
|
|
||||||
rollup: 4.21.2
|
rollup: 4.21.2
|
||||||
|
|
||||||
'@rollup/rollup-android-arm-eabi@4.21.2':
|
'@rollup/rollup-android-arm-eabi@4.21.2':
|
||||||
|
@ -5,12 +5,7 @@ import { dts } from 'rollup-plugin-dts';
|
|||||||
|
|
||||||
function makePlugins({ sync }) {
|
function makePlugins({ sync }) {
|
||||||
const plugins = [];
|
const plugins = [];
|
||||||
plugins.push(
|
plugins.push(wasm({ sync: sync ? ['pkg/um_wasm_bg.wasm'] : [] }));
|
||||||
wasm({
|
|
||||||
sync: sync ? ['pkg/um_wasm_bg.wasm'] : [],
|
|
||||||
fileName: 'um_wasm_bg.wasm',
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
plugins.push(
|
plugins.push(
|
||||||
replace({
|
replace({
|
||||||
preventAssignment: true,
|
preventAssignment: true,
|
||||||
|
@ -1,22 +1,15 @@
|
|||||||
import umWasm from '../pkg/um_wasm_bg.wasm';
|
import umWasm from '../pkg/um_wasm_bg.wasm';
|
||||||
import { __wbg_init, initSync } from '../pkg/um_wasm.js';
|
import { __wbg_init, initSync } from '../pkg/um_wasm.js';
|
||||||
|
|
||||||
export * from '../pkg/um_wasm.js';
|
export * from '../pkg/um_wasm.js';
|
||||||
|
|
||||||
function loader() {
|
function loader() {
|
||||||
if (process.env.UMC_INLINE_BUILD === '1') {
|
if (process.env.UMC_INLINE_BUILD === '1') {
|
||||||
initSync({ module: umWasm() });
|
initSync({ module: umWasm() });
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(undefined);
|
||||||
} else {
|
} else {
|
||||||
/** @type {Promise<Buffer>|undefined} */
|
return umWasm().then(async (wasm) => {
|
||||||
let wasm = undefined;
|
await __wbg_init({ module_or_path: wasm });
|
||||||
if (typeof document === 'undefined') {
|
});
|
||||||
// node
|
|
||||||
wasm = import('node:f' + 's/promises').then((fs) =>
|
|
||||||
fs.readFile(new URL('../pkg/um_wasm_bg.wasm', import.meta.url)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return __wbg_init({ module_or_path: wasm }).then(() => true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
const { NCMFile, ready } = require('./dist/loader.js');
|
|
||||||
|
|
||||||
ready.then(() => {
|
|
||||||
const ncm = new NCMFile();
|
|
||||||
let n = ncm.open(new Uint8Array([]));
|
|
||||||
console.assert(n !== 0, 'n should not be 0', { n });
|
|
||||||
console.log('cjs test ok');
|
|
||||||
});
|
|
@ -1,8 +0,0 @@
|
|||||||
import { NCMFile, ready } from './dist/loader.mjs';
|
|
||||||
|
|
||||||
ready.then(() => {
|
|
||||||
const ncm = new NCMFile();
|
|
||||||
let n = ncm.open(new Uint8Array([]));
|
|
||||||
console.assert(n !== 0, 'n should not be 0', { n });
|
|
||||||
console.log('mjs test ok');
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user