@sequencemedia/music-library-parser 1.1.105 → 1.1.106

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequencemedia/music-library-parser",
3
- "version": "1.1.105",
3
+ "version": "1.1.106",
4
4
  "description": "Parse Apple Music Library XML to JSON, JS, ES, or M3U",
5
5
  "keywords": [
6
6
  "music",
@@ -48,16 +48,14 @@
48
48
  "rimraf": "^6.0.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@babel/core": "^7.27.1",
52
- "@babel/preset-env": "^7.27.2",
53
51
  "@sequencemedia/eslint-config-standard": "^0.2.56",
54
- "core-js": "^3.42.0",
55
52
  "eslint": "^9.26.0",
56
53
  "globals": "^16.1.0",
57
54
  "husky": "^9.1.7"
58
55
  },
59
56
  "imports": {
60
57
  "#music-library-parser": "./src/js/index.mjs",
61
- "#music-library-parser/*": "./src/js/*/index.mjs"
58
+ "#music-library-parser/*": "./src/js/*/index.mjs",
59
+ "#where-am-i": "./where-am-i.mjs"
62
60
  }
63
61
  }
@@ -2,11 +2,10 @@ import {
2
2
  exec
3
3
  } from 'node:child_process'
4
4
 
5
- import path from 'path'
6
-
7
5
  import {
8
- fileURLToPath
9
- } from 'url'
6
+ resolve,
7
+ join
8
+ } from 'node:path'
10
9
 
11
10
  import debug from 'debug'
12
11
 
@@ -14,19 +13,24 @@ import {
14
13
  clear
15
14
  } from '#music-library-parser'
16
15
 
16
+ import hereIAm from '#where-am-i'
17
+
17
18
  const log = debug('@sequencemedia/music-library-parser:to-m3u')
18
19
  const error = debug('@sequencemedia/music-library-parser:to-m3u:error')
19
20
 
20
- const cwd = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..')
21
- const xsl = path.resolve(cwd, 'src/xsl/library.xsl')
21
+ const xsl = join(hereIAm, 'src/xsl/library.xsl')
22
22
 
23
23
  let immediate = null
24
24
  const queue = []
25
25
 
26
26
  export function parse (jar, xml, destination = './Music Library') {
27
+ const j = resolve(jar)
28
+ const x = resolve(xml)
29
+ const d = resolve(destination)
30
+
27
31
  return (
28
32
  new Promise((resolve, reject) => {
29
- exec(`java -jar "${path.resolve(jar)}" -s:"${path.resolve(xml)}" -xsl:"${xsl}" destination="${path.resolve(destination)}"`, { cwd }, (e) => (!e) ? resolve() : reject(e))
33
+ exec(`java -jar "${j}" -s:"${x}" -xsl:"${xsl}" destination="${d}"`, { cwd: hereIAm }, (e) => (!e) ? resolve() : reject(e))
30
34
  })
31
35
  )
32
36
  }
@@ -2,11 +2,10 @@ import {
2
2
  exec
3
3
  } from 'node:child_process'
4
4
 
5
- import path from 'path'
6
-
7
5
  import {
8
- fileURLToPath
9
- } from 'url'
6
+ resolve,
7
+ join
8
+ } from 'node:path'
10
9
 
11
10
  import debug from 'debug'
12
11
 
@@ -14,19 +13,24 @@ import {
14
13
  clear
15
14
  } from '#music-library-parser'
16
15
 
16
+ import hereIAm from '#where-am-i'
17
+
17
18
  const log = debug('@sequencemedia/music-library-parser:to-m3u')
18
19
  const error = debug('@sequencemedia/music-library-parser:to-m3u:error')
19
20
 
20
- const cwd = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../..')
21
- const xsl = path.resolve(cwd, 'src/xsl/library/playlists.xsl')
21
+ const xsl = join(hereIAm, 'src/xsl/library/playlists.xsl')
22
22
 
23
23
  let immediate = null
24
24
  const queue = []
25
25
 
26
26
  export function parse (jar, xml, destination = './Music Library') {
27
+ const j = resolve(jar)
28
+ const x = resolve(xml)
29
+ const d = resolve(destination)
30
+
27
31
  return (
28
32
  new Promise((resolve, reject) => {
29
- exec(`java -jar "${path.resolve(jar)}" -s:"${path.resolve(xml)}" -xsl:"${xsl}" destination="${path.resolve(destination)}"`, { cwd }, (e) => (!e) ? resolve() : reject(e))
33
+ exec(`java -jar "${j}" -s:"${x}" -xsl:"${xsl}" destination="${d}"`, { cwd: hereIAm }, (e) => (!e) ? resolve() : reject(e))
30
34
  })
31
35
  )
32
36
  }
@@ -2,15 +2,14 @@ import {
2
2
  exec
3
3
  } from 'node:child_process'
4
4
 
5
- import path from 'path'
6
-
7
5
  import {
8
- fileURLToPath
9
- } from 'url'
6
+ resolve,
7
+ join
8
+ } from 'node:path'
10
9
 
11
10
  import {
12
11
  readFile
13
- } from 'fs/promises'
12
+ } from 'node:fs/promises'
14
13
 
15
14
  import debug from 'debug'
16
15
 
@@ -18,19 +17,24 @@ import {
18
17
  transform
19
18
  } from '#music-library-parser/transform'
20
19
 
20
+ import hereIAm from '#where-am-i'
21
+
21
22
  const error = debug('@sequencemedia/music-library-parser:to-json:error')
22
23
 
23
- const cwd = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..')
24
- const xsl = path.resolve(cwd, 'src/xsl/library/tracks/to-json.xsl')
25
- const DESTINATION = path.resolve(cwd, '.music-library/playlists.json')
24
+ const xsl = join(hereIAm, 'src/xsl/library/tracks/to-json.xsl')
25
+ const DESTINATION = join(hereIAm, '.music-library/playlists.json')
26
26
 
27
27
  /**
28
28
  * `maxBuffer`
29
29
  */
30
30
  export function parse (jar, xml, destination = DESTINATION) {
31
+ const j = resolve(jar)
32
+ const x = resolve(xml)
33
+ const d = resolve(destination)
34
+
31
35
  return (
32
36
  new Promise((resolve, reject) => {
33
- exec(`java -jar "${path.resolve(jar)}" -s:"${path.resolve(xml)}" -xsl:"${xsl}" -o:"${destination}"`, { cwd }, (e) => (!e) ? resolve() : reject(e))
37
+ exec(`java -jar "${j}" -s:"${x}" -xsl:"${xsl}" -o:"${d}"`, { cwd: hereIAm }, (e) => (!e) ? resolve() : reject(e))
34
38
  })
35
39
  )
36
40
  }
@@ -2,11 +2,10 @@ import {
2
2
  exec
3
3
  } from 'node:child_process'
4
4
 
5
- import path from 'path'
6
-
7
5
  import {
8
- fileURLToPath
9
- } from 'url'
6
+ resolve,
7
+ join
8
+ } from 'node:path'
10
9
 
11
10
  import debug from 'debug'
12
11
 
@@ -14,19 +13,24 @@ import {
14
13
  clear
15
14
  } from '#music-library-parser'
16
15
 
16
+ import hereIAm from '#where-am-i'
17
+
17
18
  const log = debug('@sequencemedia/music-library-parser:to-m3u')
18
19
  const error = debug('@sequencemedia/music-library-parser:to-m3u:error')
19
20
 
20
- const cwd = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../..')
21
- const xsl = path.resolve(cwd, 'src/xsl/library/tracks.xsl')
21
+ const xsl = join(hereIAm, 'src/xsl/library/tracks.xsl')
22
22
 
23
23
  let immediate = null
24
24
  const queue = []
25
25
 
26
26
  export function parse (jar, xml, destination = './Music Library') {
27
+ const j = resolve(jar)
28
+ const x = resolve(xml)
29
+ const d = resolve(destination)
30
+
27
31
  return (
28
32
  new Promise((resolve, reject) => {
29
- exec(`java -jar "${path.resolve(jar)}" -s:"${path.resolve(xml)}" -xsl:"${xsl}" destination="${path.resolve(destination)}"`, { cwd }, (e) => (!e) ? resolve() : reject(e))
33
+ exec(`java -jar "${j}" -s:"${x}" -xsl:"${xsl}" destination="${d}"`, { cwd: hereIAm }, (e) => (!e) ? resolve() : reject(e))
30
34
  })
31
35
  )
32
36
  }
@@ -2,15 +2,14 @@ import {
2
2
  exec
3
3
  } from 'node:child_process'
4
4
 
5
- import path from 'path'
6
-
7
5
  import {
8
- fileURLToPath
9
- } from 'url'
6
+ resolve,
7
+ join
8
+ } from 'node:path'
10
9
 
11
10
  import {
12
11
  readFile
13
- } from 'fs/promises'
12
+ } from 'node:fs/promises'
14
13
 
15
14
  import debug from 'debug'
16
15
 
@@ -18,19 +17,24 @@ import {
18
17
  transform
19
18
  } from '#music-library-parser/transform'
20
19
 
20
+ import hereIAm from '#where-am-i'
21
+
21
22
  const error = debug('@sequencemedia/music-library-parser:to-json:error')
22
23
 
23
- const cwd = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..')
24
- const xsl = path.resolve(cwd, 'src/xsl/library/tracks/to-json.xsl')
25
- const DESTINATION = path.resolve(cwd, '.music-library/tracks.json')
24
+ const xsl = join(hereIAm, 'src/xsl/library/tracks/to-json.xsl')
25
+ const DESTINATION = join(hereIAm, '.music-library/tracks.json')
26
26
 
27
27
  /**
28
28
  * `maxBuffer`
29
29
  */
30
30
  export function parse (jar, xml, destination = DESTINATION) {
31
+ const j = resolve(jar)
32
+ const x = resolve(xml)
33
+ const d = resolve(destination)
34
+
31
35
  return (
32
36
  new Promise((resolve, reject) => {
33
- exec(`java -jar "${path.resolve(jar)}" -s:"${path.resolve(xml)}" -xsl:"${xsl}" -o:"${destination}"`, { cwd }, (e) => (!e) ? resolve() : reject(e))
37
+ exec(`java -jar "${j}" -s:"${x}" -xsl:"${xsl}" -o:"${d}"`, { cwd: hereIAm }, (e) => (!e) ? resolve() : reject(e))
34
38
  })
35
39
  )
36
40
  }
@@ -2,15 +2,14 @@ import {
2
2
  exec
3
3
  } from 'node:child_process'
4
4
 
5
- import path from 'path'
6
-
7
5
  import {
8
- fileURLToPath
9
- } from 'url'
6
+ resolve,
7
+ join
8
+ } from 'node:path'
10
9
 
11
10
  import {
12
11
  readFile
13
- } from 'fs/promises'
12
+ } from 'node:fs/promises'
14
13
 
15
14
  import debug from 'debug'
16
15
 
@@ -18,19 +17,24 @@ import {
18
17
  transform
19
18
  } from '#music-library-parser/transform'
20
19
 
20
+ import hereIAm from '#where-am-i'
21
+
21
22
  const error = debug('@sequencemedia/music-library-parser:to-json:error')
22
23
 
23
- const cwd = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../..')
24
- const xsl = path.resolve(cwd, 'src/xsl/library/to-json.xsl')
25
- const DESTINATION = path.resolve(cwd, '.music-library.json')
24
+ const xsl = join(hereIAm, 'src/xsl/library/to-json.xsl')
25
+ const DESTINATION = join(hereIAm, '.music-library.json')
26
26
 
27
27
  /**
28
28
  * `maxBuffer`
29
29
  */
30
30
  export function parse (jar, xml, destination = DESTINATION) {
31
+ const j = resolve(jar)
32
+ const x = resolve(xml)
33
+ const d = resolve(destination)
34
+
31
35
  return (
32
36
  new Promise((resolve, reject) => {
33
- exec(`java -jar "${path.resolve(jar)}" -s:"${path.resolve(xml)}" -xsl:"${xsl}" -o:"${destination}"`, { cwd }, (e) => (!e) ? resolve() : reject(e))
37
+ exec(`java -jar "${j}" -s:"${x}" -xsl:"${xsl}" -o:"${d}"`, { cwd: hereIAm }, (e) => (!e) ? resolve() : reject(e))
34
38
  })
35
39
  )
36
40
  }
package/where-am-i.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ dirname
3
+ } from 'node:path'
4
+
5
+ import {
6
+ fileURLToPath
7
+ } from 'node:url'
8
+
9
+ export default dirname(fileURLToPath(import.meta.url))
package/babel.config.cjs DELETED
@@ -1,14 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- [
4
- '@babel/env',
5
- {
6
- targets: {
7
- node: 'current'
8
- },
9
- useBuiltIns: 'usage',
10
- corejs: 3
11
- }
12
- ]
13
- ]
14
- }