@coderline/alphatab-webpack 1.7.0-alpha.1628 → 1.7.0-alpha.1629

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.
@@ -0,0 +1,118 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const Utils = require('./Utils.cjs');
42
+
43
+ const AlphaTabWorkletSpecifierTag = Symbol('alphatab worklet specifier tag');
44
+ const workletIndexMap = new WeakMap();
45
+ /**
46
+ * Configures the Audio Worklet aspects within webpack.
47
+ * The counterpart which this plugin detects sits in alphaTab.main.ts
48
+ * @param pluginName
49
+ * @param options
50
+ * @param compiler
51
+ * @param compilation
52
+ * @param normalModuleFactory
53
+ * @param cachedContextify
54
+ * @returns
55
+ * @internal
56
+ */
57
+ function configureAudioWorklet(webPackWithAlphaTab, pluginName, options, compiler, compilation, normalModuleFactory, cachedContextify) {
58
+ if (options.audioWorklets === false) {
59
+ return;
60
+ }
61
+ webPackWithAlphaTab.alphaTab.registerWorkletDependency(compilation, normalModuleFactory);
62
+ const handleAlphaTabWorklet = (parser, expr) => {
63
+ const [arg1] = expr.arguments;
64
+ const parsedUrl = Utils.parseModuleUrl(parser, arg1);
65
+ if (!parsedUrl) {
66
+ return;
67
+ }
68
+ const [url] = parsedUrl;
69
+ if (!url.isString()) {
70
+ return;
71
+ }
72
+ const runtime = Utils.getWorkerRuntime(parser, compilation, cachedContextify, workletIndexMap);
73
+ const block = new webPackWithAlphaTab.webpack.AsyncDependenciesBlock({
74
+ entryOptions: {
75
+ chunkLoading: false,
76
+ wasmLoading: false,
77
+ runtime: runtime,
78
+ library: {
79
+ // prevent any built-in/default library settings
80
+ // to be active for this chunk
81
+ type: 'at-worklet'
82
+ }
83
+ }
84
+ });
85
+ block.loc = expr.loc;
86
+ const workletBootstrap = webPackWithAlphaTab.alphaTab.createWorkletDependency(url.string, [expr.range[0], expr.range[1]], compiler.options.output.workerPublicPath);
87
+ workletBootstrap.loc = expr.loc;
88
+ block.addDependency(workletBootstrap);
89
+ parser.state.module.addBlock(block);
90
+ return true;
91
+ };
92
+ const parserPlugin = (parser) => {
93
+ const pattern = 'alphaTabWorklet';
94
+ const itemMembers = 'addModule';
95
+ parser.hooks.preDeclarator.tap(pluginName, (decl) => {
96
+ if (decl.id.type === 'Identifier' && decl.id.name === pattern) {
97
+ parser.tagVariable(decl.id.name, AlphaTabWorkletSpecifierTag);
98
+ return true;
99
+ }
100
+ return;
101
+ });
102
+ parser.hooks.pattern.for(pattern).tap(pluginName, (pattern) => {
103
+ parser.tagVariable(pattern.name, AlphaTabWorkletSpecifierTag);
104
+ return true;
105
+ });
106
+ parser.hooks.callMemberChain
107
+ .for(AlphaTabWorkletSpecifierTag)
108
+ .tap(pluginName, (expression, members) => {
109
+ if (itemMembers !== members.join('.')) {
110
+ return;
111
+ }
112
+ return handleAlphaTabWorklet(parser, expression);
113
+ });
114
+ };
115
+ Utils.tapJavaScript(normalModuleFactory, pluginName, parserPlugin);
116
+ }
117
+
118
+ exports.configureAudioWorklet = configureAudioWorklet;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -0,0 +1,336 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const fs = require('node:fs');
42
+ const path = require('node:path');
43
+ const url = require('node:url');
44
+ const AlphaTabWorkerRuntimeModule = require('./AlphaTabWorkerRuntimeModule.cjs');
45
+ const AlphaTabAudioWorklet = require('./AlphaTabAudioWorklet.cjs');
46
+ const AlphaTabWebWorker = require('./AlphaTabWebWorker.cjs');
47
+ const AlphaTabWebWorkerDependency = require('./AlphaTabWebWorkerDependency.cjs');
48
+ const AlphaTabWorkletStartRuntimeModule = require('./AlphaTabWorkletStartRuntimeModule.cjs');
49
+ const AlphaTabWorkletDependency = require('./AlphaTabWorkletDependency.cjs');
50
+
51
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
52
+ function _interopNamespaceDefault(e) {
53
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
54
+ if (e) {
55
+ for (const k in e) {
56
+ if (k !== 'default') {
57
+ const d = Object.getOwnPropertyDescriptor(e, k);
58
+ Object.defineProperty(n, k, d.get ? d : {
59
+ enumerable: true,
60
+ get: () => e[k]
61
+ });
62
+ }
63
+ }
64
+ }
65
+ n.default = e;
66
+ return Object.freeze(n);
67
+ }
68
+
69
+ const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
70
+ const url__namespace = /*#__PURE__*/_interopNamespaceDefault(url);
71
+
72
+ /**@target web */
73
+ const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/;
74
+ const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
75
+ const relativePathToRequest = (relativePath) => {
76
+ if (relativePath === '') {
77
+ return './.';
78
+ }
79
+ if (relativePath === '..') {
80
+ return '../.';
81
+ }
82
+ if (relativePath.startsWith('../')) {
83
+ return relativePath;
84
+ }
85
+ return `./${relativePath}`;
86
+ };
87
+ const absoluteToRequest = (context, maybeAbsolutePath) => {
88
+ if (maybeAbsolutePath[0] === '/') {
89
+ if (maybeAbsolutePath.length > 1 && maybeAbsolutePath[maybeAbsolutePath.length - 1] === '/') {
90
+ // this 'path' is actually a regexp generated by dynamic requires.
91
+ // Don't treat it as an absolute path.
92
+ return maybeAbsolutePath;
93
+ }
94
+ const querySplitPos = maybeAbsolutePath.indexOf('?');
95
+ let resource = querySplitPos === -1 ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
96
+ resource = relativePathToRequest(path__namespace.posix.relative(context, resource));
97
+ return querySplitPos === -1 ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
98
+ }
99
+ if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) {
100
+ const querySplitPos = maybeAbsolutePath.indexOf('?');
101
+ let resource = querySplitPos === -1 ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
102
+ resource = path__namespace.win32.relative(context, resource);
103
+ if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) {
104
+ resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'));
105
+ }
106
+ return querySplitPos === -1 ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
107
+ }
108
+ // not an absolute path
109
+ return maybeAbsolutePath;
110
+ };
111
+ const _contextify = (context, request) => {
112
+ return request
113
+ .split('!')
114
+ .map(r => absoluteToRequest(context, r))
115
+ .join('!');
116
+ };
117
+ const makeCacheableWithContext = (fn) => {
118
+ const cache = new WeakMap();
119
+ const cachedFn = (context, identifier, associatedObjectForCache) => {
120
+ if (!associatedObjectForCache) {
121
+ return fn(context, identifier);
122
+ }
123
+ let innerCache = cache.get(associatedObjectForCache);
124
+ if (innerCache === undefined) {
125
+ innerCache = new Map();
126
+ cache.set(associatedObjectForCache, innerCache);
127
+ }
128
+ let cachedResult;
129
+ let innerSubCache = innerCache.get(context);
130
+ if (innerSubCache === undefined) {
131
+ innerSubCache = new Map();
132
+ innerCache.set(context, innerSubCache);
133
+ }
134
+ else {
135
+ cachedResult = innerSubCache.get(identifier);
136
+ }
137
+ if (cachedResult !== undefined) {
138
+ return cachedResult;
139
+ }
140
+ const result = fn(context, identifier);
141
+ innerSubCache.set(identifier, result);
142
+ return result;
143
+ };
144
+ cachedFn.bindContextCache = (context, associatedObjectForCache) => {
145
+ let innerSubCache;
146
+ if (associatedObjectForCache) {
147
+ let innerCache = cache.get(associatedObjectForCache);
148
+ if (innerCache === undefined) {
149
+ innerCache = new Map();
150
+ cache.set(associatedObjectForCache, innerCache);
151
+ }
152
+ innerSubCache = innerCache.get(context);
153
+ if (innerSubCache === undefined) {
154
+ innerSubCache = new Map();
155
+ innerCache.set(context, innerSubCache);
156
+ }
157
+ }
158
+ else {
159
+ innerSubCache = new Map();
160
+ }
161
+ const boundFn = (identifier) => {
162
+ const cachedResult = innerSubCache.get(identifier);
163
+ if (cachedResult !== undefined) {
164
+ return cachedResult;
165
+ }
166
+ const result = fn(context, identifier);
167
+ innerSubCache.set(identifier, result);
168
+ return result;
169
+ };
170
+ return boundFn;
171
+ };
172
+ return cachedFn;
173
+ };
174
+ const contextify = makeCacheableWithContext(_contextify);
175
+ /**
176
+ * @public
177
+ */
178
+ class AlphaTabWebPackPlugin {
179
+ _webPackWithAlphaTab;
180
+ options;
181
+ constructor(options) {
182
+ this.options = options ?? {};
183
+ }
184
+ apply(compiler) {
185
+ // here we create all plugin related class implementations using
186
+ // the webpack instance provided to this plugin (not as global import)
187
+ // after that we use the helper and factory functions we add to webpack
188
+ const webPackWithAlphaTab = {
189
+ webpack: compiler.webpack,
190
+ alphaTab: {}
191
+ };
192
+ if ('alphaTab' in compiler.webpack.util.serialization.register) {
193
+ // prevent multi registration
194
+ webPackWithAlphaTab.alphaTab = compiler.webpack.util.serialization.register.alphaTab;
195
+ }
196
+ else {
197
+ compiler.webpack.util.serialization.register.alphaTab = webPackWithAlphaTab.alphaTab;
198
+ AlphaTabWebWorkerDependency.injectWebWorkerDependency(webPackWithAlphaTab);
199
+ AlphaTabWorkerRuntimeModule.injectWorkerRuntimeModule(webPackWithAlphaTab);
200
+ AlphaTabWorkletDependency.injectWorkletDependency(webPackWithAlphaTab);
201
+ AlphaTabWorkletStartRuntimeModule.injectWorkletRuntimeModule(webPackWithAlphaTab);
202
+ }
203
+ this._webPackWithAlphaTab = webPackWithAlphaTab;
204
+ this._configureSoundFont(compiler);
205
+ this._configure(compiler);
206
+ }
207
+ _configureSoundFont(compiler) {
208
+ if (this.options.assetOutputDir === false) {
209
+ return;
210
+ }
211
+ // register soundfont as resource
212
+ compiler.options.module.rules.push({
213
+ test: /\.sf2/,
214
+ type: 'asset/resource'
215
+ });
216
+ compiler.options.module.rules.push({
217
+ test: /\.sf3/,
218
+ type: 'asset/resource'
219
+ });
220
+ }
221
+ _configure(compiler) {
222
+ const pluginName = this.constructor.name;
223
+ const cachedContextify = contextify.bindContextCache(compiler.context, compiler.root);
224
+ compiler.hooks.thisCompilation.tap(pluginName, (compilation, { normalModuleFactory }) => {
225
+ this._webPackWithAlphaTab.alphaTab.registerWebWorkerRuntimeModule(pluginName, compilation);
226
+ this._webPackWithAlphaTab.alphaTab.registerWorkletRuntimeModule(pluginName, compilation);
227
+ AlphaTabAudioWorklet.configureAudioWorklet(this._webPackWithAlphaTab, pluginName, this.options, compiler, compilation, normalModuleFactory, cachedContextify);
228
+ AlphaTabWebWorker.configureWebWorker(this._webPackWithAlphaTab, pluginName, this.options, compiler, compilation, normalModuleFactory, cachedContextify);
229
+ this._configureAssetCopy(this._webPackWithAlphaTab, pluginName, compiler, compilation);
230
+ });
231
+ }
232
+ _configureAssetCopy(webPackWithAlphaTab, pluginName, compiler, compilation) {
233
+ if (this.options.assetOutputDir === false) {
234
+ return;
235
+ }
236
+ const options = this.options;
237
+ compilation.hooks.processAssets.tapAsync({
238
+ name: pluginName,
239
+ stage: this._webPackWithAlphaTab.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
240
+ }, async (_, callback) => {
241
+ let alphaTabSourceDir = options.alphaTabSourceDir;
242
+ if (!alphaTabSourceDir) {
243
+ try {
244
+ const isEsm = typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('AlphaTabWebPackPlugin.cjs', document.baseURI).href)) === 'string';
245
+ if (isEsm) {
246
+ alphaTabSourceDir = url__namespace.fileURLToPath(undefined('@coderline/alphatab'));
247
+ }
248
+ else {
249
+ alphaTabSourceDir = require.resolve('@coderline/alphatab');
250
+ }
251
+ alphaTabSourceDir = path__namespace.resolve(alphaTabSourceDir, '..');
252
+ // walk up to package.json
253
+ while (alphaTabSourceDir) {
254
+ if (await fs.promises
255
+ .access(path__namespace.join(alphaTabSourceDir, 'package.json'), fs.constants.F_OK)
256
+ .then(() => true)
257
+ .catch(() => false)) {
258
+ // found package directory
259
+ alphaTabSourceDir = path__namespace.resolve(alphaTabSourceDir, 'dist');
260
+ break;
261
+ }
262
+ else {
263
+ // reached root
264
+ const parent = path__namespace.resolve(alphaTabSourceDir, '..');
265
+ if (parent === alphaTabSourceDir) {
266
+ alphaTabSourceDir = undefined;
267
+ }
268
+ else {
269
+ alphaTabSourceDir = parent;
270
+ }
271
+ }
272
+ }
273
+ }
274
+ catch {
275
+ alphaTabSourceDir = compilation.getPath('node_modules/@coderline/alphatab/dist/');
276
+ }
277
+ }
278
+ let isValidAlphaTabSourceDir;
279
+ if (alphaTabSourceDir) {
280
+ try {
281
+ await fs.promises.access(path__namespace.join(alphaTabSourceDir, 'alphaTab.mjs'), fs.constants.F_OK);
282
+ isValidAlphaTabSourceDir = true;
283
+ }
284
+ catch {
285
+ isValidAlphaTabSourceDir = false;
286
+ }
287
+ }
288
+ else {
289
+ isValidAlphaTabSourceDir = false;
290
+ }
291
+ if (!isValidAlphaTabSourceDir) {
292
+ compilation.errors.push(new this._webPackWithAlphaTab.webpack.WebpackError('Could not find alphaTab, please ensure it is installed into node_modules or configure alphaTabSourceDir'));
293
+ return;
294
+ }
295
+ const outputPath = (options.assetOutputDir ?? compiler.options.output.path);
296
+ if (!outputPath) {
297
+ compilation.errors.push(new this._webPackWithAlphaTab.webpack.WebpackError('Need output.path configured in application to store asset files.'));
298
+ return;
299
+ }
300
+ async function copyFiles(subdir) {
301
+ const fullDir = path__namespace.join(alphaTabSourceDir, subdir);
302
+ compilation.contextDependencies.add(path__namespace.normalize(fullDir));
303
+ const files = await fs.promises.readdir(fullDir, { withFileTypes: true });
304
+ await fs.promises.mkdir(path__namespace.join(outputPath, subdir), { recursive: true });
305
+ await Promise.all(files
306
+ .filter(f => f.isFile())
307
+ .map(async (file) => {
308
+ // node v20.12.0 has parentPath pointing to the path (not the file)
309
+ // see https://github.com/nodejs/node/pull/50976
310
+ const sourceFilename = path__namespace.join(file.parentPath ?? file.path, file.name);
311
+ await fs.promises.copyFile(sourceFilename, path__namespace.join(outputPath, subdir, file.name));
312
+ const assetFileName = `${subdir}/${file.name}`;
313
+ const existingAsset = compilation.getAsset(assetFileName);
314
+ const data = await fs.promises.readFile(sourceFilename);
315
+ const source = new webPackWithAlphaTab.webpack.sources.RawSource(data);
316
+ if (existingAsset) {
317
+ compilation.updateAsset(assetFileName, source, {
318
+ copied: true,
319
+ sourceFilename
320
+ });
321
+ }
322
+ else {
323
+ compilation.emitAsset(assetFileName, source, {
324
+ copied: true,
325
+ sourceFilename
326
+ });
327
+ }
328
+ }));
329
+ }
330
+ await Promise.all([copyFiles('font'), copyFiles('soundfont')]);
331
+ callback();
332
+ });
333
+ }
334
+ }
335
+
336
+ exports.AlphaTabWebPackPlugin = AlphaTabWebPackPlugin;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -0,0 +1,38 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -0,0 +1,105 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const Utils = require('./Utils.cjs');
42
+
43
+ const workerIndexMap = new WeakMap();
44
+ /**
45
+ * Configures the WebWorker aspects within webpack.
46
+ * The counterpart which this plugin detects sits in alphaTab.main.ts
47
+ * @param pluginName
48
+ * @param options
49
+ * @param compiler
50
+ * @param compilation
51
+ * @param normalModuleFactory
52
+ * @param cachedContextify
53
+ * @returns
54
+ * @internal
55
+ */
56
+ function configureWebWorker(webPackWithAlphaTab, pluginName, options, compiler, compilation, normalModuleFactory, cachedContextify) {
57
+ if (options.audioWorklets === false) {
58
+ return;
59
+ }
60
+ webPackWithAlphaTab.alphaTab.registerWebWorkerDependency(compilation, normalModuleFactory);
61
+ new webPackWithAlphaTab.webpack.javascript.EnableChunkLoadingPlugin('import-scripts').apply(compiler);
62
+ const handleAlphaTabWorker = (parser, expr) => {
63
+ const [arg1, arg2] = expr.arguments;
64
+ const parsedUrl = Utils.parseModuleUrl(parser, arg1);
65
+ if (!parsedUrl) {
66
+ return;
67
+ }
68
+ const [url, range] = parsedUrl;
69
+ if (!url.isString()) {
70
+ return;
71
+ }
72
+ const runtime = Utils.getWorkerRuntime(parser, compilation, cachedContextify, workerIndexMap);
73
+ const block = new webPackWithAlphaTab.webpack.AsyncDependenciesBlock({
74
+ entryOptions: {
75
+ chunkLoading: 'import-scripts',
76
+ wasmLoading: false,
77
+ runtime: runtime,
78
+ library: {
79
+ // prevent any built-in/default library settings
80
+ // to be active for this chunk
81
+ type: 'at-worker'
82
+ }
83
+ }
84
+ });
85
+ block.loc = expr.loc;
86
+ const workletBootstrap = webPackWithAlphaTab.alphaTab.createWebWorkerDependency(url.string, range, compiler.options.output.workerPublicPath);
87
+ workletBootstrap.loc = expr.loc;
88
+ block.addDependency(workletBootstrap);
89
+ parser.state.module.addBlock(block);
90
+ const dep1 = new webPackWithAlphaTab.webpack.dependencies.ConstDependency(`{ type: ${compilation.options.output.module ? '"module"' : 'undefined'} }`, arg2.range);
91
+ dep1.loc = expr.loc;
92
+ parser.state.module.addPresentationalDependency(dep1);
93
+ parser.walkExpression(expr.callee);
94
+ parser.walkExpression(arg1.callee);
95
+ return true;
96
+ };
97
+ const parserPlugin = (parser) => {
98
+ parser.hooks.new
99
+ .for('alphaTab.Environment.alphaTabWorker')
100
+ .tap(pluginName, (expr) => handleAlphaTabWorker(parser, expr));
101
+ };
102
+ Utils.tapJavaScript(normalModuleFactory, pluginName, parserPlugin);
103
+ }
104
+
105
+ exports.configureWebWorker = configureWebWorker;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -0,0 +1,106 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const Utils = require('./Utils.cjs');
42
+
43
+ /**
44
+ * @internal
45
+ */
46
+ function injectWebWorkerDependency(webPackWithAlphaTab) {
47
+ class AlphaTabWebWorkerDependency extends webPackWithAlphaTab.webpack.dependencies.ModuleDependency {
48
+ publicPath;
49
+ _hashUpdate;
50
+ constructor(request, range, publicPath) {
51
+ super(request);
52
+ this.range = range;
53
+ this.publicPath = publicPath;
54
+ }
55
+ getReferencedExports() {
56
+ return webPackWithAlphaTab.webpack.Dependency.NO_EXPORTS_REFERENCED;
57
+ }
58
+ get type() {
59
+ return 'alphaTabWorker';
60
+ }
61
+ get category() {
62
+ return 'worker';
63
+ }
64
+ updateHash(hash) {
65
+ if (this._hashUpdate === undefined) {
66
+ this._hashUpdate = JSON.stringify(this.publicPath);
67
+ }
68
+ hash.update(this._hashUpdate);
69
+ }
70
+ serialize(context) {
71
+ const { write } = context;
72
+ write(this.publicPath);
73
+ super.serialize(context);
74
+ }
75
+ deserialize(context) {
76
+ const { read } = context;
77
+ this.publicPath = read();
78
+ super.deserialize(context);
79
+ }
80
+ }
81
+ AlphaTabWebWorkerDependency.Template = class WorkerDependencyTemplate extends (webPackWithAlphaTab.webpack.dependencies.ModuleDependency.Template) {
82
+ apply(dependency, source, templateContext) {
83
+ const { chunkGraph, moduleGraph, runtimeRequirements } = templateContext;
84
+ const dep = dependency;
85
+ const block = moduleGraph.getParentBlock(dependency);
86
+ const entrypoint = chunkGraph.getBlockChunkGroup(block);
87
+ const chunk = entrypoint.getEntrypointChunk();
88
+ // We use the workerPublicPath option if provided, else we fallback to the RuntimeGlobal publicPath
89
+ const workerImportBaseUrl = dep.publicPath
90
+ ? `"${dep.publicPath}"`
91
+ : webPackWithAlphaTab.webpack.RuntimeGlobals.publicPath;
92
+ runtimeRequirements.add(webPackWithAlphaTab.webpack.RuntimeGlobals.publicPath);
93
+ runtimeRequirements.add(webPackWithAlphaTab.webpack.RuntimeGlobals.baseURI);
94
+ runtimeRequirements.add(webPackWithAlphaTab.webpack.RuntimeGlobals.getChunkScriptFilename);
95
+ source.replace(dep.range[0], dep.range[1] - 1, `/* worker import */ ${workerImportBaseUrl} + ${webPackWithAlphaTab.webpack.RuntimeGlobals.getChunkScriptFilename}(${JSON.stringify(chunk.id)}), ${webPackWithAlphaTab.webpack.RuntimeGlobals.baseURI}`);
96
+ }
97
+ };
98
+ Utils.makeDependencySerializable(webPackWithAlphaTab, AlphaTabWebWorkerDependency, 'AlphaTabWebWorkerDependency');
99
+ webPackWithAlphaTab.alphaTab.createWebWorkerDependency = (request, range, publicPath) => new AlphaTabWebWorkerDependency(request, range, publicPath);
100
+ webPackWithAlphaTab.alphaTab.registerWebWorkerDependency = (compilation, normalModuleFactory) => {
101
+ compilation.dependencyFactories.set(AlphaTabWebWorkerDependency, normalModuleFactory);
102
+ compilation.dependencyTemplates.set(AlphaTabWebWorkerDependency, new AlphaTabWebWorkerDependency.Template());
103
+ };
104
+ }
105
+
106
+ exports.injectWebWorkerDependency = injectWebWorkerDependency;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -0,0 +1,109 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const Utils = require('./Utils.cjs');
42
+
43
+ /**
44
+ * @internal
45
+ */
46
+ function injectWorkerRuntimeModule(webPackWithAlphaTab) {
47
+ class AlphaTabWorkerRuntimeModule extends webPackWithAlphaTab.webpack.RuntimeModule {
48
+ static Key = 'AlphaTabWorkerRuntime';
49
+ constructor() {
50
+ super('alphaTab audio worker chunk loading', webPackWithAlphaTab.webpack.RuntimeModule.STAGE_BASIC);
51
+ }
52
+ generate() {
53
+ const compilation = this.compilation;
54
+ const runtimeTemplate = compilation.runtimeTemplate;
55
+ const globalObject = runtimeTemplate.globalObject;
56
+ const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify(compilation.outputOptions.chunkLoadingGlobal)}]`;
57
+ const initialChunkIds = new Set(this.chunk.ids);
58
+ for (const c of this.chunk.getAllInitialChunks()) {
59
+ if (webPackWithAlphaTab.webpack.javascript.JavascriptModulesPlugin.chunkHasJs(c, this.chunkGraph)) {
60
+ continue;
61
+ }
62
+ for (const id of c.ids) {
63
+ initialChunkIds.add(id);
64
+ }
65
+ }
66
+ return webPackWithAlphaTab.webpack.Template.asString([
67
+ `if ( ! ('AudioWorkletGlobalScope' in ${globalObject}) ) { return; }`,
68
+ 'const installedChunks = {',
69
+ webPackWithAlphaTab.webpack.Template.indent(Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join(',\n')),
70
+ '};',
71
+ '// importScripts chunk loading',
72
+ `const installChunk = ${runtimeTemplate.basicFunction('data', [
73
+ runtimeTemplate.destructureArray(['chunkIds', 'moreModules', 'runtime'], 'data'),
74
+ 'for(const moduleId in moreModules) {',
75
+ webPackWithAlphaTab.webpack.Template.indent([
76
+ `if(${webPackWithAlphaTab.webpack.RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`,
77
+ webPackWithAlphaTab.webpack.Template.indent(`${webPackWithAlphaTab.webpack.RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];`),
78
+ '}'
79
+ ]),
80
+ '}',
81
+ `if(runtime) runtime(${webPackWithAlphaTab.webpack.RuntimeGlobals.require});`,
82
+ 'while(chunkIds.length)',
83
+ webPackWithAlphaTab.webpack.Template.indent('installedChunks[chunkIds.pop()] = 1;'),
84
+ 'parentChunkLoadingFunction(data);'
85
+ ])};`,
86
+ `const chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`,
87
+ 'const parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);',
88
+ 'chunkLoadingGlobal.forEach(installChunk);',
89
+ 'chunkLoadingGlobal.push = installChunk;'
90
+ ]);
91
+ }
92
+ }
93
+ webPackWithAlphaTab.alphaTab.registerWebWorkerRuntimeModule = (pluginName, compilation) => {
94
+ compilation.hooks.runtimeRequirementInTree
95
+ .for(AlphaTabWorkerRuntimeModule.Key)
96
+ .tap(pluginName, (chunk) => {
97
+ compilation.addRuntimeModule(chunk, new AlphaTabWorkerRuntimeModule());
98
+ });
99
+ compilation.hooks.additionalChunkRuntimeRequirements.tap(pluginName, (chunk, runtimeRequirements) => {
100
+ if (Utils.isWorkerRuntime(chunk.runtime)) {
101
+ runtimeRequirements.add(webPackWithAlphaTab.webpack.RuntimeGlobals.moduleFactories);
102
+ runtimeRequirements.add(webPackWithAlphaTab.alphaTab.WebWorkerRuntimeModuleKey);
103
+ }
104
+ });
105
+ };
106
+ webPackWithAlphaTab.alphaTab.WebWorkerRuntimeModuleKey = AlphaTabWorkerRuntimeModule.Key;
107
+ }
108
+
109
+ exports.injectWorkerRuntimeModule = injectWorkerRuntimeModule;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -0,0 +1,127 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const Utils = require('./Utils.cjs');
42
+
43
+ /**
44
+ * @internal
45
+ */
46
+ function injectWorkletDependency(webPackWithAlphaTab) {
47
+ /**
48
+ * This module dependency injects the relevant code into a worklet bootstrap script
49
+ * to install chunks which have been added to the worklet via addModule before the bootstrap script starts.
50
+ */
51
+ class AlphaTabWorkletDependency extends webPackWithAlphaTab.webpack.dependencies.ModuleDependency {
52
+ publicPath;
53
+ _hashUpdate;
54
+ constructor(url, range, publicPath) {
55
+ super(url);
56
+ this.range = range;
57
+ this.publicPath = publicPath;
58
+ }
59
+ get type() {
60
+ return 'alphaTabWorklet';
61
+ }
62
+ get category() {
63
+ return 'worker';
64
+ }
65
+ updateHash(hash) {
66
+ if (this._hashUpdate === undefined) {
67
+ this._hashUpdate = JSON.stringify(this.publicPath);
68
+ }
69
+ hash.update(this._hashUpdate);
70
+ }
71
+ serialize(context) {
72
+ const { write } = context;
73
+ write(this.publicPath);
74
+ super.serialize(context);
75
+ }
76
+ deserialize(context) {
77
+ const { read } = context;
78
+ this.publicPath = read();
79
+ super.deserialize(context);
80
+ }
81
+ }
82
+ AlphaTabWorkletDependency.Template = class AlphaTabWorkletDependencyTemplate extends (webPackWithAlphaTab.webpack.dependencies.ModuleDependency.Template) {
83
+ apply(dependency, source, templateContext) {
84
+ const { chunkGraph, moduleGraph, runtimeRequirements } = templateContext;
85
+ const dep = dependency;
86
+ const block = moduleGraph.getParentBlock(dependency);
87
+ const entrypoint = chunkGraph.getBlockChunkGroup(block);
88
+ const workletImportBaseUrl = dep.publicPath
89
+ ? JSON.stringify(dep.publicPath)
90
+ : webPackWithAlphaTab.webpack.RuntimeGlobals.publicPath;
91
+ const chunk = entrypoint.getEntrypointChunk();
92
+ // worklet global scope has no 'self', need to inject it for compatibility with chunks
93
+ // some plugins like the auto public path need to right location. we pass this on from the main runtime
94
+ // some plugins rely on importScripts to be defined.
95
+ const workletInlineBootstrap = `
96
+ globalThis.self = globalThis.self || globalThis;
97
+ globalThis.location = \${JSON.stringify(${webPackWithAlphaTab.webpack.RuntimeGlobals.baseURI})};
98
+ globalThis.importScripts = (url) => { throw new Error("importScripts not available, dynamic loading of chunks not supported in this context", url) };
99
+ `;
100
+ chunkGraph.addChunkRuntimeRequirements(chunk, new Set([
101
+ webPackWithAlphaTab.webpack.RuntimeGlobals.moduleFactories,
102
+ webPackWithAlphaTab.alphaTab.WebWorkerRuntimeModuleKey
103
+ ]));
104
+ runtimeRequirements.add(webPackWithAlphaTab.alphaTab.RuntimeGlobalWorkletGetStartupChunks);
105
+ source.replace(dep.range[0], dep.range[1] - 1, webPackWithAlphaTab.webpack.Template.asString([
106
+ '(/* worklet bootstrap */ async function(__webpack_worklet__) {',
107
+ webPackWithAlphaTab.webpack.Template.indent([
108
+ `await __webpack_worklet__.addModule(URL.createObjectURL(new Blob([\`${workletInlineBootstrap}\`], { type: "application/javascript; charset=utf-8" })));`,
109
+ `for (const fileName of ${webPackWithAlphaTab.alphaTab.RuntimeGlobalWorkletGetStartupChunks}(${JSON.stringify(chunk.id)})) {`,
110
+ webPackWithAlphaTab.webpack.Template.indent([
111
+ `await __webpack_worklet__.addModule(new URL(${workletImportBaseUrl} + fileName, ${webPackWithAlphaTab.webpack.RuntimeGlobals.baseURI}));`
112
+ ]),
113
+ '}'
114
+ ]),
115
+ '})(alphaTabWorklet)'
116
+ ]));
117
+ }
118
+ };
119
+ Utils.makeDependencySerializable(webPackWithAlphaTab, AlphaTabWorkletDependency, 'AlphaTabWorkletDependency');
120
+ webPackWithAlphaTab.alphaTab.registerWorkletDependency = (compilation, normalModuleFactory) => {
121
+ compilation.dependencyFactories.set(AlphaTabWorkletDependency, normalModuleFactory);
122
+ compilation.dependencyTemplates.set(AlphaTabWorkletDependency, new AlphaTabWorkletDependency.Template());
123
+ };
124
+ webPackWithAlphaTab.alphaTab.createWorkletDependency = (request, range, publicPath) => new AlphaTabWorkletDependency(request, range, publicPath);
125
+ }
126
+
127
+ exports.injectWorkletDependency = injectWorkletDependency;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -0,0 +1,93 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const Utils = require('./Utils.cjs');
42
+
43
+ /**
44
+ * @internal
45
+ */
46
+ function injectWorkletRuntimeModule(webPackWithAlphaTab) {
47
+ class AlphaTabWorkletStartRuntimeModule extends webPackWithAlphaTab.webpack.RuntimeModule {
48
+ static RuntimeGlobalWorkletGetStartupChunks = '__webpack_require__.wsc';
49
+ constructor() {
50
+ super('alphaTab audio worklet chunk lookup', webPackWithAlphaTab.webpack.RuntimeModule.STAGE_BASIC);
51
+ }
52
+ generate() {
53
+ const compilation = this.compilation;
54
+ const workletChunkLookup = new Map();
55
+ const allChunks = compilation.chunks;
56
+ for (const chunk of allChunks) {
57
+ const isWorkletEntry = Utils.isWorkerRuntime(chunk.runtime);
58
+ if (isWorkletEntry) {
59
+ const workletChunks = Array.from(chunk.getAllReferencedChunks()).map(c => {
60
+ // force content chunk to be created
61
+ compilation.hooks.contentHash.call(c);
62
+ return compilation.getPath(webPackWithAlphaTab.webpack.javascript.JavascriptModulesPlugin.getChunkFilenameTemplate(c, compilation.outputOptions), {
63
+ chunk: c,
64
+ contentHashType: 'javascript'
65
+ });
66
+ });
67
+ workletChunkLookup.set(String(chunk.id), workletChunks);
68
+ }
69
+ }
70
+ return webPackWithAlphaTab.webpack.Template.asString([
71
+ `${AlphaTabWorkletStartRuntimeModule.RuntimeGlobalWorkletGetStartupChunks} = (() => {`,
72
+ webPackWithAlphaTab.webpack.Template.indent([
73
+ 'const lookup = new Map(',
74
+ webPackWithAlphaTab.webpack.Template.indent(JSON.stringify(Array.from(workletChunkLookup.entries()))),
75
+ ');',
76
+ 'return (chunkId) => lookup.get(String(chunkId)) ?? [];'
77
+ ]),
78
+ '})();'
79
+ ]);
80
+ }
81
+ }
82
+ webPackWithAlphaTab.alphaTab.RuntimeGlobalWorkletGetStartupChunks =
83
+ AlphaTabWorkletStartRuntimeModule.RuntimeGlobalWorkletGetStartupChunks;
84
+ webPackWithAlphaTab.alphaTab.registerWorkletRuntimeModule = (pluginName, compilation) => {
85
+ compilation.hooks.runtimeRequirementInTree
86
+ .for(AlphaTabWorkletStartRuntimeModule.RuntimeGlobalWorkletGetStartupChunks)
87
+ .tap(pluginName, (chunk) => {
88
+ compilation.addRuntimeModule(chunk, new AlphaTabWorkletStartRuntimeModule());
89
+ });
90
+ };
91
+ }
92
+
93
+ exports.injectWorkletRuntimeModule = injectWorkletRuntimeModule;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
package/dist/Utils.cjs ADDED
@@ -0,0 +1,112 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const JAVASCRIPT_MODULE_TYPE_AUTO = 'javascript/auto';
42
+ const JAVASCRIPT_MODULE_TYPE_ESM = 'javascript/esm';
43
+ /**
44
+ * @internal
45
+ */
46
+ function makeDependencySerializable(webPackWithAlphaTab, dependency, key) {
47
+ webPackWithAlphaTab.webpack.util.serialization.register(dependency, key, null, {
48
+ serialize(obj, context) {
49
+ obj.serialize(context);
50
+ },
51
+ deserialize(context) {
52
+ if (typeof dependency.deserialize === 'function') {
53
+ return dependency.deserialize(context);
54
+ }
55
+ const obj = new dependency();
56
+ obj.deserialize(context);
57
+ return obj;
58
+ }
59
+ });
60
+ }
61
+ /**
62
+ * @internal
63
+ */
64
+ function tapJavaScript(normalModuleFactory, pluginName, parserPlugin) {
65
+ normalModuleFactory.hooks.parser.for(JAVASCRIPT_MODULE_TYPE_AUTO).tap(pluginName, parserPlugin);
66
+ normalModuleFactory.hooks.parser.for(JAVASCRIPT_MODULE_TYPE_ESM).tap(pluginName, parserPlugin);
67
+ }
68
+ /**
69
+ * @internal
70
+ */
71
+ function parseModuleUrl(parser, expr) {
72
+ if (expr.type !== 'NewExpression' || expr.arguments.length !== 2) {
73
+ return;
74
+ }
75
+ const newExpr = expr;
76
+ const [arg1, arg2] = newExpr.arguments;
77
+ const callee = parser.evaluateExpression(newExpr.callee);
78
+ if (!callee.isIdentifier() || !callee.identifier.includes('alphaTabUrl')) {
79
+ return;
80
+ }
81
+ const arg1Value = parser.evaluateExpression(arg1);
82
+ return [arg1Value, [arg1.range[0], arg2.range[1]]];
83
+ }
84
+ const ALPHATAB_WORKER_RUNTIME_PREFIX = 'atworker_';
85
+ /**
86
+ * @internal
87
+ */
88
+ function getWorkerRuntime(parser, compilation, cachedContextify, workerIndexMap) {
89
+ const i = workerIndexMap.get(parser.state) || 0;
90
+ workerIndexMap.set(parser.state, i + 1);
91
+ const name = `${cachedContextify(parser.state.module.identifier())}|${i}`;
92
+ const hash = compilation.compiler.webpack.util.createHash(compilation.outputOptions.hashFunction);
93
+ hash.update(name);
94
+ const digest = hash.digest(compilation.outputOptions.hashDigest);
95
+ const runtime = digest.slice(0, compilation.outputOptions.hashDigestLength);
96
+ return ALPHATAB_WORKER_RUNTIME_PREFIX + runtime;
97
+ }
98
+ /**
99
+ * @internal
100
+ */
101
+ function isWorkerRuntime(runtime) {
102
+ if (typeof runtime !== 'string') {
103
+ return false;
104
+ }
105
+ return runtime.startsWith(ALPHATAB_WORKER_RUNTIME_PREFIX);
106
+ }
107
+
108
+ exports.getWorkerRuntime = getWorkerRuntime;
109
+ exports.isWorkerRuntime = isWorkerRuntime;
110
+ exports.makeDependencySerializable = makeDependencySerializable;
111
+ exports.parseModuleUrl = parseModuleUrl;
112
+ exports.tapJavaScript = tapJavaScript;
package/dist/Utils.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -0,0 +1,45 @@
1
+ /*!
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
+ *
4
+ * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * This library uses code from WebPack (https://github.com/webpack/webpack/), licensed under:
11
+ *
12
+ * Copyright JS Foundation and other contributors
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining
15
+ * a copy of this software and associated documentation files (the
16
+ * 'Software'), to deal in the Software without restriction, including
17
+ * without limitation the rights to use, copy, modify, merge, publish,
18
+ * distribute, sublicense, and/or sell copies of the Software, and to
19
+ * permit persons to whom the Software is furnished to do so, subject to
20
+ * the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be
23
+ * included in all copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
26
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+
37
+ 'use strict';
38
+
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+
41
+ const AlphaTabWebPackPlugin = require('./AlphaTabWebPackPlugin.cjs');
42
+
43
+
44
+
45
+ exports.AlphaTabWebPackPlugin = AlphaTabWebPackPlugin.AlphaTabWebPackPlugin;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab WebPack Plugin v1.7.0-alpha.1628 (develop, build 1628)
2
+ * alphaTab WebPack Plugin v1.7.0-alpha.1629 (develop, build 1629)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderline/alphatab-webpack",
3
- "version": "1.7.0-alpha.1628",
3
+ "version": "1.7.0-alpha.1629",
4
4
  "description": "A plugin for WebPack to bundle alphaTab into your webapps.",
5
5
  "keywords": [
6
6
  "guitar",
@@ -22,11 +22,17 @@
22
22
  "url": "git+https://github.com/coderline/alphaTab.git"
23
23
  },
24
24
  "type": "module",
25
- "main": "dist/alphaTab.webpack.mjs",
26
- "module": "dist/alphaTab.webpack.mjs",
27
- "types": "dist/alphaTab.webpack.d.ts",
28
25
  "exports": {
29
- "./*": "./dist/*"
26
+ ".": {
27
+ "require": "./dist/alphaTab.webpack.cjs",
28
+ "import": "./dist/alphaTab.webpack.mjs",
29
+ "types": "./dist/alphaTab.webpack.d.ts"
30
+ },
31
+ "./*": {
32
+ "require": "./dist/*.cjs",
33
+ "import": "./dist/*.mjs",
34
+ "types": "./dist/*.d.ts"
35
+ }
30
36
  },
31
37
  "scripts": {
32
38
  "clean": "rimraf dist",