taglib-wasm 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +70 -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/{src/constants → constants}/properties.d.ts +1 -1
- 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} +4 -2
- package/dist/deno-compile.d.ts.map +1 -0
- package/dist/deno-compile.js +109 -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 +4101 -4478
- 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.map +1 -0
- package/dist/runtime/deno-detect.js +12 -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 +153 -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 +3404 -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 +137 -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-wrapper.js +1 -1
- package/dist/taglib.d.ts.map +1 -0
- package/dist/taglib.js +7 -0
- 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 +3168 -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 +131 -96
- 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.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.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}/deno-detect.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}/audio-formats.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
package/LICENSE
CHANGED
|
@@ -42,7 +42,7 @@ The WebAssembly binaries are subject to LGPL requirements. This means:
|
|
|
42
42
|
To rebuild the WebAssembly binaries with a modified TagLib:
|
|
43
43
|
1. Modify the TagLib source in lib/taglib/
|
|
44
44
|
2. Run: npm run build:wasm (builds both backends; requires the
|
|
45
|
-
Emscripten SDK and WASI SDK 34 — see CONTRIBUTING.md)
|
|
45
|
+
Emscripten SDK and WASI SDK 34 — see .github/CONTRIBUTING.md)
|
|
46
46
|
3. The new binaries will be in build/taglib-web.wasm and
|
|
47
47
|
build/taglib-wasi.wasm
|
|
48
48
|
|
package/README.md
CHANGED
|
@@ -59,8 +59,11 @@ npm install taglib-wasm
|
|
|
59
59
|
|
|
60
60
|
### Deno
|
|
61
61
|
|
|
62
|
+
Deno installs from npm (Deno's `npm:` specifiers), not from JSR — the JSR
|
|
63
|
+
package `@charlesw/taglib-wasm` is deprecated.
|
|
64
|
+
|
|
62
65
|
```typescript
|
|
63
|
-
import { TagLib } from "
|
|
66
|
+
import { TagLib } from "npm:taglib-wasm";
|
|
64
67
|
```
|
|
65
68
|
|
|
66
69
|
### Bun
|
|
@@ -93,11 +96,11 @@ file:
|
|
|
93
96
|
|
|
94
97
|
```typescript
|
|
95
98
|
// 1. Prepare your build by copying the WASM file
|
|
96
|
-
import { prepareWasmForEmbedding } from "
|
|
99
|
+
import { prepareWasmForEmbedding } from "npm:taglib-wasm";
|
|
97
100
|
await prepareWasmForEmbedding("./taglib-web.wasm");
|
|
98
101
|
|
|
99
102
|
// 2. In your application, use the helper for automatic handling
|
|
100
|
-
import { initializeForDenoCompile } from "
|
|
103
|
+
import { initializeForDenoCompile } from "npm:taglib-wasm";
|
|
101
104
|
const taglib = await initializeForDenoCompile();
|
|
102
105
|
|
|
103
106
|
// 3. Compile with the embedded WASM
|
|
@@ -132,8 +135,8 @@ path or URL instead — use `wasmUrl` with it.
|
|
|
132
135
|
|
|
133
136
|
## Quick Start
|
|
134
137
|
|
|
135
|
-
> **Import paths:**
|
|
136
|
-
>
|
|
138
|
+
> **Import paths:** all runtimes use the npm package `taglib-wasm` (Deno via
|
|
139
|
+
> `npm:taglib-wasm`); the old JSR package `@charlesw/taglib-wasm` is deprecated.
|
|
137
140
|
|
|
138
141
|
### Simple API
|
|
139
142
|
|
|
@@ -463,7 +466,7 @@ Supported formats:
|
|
|
463
466
|
- [Broadcast Metadata (BWF bext / iXML)](https://charleswiltgen.github.io/TagLib-Wasm/guide/broadcast-metadata.html)
|
|
464
467
|
- [Cloudflare Workers](https://charleswiltgen.github.io/TagLib-Wasm/advanced/cloudflare-workers.html)
|
|
465
468
|
- [Error Handling](https://charleswiltgen.github.io/TagLib-Wasm/concepts/error-handling.html)
|
|
466
|
-
- [Contributing](CONTRIBUTING.md)
|
|
469
|
+
- [Contributing](.github/CONTRIBUTING.md)
|
|
467
470
|
- [AI Agent Documentation](AGENTS.md)
|
|
468
471
|
|
|
469
472
|
## Supported Formats
|
|
@@ -563,38 +566,41 @@ Partial loading (`{ partial: true }`) works on both paths; see the
|
|
|
563
566
|
### Bundle Size and Tree-Shaking
|
|
564
567
|
|
|
565
568
|
Importing the barrel (`taglib-wasm`) does **not** pull in the Folder or Web API:
|
|
566
|
-
every bundler tested here tree-shakes to leaf granularity. Measured
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
are minified JavaScript bytes — the
|
|
570
|
-
is not part of the bundle in any
|
|
571
|
-
|
|
572
|
-
condition.
|
|
569
|
+
every bundler tested here tree-shakes to leaf granularity. Measured from a packed
|
|
570
|
+
tarball of this repository's build (`npm pack` → `npm install <tarball>`),
|
|
571
|
+
minified ES2022 ESM bundles on Node 24.21.0 with esbuild 0.28.2, rollup 4.63.3,
|
|
572
|
+
vite 8.3.0 and webpack 5.111.1. Figures are minified JavaScript bytes — the
|
|
573
|
+
~700 KB Wasm binary is loaded at runtime and is not part of the bundle in any
|
|
574
|
+
scenario below.
|
|
573
575
|
|
|
574
576
|
Each row is a one-file app whose whole body is that import plus the call the row
|
|
575
577
|
names, keeping the imported function reachable (`globalThis.__app = { … }`).
|
|
576
|
-
|
|
578
|
+
Where a build splits its output into several files, the figure is the total of
|
|
579
|
+
every JavaScript chunk it emits. Exact invocations, so the table can be
|
|
580
|
+
reproduced:
|
|
577
581
|
|
|
578
582
|
- **esbuild 0.28.2** — `esbuild <app> --bundle --minify --format=esm
|
|
579
|
-
--target=es2022 --platform=browser --external:module` for the browser
|
|
580
|
-
the same with `--platform=node` and no `--external` for the Node
|
|
581
|
-
|
|
583
|
+
--target=es2022 --platform=browser --external:node:module` for the browser
|
|
584
|
+
column; the same with `--platform=node` and no `--external` for the Node
|
|
585
|
+
column. The `--external` matches the dynamic `import("node:module")` in
|
|
586
|
+
`dist/taglib-wrapper.js`. (`--external` takes a colon, not `=`.)
|
|
582
587
|
- **rollup 4.63.3** — `input: <app>`, plugins `@rollup/plugin-node-resolve`
|
|
583
588
|
(`{ browser: true, exportConditions: ["browser", "default"] }` for the browser
|
|
584
589
|
column, default options for the Node column) and `@rollup/plugin-terser`,
|
|
585
590
|
output `{ format: "esm", inlineDynamicImports: true }`.
|
|
586
591
|
- **vite 8.3.0** — a real app build: `index.html` plus a
|
|
587
592
|
`<script type="module">` pointing at the entry, `build.minify: "esbuild"`,
|
|
588
|
-
`target: "es2022"`. Vite builds for the browser
|
|
593
|
+
`target: "es2022"`. Vite builds for the browser; the figures below that name
|
|
594
|
+
the `node` condition instead add `resolve.conditions: ["node"]`.
|
|
589
595
|
- **webpack 5.111.1** — `mode: "production"`, `target: "web"`,
|
|
590
596
|
`externals: { module: "module" }`. `target: "web"` alone fails on the
|
|
591
|
-
`import("module")` inside `dist/taglib-wrapper.js`.
|
|
597
|
+
`import("node:module")` inside `dist/taglib-wrapper.js`.
|
|
592
598
|
|
|
593
599
|
| Consumer app | esbuild (browser)¹ | rollup (browser)¹ | vite (app) | webpack (web)² | esbuild (Node)³ | rollup (Node)³ |
|
|
594
600
|
| ------------------------------------- | ------------------ | ----------------- | ---------- | -------------- | --------------- | -------------- |
|
|
595
|
-
| `taglib-wasm` — `TagLib.initialize()` |
|
|
596
|
-
| `taglib-wasm/simple` — `getTagLib()` |
|
|
597
|
-
| `taglib-wasm/folder` — `scanFolder`⁴ | — |
|
|
601
|
+
| `taglib-wasm` — `TagLib.initialize()` | 79,826 | 77,058 | 82,778 | 80,736 | 143,600 | 133,060 |
|
|
602
|
+
| `taglib-wasm/simple` — `getTagLib()` | 79,548 | 77,316 | 82,512 | 81,554 | 144,602 | 133,431 |
|
|
603
|
+
| `taglib-wasm/folder` — `scanFolder`⁴ | — | 136,822⁴ | 145,895⁴ | — | 147,942 | 136,822 |
|
|
598
604
|
|
|
599
605
|
¹ the `browser` `exports` condition. ² `target: "web"`. ³ the Node `exports`
|
|
600
606
|
condition. ⁴ Node-only entry — see below.
|
|
@@ -603,28 +609,29 @@ condition. ⁴ Node-only entry — see below.
|
|
|
603
609
|
because `scanFolder` and friends read and write a filesystem, so a
|
|
604
610
|
browser-targeted build resolves the Node-oriented graph and fails: esbuild
|
|
605
611
|
`--platform=browser` reports `Could not resolve "node:fs/promises"`, and webpack
|
|
606
|
-
`target: "web"` fails with
|
|
607
|
-
`node:fs
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
612
|
+
`target: "web"` fails with three errors (`node:buffer`, `node:fs/promises`,
|
|
613
|
+
`node:fs`). That outcome is the design: a build error beats a stub that throws
|
|
614
|
+
on the first call in production. If the same cells were reachable they would
|
|
615
|
+
come from shimming Node builtins into a bundle that cannot work — which is
|
|
616
|
+
exactly what vite and rollup did before the condition was declared. `./rating`
|
|
617
|
+
and `./disc-folder` are pure JavaScript and build for either target. In a
|
|
618
|
+
browser, scan on a server and post the result; the pure
|
|
613
619
|
`groupAlbums` / `discFolderInfo` half is exported from `taglib-wasm` and
|
|
614
620
|
`taglib-wasm/disc-folder` and runs anywhere.
|
|
615
621
|
|
|
616
622
|
**`./web` builds for the browser.** It declares a `browser` condition, so a
|
|
617
623
|
browser-targeted build resolves an Emscripten-only build of that entry and pulls
|
|
618
624
|
**`taglib-web.wasm` alone** — measured with the vite invocation above on
|
|
619
|
-
`pictureToDataURL` from `taglib-wasm/web`: one 703,477-byte Wasm asset where
|
|
620
|
-
|
|
621
|
-
(1
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
625
|
+
`pictureToDataURL` from `taglib-wasm/web`: one 703,477-byte Wasm asset, where
|
|
626
|
+
the vite build on the `node` condition instead emits both `taglib-web.wasm` and
|
|
627
|
+
`taglib-wasi.wasm` (1,458,150 bytes of assets for a call that needs neither
|
|
628
|
+
engine). The browser build is a pre-bundled file like `index.browser.js`, so it
|
|
629
|
+
barely tree-shakes: that call is 81,006 bytes in the vite app build and 78,528
|
|
630
|
+
under the esbuild browser column, against 205 bytes under esbuild's Node column —
|
|
631
|
+
and importing any pure helper from the barrel costs ~80 KB there too. Rollup is
|
|
632
|
+
the exception: it shakes the pre-bundled file down to 745 bytes, though still
|
|
633
|
+
not to the 210-byte leaf its Node column reaches. That granularity is a property
|
|
634
|
+
of the pre-bundled browser entries, not of this subpath.
|
|
628
635
|
|
|
629
636
|
**TypeScript resolves the same condition.** A browser consumer gets the matching
|
|
630
637
|
type surface only if TypeScript is told about it — in `tsconfig.json`:
|
|
@@ -648,8 +655,8 @@ instead of a bundler error — and importing `bwf`, `groupAlbums`,
|
|
|
648
655
|
mismatch is what produced the original silent failure.
|
|
649
656
|
|
|
650
657
|
**Bundler interop.** `dist/taglib-wrapper.js` — the Emscripten glue — contains a
|
|
651
|
-
dynamic `import("module")`, and browser targets have no such builtin, so the
|
|
652
|
-
targets need one line each: esbuild `--external:module`, webpack
|
|
658
|
+
dynamic `import("node:module")`, and browser targets have no such builtin, so the
|
|
659
|
+
two targets need one line each: esbuild `--external:node:module`, webpack
|
|
653
660
|
`externals: { module: "module" }` (webpack `target: "web"` alone fails on it).
|
|
654
661
|
Rollup needs nothing extra; vite externalizes it for the browser with a warning.
|
|
655
662
|
The `browser` condition itself is resolved by default by esbuild
|
|
@@ -658,42 +665,41 @@ The `browser` condition itself is resolved by default by esbuild
|
|
|
658
665
|
|
|
659
666
|
**The barrel is not a tax.** Adding an API to an import that already loads the
|
|
660
667
|
engine costs only that API. Against the `taglib-wasm` row above (esbuild, Node
|
|
661
|
-
column): adding `scanFolder` costs **4,
|
|
668
|
+
column): adding `scanFolder` costs **4,376 bytes** and adding
|
|
662
669
|
`pictureToDataURL` costs **187 bytes**, because neither drags in the rest of the
|
|
663
670
|
Folder or Web module tree.
|
|
664
671
|
|
|
665
|
-
**The browser barrel's
|
|
666
|
-
|
|
667
|
-
`bwf` / `groupAlbums` / `discFolderInfo` exports to
|
|
668
|
-
|
|
669
|
-
`import { TagLib }
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
function, shakes away completely, the Folder and Web APIs are still reached only
|
|
674
|
-
when imported, and the Node entries are unchanged.
|
|
672
|
+
**The browser barrel's export list is already paid for.** The browser entry is a
|
|
673
|
+
pre-bundled file, so a consumer of the barrel downloads the whole file whatever
|
|
674
|
+
it imports; adding the pure `bwf` / `groupAlbums` / `discFolderInfo` exports to
|
|
675
|
+
that file's export list therefore costs nothing measurable. Bundling
|
|
676
|
+
`import { TagLib }` against the entry with and without those three export names
|
|
677
|
+
gives identical bytes under esbuild (79,826) and rollup (77,058) and 12 bytes
|
|
678
|
+
more under vite (82,764 → 82,776). Nothing else moved: the Folder and Web APIs
|
|
679
|
+
are still reached only when imported, and the Node entries are unchanged.
|
|
675
680
|
|
|
676
681
|
**Entry-point choice is not a size lever.** `taglib-wasm` and
|
|
677
|
-
`taglib-wasm/simple` differ by
|
|
678
|
-
|
|
682
|
+
`taglib-wasm/simple` differ by about a kilobyte either way — in a browser bundle
|
|
683
|
+
`simple` is 278 bytes _smaller_, on Node 1,002 bytes _larger_, because
|
|
679
684
|
`getTagLib()` reaches the full `TagLib` class through a dynamic import. Pick by
|
|
680
685
|
API surface. The lever that does matter is the `browser` export condition: a
|
|
681
|
-
browser-targeted bundle is ~
|
|
686
|
+
browser-targeted bundle is ~80 KB where a Node-targeted one is ~144 KB.
|
|
682
687
|
|
|
683
688
|
**`"sideEffects": false`** is set in `package.json`, so a bundler may drop any
|
|
684
689
|
module whose exports go unused. Before that field, importers of the sub-entries
|
|
685
690
|
paid ~17 KB for property-metadata tables that were kept only because module-level
|
|
686
691
|
table building looked impure; those bundles are now a few hundred bytes or less.
|
|
687
|
-
Measured
|
|
688
|
-
options, and vite's app build
|
|
692
|
+
Measured on the **`node` condition** — esbuild `--platform=node`, rollup with
|
|
693
|
+
default `node-resolve` options, and vite's app build with
|
|
694
|
+
`resolve.conditions: ["node"]` — the combination under which all four apps build
|
|
689
695
|
under every bundler:
|
|
690
696
|
|
|
691
|
-
| Consumer app | esbuild off → on | rollup off → on | vite off → on
|
|
692
|
-
| -------------------------------------------------------------- | ----------------- | ----------------- |
|
|
693
|
-
| `import "taglib-wasm/web"` (uses nothing) | 17,
|
|
694
|
-
| `import "taglib-wasm/folder"` (uses nothing) | 17,
|
|
695
|
-
| `pictureToDataURL` from `taglib-wasm/web` | 17,
|
|
696
|
-
| `import { TagLib } from "taglib-wasm"`, referenced by `typeof` |
|
|
697
|
+
| Consumer app | esbuild off → on | rollup off → on | vite off → on |
|
|
698
|
+
| -------------------------------------------------------------- | ----------------- | ----------------- | ----------------- |
|
|
699
|
+
| `import "taglib-wasm/web"` (uses nothing) | 17,224 → 0 | 16,428 → 1 | 17,328 → 711 |
|
|
700
|
+
| `import "taglib-wasm/folder"` (uses nothing) | 17,428 → 0 | 16,479 → 1 | 17,669 → 711 |
|
|
701
|
+
| `pictureToDataURL` from `taglib-wasm/web` | 17,428 → 205 | 16,637 → 210 | 17,540 → 923 |
|
|
702
|
+
| `import { TagLib } from "taglib-wasm"`, referenced by `typeof` | 144,582 → 143,579 | 133,090 → 133,039 | 141,847 → 141,456 |
|
|
697
703
|
|
|
698
704
|
## Runtime Compatibility
|
|
699
705
|
|
|
@@ -703,7 +709,7 @@ under every bundler:
|
|
|
703
709
|
| ---------------------- | ------- | ------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
704
710
|
| **Node.js** | Full | `npm install taglib-wasm` | TypeScript via tsx |
|
|
705
711
|
| **Deno** | Full | `npm:taglib-wasm` | Native TypeScript |
|
|
706
|
-
| **Bun** | Partial | `bun add taglib-wasm` | Import + init verified;
|
|
712
|
+
| **Bun** | Partial | `bun add taglib-wasm` | Import + init verified; covered by `npm run test:bun` and the cross-runtime smoke |
|
|
707
713
|
| **Browser** | Full | Via bundler | Full API support |
|
|
708
714
|
| **Cloudflare Workers** | Full | `npm install taglib-wasm` | Buffer-based (Emscripten); no filesystem. See [Workers guide](docs/advanced/cloudflare-workers.md) |
|
|
709
715
|
| **Electron** | Node.js | `npm install taglib-wasm` | Main process; renderer via IPC |
|
|
@@ -720,7 +726,7 @@ under every bundler:
|
|
|
720
726
|
|
|
721
727
|
## Contributing
|
|
722
728
|
|
|
723
|
-
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md)
|
|
729
|
+
Contributions are welcome! Please read our [Contributing Guide](.github/CONTRIBUTING.md)
|
|
724
730
|
for details on our code of conduct and the process for submitting pull requests.
|
|
725
731
|
|
|
726
732
|
## License
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/assertClassBrand.js
|
|
2
|
+
function _assertClassBrand(e, t, n) {
|
|
3
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
4
|
+
throw new TypeError("Private element is not present on this object");
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _assertClassBrand as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/checkPrivateRedeclaration.js
|
|
2
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
3
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { _checkPrivateRedeclaration as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _assertClassBrand from "./assertClassBrand.js";
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/classPrivateFieldGet2.js
|
|
3
|
+
function _classPrivateFieldGet2(s, a) {
|
|
4
|
+
return s.get(_assertClassBrand(s, a));
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _classPrivateFieldGet2 as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _checkPrivateRedeclaration from "./checkPrivateRedeclaration.js";
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
3
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
4
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _classPrivateFieldInitSpec as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _assertClassBrand from "./assertClassBrand.js";
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/classPrivateFieldSet2.js
|
|
3
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
4
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _classPrivateFieldSet2 as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import toPropertyKey from "./toPropertyKey.js";
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/defineProperty.js
|
|
3
|
+
function _defineProperty(e, r, t) {
|
|
4
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5
|
+
value: t,
|
|
6
|
+
enumerable: !0,
|
|
7
|
+
configurable: !0,
|
|
8
|
+
writable: !0
|
|
9
|
+
}) : e[r] = t, e;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { _defineProperty as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _typeof from "./typeof.js";
|
|
2
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPrimitive.js
|
|
3
|
+
function toPrimitive(t, r) {
|
|
4
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
5
|
+
var e = t[Symbol.toPrimitive];
|
|
6
|
+
if (void 0 !== e) {
|
|
7
|
+
var i = e.call(t, r || "default");
|
|
8
|
+
if ("object" != _typeof(i)) return i;
|
|
9
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
|
+
}
|
|
11
|
+
return ("string" === r ? String : Number)(t);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { toPrimitive as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _typeof from "./typeof.js";
|
|
2
|
+
import toPrimitive from "./toPrimitive.js";
|
|
3
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPropertyKey.js
|
|
4
|
+
function toPropertyKey(t) {
|
|
5
|
+
var i = toPrimitive(t, "string");
|
|
6
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { toPropertyKey as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/typeof.js
|
|
2
|
+
function _typeof(o) {
|
|
3
|
+
"@babel/helpers - typeof";
|
|
4
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5
|
+
return typeof o;
|
|
6
|
+
} : function(o) {
|
|
7
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
+
}, _typeof(o);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { _typeof as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.152.0/helpers/esm/usingCtx.js
|
|
2
|
+
function _usingCtx() {
|
|
3
|
+
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
4
|
+
var n = Error();
|
|
5
|
+
return n.name = "SuppressedError", n.error = r, n.suppressed = e, n;
|
|
6
|
+
}, e = {}, n = [];
|
|
7
|
+
function using(r, e) {
|
|
8
|
+
if (null != e) {
|
|
9
|
+
if (Object(e) !== e) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
10
|
+
if (r) var o = e[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
|
11
|
+
if (void 0 === o && (o = e[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r)) var t = o;
|
|
12
|
+
if ("function" != typeof o) throw new TypeError("Object is not disposable.");
|
|
13
|
+
t && (o = function o() {
|
|
14
|
+
try {
|
|
15
|
+
t.call(e);
|
|
16
|
+
} catch (r) {
|
|
17
|
+
return Promise.reject(r);
|
|
18
|
+
}
|
|
19
|
+
}), n.push({
|
|
20
|
+
v: e,
|
|
21
|
+
d: o,
|
|
22
|
+
a: r
|
|
23
|
+
});
|
|
24
|
+
} else r && n.push({
|
|
25
|
+
d: e,
|
|
26
|
+
a: r
|
|
27
|
+
});
|
|
28
|
+
return e;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
e,
|
|
32
|
+
u: using.bind(null, !1),
|
|
33
|
+
a: using.bind(null, !0),
|
|
34
|
+
d: function d() {
|
|
35
|
+
var o, t = this.e, s = 0;
|
|
36
|
+
function next() {
|
|
37
|
+
for (; o = n.pop();) try {
|
|
38
|
+
if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
|
|
39
|
+
if (o.d) {
|
|
40
|
+
var r = o.d.call(o.v);
|
|
41
|
+
if (o.a) return s |= 2, Promise.resolve(r).then(next, err);
|
|
42
|
+
} else s |= 1;
|
|
43
|
+
} catch (r) {
|
|
44
|
+
return err(r);
|
|
45
|
+
}
|
|
46
|
+
if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
|
|
47
|
+
if (t !== e) throw t;
|
|
48
|
+
}
|
|
49
|
+
function err(n) {
|
|
50
|
+
return t = t !== e ? new r(n, t) : n, next();
|
|
51
|
+
}
|
|
52
|
+
return next();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { _usingCtx as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bext.d.ts","sourceRoot":"","sources":["../../src/bwf/bext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AA6D/D;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,GAChB,uBAAuB,GAAG,SAAS,CAyCrC;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,uBAAuB,GAAG,UAAU,CAmDjE"}
|
package/dist/bwf/bext.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region src/bwf/bext.ts
|
|
3
|
+
var bext_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
decodeBext: () => decodeBext,
|
|
5
|
+
encodeBext: () => encodeBext
|
|
6
|
+
});
|
|
7
|
+
const FIXED_PREFIX_LEN = 602;
|
|
8
|
+
const VERSION_OFFSET = 346;
|
|
9
|
+
const UMID_OFFSET = 348;
|
|
10
|
+
const UMID_LEN = 64;
|
|
11
|
+
const LOUDNESS_OFFSET = 412;
|
|
12
|
+
const LOUDNESS_UNSET = 32767;
|
|
13
|
+
function readFixedString(bytes, offset, len) {
|
|
14
|
+
let end = offset;
|
|
15
|
+
const max = Math.min(offset + len, bytes.length);
|
|
16
|
+
while (end < max && bytes[end] !== 0) end++;
|
|
17
|
+
let s = "";
|
|
18
|
+
for (let i = offset; i < end; i++) s += String.fromCharCode(bytes[i]);
|
|
19
|
+
return s;
|
|
20
|
+
}
|
|
21
|
+
function writeFixedString(bytes, offset, len, value) {
|
|
22
|
+
for (let i = 0; i < len; i++) bytes[offset + i] = i < value.length ? value.charCodeAt(i) & 255 : 0;
|
|
23
|
+
}
|
|
24
|
+
function clampInt16(n) {
|
|
25
|
+
return Math.max(-32768, Math.min(32767, Math.round(n)));
|
|
26
|
+
}
|
|
27
|
+
function loudnessRaw(v) {
|
|
28
|
+
return v === void 0 ? LOUDNESS_UNSET : clampInt16(v * 100);
|
|
29
|
+
}
|
|
30
|
+
function loudnessFromRaw(raw) {
|
|
31
|
+
return raw === LOUDNESS_UNSET ? void 0 : raw / 100;
|
|
32
|
+
}
|
|
33
|
+
function bytesToHex(bytes) {
|
|
34
|
+
let s = "";
|
|
35
|
+
for (const b of bytes) s += b.toString(16).padStart(2, "0");
|
|
36
|
+
return s;
|
|
37
|
+
}
|
|
38
|
+
function hexToBytes(hex, outLen) {
|
|
39
|
+
const clean = hex.replace(/[^0-9a-fA-F]/g, "");
|
|
40
|
+
const out = new Uint8Array(outLen);
|
|
41
|
+
for (let i = 0; i + 1 < clean.length + 1 && i / 2 < outLen; i += 2) {
|
|
42
|
+
const pair = clean.slice(i, i + 2);
|
|
43
|
+
if (pair.length === 2) out[i / 2] = parseInt(pair, 16);
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parse a raw `bext` chunk. Returns `undefined` only if `bytes` is shorter than
|
|
49
|
+
* 348 (cannot even read the `Version` field). Optional fields are populated per
|
|
50
|
+
* the chunk's declared version and the available length, so compact/legacy v0
|
|
51
|
+
* chunks parse into a partial struct.
|
|
52
|
+
*/
|
|
53
|
+
function decodeBext(bytes) {
|
|
54
|
+
if (bytes.length < 348) return void 0;
|
|
55
|
+
const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
56
|
+
const timeRefLow = dv.getUint32(338, true);
|
|
57
|
+
const timeRefHigh = dv.getUint32(342, true);
|
|
58
|
+
const version = dv.getUint16(VERSION_OFFSET, true);
|
|
59
|
+
const result = {
|
|
60
|
+
description: readFixedString(bytes, 0, 256),
|
|
61
|
+
originator: readFixedString(bytes, 256, 32),
|
|
62
|
+
originatorReference: readFixedString(bytes, 288, 32),
|
|
63
|
+
originationDate: readFixedString(bytes, 320, 10),
|
|
64
|
+
originationTime: readFixedString(bytes, 330, 8),
|
|
65
|
+
timeReferenceSamples: BigInt(timeRefHigh) << 32n | BigInt(timeRefLow),
|
|
66
|
+
version,
|
|
67
|
+
codingHistory: bytes.length > FIXED_PREFIX_LEN ? readFixedString(bytes, FIXED_PREFIX_LEN, bytes.length - FIXED_PREFIX_LEN) : ""
|
|
68
|
+
};
|
|
69
|
+
if (version >= 1 && bytes.length >= 412) result.umid = bytesToHex(bytes.subarray(UMID_OFFSET, 412));
|
|
70
|
+
if (version >= 2 && bytes.length >= 422) {
|
|
71
|
+
const lv = loudnessFromRaw(dv.getInt16(LOUDNESS_OFFSET, true));
|
|
72
|
+
const lr = loudnessFromRaw(dv.getInt16(414, true));
|
|
73
|
+
const mtp = loudnessFromRaw(dv.getInt16(416, true));
|
|
74
|
+
const mml = loudnessFromRaw(dv.getInt16(418, true));
|
|
75
|
+
const msl = loudnessFromRaw(dv.getInt16(420, true));
|
|
76
|
+
if (lv !== void 0) result.loudnessValueDb = lv;
|
|
77
|
+
if (lr !== void 0) result.loudnessRangeDb = lr;
|
|
78
|
+
if (mtp !== void 0) result.maxTruePeakLevelDbtp = mtp;
|
|
79
|
+
if (mml !== void 0) result.maxMomentaryLoudnessDb = mml;
|
|
80
|
+
if (msl !== void 0) result.maxShortTermLoudnessDb = msl;
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Serialize a `bext` chunk. The result is always `602 + codingHistory.length`
|
|
86
|
+
* bytes. `version` defaults to 2 when any loudness field is present (else 1 if
|
|
87
|
+
* `umid` is set, else 0). Over-long string fields are truncated to their widths;
|
|
88
|
+
* loudness values are clamped to the Int16 range after ×100, with `undefined`
|
|
89
|
+
* written as the EBU `0x7FFF` "not set" sentinel; UMID is written only for
|
|
90
|
+
* version ≥ 1.
|
|
91
|
+
*/
|
|
92
|
+
function encodeBext(b) {
|
|
93
|
+
const codingHistory = b.codingHistory ?? "";
|
|
94
|
+
const bytes = new Uint8Array(FIXED_PREFIX_LEN + codingHistory.length);
|
|
95
|
+
const dv = new DataView(bytes.buffer);
|
|
96
|
+
const hasLoudness = b.loudnessValueDb !== void 0 || b.loudnessRangeDb !== void 0 || b.maxTruePeakLevelDbtp !== void 0 || b.maxMomentaryLoudnessDb !== void 0 || b.maxShortTermLoudnessDb !== void 0;
|
|
97
|
+
const version = Number.isInteger(b.version) ? b.version : hasLoudness ? 2 : b.umid ? 1 : 0;
|
|
98
|
+
writeFixedString(bytes, 0, 256, b.description ?? "");
|
|
99
|
+
writeFixedString(bytes, 256, 32, b.originator ?? "");
|
|
100
|
+
writeFixedString(bytes, 288, 32, b.originatorReference ?? "");
|
|
101
|
+
writeFixedString(bytes, 320, 10, b.originationDate ?? "");
|
|
102
|
+
writeFixedString(bytes, 330, 8, b.originationTime ?? "");
|
|
103
|
+
const tr = b.timeReferenceSamples ?? 0n;
|
|
104
|
+
dv.setUint32(338, Number(tr & 4294967295n), true);
|
|
105
|
+
dv.setUint32(342, Number(tr >> 32n & 4294967295n), true);
|
|
106
|
+
dv.setUint16(VERSION_OFFSET, version, true);
|
|
107
|
+
if (version >= 1 && b.umid) bytes.set(hexToBytes(b.umid, UMID_LEN), UMID_OFFSET);
|
|
108
|
+
if (version >= 2) {
|
|
109
|
+
dv.setInt16(LOUDNESS_OFFSET, loudnessRaw(b.loudnessValueDb), true);
|
|
110
|
+
dv.setInt16(414, loudnessRaw(b.loudnessRangeDb), true);
|
|
111
|
+
dv.setInt16(416, loudnessRaw(b.maxTruePeakLevelDbtp), true);
|
|
112
|
+
dv.setInt16(418, loudnessRaw(b.maxMomentaryLoudnessDb), true);
|
|
113
|
+
dv.setInt16(420, loudnessRaw(b.maxShortTermLoudnessDb), true);
|
|
114
|
+
}
|
|
115
|
+
writeFixedString(bytes, FIXED_PREFIX_LEN, codingHistory.length, codingHistory);
|
|
116
|
+
return bytes;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { bext_exports, decodeBext, encodeBext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"additional-properties.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"additional-properties.d.ts","sourceRoot":"","sources":["../../src/constants/additional-properties.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwMxB,CAAC"}
|