@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.mjs 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
  *
@@ -26875,7 +26875,9 @@ class BrowserUiFacade {
26875
26875
  }
26876
26876
  let player = null;
26877
26877
  let supportsScriptProcessor = 'ScriptProcessorNode' in window;
26878
- let supportsAudioWorklets = window.isSecureContext && 'AudioWorkletNode' in window;
26878
+ // Once https://github.com/webpack/webpack/issues/11543 is decided
26879
+ // we can support audio worklets together with WebPack
26880
+ let supportsAudioWorklets = window.isSecureContext && 'AudioWorkletNode' in window && !Environment.isWebPackBundled;
26879
26881
  if (supportsAudioWorklets) {
26880
26882
  Logger.debug('Player', 'Will use webworkers for synthesizing and web audio api with worklets for playback');
26881
26883
  player = new AlphaSynthWebWorkerApi(new AlphaSynthAudioWorkletOutput(), alphaSynthScriptFile, this._api.settings.core.logLevel);
@@ -40126,14 +40128,24 @@ class Environment {
40126
40128
  * @target web
40127
40129
  */
40128
40130
  static createAlphaTabWorker(scriptFile) {
40129
- if (Environment.webPlatform === WebPlatform.BrowserModule) {
40130
- let script = `import * as alphaTab from '${scriptFile}'`;
40131
- let blob = new Blob([script], { type: 'text/javascript' });
40131
+ if (Environment.isWebPackBundled) {
40132
+ // WebPack currently requires this exact syntax: new Worker(new URL(..., import.meta.url)))
40133
+ // The module `@coderline/alphatab` will be resolved by WebPack to alphaTab consumed as library
40134
+ // this will not work with CDNs because worker start scripts need to have the same origin like
40135
+ // the current browser.
40136
+ // https://github.com/webpack/webpack/discussions/14066
40137
+ return new Worker(
40138
+ // @ts-ignore
40139
+ /* webpackChunkName: "alphatab.worker" */ new URL('@coderline/alphatab', import.meta.url));
40140
+ }
40141
+ else if (Environment.webPlatform === WebPlatform.BrowserModule) {
40142
+ const script = `import * as alphaTab from '${scriptFile}'`;
40143
+ const blob = new Blob([script], { type: 'text/javascript' });
40132
40144
  return new Worker(URL.createObjectURL(blob), { type: 'module' });
40133
40145
  }
40134
40146
  else {
40135
- let script = `importScripts('${scriptFile}')`;
40136
- let blob = new Blob([script]);
40147
+ const script = `importScripts('${scriptFile}')`;
40148
+ const blob = new Blob([script]);
40137
40149
  return new Worker(URL.createObjectURL(blob));
40138
40150
  }
40139
40151
  }
@@ -40401,6 +40413,21 @@ class Environment {
40401
40413
  }
40402
40414
  }
40403
40415
  }
40416
+ /**
40417
+ * @target web
40418
+ */
40419
+ static detectWebPack() {
40420
+ try {
40421
+ // @ts-ignore
40422
+ if (typeof __webpack_require__ !== 'function') {
40423
+ return true;
40424
+ }
40425
+ }
40426
+ catch (e) {
40427
+ // ignore any errors
40428
+ }
40429
+ return false;
40430
+ }
40404
40431
  /**
40405
40432
  * @target web
40406
40433
  */
@@ -40421,7 +40448,7 @@ class Environment {
40421
40448
  try {
40422
40449
  // @ts-ignore
40423
40450
  const url = import.meta.url;
40424
- if (url && typeof url === 'string') {
40451
+ if (url && typeof url === 'string' && !url.startsWith('file://')) {
40425
40452
  return WebPlatform.BrowserModule;
40426
40453
  }
40427
40454
  }
@@ -40447,6 +40474,10 @@ Environment._globalThis = undefined;
40447
40474
  * @target web
40448
40475
  */
40449
40476
  Environment.webPlatform = Environment.detectWebPlatform();
40477
+ /**
40478
+ * @target web
40479
+ */
40480
+ Environment.isWebPackBundled = Environment.detectWebPack();
40450
40481
  /**
40451
40482
  * @target web
40452
40483
  */
@@ -40599,8 +40630,8 @@ class CoreSettings {
40599
40630
  // </auto-generated>
40600
40631
  class VersionInfo {
40601
40632
  }
40602
- VersionInfo.version = '1.3.0-alpha.174';
40603
- VersionInfo.date = '2022-02-15T00:31:25.846Z';
40633
+ VersionInfo.version = '1.3.0-alpha.181';
40634
+ VersionInfo.date = '2022-02-20T17:16:08.027Z';
40604
40635
 
40605
40636
  var index$5 = /*#__PURE__*/Object.freeze({
40606
40637
  __proto__: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderline/alphatab",
3
- "version": "1.3.0-alpha.174",
3
+ "version": "1.3.0-alpha.181",
4
4
  "description": "alphaTab is a music notation and guitar tablature rendering library",
5
5
  "keywords": [
6
6
  "guitar",