music-metadata 10.8.2 → 10.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -5
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -771,17 +771,30 @@ Dependency list:
|
|
|
771
771
|
|
|
772
772
|
## CommonJS backward compatibility
|
|
773
773
|
|
|
774
|
-
|
|
774
|
+
Using Node.js ≥ 22, which is support loading ESM module via require
|
|
775
775
|
```js
|
|
776
|
-
const
|
|
776
|
+
const mm = require('music-metadata');
|
|
777
|
+
```
|
|
777
778
|
|
|
779
|
+
For older Node.js version < 22, you need to dynamically import **music-metadata**:
|
|
780
|
+
```js
|
|
778
781
|
(async () => {
|
|
779
782
|
// Dynamically loads the ESM module in a CommonJS project
|
|
780
|
-
const mm = await
|
|
781
|
-
|
|
782
|
-
const metadata = await mm.parseFile('/path/to/your/file');
|
|
783
|
+
const mm = await import('music-metadata');
|
|
783
784
|
})();
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
For CommonJS TypeScript projects, using a Node.js version < 22, you can use [load-esm](https://github.com/Borewit/load-esm):
|
|
788
|
+
|
|
789
|
+
This method shall replace the embedded CJS loader `loadMusicMetadata()` function.
|
|
784
790
|
|
|
791
|
+
```js
|
|
792
|
+
import {loadEsm} from 'load-esm';
|
|
793
|
+
|
|
794
|
+
(async () => {
|
|
795
|
+
// Dynamically loads the ESM module in a CommonJS project
|
|
796
|
+
const mm = await loadEsm<typeof import('music-metadata')>('music-metadata');
|
|
797
|
+
})();
|
|
785
798
|
```
|
|
786
799
|
|
|
787
800
|
> [!NOTE]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "music-metadata",
|
|
3
3
|
"description": "Music metadata parser for Node.js, supporting virtual any audio and tag format.",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.9.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Borewit",
|
|
7
7
|
"url": "https://github.com/Borewit"
|
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
".": {
|
|
22
22
|
"node": {
|
|
23
23
|
"import": "./lib/index.js",
|
|
24
|
+
"module-sync": "./lib/index.js",
|
|
24
25
|
"require": "./lib/node.cjs",
|
|
25
26
|
"types": "./lib/index.d.ts"
|
|
26
27
|
},
|
|
27
28
|
"default": {
|
|
28
29
|
"import": "./lib/core.js",
|
|
30
|
+
"module-sync": "./lib/index.js",
|
|
29
31
|
"require": "./lib/default.cjs",
|
|
30
32
|
"types": "./lib/core.d.ts"
|
|
31
33
|
}
|
|
@@ -111,7 +113,7 @@
|
|
|
111
113
|
"file-type": "^19.6.0",
|
|
112
114
|
"link": "^2.1.1",
|
|
113
115
|
"media-typer": "^1.1.0",
|
|
114
|
-
"strtok3": "^10.2.
|
|
116
|
+
"strtok3": "^10.2.1",
|
|
115
117
|
"token-types": "^6.0.0",
|
|
116
118
|
"uint8array-extras": "^1.4.0"
|
|
117
119
|
},
|
|
@@ -123,7 +125,7 @@
|
|
|
123
125
|
"@types/debug": "^4.1.12",
|
|
124
126
|
"@types/media-typer": "^1.1.3",
|
|
125
127
|
"@types/mocha": "^10.0.10",
|
|
126
|
-
"@types/node": "^22.
|
|
128
|
+
"@types/node": "^22.13.1",
|
|
127
129
|
"c8": "^10.1.3",
|
|
128
130
|
"chai": "^5.1.2",
|
|
129
131
|
"chai-as-promised": "^8.0.1",
|
|
@@ -131,7 +133,7 @@
|
|
|
131
133
|
"mime": "^4.0.6",
|
|
132
134
|
"mocha": "^11.1.0",
|
|
133
135
|
"remark-cli": "^12.0.1",
|
|
134
|
-
"remark-preset-lint-consistent": "^6.0.
|
|
136
|
+
"remark-preset-lint-consistent": "^6.0.1",
|
|
135
137
|
"ts-node": "^10.9.2",
|
|
136
138
|
"typescript": "^5.7.3"
|
|
137
139
|
},
|
|
@@ -139,8 +141,7 @@
|
|
|
139
141
|
"node": ">=18"
|
|
140
142
|
},
|
|
141
143
|
"repository": {
|
|
142
|
-
"type": "git"
|
|
143
|
-
"url": "git+https://github.com/borewit/music-metadata.git"
|
|
144
|
+
"type": "https://github.com/borewit/music-metadata.git"
|
|
144
145
|
},
|
|
145
146
|
"license": "MIT",
|
|
146
147
|
"bugs": {
|