@coderline/alphatab-vite 1.9.0-alpha.1785 → 1.9.0-alpha.1861

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.
Files changed (46) hide show
  1. package/dist/AlphaTabVitePluginOptions.cjs +34 -37
  2. package/dist/AlphaTabVitePluginOptions.mjs +34 -35
  3. package/dist/alphaTab.vite.cjs +37 -44
  4. package/dist/alphaTab.vite.mjs +36 -36
  5. package/dist/alphaTabVitePlugin.cjs +50 -54
  6. package/dist/alphaTabVitePlugin.mjs +49 -50
  7. package/dist/bridge/asset.cjs +50 -80
  8. package/dist/bridge/asset.mjs +47 -57
  9. package/dist/bridge/build.cjs +152 -214
  10. package/dist/bridge/build.mjs +149 -191
  11. package/dist/bridge/bundler.cjs +54 -0
  12. package/dist/bridge/bundler.mjs +52 -0
  13. package/dist/bridge/config.cjs +34 -37
  14. package/dist/bridge/config.mjs +34 -35
  15. package/dist/bridge/constants.cjs +73 -80
  16. package/dist/bridge/constants.mjs +72 -76
  17. package/dist/bridge/fsUtils.cjs +46 -55
  18. package/dist/bridge/fsUtils.mjs +43 -51
  19. package/dist/bridge/index.cjs +58 -68
  20. package/dist/bridge/index.mjs +42 -42
  21. package/dist/bridge/optimizer.cjs +112 -155
  22. package/dist/bridge/optimizer.mjs +108 -132
  23. package/dist/bridge/plugins.cjs +39 -45
  24. package/dist/bridge/plugins.mjs +38 -41
  25. package/dist/bridge/resolve.cjs +54 -66
  26. package/dist/bridge/resolve.mjs +53 -62
  27. package/dist/bridge/typeUtils.cjs +34 -37
  28. package/dist/bridge/typeUtils.mjs +34 -35
  29. package/dist/bridge/utils.cjs +87 -121
  30. package/dist/bridge/utils.mjs +84 -117
  31. package/dist/bridge/worker.cjs +179 -183
  32. package/dist/bridge/worker.mjs +175 -160
  33. package/dist/copyAssetsPlugin.cjs +102 -163
  34. package/dist/copyAssetsPlugin.mjs +103 -138
  35. package/dist/detectionGlobalPlugin.cjs +65 -68
  36. package/dist/detectionGlobalPlugin.mjs +62 -64
  37. package/dist/dist.cjs +6629 -0
  38. package/dist/dist.mjs +6623 -0
  39. package/dist/importMetaPlugin.cjs +147 -192
  40. package/dist/importMetaPlugin.mjs +143 -188
  41. package/dist/prompt-B1Yc1NPt.cjs +885 -0
  42. package/dist/prompt-B1Yc1NPt.mjs +882 -0
  43. package/dist/rolldown-runtime.cjs +63 -0
  44. package/dist/workerPlugin.cjs +145 -219
  45. package/dist/workerPlugin.mjs +141 -196
  46. package/package.json +15 -12
@@ -1,143 +1,108 @@
1
1
  /*!
2
- * alphaTab Vite Plugin v1.9.0-alpha.1785 (develop, build 1785)
3
- *
4
- * Copyright © 2026, 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 Vite (https://github.com/vitejs/vite/), licensed under:
11
- *
12
- * MIT License
13
- * Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
14
- *
15
- * Permission is hereby granted, free of charge, to any person obtaining a copy
16
- * of this software and associated documentation files (the "Software"), to deal
17
- * in the Software without restriction, including without limitation the rights
18
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
- * copies of the Software, and to permit persons to whom the Software is
20
- * furnished to do so, subject to the following conditions:
21
- *
22
- * The above copyright notice and this permission notice shall be included in all
23
- * copies or substantial portions of the Software.
24
- *
25
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- *
33
- * @preserve
34
- * @license
35
- */
36
-
37
- import fs from 'node:fs';
38
- import * as path from 'node:path';
39
- import * as url from 'node:url';
40
-
2
+ * alphaTab Vite Plugin v1.9.0-alpha.1861 (develop, build 1861)
3
+ *
4
+ * Copyright © 2026, 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 Vite (https://github.com/vitejs/vite/), licensed under:
11
+ *
12
+ * MIT License
13
+ * Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ * of this software and associated documentation files (the "Software"), to deal
17
+ * in the Software without restriction, including without limitation the rights
18
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ * copies of the Software, and to permit persons to whom the Software is
20
+ * furnished to do so, subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all
23
+ * copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ * SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+ import fs from "node:fs";
37
+ import * as path$1 from "node:path";
38
+ import * as url from "node:url";
39
+ //#region \0rolldown/runtime.js
40
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
41
+ if (typeof require !== "undefined") return require.apply(this, arguments);
42
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
43
+ });
44
+ //#endregion
45
+ //#region src/copyAssetsPlugin.ts
41
46
  /**
42
- * @public
43
- */
47
+ * @public
48
+ */
44
49
  function copyAssetsPlugin(options) {
45
- let resolvedConfig;
46
- let output = false;
47
- return {
48
- name: 'vite-plugin-alphatab-copy',
49
- enforce: 'pre',
50
- configResolved(config) {
51
- resolvedConfig = config;
52
- },
53
- buildEnd() {
54
- // reset for watch mode
55
- output = false;
56
- },
57
- async buildStart() {
58
- // run copy only once even if multiple bundles are generated
59
- if (output) {
60
- return;
61
- }
62
- output = true;
63
- let alphaTabSourceDir = options.alphaTabSourceDir;
64
- if (!alphaTabSourceDir) {
65
- try {
66
- const isEsm = typeof import.meta.url === 'string';
67
- if (isEsm) {
68
- alphaTabSourceDir = url.fileURLToPath(import.meta.resolve('@coderline/alphatab'));
69
- }
70
- else {
71
- alphaTabSourceDir = require.resolve('@coderline/alphatab');
72
- }
73
- alphaTabSourceDir = path.resolve(alphaTabSourceDir, '..');
74
- // walk up to package.json
75
- while (alphaTabSourceDir) {
76
- if (await fs.promises
77
- .access(path.join(alphaTabSourceDir, 'package.json'), fs.constants.F_OK)
78
- .then(() => true)
79
- .catch(() => false)) {
80
- // found package directory
81
- alphaTabSourceDir = path.resolve(alphaTabSourceDir, 'dist');
82
- break;
83
- }
84
- else {
85
- // reached root
86
- const parent = path.resolve(alphaTabSourceDir, '..');
87
- if (parent === alphaTabSourceDir) {
88
- alphaTabSourceDir = undefined;
89
- }
90
- else {
91
- alphaTabSourceDir = parent;
92
- }
93
- }
94
- }
95
- }
96
- catch {
97
- alphaTabSourceDir = path.join(resolvedConfig.root, 'node_modules/@coderline/alphatab/dist/');
98
- }
99
- }
100
- let isValidAlphaTabSourceDir;
101
- if (alphaTabSourceDir) {
102
- try {
103
- await fs.promises.access(path.join(alphaTabSourceDir, 'alphaTab.mjs'), fs.constants.F_OK);
104
- isValidAlphaTabSourceDir = true;
105
- }
106
- catch {
107
- isValidAlphaTabSourceDir = false;
108
- }
109
- }
110
- else {
111
- isValidAlphaTabSourceDir = false;
112
- }
113
- if (!isValidAlphaTabSourceDir) {
114
- resolvedConfig.logger.error('Could not find alphaTab, please ensure it is installed into node_modules or configure alphaTabSourceDir');
115
- return;
116
- }
117
- const outputPath = (options.assetOutputDir ?? resolvedConfig.publicDir);
118
- if (!outputPath) {
119
- return;
120
- }
121
- async function copyFiles(subdir) {
122
- const fullDir = path.join(alphaTabSourceDir, subdir);
123
- const files = await fs.promises.readdir(fullDir, {
124
- withFileTypes: true
125
- });
126
- await fs.promises.mkdir(path.join(outputPath, subdir), {
127
- recursive: true
128
- });
129
- await Promise.all(files
130
- .filter(f => f.isFile())
131
- .map(async (file) => {
132
- // node v20.12.0 has parentPath pointing to the path (not the file)
133
- // see https://github.com/nodejs/node/pull/50976
134
- const sourceFilename = path.join(file.parentPath ?? file.path, file.name);
135
- await fs.promises.copyFile(sourceFilename, path.join(outputPath, subdir, file.name));
136
- }));
137
- }
138
- await Promise.all([copyFiles('font'), copyFiles('soundfont')]);
139
- }
140
- };
50
+ let resolvedConfig;
51
+ let output = false;
52
+ return {
53
+ name: "vite-plugin-alphatab-copy",
54
+ enforce: "pre",
55
+ configResolved(config) {
56
+ resolvedConfig = config;
57
+ },
58
+ buildEnd() {
59
+ output = false;
60
+ },
61
+ async buildStart() {
62
+ if (output) return;
63
+ output = true;
64
+ let alphaTabSourceDir = options.alphaTabSourceDir;
65
+ if (!alphaTabSourceDir) try {
66
+ if (typeof import.meta.url === "string") alphaTabSourceDir = url.fileURLToPath(import.meta.resolve("@coderline/alphatab"));
67
+ else alphaTabSourceDir = __require.resolve("@coderline/alphatab");
68
+ alphaTabSourceDir = path$1.resolve(alphaTabSourceDir, "..");
69
+ while (alphaTabSourceDir) if (await fs.promises.access(path$1.join(alphaTabSourceDir, "package.json"), fs.constants.F_OK).then(() => true).catch(() => false)) {
70
+ alphaTabSourceDir = path$1.resolve(alphaTabSourceDir, "dist");
71
+ break;
72
+ } else {
73
+ const parent = path$1.resolve(alphaTabSourceDir, "..");
74
+ if (parent === alphaTabSourceDir) alphaTabSourceDir = void 0;
75
+ else alphaTabSourceDir = parent;
76
+ }
77
+ } catch {
78
+ alphaTabSourceDir = path$1.join(resolvedConfig.root, "node_modules/@coderline/alphatab/dist/");
79
+ }
80
+ let isValidAlphaTabSourceDir;
81
+ if (alphaTabSourceDir) try {
82
+ await fs.promises.access(path$1.join(alphaTabSourceDir, "alphaTab.mjs"), fs.constants.F_OK);
83
+ isValidAlphaTabSourceDir = true;
84
+ } catch {
85
+ isValidAlphaTabSourceDir = false;
86
+ }
87
+ else isValidAlphaTabSourceDir = false;
88
+ if (!isValidAlphaTabSourceDir) {
89
+ resolvedConfig.logger.error("Could not find alphaTab, please ensure it is installed into node_modules or configure alphaTabSourceDir");
90
+ return;
91
+ }
92
+ const outputPath = options.assetOutputDir ?? resolvedConfig.publicDir;
93
+ if (!outputPath) return;
94
+ async function copyFiles(subdir) {
95
+ const fullDir = path$1.join(alphaTabSourceDir, subdir);
96
+ const files = await fs.promises.readdir(fullDir, { withFileTypes: true });
97
+ await fs.promises.mkdir(path$1.join(outputPath, subdir), { recursive: true });
98
+ await Promise.all(files.filter((f) => f.isFile()).map(async (file) => {
99
+ const sourceFilename = path$1.join(file.parentPath ?? file.path, file.name);
100
+ await fs.promises.copyFile(sourceFilename, path$1.join(outputPath, subdir, file.name));
101
+ }));
102
+ }
103
+ await Promise.all([copyFiles("font"), copyFiles("soundfont")]);
104
+ }
105
+ };
141
106
  }
142
-
107
+ //#endregion
143
108
  export { copyAssetsPlugin };
@@ -1,73 +1,70 @@
1
1
  /*!
2
- * alphaTab Vite Plugin v1.9.0-alpha.1785 (develop, build 1785)
3
- *
4
- * Copyright © 2026, 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 Vite (https://github.com/vitejs/vite/), licensed under:
11
- *
12
- * MIT License
13
- * Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
14
- *
15
- * Permission is hereby granted, free of charge, to any person obtaining a copy
16
- * of this software and associated documentation files (the "Software"), to deal
17
- * in the Software without restriction, including without limitation the rights
18
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
- * copies of the Software, and to permit persons to whom the Software is
20
- * furnished to do so, subject to the following conditions:
21
- *
22
- * The above copyright notice and this permission notice shall be included in all
23
- * copies or substantial portions of the Software.
24
- *
25
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- *
33
- * @preserve
34
- * @license
35
- */
36
-
37
- 'use strict';
38
-
39
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
-
41
- const MagicString = require('magic-string');
42
-
43
- const marker = '__ALPHATAB_VITE__';
2
+ * alphaTab Vite Plugin v1.9.0-alpha.1861 (develop, build 1861)
3
+ *
4
+ * Copyright © 2026, 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 Vite (https://github.com/vitejs/vite/), licensed under:
11
+ *
12
+ * MIT License
13
+ * Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ * of this software and associated documentation files (the "Software"), to deal
17
+ * in the Software without restriction, including without limitation the rights
18
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ * copies of the Software, and to permit persons to whom the Software is
20
+ * furnished to do so, subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all
23
+ * copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ * SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
37
+ const require_rolldown_runtime = require("./rolldown-runtime.cjs");
38
+ let magic_string = require("magic-string");
39
+ magic_string = require_rolldown_runtime.__toESM(magic_string, 1);
40
+ //#region src/detectionGlobalPlugin.ts
41
+ var marker = "__ALPHATAB_VITE__";
44
42
  /**
45
- * @public
46
- */
43
+ * @public
44
+ */
47
45
  function detectionGlobalPlugin() {
48
- let resolvedConfig;
49
- return {
50
- name: 'vite-plugin-alphatab-global',
51
- configResolved(config) {
52
- resolvedConfig = config;
53
- },
54
- shouldTransformCachedModule({ code }) {
55
- return code.includes(marker);
56
- },
57
- async transform(code, id) {
58
- if (!code.includes(marker)) {
59
- return;
60
- }
61
- const s = new MagicString(code);
62
- s.replaceAll(marker, JSON.stringify(true));
63
- return {
64
- code: s.toString(),
65
- map: resolvedConfig.command === 'build' && resolvedConfig.build.sourcemap
66
- ? s.generateMap({ hires: 'boundary', source: id })
67
- : null
68
- };
69
- }
70
- };
46
+ let resolvedConfig;
47
+ return {
48
+ name: "vite-plugin-alphatab-global",
49
+ configResolved(config) {
50
+ resolvedConfig = config;
51
+ },
52
+ shouldTransformCachedModule({ code }) {
53
+ return code.includes(marker);
54
+ },
55
+ async transform(code, id) {
56
+ if (!code.includes(marker)) return;
57
+ const s = new magic_string.default(code);
58
+ s.replaceAll(marker, JSON.stringify(true));
59
+ return {
60
+ code: s.toString(),
61
+ map: resolvedConfig.command === "build" && resolvedConfig.build.sourcemap ? s.generateMap({
62
+ hires: "boundary",
63
+ source: id
64
+ }) : null
65
+ };
66
+ }
67
+ };
71
68
  }
72
-
69
+ //#endregion
73
70
  exports.detectionGlobalPlugin = detectionGlobalPlugin;
@@ -1,69 +1,67 @@
1
1
  /*!
2
- * alphaTab Vite Plugin v1.9.0-alpha.1785 (develop, build 1785)
3
- *
4
- * Copyright © 2026, 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 Vite (https://github.com/vitejs/vite/), licensed under:
11
- *
12
- * MIT License
13
- * Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
14
- *
15
- * Permission is hereby granted, free of charge, to any person obtaining a copy
16
- * of this software and associated documentation files (the "Software"), to deal
17
- * in the Software without restriction, including without limitation the rights
18
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
- * copies of the Software, and to permit persons to whom the Software is
20
- * furnished to do so, subject to the following conditions:
21
- *
22
- * The above copyright notice and this permission notice shall be included in all
23
- * copies or substantial portions of the Software.
24
- *
25
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- *
33
- * @preserve
34
- * @license
35
- */
36
-
37
- import MagicString from 'magic-string';
38
-
39
- const marker = '__ALPHATAB_VITE__';
2
+ * alphaTab Vite Plugin v1.9.0-alpha.1861 (develop, build 1861)
3
+ *
4
+ * Copyright © 2026, 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 Vite (https://github.com/vitejs/vite/), licensed under:
11
+ *
12
+ * MIT License
13
+ * Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ * of this software and associated documentation files (the "Software"), to deal
17
+ * in the Software without restriction, including without limitation the rights
18
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ * copies of the Software, and to permit persons to whom the Software is
20
+ * furnished to do so, subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all
23
+ * copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ * SOFTWARE.
32
+ *
33
+ * @preserve
34
+ * @license
35
+ */
36
+ import MagicString from "magic-string";
37
+ //#region src/detectionGlobalPlugin.ts
38
+ var marker = "__ALPHATAB_VITE__";
40
39
  /**
41
- * @public
42
- */
40
+ * @public
41
+ */
43
42
  function detectionGlobalPlugin() {
44
- let resolvedConfig;
45
- return {
46
- name: 'vite-plugin-alphatab-global',
47
- configResolved(config) {
48
- resolvedConfig = config;
49
- },
50
- shouldTransformCachedModule({ code }) {
51
- return code.includes(marker);
52
- },
53
- async transform(code, id) {
54
- if (!code.includes(marker)) {
55
- return;
56
- }
57
- const s = new MagicString(code);
58
- s.replaceAll(marker, JSON.stringify(true));
59
- return {
60
- code: s.toString(),
61
- map: resolvedConfig.command === 'build' && resolvedConfig.build.sourcemap
62
- ? s.generateMap({ hires: 'boundary', source: id })
63
- : null
64
- };
65
- }
66
- };
43
+ let resolvedConfig;
44
+ return {
45
+ name: "vite-plugin-alphatab-global",
46
+ configResolved(config) {
47
+ resolvedConfig = config;
48
+ },
49
+ shouldTransformCachedModule({ code }) {
50
+ return code.includes(marker);
51
+ },
52
+ async transform(code, id) {
53
+ if (!code.includes(marker)) return;
54
+ const s = new MagicString(code);
55
+ s.replaceAll(marker, JSON.stringify(true));
56
+ return {
57
+ code: s.toString(),
58
+ map: resolvedConfig.command === "build" && resolvedConfig.build.sourcemap ? s.generateMap({
59
+ hires: "boundary",
60
+ source: id
61
+ }) : null
62
+ };
63
+ }
64
+ };
67
65
  }
68
-
66
+ //#endregion
69
67
  export { detectionGlobalPlugin };