taglib-wasm 1.1.0 → 1.1.1
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/index.browser.js +28 -2
- package/dist/simple.browser.js +28 -2
- package/dist/src/runtime/unified-loader/module-loading.d.ts.map +1 -1
- package/dist/src/runtime/unified-loader/module-loading.js +22 -1
- package/dist/src/taglib/taglib-class.d.ts.map +1 -1
- package/dist/src/taglib/taglib-class.js +27 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -1693,7 +1693,7 @@ var VERSION;
|
|
|
1693
1693
|
var init_version = __esm({
|
|
1694
1694
|
"src/version.ts"() {
|
|
1695
1695
|
"use strict";
|
|
1696
|
-
VERSION = "1.1.
|
|
1696
|
+
VERSION = "1.1.1";
|
|
1697
1697
|
}
|
|
1698
1698
|
});
|
|
1699
1699
|
|
|
@@ -1743,6 +1743,30 @@ var init_module_loader_browser = __esm({
|
|
|
1743
1743
|
});
|
|
1744
1744
|
|
|
1745
1745
|
// src/taglib/taglib-class.ts
|
|
1746
|
+
function toWasiPath(osPath) {
|
|
1747
|
+
if (osPath.startsWith("\\\\") || osPath.startsWith("//")) {
|
|
1748
|
+
throw new FileOperationError(
|
|
1749
|
+
"read",
|
|
1750
|
+
`UNC paths are not supported. Path: ${osPath}`
|
|
1751
|
+
);
|
|
1752
|
+
}
|
|
1753
|
+
let p = osPath;
|
|
1754
|
+
if (!p.startsWith("/") && !/^[A-Za-z]:/.test(p)) {
|
|
1755
|
+
const g = globalThis;
|
|
1756
|
+
const cwd = typeof Deno !== "undefined" ? Deno.cwd() : g.process?.cwd?.();
|
|
1757
|
+
if (cwd) {
|
|
1758
|
+
p = cwd.replace(/[/\\]+$/, "") + "/" + p;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
p = p.replaceAll("\\", "/");
|
|
1762
|
+
const driveMatch = p.match(/^([A-Za-z]):\//);
|
|
1763
|
+
if (driveMatch) {
|
|
1764
|
+
p = `/${driveMatch[1].toUpperCase()}${p.slice(2)}`;
|
|
1765
|
+
}
|
|
1766
|
+
p = p.replace(/\/\.\//g, "/").replace(/\/+/g, "/");
|
|
1767
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
1768
|
+
return p;
|
|
1769
|
+
}
|
|
1746
1770
|
async function createTagLib(module) {
|
|
1747
1771
|
return new TagLib(module);
|
|
1748
1772
|
}
|
|
@@ -1755,6 +1779,7 @@ var init_taglib_class = __esm({
|
|
|
1755
1779
|
init_audio_file_impl();
|
|
1756
1780
|
init_load_audio_data();
|
|
1757
1781
|
init_tag_mapping();
|
|
1782
|
+
init_errors2();
|
|
1758
1783
|
init_version();
|
|
1759
1784
|
TagLib = class _TagLib {
|
|
1760
1785
|
constructor(module) {
|
|
@@ -1793,7 +1818,8 @@ var init_taglib_class = __esm({
|
|
|
1793
1818
|
try {
|
|
1794
1819
|
const fh = fileHandle2;
|
|
1795
1820
|
if (fh.loadFromPath) {
|
|
1796
|
-
const
|
|
1821
|
+
const wasiPath = toWasiPath(actualInput);
|
|
1822
|
+
const success = fh.loadFromPath(wasiPath);
|
|
1797
1823
|
if (!success) {
|
|
1798
1824
|
throw new InvalidFormatError(
|
|
1799
1825
|
`Failed to load audio file. Path: ${actualInput}`
|
package/dist/simple.browser.js
CHANGED
|
@@ -1681,7 +1681,7 @@ var VERSION;
|
|
|
1681
1681
|
var init_version = __esm({
|
|
1682
1682
|
"src/version.ts"() {
|
|
1683
1683
|
"use strict";
|
|
1684
|
-
VERSION = "1.1.
|
|
1684
|
+
VERSION = "1.1.1";
|
|
1685
1685
|
}
|
|
1686
1686
|
});
|
|
1687
1687
|
|
|
@@ -1730,6 +1730,30 @@ var init_module_loader_browser = __esm({
|
|
|
1730
1730
|
});
|
|
1731
1731
|
|
|
1732
1732
|
// src/taglib/taglib-class.ts
|
|
1733
|
+
function toWasiPath(osPath) {
|
|
1734
|
+
if (osPath.startsWith("\\\\") || osPath.startsWith("//")) {
|
|
1735
|
+
throw new FileOperationError(
|
|
1736
|
+
"read",
|
|
1737
|
+
`UNC paths are not supported. Path: ${osPath}`
|
|
1738
|
+
);
|
|
1739
|
+
}
|
|
1740
|
+
let p = osPath;
|
|
1741
|
+
if (!p.startsWith("/") && !/^[A-Za-z]:/.test(p)) {
|
|
1742
|
+
const g = globalThis;
|
|
1743
|
+
const cwd = typeof Deno !== "undefined" ? Deno.cwd() : g.process?.cwd?.();
|
|
1744
|
+
if (cwd) {
|
|
1745
|
+
p = cwd.replace(/[/\\]+$/, "") + "/" + p;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
p = p.replaceAll("\\", "/");
|
|
1749
|
+
const driveMatch = p.match(/^([A-Za-z]):\//);
|
|
1750
|
+
if (driveMatch) {
|
|
1751
|
+
p = `/${driveMatch[1].toUpperCase()}${p.slice(2)}`;
|
|
1752
|
+
}
|
|
1753
|
+
p = p.replace(/\/\.\//g, "/").replace(/\/+/g, "/");
|
|
1754
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
1755
|
+
return p;
|
|
1756
|
+
}
|
|
1733
1757
|
async function createTagLib(module) {
|
|
1734
1758
|
return new TagLib(module);
|
|
1735
1759
|
}
|
|
@@ -1742,6 +1766,7 @@ var init_taglib_class = __esm({
|
|
|
1742
1766
|
init_audio_file_impl();
|
|
1743
1767
|
init_load_audio_data();
|
|
1744
1768
|
init_tag_mapping();
|
|
1769
|
+
init_errors2();
|
|
1745
1770
|
init_version();
|
|
1746
1771
|
TagLib = class _TagLib {
|
|
1747
1772
|
constructor(module) {
|
|
@@ -1780,7 +1805,8 @@ var init_taglib_class = __esm({
|
|
|
1780
1805
|
try {
|
|
1781
1806
|
const fh = fileHandle2;
|
|
1782
1807
|
if (fh.loadFromPath) {
|
|
1783
|
-
const
|
|
1808
|
+
const wasiPath = toWasiPath(actualInput);
|
|
1809
|
+
const success = fh.loadFromPath(wasiPath);
|
|
1784
1810
|
if (!success) {
|
|
1785
1811
|
throw new InvalidFormatError(
|
|
1786
1812
|
`Failed to load audio file. Path: ${actualInput}`
|
|
@@ -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;AAG7D,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;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA0CzE,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,GAAG,YAAY,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAS3B"}
|
|
@@ -2,6 +2,27 @@ import { supportsExnref } from "../detector.js";
|
|
|
2
2
|
import { ModuleLoadError } from "./types.js";
|
|
3
3
|
import { errorMessage } from "../../errors/classes.js";
|
|
4
4
|
import { fileUrlToPath } from "../../utils/path.js";
|
|
5
|
+
function isWindows() {
|
|
6
|
+
return typeof Deno !== "undefined" ? Deno.build.os === "windows" : globalThis.process ? globalThis.process.platform === "win32" : false;
|
|
7
|
+
}
|
|
8
|
+
function getPreopens() {
|
|
9
|
+
if (!isWindows()) return { "/": "/" };
|
|
10
|
+
const preopens = {};
|
|
11
|
+
for (const letter of "CDEFGHIJKLMNOPQRSTUVWXYZAB") {
|
|
12
|
+
const root = `${letter}:\\`;
|
|
13
|
+
try {
|
|
14
|
+
if (typeof Deno !== "undefined") {
|
|
15
|
+
Deno.statSync(root);
|
|
16
|
+
} else {
|
|
17
|
+
const fs = new Function("return require('node:fs')")();
|
|
18
|
+
fs.statSync(root);
|
|
19
|
+
}
|
|
20
|
+
preopens[`/${letter}`] = root;
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return Object.keys(preopens).length > 0 ? preopens : { "/C": "C:\\" };
|
|
25
|
+
}
|
|
5
26
|
function resolveWasmPath(relativePath) {
|
|
6
27
|
const url = new URL(relativePath, import.meta.url);
|
|
7
28
|
return url.protocol === "file:" ? fileUrlToPath(url) : url.href;
|
|
@@ -22,7 +43,7 @@ async function loadWasiModuleWithFallback(runtime, options) {
|
|
|
22
43
|
const { loadWasiHost } = await import("../wasi-host-loader.js");
|
|
23
44
|
const wasiModule = await loadWasiHost({
|
|
24
45
|
wasmPath: options.wasmUrl || defaultWasmPath,
|
|
25
|
-
preopens:
|
|
46
|
+
preopens: getPreopens()
|
|
26
47
|
});
|
|
27
48
|
return { module: wasiModule, actualWasmType: "wasi" };
|
|
28
49
|
} catch (hostError) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taglib-class.d.ts","sourceRoot":"","sources":["../../../src/taglib/taglib-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"taglib-class.d.ts","sourceRoot":"","sources":["../../../src/taglib/taglib-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO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IjB,OAAO,CAAC,aAAa;CAStB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtE"}
|
|
@@ -8,7 +8,32 @@ import { InvalidFormatError, TagLibInitializationError } from "../errors.js";
|
|
|
8
8
|
import { AudioFileImpl } from "./audio-file-impl.js";
|
|
9
9
|
import { loadAudioData } from "./load-audio-data.js";
|
|
10
10
|
import { mergeTagUpdates } from "../utils/tag-mapping.js";
|
|
11
|
+
import { FileOperationError } from "../errors.js";
|
|
11
12
|
import { VERSION } from "../version.js";
|
|
13
|
+
function toWasiPath(osPath) {
|
|
14
|
+
if (osPath.startsWith("\\\\") || osPath.startsWith("//")) {
|
|
15
|
+
throw new FileOperationError(
|
|
16
|
+
"read",
|
|
17
|
+
`UNC paths are not supported. Path: ${osPath}`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
let p = osPath;
|
|
21
|
+
if (!p.startsWith("/") && !/^[A-Za-z]:/.test(p)) {
|
|
22
|
+
const g = globalThis;
|
|
23
|
+
const cwd = typeof Deno !== "undefined" ? Deno.cwd() : g.process?.cwd?.();
|
|
24
|
+
if (cwd) {
|
|
25
|
+
p = cwd.replace(/[/\\]+$/, "") + "/" + p;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
p = p.replaceAll("\\", "/");
|
|
29
|
+
const driveMatch = p.match(/^([A-Za-z]):\//);
|
|
30
|
+
if (driveMatch) {
|
|
31
|
+
p = `/${driveMatch[1].toUpperCase()}${p.slice(2)}`;
|
|
32
|
+
}
|
|
33
|
+
p = p.replace(/\/\.\//g, "/").replace(/\/+/g, "/");
|
|
34
|
+
if (!p.startsWith("/")) p = "/" + p;
|
|
35
|
+
return p;
|
|
36
|
+
}
|
|
12
37
|
class TagLib {
|
|
13
38
|
constructor(module) {
|
|
14
39
|
__publicField(this, "module");
|
|
@@ -46,7 +71,8 @@ class TagLib {
|
|
|
46
71
|
try {
|
|
47
72
|
const fh = fileHandle2;
|
|
48
73
|
if (fh.loadFromPath) {
|
|
49
|
-
const
|
|
74
|
+
const wasiPath = toWasiPath(actualInput);
|
|
75
|
+
const success = fh.loadFromPath(wasiPath);
|
|
50
76
|
if (!success) {
|
|
51
77
|
throw new InvalidFormatError(
|
|
52
78
|
`Failed to load audio file. Path: ${actualInput}`
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.1.
|
|
1
|
+
export declare const VERSION = "1.1.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taglib-wasm",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
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",
|