@coderline/alphatab-vite 1.7.0 → 1.7.1
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 +38 -0
- package/dist/AlphaTabVitePluginOptions.d.ts +30 -0
- package/dist/AlphaTabVitePluginOptions.mjs +36 -0
- package/dist/alphaTab.vite.cjs +45 -0
- package/dist/alphaTab.vite.d.ts +1 -33
- package/dist/alphaTab.vite.mjs +2 -2328
- package/dist/alphaTabVitePlugin.cjs +57 -0
- package/dist/alphaTabVitePlugin.d.ts +5 -0
- package/dist/alphaTabVitePlugin.mjs +53 -0
- package/dist/bridge/asset.cjs +87 -0
- package/dist/bridge/asset.mjs +63 -0
- package/dist/bridge/build.cjs +242 -0
- package/dist/bridge/build.mjs +217 -0
- package/dist/bridge/config.cjs +38 -0
- package/dist/bridge/config.mjs +36 -0
- package/dist/bridge/constants.cjs +88 -0
- package/dist/bridge/constants.mjs +82 -0
- package/dist/bridge/fsUtils.cjs +60 -0
- package/dist/bridge/fsUtils.mjs +56 -0
- package/dist/bridge/index.cjs +69 -0
- package/dist/bridge/index.mjs +43 -0
- package/dist/bridge/optimizer.cjs +172 -0
- package/dist/bridge/optimizer.mjs +148 -0
- package/dist/bridge/plugins.cjs +51 -0
- package/dist/bridge/plugins.mjs +47 -0
- package/dist/bridge/resolve.cjs +75 -0
- package/dist/bridge/resolve.mjs +71 -0
- package/dist/bridge/typeUtils.cjs +38 -0
- package/dist/bridge/typeUtils.d.ts +3 -0
- package/dist/bridge/typeUtils.mjs +36 -0
- package/dist/bridge/utils.cjs +164 -0
- package/dist/bridge/utils.mjs +151 -0
- package/dist/bridge/worker.cjs +207 -0
- package/dist/bridge/worker.d.ts +10 -0
- package/dist/bridge/worker.mjs +180 -0
- package/dist/copyAssetsPlugin.cjs +168 -0
- package/dist/copyAssetsPlugin.d.ts +5 -0
- package/dist/copyAssetsPlugin.mjs +143 -0
- package/dist/importMetaPlugin.cjs +201 -0
- package/dist/importMetaPlugin.d.ts +5 -0
- package/dist/importMetaPlugin.mjs +197 -0
- package/dist/workerPlugin.cjs +224 -0
- package/dist/workerPlugin.d.ts +5 -0
- package/dist/workerPlugin.mjs +201 -0
- package/package.json +32 -19
- package/dist/alphaTab.vite.js +0 -2388
- package/dist/alphaTab.vite.min.mjs +0 -36
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.7.1 (, build 24)
|
|
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 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
|
+
export { fileToUrl } from './asset.mjs';
|
|
38
|
+
export { createToImportMetaURLBasedRelativeRuntime, toOutputFilePathInJS } from './build.mjs';
|
|
39
|
+
export { ENV_PUBLIC_PATH } from './constants.mjs';
|
|
40
|
+
export { tryOptimizedDepResolve } from './optimizer.mjs';
|
|
41
|
+
export { tryFsResolve } from './resolve.mjs';
|
|
42
|
+
export { cleanUrl, encodeURIPath, evalValue, injectQuery } from './utils.mjs';
|
|
43
|
+
export { AlphaTabWorkerTypes, WORKER_ASSET_ID, WORKER_FILE_ID, isSameContent, workerCache, workerFileToUrl } from './worker.mjs';
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.7.1 (, build 24)
|
|
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 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 fs = require('node:fs');
|
|
42
|
+
const path = require('node:path');
|
|
43
|
+
const vite = require('vite');
|
|
44
|
+
const bridge_constants = require('./constants.cjs');
|
|
45
|
+
const bridge_resolve = require('./resolve.cjs');
|
|
46
|
+
const bridge_utils = require('./utils.cjs');
|
|
47
|
+
|
|
48
|
+
function _interopNamespaceDefault(e) {
|
|
49
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
50
|
+
if (e) {
|
|
51
|
+
for (const k in e) {
|
|
52
|
+
if (k !== 'default') {
|
|
53
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
54
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: () => e[k]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
n.default = e;
|
|
62
|
+
return Object.freeze(n);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
66
|
+
|
|
67
|
+
// index.ts for more details on contents and license of this file
|
|
68
|
+
// https://github.com/Danielku15/vite/blob/88b7def341f12d07d7d4f83cbe3dc73cc8c6b7be/packages/vite/src/node/optimizer/index.ts#L1356
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
function tryOptimizedDepResolve(config, ssr, url, depId, preserveSymlinks) {
|
|
73
|
+
const optimizer = getDepsOptimizer(config, ssr);
|
|
74
|
+
if (optimizer?.isOptimizedDepFile(depId)) {
|
|
75
|
+
const depFile = bridge_utils.cleanUrl(depId);
|
|
76
|
+
const info = optimizedDepInfoFromFile(optimizer.metadata, depFile);
|
|
77
|
+
const depSrc = info?.src;
|
|
78
|
+
if (depSrc) {
|
|
79
|
+
const resolvedFile = path__namespace.resolve(path__namespace.dirname(depSrc), url);
|
|
80
|
+
return bridge_resolve.tryFsResolve(resolvedFile, preserveSymlinks);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
// https://github.com/Danielku15/vite/blob/88b7def341f12d07d7d4f83cbe3dc73cc8c6b7be/packages/vite/src/node/optimizer/optimizer.ts#L32-L40
|
|
86
|
+
const depsOptimizerMap = new WeakMap();
|
|
87
|
+
const devSsrDepsOptimizerMap = new WeakMap();
|
|
88
|
+
function getDepsOptimizer(config, ssr) {
|
|
89
|
+
const map = ssr ? devSsrDepsOptimizerMap : depsOptimizerMap;
|
|
90
|
+
let optimizer = map.get(config);
|
|
91
|
+
if (!optimizer) {
|
|
92
|
+
optimizer = createDepsOptimizer(config);
|
|
93
|
+
map.set(config, optimizer);
|
|
94
|
+
}
|
|
95
|
+
return optimizer;
|
|
96
|
+
}
|
|
97
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/optimizer.ts#L79
|
|
98
|
+
function createDepsOptimizer(config) {
|
|
99
|
+
const depsCacheDirPrefix = vite.normalizePath(path__namespace.resolve(config.cacheDir, 'deps'));
|
|
100
|
+
const metadata = parseDepsOptimizerMetadata(fs.readFileSync(path__namespace.join(depsCacheDirPrefix, bridge_constants.METADATA_FILENAME), 'utf8'), depsCacheDirPrefix);
|
|
101
|
+
const notImplemented = () => {
|
|
102
|
+
throw new Error('not implemented');
|
|
103
|
+
};
|
|
104
|
+
const depsOptimizer = {
|
|
105
|
+
async init() { },
|
|
106
|
+
metadata,
|
|
107
|
+
registerMissingImport: notImplemented,
|
|
108
|
+
run: notImplemented,
|
|
109
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L916
|
|
110
|
+
isOptimizedDepFile: id => id.startsWith(depsCacheDirPrefix),
|
|
111
|
+
isOptimizedDepUrl: notImplemented,
|
|
112
|
+
getOptimizedDepId: notImplemented,
|
|
113
|
+
close: notImplemented,
|
|
114
|
+
options: {}
|
|
115
|
+
};
|
|
116
|
+
return depsOptimizer;
|
|
117
|
+
}
|
|
118
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L944
|
|
119
|
+
function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
|
120
|
+
const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
|
121
|
+
if (key === 'file' || key === 'src') {
|
|
122
|
+
return vite.normalizePath(path__namespace.resolve(depsCacheDir, value));
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
});
|
|
126
|
+
if (!chunks || Object.values(optimized).some(depInfo => !depInfo.fileHash)) {
|
|
127
|
+
// outdated _metadata.json version, ignore
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const metadata = {
|
|
131
|
+
hash,
|
|
132
|
+
lockfileHash,
|
|
133
|
+
configHash,
|
|
134
|
+
browserHash,
|
|
135
|
+
optimized: {},
|
|
136
|
+
discovered: {},
|
|
137
|
+
chunks: {},
|
|
138
|
+
depInfoList: []
|
|
139
|
+
};
|
|
140
|
+
for (const id of Object.keys(optimized)) {
|
|
141
|
+
addOptimizedDepInfo(metadata, 'optimized', {
|
|
142
|
+
...optimized[id],
|
|
143
|
+
id,
|
|
144
|
+
browserHash
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
for (const id of Object.keys(chunks)) {
|
|
148
|
+
addOptimizedDepInfo(metadata, 'chunks', {
|
|
149
|
+
...chunks[id],
|
|
150
|
+
id,
|
|
151
|
+
browserHash,
|
|
152
|
+
needsInterop: false
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return metadata;
|
|
156
|
+
}
|
|
157
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L322
|
|
158
|
+
function addOptimizedDepInfo(metadata, type, depInfo) {
|
|
159
|
+
metadata[type][depInfo.id] = depInfo;
|
|
160
|
+
metadata.depInfoList.push(depInfo);
|
|
161
|
+
return depInfo;
|
|
162
|
+
}
|
|
163
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L1248
|
|
164
|
+
/**
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
|
+
function optimizedDepInfoFromFile(metadata, file) {
|
|
168
|
+
return metadata.depInfoList.find(depInfo => depInfo.file === file);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
exports.optimizedDepInfoFromFile = optimizedDepInfoFromFile;
|
|
172
|
+
exports.tryOptimizedDepResolve = tryOptimizedDepResolve;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.7.1 (, build 24)
|
|
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 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 { normalizePath } from 'vite';
|
|
40
|
+
import { METADATA_FILENAME } from './constants.mjs';
|
|
41
|
+
import { tryFsResolve } from './resolve.mjs';
|
|
42
|
+
import { cleanUrl } from './utils.mjs';
|
|
43
|
+
|
|
44
|
+
// index.ts for more details on contents and license of this file
|
|
45
|
+
// https://github.com/Danielku15/vite/blob/88b7def341f12d07d7d4f83cbe3dc73cc8c6b7be/packages/vite/src/node/optimizer/index.ts#L1356
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
function tryOptimizedDepResolve(config, ssr, url, depId, preserveSymlinks) {
|
|
50
|
+
const optimizer = getDepsOptimizer(config, ssr);
|
|
51
|
+
if (optimizer?.isOptimizedDepFile(depId)) {
|
|
52
|
+
const depFile = cleanUrl(depId);
|
|
53
|
+
const info = optimizedDepInfoFromFile(optimizer.metadata, depFile);
|
|
54
|
+
const depSrc = info?.src;
|
|
55
|
+
if (depSrc) {
|
|
56
|
+
const resolvedFile = path.resolve(path.dirname(depSrc), url);
|
|
57
|
+
return tryFsResolve(resolvedFile, preserveSymlinks);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
// https://github.com/Danielku15/vite/blob/88b7def341f12d07d7d4f83cbe3dc73cc8c6b7be/packages/vite/src/node/optimizer/optimizer.ts#L32-L40
|
|
63
|
+
const depsOptimizerMap = new WeakMap();
|
|
64
|
+
const devSsrDepsOptimizerMap = new WeakMap();
|
|
65
|
+
function getDepsOptimizer(config, ssr) {
|
|
66
|
+
const map = ssr ? devSsrDepsOptimizerMap : depsOptimizerMap;
|
|
67
|
+
let optimizer = map.get(config);
|
|
68
|
+
if (!optimizer) {
|
|
69
|
+
optimizer = createDepsOptimizer(config);
|
|
70
|
+
map.set(config, optimizer);
|
|
71
|
+
}
|
|
72
|
+
return optimizer;
|
|
73
|
+
}
|
|
74
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/optimizer.ts#L79
|
|
75
|
+
function createDepsOptimizer(config) {
|
|
76
|
+
const depsCacheDirPrefix = normalizePath(path.resolve(config.cacheDir, 'deps'));
|
|
77
|
+
const metadata = parseDepsOptimizerMetadata(fs.readFileSync(path.join(depsCacheDirPrefix, METADATA_FILENAME), 'utf8'), depsCacheDirPrefix);
|
|
78
|
+
const notImplemented = () => {
|
|
79
|
+
throw new Error('not implemented');
|
|
80
|
+
};
|
|
81
|
+
const depsOptimizer = {
|
|
82
|
+
async init() { },
|
|
83
|
+
metadata,
|
|
84
|
+
registerMissingImport: notImplemented,
|
|
85
|
+
run: notImplemented,
|
|
86
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L916
|
|
87
|
+
isOptimizedDepFile: id => id.startsWith(depsCacheDirPrefix),
|
|
88
|
+
isOptimizedDepUrl: notImplemented,
|
|
89
|
+
getOptimizedDepId: notImplemented,
|
|
90
|
+
close: notImplemented,
|
|
91
|
+
options: {}
|
|
92
|
+
};
|
|
93
|
+
return depsOptimizer;
|
|
94
|
+
}
|
|
95
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L944
|
|
96
|
+
function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
|
97
|
+
const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
|
98
|
+
if (key === 'file' || key === 'src') {
|
|
99
|
+
return normalizePath(path.resolve(depsCacheDir, value));
|
|
100
|
+
}
|
|
101
|
+
return value;
|
|
102
|
+
});
|
|
103
|
+
if (!chunks || Object.values(optimized).some(depInfo => !depInfo.fileHash)) {
|
|
104
|
+
// outdated _metadata.json version, ignore
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const metadata = {
|
|
108
|
+
hash,
|
|
109
|
+
lockfileHash,
|
|
110
|
+
configHash,
|
|
111
|
+
browserHash,
|
|
112
|
+
optimized: {},
|
|
113
|
+
discovered: {},
|
|
114
|
+
chunks: {},
|
|
115
|
+
depInfoList: []
|
|
116
|
+
};
|
|
117
|
+
for (const id of Object.keys(optimized)) {
|
|
118
|
+
addOptimizedDepInfo(metadata, 'optimized', {
|
|
119
|
+
...optimized[id],
|
|
120
|
+
id,
|
|
121
|
+
browserHash
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
for (const id of Object.keys(chunks)) {
|
|
125
|
+
addOptimizedDepInfo(metadata, 'chunks', {
|
|
126
|
+
...chunks[id],
|
|
127
|
+
id,
|
|
128
|
+
browserHash,
|
|
129
|
+
needsInterop: false
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return metadata;
|
|
133
|
+
}
|
|
134
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L322
|
|
135
|
+
function addOptimizedDepInfo(metadata, type, depInfo) {
|
|
136
|
+
metadata[type][depInfo.id] = depInfo;
|
|
137
|
+
metadata.depInfoList.push(depInfo);
|
|
138
|
+
return depInfo;
|
|
139
|
+
}
|
|
140
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L1248
|
|
141
|
+
/**
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
144
|
+
function optimizedDepInfoFromFile(metadata, file) {
|
|
145
|
+
return metadata.depInfoList.find(depInfo => depInfo.file === file);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { optimizedDepInfoFromFile, tryOptimizedDepResolve };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.7.1 (, build 24)
|
|
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 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
|
+
// index.ts for more details on contents and license of this file
|
|
42
|
+
// https://github.com/vitejs/vite/blob/v6.1.1/packages/vite/src/node/plugins/index.ts#L161
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
// biome-ignore lint/complexity/noBannedTypes: Function type needed here
|
|
47
|
+
function getHookHandler(hook) {
|
|
48
|
+
return (typeof hook === 'object' ? hook.handler : hook);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.getHookHandler = getHookHandler;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.7.1 (, build 24)
|
|
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 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
|
+
// index.ts for more details on contents and license of this file
|
|
38
|
+
// https://github.com/vitejs/vite/blob/v6.1.1/packages/vite/src/node/plugins/index.ts#L161
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
// biome-ignore lint/complexity/noBannedTypes: Function type needed here
|
|
43
|
+
function getHookHandler(hook) {
|
|
44
|
+
return (typeof hook === 'object' ? hook.handler : hook);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { getHookHandler };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.7.1 (, build 24)
|
|
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 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 vite = require('vite');
|
|
42
|
+
const bridge_fsUtils = require('./fsUtils.cjs');
|
|
43
|
+
const bridge_utils = require('./utils.cjs');
|
|
44
|
+
|
|
45
|
+
// index.ts for more details on contents and license of this file
|
|
46
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/plugins/resolve.ts#L534
|
|
47
|
+
function splitFileAndPostfix(path) {
|
|
48
|
+
const file = bridge_utils.cleanUrl(path);
|
|
49
|
+
return { file, postfix: path.slice(file.length) };
|
|
50
|
+
}
|
|
51
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/plugins/resolve.ts#L566-L574
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
function tryFsResolve(fsPath, preserveSymlinks) {
|
|
56
|
+
const { file, postfix } = splitFileAndPostfix(fsPath);
|
|
57
|
+
const res = tryCleanFsResolve(file, preserveSymlinks);
|
|
58
|
+
if (res) {
|
|
59
|
+
return res + postfix;
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/plugins/resolve.ts#L580
|
|
64
|
+
function tryCleanFsResolve(file, preserveSymlinks) {
|
|
65
|
+
if (file.includes('node_modules')) {
|
|
66
|
+
return bridge_fsUtils.tryResolveRealFile(file, preserveSymlinks);
|
|
67
|
+
}
|
|
68
|
+
const normalizedResolved = bridge_fsUtils.tryResolveRealFile(vite.normalizePath(file));
|
|
69
|
+
if (!normalizedResolved) {
|
|
70
|
+
return bridge_fsUtils.tryResolveRealFile(file, preserveSymlinks);
|
|
71
|
+
}
|
|
72
|
+
return normalizedResolved;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
exports.tryFsResolve = tryFsResolve;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.7.1 (, build 24)
|
|
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 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 { normalizePath } from 'vite';
|
|
38
|
+
import { tryResolveRealFile } from './fsUtils.mjs';
|
|
39
|
+
import { cleanUrl } from './utils.mjs';
|
|
40
|
+
|
|
41
|
+
// index.ts for more details on contents and license of this file
|
|
42
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/plugins/resolve.ts#L534
|
|
43
|
+
function splitFileAndPostfix(path) {
|
|
44
|
+
const file = cleanUrl(path);
|
|
45
|
+
return { file, postfix: path.slice(file.length) };
|
|
46
|
+
}
|
|
47
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/plugins/resolve.ts#L566-L574
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
function tryFsResolve(fsPath, preserveSymlinks) {
|
|
52
|
+
const { file, postfix } = splitFileAndPostfix(fsPath);
|
|
53
|
+
const res = tryCleanFsResolve(file, preserveSymlinks);
|
|
54
|
+
if (res) {
|
|
55
|
+
return res + postfix;
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/plugins/resolve.ts#L580
|
|
60
|
+
function tryCleanFsResolve(file, preserveSymlinks) {
|
|
61
|
+
if (file.includes('node_modules')) {
|
|
62
|
+
return tryResolveRealFile(file, preserveSymlinks);
|
|
63
|
+
}
|
|
64
|
+
const normalizedResolved = tryResolveRealFile(normalizePath(file));
|
|
65
|
+
if (!normalizedResolved) {
|
|
66
|
+
return tryResolveRealFile(file, preserveSymlinks);
|
|
67
|
+
}
|
|
68
|
+
return normalizedResolved;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { tryFsResolve };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* alphaTab Vite Plugin v1.7.1 (, build 24)
|
|
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 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
|
+
|