musicxml-io 0.5.4 → 0.5.6
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -5
- package/dist/index.mjs +27 -5
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { V as ValidateOptions, a as ValidationResult } from './index-8MkN7sbm.mj
|
|
|
4
4
|
export { ba as AddArticulationOptions, bj as AddBeamOptions, c8 as AddBowingOptions, ch as AddBreathMarkOptions, ck as AddCaesuraOptions, aW as AddChordOptions, c2 as AddChordSymbolOptions, bS as AddCodaOptions, bc as AddDynamicsOptions, bM as AddEndingOptions, bz as AddFermataOptions, c5 as AddFingeringOptions, bU as AddGraceNoteOptions, b$ as AddHarmonyOptions, bX as AddLyricOptions, bT as AddNavigationOptions, cd as AddOctaveShiftOptions, bB as AddOrnamentOptions, b2 as AddPartOptions, bD as AddPedalOptions, bH as AddRehearsalMarkOptions, bI as AddRepeatBarlineOptions, bK as AddRepeatOptions, bR as AddSegnoOptions, b8 as AddSlurOptions, ca as AddStringNumberOptions, bu as AddTempoOptions, bF as AddTextDirectionOptions, bG as AddTextOptions, b6 as AddTieOptions, b1 as AddVoiceOptions, bx as AddWedgeOptions, bl as AutoBeamOptions, bQ as BarStyle, c7 as BowingType, cg as BreathMarkValue, cj as CaesuraValue, bO as ChangeBarlineOptions, bg as ChangeClefOptions, aX as ChangeNoteDurationOptions, bW as ConvertToGraceOptions, br as CopyNotesMultiMeasureOptions, bo as CopyNotesOptions, bh as CreateTupletOptions, bq as CutNotesOptions, b3 as DuplicatePartOptions, b_ as HarmonyKind, bf as InsertClefChangeOptions, aU as InsertNoteOptions, cM as LocalValidateOptions, b0 as LowerAccidentalOptions, cL as MeasureValidationContext, be as ModifyDynamicsOptions, bw as ModifyTempoOptions, b5 as MoveNoteToStaffOptions, bs as MultiMeasureSelection, bn as NoteSelection, cc as OctaveShiftType, aT as OperationErrorCode, aS as OperationResult, bt as PasteNotesMultiMeasureOptions, bp as PasteNotesOptions, a$ as RaiseAccidentalOptions, bb as RemoveArticulationOptions, bk as RemoveBeamOptions, c9 as RemoveBowingOptions, ci as RemoveBreathMarkOptions, cl as RemoveCaesuraOptions, c3 as RemoveChordSymbolOptions, bd as RemoveDynamicsOptions, bN as RemoveEndingOptions, bA as RemoveFermataOptions, c6 as RemoveFingeringOptions, bV as RemoveGraceNoteOptions, c0 as RemoveHarmonyOptions, bY as RemoveLyricOptions, aV as RemoveNoteOptions, cf as RemoveOctaveShiftOptions, bC as RemoveOrnamentOptions, bE as RemovePedalOptions, bJ as RemoveRepeatBarlineOptions, bL as RemoveRepeatOptions, b9 as RemoveSlurOptions, cb as RemoveStringNumberOptions, bv as RemoveTempoOptions, b7 as RemoveTieOptions, bi as RemoveTupletOptions, by as RemoveWedgeOptions, bP as SetBarlineOptions, bm as SetBeamingOptions, aZ as SetNotePitchBySemitoneOptions, aY as SetNotePitchOptions, b4 as SetStavesOptions, a_ as ShiftNotePitchOptions, ce as StopOctaveShiftOptions, c4 as UpdateChordSymbolOptions, c1 as UpdateHarmonyOptions, bZ as UpdateLyricOptions, cH as ValidationError, cJ as ValidationErrorCode, cD as ValidationException, cK as ValidationLevel, cI as ValidationLocation, K as addArticulation, T as addBeam, aH as addBowing, aO as addBreathMark, aQ as addCaesura, b as addChord, j as addChordNote, p as addChordNoteChecked, aC as addChordSymbol, ao as addCoda, ap as addDaCapo, aq as addDalSegno, M as addDynamics, aj as addEnding, a6 as addFermata, ar as addFine, aF as addFingering, at as addGraceNote, az as addHarmony, aw as addLyric, g as addNote, n as addNoteChecked, aL as addOctaveShift, a8 as addOrnament, x as addPart, aa as addPedal, ae as addRehearsalMark, ah as addRepeat, af as addRepeatBarline, an as addSegno, I as addSlur, aJ as addStringNumber, a1 as addTempo, ad as addText, ac as addTextDirection, G as addTie, as as addToCoda, w as addVoice, a4 as addWedge, cG as assertMeasureValid, co as assertValid, W as autoBeam, al as changeBarline, Q as changeClef, C as changeKey, e as changeNoteDuration, D as changeTime, av as convertToGrace, Y as copyNotes, $ as copyNotesMultiMeasure, R as createTuplet, _ as cutNotes, F as deleteMeasure, h as deleteNote, o as deleteNoteChecked, z as duplicatePart, cC as formatLocation, cF as getMeasureContext, P as insertClefChange, E as insertMeasure, i as insertNote, cn as isValid, l as lowerAccidental, O as modifyDynamics, k as modifyNoteDuration, u as modifyNoteDurationChecked, m as modifyNotePitch, q as modifyNotePitchChecked, a3 as modifyTempo, B as moveNoteToStaff, Z as pasteNotes, a0 as pasteNotesMultiMeasure, f as raiseAccidental, L as removeArticulation, U as removeBeam, aI as removeBowing, aP as removeBreathMark, aR as removeCaesura, aD as removeChordSymbol, N as removeDynamics, ak as removeEnding, a7 as removeFermata, aG as removeFingering, au as removeGraceNote, aA as removeHarmony, ax as removeLyric, r as removeNote, aN as removeOctaveShift, a9 as removeOrnament, y as removePart, ab as removePedal, ai as removeRepeat, ag as removeRepeatBarline, J as removeSlur, aK as removeStringNumber, a2 as removeTempo, H as removeTie, S as removeTuplet, a5 as removeWedge, am as setBarline, X as setBeaming, s as setNotePitch, c as setNotePitchBySemitone, A as setStaves, d as shiftNotePitch, aM as stopOctaveShift, t as transpose, v as transposeChecked, aE as updateChordSymbol, aB as updateHarmony, ay as updateLyric, cm as validate, cr as validateBackupForward, ct as validateBeams, cp as validateDivisions, cq as validateMeasureDuration, cE as validateMeasureLocal, cw as validatePartReferences, cx as validatePartStructure, cu as validateSlurs, cB as validateSlursAcrossMeasures, cy as validateStaffStructure, cs as validateTies, cA as validateTiesAcrossMeasures, cv as validateTuplets, cz as validateVoiceStaff } from './index-8MkN7sbm.mjs';
|
|
5
5
|
export { FindNotesFilter, NormalizedPositionOptions, PitchRange, RoundtripMetrics, VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, getAbsolutePosition, getAdjacentNotes, getAllNotes, getAttributesAtMeasure, getBeamGroups, getChordProgression, getChords, getClefChanges, getClefForStaff, getDirections, getDirectionsAtPosition, getDivisions, getDuration, getDynamics, getEffectiveStaff, getEndings, getEntriesAtPosition, getEntriesForStaff, getEntriesInRange, getHarmonies, getHarmonyAtPosition, getKeyChanges, getLyricText, getLyrics, getMeasure, getMeasureByIndex, getMeasureCount, getNextNote, getNormalizedDuration, getNormalizedPosition, getNotesAtPosition, getNotesForStaff, getNotesForVoice, getNotesInRange, getOctaveShifts, getPartById, getPartByIndex, getPartCount, getPartIds, getPartIndex, getPedalMarkings, getPrevNote, getRepeatStructure, getSlurSpans, getStaffRange, getStaveCount, getStaves, getStructuralChanges, getTempoMarkings, getTiedNoteGroups, getTimeChanges, getTupletGroups, getVerseCount, getVerticalSlice, getVoiceLine, getVoiceLineInRange, getVoices, getVoicesForStaff, getWedges, groupByStaff, groupByVoice, hasMultipleStaves, hasNotes, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions } from './query/index.mjs';
|
|
6
6
|
|
|
7
|
-
declare function parse(
|
|
7
|
+
declare function parse(input: string | Uint8Array): Score;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Parse a compressed MusicXML (.mxl) file
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { V as ValidateOptions, a as ValidationResult } from './index-DxLMCMTr.js
|
|
|
4
4
|
export { ba as AddArticulationOptions, bj as AddBeamOptions, c8 as AddBowingOptions, ch as AddBreathMarkOptions, ck as AddCaesuraOptions, aW as AddChordOptions, c2 as AddChordSymbolOptions, bS as AddCodaOptions, bc as AddDynamicsOptions, bM as AddEndingOptions, bz as AddFermataOptions, c5 as AddFingeringOptions, bU as AddGraceNoteOptions, b$ as AddHarmonyOptions, bX as AddLyricOptions, bT as AddNavigationOptions, cd as AddOctaveShiftOptions, bB as AddOrnamentOptions, b2 as AddPartOptions, bD as AddPedalOptions, bH as AddRehearsalMarkOptions, bI as AddRepeatBarlineOptions, bK as AddRepeatOptions, bR as AddSegnoOptions, b8 as AddSlurOptions, ca as AddStringNumberOptions, bu as AddTempoOptions, bF as AddTextDirectionOptions, bG as AddTextOptions, b6 as AddTieOptions, b1 as AddVoiceOptions, bx as AddWedgeOptions, bl as AutoBeamOptions, bQ as BarStyle, c7 as BowingType, cg as BreathMarkValue, cj as CaesuraValue, bO as ChangeBarlineOptions, bg as ChangeClefOptions, aX as ChangeNoteDurationOptions, bW as ConvertToGraceOptions, br as CopyNotesMultiMeasureOptions, bo as CopyNotesOptions, bh as CreateTupletOptions, bq as CutNotesOptions, b3 as DuplicatePartOptions, b_ as HarmonyKind, bf as InsertClefChangeOptions, aU as InsertNoteOptions, cM as LocalValidateOptions, b0 as LowerAccidentalOptions, cL as MeasureValidationContext, be as ModifyDynamicsOptions, bw as ModifyTempoOptions, b5 as MoveNoteToStaffOptions, bs as MultiMeasureSelection, bn as NoteSelection, cc as OctaveShiftType, aT as OperationErrorCode, aS as OperationResult, bt as PasteNotesMultiMeasureOptions, bp as PasteNotesOptions, a$ as RaiseAccidentalOptions, bb as RemoveArticulationOptions, bk as RemoveBeamOptions, c9 as RemoveBowingOptions, ci as RemoveBreathMarkOptions, cl as RemoveCaesuraOptions, c3 as RemoveChordSymbolOptions, bd as RemoveDynamicsOptions, bN as RemoveEndingOptions, bA as RemoveFermataOptions, c6 as RemoveFingeringOptions, bV as RemoveGraceNoteOptions, c0 as RemoveHarmonyOptions, bY as RemoveLyricOptions, aV as RemoveNoteOptions, cf as RemoveOctaveShiftOptions, bC as RemoveOrnamentOptions, bE as RemovePedalOptions, bJ as RemoveRepeatBarlineOptions, bL as RemoveRepeatOptions, b9 as RemoveSlurOptions, cb as RemoveStringNumberOptions, bv as RemoveTempoOptions, b7 as RemoveTieOptions, bi as RemoveTupletOptions, by as RemoveWedgeOptions, bP as SetBarlineOptions, bm as SetBeamingOptions, aZ as SetNotePitchBySemitoneOptions, aY as SetNotePitchOptions, b4 as SetStavesOptions, a_ as ShiftNotePitchOptions, ce as StopOctaveShiftOptions, c4 as UpdateChordSymbolOptions, c1 as UpdateHarmonyOptions, bZ as UpdateLyricOptions, cH as ValidationError, cJ as ValidationErrorCode, cD as ValidationException, cK as ValidationLevel, cI as ValidationLocation, K as addArticulation, T as addBeam, aH as addBowing, aO as addBreathMark, aQ as addCaesura, b as addChord, j as addChordNote, p as addChordNoteChecked, aC as addChordSymbol, ao as addCoda, ap as addDaCapo, aq as addDalSegno, M as addDynamics, aj as addEnding, a6 as addFermata, ar as addFine, aF as addFingering, at as addGraceNote, az as addHarmony, aw as addLyric, g as addNote, n as addNoteChecked, aL as addOctaveShift, a8 as addOrnament, x as addPart, aa as addPedal, ae as addRehearsalMark, ah as addRepeat, af as addRepeatBarline, an as addSegno, I as addSlur, aJ as addStringNumber, a1 as addTempo, ad as addText, ac as addTextDirection, G as addTie, as as addToCoda, w as addVoice, a4 as addWedge, cG as assertMeasureValid, co as assertValid, W as autoBeam, al as changeBarline, Q as changeClef, C as changeKey, e as changeNoteDuration, D as changeTime, av as convertToGrace, Y as copyNotes, $ as copyNotesMultiMeasure, R as createTuplet, _ as cutNotes, F as deleteMeasure, h as deleteNote, o as deleteNoteChecked, z as duplicatePart, cC as formatLocation, cF as getMeasureContext, P as insertClefChange, E as insertMeasure, i as insertNote, cn as isValid, l as lowerAccidental, O as modifyDynamics, k as modifyNoteDuration, u as modifyNoteDurationChecked, m as modifyNotePitch, q as modifyNotePitchChecked, a3 as modifyTempo, B as moveNoteToStaff, Z as pasteNotes, a0 as pasteNotesMultiMeasure, f as raiseAccidental, L as removeArticulation, U as removeBeam, aI as removeBowing, aP as removeBreathMark, aR as removeCaesura, aD as removeChordSymbol, N as removeDynamics, ak as removeEnding, a7 as removeFermata, aG as removeFingering, au as removeGraceNote, aA as removeHarmony, ax as removeLyric, r as removeNote, aN as removeOctaveShift, a9 as removeOrnament, y as removePart, ab as removePedal, ai as removeRepeat, ag as removeRepeatBarline, J as removeSlur, aK as removeStringNumber, a2 as removeTempo, H as removeTie, S as removeTuplet, a5 as removeWedge, am as setBarline, X as setBeaming, s as setNotePitch, c as setNotePitchBySemitone, A as setStaves, d as shiftNotePitch, aM as stopOctaveShift, t as transpose, v as transposeChecked, aE as updateChordSymbol, aB as updateHarmony, ay as updateLyric, cm as validate, cr as validateBackupForward, ct as validateBeams, cp as validateDivisions, cq as validateMeasureDuration, cE as validateMeasureLocal, cw as validatePartReferences, cx as validatePartStructure, cu as validateSlurs, cB as validateSlursAcrossMeasures, cy as validateStaffStructure, cs as validateTies, cA as validateTiesAcrossMeasures, cv as validateTuplets, cz as validateVoiceStaff } from './index-DxLMCMTr.js';
|
|
5
5
|
export { FindNotesFilter, NormalizedPositionOptions, PitchRange, RoundtripMetrics, VoiceFilter, buildVoiceToStaffMap, buildVoiceToStaffMapForPart, countNotes, findBarlines, findDirectionsByType, findNotes, findNotesWithNotation, getAbsolutePosition, getAdjacentNotes, getAllNotes, getAttributesAtMeasure, getBeamGroups, getChordProgression, getChords, getClefChanges, getClefForStaff, getDirections, getDirectionsAtPosition, getDivisions, getDuration, getDynamics, getEffectiveStaff, getEndings, getEntriesAtPosition, getEntriesForStaff, getEntriesInRange, getHarmonies, getHarmonyAtPosition, getKeyChanges, getLyricText, getLyrics, getMeasure, getMeasureByIndex, getMeasureCount, getNextNote, getNormalizedDuration, getNormalizedPosition, getNotesAtPosition, getNotesForStaff, getNotesForVoice, getNotesInRange, getOctaveShifts, getPartById, getPartByIndex, getPartCount, getPartIds, getPartIndex, getPedalMarkings, getPrevNote, getRepeatStructure, getSlurSpans, getStaffRange, getStaveCount, getStaves, getStructuralChanges, getTempoMarkings, getTiedNoteGroups, getTimeChanges, getTupletGroups, getVerseCount, getVerticalSlice, getVoiceLine, getVoiceLineInRange, getVoices, getVoicesForStaff, getWedges, groupByStaff, groupByVoice, hasMultipleStaves, hasNotes, inferStaff, isRestMeasure, iterateEntries, iterateNotes, measureRoundtrip, scoresEqual, withAbsolutePositions } from './query/index.js';
|
|
6
6
|
|
|
7
|
-
declare function parse(
|
|
7
|
+
declare function parse(input: string | Uint8Array): Score;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Parse a compressed MusicXML (.mxl) file
|
package/dist/index.js
CHANGED
|
@@ -223,13 +223,16 @@ function decodeXmlEntities(s) {
|
|
|
223
223
|
(_, named, dec, hex) => named ? _entityMap[named] : dec ? String.fromCharCode(parseInt(dec, 10)) : String.fromCharCode(parseInt(hex, 16))
|
|
224
224
|
);
|
|
225
225
|
}
|
|
226
|
+
var INVALID_XML_CHARS_RE = /[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g;
|
|
226
227
|
function decodeTree(nodes) {
|
|
227
228
|
for (let i = 0; i < nodes.length; i++) {
|
|
228
229
|
const node = nodes[i];
|
|
229
230
|
if (typeof node === "string") {
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
let s = node;
|
|
232
|
+
if (s.indexOf("&") !== -1) {
|
|
233
|
+
s = decodeXmlEntities(s);
|
|
232
234
|
}
|
|
235
|
+
nodes[i] = s.replace(INVALID_XML_CHARS_RE, "");
|
|
233
236
|
} else {
|
|
234
237
|
const attrs = node.attributes;
|
|
235
238
|
for (const key in attrs) {
|
|
@@ -243,7 +246,26 @@ function decodeTree(nodes) {
|
|
|
243
246
|
}
|
|
244
247
|
}
|
|
245
248
|
var TXML_OPTIONS = { noChildNodes: [] };
|
|
246
|
-
function
|
|
249
|
+
function decodeXmlBytes(data) {
|
|
250
|
+
if (data.length >= 2 && data[0] === 254 && data[1] === 255) {
|
|
251
|
+
return new TextDecoder("utf-16be").decode(data);
|
|
252
|
+
}
|
|
253
|
+
if (data.length >= 2 && data[0] === 255 && data[1] === 254) {
|
|
254
|
+
return new TextDecoder("utf-16le").decode(data);
|
|
255
|
+
}
|
|
256
|
+
return new TextDecoder("utf-8").decode(data);
|
|
257
|
+
}
|
|
258
|
+
function parse(input) {
|
|
259
|
+
let xmlString;
|
|
260
|
+
if (typeof input !== "string") {
|
|
261
|
+
xmlString = decodeXmlBytes(input);
|
|
262
|
+
} else if (input.includes("\0")) {
|
|
263
|
+
throw new Error(
|
|
264
|
+
"parse() received a string containing NUL bytes, which indicates a UTF-16 encoded MusicXML file was read without proper encoding detection. Pass a Buffer or Uint8Array instead so the encoding is handled automatically:\n parse(fs.readFileSync(path)) // Node.js\n parse(new Uint8Array(arrayBuffer)) // Browser"
|
|
265
|
+
);
|
|
266
|
+
} else {
|
|
267
|
+
xmlString = input;
|
|
268
|
+
}
|
|
247
269
|
const cleanedXml = xmlString.replace(/<\?(?!xml\s)[^?]*\?>/g, "");
|
|
248
270
|
const parsed = _txml.parse.call(void 0, cleanedXml, TXML_OPTIONS);
|
|
249
271
|
decodeTree(parsed);
|
|
@@ -2760,7 +2782,7 @@ function parseCompressed(data) {
|
|
|
2760
2782
|
function isCompressed(data) {
|
|
2761
2783
|
return data.length >= 2 && data[0] === 80 && data[1] === 75;
|
|
2762
2784
|
}
|
|
2763
|
-
function
|
|
2785
|
+
function decodeXmlBytes2(data) {
|
|
2764
2786
|
if (data.length >= 2 && data[0] === 254 && data[1] === 255) {
|
|
2765
2787
|
return new TextDecoder("utf-16be").decode(data);
|
|
2766
2788
|
}
|
|
@@ -2776,7 +2798,7 @@ function parseAuto(data) {
|
|
|
2776
2798
|
if (isCompressed(data)) {
|
|
2777
2799
|
return parseCompressed(data);
|
|
2778
2800
|
}
|
|
2779
|
-
const xmlString =
|
|
2801
|
+
const xmlString = decodeXmlBytes2(data);
|
|
2780
2802
|
return parse(xmlString);
|
|
2781
2803
|
}
|
|
2782
2804
|
|
package/dist/index.mjs
CHANGED
|
@@ -223,13 +223,16 @@ function decodeXmlEntities(s) {
|
|
|
223
223
|
(_, named, dec, hex) => named ? _entityMap[named] : dec ? String.fromCharCode(parseInt(dec, 10)) : String.fromCharCode(parseInt(hex, 16))
|
|
224
224
|
);
|
|
225
225
|
}
|
|
226
|
+
var INVALID_XML_CHARS_RE = /[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g;
|
|
226
227
|
function decodeTree(nodes) {
|
|
227
228
|
for (let i = 0; i < nodes.length; i++) {
|
|
228
229
|
const node = nodes[i];
|
|
229
230
|
if (typeof node === "string") {
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
let s = node;
|
|
232
|
+
if (s.indexOf("&") !== -1) {
|
|
233
|
+
s = decodeXmlEntities(s);
|
|
232
234
|
}
|
|
235
|
+
nodes[i] = s.replace(INVALID_XML_CHARS_RE, "");
|
|
233
236
|
} else {
|
|
234
237
|
const attrs = node.attributes;
|
|
235
238
|
for (const key in attrs) {
|
|
@@ -243,7 +246,26 @@ function decodeTree(nodes) {
|
|
|
243
246
|
}
|
|
244
247
|
}
|
|
245
248
|
var TXML_OPTIONS = { noChildNodes: [] };
|
|
246
|
-
function
|
|
249
|
+
function decodeXmlBytes(data) {
|
|
250
|
+
if (data.length >= 2 && data[0] === 254 && data[1] === 255) {
|
|
251
|
+
return new TextDecoder("utf-16be").decode(data);
|
|
252
|
+
}
|
|
253
|
+
if (data.length >= 2 && data[0] === 255 && data[1] === 254) {
|
|
254
|
+
return new TextDecoder("utf-16le").decode(data);
|
|
255
|
+
}
|
|
256
|
+
return new TextDecoder("utf-8").decode(data);
|
|
257
|
+
}
|
|
258
|
+
function parse(input) {
|
|
259
|
+
let xmlString;
|
|
260
|
+
if (typeof input !== "string") {
|
|
261
|
+
xmlString = decodeXmlBytes(input);
|
|
262
|
+
} else if (input.includes("\0")) {
|
|
263
|
+
throw new Error(
|
|
264
|
+
"parse() received a string containing NUL bytes, which indicates a UTF-16 encoded MusicXML file was read without proper encoding detection. Pass a Buffer or Uint8Array instead so the encoding is handled automatically:\n parse(fs.readFileSync(path)) // Node.js\n parse(new Uint8Array(arrayBuffer)) // Browser"
|
|
265
|
+
);
|
|
266
|
+
} else {
|
|
267
|
+
xmlString = input;
|
|
268
|
+
}
|
|
247
269
|
const cleanedXml = xmlString.replace(/<\?(?!xml\s)[^?]*\?>/g, "");
|
|
248
270
|
const parsed = txmlParse(cleanedXml, TXML_OPTIONS);
|
|
249
271
|
decodeTree(parsed);
|
|
@@ -2760,7 +2782,7 @@ function parseCompressed(data) {
|
|
|
2760
2782
|
function isCompressed(data) {
|
|
2761
2783
|
return data.length >= 2 && data[0] === 80 && data[1] === 75;
|
|
2762
2784
|
}
|
|
2763
|
-
function
|
|
2785
|
+
function decodeXmlBytes2(data) {
|
|
2764
2786
|
if (data.length >= 2 && data[0] === 254 && data[1] === 255) {
|
|
2765
2787
|
return new TextDecoder("utf-16be").decode(data);
|
|
2766
2788
|
}
|
|
@@ -2776,7 +2798,7 @@ function parseAuto(data) {
|
|
|
2776
2798
|
if (isCompressed(data)) {
|
|
2777
2799
|
return parseCompressed(data);
|
|
2778
2800
|
}
|
|
2779
|
-
const xmlString =
|
|
2801
|
+
const xmlString = decodeXmlBytes2(data);
|
|
2780
2802
|
return parse(xmlString);
|
|
2781
2803
|
}
|
|
2782
2804
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musicxml-io",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Parse and serialize MusicXML (.xml/.mxl) and ABC notation with high round-trip fidelity",
|
|
5
5
|
"author": "tan-z-tan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"abc-notation"
|
|
71
71
|
],
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@types/node": "^
|
|
73
|
+
"@types/node": "^25.6.0",
|
|
74
74
|
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
|
75
75
|
"@typescript-eslint/parser": "^8.57.2",
|
|
76
76
|
"eslint": "^10.1.0",
|