notations 0.0.35 → 0.0.36
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/lib/cjs/loader.d.ts +2 -1
- package/lib/cjs/loader.js +11 -2
- package/lib/cjs/loader.js.map +1 -1
- package/lib/esm/loader.d.ts +2 -1
- package/lib/esm/loader.js +11 -2
- package/lib/esm/loader.js.map +1 -1
- package/package.json +1 -1
package/lib/cjs/loader.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import * as TSU from "@panyam/tsutils";
|
|
1
2
|
import * as G from "galore";
|
|
2
3
|
import { BeatLayout, Beat } from "./layouts";
|
|
3
4
|
import { Notation } from "./notation";
|
|
4
|
-
export declare function load(codeText: string, config?: any): [Notation, Map<number, Beat[][]>, Map<number, BeatLayout>, G.ParseError[]];
|
|
5
|
+
export declare function load(codeText: string, config?: any): [Notation, Map<number, Beat[][]>, Map<number, BeatLayout>, G.ParseError[], TSU.StringMap<number>];
|
package/lib/cjs/loader.js
CHANGED
|
@@ -140,11 +140,20 @@ function load(codeText, config) {
|
|
|
140
140
|
}
|
|
141
141
|
finally { if (e_2) throw e_2.error; }
|
|
142
142
|
}
|
|
143
|
+
var buildTime = performance.now();
|
|
143
144
|
if (config.log) {
|
|
144
|
-
var buildTime = performance.now();
|
|
145
145
|
console.log("V4 Document, Parse Time: " + (parseTime - startTime) + "ms, Build Time: " + (buildTime - parseTime) + "ms");
|
|
146
146
|
}
|
|
147
|
-
return [
|
|
147
|
+
return [
|
|
148
|
+
notation,
|
|
149
|
+
beatsByLineRole,
|
|
150
|
+
beatLayouts,
|
|
151
|
+
errors,
|
|
152
|
+
{
|
|
153
|
+
parseTime: parseTime - startTime,
|
|
154
|
+
buildTime: buildTime - parseTime,
|
|
155
|
+
},
|
|
156
|
+
];
|
|
148
157
|
}
|
|
149
158
|
exports.load = load;
|
|
150
159
|
//# sourceMappingURL=loader.js.map
|
package/lib/cjs/loader.js.map
CHANG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G,SAAS;SACjC;KACF,CAAC;AACJ,CAAC;AA5DD,oBA4DC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport * as G from \"galore\";\nimport { Line } from \"./core\";\nimport { BeatLayout, Beat, BeatsBuilder } from \"./layouts\";\nimport { Parser } from \"./parser\";\nimport { Notation } from \"./notation\";\n\nexport function load(\n codeText: string,\n config: any = {},\n): [Notation, Map<number, Beat[][]>, Map<number, BeatLayout>, G.ParseError[], TSU.StringMap<number>] {\n const beatsByLineRole = new Map<number, Beat[][]>();\n const beatLayouts = new Map<number, BeatLayout>();\n const errors: G.ParseError[] = [];\n const startTime = performance.now();\n const notation = new Notation();\n const parser = new Parser();\n parser.parse(codeText);\n const parseTime = performance.now();\n for (const cmd of parser.commands) cmd.applyToNotation(notation);\n\n // Create Line Beats\n for (const block of notation.blocks) {\n if (block.type == \"Line\") {\n const line = block as Line;\n // LP should exist by now\n const layoutParams = notation.layoutParamsForLine(line) || null;\n if (!line.isEmpty) {\n // Probably because this is an empty line and AddAtoms was not called\n TSU.assert(layoutParams != null, \"Layout params for a non empty line *should* exist\");\n let beatLayout = beatLayouts.get(layoutParams.uuid) || null;\n if (beatLayout == null) {\n beatLayout = new BeatLayout(layoutParams);\n beatLayouts.set(layoutParams.uuid, beatLayout);\n }\n const roleBeats = [] as Beat[][];\n beatsByLineRole.set(line.uuid, roleBeats);\n\n const lineOffset = line.offset.divbyNum(layoutParams.beatDuration);\n for (const role of line.roles) {\n const bb = new BeatsBuilder(role, layoutParams, lineOffset);\n bb.addAtoms(...role.atoms);\n roleBeats.push(bb.beats);\n\n // Add these to the beat layout too\n for (const beat of bb.beats) {\n beat.ensureUniformSpaces(layoutParams.beatDuration);\n beatLayout.addBeat(beat);\n }\n }\n }\n }\n }\n const buildTime = performance.now();\n if (config.log) {\n console.log(`V4 Document, Parse Time: ${parseTime - startTime}ms, Build Time: ${buildTime - parseTime}ms`);\n }\n return [\n notation,\n beatsByLineRole,\n beatLayouts,\n errors,\n {\n parseTime: parseTime - startTime,\n buildTime: buildTime - parseTime,\n },\n ];\n}\n"]}
|
package/lib/esm/loader.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import * as TSU from "@panyam/tsutils";
|
|
1
2
|
import * as G from "galore";
|
|
2
3
|
import { BeatLayout, Beat } from "./layouts";
|
|
3
4
|
import { Notation } from "./notation";
|
|
4
|
-
export declare function load(codeText: string, config?: any): [Notation, Map<number, Beat[][]>, Map<number, BeatLayout>, G.ParseError[]];
|
|
5
|
+
export declare function load(codeText: string, config?: any): [Notation, Map<number, Beat[][]>, Map<number, BeatLayout>, G.ParseError[], TSU.StringMap<number>];
|
package/lib/esm/loader.js
CHANGED
|
@@ -118,10 +118,19 @@ export function load(codeText, config) {
|
|
|
118
118
|
}
|
|
119
119
|
finally { if (e_2) throw e_2.error; }
|
|
120
120
|
}
|
|
121
|
+
var buildTime = performance.now();
|
|
121
122
|
if (config.log) {
|
|
122
|
-
var buildTime = performance.now();
|
|
123
123
|
console.log("V4 Document, Parse Time: " + (parseTime - startTime) + "ms, Build Time: " + (buildTime - parseTime) + "ms");
|
|
124
124
|
}
|
|
125
|
-
return [
|
|
125
|
+
return [
|
|
126
|
+
notation,
|
|
127
|
+
beatsByLineRole,
|
|
128
|
+
beatLayouts,
|
|
129
|
+
errors,
|
|
130
|
+
{
|
|
131
|
+
parseTime: parseTime - startTime,
|
|
132
|
+
buildTime: buildTime - parseTime,
|
|
133
|
+
},
|
|
134
|
+
];
|
|
126
135
|
}
|
|
127
136
|
//# sourceMappingURL=loader.js.map
|
package/lib/esm/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAQ,YAAY,EAAE,MAAM,WAAW,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GAAG,SAAS;SACjC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import * as TSU from \"@panyam/tsutils\";\nimport * as G from \"galore\";\nimport { Line } from \"./core\";\nimport { BeatLayout, Beat, BeatsBuilder } from \"./layouts\";\nimport { Parser } from \"./parser\";\nimport { Notation } from \"./notation\";\n\nexport function load(\n codeText: string,\n config: any = {},\n): [Notation, Map<number, Beat[][]>, Map<number, BeatLayout>, G.ParseError[], TSU.StringMap<number>] {\n const beatsByLineRole = new Map<number, Beat[][]>();\n const beatLayouts = new Map<number, BeatLayout>();\n const errors: G.ParseError[] = [];\n const startTime = performance.now();\n const notation = new Notation();\n const parser = new Parser();\n parser.parse(codeText);\n const parseTime = performance.now();\n for (const cmd of parser.commands) cmd.applyToNotation(notation);\n\n // Create Line Beats\n for (const block of notation.blocks) {\n if (block.type == \"Line\") {\n const line = block as Line;\n // LP should exist by now\n const layoutParams = notation.layoutParamsForLine(line) || null;\n if (!line.isEmpty) {\n // Probably because this is an empty line and AddAtoms was not called\n TSU.assert(layoutParams != null, \"Layout params for a non empty line *should* exist\");\n let beatLayout = beatLayouts.get(layoutParams.uuid) || null;\n if (beatLayout == null) {\n beatLayout = new BeatLayout(layoutParams);\n beatLayouts.set(layoutParams.uuid, beatLayout);\n }\n const roleBeats = [] as Beat[][];\n beatsByLineRole.set(line.uuid, roleBeats);\n\n const lineOffset = line.offset.divbyNum(layoutParams.beatDuration);\n for (const role of line.roles) {\n const bb = new BeatsBuilder(role, layoutParams, lineOffset);\n bb.addAtoms(...role.atoms);\n roleBeats.push(bb.beats);\n\n // Add these to the beat layout too\n for (const beat of bb.beats) {\n beat.ensureUniformSpaces(layoutParams.beatDuration);\n beatLayout.addBeat(beat);\n }\n }\n }\n }\n }\n const buildTime = performance.now();\n if (config.log) {\n console.log(`V4 Document, Parse Time: ${parseTime - startTime}ms, Build Time: ${buildTime - parseTime}ms`);\n }\n return [\n notation,\n beatsByLineRole,\n beatLayouts,\n errors,\n {\n parseTime: parseTime - startTime,\n buildTime: buildTime - parseTime,\n },\n ];\n}\n"]}
|
package/package.json
CHANGED