@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.
- package/dist/AlphaTabVitePluginOptions.cjs +34 -37
- package/dist/AlphaTabVitePluginOptions.mjs +34 -35
- package/dist/alphaTab.vite.cjs +37 -44
- package/dist/alphaTab.vite.mjs +36 -36
- package/dist/alphaTabVitePlugin.cjs +50 -54
- package/dist/alphaTabVitePlugin.mjs +49 -50
- package/dist/bridge/asset.cjs +50 -80
- package/dist/bridge/asset.mjs +47 -57
- package/dist/bridge/build.cjs +152 -214
- package/dist/bridge/build.mjs +149 -191
- package/dist/bridge/bundler.cjs +54 -0
- package/dist/bridge/bundler.mjs +52 -0
- package/dist/bridge/config.cjs +34 -37
- package/dist/bridge/config.mjs +34 -35
- package/dist/bridge/constants.cjs +73 -80
- package/dist/bridge/constants.mjs +72 -76
- package/dist/bridge/fsUtils.cjs +46 -55
- package/dist/bridge/fsUtils.mjs +43 -51
- package/dist/bridge/index.cjs +58 -68
- package/dist/bridge/index.mjs +42 -42
- package/dist/bridge/optimizer.cjs +112 -155
- package/dist/bridge/optimizer.mjs +108 -132
- package/dist/bridge/plugins.cjs +39 -45
- package/dist/bridge/plugins.mjs +38 -41
- package/dist/bridge/resolve.cjs +54 -66
- package/dist/bridge/resolve.mjs +53 -62
- package/dist/bridge/typeUtils.cjs +34 -37
- package/dist/bridge/typeUtils.mjs +34 -35
- package/dist/bridge/utils.cjs +87 -121
- package/dist/bridge/utils.mjs +84 -117
- package/dist/bridge/worker.cjs +179 -183
- package/dist/bridge/worker.mjs +175 -160
- package/dist/copyAssetsPlugin.cjs +102 -163
- package/dist/copyAssetsPlugin.mjs +103 -138
- package/dist/detectionGlobalPlugin.cjs +65 -68
- package/dist/detectionGlobalPlugin.mjs +62 -64
- package/dist/dist.cjs +6629 -0
- package/dist/dist.mjs +6623 -0
- package/dist/importMetaPlugin.cjs +147 -192
- package/dist/importMetaPlugin.mjs +143 -188
- package/dist/prompt-B1Yc1NPt.cjs +885 -0
- package/dist/prompt-B1Yc1NPt.mjs +882 -0
- package/dist/rolldown-runtime.cjs +63 -0
- package/dist/workerPlugin.cjs +145 -219
- package/dist/workerPlugin.mjs +141 -196
- package/package.json +15 -12
|
@@ -1,143 +1,108 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
import
|
|
38
|
-
import * as
|
|
39
|
-
|
|
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
|
-
|
|
43
|
-
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
44
49
|
function copyAssetsPlugin(options) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
46
|
-
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
47
45
|
function detectionGlobalPlugin() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
42
|
-
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
43
42
|
function detectionGlobalPlugin() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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 };
|