@coderline/alphatab-vite 1.8.1 → 1.8.3
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/chunk.cjs +63 -0
- package/dist/copyAssetsPlugin.cjs +102 -163
- package/dist/copyAssetsPlugin.mjs +35 -141
- package/dist/copyAssetsPlugin2.mjs +108 -0
- package/dist/detectionGlobalPlugin.cjs +65 -68
- package/dist/detectionGlobalPlugin.mjs +62 -64
- package/dist/dist.cjs +6595 -0
- package/dist/dist.mjs +6589 -0
- package/dist/importMetaPlugin.cjs +147 -192
- package/dist/importMetaPlugin.mjs +143 -188
- package/dist/prompt-DewH0PjV.cjs +885 -0
- package/dist/prompt-DewH0PjV.mjs +882 -0
- package/dist/workerPlugin.cjs +145 -219
- package/dist/workerPlugin.mjs +141 -196
- package/package.json +17 -17
|
@@ -1,168 +1,107 @@
|
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
46
|
-
function _interopNamespaceDefault(e) {
|
|
47
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
48
|
-
if (e) {
|
|
49
|
-
for (const k in e) {
|
|
50
|
-
if (k !== 'default') {
|
|
51
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
52
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: () => e[k]
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
n.default = e;
|
|
60
|
-
return Object.freeze(n);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
64
|
-
const url__namespace = /*#__PURE__*/_interopNamespaceDefault(url);
|
|
65
|
-
|
|
2
|
+
* alphaTab Vite Plugin v1.8.3 (, build 32)
|
|
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_chunk = require("./chunk.cjs");
|
|
38
|
+
let node_fs = require("node:fs");
|
|
39
|
+
node_fs = require_chunk.__toESM(node_fs, 1);
|
|
40
|
+
let node_path = require("node:path");
|
|
41
|
+
node_path = require_chunk.__toESM(node_path, 1);
|
|
42
|
+
let node_url = require("node:url");
|
|
43
|
+
node_url = require_chunk.__toESM(node_url, 1);
|
|
44
|
+
//#region src/copyAssetsPlugin.ts
|
|
66
45
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
69
48
|
function copyAssetsPlugin(options) {
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (alphaTabSourceDir) {
|
|
127
|
-
try {
|
|
128
|
-
await fs.promises.access(path__namespace.join(alphaTabSourceDir, 'alphaTab.mjs'), fs.constants.F_OK);
|
|
129
|
-
isValidAlphaTabSourceDir = true;
|
|
130
|
-
}
|
|
131
|
-
catch {
|
|
132
|
-
isValidAlphaTabSourceDir = false;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
isValidAlphaTabSourceDir = false;
|
|
137
|
-
}
|
|
138
|
-
if (!isValidAlphaTabSourceDir) {
|
|
139
|
-
resolvedConfig.logger.error('Could not find alphaTab, please ensure it is installed into node_modules or configure alphaTabSourceDir');
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
const outputPath = (options.assetOutputDir ?? resolvedConfig.publicDir);
|
|
143
|
-
if (!outputPath) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
async function copyFiles(subdir) {
|
|
147
|
-
const fullDir = path__namespace.join(alphaTabSourceDir, subdir);
|
|
148
|
-
const files = await fs.promises.readdir(fullDir, {
|
|
149
|
-
withFileTypes: true
|
|
150
|
-
});
|
|
151
|
-
await fs.promises.mkdir(path__namespace.join(outputPath, subdir), {
|
|
152
|
-
recursive: true
|
|
153
|
-
});
|
|
154
|
-
await Promise.all(files
|
|
155
|
-
.filter(f => f.isFile())
|
|
156
|
-
.map(async (file) => {
|
|
157
|
-
// node v20.12.0 has parentPath pointing to the path (not the file)
|
|
158
|
-
// see https://github.com/nodejs/node/pull/50976
|
|
159
|
-
const sourceFilename = path__namespace.join(file.parentPath ?? file.path, file.name);
|
|
160
|
-
await fs.promises.copyFile(sourceFilename, path__namespace.join(outputPath, subdir, file.name));
|
|
161
|
-
}));
|
|
162
|
-
}
|
|
163
|
-
await Promise.all([copyFiles('font'), copyFiles('soundfont')]);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
49
|
+
let resolvedConfig;
|
|
50
|
+
let output = false;
|
|
51
|
+
return {
|
|
52
|
+
name: "vite-plugin-alphatab-copy",
|
|
53
|
+
enforce: "pre",
|
|
54
|
+
configResolved(config) {
|
|
55
|
+
resolvedConfig = config;
|
|
56
|
+
},
|
|
57
|
+
buildEnd() {
|
|
58
|
+
output = false;
|
|
59
|
+
},
|
|
60
|
+
async buildStart() {
|
|
61
|
+
if (output) return;
|
|
62
|
+
output = true;
|
|
63
|
+
let alphaTabSourceDir = options.alphaTabSourceDir;
|
|
64
|
+
if (!alphaTabSourceDir) try {
|
|
65
|
+
if (typeof {}.url === "string") alphaTabSourceDir = node_url.fileURLToPath({}.resolve("@coderline/alphatab"));
|
|
66
|
+
else alphaTabSourceDir = require.resolve("@coderline/alphatab");
|
|
67
|
+
alphaTabSourceDir = node_path.resolve(alphaTabSourceDir, "..");
|
|
68
|
+
while (alphaTabSourceDir) if (await node_fs.default.promises.access(node_path.join(alphaTabSourceDir, "package.json"), node_fs.default.constants.F_OK).then(() => true).catch(() => false)) {
|
|
69
|
+
alphaTabSourceDir = node_path.resolve(alphaTabSourceDir, "dist");
|
|
70
|
+
break;
|
|
71
|
+
} else {
|
|
72
|
+
const parent = node_path.resolve(alphaTabSourceDir, "..");
|
|
73
|
+
if (parent === alphaTabSourceDir) alphaTabSourceDir = void 0;
|
|
74
|
+
else alphaTabSourceDir = parent;
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
alphaTabSourceDir = node_path.join(resolvedConfig.root, "node_modules/@coderline/alphatab/dist/");
|
|
78
|
+
}
|
|
79
|
+
let isValidAlphaTabSourceDir;
|
|
80
|
+
if (alphaTabSourceDir) try {
|
|
81
|
+
await node_fs.default.promises.access(node_path.join(alphaTabSourceDir, "alphaTab.mjs"), node_fs.default.constants.F_OK);
|
|
82
|
+
isValidAlphaTabSourceDir = true;
|
|
83
|
+
} catch {
|
|
84
|
+
isValidAlphaTabSourceDir = false;
|
|
85
|
+
}
|
|
86
|
+
else isValidAlphaTabSourceDir = false;
|
|
87
|
+
if (!isValidAlphaTabSourceDir) {
|
|
88
|
+
resolvedConfig.logger.error("Could not find alphaTab, please ensure it is installed into node_modules or configure alphaTabSourceDir");
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const outputPath = options.assetOutputDir ?? resolvedConfig.publicDir;
|
|
92
|
+
if (!outputPath) return;
|
|
93
|
+
async function copyFiles(subdir) {
|
|
94
|
+
const fullDir = node_path.join(alphaTabSourceDir, subdir);
|
|
95
|
+
const files = await node_fs.default.promises.readdir(fullDir, { withFileTypes: true });
|
|
96
|
+
await node_fs.default.promises.mkdir(node_path.join(outputPath, subdir), { recursive: true });
|
|
97
|
+
await Promise.all(files.filter((f) => f.isFile()).map(async (file) => {
|
|
98
|
+
const sourceFilename = node_path.join(file.parentPath ?? file.path, file.name);
|
|
99
|
+
await node_fs.default.promises.copyFile(sourceFilename, node_path.join(outputPath, subdir, file.name));
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
await Promise.all([copyFiles("font"), copyFiles("soundfont")]);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
166
105
|
}
|
|
167
|
-
|
|
106
|
+
//#endregion
|
|
168
107
|
exports.copyAssetsPlugin = copyAssetsPlugin;
|
|
@@ -1,143 +1,37 @@
|
|
|
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 fs from 'node:fs';
|
|
38
|
-
import * as path from 'node:path';
|
|
39
|
-
import * as url from 'node:url';
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
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
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
2
|
+
* alphaTab Vite Plugin v1.8.3 (, build 32)
|
|
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 { t as copyAssetsPlugin } from "./copyAssetsPlugin2.mjs";
|
|
143
37
|
export { copyAssetsPlugin };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.8.3 (, build 32)
|
|
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
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
function copyAssetsPlugin(options) {
|
|
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
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { copyAssetsPlugin as t };
|