Comparing version 0.21.0 to 0.22.0
@@ -12,2 +12,12 @@ # Changelog | ||
## 0.22.0 - 2022-12-31 | ||
### Changed | ||
* Build over the `offscreen` [Qt Platform Plugin](https://doc.qt.io/qt-5/qpa.html) so that the wasm binary size has been significantly reduced | ||
* `webmscore.lib.wasm`:<br> | ||
10.47 MB -> 7.42 MB | ||
* `webmscore.lib.mem.wasm`:<br> | ||
4.97 MB -> 3.92 MB | ||
## 0.21.0 - 2020-03-02 | ||
@@ -14,0 +24,0 @@ |
{ | ||
"name": "webmscore", | ||
"version": "0.21.0", | ||
"version": "0.22.0", | ||
"description": "MuseScore's libmscore in WebAssembly! Read mscz data, and generate audio/MIDI/MusicXML/SVG/PNG/PDF sheets right in browsers", | ||
@@ -48,3 +48,4 @@ "type": "module", | ||
"scripts": { | ||
"build": "npm run clean && npm run compile && npm run bundle && npm run d-ts", | ||
"build": "npm run clean && npm run build:no-clean", | ||
"build:no-clean": "npm run compile && npm run build:js-only", | ||
"build:js-only": "npm run clean:d-ts && npm run bundle && npm run d-ts", | ||
@@ -51,0 +52,0 @@ "version": "npm run build:js-only", |
@@ -135,8 +135,21 @@ | ||
cd $QT_PATH | ||
./configure -xplatform wasm-emscripten -nomake examples -prefix $PWD/qtbase | ||
./configure -opensource -confirm-license \ | ||
-xplatform wasm-emscripten \ | ||
-nomake examples -nomake tools \ | ||
-skip qt3d -skip qtconnectivity -skip qtdeclarative -skip qtgamepad -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialbus -skip serialport -skip qtspeech -skip qttools -skip qtwayland -skip qtwebengine \ | ||
-no-accessibility -no-opengl \ | ||
-no-gif -no-ico -no-tiff -no-webp \ | ||
-prefix $PWD/qtbase -optimize-size -static | ||
make -j$CPUS | ||
# exclude unused Qt5Gui plugins | ||
sed -i -E "s/\s(\S+?Qt5Gui_)\*(Plugin)?(.*)\)/ \1QWasmIntegrationPlugin\3 \1QJpegPlugin\3)/" $QT_PATH/qtbase/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake | ||
# build `offscreen` QPA platform plugin (https://doc.qt.io/qt-5/qpa.html) | ||
cd $QT_PATH/qtbase/src/plugins/platforms/offscreen | ||
$QT_PATH/qtbase/bin/qmake offscreen.pro && make | ||
cd - | ||
# enable the `offscreen` plugin | ||
sed -i -E "s/(PROPERTY QT_PLUGIN_EXTENDS \").*?(\")/\1\2/" $QT_PATH/qtbase/lib/cmake/Qt5Gui/Qt5Gui_QOffscreenIntegrationPlugin.cmake | ||
# exclude other Qt5Gui plugins | ||
sed -i -E "s/\s(\S+?Qt5Gui_)\*(Plugin)?(.*)\)/ \1QOffscreenIntegrationPlugin\3 \1QJpegPlugin\3)/" $QT_PATH/qtbase/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake | ||
# patch emcc.py to emit separate .mem files regardless of MEM_INIT_METHOD settings (MEM_INIT_METHOD won't work with wasm) | ||
@@ -143,0 +156,0 @@ sed -i -r "s/(shared.Settings.MEM_INIT_IN_WASM = )True/\1False/" "$(which emcc).py" |
export function getStrPtr(str: string): number; | ||
export function getTypedArrayPtr(data: Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array): number; | ||
export function getTypedArrayPtr(data: TypedArray): number; | ||
export function readData(ptr: number): Uint8Array; | ||
@@ -9,2 +9,5 @@ export function freePtr(bufPtr: number): void; | ||
export const RuntimeInitialized: Promise<any>; | ||
/** | ||
* * | ||
*/ | ||
export type FileErrorEnum = number; | ||
@@ -34,3 +37,3 @@ /** | ||
*/ | ||
constructor(errorCode: number); | ||
constructor(errorCode: FileErrorEnum); | ||
errorCode: number; | ||
@@ -42,4 +45,4 @@ errorName: string; | ||
*/ | ||
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; | ||
export type TypedArray = Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array; | ||
/** @type {Record<string, any>} */ | ||
export let Module: Record<string, any>; |
@@ -64,7 +64,5 @@ | ||
export const readData = (ptr) => { | ||
let offset = ptr + 8 // 8 bytes padding | ||
const sizeData = new DataView( | ||
new Uint8Array( // make a copy | ||
Module.HEAPU8.subarray(offset, offset + 4) | ||
Module.HEAPU8.subarray(ptr, ptr + 4) | ||
).buffer | ||
@@ -74,3 +72,3 @@ ) | ||
const size = sizeData.getUint32(0, true) | ||
const data = new Uint8Array(Module.HEAPU8.subarray(offset + 4, offset + 4 + size)) // make a copy | ||
const data = new Uint8Array(Module.HEAPU8.subarray(ptr + 4, ptr + 4 + size)) // make a copy | ||
@@ -77,0 +75,0 @@ freePtr(ptr) |
@@ -46,3 +46,3 @@ export default WebMscore; | ||
*/ | ||
static load(format: import("../schemas.js").InputFileFormat, data: Uint8Array, fonts?: Uint8Array[] | Promise<Uint8Array[]>, doLayout?: boolean): Promise<WebMscore>; | ||
static load(format: import('../schemas').InputFileFormat, data: Uint8Array, fonts?: Uint8Array[] | Promise<Uint8Array[]>, doLayout?: boolean): Promise<WebMscore>; | ||
/** | ||
@@ -115,3 +115,3 @@ * Load (CJK) fonts on demand | ||
*/ | ||
metadata(): Promise<import("../schemas.js").ScoreMetadata>; | ||
metadata(): Promise<import('../schemas').ScoreMetadata>; | ||
/** | ||
@@ -121,3 +121,3 @@ * Get the positions of measures | ||
*/ | ||
measurePositions(): Promise<import("../schemas.js").Positions>; | ||
measurePositions(): Promise<import('../schemas').Positions>; | ||
/** | ||
@@ -127,3 +127,3 @@ * Get the positions of segments | ||
*/ | ||
segmentPositions(): Promise<import("../schemas.js").Positions>; | ||
segmentPositions(): Promise<import('../schemas').Positions>; | ||
/** | ||
@@ -144,3 +144,3 @@ * Export score as MusicXML file | ||
*/ | ||
saveMsc(format?: "mscz" | "mscx"): Promise<Uint8Array>; | ||
saveMsc(format?: 'mscz' | 'mscx'): Promise<Uint8Array>; | ||
/** | ||
@@ -182,3 +182,3 @@ * Export score as the SVG file of one page | ||
*/ | ||
saveAudio(format: "wav" | "ogg" | "flac" | "mp3"): Promise<Uint8Array>; | ||
saveAudio(format: 'wav' | 'ogg' | 'flac' | 'mp3'): Promise<Uint8Array>; | ||
/** | ||
@@ -192,3 +192,3 @@ * Synthesize audio frames | ||
*/ | ||
synthAudio(starttime: number): Promise<(cancel?: boolean) => Promise<import("../schemas.js").SynthRes>>; | ||
synthAudio(starttime: number): Promise<(cancel?: boolean) => Promise<import('../schemas').SynthRes>>; | ||
/** | ||
@@ -200,3 +200,3 @@ * Synthesize audio frames in bulk | ||
*/ | ||
synthAudioBatch(starttime: number, batchSize: number): Promise<(cancel?: boolean) => Promise<import("../schemas.js").SynthRes[]>>; | ||
synthAudioBatch(starttime: number, batchSize: number): Promise<(cancel?: boolean) => Promise<import('../schemas').SynthRes[]>>; | ||
/** | ||
@@ -250,3 +250,3 @@ * Synthesize audio frames | ||
*/ | ||
destroy(soft?: boolean): void; | ||
destroy(soft?: boolean | undefined): void; | ||
} |
@@ -218,3 +218,3 @@ | ||
const strptr = Module.ccall('title', 'number', ['number'], [this.scoreptr]) | ||
const str = Module.UTF8ToString(strptr + 8) // 8 bytes of padding | ||
const str = Module.UTF8ToString(strptr) | ||
freePtr(strptr) | ||
@@ -272,3 +272,3 @@ return str | ||
// MusicXML is plain text | ||
const data = Module.UTF8ToString(dataptr + 8) // 8 bytes of padding | ||
const data = Module.UTF8ToString(dataptr) | ||
freePtr(dataptr) | ||
@@ -312,3 +312,3 @@ | ||
// SVG is plain text | ||
const data = Module.UTF8ToString(dataptr + 8) // 8 bytes of padding | ||
const data = Module.UTF8ToString(dataptr) | ||
freePtr(dataptr) | ||
@@ -523,3 +523,3 @@ | ||
// JSON is plain text | ||
const data = Module.UTF8ToString(dataptr + 8) // 8 bytes of padding | ||
const data = Module.UTF8ToString(dataptr) | ||
freePtr(dataptr) | ||
@@ -539,3 +539,3 @@ | ||
// JSON is plain text | ||
const data = Module.UTF8ToString(dataptr + 8) // 8 bytes of padding | ||
const data = Module.UTF8ToString(dataptr) | ||
freePtr(dataptr) | ||
@@ -542,0 +542,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206
20371438
11994