trackparse 0.2.1 → 0.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/README.md +87 -5
- package/dist/chunk-3TS4DITR.js +2314 -0
- package/dist/index.cjs +73 -6
- package/dist/index.d.cts +4 -86
- package/dist/index.d.ts +4 -86
- package/dist/index.js +3 -2189
- package/dist/tracklist.cjs +3135 -0
- package/dist/tracklist.d.cts +114 -0
- package/dist/tracklist.d.ts +114 -0
- package/dist/tracklist.js +827 -0
- package/dist/types-DqJSn18b.d.cts +87 -0
- package/dist/types-DqJSn18b.d.ts +87 -0
- package/package.json +15 -4
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Public types. They mirror spec/schema/parsed-track.schema.json and options.schema.json. */
|
|
2
|
+
/** R2 / R13.6: `tracklist` is only used when asked for (never resolved from `auto`). */
|
|
3
|
+
type Mode = "clean" | "youtube" | "filename" | "tracklist";
|
|
4
|
+
type ModeOption = Mode | "auto";
|
|
5
|
+
type ArtistRole = "primary" | "featured" | "remixer" | "producer";
|
|
6
|
+
type ArtistSource = "artist" | "title" | "version";
|
|
7
|
+
interface Artist {
|
|
8
|
+
name: string;
|
|
9
|
+
role: ArtistRole;
|
|
10
|
+
/** Raw joiner / marker text that preceded the name in its credit list; `null` for the first name. */
|
|
11
|
+
joiner: string | null;
|
|
12
|
+
source: ArtistSource;
|
|
13
|
+
}
|
|
14
|
+
type VersionType = "remix" | "bootleg" | "vip" | "edit" | "flip" | "refix" | "rework" | "mashup" | "blend" | "dub" | "mix" | "extended" | "radio" | "club" | "original" | "instrumental" | "acapella" | "live" | "acoustic" | "remaster" | "demo" | "reprise" | "cover" | "version" | "spedUp" | "slowed" | "nightcore";
|
|
15
|
+
type VersionDelimiter = "(" | "[" | "{" | "-";
|
|
16
|
+
interface Version {
|
|
17
|
+
type: VersionType;
|
|
18
|
+
raw: string;
|
|
19
|
+
artists: Artist[];
|
|
20
|
+
modifiers: string[];
|
|
21
|
+
descriptor: string | null;
|
|
22
|
+
year: number | null;
|
|
23
|
+
unknownArtist: boolean;
|
|
24
|
+
delimiter: VersionDelimiter;
|
|
25
|
+
}
|
|
26
|
+
type JunkKind = "video" | "audio" | "lyrics" | "quality" | "promo" | "platform" | "label" | "genre" | "other";
|
|
27
|
+
interface Junk {
|
|
28
|
+
raw: string;
|
|
29
|
+
kind: JunkKind;
|
|
30
|
+
}
|
|
31
|
+
type Warning = "noSeparator" | "ambiguousSeparator" | "unspacedDashSplit" | "asymmetricDashSplit" | "bySplit" | "quotedTitleSplit" | "ambiguousMixCredit" | "unbalancedBrackets";
|
|
32
|
+
interface Flags {
|
|
33
|
+
explicit: boolean;
|
|
34
|
+
clean: boolean;
|
|
35
|
+
unknownArtist: boolean;
|
|
36
|
+
unknownTitle: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface Position {
|
|
39
|
+
raw: string;
|
|
40
|
+
number: number;
|
|
41
|
+
}
|
|
42
|
+
interface Timestamp {
|
|
43
|
+
raw: string;
|
|
44
|
+
seconds: number;
|
|
45
|
+
}
|
|
46
|
+
interface ParsedTrack {
|
|
47
|
+
input: string;
|
|
48
|
+
mode: Mode;
|
|
49
|
+
position: Position | null;
|
|
50
|
+
timestamp: Timestamp | null;
|
|
51
|
+
artists: Artist[];
|
|
52
|
+
title: string;
|
|
53
|
+
fullTitle: string;
|
|
54
|
+
versions: Version[];
|
|
55
|
+
year: number | null;
|
|
56
|
+
flags: Flags;
|
|
57
|
+
junk: Junk[];
|
|
58
|
+
warnings: Warning[];
|
|
59
|
+
}
|
|
60
|
+
interface KeywordOptions {
|
|
61
|
+
/** Extra version heads: key → version type. */
|
|
62
|
+
versionHeads?: Record<string, VersionType>;
|
|
63
|
+
descriptors?: string[];
|
|
64
|
+
genres?: string[];
|
|
65
|
+
/** Extra junk phrases: phrase → kind. */
|
|
66
|
+
junk?: Record<string, JunkKind>;
|
|
67
|
+
featMarkers?: string[];
|
|
68
|
+
}
|
|
69
|
+
interface ParseOptions {
|
|
70
|
+
mode?: ModeOption;
|
|
71
|
+
/** youtube mode: channel name used as the artist when no separator is found (R6.8). */
|
|
72
|
+
uploader?: string;
|
|
73
|
+
/** Names that must never be split (R7.3a). */
|
|
74
|
+
knownArtists?: string[];
|
|
75
|
+
splitAnd?: "auto" | "always" | "never";
|
|
76
|
+
keywords?: KeywordOptions;
|
|
77
|
+
}
|
|
78
|
+
interface FormatOptions {
|
|
79
|
+
feat?: "source" | "artist" | "title" | "omit";
|
|
80
|
+
featMarker?: string;
|
|
81
|
+
joiners?: "original" | "canonical";
|
|
82
|
+
versions?: "all" | "none";
|
|
83
|
+
producers?: boolean;
|
|
84
|
+
position?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type { Artist as A, FormatOptions as F, Junk as J, KeywordOptions as K, Mode as M, ParsedTrack as P, Timestamp as T, Version as V, Warning as W, ParseOptions as a, ArtistRole as b, ArtistSource as c, Flags as d, JunkKind as e, ModeOption as f, Position as g, VersionDelimiter as h, VersionType as i };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Public types. They mirror spec/schema/parsed-track.schema.json and options.schema.json. */
|
|
2
|
+
/** R2 / R13.6: `tracklist` is only used when asked for (never resolved from `auto`). */
|
|
3
|
+
type Mode = "clean" | "youtube" | "filename" | "tracklist";
|
|
4
|
+
type ModeOption = Mode | "auto";
|
|
5
|
+
type ArtistRole = "primary" | "featured" | "remixer" | "producer";
|
|
6
|
+
type ArtistSource = "artist" | "title" | "version";
|
|
7
|
+
interface Artist {
|
|
8
|
+
name: string;
|
|
9
|
+
role: ArtistRole;
|
|
10
|
+
/** Raw joiner / marker text that preceded the name in its credit list; `null` for the first name. */
|
|
11
|
+
joiner: string | null;
|
|
12
|
+
source: ArtistSource;
|
|
13
|
+
}
|
|
14
|
+
type VersionType = "remix" | "bootleg" | "vip" | "edit" | "flip" | "refix" | "rework" | "mashup" | "blend" | "dub" | "mix" | "extended" | "radio" | "club" | "original" | "instrumental" | "acapella" | "live" | "acoustic" | "remaster" | "demo" | "reprise" | "cover" | "version" | "spedUp" | "slowed" | "nightcore";
|
|
15
|
+
type VersionDelimiter = "(" | "[" | "{" | "-";
|
|
16
|
+
interface Version {
|
|
17
|
+
type: VersionType;
|
|
18
|
+
raw: string;
|
|
19
|
+
artists: Artist[];
|
|
20
|
+
modifiers: string[];
|
|
21
|
+
descriptor: string | null;
|
|
22
|
+
year: number | null;
|
|
23
|
+
unknownArtist: boolean;
|
|
24
|
+
delimiter: VersionDelimiter;
|
|
25
|
+
}
|
|
26
|
+
type JunkKind = "video" | "audio" | "lyrics" | "quality" | "promo" | "platform" | "label" | "genre" | "other";
|
|
27
|
+
interface Junk {
|
|
28
|
+
raw: string;
|
|
29
|
+
kind: JunkKind;
|
|
30
|
+
}
|
|
31
|
+
type Warning = "noSeparator" | "ambiguousSeparator" | "unspacedDashSplit" | "asymmetricDashSplit" | "bySplit" | "quotedTitleSplit" | "ambiguousMixCredit" | "unbalancedBrackets";
|
|
32
|
+
interface Flags {
|
|
33
|
+
explicit: boolean;
|
|
34
|
+
clean: boolean;
|
|
35
|
+
unknownArtist: boolean;
|
|
36
|
+
unknownTitle: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface Position {
|
|
39
|
+
raw: string;
|
|
40
|
+
number: number;
|
|
41
|
+
}
|
|
42
|
+
interface Timestamp {
|
|
43
|
+
raw: string;
|
|
44
|
+
seconds: number;
|
|
45
|
+
}
|
|
46
|
+
interface ParsedTrack {
|
|
47
|
+
input: string;
|
|
48
|
+
mode: Mode;
|
|
49
|
+
position: Position | null;
|
|
50
|
+
timestamp: Timestamp | null;
|
|
51
|
+
artists: Artist[];
|
|
52
|
+
title: string;
|
|
53
|
+
fullTitle: string;
|
|
54
|
+
versions: Version[];
|
|
55
|
+
year: number | null;
|
|
56
|
+
flags: Flags;
|
|
57
|
+
junk: Junk[];
|
|
58
|
+
warnings: Warning[];
|
|
59
|
+
}
|
|
60
|
+
interface KeywordOptions {
|
|
61
|
+
/** Extra version heads: key → version type. */
|
|
62
|
+
versionHeads?: Record<string, VersionType>;
|
|
63
|
+
descriptors?: string[];
|
|
64
|
+
genres?: string[];
|
|
65
|
+
/** Extra junk phrases: phrase → kind. */
|
|
66
|
+
junk?: Record<string, JunkKind>;
|
|
67
|
+
featMarkers?: string[];
|
|
68
|
+
}
|
|
69
|
+
interface ParseOptions {
|
|
70
|
+
mode?: ModeOption;
|
|
71
|
+
/** youtube mode: channel name used as the artist when no separator is found (R6.8). */
|
|
72
|
+
uploader?: string;
|
|
73
|
+
/** Names that must never be split (R7.3a). */
|
|
74
|
+
knownArtists?: string[];
|
|
75
|
+
splitAnd?: "auto" | "always" | "never";
|
|
76
|
+
keywords?: KeywordOptions;
|
|
77
|
+
}
|
|
78
|
+
interface FormatOptions {
|
|
79
|
+
feat?: "source" | "artist" | "title" | "omit";
|
|
80
|
+
featMarker?: string;
|
|
81
|
+
joiners?: "original" | "canonical";
|
|
82
|
+
versions?: "all" | "none";
|
|
83
|
+
producers?: boolean;
|
|
84
|
+
position?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type { Artist as A, FormatOptions as F, Junk as J, KeywordOptions as K, Mode as M, ParsedTrack as P, Timestamp as T, Version as V, Warning as W, ParseOptions as a, ArtistRole as b, ArtistSource as c, Flags as d, JunkKind as e, ModeOption as f, Position as g, VersionDelimiter as h, VersionType as i };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trackparse",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Spec-driven parser for music track strings: artists, feat credits, remixes/versions, junk and more from single track strings (store titles, YouTube titles, filenames).",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Spec-driven parser for music track strings: artists, feat credits, remixes/versions, junk and more from single track strings (store titles, YouTube titles, filenames) and multi-line tracklists.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Maksim Maksimov",
|
|
7
7
|
"repository": {
|
|
@@ -45,6 +45,16 @@
|
|
|
45
45
|
"default": "./dist/index.cjs"
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
+
"./tracklist": {
|
|
49
|
+
"import": {
|
|
50
|
+
"types": "./dist/tracklist.d.ts",
|
|
51
|
+
"default": "./dist/tracklist.js"
|
|
52
|
+
},
|
|
53
|
+
"require": {
|
|
54
|
+
"types": "./dist/tracklist.d.cts",
|
|
55
|
+
"default": "./dist/tracklist.cjs"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
48
58
|
"./package.json": "./package.json"
|
|
49
59
|
},
|
|
50
60
|
"scripts": {
|
|
@@ -55,8 +65,9 @@
|
|
|
55
65
|
"typecheck": "tsc --noEmit",
|
|
56
66
|
"lint": "biome check .",
|
|
57
67
|
"conformance": "tsx scripts/conformance.ts",
|
|
58
|
-
"check:package": "publint && attw --pack .",
|
|
59
|
-
"compat": "node scripts/compat.mjs"
|
|
68
|
+
"check:package": "publint && attw --pack . --profile node16",
|
|
69
|
+
"compat": "node scripts/compat.mjs",
|
|
70
|
+
"size": "node scripts/size-check.mjs"
|
|
60
71
|
},
|
|
61
72
|
"devDependencies": {
|
|
62
73
|
"@arethetypeswrong/cli": "^0.18.5",
|