taglib-wasm 2.4.0 → 2.5.0
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/LICENSE +0 -29
- package/NOTICE +35 -0
- package/README.md +42 -36
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/assertClassBrand.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/checkPrivateRedeclaration.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/classPrivateFieldGet2.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/classPrivateFieldInitSpec.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/classPrivateFieldSet2.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/typeof.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/usingCtx.js +1 -1
- package/dist/bwf/bext.d.ts.map +1 -1
- package/dist/bwf/bext.js +25 -16
- package/dist/constants/complex-properties.d.ts.map +1 -1
- package/dist/constants/general-extended-properties.d.ts +2 -1
- package/dist/constants/general-extended-properties.d.ts.map +1 -1
- package/dist/constants/general-extended-properties.js +5 -2
- package/dist/constants/properties.js +4 -2
- package/dist/constants/specialized-properties.d.ts +14 -0
- package/dist/constants/specialized-properties.d.ts.map +1 -1
- package/dist/constants/specialized-properties.js +21 -0
- package/dist/disc-folder.js +79 -45
- package/dist/folder-api/album-corroborate.d.ts.map +1 -1
- package/dist/folder-api/album-corroborate.js +25 -11
- package/dist/folder-api/album-discs.d.ts.map +1 -1
- package/dist/folder-api/album-discs.js +2 -5
- package/dist/folder-api/album-grouping.d.ts.map +1 -1
- package/dist/folder-api/album-grouping.js +27 -15
- package/dist/folder-api/album-identity.js +1 -1
- package/dist/folder-api/folder-disc.d.ts.map +1 -1
- package/dist/folder-api/folder-disc.js +24 -13
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +2 -4453
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/msgpack/encoder.d.ts.map +1 -1
- package/dist/msgpack/encoder.js +3 -1
- package/dist/rating.js +1 -2
- package/dist/runtime/module-loader.d.ts.map +1 -1
- package/dist/runtime/module-loader.js +43 -33
- package/dist/runtime/platform-io.d.ts.map +1 -1
- package/dist/runtime/platform-io.js +4 -2
- package/dist/runtime/unified-loader/module-loading.d.ts.map +1 -1
- package/dist/runtime/unified-loader/module-loading.js +3 -2
- package/dist/runtime/wasi-adapter/adapter.js +1 -1
- package/dist/runtime/wasi-adapter/audio-properties.d.ts.map +1 -1
- package/dist/runtime/wasi-adapter/audio-properties.js +8 -2
- package/dist/runtime/wasi-adapter/file-handle.d.ts +3 -1
- package/dist/runtime/wasi-adapter/file-handle.d.ts.map +1 -1
- package/dist/runtime/wasi-adapter/file-handle.js +17 -5
- package/dist/runtime/wasi-adapter/handle-state.d.ts.map +1 -1
- package/dist/runtime/wasi-adapter/handle-state.js +7 -1
- package/dist/runtime/wasi-adapter/index.js +1 -2
- package/dist/runtime/wasi-adapter/mp4-items.d.ts +24 -0
- package/dist/runtime/wasi-adapter/mp4-items.d.ts.map +1 -1
- package/dist/runtime/wasi-adapter/mp4-items.js +119 -2
- package/dist/runtime/wasi-adapter/property-surface.d.ts.map +1 -1
- package/dist/runtime/wasi-adapter/property-surface.js +15 -6
- package/dist/runtime/wasi-adapter/structured-fields.js +1 -1
- package/dist/runtime/wasi-adapter/tag-keys.d.ts.map +1 -1
- package/dist/runtime/wasi-adapter/tag-keys.js +3 -1
- package/dist/runtime/wasi-adapter/wasm-io.d.ts.map +1 -1
- package/dist/runtime/wasi-adapter/wasm-io.js +1 -1
- package/dist/runtime/wasi-memory.js +3 -3
- package/dist/simple/batch-operations.d.ts.map +1 -1
- package/dist/simple/batch-operations.js +5 -1
- package/dist/simple/picture-operations.d.ts +6 -0
- package/dist/simple/picture-operations.d.ts.map +1 -1
- package/dist/simple/picture-operations.js +6 -0
- package/dist/simple/tag-operations.d.ts +7 -0
- package/dist/simple/tag-operations.d.ts.map +1 -1
- package/dist/simple/tag-operations.js +7 -0
- package/dist/simple/with-audio-file.d.ts.map +1 -1
- package/dist/simple/with-audio-file.js +2 -1
- package/dist/simple.browser.js +2 -3670
- package/dist/taglib/audio-file-base.d.ts +35 -1
- package/dist/taglib/audio-file-base.d.ts.map +1 -1
- package/dist/taglib/audio-file-base.js +91 -21
- package/dist/taglib/audio-file-checksum.d.ts.map +1 -1
- package/dist/taglib/audio-file-checksum.js +17 -13
- package/dist/taglib/audio-file-impl.d.ts.map +1 -1
- package/dist/taglib/audio-file-impl.js +1 -1
- package/dist/taglib/audio-file-interface.d.ts +18 -1
- package/dist/taglib/audio-file-interface.d.ts.map +1 -1
- package/dist/taglib/embind-adapter.d.ts +3 -0
- package/dist/taglib/embind-adapter.d.ts.map +1 -1
- package/dist/taglib/embind-adapter.js +6 -0
- package/dist/taglib/extra-state-registry.d.ts.map +1 -1
- package/dist/taglib/extra-state-registry.js +15 -0
- package/dist/taglib/load-audio-data.d.ts +11 -8
- package/dist/taglib/load-audio-data.d.ts.map +1 -1
- package/dist/taglib/load-audio-data.js +39 -43
- package/dist/taglib/metadata-extent.d.ts.map +1 -1
- package/dist/taglib/metadata-extent.js +59 -32
- package/dist/taglib/mutable-tag-impl.d.ts.map +1 -1
- package/dist/taglib/mutable-tag-impl.js +72 -69
- package/dist/taglib/taglib-class.d.ts.map +1 -1
- package/dist/taglib/taglib-class.js +16 -6
- package/dist/taglib-wasi.wasm +0 -0
- package/dist/taglib-web.wasm +0 -0
- package/dist/taglib-wrapper.js +1 -1
- package/dist/types/metadata-mappings.d.ts.map +1 -1
- package/dist/types/metadata-mappings.js +8 -0
- package/dist/types/tags.d.ts +48 -0
- package/dist/types/tags.d.ts.map +1 -1
- package/dist/utils/mp4-freeform.d.ts +20 -0
- package/dist/utils/mp4-freeform.d.ts.map +1 -0
- package/dist/utils/mp4-freeform.js +111 -0
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +3 -1
- package/dist/utils/tag-mapping.d.ts.map +1 -1
- package/dist/utils/tag-mapping.js +30 -18
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wasm.d.ts +3 -0
- package/dist/wasm.d.ts.map +1 -1
- package/dist/web-utils/data-url.js +1 -1
- package/dist/web.browser.js +2 -3388
- package/legal/COPYING.LGPL +502 -0
- package/package.json +17 -10
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export type { PropertyMetadata } from "./constants/property-types.js";
|
|
|
46
46
|
export { copyCoverArt, exportAllPictures, exportCoverArt, exportPictureByType, findCoverArtFiles, importCoverArt, importPictureWithType, loadPictureFromFile, savePictureToFile, } from "./file-utils/index.js";
|
|
47
47
|
export { type AlbumDisc, type AlbumGroup, type AlbumGroupingResult, type AlbumGroupItem, type AlbumGroupKey, type AudioDynamics, type AudioFileMetadata, type DiscConfidence, type DiscFolderInfo, discFolderInfo, type DuplicateGroup, exportFolderMetadata, findDuplicates, type FolderScanItem, type FolderScanOptions, type FolderScanResult, groupAlbums, type GroupAlbumsOptions, scanFolder, scanForAlbums, type ScanForAlbumsOptions, } from "./folder-api/index.js";
|
|
48
48
|
export { canvasToPicture, createPictureDownloadURL, createPictureGallery, dataURLToPicture, displayPicture, imageFileToPicture, pictureToDataURL, setCoverArtFromCanvas, } from "./web-utils/index.js";
|
|
49
|
-
export type { AudioCodec, AudioFileInput, AudioProperties, BitrateControlMode, BroadcastAudioExtension, Chapter, ContainerFormat, ExtendedTag, FieldMapping, FileType, NamedAudioInput, OpenOptions, Picture, PictureType, PropertyMap, SetChaptersOptions, Tag, TagInput, } from "./types.js";
|
|
49
|
+
export type { AudioCodec, AudioFileInput, AudioProperties, BitrateControlMode, BroadcastAudioExtension, Chapter, ContainerFormat, ExtendedTag, FieldMapping, FileType, MP4FreeformItem, MP4FreeformType, NamedAudioInput, OpenOptions, Picture, PictureType, PropertyMap, SetChaptersOptions, Tag, TagInput, } from "./types.js";
|
|
50
50
|
export { BITRATE_CONTROL_MODE_NAMES, BITRATE_CONTROL_MODE_VALUES, PICTURE_TYPE_NAMES, PICTURE_TYPE_VALUES, } from "./types.js";
|
|
51
51
|
export type { PropertyKey, PropertyValue } from "./constants.js";
|
|
52
52
|
export type { FormatPropertyKey, TagFormat, } from "./types/format-property-keys.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,YAAY,EACV,SAAS,EACT,cAAc,GACf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EAC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AE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,YAAY,EACV,SAAS,EACT,cAAc,GACf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,aAAa,EACb,wBAAwB,EACxB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,eAAe,EACf,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,aAAa,EACb,SAAS,EACT,KAAK,YAAY,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,aAAa,EACb,oBAAoB,EACpB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,iBAAiB,EACj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OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjE,YAAY,EACV,iBAAiB,EACjB,SAAS,GACV,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAKrE,YAAY,EACV,UAAU,EACV,MAAM,EACN,cAAc,EACd,UAAU,GACX,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGtE,OAAO,KAAK,GAAG,MAAM,eAAe,CAAC;AAGrC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../src/msgpack/encoder.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../src/msgpack/encoder.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AA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AAM,CAAC;CAC1B,CAaA"}
|
package/dist/msgpack/encoder.js
CHANGED
package/dist/rating.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { RatingUtils, clamp, fromNormalized, fromPercent, fromPopm, fromStars, isValid, normalized, popm, toNormalized, toPercent, toPopm, toStars };
|
|
1
|
+
export { RatingUtils, clamp, fromNormalized, fromPercent, fromPopm, fromStars, isValid, normalized, popm, toNormalized, toPercent, toPopm, toStars } from "./utils/rating.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../src/runtime/module-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../src/runtime/module-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAiBvB"}
|
|
@@ -3,6 +3,46 @@ import { checkNodeVersion } from "./detector.js";
|
|
|
3
3
|
import { isDenoCompiled } from "./deno-detect.js";
|
|
4
4
|
import { describeNonWasmBinary } from "./loader-types.js";
|
|
5
5
|
//#region src/runtime/module-loader.ts
|
|
6
|
+
/** Validate backend/version preconditions before loading. */
|
|
7
|
+
function validateLoadPreconditions(options) {
|
|
8
|
+
const node = globalThis.process?.versions?.node;
|
|
9
|
+
const versionError = checkNodeVersion(typeof node === "string" ? node : void 0);
|
|
10
|
+
if (versionError) throw new EnvironmentError("Node.js", versionError, "WASI support");
|
|
11
|
+
if (options?.forceWasmType === "wasi" && options?.wasmBinary) throw new TagLibInitializationError("wasmBinary is not supported by the WASI backend: it loads from a filesystem path or URL. Use wasmUrl, or omit forceWasmType to use the Emscripten backend", { forceWasmType: "wasi" });
|
|
12
|
+
if (options?.wasmBinary) {
|
|
13
|
+
const problem = describeNonWasmBinary(options.wasmBinary);
|
|
14
|
+
if (problem) throw new TagLibInitializationError(problem, { byteLength: options.wasmBinary.byteLength });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Deno compile: load the embedded Wasm, or warn and use the default path. */
|
|
18
|
+
async function loadDenoCompiled(options) {
|
|
19
|
+
const wasmBinary = await tryLoadEmbeddedWasm();
|
|
20
|
+
if (!wasmBinary) console.warn("[TagLib] Deno compile detected but embedded Wasm not found. Include taglib-web.wasm with: deno compile --include taglib-web.wasm");
|
|
21
|
+
return loadBufferModeTagLibModule({
|
|
22
|
+
...options,
|
|
23
|
+
forceWasmType: "emscripten",
|
|
24
|
+
...wasmBinary ? { wasmBinary } : {}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Unified loader with auto-mode fallback; an explicit WASI choice throws. */
|
|
28
|
+
async function loadUnified(options) {
|
|
29
|
+
try {
|
|
30
|
+
const { loadUnifiedTagLibModule } = await import("./unified-loader/index.js");
|
|
31
|
+
return await loadUnifiedTagLibModule({
|
|
32
|
+
...options?.wasmBinary !== void 0 ? { wasmBinary: options.wasmBinary } : {},
|
|
33
|
+
...options?.wasmUrl !== void 0 ? { wasmUrl: options.wasmUrl } : {},
|
|
34
|
+
...options?.forceWasmType !== void 0 ? { forceWasmType: options.forceWasmType } : {},
|
|
35
|
+
debug: false
|
|
36
|
+
});
|
|
37
|
+
} catch (error) {
|
|
38
|
+
if (options?.forceWasmType === "wasi") throw new TagLibInitializationError(`WASI backend failed to load: ${errorMessage(error)}. forceWasmType is "wasi", so the Emscripten fallback was not attempted`, {
|
|
39
|
+
cause: error,
|
|
40
|
+
forceWasmType: "wasi"
|
|
41
|
+
});
|
|
42
|
+
console.warn(`[TagLib] Unified loader failed, falling back to buffer mode: ${errorMessage(error)}`);
|
|
43
|
+
return loadBufferModeTagLibModule(options || {});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
6
46
|
/**
|
|
7
47
|
* Load the TagLib Wasm module.
|
|
8
48
|
* This function initializes the WebAssembly module and returns
|
|
@@ -39,40 +79,10 @@ import { describeNonWasmBinary } from "./loader-types.js";
|
|
|
39
79
|
* which handles module loading automatically.
|
|
40
80
|
*/
|
|
41
81
|
async function loadTagLibModule(options) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (versionError) throw new EnvironmentError("Node.js", versionError, "WASI support");
|
|
45
|
-
if (options?.forceWasmType === "wasi" && options?.wasmBinary) throw new TagLibInitializationError("wasmBinary is not supported by the WASI backend: it loads from a filesystem path or URL. Use wasmUrl, or omit forceWasmType to use the Emscripten backend", { forceWasmType: "wasi" });
|
|
46
|
-
if (options?.wasmBinary) {
|
|
47
|
-
const problem = describeNonWasmBinary(options.wasmBinary);
|
|
48
|
-
if (problem) throw new TagLibInitializationError(problem, { byteLength: options.wasmBinary.byteLength });
|
|
49
|
-
}
|
|
50
|
-
if (!options?.wasmBinary && !options?.wasmUrl && !options?.forceWasmType && isDenoCompiled()) {
|
|
51
|
-
const wasmBinary = await tryLoadEmbeddedWasm();
|
|
52
|
-
if (!wasmBinary) console.warn("[TagLib] Deno compile detected but embedded Wasm not found. Include taglib-web.wasm with: deno compile --include taglib-web.wasm");
|
|
53
|
-
return loadBufferModeTagLibModule({
|
|
54
|
-
...options,
|
|
55
|
-
forceWasmType: "emscripten",
|
|
56
|
-
...wasmBinary ? { wasmBinary } : {}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
82
|
+
validateLoadPreconditions(options);
|
|
83
|
+
if (!options?.wasmBinary && !options?.wasmUrl && !options?.forceWasmType && isDenoCompiled()) return loadDenoCompiled(options);
|
|
59
84
|
if (options?.forceWasmType === "emscripten") return loadBufferModeTagLibModule(options);
|
|
60
|
-
|
|
61
|
-
const { loadUnifiedTagLibModule } = await import("./unified-loader/index.js");
|
|
62
|
-
return await loadUnifiedTagLibModule({
|
|
63
|
-
...options?.wasmBinary !== void 0 ? { wasmBinary: options.wasmBinary } : {},
|
|
64
|
-
...options?.wasmUrl !== void 0 ? { wasmUrl: options.wasmUrl } : {},
|
|
65
|
-
...options?.forceWasmType !== void 0 ? { forceWasmType: options.forceWasmType } : {},
|
|
66
|
-
debug: false
|
|
67
|
-
});
|
|
68
|
-
} catch (error) {
|
|
69
|
-
if (options?.forceWasmType === "wasi") throw new TagLibInitializationError(`WASI backend failed to load: ${errorMessage(error)}. forceWasmType is "wasi", so the Emscripten fallback was not attempted`, {
|
|
70
|
-
cause: error,
|
|
71
|
-
forceWasmType: "wasi"
|
|
72
|
-
});
|
|
73
|
-
console.warn(`[TagLib] Unified loader failed, falling back to buffer mode: ${errorMessage(error)}`);
|
|
74
|
-
return loadBufferModeTagLibModule(options || {});
|
|
75
|
-
}
|
|
85
|
+
return loadUnified(options);
|
|
76
86
|
}
|
|
77
87
|
/**
|
|
78
88
|
* Emscripten-only module loader for buffer mode (in-memory I/O).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-io.d.ts","sourceRoot":"","sources":["../../src/runtime/platform-io.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CA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gB,wBAAwB,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,CAE7D;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -50,10 +50,12 @@ function createNodeIO() {
|
|
|
50
50
|
let fsCache;
|
|
51
51
|
let bufCache;
|
|
52
52
|
async function getFs() {
|
|
53
|
-
|
|
53
|
+
fsCache ?? (fsCache = await import("node:fs/promises"));
|
|
54
|
+
return fsCache;
|
|
54
55
|
}
|
|
55
56
|
async function getBuf() {
|
|
56
|
-
|
|
57
|
+
bufCache ?? (bufCache = await import("node:buffer"));
|
|
58
|
+
return bufCache;
|
|
57
59
|
}
|
|
58
60
|
return {
|
|
59
61
|
readFile: async (path) => {
|
|
@@ -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;AAczE,6EAA6E;AAC7E,wBAAgB,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BpD;AAOD,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,GAAG,YAAY,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAS3B"}
|
|
@@ -5,14 +5,15 @@ import { fileUrlToPath } from "../../utils/path.js";
|
|
|
5
5
|
import { ModuleLoadError } from "./types.js";
|
|
6
6
|
//#region src/runtime/unified-loader/module-loading.ts
|
|
7
7
|
function isWindows() {
|
|
8
|
-
|
|
8
|
+
if (isDeno()) return Deno.build.os === "windows";
|
|
9
|
+
return globalThis.process?.platform === "win32";
|
|
9
10
|
}
|
|
10
11
|
/** @internal Exported for unit tests (tests/node-fs-acquisition.test.ts). */
|
|
11
12
|
function getPreopens() {
|
|
12
13
|
if (!isWindows()) return { "/": "/" };
|
|
13
14
|
const statSync = isDeno() ? (p) => Deno.statSync(p) : getNodeFsSync()?.statSync;
|
|
14
15
|
if (!statSync) {
|
|
15
|
-
console.warn("[taglib-wasm] Windows drive detection unavailable: node:fs could not be loaded. Only C
|
|
16
|
+
console.warn("[taglib-wasm] Windows drive detection unavailable: node:fs could not " + String.raw`be loaded. Only C:\ is registered as a WASI preopen.`);
|
|
16
17
|
return { "/C": "C:\\" };
|
|
17
18
|
}
|
|
18
19
|
const preopens = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MemoryError } from "../../errors/classes.js";
|
|
2
|
-
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.js";
|
|
3
3
|
import { WasmerExecutionError } from "../wasmer-sdk-loader/types.js";
|
|
4
4
|
import { WasiFileHandle } from "./file-handle.js";
|
|
5
5
|
import { openAudioPath } from "./path-open.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-properties.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/audio-properties.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"audio-properties.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/audio-properties.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AAyDxB,wEAAwE;AACxE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GACtC,eAAe,GAAG,IAAI,CA8BxB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CA0B3D;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,QAAQ,EAAE,UAAU,GAAG,IAAI,GAC1B,MAAM,CAiFR;AAED,4EAA4E;AAC5E,wBAAgB,KAAK,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,QAAQ,EAAE,UAAU,GAAG,IAAI,GAC1B,OAAO,CAYT"}
|
|
@@ -40,6 +40,12 @@ const OGG_CODEC_TO_FORMAT = {
|
|
|
40
40
|
FLAC: "OggFLAC",
|
|
41
41
|
Speex: "SPEEX"
|
|
42
42
|
};
|
|
43
|
+
/** `isEncrypted` default per format contract (taglib-rcz). */
|
|
44
|
+
function encryptionEntries(isEncrypted, containerFormat) {
|
|
45
|
+
if (isEncrypted === true) return { isEncrypted: true };
|
|
46
|
+
if (containerFormat === "MP4" || containerFormat === "ASF") return { isEncrypted: false };
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
43
49
|
/** The audio-properties block of the C++ snapshot, null when absent. */
|
|
44
50
|
function getAudioProperties(tagData) {
|
|
45
51
|
if (!tagData || !("sampleRate" in tagData)) return null;
|
|
@@ -61,7 +67,7 @@ function getAudioProperties(tagData) {
|
|
|
61
67
|
mpegVersion,
|
|
62
68
|
mpegLayer: d.mpegLayer ?? 0
|
|
63
69
|
} : {},
|
|
64
|
-
...d.isEncrypted
|
|
70
|
+
...encryptionEntries(d.isEncrypted, containerFormat),
|
|
65
71
|
...formatVersion > 0 ? { formatVersion } : {},
|
|
66
72
|
...d.outputGainDb !== void 0 ? { outputGainDb: d.outputGainDb } : {}
|
|
67
73
|
};
|
|
@@ -77,7 +83,7 @@ function detectOggCodec(fileData) {
|
|
|
77
83
|
const payloadStart = 27 + segCount;
|
|
78
84
|
if (fileData.length < payloadStart + 8) return "OGG";
|
|
79
85
|
const sig = fileData.slice(payloadStart, payloadStart + 8);
|
|
80
|
-
const text = String.
|
|
86
|
+
const text = String.fromCodePoint(...sig);
|
|
81
87
|
if (text === "OpusHead") return "OPUS";
|
|
82
88
|
if (sig[0] === 127 && sig[1] === 70 && sig[2] === 76 && sig[3] === 65 && sig[4] === 67) return "OggFLAC";
|
|
83
89
|
if (text === "Speex ") return "SPEEX";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** WASI-based FileHandle implementation (taglib-1dfc split). */
|
|
2
2
|
import type { FileHandle, RawChapter, RawId3v2Frame, RawLyrics, RawPicture } from "../../wasm.js";
|
|
3
|
-
import type { BasicTagData } from "../../types/tags.js";
|
|
3
|
+
import type { BasicTagData, RawMP4FreeformItem } from "../../types/tags.js";
|
|
4
4
|
import type { AudioProperties } from "../../types.js";
|
|
5
5
|
import type { WasiModule } from "../wasmer-sdk-loader/types.js";
|
|
6
6
|
export declare class WasiFileHandle implements FileHandle {
|
|
@@ -27,6 +27,8 @@ export declare class WasiFileHandle implements FileHandle {
|
|
|
27
27
|
getMp4ItemRemovals(): string[] | undefined;
|
|
28
28
|
setMp4ItemRemovals(removals: string[]): void;
|
|
29
29
|
removeMP4Item(key: string): void;
|
|
30
|
+
getMP4FreeformItems(): RawMP4FreeformItem[];
|
|
31
|
+
setMP4FreeformItems(items: readonly RawMP4FreeformItem[]): void;
|
|
30
32
|
getPictures(): RawPicture[];
|
|
31
33
|
setPictures(pictures: RawPicture[]): void;
|
|
32
34
|
addPicture(picture: RawPicture): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-handle.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/file-handle.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"file-handle.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/file-handle.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAiBhE,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,SAAS,CAAS;gBAEd,UAAU,EAAE,UAAU;IAIlC,OAAO,CAAC,iBAAiB;IAMzB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAM3C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAMnC,OAAO,IAAI,OAAO;IAKlB,IAAI,IAAI,OAAO;IAKf,SAAS,IAAI,UAAU;IAKvB,UAAU,IAAI,YAAY;IAK1B,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;IAK7C,kBAAkB,IAAI,eAAe,GAAG,IAAI;IAK5C,SAAS,IAAI,MAAM;IAKnB,KAAK,IAAI,OAAO;IAKhB,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAKzC,aAAa,CAAC,UAAU,EAAE,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U,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;IAKlE,UAAU,CACR,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,GAC9D,IAAI;IAKP,SAAS,IAAI,SAAS,EAAE;IAKxB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI;IAKpC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,EAAE;IAK3C,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI;IAKpD,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKnC,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,SAAS;IAIhE,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.js";
|
|
2
2
|
import { WasmerExecutionError } from "../wasmer-sdk-loader/types.js";
|
|
3
|
+
import { getBasicTagData, getProperties, getProperty, setBasicTagData, setProperties, setProperty } from "./property-surface.js";
|
|
4
|
+
import { getMP4FreeformItems, getMP4Item, getMp4ItemRemovals, mirrorFreeformPropertyWrite, removeMP4Item, setMP4FreeformItems, setMP4Item, setMp4ItemRemovals } from "./mp4-items.js";
|
|
3
5
|
import { createHandleState, destroy, getBuffer, isValid, loadBuffer, loadPath, save } from "./handle-state.js";
|
|
4
6
|
import { getAudioProperties, getFormat, isMP4 } from "./audio-properties.js";
|
|
5
|
-
import { getBasicTagData, getProperties, getProperty, setBasicTagData, setProperties, setProperty } from "./property-surface.js";
|
|
6
|
-
import { getMP4Item, getMp4ItemRemovals, removeMP4Item, setMP4Item, setMp4ItemRemovals } from "./mp4-items.js";
|
|
7
7
|
import { addPicture, getBextData, getChapters, getId3v2Frames, getIxml, getLyrics, getPictures, getRatings, getStagedId3v2Frames, hasId3Tags, removeId3v2Frames, removePictures, setBextData, setChapters, setId3v2Frames, setIxml, setLyrics, setPictures, setRatings, stripId3Tags } from "./structured-fields.js";
|
|
8
8
|
//#region src/runtime/wasi-adapter/file-handle.ts
|
|
9
9
|
var WasiFileHandle = class {
|
|
@@ -63,7 +63,9 @@ var WasiFileHandle = class {
|
|
|
63
63
|
}
|
|
64
64
|
setProperties(properties) {
|
|
65
65
|
this.checkNotDestroyed();
|
|
66
|
-
|
|
66
|
+
let next = setProperties(this.state.tagData, properties);
|
|
67
|
+
if (isMP4(this.state.tagData, this.state.fileData)) for (const [key, values] of Object.entries(properties)) next = mirrorFreeformPropertyWrite(next, key, values);
|
|
68
|
+
this.state.tagData = next;
|
|
67
69
|
}
|
|
68
70
|
getProperty(key) {
|
|
69
71
|
this.checkNotDestroyed();
|
|
@@ -71,7 +73,9 @@ var WasiFileHandle = class {
|
|
|
71
73
|
}
|
|
72
74
|
setProperty(key, value) {
|
|
73
75
|
this.checkNotDestroyed();
|
|
74
|
-
|
|
76
|
+
let next = setProperty(this.state.tagData, key, value);
|
|
77
|
+
if (isMP4(this.state.tagData, this.state.fileData)) next = mirrorFreeformPropertyWrite(next, key, value === "" ? [] : [value]);
|
|
78
|
+
this.state.tagData = next;
|
|
75
79
|
}
|
|
76
80
|
getMP4Item(key) {
|
|
77
81
|
this.checkNotDestroyed();
|
|
@@ -93,6 +97,14 @@ var WasiFileHandle = class {
|
|
|
93
97
|
this.checkNotDestroyed();
|
|
94
98
|
this.state.tagData = removeMP4Item(this.state.tagData, key);
|
|
95
99
|
}
|
|
100
|
+
getMP4FreeformItems() {
|
|
101
|
+
this.checkNotDestroyed();
|
|
102
|
+
return getMP4FreeformItems(this.state.tagData);
|
|
103
|
+
}
|
|
104
|
+
setMP4FreeformItems(items) {
|
|
105
|
+
this.checkNotDestroyed();
|
|
106
|
+
this.state.tagData = setMP4FreeformItems(this.state.tagData, items);
|
|
107
|
+
}
|
|
96
108
|
getPictures() {
|
|
97
109
|
this.checkNotDestroyed();
|
|
98
110
|
return getPictures(this.state.tagData);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-state.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/handle-state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"handle-state.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/handle-state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAMhE,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACzC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,CAE/D;AAED,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAKvE;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAK/D;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAKnD;AAED;iEACiE;AACjE,wBAAgB,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAyBhD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,CAExD;AAED,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAGhD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { decodeTagData } from "../../msgpack/decoder.js";
|
|
2
2
|
import { preserveEmptyValues } from "./tag-keys.js";
|
|
3
|
+
import { clearMP4FreeformDirty } from "./mp4-items.js";
|
|
3
4
|
import { readTagsFromWasm, readTagsFromWasmPath, writeTagsToWasm, writeTagsToWasmPath } from "./wasm-io.js";
|
|
4
5
|
//#region src/runtime/wasi-adapter/handle-state.ts
|
|
5
6
|
function createHandleState(wasi) {
|
|
@@ -27,11 +28,16 @@ function isValid(state) {
|
|
|
27
28
|
* the new bytes (stored back into state.fileData on success). */
|
|
28
29
|
function save(state) {
|
|
29
30
|
if (!state.tagData) return false;
|
|
30
|
-
if (state.filePath)
|
|
31
|
+
if (state.filePath) {
|
|
32
|
+
const ok = writeTagsToWasmPath(state.wasi, state.filePath, state.tagData);
|
|
33
|
+
if (ok) state.tagData = clearMP4FreeformDirty(state.tagData);
|
|
34
|
+
return ok;
|
|
35
|
+
}
|
|
31
36
|
if (!state.fileData) return false;
|
|
32
37
|
const result = writeTagsToWasm(state.wasi, state.fileData, state.tagData);
|
|
33
38
|
if (result) {
|
|
34
39
|
state.fileData = result;
|
|
40
|
+
state.tagData = clearMP4FreeformDirty(state.tagData);
|
|
35
41
|
return true;
|
|
36
42
|
}
|
|
37
43
|
return false;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { WasiToTagLibAdapter };
|
|
1
|
+
export { WasiToTagLibAdapter } from "./adapter.js";
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Pure functions over tagData: the WasiFileHandle wrappers add destruction
|
|
5
5
|
* guards. Extracted from file-handle.ts in the taglib-1dfc split.
|
|
6
6
|
*/
|
|
7
|
+
import type { RawMP4FreeformItem } from "../../types/tags.js";
|
|
7
8
|
/**
|
|
8
9
|
* Normalize an MP4 item key for the PropertyMap path. TagLib's MP4 PropertyMap
|
|
9
10
|
* keys a freeform `----:mean:NAME` atom by its bare NAME, uppercased (the usual
|
|
@@ -29,6 +30,29 @@ export declare function registerMp4ItemRemoval(tagData: Record<string, unknown>
|
|
|
29
30
|
export declare function getMp4ItemRemovals(tagData: Record<string, unknown> | null): string[] | undefined;
|
|
30
31
|
/** Replace the pending foreign-atom removal list. */
|
|
31
32
|
export declare function setMp4ItemRemovals(tagData: Record<string, unknown> | null, removals: string[]): Record<string, unknown>;
|
|
33
|
+
/** Typed MP4 freeform entries carried by the snapshot (taglib-gja). */
|
|
34
|
+
export declare function getMP4FreeformItems(tagData: Record<string, unknown> | null): RawMP4FreeformItem[];
|
|
35
|
+
/**
|
|
36
|
+
* The exact MP4 freeform atom a property write lands in, or `undefined` for a
|
|
37
|
+
* standard item. TagLib writes a property with no MP4 mapping as
|
|
38
|
+
* `----:com.apple.iTunes:<wireKey>`; one with a standard mapping ("©nam",
|
|
39
|
+
* "trkn", ...) is not a freeform atom at all.
|
|
40
|
+
*/
|
|
41
|
+
export declare function freeformAtomForProperty(wireKey: string): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Keep the typed channel in step with a freeform-backed property write.
|
|
44
|
+
*
|
|
45
|
+
* The two views must agree: `setMP4FreeformItems` replaces every freeform
|
|
46
|
+
* atom, so a slot written through the property surface has to be visible to
|
|
47
|
+
* it; and after a binary atom is overwritten by a property write,
|
|
48
|
+
* `getMP4FreeformItems` must not keep serving the binary value. No dirty flag
|
|
49
|
+
* is set here — the property surface owns the value, this only mirrors it.
|
|
50
|
+
*/
|
|
51
|
+
export declare function mirrorFreeformPropertyWrite(tagData: Record<string, unknown> | null, wireKey: string, values: readonly string[]): Record<string, unknown>;
|
|
52
|
+
/** Stage a full replacement of the typed freeform channel. */
|
|
53
|
+
export declare function setMP4FreeformItems(tagData: Record<string, unknown> | null, items: readonly RawMP4FreeformItem[]): Record<string, unknown>;
|
|
54
|
+
/** Clear the write directive after a successful save (idempotent). */
|
|
55
|
+
export declare function clearMP4FreeformDirty(tagData: Record<string, unknown> | null): Record<string, unknown>;
|
|
32
56
|
/** Remove an MP4 item; returns the next snapshot record (null on no-op). */
|
|
33
57
|
export declare function removeMP4Item(tagData: Record<string, unknown> | null, key: string): Record<string, unknown> | null;
|
|
34
58
|
//# sourceMappingURL=mp4-items.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mp4-items.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/mp4-items.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"mp4-items.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/mp4-items.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9D;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAStD;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,GAAG,EAAE,MAAM,GACV,MAAM,CAiBR;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA6CzB;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,IAAI,EAAE,MAAM,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzB;AAED;;;;GAIG;AACH,wB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AM,EAAE,OAAO,CAAC,CAiBzB;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,GAAG,EAAE,MAAM,GACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAiChC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromTagLibKey, mp4AtomWireKey } from "../../constants/properties.js";
|
|
1
|
+
import { PROPERTIES, fromTagLibKey, mp4AtomWireKey } from "../../constants/properties.js";
|
|
2
2
|
import { mirrorForRawKey, stringifyScalar } from "../../utils/mirror-fields.js";
|
|
3
3
|
import { getProperty, setProperty } from "./property-surface.js";
|
|
4
4
|
//#region src/runtime/wasi-adapter/mp4-items.ts
|
|
@@ -43,6 +43,22 @@ function setMP4Item(tagData, key, value) {
|
|
|
43
43
|
...next,
|
|
44
44
|
[key]: value
|
|
45
45
|
};
|
|
46
|
+
const sep = key.indexOf(":", 5);
|
|
47
|
+
const freeform = next._mp4Freeform ?? [];
|
|
48
|
+
if (sep !== -1) {
|
|
49
|
+
const mean = key.slice(5, sep);
|
|
50
|
+
const name = key.slice(sep + 1);
|
|
51
|
+
const kept = freeform.filter((entry) => entry.mean !== mean || entry.name !== name);
|
|
52
|
+
next = {
|
|
53
|
+
...next,
|
|
54
|
+
_mp4Freeform: value === "" ? kept : [...kept, {
|
|
55
|
+
mean,
|
|
56
|
+
name,
|
|
57
|
+
type: 1,
|
|
58
|
+
value: new TextEncoder().encode(value)
|
|
59
|
+
}]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
63
|
return next;
|
|
48
64
|
}
|
|
@@ -79,12 +95,113 @@ function setMp4ItemRemovals(tagData, removals) {
|
|
|
79
95
|
_mp4ItemRemovals: [...new Set(removals)]
|
|
80
96
|
};
|
|
81
97
|
}
|
|
98
|
+
/** Typed MP4 freeform entries carried by the snapshot (taglib-gja). */
|
|
99
|
+
function getMP4FreeformItems(tagData) {
|
|
100
|
+
const raw = tagData?._mp4Freeform;
|
|
101
|
+
return Array.isArray(raw) ? raw : [];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The exact MP4 freeform atom a property write lands in, or `undefined` for a
|
|
105
|
+
* standard item. TagLib writes a property with no MP4 mapping as
|
|
106
|
+
* `----:com.apple.iTunes:<wireKey>`; one with a standard mapping ("©nam",
|
|
107
|
+
* "trkn", ...) is not a freeform atom at all.
|
|
108
|
+
*/
|
|
109
|
+
function freeformAtomForProperty(wireKey) {
|
|
110
|
+
if (wireKey.startsWith("_") || wireKey.startsWith("----:")) return void 0;
|
|
111
|
+
const table = PROPERTIES;
|
|
112
|
+
const atom = (table[fromTagLibKey(wireKey)] ?? table[wireKey])?.mappings?.mp4;
|
|
113
|
+
if (typeof atom === "string") return atom.startsWith("----:") ? atom : void 0;
|
|
114
|
+
return `----:com.apple.iTunes:${wireKey}`;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Keep the typed channel in step with a freeform-backed property write.
|
|
118
|
+
*
|
|
119
|
+
* The two views must agree: `setMP4FreeformItems` replaces every freeform
|
|
120
|
+
* atom, so a slot written through the property surface has to be visible to
|
|
121
|
+
* it; and after a binary atom is overwritten by a property write,
|
|
122
|
+
* `getMP4FreeformItems` must not keep serving the binary value. No dirty flag
|
|
123
|
+
* is set here — the property surface owns the value, this only mirrors it.
|
|
124
|
+
*/
|
|
125
|
+
function mirrorFreeformPropertyWrite(tagData, wireKey, values) {
|
|
126
|
+
const base = tagData ?? {};
|
|
127
|
+
const atom = freeformAtomForProperty(wireKey);
|
|
128
|
+
if (atom === void 0) return base;
|
|
129
|
+
const sep = atom.lastIndexOf(":");
|
|
130
|
+
const mean = atom.slice(5, sep);
|
|
131
|
+
const name = atom.slice(sep + 1);
|
|
132
|
+
const kept = getMP4FreeformItems(base).filter((entry) => entry.mean !== mean || entry.name !== name);
|
|
133
|
+
const added = values.filter((value) => value !== "").map((value) => ({
|
|
134
|
+
mean,
|
|
135
|
+
name,
|
|
136
|
+
type: 1,
|
|
137
|
+
value: new TextEncoder().encode(value)
|
|
138
|
+
}));
|
|
139
|
+
return {
|
|
140
|
+
...base,
|
|
141
|
+
_mp4Freeform: [...kept, ...added]
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Keep the property slots a typed list owns in sync with it. Without this a
|
|
146
|
+
* typed write only wins on the save that applies the directive; the stale
|
|
147
|
+
* property slot is what the next save ships (taglib-gja review).
|
|
148
|
+
*/
|
|
149
|
+
function syncFreeformPropertySlots(tagData, oldItems, newItems) {
|
|
150
|
+
const next = { ...tagData };
|
|
151
|
+
const clearSlot = (item) => {
|
|
152
|
+
if (item.mean !== "com.apple.iTunes") return;
|
|
153
|
+
const upper = item.name.toUpperCase();
|
|
154
|
+
delete next[upper];
|
|
155
|
+
delete next[fromTagLibKey(upper)];
|
|
156
|
+
};
|
|
157
|
+
for (const item of oldItems) clearSlot(item);
|
|
158
|
+
for (const item of newItems) clearSlot(item);
|
|
159
|
+
const utf8Slots = /* @__PURE__ */ new Map();
|
|
160
|
+
for (const item of newItems) if (item.type === 1 && item.mean === "com.apple.iTunes") {
|
|
161
|
+
const key = fromTagLibKey(item.name.toUpperCase());
|
|
162
|
+
const values = utf8Slots.get(key) ?? [];
|
|
163
|
+
values.push(new TextDecoder().decode(item.value));
|
|
164
|
+
utf8Slots.set(key, values);
|
|
165
|
+
}
|
|
166
|
+
for (const [key, values] of utf8Slots) next[key] = values;
|
|
167
|
+
return next;
|
|
168
|
+
}
|
|
169
|
+
/** Stage a full replacement of the typed freeform channel. */
|
|
170
|
+
function setMP4FreeformItems(tagData, items) {
|
|
171
|
+
return {
|
|
172
|
+
...syncFreeformPropertySlots(tagData, getMP4FreeformItems(tagData), items),
|
|
173
|
+
_mp4Freeform: items,
|
|
174
|
+
_mp4FreeformDirty: true
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/** Clear the write directive after a successful save (idempotent). */
|
|
178
|
+
function clearMP4FreeformDirty(tagData) {
|
|
179
|
+
if (tagData?._mp4FreeformDirty === void 0) return tagData ?? {};
|
|
180
|
+
const items = tagData._mp4Freeform;
|
|
181
|
+
if (Array.isArray(items) && items.some((item) => item.type !== 1)) return tagData;
|
|
182
|
+
const next = { ...tagData };
|
|
183
|
+
delete next._mp4FreeformDirty;
|
|
184
|
+
return next;
|
|
185
|
+
}
|
|
82
186
|
/** Remove an MP4 item; returns the next snapshot record (null on no-op). */
|
|
83
187
|
function removeMP4Item(tagData, key) {
|
|
84
188
|
if (!tagData) return null;
|
|
85
189
|
let next = tagData;
|
|
86
190
|
if (key.startsWith("----:")) {
|
|
87
191
|
delete next[key];
|
|
192
|
+
const sep = key.indexOf(":", 5);
|
|
193
|
+
if (sep !== -1) {
|
|
194
|
+
const mean = key.slice(5, sep);
|
|
195
|
+
const name = key.slice(sep + 1);
|
|
196
|
+
const freeform = next._mp4Freeform;
|
|
197
|
+
if (freeform !== void 0) {
|
|
198
|
+
const kept = freeform.filter((entry) => entry.mean !== mean || entry.name !== name);
|
|
199
|
+
if (kept.length !== freeform.length) next = {
|
|
200
|
+
...next,
|
|
201
|
+
_mp4Freeform: kept
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
88
205
|
next = registerMp4ItemRemoval(next, key);
|
|
89
206
|
}
|
|
90
207
|
const mappedKey = fromTagLibKey(mp4ItemPropertyKey(key));
|
|
@@ -94,4 +211,4 @@ function removeMP4Item(tagData, key) {
|
|
|
94
211
|
return next;
|
|
95
212
|
}
|
|
96
213
|
//#endregion
|
|
97
|
-
export { getMP4Item, getMp4ItemRemovals, mp4ItemPropertyKey, registerMp4ItemName, registerMp4ItemRemoval, removeMP4Item, setMP4Item, setMp4ItemRemovals };
|
|
214
|
+
export { clearMP4FreeformDirty, freeformAtomForProperty, getMP4FreeformItems, getMP4Item, getMp4ItemRemovals, mirrorFreeformPropertyWrite, mp4ItemPropertyKey, registerMp4ItemName, registerMp4ItemRemoval, removeMP4Item, setMP4FreeformItems, setMP4Item, setMp4ItemRemovals };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-surface.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/property-surface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAexD,2EAA2E;AAC3E,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GACtC,YAAY,CAWd;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;
|
|
1
|
+
{"version":3,"file":"property-surface.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/property-surface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAexD,2EAA2E;AAC3E,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GACtC,YAAY,CAWd;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AA0BD,yEAAyE;AACzE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAyB1B;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgCzB;AAED,oDAAoD;AACpD,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,GAAG,EAAE,MAAM,GACV,MAAM,CAQR;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAazB"}
|
|
@@ -30,6 +30,18 @@ function setBasicTagData(tagData, data) {
|
|
|
30
30
|
if (data.track !== void 0) stageNumericWrite(merged, TRACK_MIRROR, data.track);
|
|
31
31
|
return merged;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Convert a snapshot value to property strings. Undefined means the value is
|
|
35
|
+
* not representable: objects (including arrays of none) and empty arrays are
|
|
36
|
+
* absent. An empty array is the cleared-state marker (itunesAdvisory's rtng
|
|
37
|
+
* removal signal, taglib-an30); the surface shows cleared fields as absent,
|
|
38
|
+
* matching Emscripten.
|
|
39
|
+
*/
|
|
40
|
+
function propertyValues(value) {
|
|
41
|
+
if (Array.isArray(value)) return value.length === 0 ? void 0 : value.map(String);
|
|
42
|
+
if (typeof value === "object") return void 0;
|
|
43
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint" || typeof value === "symbol") return [String(value)];
|
|
44
|
+
}
|
|
33
45
|
/** The property map over the snapshot, excluding audio/internal keys. */
|
|
34
46
|
function getProperties(tagData) {
|
|
35
47
|
const result = {};
|
|
@@ -40,12 +52,9 @@ function getProperties(tagData) {
|
|
|
40
52
|
if (isShadowedNumericMirror(data, key)) continue;
|
|
41
53
|
if (value === void 0 || value === null) continue;
|
|
42
54
|
if (value === 0 || value === "") continue;
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
result[propKey] = value.map(String);
|
|
47
|
-
} else if (typeof value === "object") continue;
|
|
48
|
-
else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint" || typeof value === "symbol") result[propKey] = [String(value)];
|
|
55
|
+
const values = propertyValues(value);
|
|
56
|
+
if (values === void 0) continue;
|
|
57
|
+
result[toTagLibKey(key)] = values;
|
|
49
58
|
}
|
|
50
59
|
return result;
|
|
51
60
|
}
|
|
@@ -111,7 +111,7 @@ function getStagedId3v2Frames(tagData) {
|
|
|
111
111
|
return tagData?.id3v2Frames;
|
|
112
112
|
}
|
|
113
113
|
function setId3v2Frames(tagData, id, data) {
|
|
114
|
-
const staged = { ...getStagedId3v2Frames(tagData)
|
|
114
|
+
const staged = { ...getStagedId3v2Frames(tagData) };
|
|
115
115
|
staged[id] = data.map((d) => new Uint8Array(d));
|
|
116
116
|
return {
|
|
117
117
|
...tagData,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-keys.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/tag-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sEAAsE;AACtE,eAAO,MAAM,UAAU,aAiBrB,CAAC;AAEH,qEAAqE;AACrE,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"tag-keys.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/tag-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sEAAsE;AACtE,eAAO,MAAM,UAAU,aAiBrB,CAAC;AAEH,qEAAqE;AACrE,eAAO,MAAM,aAAa,aAiBxB,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB"}
|