| 12 | |
| 13 | // ensure we have file extensions in the URL worker resolve area |
| 14 | const adjustScriptPathsPlugin = (min: boolean) => { |
| 15 | return { |
| 16 | name: 'adjust-script-paths', |
| 17 | renderChunk(code) { |
| 18 | const modifiedCode = new MagicString(code); |
| 19 | const extension = min ? '.min.mjs' : '.mjs'; |
| 20 | modifiedCode.replaceAll( |
| 21 | /(@coderline\/alphatab|\.)\/alphaTab\.(core|worker|worklet)(\.ts)?(['"])/g, |
| 22 | `./alphaTab.$2${extension}$4` |
| 23 | ); |
| 24 | |
| 25 | return { |
| 26 | code: modifiedCode.toString(), |
| 27 | map: modifiedCode.generateMap() |
| 28 | }; |
| 29 | } |
| 30 | } satisfies Plugin; |
| 31 | }; |
| 32 | |
| 33 | // Rolldown unconditionally lowers top-level `class X { ... }` declarations to |
| 34 | // `var X = class { ... };` (documented as TDZ-hoisting behaviour, independent |