@coderline/alphatab 1.3.0-alpha.174 → 1.3.0-alpha.181

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/alphaTab.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.174 (develop, build 174)
2
+ * alphaTab v1.3.0-alpha.181 (develop, build 181)
3
3
  *
4
4
  * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -26881,7 +26881,9 @@
26881
26881
  }
26882
26882
  let player = null;
26883
26883
  let supportsScriptProcessor = 'ScriptProcessorNode' in window;
26884
- let supportsAudioWorklets = window.isSecureContext && 'AudioWorkletNode' in window;
26884
+ // Once https://github.com/webpack/webpack/issues/11543 is decided
26885
+ // we can support audio worklets together with WebPack
26886
+ let supportsAudioWorklets = window.isSecureContext && 'AudioWorkletNode' in window && !Environment.isWebPackBundled;
26885
26887
  if (supportsAudioWorklets) {
26886
26888
  Logger.debug('Player', 'Will use webworkers for synthesizing and web audio api with worklets for playback');
26887
26889
  player = new AlphaSynthWebWorkerApi(new AlphaSynthAudioWorkletOutput(), alphaSynthScriptFile, this._api.settings.core.logLevel);
@@ -40132,14 +40134,24 @@
40132
40134
  * @target web
40133
40135
  */
40134
40136
  static createAlphaTabWorker(scriptFile) {
40135
- if (Environment.webPlatform === WebPlatform.BrowserModule) {
40136
- let script = `import * as alphaTab from '${scriptFile}'`;
40137
- let blob = new Blob([script], { type: 'text/javascript' });
40137
+ if (Environment.isWebPackBundled) {
40138
+ // WebPack currently requires this exact syntax: new Worker(new URL(..., import.meta.url)))
40139
+ // The module `@coderline/alphatab` will be resolved by WebPack to alphaTab consumed as library
40140
+ // this will not work with CDNs because worker start scripts need to have the same origin like
40141
+ // the current browser.
40142
+ // https://github.com/webpack/webpack/discussions/14066
40143
+ return new Worker(
40144
+ // @ts-ignore
40145
+ /* webpackChunkName: "alphatab.worker" */ new URL('@coderline/alphatab', {}));
40146
+ }
40147
+ else if (Environment.webPlatform === WebPlatform.BrowserModule) {
40148
+ const script = `import * as alphaTab from '${scriptFile}'`;
40149
+ const blob = new Blob([script], { type: 'text/javascript' });
40138
40150
  return new Worker(URL.createObjectURL(blob), { type: 'module' });
40139
40151
  }
40140
40152
  else {
40141
- let script = `importScripts('${scriptFile}')`;
40142
- let blob = new Blob([script]);
40153
+ const script = `importScripts('${scriptFile}')`;
40154
+ const blob = new Blob([script]);
40143
40155
  return new Worker(URL.createObjectURL(blob));
40144
40156
  }
40145
40157
  }
@@ -40407,6 +40419,21 @@
40407
40419
  }
40408
40420
  }
40409
40421
  }
40422
+ /**
40423
+ * @target web
40424
+ */
40425
+ static detectWebPack() {
40426
+ try {
40427
+ // @ts-ignore
40428
+ if (typeof __webpack_require__ !== 'function') {
40429
+ return true;
40430
+ }
40431
+ }
40432
+ catch (e) {
40433
+ // ignore any errors
40434
+ }
40435
+ return false;
40436
+ }
40410
40437
  /**
40411
40438
  * @target web
40412
40439
  */
@@ -40427,7 +40454,7 @@
40427
40454
  try {
40428
40455
  // @ts-ignore
40429
40456
  const url = {};
40430
- if (url && typeof url === 'string') {
40457
+ if (url && typeof url === 'string' && !url.startsWith('file://')) {
40431
40458
  return WebPlatform.BrowserModule;
40432
40459
  }
40433
40460
  }
@@ -40453,6 +40480,10 @@
40453
40480
  * @target web
40454
40481
  */
40455
40482
  Environment.webPlatform = Environment.detectWebPlatform();
40483
+ /**
40484
+ * @target web
40485
+ */
40486
+ Environment.isWebPackBundled = Environment.detectWebPack();
40456
40487
  /**
40457
40488
  * @target web
40458
40489
  */
@@ -40605,8 +40636,8 @@
40605
40636
  // </auto-generated>
40606
40637
  class VersionInfo {
40607
40638
  }
40608
- VersionInfo.version = '1.3.0-alpha.174';
40609
- VersionInfo.date = '2022-02-15T00:31:25.846Z';
40639
+ VersionInfo.version = '1.3.0-alpha.181';
40640
+ VersionInfo.date = '2022-02-20T17:16:08.027Z';
40610
40641
 
40611
40642
  var index$5 = /*#__PURE__*/Object.freeze({
40612
40643
  __proto__: null,