taglib-wasm 1.2.0 → 1.2.2

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.
Files changed (41) hide show
  1. package/dist/index.browser.js +39 -14
  2. package/dist/simple.browser.js +39 -14
  3. package/dist/src/constants/complex-properties.d.ts +1 -14
  4. package/dist/src/constants/complex-properties.d.ts.map +1 -1
  5. package/dist/src/errors/base.js +5 -2
  6. package/dist/src/errors/classes.js +13 -10
  7. package/dist/src/msgpack/encoder.d.ts.map +1 -1
  8. package/dist/src/msgpack/encoder.js +6 -1
  9. package/dist/src/msgpack/index.d.ts +0 -1
  10. package/dist/src/msgpack/index.d.ts.map +1 -1
  11. package/dist/src/msgpack/index.js +1 -11
  12. package/dist/src/runtime/unified-loader/types.js +4 -1
  13. package/dist/src/runtime/wasi-adapter/file-handle.d.ts +8 -0
  14. package/dist/src/runtime/wasi-adapter/file-handle.d.ts.map +1 -1
  15. package/dist/src/runtime/wasi-adapter/file-handle.js +45 -4
  16. package/dist/src/runtime/wasi-memory.js +5 -2
  17. package/dist/src/taglib/audio-file-base.js +1 -1
  18. package/dist/src/taglib/audio-file-impl.d.ts +8 -0
  19. package/dist/src/taglib/audio-file-impl.d.ts.map +1 -1
  20. package/dist/src/taglib/audio-file-impl.js +9 -0
  21. package/dist/src/taglib/audio-file-interface.d.ts +17 -0
  22. package/dist/src/taglib/audio-file-interface.d.ts.map +1 -1
  23. package/dist/src/taglib/embind-adapter.d.ts.map +1 -1
  24. package/dist/src/taglib/embind-adapter.js +9 -0
  25. package/dist/src/types/metadata-mappings.d.ts.map +1 -1
  26. package/dist/src/types/metadata-mappings.js +8 -0
  27. package/dist/src/types/tags.d.ts +10 -0
  28. package/dist/src/types/tags.d.ts.map +1 -1
  29. package/dist/src/utils/tag-mapping.d.ts.map +1 -1
  30. package/dist/src/utils/tag-mapping.js +7 -0
  31. package/dist/src/version.d.ts +1 -1
  32. package/dist/src/version.js +1 -1
  33. package/dist/src/wasm.d.ts +8 -50
  34. package/dist/src/wasm.d.ts.map +1 -1
  35. package/dist/taglib-wasi.wasm +0 -0
  36. package/dist/taglib-web.wasm +0 -0
  37. package/dist/taglib-wrapper.js +1 -1
  38. package/package.json +7 -9
  39. package/dist/src/msgpack/processor.d.ts +0 -37
  40. package/dist/src/msgpack/processor.d.ts.map +0 -1
  41. package/dist/src/msgpack/processor.js +0 -69
@@ -304,8 +304,8 @@ var init_base = __esm({
304
304
  */
305
305
  constructor(code, message, details) {
306
306
  super(message);
307
- this.code = code;
308
- this.details = details;
307
+ __publicField(this, "code", code);
308
+ __publicField(this, "details", details);
309
309
  this.name = "TagLibError";
310
310
  Object.setPrototypeOf(this, _TagLibError.prototype);
311
311
  }
@@ -365,7 +365,7 @@ var init_classes = __esm({
365
365
  errorDetails.join(". "),
366
366
  { ...details, bufferSize }
367
367
  );
368
- this.bufferSize = bufferSize;
368
+ __publicField(this, "bufferSize", bufferSize);
369
369
  this.name = "InvalidFormatError";
370
370
  Object.setPrototypeOf(this, _InvalidFormatError.prototype);
371
371
  }
@@ -383,8 +383,8 @@ var init_classes = __esm({
383
383
  `Unsupported audio format: ${format}. Supported formats: ${supportedFormats.join(", ")}`,
384
384
  { ...details, format, supportedFormats }
385
385
  );
386
- this.format = format;
387
- this.supportedFormats = supportedFormats;
386
+ __publicField(this, "format", format);
387
+ __publicField(this, "supportedFormats", supportedFormats);
388
388
  this.name = "UnsupportedFormatError";
389
389
  Object.setPrototypeOf(this, _UnsupportedFormatError.prototype);
390
390
  }
@@ -408,8 +408,8 @@ var init_classes = __esm({
408
408
  errorDetails.join(". "),
409
409
  { ...details, operation, path }
410
410
  );
411
- this.operation = operation;
412
- this.path = path;
411
+ __publicField(this, "operation", operation);
412
+ __publicField(this, "path", path);
413
413
  this.name = "FileOperationError";
414
414
  Object.setPrototypeOf(this, _FileOperationError.prototype);
415
415
  }
@@ -433,8 +433,8 @@ var init_classes = __esm({
433
433
  errorDetails.join(". "),
434
434
  { ...details, operation, field }
435
435
  );
436
- this.operation = operation;
437
- this.field = field;
436
+ __publicField(this, "operation", operation);
437
+ __publicField(this, "field", field);
438
438
  this.name = "MetadataError";
439
439
  Object.setPrototypeOf(this, _MetadataError.prototype);
440
440
  }
@@ -465,9 +465,9 @@ var init_classes = __esm({
465
465
  constructor(environment, reason, requiredFeature) {
466
466
  const message = requiredFeature ? `Environment '${environment}' ${reason}. Required feature: ${requiredFeature}.` : `Environment '${environment}' ${reason}.`;
467
467
  super("ENVIRONMENT", message);
468
- this.environment = environment;
469
- this.reason = reason;
470
- this.requiredFeature = requiredFeature;
468
+ __publicField(this, "environment", environment);
469
+ __publicField(this, "reason", reason);
470
+ __publicField(this, "requiredFeature", requiredFeature);
471
471
  this.name = "EnvironmentError";
472
472
  Object.setPrototypeOf(this, _EnvironmentError.prototype);
473
473
  }
@@ -1395,7 +1395,7 @@ var init_audio_file_base = __esm({
1395
1395
  init_errors2();
1396
1396
  BaseAudioFileImpl = class {
1397
1397
  constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
1398
- this.module = module;
1398
+ __publicField(this, "module", module);
1399
1399
  __publicField(this, "fileHandle");
1400
1400
  __publicField(this, "cachedAudioProperties", null);
1401
1401
  __publicField(this, "sourcePath");
@@ -1591,6 +1591,15 @@ function wrapEmbindHandle(raw) {
1591
1591
  data ?? null
1592
1592
  );
1593
1593
  },
1594
+ hasId3Tags() {
1595
+ const v = raw.hasId3Tags();
1596
+ if (!v || typeof v !== "object") return { v1: false, v2: false };
1597
+ const o = v;
1598
+ return { v1: o.v1 === true, v2: o.v2 === true };
1599
+ },
1600
+ stripId3Tags(opts) {
1601
+ raw.stripId3Tags(opts);
1602
+ },
1594
1603
  getAudioProperties() {
1595
1604
  const pw = raw.getAudioProperties();
1596
1605
  if (!pw) return null;
@@ -1851,6 +1860,15 @@ var init_audio_file_impl = __esm({
1851
1860
  setRating(rating, email) {
1852
1861
  this.setRatings([{ rating, email, counter: 0 }]);
1853
1862
  }
1863
+ hasId3Tags() {
1864
+ return this.handle.hasId3Tags();
1865
+ }
1866
+ stripId3Tags(opts) {
1867
+ this.handle.stripId3Tags({
1868
+ v1: opts?.v1 ?? true,
1869
+ v2: opts?.v2 ?? true
1870
+ });
1871
+ }
1854
1872
  };
1855
1873
  }
1856
1874
  });
@@ -1905,6 +1923,9 @@ function mapPropertiesToExtendedTag(props) {
1905
1923
  if (tagField === "year" || tagField === "track") {
1906
1924
  const num = parseNumeric(values[0]);
1907
1925
  if (num !== void 0) tag[tagField] = num;
1926
+ if (propKey === "date") {
1927
+ tag.date = values.length === 1 ? values[0] : values;
1928
+ }
1908
1929
  } else {
1909
1930
  tag[tagField] = values;
1910
1931
  }
@@ -1945,6 +1966,9 @@ function normalizeTagInput(input) {
1945
1966
  if (input.year !== void 0) {
1946
1967
  props.date = [String(input.year)];
1947
1968
  }
1969
+ if (input.date !== void 0) {
1970
+ props.date = Array.isArray(input.date) ? input.date : [input.date];
1971
+ }
1948
1972
  if (input.track !== void 0) {
1949
1973
  props.trackNumber = [String(input.track)];
1950
1974
  }
@@ -1983,6 +2007,7 @@ var init_tag_mapping = __esm({
1983
2007
  "comment",
1984
2008
  "genre",
1985
2009
  "year",
2010
+ "date",
1986
2011
  "track"
1987
2012
  ]);
1988
2013
  NUMERIC_FIELDS = /* @__PURE__ */ new Set([
@@ -2001,7 +2026,7 @@ var VERSION;
2001
2026
  var init_version = __esm({
2002
2027
  "src/version.ts"() {
2003
2028
  "use strict";
2004
- VERSION = "1.2.0";
2029
+ VERSION = "1.2.2";
2005
2030
  }
2006
2031
  });
2007
2032
 
@@ -292,8 +292,8 @@ var init_base = __esm({
292
292
  */
293
293
  constructor(code, message, details) {
294
294
  super(message);
295
- this.code = code;
296
- this.details = details;
295
+ __publicField(this, "code", code);
296
+ __publicField(this, "details", details);
297
297
  this.name = "TagLibError";
298
298
  Object.setPrototypeOf(this, _TagLibError.prototype);
299
299
  }
@@ -353,7 +353,7 @@ var init_classes = __esm({
353
353
  errorDetails.join(". "),
354
354
  { ...details, bufferSize }
355
355
  );
356
- this.bufferSize = bufferSize;
356
+ __publicField(this, "bufferSize", bufferSize);
357
357
  this.name = "InvalidFormatError";
358
358
  Object.setPrototypeOf(this, _InvalidFormatError.prototype);
359
359
  }
@@ -371,8 +371,8 @@ var init_classes = __esm({
371
371
  `Unsupported audio format: ${format}. Supported formats: ${supportedFormats.join(", ")}`,
372
372
  { ...details, format, supportedFormats }
373
373
  );
374
- this.format = format;
375
- this.supportedFormats = supportedFormats;
374
+ __publicField(this, "format", format);
375
+ __publicField(this, "supportedFormats", supportedFormats);
376
376
  this.name = "UnsupportedFormatError";
377
377
  Object.setPrototypeOf(this, _UnsupportedFormatError.prototype);
378
378
  }
@@ -396,8 +396,8 @@ var init_classes = __esm({
396
396
  errorDetails.join(". "),
397
397
  { ...details, operation, path }
398
398
  );
399
- this.operation = operation;
400
- this.path = path;
399
+ __publicField(this, "operation", operation);
400
+ __publicField(this, "path", path);
401
401
  this.name = "FileOperationError";
402
402
  Object.setPrototypeOf(this, _FileOperationError.prototype);
403
403
  }
@@ -421,8 +421,8 @@ var init_classes = __esm({
421
421
  errorDetails.join(". "),
422
422
  { ...details, operation, field }
423
423
  );
424
- this.operation = operation;
425
- this.field = field;
424
+ __publicField(this, "operation", operation);
425
+ __publicField(this, "field", field);
426
426
  this.name = "MetadataError";
427
427
  Object.setPrototypeOf(this, _MetadataError.prototype);
428
428
  }
@@ -453,9 +453,9 @@ var init_classes = __esm({
453
453
  constructor(environment, reason, requiredFeature) {
454
454
  const message = requiredFeature ? `Environment '${environment}' ${reason}. Required feature: ${requiredFeature}.` : `Environment '${environment}' ${reason}.`;
455
455
  super("ENVIRONMENT", message);
456
- this.environment = environment;
457
- this.reason = reason;
458
- this.requiredFeature = requiredFeature;
456
+ __publicField(this, "environment", environment);
457
+ __publicField(this, "reason", reason);
458
+ __publicField(this, "requiredFeature", requiredFeature);
459
459
  this.name = "EnvironmentError";
460
460
  Object.setPrototypeOf(this, _EnvironmentError.prototype);
461
461
  }
@@ -1383,7 +1383,7 @@ var init_audio_file_base = __esm({
1383
1383
  init_errors2();
1384
1384
  BaseAudioFileImpl = class {
1385
1385
  constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
1386
- this.module = module;
1386
+ __publicField(this, "module", module);
1387
1387
  __publicField(this, "fileHandle");
1388
1388
  __publicField(this, "cachedAudioProperties", null);
1389
1389
  __publicField(this, "sourcePath");
@@ -1579,6 +1579,15 @@ function wrapEmbindHandle(raw) {
1579
1579
  data ?? null
1580
1580
  );
1581
1581
  },
1582
+ hasId3Tags() {
1583
+ const v = raw.hasId3Tags();
1584
+ if (!v || typeof v !== "object") return { v1: false, v2: false };
1585
+ const o = v;
1586
+ return { v1: o.v1 === true, v2: o.v2 === true };
1587
+ },
1588
+ stripId3Tags(opts) {
1589
+ raw.stripId3Tags(opts);
1590
+ },
1582
1591
  getAudioProperties() {
1583
1592
  const pw = raw.getAudioProperties();
1584
1593
  if (!pw) return null;
@@ -1839,6 +1848,15 @@ var init_audio_file_impl = __esm({
1839
1848
  setRating(rating, email) {
1840
1849
  this.setRatings([{ rating, email, counter: 0 }]);
1841
1850
  }
1851
+ hasId3Tags() {
1852
+ return this.handle.hasId3Tags();
1853
+ }
1854
+ stripId3Tags(opts) {
1855
+ this.handle.stripId3Tags({
1856
+ v1: opts?.v1 ?? true,
1857
+ v2: opts?.v2 ?? true
1858
+ });
1859
+ }
1842
1860
  };
1843
1861
  }
1844
1862
  });
@@ -1893,6 +1911,9 @@ function mapPropertiesToExtendedTag(props) {
1893
1911
  if (tagField === "year" || tagField === "track") {
1894
1912
  const num = parseNumeric(values[0]);
1895
1913
  if (num !== void 0) tag[tagField] = num;
1914
+ if (propKey === "date") {
1915
+ tag.date = values.length === 1 ? values[0] : values;
1916
+ }
1896
1917
  } else {
1897
1918
  tag[tagField] = values;
1898
1919
  }
@@ -1933,6 +1954,9 @@ function normalizeTagInput(input) {
1933
1954
  if (input.year !== void 0) {
1934
1955
  props.date = [String(input.year)];
1935
1956
  }
1957
+ if (input.date !== void 0) {
1958
+ props.date = Array.isArray(input.date) ? input.date : [input.date];
1959
+ }
1936
1960
  if (input.track !== void 0) {
1937
1961
  props.trackNumber = [String(input.track)];
1938
1962
  }
@@ -1971,6 +1995,7 @@ var init_tag_mapping = __esm({
1971
1995
  "comment",
1972
1996
  "genre",
1973
1997
  "year",
1998
+ "date",
1974
1999
  "track"
1975
2000
  ]);
1976
2001
  NUMERIC_FIELDS = /* @__PURE__ */ new Set([
@@ -1989,7 +2014,7 @@ var VERSION;
1989
2014
  var init_version = __esm({
1990
2015
  "src/version.ts"() {
1991
2016
  "use strict";
1992
- VERSION = "1.2.0";
2017
+ VERSION = "1.2.2";
1993
2018
  }
1994
2019
  });
1995
2020
 
@@ -18,6 +18,7 @@
18
18
  * ```
19
19
  */
20
20
  import type { Picture } from "../types.js";
21
+ import type { Chapter } from "../types/chapters.js";
21
22
  /**
22
23
  * Rating metadata representing track popularity/rating.
23
24
  * Uses normalized 0.0-1.0 scale for cross-format compatibility.
@@ -72,20 +73,6 @@ export type VariantMap = Record<string, unknown>;
72
73
  * }
73
74
  * ```
74
75
  */
75
- /**
76
- * Chapter marker metadata (ID3v2 CHAP frames).
77
- * Describes a time range within an audio file.
78
- */
79
- export interface Chapter {
80
- /** Unique element ID for the chapter */
81
- id: string;
82
- /** Start time in milliseconds */
83
- startTimeMs: number;
84
- /** End time in milliseconds */
85
- endTimeMs: number;
86
- /** Optional chapter title */
87
- title?: string;
88
- }
89
76
  export interface ComplexPropertyValueMap {
90
77
  /** Cover art and embedded images */
91
78
  PICTURE: Picture;
@@ -1 +1 @@
1
- {"version":3,"file":"complex-properties.d.ts","sourceRoot":"","sources":["../../../src/constants/complex-properties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;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AAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CACjE,CAAC;CACH;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CrB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,CAAC,IAAI,kBAAkB,GAAG,CAAC;CACtC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,qBAKzB,CAAC"}
1
+ {"version":3,"file":"complex-properties.d.ts","sourceRoot":"","sources":["../../../src/constants/complex-properties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,WAAW,MAAM;IACrB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,uBAAuB;IACtC,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,MAAM,EAAE,cAAc,CAAC;IACvB,0CAA0C;IAC1C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,uBAAuB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,EAAE,MAAM,CACd,MAAM,EACN,MAAM,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CACjE,CAAC;CACH;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CrB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,CAAC,IAAI,kBAAkB,GAAG,CAAC;CACtC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,qBAKzB,CAAC"}
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
4
  const SUPPORTED_FORMATS = [
2
5
  "MP3",
3
6
  "MP4",
@@ -16,8 +19,8 @@ class TagLibError extends Error {
16
19
  */
17
20
  constructor(code, message, details) {
18
21
  super(message);
19
- this.code = code;
20
- this.details = details;
22
+ __publicField(this, "code", code);
23
+ __publicField(this, "details", details);
21
24
  this.name = "TagLibError";
22
25
  Object.setPrototypeOf(this, TagLibError.prototype);
23
26
  }
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
4
  import { SUPPORTED_FORMATS, TagLibError } from "./base.js";
2
5
  function errorMessage(error) {
3
6
  return error instanceof Error ? error.message : String(error);
@@ -48,7 +51,7 @@ class InvalidFormatError extends TagLibError {
48
51
  errorDetails.join(". "),
49
52
  { ...details, bufferSize }
50
53
  );
51
- this.bufferSize = bufferSize;
54
+ __publicField(this, "bufferSize", bufferSize);
52
55
  this.name = "InvalidFormatError";
53
56
  Object.setPrototypeOf(this, InvalidFormatError.prototype);
54
57
  }
@@ -66,8 +69,8 @@ class UnsupportedFormatError extends TagLibError {
66
69
  `Unsupported audio format: ${format}. Supported formats: ${supportedFormats.join(", ")}`,
67
70
  { ...details, format, supportedFormats }
68
71
  );
69
- this.format = format;
70
- this.supportedFormats = supportedFormats;
72
+ __publicField(this, "format", format);
73
+ __publicField(this, "supportedFormats", supportedFormats);
71
74
  this.name = "UnsupportedFormatError";
72
75
  Object.setPrototypeOf(this, UnsupportedFormatError.prototype);
73
76
  }
@@ -91,8 +94,8 @@ class FileOperationError extends TagLibError {
91
94
  errorDetails.join(". "),
92
95
  { ...details, operation, path }
93
96
  );
94
- this.operation = operation;
95
- this.path = path;
97
+ __publicField(this, "operation", operation);
98
+ __publicField(this, "path", path);
96
99
  this.name = "FileOperationError";
97
100
  Object.setPrototypeOf(this, FileOperationError.prototype);
98
101
  }
@@ -116,8 +119,8 @@ class MetadataError extends TagLibError {
116
119
  errorDetails.join(". "),
117
120
  { ...details, operation, field }
118
121
  );
119
- this.operation = operation;
120
- this.field = field;
122
+ __publicField(this, "operation", operation);
123
+ __publicField(this, "field", field);
121
124
  this.name = "MetadataError";
122
125
  Object.setPrototypeOf(this, MetadataError.prototype);
123
126
  }
@@ -148,9 +151,9 @@ class EnvironmentError extends TagLibError {
148
151
  constructor(environment, reason, requiredFeature) {
149
152
  const message = requiredFeature ? `Environment '${environment}' ${reason}. Required feature: ${requiredFeature}.` : `Environment '${environment}' ${reason}.`;
150
153
  super("ENVIRONMENT", message);
151
- this.environment = environment;
152
- this.reason = reason;
153
- this.requiredFeature = requiredFeature;
154
+ __publicField(this, "environment", environment);
155
+ __publicField(this, "reason", reason);
156
+ __publicField(this, "requiredFeature", requiredFeature);
154
157
  this.name = "EnvironmentError";
155
158
  Object.setPrototypeOf(this, EnvironmentError.prototype);
156
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/msgpack/encoder.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,OAAO,EACP,WAAW,EACZ,MAAM,aAAa,CAAC;AAsBrB,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAiB9D;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,eAAe,GAAG,UAAU,CAS7E;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAStE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAe1D;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,UAAU,CAelE;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,IAAI,EAAE,CAAC,EACP,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,GACpC,UAAU,CAUZ;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,UAAU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,GAAG,UAAU,CAelE;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,IAAI,EAAE,CAAC,EACP,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,GACpC,UAAU,CAUZ;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,UAAU,CAe/D;AAqBD,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,UAAU,CAc1E;AAED,wBAAiB,uBAAuB,CAAC,CAAC,EACxC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,GACxB,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CActC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAS7D;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,GAC1E,UAAU,CAeZ;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAW7D;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG;IACxD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAaA"}
@@ -8,7 +8,9 @@ const PASSTHROUGH_KEYS = /* @__PURE__ */ new Set([
8
8
  "chapters",
9
9
  "_mp4ChapterStyle",
10
10
  "bextData",
11
- "ixml"
11
+ "ixml",
12
+ "id3Tags",
13
+ "_stripId3"
12
14
  ]);
13
15
  const MSGPACK_ENCODE_OPTIONS = {
14
16
  sortKeys: false,
@@ -20,8 +22,11 @@ const MSGPACK_ENCODE_OPTIONS = {
20
22
  };
21
23
  function encodeTagData(tagData) {
22
24
  try {
25
+ const dateVal = tagData.date;
26
+ const hasDate = Array.isArray(dateVal) ? dateVal.length > 0 : dateVal !== void 0 && dateVal !== null && dateVal !== "";
23
27
  const remapped = {};
24
28
  for (const [key, value] of Object.entries(tagData)) {
29
+ if (key === "year" && hasDate) continue;
25
30
  if (PASSTHROUGH_KEYS.has(key)) {
26
31
  remapped[key] = value;
27
32
  } else {
@@ -24,5 +24,4 @@ export { canEncodeToMessagePack, compareEncodingEfficiency, encodeAudioPropertie
24
24
  export type { AutoDetectionConfig, AutoDetectionResult, BatchProcessingResult, DecodingResult, EncodingResult, FormatComparison, FormatVersion, MessagePackCompatible, MessagePackData, MessagePackDataType, MessagePackError, MessagePackErrorInfo, MessagePackMetrics, MessagePackValue, StreamingConfig, TagLibMessagePackData, TagLibMessagePackMarker, ValidationResult, } from "./types.js";
25
25
  export { TAGLIB_MSGPACK_MARKERS } from "./types.js";
26
26
  export { MessagePackUtils } from "./utils.js";
27
- export { createMessagePackProcessor, debugMessagePackProcessor, defaultMessagePackProcessor, performanceMessagePackProcessor, } from "./processor.js";
28
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/msgpack/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/msgpack/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -27,19 +27,11 @@ import {
27
27
  } from "./encoder.js";
28
28
  import { TAGLIB_MSGPACK_MARKERS } from "./types.js";
29
29
  import { MessagePackUtils } from "./utils.js";
30
- import {
31
- createMessagePackProcessor,
32
- debugMessagePackProcessor,
33
- defaultMessagePackProcessor,
34
- performanceMessagePackProcessor
35
- } from "./processor.js";
36
30
  export {
37
31
  MessagePackUtils,
38
32
  TAGLIB_MSGPACK_MARKERS,
39
33
  canEncodeToMessagePack,
40
34
  compareEncodingEfficiency,
41
- createMessagePackProcessor,
42
- debugMessagePackProcessor,
43
35
  decodeAudioProperties,
44
36
  decodeFastTagData,
45
37
  decodeMessagePack,
@@ -48,7 +40,6 @@ export {
48
40
  decodePictureArray,
49
41
  decodePropertyMap,
50
42
  decodeTagData,
51
- defaultMessagePackProcessor,
52
43
  encodeAudioProperties,
53
44
  encodeBatchTagData,
54
45
  encodeFastTagData,
@@ -61,6 +52,5 @@ export {
61
52
  encodeTagData,
62
53
  estimateMessagePackSize,
63
54
  getMessagePackInfo,
64
- isValidMessagePack,
65
- performanceMessagePackProcessor
55
+ isValidMessagePack
66
56
  };
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
4
  import { TagLibError } from "../../errors/base.js";
2
5
  class UnifiedLoaderError extends TagLibError {
3
6
  constructor(message, cause) {
@@ -10,7 +13,7 @@ class UnifiedLoaderError extends TagLibError {
10
13
  class ModuleLoadError extends TagLibError {
11
14
  constructor(message, wasmType, cause) {
12
15
  super("MODULE_LOAD", message, cause ? { cause, wasmType } : { wasmType });
13
- this.wasmType = wasmType;
16
+ __publicField(this, "wasmType", wasmType);
14
17
  this.name = "ModuleLoadError";
15
18
  if (cause) this.cause = cause;
16
19
  Object.setPrototypeOf(this, ModuleLoadError.prototype);
@@ -41,6 +41,14 @@ export declare class WasiFileHandle implements FileHandle {
41
41
  setBextData(data: Uint8Array | null): void;
42
42
  getIxml(): string | undefined;
43
43
  setIxml(data: string | null): void;
44
+ hasId3Tags(): {
45
+ v1: boolean;
46
+ v2: boolean;
47
+ };
48
+ stripId3Tags(opts: {
49
+ v1: boolean;
50
+ v2: boolean;
51
+ }): void;
44
52
  getRatings(): {
45
53
  rating: number;
46
54
  email: string;
@@ -1 +1 @@
1
- {"version":3,"file":"file-handle.d.ts","sourceRoot":"","sources":["../../../../src/runtime/wasi-adapter/file-handle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AA8DhE,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,SAAS,CAAS;gBAEd,UAAU,EAAE,UAAU;IAIlC,OAAO,CAAC,iBAAiB;IAQzB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAW3C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAWnC,OAAO,IAAI,OAAO;IAMlB,IAAI,IAAI,OAAO;IAqBf,UAAU,IAAI,YAAY;IAc1B,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;IAK7C,kB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,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,GAC9D,IAAI;IAaP,OAAO,IAAI,IAAI;CAKhB"}
@@ -49,9 +49,12 @@ const CONTAINER_TO_FORMAT = {
49
49
  Matroska: "MATROSKA"
50
50
  };
51
51
  const NUMERIC_FIELD_ALIASES = {
52
- date: "year",
53
52
  trackNumber: "track"
54
53
  };
54
+ function hasValue(v) {
55
+ if (Array.isArray(v)) return v.length > 0;
56
+ return v !== void 0 && v !== null && v !== "";
57
+ }
55
58
  function firstString(v) {
56
59
  if (Array.isArray(v)) return v[0] ?? "";
57
60
  return v || "";
@@ -123,7 +126,12 @@ class WasiFileHandle {
123
126
  }
124
127
  setTagData(data) {
125
128
  this.checkNotDestroyed();
126
- this.tagData = { ...this.tagData, ...data };
129
+ const merged = { ...this.tagData, ...data };
130
+ if (data.year !== void 0) {
131
+ if (data.year > 0) merged.date = String(data.year);
132
+ else delete merged.date;
133
+ }
134
+ this.tagData = merged;
127
135
  }
128
136
  getAudioProperties() {
129
137
  this.checkNotDestroyed();
@@ -195,6 +203,7 @@ class WasiFileHandle {
195
203
  const data = this.tagData ?? {};
196
204
  for (const [key, value] of Object.entries(data)) {
197
205
  if (AUDIO_KEYS.has(key) || INTERNAL_KEYS.has(key)) continue;
206
+ if (key === "year" && hasValue(data.date)) continue;
198
207
  if (value === void 0 || value === null) continue;
199
208
  if (value === 0 || value === "") continue;
200
209
  const propKey = toTagLibKey(key);
@@ -214,9 +223,13 @@ class WasiFileHandle {
214
223
  for (const [key, values] of Object.entries(props)) {
215
224
  const camelKey = fromTagLibKey(key);
216
225
  const storeKey = NUMERIC_FIELD_ALIASES[camelKey] ?? camelKey;
217
- if (storeKey === "year" || storeKey === "track") {
226
+ if (storeKey === "track") {
218
227
  const parsed = Number.parseInt(values[0] ?? "", 10);
219
228
  if (!Number.isNaN(parsed)) mapped[storeKey] = parsed;
229
+ } else if (camelKey === "date") {
230
+ mapped.date = values;
231
+ const year = Number.parseInt(values[0] ?? "", 10);
232
+ if (!Number.isNaN(year)) mapped.year = year;
220
233
  } else {
221
234
  mapped[camelKey] = values;
222
235
  }
@@ -233,11 +246,18 @@ class WasiFileHandle {
233
246
  this.checkNotDestroyed();
234
247
  const mappedKey = fromTagLibKey(key);
235
248
  const storeKey = NUMERIC_FIELD_ALIASES[mappedKey] ?? mappedKey;
236
- if (storeKey === "year" || storeKey === "track") {
249
+ if (storeKey === "track") {
237
250
  const parsed = Number.parseInt(value, 10);
238
251
  if (!Number.isNaN(parsed)) {
239
252
  this.tagData = { ...this.tagData, [storeKey]: parsed };
240
253
  }
254
+ } else if (mappedKey === "date") {
255
+ const year = Number.parseInt(value, 10);
256
+ this.tagData = {
257
+ ...this.tagData,
258
+ date: value,
259
+ ...Number.isNaN(year) ? {} : { year }
260
+ };
241
261
  } else {
242
262
  this.tagData = { ...this.tagData, [mappedKey]: value };
243
263
  }
@@ -314,6 +334,27 @@ class WasiFileHandle {
314
334
  this.checkNotDestroyed();
315
335
  this.tagData = { ...this.tagData, ixml: data };
316
336
  }
337
+ hasId3Tags() {
338
+ this.checkNotDestroyed();
339
+ const t = this.tagData?.id3Tags;
340
+ return { v1: t?.v1 ?? false, v2: t?.v2 ?? false };
341
+ }
342
+ stripId3Tags(opts) {
343
+ this.checkNotDestroyed();
344
+ const current = this.tagData?.id3Tags;
345
+ if (!current) return;
346
+ const prior = this.tagData?._stripId3;
347
+ const stripV1 = (prior?.v1 ?? false) || opts.v1;
348
+ const stripV2 = (prior?.v2 ?? false) || opts.v2;
349
+ this.tagData = {
350
+ ...this.tagData,
351
+ _stripId3: { v1: stripV1, v2: stripV2 },
352
+ id3Tags: {
353
+ v1: (current.v1 ?? false) && !stripV1,
354
+ v2: (current.v2 ?? false) && !stripV2
355
+ }
356
+ };
357
+ }
317
358
  getRatings() {
318
359
  this.checkNotDestroyed();
319
360
  return this.tagData?.ratings ?? [];
@@ -1,6 +1,9 @@
1
+ var __defProp = Object.defineProperty;
1
2
  var __typeError = (msg) => {
2
3
  throw TypeError(msg);
3
4
  };
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
7
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -180,8 +183,8 @@ class WasmMemoryError extends TagLibError {
180
183
  "WASM_MEMORY",
181
184
  `${operation}: ${message}${errorCode === void 0 ? "" : ` (code ${errorCode})`}`
182
185
  );
183
- this.operation = operation;
184
- this.errorCode = errorCode;
186
+ __publicField(this, "operation", operation);
187
+ __publicField(this, "errorCode", errorCode);
185
188
  this.name = "WasmMemoryError";
186
189
  Object.setPrototypeOf(this, WasmMemoryError.prototype);
187
190
  }
@@ -5,7 +5,7 @@ import { remapKeysFromTagLib, toTagLibKey } from "../constants/properties.js";
5
5
  import { MetadataError, UnsupportedFormatError } from "../errors.js";
6
6
  class BaseAudioFileImpl {
7
7
  constructor(module, fileHandle, sourcePath, originalSource, isPartiallyLoaded = false, partialLoadOptions) {
8
- this.module = module;
8
+ __publicField(this, "module", module);
9
9
  __publicField(this, "fileHandle");
10
10
  __publicField(this, "cachedAudioProperties", null);
11
11
  __publicField(this, "sourcePath");