taglib-wasm 2.3.0 → 2.4.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 +2 -2
- package/README.md +72 -64
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/assertClassBrand.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/checkPrivateRedeclaration.js +6 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldGet2.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldInitSpec.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/classPrivateFieldSet2.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js +12 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/toPrimitive.js +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/toPropertyKey.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/typeof.js +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/usingCtx.js +57 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/bwf/bext.d.ts.map +1 -0
- package/dist/bwf/bext.js +119 -0
- package/dist/{src/constants → constants}/additional-properties.d.ts.map +1 -1
- package/dist/constants/additional-properties.js +270 -0
- package/dist/constants/basic-properties.d.ts.map +1 -0
- package/dist/constants/basic-properties.js +128 -0
- package/dist/constants/complex-properties.d.ts.map +1 -0
- package/dist/constants/complex-properties.js +1 -0
- package/dist/constants/format-mappings.d.ts.map +1 -0
- package/dist/constants/format-mappings.js +58 -0
- package/dist/{src/constants → constants}/general-extended-properties.d.ts.map +1 -1
- package/dist/constants/general-extended-properties.js +272 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/properties.d.ts +43 -0
- package/dist/constants/properties.d.ts.map +1 -0
- package/dist/constants/properties.js +105 -0
- package/dist/constants/property-types.d.ts.map +1 -0
- package/dist/constants/property-types.js +1 -0
- package/dist/{src/constants → constants}/specialized-properties.d.ts.map +1 -1
- package/dist/constants/specialized-properties.js +335 -0
- package/dist/{src/constants → constants}/utilities.d.ts +1 -1
- package/dist/constants/utilities.d.ts.map +1 -0
- package/dist/constants/utilities.js +50 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +5 -0
- package/dist/{src/deno-compile.d.ts → deno-compile.d.ts} +8 -2
- package/dist/deno-compile.d.ts.map +1 -0
- package/dist/deno-compile.js +113 -0
- package/dist/disc-folder.d.ts +4 -4
- package/dist/disc-folder.d.ts.map +1 -1
- package/dist/disc-folder.js +596 -544
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +66 -0
- package/dist/errors/classes.d.ts.map +1 -0
- package/dist/errors/classes.js +164 -0
- package/dist/errors/guards.d.ts.map +1 -0
- package/dist/errors/guards.js +26 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +5 -0
- package/dist/file-utils/copy-and-find.d.ts.map +1 -0
- package/dist/file-utils/copy-and-find.js +107 -0
- package/dist/file-utils/export-operations.d.ts.map +1 -0
- package/dist/file-utils/export-operations.js +84 -0
- package/dist/file-utils/import-operations.d.ts.map +1 -0
- package/dist/file-utils/import-operations.js +109 -0
- package/dist/file-utils/index.d.ts.map +1 -0
- package/dist/file-utils/index.js +5 -0
- package/dist/file-utils/mime-detection.d.ts.map +1 -0
- package/dist/file-utils/mime-detection.js +44 -0
- package/dist/folder-api/album-corroborate.d.ts.map +1 -0
- package/dist/folder-api/album-corroborate.js +35 -0
- package/dist/folder-api/album-discs.d.ts.map +1 -0
- package/dist/folder-api/album-discs.js +119 -0
- package/dist/folder-api/album-grouping.d.ts.map +1 -0
- package/dist/folder-api/album-grouping.js +161 -0
- package/dist/folder-api/album-identity.d.ts.map +1 -0
- package/dist/folder-api/album-identity.js +165 -0
- package/dist/folder-api/album-types.d.ts.map +1 -0
- package/dist/folder-api/album-types.js +1 -0
- package/dist/folder-api/directory-walker.d.ts.map +1 -0
- package/dist/folder-api/directory-walker.js +27 -0
- package/dist/folder-api/file-processors.d.ts.map +1 -0
- package/dist/folder-api/file-processors.js +52 -0
- package/dist/folder-api/folder-disc.d.ts.map +1 -0
- package/dist/folder-api/folder-disc.js +166 -0
- package/dist/folder-api/folder-operations.d.ts.map +1 -0
- package/dist/folder-api/folder-operations.js +69 -0
- package/dist/folder-api/index.d.ts.map +1 -0
- package/dist/{src/folder-api → folder-api}/index.js +1 -8
- package/dist/folder-api/scan-for-albums.d.ts.map +1 -0
- package/dist/folder-api/scan-for-albums.js +25 -0
- package/dist/folder-api/scan-operations.d.ts.map +1 -0
- package/dist/folder-api/scan-operations.js +79 -0
- package/dist/folder-api/types.d.ts.map +1 -0
- package/dist/folder-api/types.js +21 -0
- package/dist/folder.d.ts +1 -1
- package/dist/folder.d.ts.map +1 -1
- package/dist/folder.js +7 -2
- package/dist/global.d.js +1 -0
- package/dist/index.browser.d.ts +29 -30
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +4106 -4479
- package/dist/index.d.ts +26 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -185
- package/dist/msgpack/decoder.d.ts.map +1 -0
- package/dist/msgpack/decoder.js +177 -0
- package/dist/msgpack/encoder.d.ts.map +1 -0
- package/dist/msgpack/encoder.js +211 -0
- package/dist/msgpack/index.d.ts.map +1 -0
- package/dist/msgpack/index.js +5 -0
- package/dist/{src/msgpack → msgpack}/types.d.ts +1 -1
- package/dist/msgpack/types.d.ts.map +1 -0
- package/dist/msgpack/types.js +13 -0
- package/dist/msgpack/utils.d.ts.map +1 -0
- package/dist/msgpack/utils.js +116 -0
- package/dist/rating.d.ts +1 -1
- package/dist/rating.d.ts.map +1 -1
- package/dist/rating.js +2 -2
- package/dist/runtime/deno-detect.d.ts +19 -0
- package/dist/runtime/deno-detect.d.ts.map +1 -0
- package/dist/runtime/deno-detect.js +26 -0
- package/dist/{src/runtime → runtime}/detector.d.ts +2 -0
- package/dist/runtime/detector.d.ts.map +1 -0
- package/dist/runtime/detector.js +173 -0
- package/dist/runtime/loader-types.d.ts.map +1 -0
- package/dist/runtime/loader-types.js +23 -0
- package/dist/runtime/module-loader-browser.d.ts.map +1 -0
- package/dist/runtime/module-loader-browser.js +33 -0
- package/dist/runtime/module-loader.d.ts.map +1 -0
- package/dist/runtime/module-loader.js +119 -0
- package/dist/runtime/platform-io.d.ts.map +1 -0
- package/dist/runtime/platform-io.js +168 -0
- package/dist/runtime/unified-loader/index.d.ts.map +1 -0
- package/dist/{src/runtime → runtime}/unified-loader/index.js +1 -7
- package/dist/runtime/unified-loader/loader.d.ts.map +1 -0
- package/dist/runtime/unified-loader/loader.js +64 -0
- package/dist/runtime/unified-loader/module-loading.d.ts.map +1 -0
- package/dist/runtime/unified-loader/module-loading.js +90 -0
- package/dist/runtime/unified-loader/module-selection.d.ts.map +1 -0
- package/dist/runtime/unified-loader/module-selection.js +25 -0
- package/dist/runtime/unified-loader/types.d.ts.map +1 -0
- package/dist/runtime/unified-loader/types.js +24 -0
- package/dist/runtime/wasi-adapter/adapter.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/adapter.js +114 -0
- package/dist/runtime/wasi-adapter/audio-properties.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/audio-properties.js +120 -0
- package/dist/runtime/wasi-adapter/file-handle.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/file-handle.js +181 -0
- package/dist/runtime/wasi-adapter/handle-state.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/handle-state.js +48 -0
- package/dist/runtime/wasi-adapter/index.d.ts.map +1 -0
- package/dist/{src/runtime → runtime}/wasi-adapter/index.js +1 -3
- package/dist/runtime/wasi-adapter/mp4-items.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/mp4-items.js +97 -0
- package/dist/runtime/wasi-adapter/path-open.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/path-open.js +101 -0
- package/dist/runtime/wasi-adapter/property-surface.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/property-surface.js +96 -0
- package/dist/runtime/wasi-adapter/structured-fields.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/structured-fields.js +144 -0
- package/dist/runtime/wasi-adapter/tag-keys.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/tag-keys.js +65 -0
- package/dist/runtime/wasi-adapter/wasm-io.d.ts.map +1 -0
- package/dist/runtime/wasi-adapter/wasm-io.js +154 -0
- package/dist/runtime/wasi-fs-deno.d.ts.map +1 -0
- package/dist/runtime/wasi-fs-deno.js +25 -0
- package/dist/runtime/wasi-fs-node.d.ts.map +1 -0
- package/dist/runtime/wasi-fs-node.js +58 -0
- package/dist/runtime/wasi-fs-provider.d.ts.map +1 -0
- package/dist/runtime/wasi-fs-provider.js +1 -0
- package/dist/runtime/wasi-host-loader.d.ts.map +1 -0
- package/dist/runtime/wasi-host-loader.js +101 -0
- package/dist/runtime/wasi-host.d.ts.map +1 -0
- package/dist/runtime/wasi-host.js +199 -0
- package/dist/runtime/wasi-memory.d.ts.map +1 -0
- package/dist/runtime/wasi-memory.js +179 -0
- package/dist/runtime/wasmer-sdk-loader/types.d.ts.map +1 -0
- package/dist/runtime/wasmer-sdk-loader/types.js +15 -0
- package/dist/simple/batch-operations.d.ts.map +1 -0
- package/dist/simple/batch-operations.js +245 -0
- package/dist/simple/checksum-operations.d.ts.map +1 -0
- package/dist/simple/checksum-operations.js +28 -0
- package/dist/simple/config.d.ts.map +1 -0
- package/dist/simple/config.js +17 -0
- package/dist/simple/index.d.ts.map +1 -0
- package/dist/simple/index.js +8 -0
- package/dist/simple/picture-operations.d.ts.map +1 -0
- package/dist/simple/picture-operations.js +132 -0
- package/dist/simple/tag-operations.d.ts.map +1 -0
- package/dist/simple/tag-operations.js +125 -0
- package/dist/simple/with-audio-file.d.ts.map +1 -0
- package/dist/simple/with-audio-file.js +28 -0
- package/dist/simple.browser.d.ts +2 -2
- package/dist/simple.browser.d.ts.map +1 -1
- package/dist/simple.browser.js +3405 -3692
- package/dist/simple.d.ts +1 -1
- package/dist/simple.d.ts.map +1 -1
- package/dist/simple.js +8 -2
- package/dist/taglib/audio-file-base.d.ts.map +1 -0
- package/dist/taglib/audio-file-base.js +166 -0
- package/dist/taglib/audio-file-bwf.d.ts.map +1 -0
- package/dist/taglib/audio-file-bwf.js +33 -0
- package/dist/taglib/audio-file-checksum.d.ts.map +1 -0
- package/dist/taglib/audio-file-checksum.js +90 -0
- package/dist/taglib/audio-file-impl.d.ts.map +1 -0
- package/dist/taglib/audio-file-impl.js +234 -0
- package/dist/taglib/audio-file-interface.d.ts.map +1 -0
- package/dist/taglib/audio-file-interface.js +1 -0
- package/dist/taglib/auto-dispose.d.ts.map +1 -0
- package/dist/taglib/auto-dispose.js +34 -0
- package/dist/taglib/embind-adapter.d.ts.map +1 -0
- package/dist/taglib/embind-adapter.js +138 -0
- package/dist/taglib/extra-state-registry.d.ts.map +1 -0
- package/dist/taglib/extra-state-registry.js +72 -0
- package/dist/{src/taglib → taglib}/id3v2-frames.d.ts +0 -1
- package/dist/taglib/id3v2-frames.d.ts.map +1 -0
- package/dist/taglib/id3v2-frames.js +25 -0
- package/dist/taglib/index.d.ts.map +1 -0
- package/dist/taglib/index.js +7 -0
- package/dist/taglib/load-audio-data.d.ts.map +1 -0
- package/dist/taglib/load-audio-data.js +54 -0
- package/dist/taglib/media-ranges.d.ts.map +1 -0
- package/dist/taglib/media-ranges.js +309 -0
- package/dist/taglib/metadata-extent.d.ts.map +1 -0
- package/dist/taglib/metadata-extent.js +394 -0
- package/dist/taglib/mp4-item-names.d.ts.map +1 -0
- package/dist/taglib/mp4-item-names.js +14 -0
- package/dist/taglib/mutable-tag-impl.d.ts.map +1 -0
- package/dist/taglib/mutable-tag-impl.js +81 -0
- package/dist/taglib/mutable-tag.d.ts.map +1 -0
- package/dist/taglib/mutable-tag.js +1 -0
- package/dist/taglib/save-reconstruct.d.ts.map +1 -0
- package/dist/taglib/save-reconstruct.js +53 -0
- package/dist/taglib/taglib-class.d.ts.map +1 -0
- package/dist/taglib/taglib-class.js +146 -0
- package/dist/taglib-wasi.wasm +0 -0
- package/dist/taglib.d.ts.map +1 -0
- package/dist/taglib.js +7 -0
- package/dist/{src/types → types}/audio-formats.d.ts +5 -1
- package/dist/types/audio-formats.d.ts.map +1 -0
- package/dist/types/audio-formats.js +6 -0
- package/dist/types/bwf.d.ts.map +1 -0
- package/dist/types/bwf.js +1 -0
- package/dist/types/chapters.d.ts.map +1 -0
- package/dist/types/chapters.js +1 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +1 -0
- package/dist/types/format-property-keys.d.ts.map +1 -0
- package/dist/types/format-property-keys.js +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/metadata-mappings.d.ts.map +1 -0
- package/dist/types/metadata-mappings.js +323 -0
- package/dist/types/pictures.d.ts.map +1 -0
- package/dist/types/pictures.js +79 -0
- package/dist/types/tags.d.ts.map +1 -0
- package/dist/types/tags.js +1 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +43 -0
- package/dist/utils/mirror-fields.d.ts.map +1 -0
- package/dist/utils/mirror-fields.js +107 -0
- package/dist/utils/node-fs.d.ts.map +1 -0
- package/dist/utils/node-fs.js +36 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +52 -0
- package/dist/utils/rating.d.ts.map +1 -0
- package/dist/utils/rating.js +150 -0
- package/dist/utils/tag-mapping.d.ts.map +1 -0
- package/dist/utils/tag-mapping.js +207 -0
- package/dist/utils/write.d.ts.map +1 -0
- package/dist/utils/write.js +18 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +4 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +1 -0
- package/dist/web-utils/canvas.d.ts.map +1 -0
- package/dist/web-utils/canvas.js +97 -0
- package/dist/web-utils/data-url.d.ts.map +1 -0
- package/dist/web-utils/data-url.js +54 -0
- package/dist/web-utils/dom-integration.d.ts.map +1 -0
- package/dist/web-utils/dom-integration.js +105 -0
- package/dist/web-utils/index.d.ts.map +1 -0
- package/dist/web-utils/index.js +4 -0
- package/dist/web.browser.d.ts +5 -5
- package/dist/web.browser.d.ts.map +1 -1
- package/dist/web.browser.js +3169 -3411
- package/dist/web.d.ts +1 -1
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +5 -2
- package/package.json +136 -100
- package/dist/src/bwf/bext.d.ts.map +0 -1
- package/dist/src/bwf/bext.js +0 -126
- package/dist/src/constants/additional-properties.js +0 -204
- package/dist/src/constants/basic-properties.d.ts.map +0 -1
- package/dist/src/constants/basic-properties.js +0 -89
- package/dist/src/constants/complex-properties.d.ts.map +0 -1
- package/dist/src/constants/complex-properties.js +0 -0
- package/dist/src/constants/format-mappings.d.ts.map +0 -1
- package/dist/src/constants/format-mappings.js +0 -54
- package/dist/src/constants/general-extended-properties.js +0 -254
- package/dist/src/constants/index.d.ts.map +0 -1
- package/dist/src/constants/index.js +0 -4
- package/dist/src/constants/properties.d.ts +0 -877
- package/dist/src/constants/properties.d.ts.map +0 -1
- package/dist/src/constants/properties.js +0 -95
- package/dist/src/constants/property-types.d.ts.map +0 -1
- package/dist/src/constants/property-types.js +0 -0
- package/dist/src/constants/specialized-properties.js +0 -223
- package/dist/src/constants/utilities.d.ts.map +0 -1
- package/dist/src/constants/utilities.js +0 -33
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -1
- package/dist/src/deno-compile.d.ts.map +0 -1
- package/dist/src/deno-compile.js +0 -75
- package/dist/src/errors/base.d.ts.map +0 -1
- package/dist/src/errors/base.js +0 -49
- package/dist/src/errors/classes.d.ts.map +0 -1
- package/dist/src/errors/classes.js +0 -170
- package/dist/src/errors/guards.d.ts.map +0 -1
- package/dist/src/errors/guards.js +0 -39
- package/dist/src/errors/index.d.ts.map +0 -1
- package/dist/src/errors/index.js +0 -39
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js +0 -1
- package/dist/src/file-utils/copy-and-find.d.ts.map +0 -1
- package/dist/src/file-utils/copy-and-find.js +0 -89
- package/dist/src/file-utils/export-operations.d.ts.map +0 -1
- package/dist/src/file-utils/export-operations.js +0 -40
- package/dist/src/file-utils/import-operations.d.ts.map +0 -1
- package/dist/src/file-utils/import-operations.js +0 -42
- package/dist/src/file-utils/index.d.ts.map +0 -1
- package/dist/src/file-utils/index.js +0 -26
- package/dist/src/file-utils/mime-detection.d.ts.map +0 -1
- package/dist/src/file-utils/mime-detection.js +0 -45
- package/dist/src/folder-api/album-corroborate.d.ts.map +0 -1
- package/dist/src/folder-api/album-corroborate.js +0 -36
- package/dist/src/folder-api/album-discs.d.ts.map +0 -1
- package/dist/src/folder-api/album-discs.js +0 -122
- package/dist/src/folder-api/album-grouping.d.ts.map +0 -1
- package/dist/src/folder-api/album-grouping.js +0 -118
- package/dist/src/folder-api/album-identity.d.ts.map +0 -1
- package/dist/src/folder-api/album-identity.js +0 -151
- package/dist/src/folder-api/album-types.d.ts.map +0 -1
- package/dist/src/folder-api/album-types.js +0 -0
- package/dist/src/folder-api/directory-walker.d.ts.map +0 -1
- package/dist/src/folder-api/directory-walker.js +0 -35
- package/dist/src/folder-api/file-processors.d.ts.map +0 -1
- package/dist/src/folder-api/file-processors.js +0 -63
- package/dist/src/folder-api/folder-disc.d.ts.map +0 -1
- package/dist/src/folder-api/folder-disc.js +0 -169
- package/dist/src/folder-api/folder-operations.d.ts.map +0 -1
- package/dist/src/folder-api/folder-operations.js +0 -54
- package/dist/src/folder-api/index.d.ts.map +0 -1
- package/dist/src/folder-api/scan-for-albums.d.ts.map +0 -1
- package/dist/src/folder-api/scan-for-albums.js +0 -20
- package/dist/src/folder-api/scan-operations.d.ts.map +0 -1
- package/dist/src/folder-api/scan-operations.js +0 -77
- package/dist/src/folder-api/types.d.ts.map +0 -1
- package/dist/src/folder-api/types.js +0 -21
- package/dist/src/msgpack/decoder.d.ts.map +0 -1
- package/dist/src/msgpack/decoder.js +0 -215
- package/dist/src/msgpack/encoder.d.ts.map +0 -1
- package/dist/src/msgpack/encoder.js +0 -249
- package/dist/src/msgpack/index.d.ts.map +0 -1
- package/dist/src/msgpack/index.js +0 -56
- package/dist/src/msgpack/types.d.ts.map +0 -1
- package/dist/src/msgpack/types.js +0 -12
- package/dist/src/msgpack/utils.d.ts.map +0 -1
- package/dist/src/msgpack/utils.js +0 -134
- package/dist/src/runtime/deno-detect.d.ts +0 -8
- package/dist/src/runtime/deno-detect.d.ts.map +0 -1
- package/dist/src/runtime/deno-detect.js +0 -6
- package/dist/src/runtime/detector.d.ts.map +0 -1
- package/dist/src/runtime/detector.js +0 -181
- package/dist/src/runtime/loader-types.d.ts.map +0 -1
- package/dist/src/runtime/loader-types.js +0 -10
- package/dist/src/runtime/module-loader-browser.d.ts.map +0 -1
- package/dist/src/runtime/module-loader-browser.js +0 -37
- package/dist/src/runtime/module-loader.d.ts.map +0 -1
- package/dist/src/runtime/module-loader.js +0 -119
- package/dist/src/runtime/platform-io.d.ts.map +0 -1
- package/dist/src/runtime/platform-io.js +0 -188
- package/dist/src/runtime/unified-loader/index.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/loader.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/loader.js +0 -84
- package/dist/src/runtime/unified-loader/module-loading.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/module-loading.js +0 -122
- package/dist/src/runtime/unified-loader/module-selection.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/module-selection.js +0 -41
- package/dist/src/runtime/unified-loader/types.d.ts.map +0 -1
- package/dist/src/runtime/unified-loader/types.js +0 -25
- package/dist/src/runtime/wasi-adapter/adapter.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/adapter.js +0 -130
- package/dist/src/runtime/wasi-adapter/audio-properties.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/audio-properties.js +0 -102
- package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/file-handle.js +0 -197
- package/dist/src/runtime/wasi-adapter/handle-state.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/handle-state.js +0 -58
- package/dist/src/runtime/wasi-adapter/index.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/mp4-items.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/mp4-items.js +0 -80
- package/dist/src/runtime/wasi-adapter/path-open.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/path-open.js +0 -76
- package/dist/src/runtime/wasi-adapter/property-surface.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/property-surface.js +0 -104
- package/dist/src/runtime/wasi-adapter/structured-fields.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/structured-fields.js +0 -139
- package/dist/src/runtime/wasi-adapter/tag-keys.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/tag-keys.js +0 -46
- package/dist/src/runtime/wasi-adapter/wasm-io.d.ts.map +0 -1
- package/dist/src/runtime/wasi-adapter/wasm-io.js +0 -257
- package/dist/src/runtime/wasi-fs-deno.d.ts.map +0 -1
- package/dist/src/runtime/wasi-fs-deno.js +0 -26
- package/dist/src/runtime/wasi-fs-node.d.ts.map +0 -1
- package/dist/src/runtime/wasi-fs-node.js +0 -66
- package/dist/src/runtime/wasi-fs-provider.d.ts.map +0 -1
- package/dist/src/runtime/wasi-fs-provider.js +0 -0
- package/dist/src/runtime/wasi-host-loader.d.ts.map +0 -1
- package/dist/src/runtime/wasi-host-loader.js +0 -114
- package/dist/src/runtime/wasi-host.d.ts.map +0 -1
- package/dist/src/runtime/wasi-host.js +0 -202
- package/dist/src/runtime/wasi-memory.d.ts.map +0 -1
- package/dist/src/runtime/wasi-memory.js +0 -197
- package/dist/src/runtime/wasmer-sdk-loader/types.d.ts.map +0 -1
- package/dist/src/runtime/wasmer-sdk-loader/types.js +0 -12
- package/dist/src/simple/batch-operations.d.ts.map +0 -1
- package/dist/src/simple/batch-operations.js +0 -186
- package/dist/src/simple/checksum-operations.d.ts.map +0 -1
- package/dist/src/simple/checksum-operations.js +0 -7
- package/dist/src/simple/config.d.ts.map +0 -1
- package/dist/src/simple/config.js +0 -18
- package/dist/src/simple/index.d.ts.map +0 -1
- package/dist/src/simple/index.js +0 -60
- package/dist/src/simple/picture-operations.d.ts.map +0 -1
- package/dist/src/simple/picture-operations.js +0 -68
- package/dist/src/simple/tag-operations.d.ts.map +0 -1
- package/dist/src/simple/tag-operations.js +0 -90
- package/dist/src/simple/with-audio-file.d.ts.map +0 -1
- package/dist/src/simple/with-audio-file.js +0 -39
- package/dist/src/taglib/audio-file-base.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-base.js +0 -187
- package/dist/src/taglib/audio-file-bwf.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-bwf.js +0 -41
- package/dist/src/taglib/audio-file-checksum.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-checksum.js +0 -77
- package/dist/src/taglib/audio-file-impl.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-impl.js +0 -317
- package/dist/src/taglib/audio-file-interface.d.ts.map +0 -1
- package/dist/src/taglib/audio-file-interface.js +0 -0
- package/dist/src/taglib/auto-dispose.d.ts.map +0 -1
- package/dist/src/taglib/auto-dispose.js +0 -13
- package/dist/src/taglib/embind-adapter.d.ts.map +0 -1
- package/dist/src/taglib/embind-adapter.js +0 -141
- package/dist/src/taglib/extra-state-registry.d.ts.map +0 -1
- package/dist/src/taglib/extra-state-registry.js +0 -78
- package/dist/src/taglib/id3v2-frames.d.ts.map +0 -1
- package/dist/src/taglib/id3v2-frames.js +0 -42
- package/dist/src/taglib/index.d.ts.map +0 -1
- package/dist/src/taglib/index.js +0 -41
- package/dist/src/taglib/load-audio-data.d.ts.map +0 -1
- package/dist/src/taglib/load-audio-data.js +0 -51
- package/dist/src/taglib/media-ranges.d.ts.map +0 -1
- package/dist/src/taglib/media-ranges.js +0 -192
- package/dist/src/taglib/metadata-extent.d.ts.map +0 -1
- package/dist/src/taglib/metadata-extent.js +0 -189
- package/dist/src/taglib/mp4-item-names.d.ts.map +0 -1
- package/dist/src/taglib/mp4-item-names.js +0 -4
- package/dist/src/taglib/mutable-tag-impl.d.ts.map +0 -1
- package/dist/src/taglib/mutable-tag-impl.js +0 -88
- package/dist/src/taglib/mutable-tag.d.ts.map +0 -1
- package/dist/src/taglib/mutable-tag.js +0 -0
- package/dist/src/taglib/save-reconstruct.d.ts.map +0 -1
- package/dist/src/taglib/save-reconstruct.js +0 -43
- package/dist/src/taglib/taglib-class.d.ts.map +0 -1
- package/dist/src/taglib/taglib-class.js +0 -195
- package/dist/src/taglib.d.ts.map +0 -1
- package/dist/src/taglib.js +0 -1
- package/dist/src/types/audio-formats.d.ts.map +0 -1
- package/dist/src/types/audio-formats.js +0 -6
- package/dist/src/types/bwf.d.ts.map +0 -1
- package/dist/src/types/bwf.js +0 -0
- package/dist/src/types/chapters.d.ts.map +0 -1
- package/dist/src/types/chapters.js +0 -0
- package/dist/src/types/config.d.ts.map +0 -1
- package/dist/src/types/config.js +0 -0
- package/dist/src/types/format-property-keys.d.ts.map +0 -1
- package/dist/src/types/format-property-keys.js +0 -0
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/index.js +0 -8
- package/dist/src/types/metadata-mappings.d.ts.map +0 -1
- package/dist/src/types/metadata-mappings.js +0 -252
- package/dist/src/types/pictures.d.ts.map +0 -1
- package/dist/src/types/pictures.js +0 -64
- package/dist/src/types/tags.d.ts.map +0 -1
- package/dist/src/types/tags.js +0 -0
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -1
- package/dist/src/utils/file.d.ts.map +0 -1
- package/dist/src/utils/file.js +0 -52
- package/dist/src/utils/mirror-fields.d.ts.map +0 -1
- package/dist/src/utils/mirror-fields.js +0 -75
- package/dist/src/utils/node-fs.d.ts.map +0 -1
- package/dist/src/utils/node-fs.js +0 -22
- package/dist/src/utils/path.d.ts.map +0 -1
- package/dist/src/utils/path.js +0 -36
- package/dist/src/utils/rating.d.ts.map +0 -1
- package/dist/src/utils/rating.js +0 -73
- package/dist/src/utils/tag-mapping.d.ts.map +0 -1
- package/dist/src/utils/tag-mapping.js +0 -214
- package/dist/src/utils/write.d.ts.map +0 -1
- package/dist/src/utils/write.js +0 -17
- package/dist/src/version.d.ts +0 -2
- package/dist/src/version.d.ts.map +0 -1
- package/dist/src/version.js +0 -4
- package/dist/src/wasm.d.ts.map +0 -1
- package/dist/src/wasm.js +0 -0
- package/dist/src/web-utils/canvas.d.ts.map +0 -1
- package/dist/src/web-utils/canvas.js +0 -60
- package/dist/src/web-utils/data-url.d.ts.map +0 -1
- package/dist/src/web-utils/data-url.js +0 -34
- package/dist/src/web-utils/dom-integration.d.ts.map +0 -1
- package/dist/src/web-utils/dom-integration.js +0 -53
- package/dist/src/web-utils/index.d.ts.map +0 -1
- package/dist/src/web-utils/index.js +0 -21
- /package/dist/{src/bwf → bwf}/bext.d.ts +0 -0
- /package/dist/{src/constants → constants}/additional-properties.d.ts +0 -0
- /package/dist/{src/constants → constants}/basic-properties.d.ts +0 -0
- /package/dist/{src/constants → constants}/complex-properties.d.ts +0 -0
- /package/dist/{src/constants → constants}/format-mappings.d.ts +0 -0
- /package/dist/{src/constants → constants}/general-extended-properties.d.ts +0 -0
- /package/dist/{src/constants → constants}/index.d.ts +0 -0
- /package/dist/{src/constants → constants}/property-types.d.ts +0 -0
- /package/dist/{src/constants → constants}/specialized-properties.d.ts +0 -0
- /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{src/errors → errors}/base.d.ts +0 -0
- /package/dist/{src/errors → errors}/classes.d.ts +0 -0
- /package/dist/{src/errors → errors}/guards.d.ts +0 -0
- /package/dist/{src/errors → errors}/index.d.ts +0 -0
- /package/dist/{src/errors.d.ts → errors.d.ts} +0 -0
- /package/dist/{src/file-utils → file-utils}/copy-and-find.d.ts +0 -0
- /package/dist/{src/file-utils → file-utils}/export-operations.d.ts +0 -0
- /package/dist/{src/file-utils → file-utils}/import-operations.d.ts +0 -0
- /package/dist/{src/file-utils → file-utils}/index.d.ts +0 -0
- /package/dist/{src/file-utils → file-utils}/mime-detection.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-corroborate.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-discs.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-grouping.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-identity.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/album-types.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/directory-walker.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/file-processors.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/folder-disc.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/folder-operations.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/index.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/scan-for-albums.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/scan-operations.d.ts +0 -0
- /package/dist/{src/folder-api → folder-api}/types.d.ts +0 -0
- /package/dist/{src/msgpack → msgpack}/decoder.d.ts +0 -0
- /package/dist/{src/msgpack → msgpack}/encoder.d.ts +0 -0
- /package/dist/{src/msgpack → msgpack}/index.d.ts +0 -0
- /package/dist/{src/msgpack → msgpack}/utils.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/loader-types.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/module-loader-browser.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/module-loader.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/platform-io.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/index.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/loader.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/module-loading.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/module-selection.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/unified-loader/types.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/adapter.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/audio-properties.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/file-handle.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/handle-state.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/index.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/mp4-items.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/path-open.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/property-surface.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/structured-fields.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/tag-keys.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-adapter/wasm-io.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-fs-deno.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-fs-node.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-fs-provider.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-host-loader.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-host.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasi-memory.d.ts +0 -0
- /package/dist/{src/runtime → runtime}/wasmer-sdk-loader/types.d.ts +0 -0
- /package/dist/{src/simple → simple}/batch-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/checksum-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/config.d.ts +0 -0
- /package/dist/{src/simple → simple}/index.d.ts +0 -0
- /package/dist/{src/simple → simple}/picture-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/tag-operations.d.ts +0 -0
- /package/dist/{src/simple → simple}/with-audio-file.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-base.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-bwf.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-checksum.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-impl.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/audio-file-interface.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/auto-dispose.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/embind-adapter.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/extra-state-registry.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/index.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/load-audio-data.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/media-ranges.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/metadata-extent.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/mp4-item-names.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/mutable-tag-impl.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/mutable-tag.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/save-reconstruct.d.ts +0 -0
- /package/dist/{src/taglib → taglib}/taglib-class.d.ts +0 -0
- /package/dist/{src/taglib.d.ts → taglib.d.ts} +0 -0
- /package/dist/{src/types → types}/bwf.d.ts +0 -0
- /package/dist/{src/types → types}/chapters.d.ts +0 -0
- /package/dist/{src/types → types}/config.d.ts +0 -0
- /package/dist/{src/types → types}/format-property-keys.d.ts +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
- /package/dist/{src/types → types}/metadata-mappings.d.ts +0 -0
- /package/dist/{src/types → types}/pictures.d.ts +0 -0
- /package/dist/{src/types → types}/tags.d.ts +0 -0
- /package/dist/{src/types.d.ts → types.d.ts} +0 -0
- /package/dist/{src/utils → utils}/file.d.ts +0 -0
- /package/dist/{src/utils → utils}/mirror-fields.d.ts +0 -0
- /package/dist/{src/utils → utils}/node-fs.d.ts +0 -0
- /package/dist/{src/utils → utils}/path.d.ts +0 -0
- /package/dist/{src/utils → utils}/rating.d.ts +0 -0
- /package/dist/{src/utils → utils}/tag-mapping.d.ts +0 -0
- /package/dist/{src/utils → utils}/write.d.ts +0 -0
- /package/dist/{src/wasm.d.ts → wasm.d.ts} +0 -0
- /package/dist/{src/web-utils → web-utils}/canvas.d.ts +0 -0
- /package/dist/{src/web-utils → web-utils}/data-url.d.ts +0 -0
- /package/dist/{src/web-utils → web-utils}/dom-integration.d.ts +0 -0
- /package/dist/{src/web-utils → web-utils}/index.d.ts +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { MemoryError } from "../../errors/classes.js";
|
|
2
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js";
|
|
3
|
+
import { WasmerExecutionError } from "../wasmer-sdk-loader/types.js";
|
|
4
|
+
import { WasiFileHandle } from "./file-handle.js";
|
|
5
|
+
import { openAudioPath } from "./path-open.js";
|
|
6
|
+
//#region src/runtime/wasi-adapter/adapter.ts
|
|
7
|
+
var WasiToTagLibAdapter = class {
|
|
8
|
+
constructor(wasiModule) {
|
|
9
|
+
_defineProperty(this, "wasi", void 0);
|
|
10
|
+
_defineProperty(this, "heap", void 0);
|
|
11
|
+
_defineProperty(this, "FileHandle", class {
|
|
12
|
+
constructor() {
|
|
13
|
+
throw new WasmerExecutionError("Use createFileHandle() instead of new FileHandle()");
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
this.wasi = wasiModule;
|
|
17
|
+
this.heap = new Uint8Array(wasiModule.memory.buffer);
|
|
18
|
+
}
|
|
19
|
+
get ready() {
|
|
20
|
+
return Promise.resolve(this);
|
|
21
|
+
}
|
|
22
|
+
get HEAP8() {
|
|
23
|
+
return new Int8Array(this.wasi.memory.buffer);
|
|
24
|
+
}
|
|
25
|
+
get HEAP16() {
|
|
26
|
+
return new Int16Array(this.wasi.memory.buffer);
|
|
27
|
+
}
|
|
28
|
+
get HEAPU8() {
|
|
29
|
+
return new Uint8Array(this.wasi.memory.buffer);
|
|
30
|
+
}
|
|
31
|
+
get HEAP32() {
|
|
32
|
+
return new Int32Array(this.wasi.memory.buffer);
|
|
33
|
+
}
|
|
34
|
+
get HEAPU16() {
|
|
35
|
+
return new Uint16Array(this.wasi.memory.buffer);
|
|
36
|
+
}
|
|
37
|
+
get HEAPU32() {
|
|
38
|
+
return new Uint32Array(this.wasi.memory.buffer);
|
|
39
|
+
}
|
|
40
|
+
get HEAPF32() {
|
|
41
|
+
return new Float32Array(this.wasi.memory.buffer);
|
|
42
|
+
}
|
|
43
|
+
get HEAPF64() {
|
|
44
|
+
return new Float64Array(this.wasi.memory.buffer);
|
|
45
|
+
}
|
|
46
|
+
_malloc(size) {
|
|
47
|
+
return this.wasi.malloc(size);
|
|
48
|
+
}
|
|
49
|
+
_free(ptr) {
|
|
50
|
+
this.wasi.free(ptr);
|
|
51
|
+
}
|
|
52
|
+
_realloc(ptr, newSize) {
|
|
53
|
+
const newPtr = this.wasi.malloc(newSize);
|
|
54
|
+
if (!newPtr) throw new MemoryError(`realloc failed. Requested size: ${newSize} bytes`);
|
|
55
|
+
if (ptr) {
|
|
56
|
+
const oldData = this.heap.slice(ptr, ptr + newSize);
|
|
57
|
+
this.heap.set(oldData, newPtr);
|
|
58
|
+
this.wasi.free(ptr);
|
|
59
|
+
}
|
|
60
|
+
return newPtr;
|
|
61
|
+
}
|
|
62
|
+
UTF8ToString(ptr) {
|
|
63
|
+
if (!ptr) return "";
|
|
64
|
+
let end = ptr;
|
|
65
|
+
while (this.heap[end] !== 0) end++;
|
|
66
|
+
return new TextDecoder().decode(this.heap.slice(ptr, end));
|
|
67
|
+
}
|
|
68
|
+
stringToUTF8(str, ptr, maxBytes) {
|
|
69
|
+
const bytes = new TextEncoder().encode(str);
|
|
70
|
+
const len = Math.min(bytes.length, maxBytes - 1);
|
|
71
|
+
this.heap.set(bytes.slice(0, len), ptr);
|
|
72
|
+
this.heap[ptr + len] = 0;
|
|
73
|
+
return len;
|
|
74
|
+
}
|
|
75
|
+
lengthBytesUTF8(str) {
|
|
76
|
+
return new TextEncoder().encode(str).length;
|
|
77
|
+
}
|
|
78
|
+
createFileHandle() {
|
|
79
|
+
return new WasiFileHandle(this.wasi);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The WASI host module this adapter wraps. Path mode's content gate
|
|
83
|
+
* (taglib-j9ld) needs the host's own detector and its WASI→host path
|
|
84
|
+
* resolution, neither of which belongs on the shared `TagLibModule` surface
|
|
85
|
+
* every backend implements.
|
|
86
|
+
*/
|
|
87
|
+
get hostModule() {
|
|
88
|
+
return this.wasi;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The gated path open: `WasiFileHandle.loadFromPath` plus the content check a
|
|
92
|
+
* path needs where a buffer would be refused outright (see `path-open.ts`).
|
|
93
|
+
*/
|
|
94
|
+
loadAudioPath(wasiPath, displayPath) {
|
|
95
|
+
return openAudioPath(this, wasiPath, displayPath);
|
|
96
|
+
}
|
|
97
|
+
version() {
|
|
98
|
+
return this.wasi.tl_version();
|
|
99
|
+
}
|
|
100
|
+
addFunction(_func) {
|
|
101
|
+
throw new WasmerExecutionError("addFunction not supported in WASI mode");
|
|
102
|
+
}
|
|
103
|
+
removeFunction(_ptr) {
|
|
104
|
+
throw new WasmerExecutionError("removeFunction not supported in WASI mode");
|
|
105
|
+
}
|
|
106
|
+
cwrap(_name, _returnType, _argTypes) {
|
|
107
|
+
throw new WasmerExecutionError("cwrap not supported in WASI mode - use direct exports");
|
|
108
|
+
}
|
|
109
|
+
ccall(_name, _returnType, _argTypes, _args) {
|
|
110
|
+
throw new WasmerExecutionError("ccall not supported in WASI mode - use direct exports");
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { WasiToTagLibAdapter };
|
|
@@ -0,0 +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;AA6CxB,wEAAwE;AACxE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GACtC,eAAe,GAAG,IAAI,CAkCxB;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"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
//#region src/runtime/wasi-adapter/audio-properties.ts
|
|
2
|
+
/**
|
|
3
|
+
* Container string (from the C++ snapshot) to declared `FileType`. Every
|
|
4
|
+
* `ContainerFormat` member has a key here except "unknown"; where the two
|
|
5
|
+
* unions differ in spelling, this table carries the translation — "Shorten"
|
|
6
|
+
* (container) is "SHN" (FileType). A container with no key falls through to
|
|
7
|
+
* the magic-byte sniff and then to "unknown", so a missing key silently
|
|
8
|
+
* degrades `getFormat()` on the WASI backend only (taglib-uat8).
|
|
9
|
+
*/
|
|
10
|
+
const CONTAINER_TO_FORMAT = {
|
|
11
|
+
MP3: "MP3",
|
|
12
|
+
ADTS: "AAC",
|
|
13
|
+
MP4: "MP4",
|
|
14
|
+
FLAC: "FLAC",
|
|
15
|
+
OGG: "OGG",
|
|
16
|
+
WAV: "WAV",
|
|
17
|
+
AIFF: "AIFF",
|
|
18
|
+
ASF: "ASF",
|
|
19
|
+
APE: "APE",
|
|
20
|
+
DSF: "DSF",
|
|
21
|
+
DSDIFF: "DSDIFF",
|
|
22
|
+
WavPack: "WV",
|
|
23
|
+
MPC: "MPC",
|
|
24
|
+
TTA: "TTA",
|
|
25
|
+
Shorten: "SHN",
|
|
26
|
+
MOD: "MOD",
|
|
27
|
+
S3M: "S3M",
|
|
28
|
+
IT: "IT",
|
|
29
|
+
XM: "XM",
|
|
30
|
+
Matroska: "MATROSKA"
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Formats inside the Ogg container. The container alone is not enough: three
|
|
34
|
+
* of the four codecs TagLib reads there are declared FileType members of their
|
|
35
|
+
* own ("OPUS", "OggFLAC", "SPEEX"), so Ogg Vorbis is the only flavour that
|
|
36
|
+
* stays "OGG" (taglib-f6a3). Keyed by the snapshot's codec value.
|
|
37
|
+
*/
|
|
38
|
+
const OGG_CODEC_TO_FORMAT = {
|
|
39
|
+
Opus: "OPUS",
|
|
40
|
+
FLAC: "OggFLAC",
|
|
41
|
+
Speex: "SPEEX"
|
|
42
|
+
};
|
|
43
|
+
/** The audio-properties block of the C++ snapshot, null when absent. */
|
|
44
|
+
function getAudioProperties(tagData) {
|
|
45
|
+
if (!tagData || !("sampleRate" in tagData)) return null;
|
|
46
|
+
const d = tagData;
|
|
47
|
+
const containerFormat = d.containerFormat || "unknown";
|
|
48
|
+
const mpegVersion = d.mpegVersion ?? 0;
|
|
49
|
+
const formatVersion = d.formatVersion ?? 0;
|
|
50
|
+
return {
|
|
51
|
+
duration: d.length ?? 0,
|
|
52
|
+
durationMs: d.lengthMs ?? 0,
|
|
53
|
+
bitrate: d.bitrate ?? 0,
|
|
54
|
+
sampleRate: d.sampleRate ?? 0,
|
|
55
|
+
channels: d.channels ?? 0,
|
|
56
|
+
bitsPerSample: d.bitsPerSample ?? 0,
|
|
57
|
+
codec: d.codec || "unknown",
|
|
58
|
+
containerFormat,
|
|
59
|
+
isLossless: d.isLossless ?? false,
|
|
60
|
+
...mpegVersion > 0 ? {
|
|
61
|
+
mpegVersion,
|
|
62
|
+
mpegLayer: d.mpegLayer ?? 0
|
|
63
|
+
} : {},
|
|
64
|
+
...d.isEncrypted === true ? { isEncrypted: true } : containerFormat === "MP4" || containerFormat === "ASF" ? { isEncrypted: false } : {},
|
|
65
|
+
...formatVersion > 0 ? { formatVersion } : {},
|
|
66
|
+
...d.outputGainDb !== void 0 ? { outputGainDb: d.outputGainDb } : {}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* OGG codec sniffing from the first page payload: "OpusHead" (Opus),
|
|
71
|
+
* 0x7F"FLAC" (FLAC-in-Ogg), "Speex " (Speex), else Ogg Vorbis ("OGG").
|
|
72
|
+
*/
|
|
73
|
+
function detectOggCodec(fileData) {
|
|
74
|
+
if (fileData.length < 37) return "OGG";
|
|
75
|
+
const segCount = fileData[26];
|
|
76
|
+
if (segCount === void 0) return "OGG";
|
|
77
|
+
const payloadStart = 27 + segCount;
|
|
78
|
+
if (fileData.length < payloadStart + 8) return "OGG";
|
|
79
|
+
const sig = fileData.slice(payloadStart, payloadStart + 8);
|
|
80
|
+
const text = String.fromCharCode(...sig);
|
|
81
|
+
if (text === "OpusHead") return "OPUS";
|
|
82
|
+
if (sig[0] === 127 && sig[1] === 70 && sig[2] === 76 && sig[3] === 65 && sig[4] === 67) return "OggFLAC";
|
|
83
|
+
if (text === "Speex ") return "SPEEX";
|
|
84
|
+
return "OGG";
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Format detection: container-based first (works for path and buffer modes),
|
|
88
|
+
* magic-byte fallback for buffers.
|
|
89
|
+
*/
|
|
90
|
+
function getFormat(tagData, fileData) {
|
|
91
|
+
const container = tagData?.containerFormat;
|
|
92
|
+
if (container) {
|
|
93
|
+
const codec = tagData?.codec;
|
|
94
|
+
if (container === "OGG" && codec && OGG_CODEC_TO_FORMAT[codec]) return OGG_CODEC_TO_FORMAT[codec];
|
|
95
|
+
if (CONTAINER_TO_FORMAT[container]) return CONTAINER_TO_FORMAT[container];
|
|
96
|
+
}
|
|
97
|
+
if (!fileData || fileData.length < 8) return "unknown";
|
|
98
|
+
const magic = fileData.slice(0, 4);
|
|
99
|
+
if (magic[0] === 255 && (magic[1] & 224) === 224) return "MP3";
|
|
100
|
+
if (magic[0] === 73 && magic[1] === 68 && magic[2] === 51) return "MP3";
|
|
101
|
+
if (magic[0] === 102 && magic[1] === 76 && magic[2] === 97 && magic[3] === 67) return "FLAC";
|
|
102
|
+
if (magic[0] === 79 && magic[1] === 103 && magic[2] === 103 && magic[3] === 83) return detectOggCodec(fileData);
|
|
103
|
+
if (magic[0] === 82 && magic[1] === 73 && magic[2] === 70 && magic[3] === 70) return "WAV";
|
|
104
|
+
if (magic[0] === 119 && magic[1] === 118 && magic[2] === 112 && magic[3] === 107) return "WV";
|
|
105
|
+
if (magic[0] === 84 && magic[1] === 84 && magic[2] === 65 && magic[3] === 49) return "TTA";
|
|
106
|
+
if (fileData.length >= 16 && magic[0] === 48 && magic[1] === 38 && magic[2] === 178 && magic[3] === 117) return "ASF";
|
|
107
|
+
if (magic[0] === 26 && magic[1] === 69 && magic[2] === 223 && magic[3] === 163) return "MATROSKA";
|
|
108
|
+
const ftyp = fileData.slice(4, 8);
|
|
109
|
+
if (ftyp[0] === 102 && ftyp[1] === 116 && ftyp[2] === 121 && ftyp[3] === 112) return "MP4";
|
|
110
|
+
return "unknown";
|
|
111
|
+
}
|
|
112
|
+
/** MP4 detection: containerFormat (path mode) or ftyp box (buffer mode). */
|
|
113
|
+
function isMP4(tagData, fileData) {
|
|
114
|
+
if (!fileData) return tagData?.containerFormat === "MP4";
|
|
115
|
+
if (fileData.length < 8) return false;
|
|
116
|
+
const magic = fileData.slice(4, 8);
|
|
117
|
+
return magic[0] === 102 && magic[1] === 116 && magic[2] === 121 && magic[3] === 112;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
export { detectOggCodec, getAudioProperties, getFormat, isMP4 };
|
|
@@ -0,0 +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;AACxD,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,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAKzD,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKhC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAK/B,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5C,kBAAkB,IAAI,MAAM,EAAE,GAAG,SAAS;IAK1C,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAK5C,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKhC,WAAW,IAAI,UAAU,EAAE;IAK3B,WAAW,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI;IAKzC,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAKrC,cAAc,IAAI,IAAI;IAKtB,WAAW,IAAI,UAAU,EAAE;IAK3B,WAAW,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI;IASlE,WAAW,IAAI,UAAU,GAAG,SAAS;IAKrC,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI;IAK1C,OAAO,IAAI,MAAM,GAAG,SAAS;IAK7B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAKlC,UAAU,IAAI;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAA;KAAE;IAK1C,YAAY,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAKtD,UAAU,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"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js";
|
|
2
|
+
import { WasmerExecutionError } from "../wasmer-sdk-loader/types.js";
|
|
3
|
+
import { createHandleState, destroy, getBuffer, isValid, loadBuffer, loadPath, save } from "./handle-state.js";
|
|
4
|
+
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
|
+
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
|
+
//#region src/runtime/wasi-adapter/file-handle.ts
|
|
9
|
+
var WasiFileHandle = class {
|
|
10
|
+
constructor(wasiModule) {
|
|
11
|
+
_defineProperty(this, "state", void 0);
|
|
12
|
+
_defineProperty(this, "destroyed", false);
|
|
13
|
+
this.state = createHandleState(wasiModule);
|
|
14
|
+
}
|
|
15
|
+
checkNotDestroyed() {
|
|
16
|
+
if (this.destroyed) throw new WasmerExecutionError("FileHandle has been destroyed");
|
|
17
|
+
}
|
|
18
|
+
loadFromBuffer(buffer) {
|
|
19
|
+
this.checkNotDestroyed();
|
|
20
|
+
loadBuffer(this.state, buffer);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
loadFromPath(path) {
|
|
24
|
+
this.checkNotDestroyed();
|
|
25
|
+
loadPath(this.state, path);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
isValid() {
|
|
29
|
+
this.checkNotDestroyed();
|
|
30
|
+
return isValid(this.state);
|
|
31
|
+
}
|
|
32
|
+
save() {
|
|
33
|
+
this.checkNotDestroyed();
|
|
34
|
+
return save(this.state);
|
|
35
|
+
}
|
|
36
|
+
getBuffer() {
|
|
37
|
+
this.checkNotDestroyed();
|
|
38
|
+
return getBuffer(this.state);
|
|
39
|
+
}
|
|
40
|
+
getTagData() {
|
|
41
|
+
this.checkNotDestroyed();
|
|
42
|
+
return getBasicTagData(this.state.tagData);
|
|
43
|
+
}
|
|
44
|
+
setTagData(data) {
|
|
45
|
+
this.checkNotDestroyed();
|
|
46
|
+
this.state.tagData = setBasicTagData(this.state.tagData, data);
|
|
47
|
+
}
|
|
48
|
+
getAudioProperties() {
|
|
49
|
+
this.checkNotDestroyed();
|
|
50
|
+
return getAudioProperties(this.state.tagData);
|
|
51
|
+
}
|
|
52
|
+
getFormat() {
|
|
53
|
+
this.checkNotDestroyed();
|
|
54
|
+
return getFormat(this.state.tagData, this.state.fileData);
|
|
55
|
+
}
|
|
56
|
+
isMP4() {
|
|
57
|
+
this.checkNotDestroyed();
|
|
58
|
+
return isMP4(this.state.tagData, this.state.fileData);
|
|
59
|
+
}
|
|
60
|
+
getProperties() {
|
|
61
|
+
this.checkNotDestroyed();
|
|
62
|
+
return getProperties(this.state.tagData);
|
|
63
|
+
}
|
|
64
|
+
setProperties(properties) {
|
|
65
|
+
this.checkNotDestroyed();
|
|
66
|
+
this.state.tagData = setProperties(this.state.tagData, properties);
|
|
67
|
+
}
|
|
68
|
+
getProperty(key) {
|
|
69
|
+
this.checkNotDestroyed();
|
|
70
|
+
return getProperty(this.state.tagData, key);
|
|
71
|
+
}
|
|
72
|
+
setProperty(key, value) {
|
|
73
|
+
this.checkNotDestroyed();
|
|
74
|
+
this.state.tagData = setProperty(this.state.tagData, key, value);
|
|
75
|
+
}
|
|
76
|
+
getMP4Item(key) {
|
|
77
|
+
this.checkNotDestroyed();
|
|
78
|
+
return getMP4Item(this.state.tagData, key);
|
|
79
|
+
}
|
|
80
|
+
setMP4Item(key, value) {
|
|
81
|
+
this.checkNotDestroyed();
|
|
82
|
+
this.state.tagData = setMP4Item(this.state.tagData, key, value);
|
|
83
|
+
}
|
|
84
|
+
getMp4ItemRemovals() {
|
|
85
|
+
this.checkNotDestroyed();
|
|
86
|
+
return getMp4ItemRemovals(this.state.tagData);
|
|
87
|
+
}
|
|
88
|
+
setMp4ItemRemovals(removals) {
|
|
89
|
+
this.checkNotDestroyed();
|
|
90
|
+
this.state.tagData = setMp4ItemRemovals(this.state.tagData, removals);
|
|
91
|
+
}
|
|
92
|
+
removeMP4Item(key) {
|
|
93
|
+
this.checkNotDestroyed();
|
|
94
|
+
this.state.tagData = removeMP4Item(this.state.tagData, key);
|
|
95
|
+
}
|
|
96
|
+
getPictures() {
|
|
97
|
+
this.checkNotDestroyed();
|
|
98
|
+
return getPictures(this.state.tagData);
|
|
99
|
+
}
|
|
100
|
+
setPictures(pictures) {
|
|
101
|
+
this.checkNotDestroyed();
|
|
102
|
+
this.state.tagData = setPictures(this.state.tagData, pictures);
|
|
103
|
+
}
|
|
104
|
+
addPicture(picture) {
|
|
105
|
+
this.checkNotDestroyed();
|
|
106
|
+
this.state.tagData = addPicture(this.state.tagData, picture);
|
|
107
|
+
}
|
|
108
|
+
removePictures() {
|
|
109
|
+
this.checkNotDestroyed();
|
|
110
|
+
this.state.tagData = removePictures(this.state.tagData);
|
|
111
|
+
}
|
|
112
|
+
getChapters() {
|
|
113
|
+
this.checkNotDestroyed();
|
|
114
|
+
return getChapters(this.state.tagData);
|
|
115
|
+
}
|
|
116
|
+
setChapters(chapters, mp4ChapterStyle) {
|
|
117
|
+
this.checkNotDestroyed();
|
|
118
|
+
this.state.tagData = setChapters(this.state.tagData, chapters, mp4ChapterStyle);
|
|
119
|
+
}
|
|
120
|
+
getBextData() {
|
|
121
|
+
this.checkNotDestroyed();
|
|
122
|
+
return getBextData(this.state.tagData);
|
|
123
|
+
}
|
|
124
|
+
setBextData(data) {
|
|
125
|
+
this.checkNotDestroyed();
|
|
126
|
+
this.state.tagData = setBextData(this.state.tagData, data);
|
|
127
|
+
}
|
|
128
|
+
getIxml() {
|
|
129
|
+
this.checkNotDestroyed();
|
|
130
|
+
return getIxml(this.state.tagData);
|
|
131
|
+
}
|
|
132
|
+
setIxml(data) {
|
|
133
|
+
this.checkNotDestroyed();
|
|
134
|
+
this.state.tagData = setIxml(this.state.tagData, data);
|
|
135
|
+
}
|
|
136
|
+
hasId3Tags() {
|
|
137
|
+
this.checkNotDestroyed();
|
|
138
|
+
return hasId3Tags(this.state.tagData);
|
|
139
|
+
}
|
|
140
|
+
stripId3Tags(opts) {
|
|
141
|
+
this.checkNotDestroyed();
|
|
142
|
+
this.state.tagData = stripId3Tags(this.state.tagData, opts);
|
|
143
|
+
}
|
|
144
|
+
getRatings() {
|
|
145
|
+
this.checkNotDestroyed();
|
|
146
|
+
return getRatings(this.state.tagData);
|
|
147
|
+
}
|
|
148
|
+
setRatings(ratings) {
|
|
149
|
+
this.checkNotDestroyed();
|
|
150
|
+
this.state.tagData = setRatings(this.state.tagData, ratings);
|
|
151
|
+
}
|
|
152
|
+
getLyrics() {
|
|
153
|
+
this.checkNotDestroyed();
|
|
154
|
+
return getLyrics(this.state.tagData);
|
|
155
|
+
}
|
|
156
|
+
setLyrics(lyrics) {
|
|
157
|
+
this.checkNotDestroyed();
|
|
158
|
+
this.state.tagData = setLyrics(this.state.tagData, lyrics);
|
|
159
|
+
}
|
|
160
|
+
getId3v2Frames(id) {
|
|
161
|
+
this.checkNotDestroyed();
|
|
162
|
+
return getId3v2Frames(this.state, id);
|
|
163
|
+
}
|
|
164
|
+
setId3v2Frames(id, data) {
|
|
165
|
+
this.checkNotDestroyed();
|
|
166
|
+
this.state.tagData = setId3v2Frames(this.state.tagData, id, data);
|
|
167
|
+
}
|
|
168
|
+
removeId3v2Frames(id) {
|
|
169
|
+
this.checkNotDestroyed();
|
|
170
|
+
this.state.tagData = removeId3v2Frames(this.state.tagData, id);
|
|
171
|
+
}
|
|
172
|
+
getStagedId3v2Frames() {
|
|
173
|
+
return getStagedId3v2Frames(this.state.tagData);
|
|
174
|
+
}
|
|
175
|
+
destroy() {
|
|
176
|
+
destroy(this.state);
|
|
177
|
+
this.destroyed = true;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
//#endregion
|
|
181
|
+
export { WasiFileHandle };
|
|
@@ -0,0 +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;AAKhE,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,CAsBhD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,CAExD;AAED,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAGhD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { decodeTagData } from "../../msgpack/decoder.js";
|
|
2
|
+
import { preserveEmptyValues } from "./tag-keys.js";
|
|
3
|
+
import { readTagsFromWasm, readTagsFromWasmPath, writeTagsToWasm, writeTagsToWasmPath } from "./wasm-io.js";
|
|
4
|
+
//#region src/runtime/wasi-adapter/handle-state.ts
|
|
5
|
+
function createHandleState(wasi) {
|
|
6
|
+
return {
|
|
7
|
+
wasi,
|
|
8
|
+
fileData: null,
|
|
9
|
+
filePath: null,
|
|
10
|
+
tagData: null
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** Read + decode + normalize a buffer source into the snapshot. */
|
|
14
|
+
function loadBuffer(state, buffer) {
|
|
15
|
+
state.fileData = buffer;
|
|
16
|
+
state.tagData = preserveEmptyValues(decodeTagData(readTagsFromWasm(state.wasi, buffer)));
|
|
17
|
+
}
|
|
18
|
+
/** Read + decode + normalize a path source into the snapshot. */
|
|
19
|
+
function loadPath(state, path) {
|
|
20
|
+
state.filePath = path;
|
|
21
|
+
state.tagData = preserveEmptyValues(decodeTagData(readTagsFromWasmPath(state.wasi, path)));
|
|
22
|
+
}
|
|
23
|
+
function isValid(state) {
|
|
24
|
+
return state.fileData !== null && state.fileData.length > 0 || state.filePath !== null && state.tagData !== null;
|
|
25
|
+
}
|
|
26
|
+
/** Write the snapshot back; path mode writes in place, buffer mode returns
|
|
27
|
+
* the new bytes (stored back into state.fileData on success). */
|
|
28
|
+
function save(state) {
|
|
29
|
+
if (!state.tagData) return false;
|
|
30
|
+
if (state.filePath) return writeTagsToWasmPath(state.wasi, state.filePath, state.tagData);
|
|
31
|
+
if (!state.fileData) return false;
|
|
32
|
+
const result = writeTagsToWasm(state.wasi, state.fileData, state.tagData);
|
|
33
|
+
if (result) {
|
|
34
|
+
state.fileData = result;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
function getBuffer(state) {
|
|
40
|
+
return state.fileData ?? /* @__PURE__ */ new Uint8Array(0);
|
|
41
|
+
}
|
|
42
|
+
/** Null the source and snapshot; the class tracks the destroyed flag. */
|
|
43
|
+
function destroy(state) {
|
|
44
|
+
state.fileData = null;
|
|
45
|
+
state.tagData = null;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { createHandleState, destroy, getBuffer, isValid, loadBuffer, loadPath, save };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mp4-items.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/mp4-items.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;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,CAgBzB;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,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,IAAI,EAAE,MAAM,GACX,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzB;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GACtC,MAAM,EAAE,GAAG,SAAS,CAEtB;AAED,qDAAqD;AACrD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKzB;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,CAmBhC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { fromTagLibKey, mp4AtomWireKey } from "../../constants/properties.js";
|
|
2
|
+
import { mirrorForRawKey, stringifyScalar } from "../../utils/mirror-fields.js";
|
|
3
|
+
import { getProperty, setProperty } from "./property-surface.js";
|
|
4
|
+
//#region src/runtime/wasi-adapter/mp4-items.ts
|
|
5
|
+
/**
|
|
6
|
+
* MP4 item operations over the WASI tag-data snapshot.
|
|
7
|
+
*
|
|
8
|
+
* Pure functions over tagData: the WasiFileHandle wrappers add destruction
|
|
9
|
+
* guards. Extracted from file-handle.ts in the taglib-1dfc split.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Normalize an MP4 item key for the PropertyMap path. TagLib's MP4 PropertyMap
|
|
13
|
+
* keys a freeform `----:mean:NAME` atom by its bare NAME, uppercased (the usual
|
|
14
|
+
* key remap then maps known atoms like iTunNORM -> appleSoundCheck). WASI MP4
|
|
15
|
+
* items ride the PropertyMap, so the full iTunes atom key that Emscripten's
|
|
16
|
+
* dedicated Item API uses must be normalized or the value is silently dropped on
|
|
17
|
+
* save (taglib-1qn). Non-freeform keys pass through unchanged.
|
|
18
|
+
*/
|
|
19
|
+
function mp4ItemPropertyKey(key) {
|
|
20
|
+
if (key.startsWith("----:")) return key.slice(key.lastIndexOf(":") + 1).toUpperCase();
|
|
21
|
+
return mp4AtomWireKey(key) ?? key;
|
|
22
|
+
}
|
|
23
|
+
/** Read an MP4 item; foreign-mean atoms ride their full `----:` slot. */
|
|
24
|
+
function getMP4Item(tagData, key) {
|
|
25
|
+
if (key.startsWith("----:")) {
|
|
26
|
+
const foreign = tagData?.[key];
|
|
27
|
+
if (foreign !== void 0) {
|
|
28
|
+
if (Array.isArray(foreign)) {
|
|
29
|
+
const first = foreign[0];
|
|
30
|
+
return stringifyScalar(first);
|
|
31
|
+
}
|
|
32
|
+
return stringifyScalar(foreign);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return getProperty(tagData, mp4ItemPropertyKey(key));
|
|
36
|
+
}
|
|
37
|
+
/** Write an MP4 item; returns the next snapshot record. */
|
|
38
|
+
function setMP4Item(tagData, key, value) {
|
|
39
|
+
let next = setProperty(tagData, mp4ItemPropertyKey(key), value);
|
|
40
|
+
if (key.startsWith("----:")) {
|
|
41
|
+
next = registerMp4ItemName(next, key);
|
|
42
|
+
if (next?.[key] !== void 0) next = {
|
|
43
|
+
...next,
|
|
44
|
+
[key]: value
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return next;
|
|
48
|
+
}
|
|
49
|
+
/** Record an exact atom name to be repaired after the PropertyMap write. */
|
|
50
|
+
function registerMp4ItemName(tagData, name) {
|
|
51
|
+
const existing = tagData?._mp4ItemNames ?? [];
|
|
52
|
+
if (existing.includes(name)) return tagData ?? {};
|
|
53
|
+
return {
|
|
54
|
+
...tagData,
|
|
55
|
+
_mp4ItemNames: [...existing, name]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Record a foreign-mean freeform atom for deletion at save (taglib-65nm).
|
|
60
|
+
* The PropertyMap erase pass cannot express foreign atoms, so the C++ shim
|
|
61
|
+
* consumes this list and calls removeItem on each exact atom name.
|
|
62
|
+
*/
|
|
63
|
+
function registerMp4ItemRemoval(tagData, name) {
|
|
64
|
+
const existing = tagData?._mp4ItemRemovals ?? [];
|
|
65
|
+
if (existing.includes(name)) return tagData ?? {};
|
|
66
|
+
return {
|
|
67
|
+
...tagData,
|
|
68
|
+
_mp4ItemRemovals: [...existing, name]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** The accumulated foreign-atom removals pending the next save. */
|
|
72
|
+
function getMp4ItemRemovals(tagData) {
|
|
73
|
+
return tagData?._mp4ItemRemovals;
|
|
74
|
+
}
|
|
75
|
+
/** Replace the pending foreign-atom removal list. */
|
|
76
|
+
function setMp4ItemRemovals(tagData, removals) {
|
|
77
|
+
return {
|
|
78
|
+
...tagData,
|
|
79
|
+
_mp4ItemRemovals: [...new Set(removals)]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** Remove an MP4 item; returns the next snapshot record (null on no-op). */
|
|
83
|
+
function removeMP4Item(tagData, key) {
|
|
84
|
+
if (!tagData) return null;
|
|
85
|
+
let next = tagData;
|
|
86
|
+
if (key.startsWith("----:")) {
|
|
87
|
+
delete next[key];
|
|
88
|
+
next = registerMp4ItemRemoval(next, key);
|
|
89
|
+
}
|
|
90
|
+
const mappedKey = fromTagLibKey(mp4ItemPropertyKey(key));
|
|
91
|
+
delete next[mappedKey];
|
|
92
|
+
const mirror = mirrorForRawKey(mappedKey);
|
|
93
|
+
if (mirror !== void 0) delete next[mirror.numeric];
|
|
94
|
+
return next;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { getMP4Item, getMp4ItemRemovals, mp4ItemPropertyKey, registerMp4ItemName, registerMp4ItemRemoval, removeMP4Item, setMP4Item, setMp4ItemRemovals };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-open.d.ts","sourceRoot":"","sources":["../../../src/runtime/wasi-adapter/path-open.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAqBhE;;qBAEqB;AACrB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,gBAAgB,IAAI,UAAU,CAAC;CAChC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,CAAC,CAwCzB"}
|