chordsheetjs 7.8.0 → 7.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 +81 -9
- package/lib/bundle.js +52 -3
- package/lib/index.js +52 -3
- package/lib/index.js.map +1 -1
- package/lib/main.d.ts +46 -2
- package/lib/main.d.ts.map +1 -1
- package/lib/module.js +52 -3
- package/lib/module.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -387,10 +387,44 @@ PDF conversion.</p></dd>
|
|
|
387
387
|
<dd><p>Formats a song into a plain text chord sheet</p></dd>
|
|
388
388
|
<dt><a href="#ChordProParser">ChordProParser</a></dt>
|
|
389
389
|
<dd><p>Parses a ChordPro chord sheet</p></dd>
|
|
390
|
-
<dt><a href="#ChordSheetParser">ChordSheetParser</a></dt>
|
|
391
|
-
<dd><p>Parses a normal chord sheet</p
|
|
390
|
+
<dt><del><a href="#ChordSheetParser">ChordSheetParser</a></del></dt>
|
|
391
|
+
<dd><p>Parses a normal chord sheet</p>
|
|
392
|
+
<p>ChordSheetParser is deprecated, please use ChordsOverWordsParser.</p>
|
|
393
|
+
<p>ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
|
|
394
|
+
support for many variations. Besides that, some chordpro feature have been ported back
|
|
395
|
+
to ChordsOverWordsParser, which adds some interesting functionality.</p></dd>
|
|
392
396
|
<dt><a href="#ChordsOverWordsParser">ChordsOverWordsParser</a></dt>
|
|
393
|
-
<dd><p>Parses a chords over words sheet</p
|
|
397
|
+
<dd><p>Parses a chords over words sheet into a song</p>
|
|
398
|
+
<p>It support "regular" chord sheets:</p>
|
|
399
|
+
<pre><code> Am C/G F C
|
|
400
|
+
Let it be, let it be, let it be, let it be
|
|
401
|
+
C G F C/E Dm C
|
|
402
|
+
Whisper words of wisdom, let it be
|
|
403
|
+
</code></pre>
|
|
404
|
+
<p>Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:</p>
|
|
405
|
+
<pre><code>{title: Let it be}
|
|
406
|
+
{key: C}
|
|
407
|
+
Chorus 1:
|
|
408
|
+
Am
|
|
409
|
+
Let it be
|
|
410
|
+
</code></pre>
|
|
411
|
+
<p>For convenience, you can leave out the brackets:</p>
|
|
412
|
+
<pre><code>title: Let it be
|
|
413
|
+
Chorus 1:
|
|
414
|
+
Am
|
|
415
|
+
Let it be
|
|
416
|
+
</code></pre>
|
|
417
|
+
<p>You can even use a markdown style frontmatter separator to separate the header from the song:</p>
|
|
418
|
+
<pre><code>title: Let it be
|
|
419
|
+
key: C
|
|
420
|
+
---
|
|
421
|
+
Chorus 1:
|
|
422
|
+
Am C/G F C
|
|
423
|
+
Let it be, let it be, let it be, let it be
|
|
424
|
+
C G F C/E Dm C
|
|
425
|
+
Whisper words of wisdom, let it be
|
|
426
|
+
</code></pre>
|
|
427
|
+
<p><code>ChordsOverWordsParser</code> is the better version of <code>ChordSheetParser</code>, which is deprecated.</p></dd>
|
|
394
428
|
<dt><a href="#ParserWarning">ParserWarning</a></dt>
|
|
395
429
|
<dd><p>Represents a parser warning, currently only used by ChordProParser.</p></dd>
|
|
396
430
|
<dt><a href="#PegBasedParser">PegBasedParser</a></dt>
|
|
@@ -1092,19 +1126,26 @@ PDF conversion.</p>
|
|
|
1092
1126
|
|
|
1093
1127
|
<a name="ChordSheetParser"></a>
|
|
1094
1128
|
|
|
1095
|
-
## ChordSheetParser
|
|
1129
|
+
## ~~ChordSheetParser~~
|
|
1130
|
+
***Deprecated***
|
|
1131
|
+
|
|
1096
1132
|
<p>Parses a normal chord sheet</p>
|
|
1133
|
+
<p>ChordSheetParser is deprecated, please use ChordsOverWordsParser.</p>
|
|
1134
|
+
<p>ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
|
|
1135
|
+
support for many variations. Besides that, some chordpro feature have been ported back
|
|
1136
|
+
to ChordsOverWordsParser, which adds some interesting functionality.</p>
|
|
1097
1137
|
|
|
1098
1138
|
**Kind**: global class
|
|
1099
1139
|
|
|
1100
|
-
* [ChordSheetParser](#ChordSheetParser)
|
|
1140
|
+
* ~~[ChordSheetParser](#ChordSheetParser)~~
|
|
1101
1141
|
* [new ChordSheetParser([options])](#new_ChordSheetParser_new)
|
|
1102
1142
|
* [.parse(chordSheet, [options])](#ChordSheetParser+parse) ⇒ [<code>Song</code>](#Song)
|
|
1103
1143
|
|
|
1104
1144
|
<a name="new_ChordSheetParser_new"></a>
|
|
1105
1145
|
|
|
1106
1146
|
### new ChordSheetParser([options])
|
|
1107
|
-
<p>Instantiate a chord sheet parser
|
|
1147
|
+
<p>Instantiate a chord sheet parser
|
|
1148
|
+
ChordSheetParser is deprecated, please use ChordsOverWordsParser.</p>
|
|
1108
1149
|
|
|
1109
1150
|
|
|
1110
1151
|
| Param | Type | Default | Description |
|
|
@@ -1129,7 +1170,37 @@ PDF conversion.</p>
|
|
|
1129
1170
|
<a name="ChordsOverWordsParser"></a>
|
|
1130
1171
|
|
|
1131
1172
|
## ChordsOverWordsParser
|
|
1132
|
-
<p>Parses a chords over words sheet</p>
|
|
1173
|
+
<p>Parses a chords over words sheet into a song</p>
|
|
1174
|
+
<p>It support "regular" chord sheets:</p>
|
|
1175
|
+
<pre><code> Am C/G F C
|
|
1176
|
+
Let it be, let it be, let it be, let it be
|
|
1177
|
+
C G F C/E Dm C
|
|
1178
|
+
Whisper words of wisdom, let it be
|
|
1179
|
+
</code></pre>
|
|
1180
|
+
<p>Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:</p>
|
|
1181
|
+
<pre><code>{title: Let it be}
|
|
1182
|
+
{key: C}
|
|
1183
|
+
Chorus 1:
|
|
1184
|
+
Am
|
|
1185
|
+
Let it be
|
|
1186
|
+
</code></pre>
|
|
1187
|
+
<p>For convenience, you can leave out the brackets:</p>
|
|
1188
|
+
<pre><code>title: Let it be
|
|
1189
|
+
Chorus 1:
|
|
1190
|
+
Am
|
|
1191
|
+
Let it be
|
|
1192
|
+
</code></pre>
|
|
1193
|
+
<p>You can even use a markdown style frontmatter separator to separate the header from the song:</p>
|
|
1194
|
+
<pre><code>title: Let it be
|
|
1195
|
+
key: C
|
|
1196
|
+
---
|
|
1197
|
+
Chorus 1:
|
|
1198
|
+
Am C/G F C
|
|
1199
|
+
Let it be, let it be, let it be, let it be
|
|
1200
|
+
C G F C/E Dm C
|
|
1201
|
+
Whisper words of wisdom, let it be
|
|
1202
|
+
</code></pre>
|
|
1203
|
+
<p><code>ChordsOverWordsParser</code> is the better version of <code>ChordSheetParser</code>, which is deprecated.</p>
|
|
1133
1204
|
|
|
1134
1205
|
**Kind**: global class
|
|
1135
1206
|
<a name="ChordsOverWordsParser+parse"></a>
|
|
@@ -1388,13 +1459,14 @@ of the root note. For example, <code>Em/A#</code> becomes <code>Em/Bb</code>.</p
|
|
|
1388
1459
|
<a name="Chord.parse"></a>
|
|
1389
1460
|
|
|
1390
1461
|
### Chord.parse(chordString) ⇒ [<code>Chord</code>](#Chord) \| <code>null</code>
|
|
1391
|
-
<p>Tries to parse a chord string into a chord
|
|
1462
|
+
<p>Tries to parse a chord string into a chord
|
|
1463
|
+
Any leading or trailing whitespace is removed first, so a chord like <code> \n E/G# \r</code> is valid.</p>
|
|
1392
1464
|
|
|
1393
1465
|
**Kind**: static method of [<code>Chord</code>](#Chord)
|
|
1394
1466
|
|
|
1395
1467
|
| Param | Description |
|
|
1396
1468
|
| --- | --- |
|
|
1397
|
-
| chordString | <p>the chord string, eg <code>Esus4/G#</code> or <code>1sus4/#3</code
|
|
1469
|
+
| chordString | <p>the chord string, eg <code>Esus4/G#</code> or <code>1sus4/#3</code>.</p> |
|
|
1398
1470
|
|
|
1399
1471
|
<a name="ChordSheetSerializer"></a>
|
|
1400
1472
|
|
package/lib/bundle.js
CHANGED
|
@@ -2395,7 +2395,8 @@ function $26f57998457eb2d4$var$normalizeChordSuffix(suffix) {
|
|
|
2395
2395
|
*/ class $26f57998457eb2d4$var$Chord {
|
|
2396
2396
|
/**
|
|
2397
2397
|
* Tries to parse a chord string into a chord
|
|
2398
|
-
*
|
|
2398
|
+
* Any leading or trailing whitespace is removed first, so a chord like ` \n E/G# \r ` is valid.
|
|
2399
|
+
* @param chordString the chord string, eg `Esus4/G#` or `1sus4/#3`.
|
|
2399
2400
|
* @returns {Chord|null}
|
|
2400
2401
|
*/ static parse(chordString) {
|
|
2401
2402
|
try {
|
|
@@ -2405,7 +2406,7 @@ function $26f57998457eb2d4$var$normalizeChordSuffix(suffix) {
|
|
|
2405
2406
|
}
|
|
2406
2407
|
}
|
|
2407
2408
|
static parseOrFail(chordString) {
|
|
2408
|
-
const ast = (0, $ea7c5d4e4ce912f8$export$98e6a39c04603d36)(chordString);
|
|
2409
|
+
const ast = (0, $ea7c5d4e4ce912f8$export$98e6a39c04603d36)(chordString.trim());
|
|
2409
2410
|
return new $26f57998457eb2d4$var$Chord(ast);
|
|
2410
2411
|
}
|
|
2411
2412
|
/**
|
|
@@ -5597,6 +5598,12 @@ const $c049675f48c823b2$var$WHITE_SPACE = /\s/;
|
|
|
5597
5598
|
const $c049675f48c823b2$var$CHORD_LINE_REGEX = /^\s*((([A-G])(#|b)?([^/\s]*)(\/([A-G])(#|b)?)?)(\s|$)+)+(\s|$)+/;
|
|
5598
5599
|
/**
|
|
5599
5600
|
* Parses a normal chord sheet
|
|
5601
|
+
*
|
|
5602
|
+
* ChordSheetParser is deprecated, please use ChordsOverWordsParser.
|
|
5603
|
+
*
|
|
5604
|
+
* ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
|
|
5605
|
+
* support for many variations. Besides that, some chordpro feature have been ported back
|
|
5606
|
+
* to ChordsOverWordsParser, which adds some interesting functionality.
|
|
5600
5607
|
*/ class $c049675f48c823b2$var$ChordSheetParser {
|
|
5601
5608
|
processingText = true;
|
|
5602
5609
|
preserveWhitespace = true;
|
|
@@ -5608,9 +5615,16 @@ const $c049675f48c823b2$var$CHORD_LINE_REGEX = /^\s*((([A-G])(#|b)?([^/\s]*)(\/(
|
|
|
5608
5615
|
lineCount = 0;
|
|
5609
5616
|
/**
|
|
5610
5617
|
* Instantiate a chord sheet parser
|
|
5618
|
+
* ChordSheetParser is deprecated, please use ChordsOverWordsParser.
|
|
5611
5619
|
* @param {Object} [options={}] options
|
|
5612
5620
|
* @param {boolean} [options.preserveWhitespace=true] whether to preserve trailing whitespace for chords
|
|
5621
|
+
* @deprecated
|
|
5613
5622
|
*/ constructor({ preserveWhitespace: preserveWhitespace = true } = {}){
|
|
5623
|
+
(0, $21a34a464e7bc609$export$b680e6b2c82f8c2f)(`ChordSheetParser is deprecated, please use ChordsOverWordsParser.
|
|
5624
|
+
|
|
5625
|
+
ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
|
|
5626
|
+
support for many variations. Besides that, some chordpro feature have been ported back
|
|
5627
|
+
to ChordsOverWordsParser, which adds some interesting functionality.`);
|
|
5614
5628
|
this.preserveWhitespace = preserveWhitespace;
|
|
5615
5629
|
}
|
|
5616
5630
|
/**
|
|
@@ -7469,7 +7483,42 @@ const $3df1df9cc0f1cab9$export$98e6a39c04603d36 = $3df1df9cc0f1cab9$var$peg$pars
|
|
|
7469
7483
|
|
|
7470
7484
|
|
|
7471
7485
|
/**
|
|
7472
|
-
* Parses a chords over words sheet
|
|
7486
|
+
* Parses a chords over words sheet into a song
|
|
7487
|
+
*
|
|
7488
|
+
* It support "regular" chord sheets:
|
|
7489
|
+
*
|
|
7490
|
+
* Am C/G F C
|
|
7491
|
+
* Let it be, let it be, let it be, let it be
|
|
7492
|
+
* C G F C/E Dm C
|
|
7493
|
+
* Whisper words of wisdom, let it be
|
|
7494
|
+
*
|
|
7495
|
+
* Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:
|
|
7496
|
+
*
|
|
7497
|
+
* {title: Let it be}
|
|
7498
|
+
* {key: C}
|
|
7499
|
+
* Chorus 1:
|
|
7500
|
+
* Am
|
|
7501
|
+
* Let it be
|
|
7502
|
+
*
|
|
7503
|
+
* For convenience, you can leave out the brackets:
|
|
7504
|
+
*
|
|
7505
|
+
* title: Let it be
|
|
7506
|
+
* Chorus 1:
|
|
7507
|
+
* Am
|
|
7508
|
+
* Let it be
|
|
7509
|
+
*
|
|
7510
|
+
* You can even use a markdown style frontmatter separator to separate the header from the song:
|
|
7511
|
+
*
|
|
7512
|
+
* title: Let it be
|
|
7513
|
+
* key: C
|
|
7514
|
+
* ---
|
|
7515
|
+
* Chorus 1:
|
|
7516
|
+
* Am C/G F C
|
|
7517
|
+
* Let it be, let it be, let it be, let it be
|
|
7518
|
+
* C G F C/E Dm C
|
|
7519
|
+
* Whisper words of wisdom, let it be
|
|
7520
|
+
*
|
|
7521
|
+
* `ChordsOverWordsParser` is the better version of `ChordSheetParser`, which is deprecated.
|
|
7473
7522
|
*/ class $c5e7c9181f4c1376$var$ChordsOverWordsParser extends (0, $6af2b7a7ad6b2cba$export$2e2bcd8739ae039) {
|
|
7474
7523
|
/**
|
|
7475
7524
|
* Parses a chords over words sheet into a song
|
package/lib/index.js
CHANGED
|
@@ -2394,7 +2394,8 @@ function $26f57998457eb2d4$var$normalizeChordSuffix(suffix) {
|
|
|
2394
2394
|
*/ class $26f57998457eb2d4$var$Chord {
|
|
2395
2395
|
/**
|
|
2396
2396
|
* Tries to parse a chord string into a chord
|
|
2397
|
-
*
|
|
2397
|
+
* Any leading or trailing whitespace is removed first, so a chord like ` \n E/G# \r ` is valid.
|
|
2398
|
+
* @param chordString the chord string, eg `Esus4/G#` or `1sus4/#3`.
|
|
2398
2399
|
* @returns {Chord|null}
|
|
2399
2400
|
*/ static parse(chordString) {
|
|
2400
2401
|
try {
|
|
@@ -2404,7 +2405,7 @@ function $26f57998457eb2d4$var$normalizeChordSuffix(suffix) {
|
|
|
2404
2405
|
}
|
|
2405
2406
|
}
|
|
2406
2407
|
static parseOrFail(chordString) {
|
|
2407
|
-
const ast = (0, $ea7c5d4e4ce912f8$export$98e6a39c04603d36)(chordString);
|
|
2408
|
+
const ast = (0, $ea7c5d4e4ce912f8$export$98e6a39c04603d36)(chordString.trim());
|
|
2408
2409
|
return new $26f57998457eb2d4$var$Chord(ast);
|
|
2409
2410
|
}
|
|
2410
2411
|
/**
|
|
@@ -5596,6 +5597,12 @@ const $c049675f48c823b2$var$WHITE_SPACE = /\s/;
|
|
|
5596
5597
|
const $c049675f48c823b2$var$CHORD_LINE_REGEX = /^\s*((([A-G])(#|b)?([^/\s]*)(\/([A-G])(#|b)?)?)(\s|$)+)+(\s|$)+/;
|
|
5597
5598
|
/**
|
|
5598
5599
|
* Parses a normal chord sheet
|
|
5600
|
+
*
|
|
5601
|
+
* ChordSheetParser is deprecated, please use ChordsOverWordsParser.
|
|
5602
|
+
*
|
|
5603
|
+
* ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
|
|
5604
|
+
* support for many variations. Besides that, some chordpro feature have been ported back
|
|
5605
|
+
* to ChordsOverWordsParser, which adds some interesting functionality.
|
|
5599
5606
|
*/ class $c049675f48c823b2$var$ChordSheetParser {
|
|
5600
5607
|
processingText = true;
|
|
5601
5608
|
preserveWhitespace = true;
|
|
@@ -5607,9 +5614,16 @@ const $c049675f48c823b2$var$CHORD_LINE_REGEX = /^\s*((([A-G])(#|b)?([^/\s]*)(\/(
|
|
|
5607
5614
|
lineCount = 0;
|
|
5608
5615
|
/**
|
|
5609
5616
|
* Instantiate a chord sheet parser
|
|
5617
|
+
* ChordSheetParser is deprecated, please use ChordsOverWordsParser.
|
|
5610
5618
|
* @param {Object} [options={}] options
|
|
5611
5619
|
* @param {boolean} [options.preserveWhitespace=true] whether to preserve trailing whitespace for chords
|
|
5620
|
+
* @deprecated
|
|
5612
5621
|
*/ constructor({ preserveWhitespace: preserveWhitespace = true } = {}){
|
|
5622
|
+
(0, $21a34a464e7bc609$export$b680e6b2c82f8c2f)(`ChordSheetParser is deprecated, please use ChordsOverWordsParser.
|
|
5623
|
+
|
|
5624
|
+
ChordsOverWordsParser aims to support any kind of chord, whereas ChordSheetParser lacks
|
|
5625
|
+
support for many variations. Besides that, some chordpro feature have been ported back
|
|
5626
|
+
to ChordsOverWordsParser, which adds some interesting functionality.`);
|
|
5613
5627
|
this.preserveWhitespace = preserveWhitespace;
|
|
5614
5628
|
}
|
|
5615
5629
|
/**
|
|
@@ -7468,7 +7482,42 @@ const $3df1df9cc0f1cab9$export$98e6a39c04603d36 = $3df1df9cc0f1cab9$var$peg$pars
|
|
|
7468
7482
|
|
|
7469
7483
|
|
|
7470
7484
|
/**
|
|
7471
|
-
* Parses a chords over words sheet
|
|
7485
|
+
* Parses a chords over words sheet into a song
|
|
7486
|
+
*
|
|
7487
|
+
* It support "regular" chord sheets:
|
|
7488
|
+
*
|
|
7489
|
+
* Am C/G F C
|
|
7490
|
+
* Let it be, let it be, let it be, let it be
|
|
7491
|
+
* C G F C/E Dm C
|
|
7492
|
+
* Whisper words of wisdom, let it be
|
|
7493
|
+
*
|
|
7494
|
+
* Additionally, some chordpro features have been "ported back". For example, you can use chordpro directives:
|
|
7495
|
+
*
|
|
7496
|
+
* {title: Let it be}
|
|
7497
|
+
* {key: C}
|
|
7498
|
+
* Chorus 1:
|
|
7499
|
+
* Am
|
|
7500
|
+
* Let it be
|
|
7501
|
+
*
|
|
7502
|
+
* For convenience, you can leave out the brackets:
|
|
7503
|
+
*
|
|
7504
|
+
* title: Let it be
|
|
7505
|
+
* Chorus 1:
|
|
7506
|
+
* Am
|
|
7507
|
+
* Let it be
|
|
7508
|
+
*
|
|
7509
|
+
* You can even use a markdown style frontmatter separator to separate the header from the song:
|
|
7510
|
+
*
|
|
7511
|
+
* title: Let it be
|
|
7512
|
+
* key: C
|
|
7513
|
+
* ---
|
|
7514
|
+
* Chorus 1:
|
|
7515
|
+
* Am C/G F C
|
|
7516
|
+
* Let it be, let it be, let it be, let it be
|
|
7517
|
+
* C G F C/E Dm C
|
|
7518
|
+
* Whisper words of wisdom, let it be
|
|
7519
|
+
*
|
|
7520
|
+
* `ChordsOverWordsParser` is the better version of `ChordSheetParser`, which is deprecated.
|
|
7472
7521
|
*/ class $c5e7c9181f4c1376$var$ChordsOverWordsParser extends (0, $6af2b7a7ad6b2cba$export$2e2bcd8739ae039) {
|
|
7473
7522
|
/**
|
|
7474
7523
|
* Parses a chords over words sheet into a song
|