taglib-wasm 1.0.0-beta.6 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/runtime/module-loader.js +5 -2
- package/dist/src/runtime/unified-loader/module-loading.d.ts.map +1 -1
- package/dist/src/runtime/unified-loader/module-loading.js +9 -4
- package/dist/src/runtime/wasi-host-loader.d.ts.map +1 -1
- package/dist/src/runtime/wasi-host-loader.js +5 -1
- package/dist/src/runtime/wasmer-sdk-loader/loader.d.ts.map +1 -1
- package/dist/src/runtime/wasmer-sdk-loader/loader.js +4 -1
- package/package.json +1 -1
|
@@ -36,11 +36,11 @@ async function loadTagLibModule(options) {
|
|
|
36
36
|
async function loadBufferModeTagLibModule(options) {
|
|
37
37
|
let createTagLibModule;
|
|
38
38
|
try {
|
|
39
|
-
const module2 = await import("../../
|
|
39
|
+
const module2 = await import("../../taglib-wrapper.js");
|
|
40
40
|
createTagLibModule = module2.default;
|
|
41
41
|
} catch {
|
|
42
42
|
try {
|
|
43
|
-
const module2 = await import("../../
|
|
43
|
+
const module2 = await import("../../taglib-wrapper.js");
|
|
44
44
|
createTagLibModule = module2.default;
|
|
45
45
|
} catch {
|
|
46
46
|
throw new TagLibInitializationError(
|
|
@@ -59,6 +59,9 @@ async function loadBufferModeTagLibModule(options) {
|
|
|
59
59
|
}
|
|
60
60
|
return path;
|
|
61
61
|
};
|
|
62
|
+
} else if (!options?.wasmBinary) {
|
|
63
|
+
const wasmUrl = new URL("../../build/taglib-web.wasm", import.meta.url);
|
|
64
|
+
moduleConfig.locateFile = (path) => path.endsWith(".wasm") ? wasmUrl.href : path;
|
|
62
65
|
}
|
|
63
66
|
const module = await createTagLibModule(moduleConfig);
|
|
64
67
|
return module;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-loading.d.ts","sourceRoot":"","sources":["../../../../src/runtime/unified-loader/module-loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"module-loading.d.ts","sourceRoot":"","sources":["../../../../src/runtime/unified-loader/module-loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAQzE,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,GAAG,YAAY,EAC/B,QAAQ,EAAE,sBAAsB,EAChC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAS3B"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ModuleLoadError } from "./types.js";
|
|
2
|
+
function resolveWasmPath(relativePath) {
|
|
3
|
+
const url = new URL(relativePath, import.meta.url);
|
|
4
|
+
return url.protocol === "file:" ? url.pathname : url.href;
|
|
5
|
+
}
|
|
2
6
|
async function loadModule(wasmType, _runtime, options) {
|
|
3
7
|
if (wasmType === "wasi") {
|
|
4
8
|
return await loadWasiModuleWithFallback(options);
|
|
@@ -10,10 +14,11 @@ async function loadModule(wasmType, _runtime, options) {
|
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
async function loadWasiModuleWithFallback(options) {
|
|
17
|
+
const defaultWasmPath = resolveWasmPath("../../../build/taglib_wasi.wasm");
|
|
13
18
|
try {
|
|
14
19
|
const { loadWasiHost } = await import("../wasi-host-loader.js");
|
|
15
20
|
const wasiModule = await loadWasiHost({
|
|
16
|
-
wasmPath: options.wasmUrl ||
|
|
21
|
+
wasmPath: options.wasmUrl || defaultWasmPath
|
|
17
22
|
});
|
|
18
23
|
return { module: wasiModule, actualWasmType: "wasi" };
|
|
19
24
|
} catch (hostError) {
|
|
@@ -25,7 +30,7 @@ async function loadWasiModuleWithFallback(options) {
|
|
|
25
30
|
const { initializeWasmer, loadWasmerWasi } = await import("../wasmer-sdk-loader/index.js");
|
|
26
31
|
await initializeWasmer(options.useInlineWasm);
|
|
27
32
|
const wasiModule = await loadWasmerWasi({
|
|
28
|
-
wasmPath: options.wasmUrl ||
|
|
33
|
+
wasmPath: options.wasmUrl || defaultWasmPath,
|
|
29
34
|
useInlineWasm: options.useInlineWasm,
|
|
30
35
|
debug: options.debug
|
|
31
36
|
});
|
|
@@ -47,11 +52,11 @@ async function loadEmscriptenModule(options) {
|
|
|
47
52
|
try {
|
|
48
53
|
let createModule;
|
|
49
54
|
try {
|
|
50
|
-
const module2 = await import("../../../
|
|
55
|
+
const module2 = await import("../../../taglib-wrapper.js");
|
|
51
56
|
createModule = module2.default;
|
|
52
57
|
} catch {
|
|
53
58
|
try {
|
|
54
|
-
const module2 = await import("../../../
|
|
59
|
+
const module2 = await import("../../../taglib-wrapper.js");
|
|
55
60
|
createModule = module2.default;
|
|
56
61
|
} catch {
|
|
57
62
|
throw new ModuleLoadError(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasi-host-loader.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-host-loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,EAAE,CAAC,EAAE,kBAAkB,CAAC;CACzB;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAG,sBAAsB,CAAU;gBACpC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAcD,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"wasi-host-loader.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-host-loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,EAAE,CAAC,EAAE,kBAAkB,CAAC;CACzB;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAG,sBAAsB,CAAU;gBACpC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAcD,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,CA6ClC"}
|
|
@@ -21,7 +21,11 @@ async function resolveFs(provided) {
|
|
|
21
21
|
return createNodeFsProvider();
|
|
22
22
|
}
|
|
23
23
|
async function loadWasiHost(config) {
|
|
24
|
-
const
|
|
24
|
+
const defaultPath = (() => {
|
|
25
|
+
const url = new URL("../../build/taglib_wasi.wasm", import.meta.url);
|
|
26
|
+
return url.protocol === "file:" ? url.pathname : url.href;
|
|
27
|
+
})();
|
|
28
|
+
const wasmPath = config.wasmPath ?? defaultPath;
|
|
25
29
|
const preopens = config.preopens ?? {};
|
|
26
30
|
const fs = await resolveFs(config.fs);
|
|
27
31
|
const wasmBytes = await loadWasmBinary(wasmPath, fs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/runtime/wasmer-sdk-loader/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAMjE;;GAEG;AACH,wBAAsB,cAAc,CAClC,MAAM,GAAE,kBAAuB,GAC9B,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/runtime/wasmer-sdk-loader/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAMjE;;GAEG;AACH,wBAAsB,cAAc,CAClC,MAAM,GAAE,kBAAuB,GAC9B,OAAO,CAAC,UAAU,CAAC,CAgDrB"}
|
|
@@ -5,7 +5,10 @@ import { instantiateWasi } from "./wasi-stubs.js";
|
|
|
5
5
|
import { createWasiModule } from "./module-creation.js";
|
|
6
6
|
async function loadWasmerWasi(config = {}) {
|
|
7
7
|
const {
|
|
8
|
-
wasmPath =
|
|
8
|
+
wasmPath = (() => {
|
|
9
|
+
const url = new URL("../../../build/taglib_wasi.wasm", import.meta.url);
|
|
10
|
+
return url.protocol === "file:" ? url.pathname : url.href;
|
|
11
|
+
})(),
|
|
9
12
|
useInlineWasm = false,
|
|
10
13
|
mounts = {},
|
|
11
14
|
env = {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taglib-wasm",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"description": "TagLib-Wasm is the universal tagging library for TypeScript/JavaScript platforms: Browsers, Node.js, Deno, Bun, Cloudflare Workers, and Electron apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|