@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
package/dist/bridge/index.cjs
CHANGED
|
@@ -1,69 +1,59 @@
|
|
|
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
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
exports.
|
|
52
|
-
exports.
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
55
|
-
exports.
|
|
56
|
-
exports.tryFsResolve =
|
|
57
|
-
exports.
|
|
58
|
-
exports.
|
|
59
|
-
exports.
|
|
60
|
-
exports.injectQuery = bridge_utils.injectQuery;
|
|
61
|
-
Object.defineProperty(exports, "AlphaTabWorkerTypes", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: () => bridge_worker.AlphaTabWorkerTypes
|
|
64
|
-
});
|
|
65
|
-
exports.WORKER_ASSET_ID = bridge_worker.WORKER_ASSET_ID;
|
|
66
|
-
exports.WORKER_FILE_ID = bridge_worker.WORKER_FILE_ID;
|
|
67
|
-
exports.isSameContent = bridge_worker.isSameContent;
|
|
68
|
-
exports.workerCache = bridge_worker.workerCache;
|
|
69
|
-
exports.workerFileToUrl = bridge_worker.workerFileToUrl;
|
|
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_bridge_utils = require("./utils.cjs");
|
|
38
|
+
const require_bridge_asset = require("./asset.cjs");
|
|
39
|
+
const require_bridge_constants = require("./constants.cjs");
|
|
40
|
+
const require_bridge_build = require("./build.cjs");
|
|
41
|
+
const require_bridge_resolve = require("./resolve.cjs");
|
|
42
|
+
const require_bridge_optimizer = require("./optimizer.cjs");
|
|
43
|
+
const require_bridge_worker = require("./worker.cjs");
|
|
44
|
+
exports.AlphaTabWorkerTypes = require_bridge_worker.AlphaTabWorkerTypes;
|
|
45
|
+
exports.ENV_PUBLIC_PATH = require_bridge_constants.ENV_PUBLIC_PATH;
|
|
46
|
+
exports.WORKER_ASSET_ID = require_bridge_worker.WORKER_ASSET_ID;
|
|
47
|
+
exports.WORKER_FILE_ID = require_bridge_worker.WORKER_FILE_ID;
|
|
48
|
+
exports.cleanUrl = require_bridge_utils.cleanUrl;
|
|
49
|
+
exports.createToImportMetaURLBasedRelativeRuntime = require_bridge_build.createToImportMetaURLBasedRelativeRuntime;
|
|
50
|
+
exports.encodeURIPath = require_bridge_utils.encodeURIPath;
|
|
51
|
+
exports.evalValue = require_bridge_utils.evalValue;
|
|
52
|
+
exports.fileToUrl = require_bridge_asset.fileToUrl;
|
|
53
|
+
exports.injectQuery = require_bridge_utils.injectQuery;
|
|
54
|
+
exports.isSameContent = require_bridge_worker.isSameContent;
|
|
55
|
+
exports.toOutputFilePathInJS = require_bridge_build.toOutputFilePathInJS;
|
|
56
|
+
exports.tryFsResolve = require_bridge_resolve.tryFsResolve;
|
|
57
|
+
exports.tryOptimizedDepResolve = require_bridge_optimizer.tryOptimizedDepResolve;
|
|
58
|
+
exports.workerCache = require_bridge_worker.workerCache;
|
|
59
|
+
exports.workerFileToUrl = require_bridge_worker.workerFileToUrl;
|
package/dist/bridge/index.mjs
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
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
|
-
export { AlphaTabWorkerTypes, WORKER_ASSET_ID, WORKER_FILE_ID, isSameContent, workerCache, workerFileToUrl }
|
|
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 { cleanUrl, encodeURIPath, evalValue, injectQuery } from "./utils.mjs";
|
|
37
|
+
import { fileToUrl } from "./asset.mjs";
|
|
38
|
+
import { ENV_PUBLIC_PATH } from "./constants.mjs";
|
|
39
|
+
import { createToImportMetaURLBasedRelativeRuntime, toOutputFilePathInJS } from "./build.mjs";
|
|
40
|
+
import { tryFsResolve } from "./resolve.mjs";
|
|
41
|
+
import { tryOptimizedDepResolve } from "./optimizer.mjs";
|
|
42
|
+
import { AlphaTabWorkerTypes, WORKER_ASSET_ID, WORKER_FILE_ID, isSameContent, workerCache, workerFileToUrl } from "./worker.mjs";
|
|
43
|
+
export { AlphaTabWorkerTypes, ENV_PUBLIC_PATH, WORKER_ASSET_ID, WORKER_FILE_ID, cleanUrl, createToImportMetaURLBasedRelativeRuntime, encodeURIPath, evalValue, fileToUrl, injectQuery, isSameContent, toOutputFilePathInJS, tryFsResolve, tryOptimizedDepResolve, workerCache, workerFileToUrl };
|
|
@@ -1,172 +1,129 @@
|
|
|
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
|
-
|
|
46
|
-
|
|
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
|
|
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
|
+
const require_bridge_utils = require("./utils.cjs");
|
|
39
|
+
const require_bridge_constants = require("./constants.cjs");
|
|
40
|
+
const require_bridge_resolve = require("./resolve.cjs");
|
|
41
|
+
let node_fs = require("node:fs");
|
|
42
|
+
node_fs = require_chunk.__toESM(node_fs, 1);
|
|
43
|
+
let node_path = require("node:path");
|
|
44
|
+
node_path = require_chunk.__toESM(node_path, 1);
|
|
45
|
+
let vite = require("vite");
|
|
46
|
+
//#region src/bridge/optimizer.ts
|
|
69
47
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
72
50
|
function tryOptimizedDepResolve(config, ssr, url, depId, preserveSymlinks) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const resolvedFile = path__namespace.resolve(path__namespace.dirname(depSrc), url);
|
|
80
|
-
return bridge_resolve.tryFsResolve(resolvedFile, preserveSymlinks);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return undefined;
|
|
51
|
+
const optimizer = getDepsOptimizer(config, ssr);
|
|
52
|
+
if (optimizer?.isOptimizedDepFile(depId)) {
|
|
53
|
+
const depFile = require_bridge_utils.cleanUrl(depId);
|
|
54
|
+
const depSrc = optimizedDepInfoFromFile(optimizer.metadata, depFile)?.src;
|
|
55
|
+
if (depSrc) return require_bridge_resolve.tryFsResolve(node_path.resolve(node_path.dirname(depSrc), url), preserveSymlinks);
|
|
56
|
+
}
|
|
84
57
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const devSsrDepsOptimizerMap = new WeakMap();
|
|
58
|
+
var depsOptimizerMap = /* @__PURE__ */ new WeakMap();
|
|
59
|
+
var devSsrDepsOptimizerMap = /* @__PURE__ */ new WeakMap();
|
|
88
60
|
function getDepsOptimizer(config, ssr) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
61
|
+
const map = ssr ? devSsrDepsOptimizerMap : depsOptimizerMap;
|
|
62
|
+
let optimizer = map.get(config);
|
|
63
|
+
if (!optimizer) {
|
|
64
|
+
optimizer = createDepsOptimizer(config);
|
|
65
|
+
map.set(config, optimizer);
|
|
66
|
+
}
|
|
67
|
+
return optimizer;
|
|
96
68
|
}
|
|
97
|
-
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/optimizer.ts#L79
|
|
98
69
|
function createDepsOptimizer(config) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
};
|
|
116
|
-
return depsOptimizer;
|
|
70
|
+
const depsCacheDirPrefix = (0, vite.normalizePath)(node_path.resolve(config.cacheDir, "deps"));
|
|
71
|
+
const metadata = parseDepsOptimizerMetadata(node_fs.default.readFileSync(node_path.join(depsCacheDirPrefix, require_bridge_constants.METADATA_FILENAME), "utf8"), depsCacheDirPrefix);
|
|
72
|
+
const notImplemented = () => {
|
|
73
|
+
throw new Error("not implemented");
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
async init() {},
|
|
77
|
+
metadata,
|
|
78
|
+
registerMissingImport: notImplemented,
|
|
79
|
+
run: notImplemented,
|
|
80
|
+
isOptimizedDepFile: (id) => id.startsWith(depsCacheDirPrefix),
|
|
81
|
+
isOptimizedDepUrl: notImplemented,
|
|
82
|
+
getOptimizedDepId: notImplemented,
|
|
83
|
+
close: notImplemented,
|
|
84
|
+
options: {}
|
|
85
|
+
};
|
|
117
86
|
}
|
|
118
|
-
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L944
|
|
119
87
|
function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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;
|
|
88
|
+
const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
|
89
|
+
if (key === "file" || key === "src") return (0, vite.normalizePath)(node_path.resolve(depsCacheDir, value));
|
|
90
|
+
return value;
|
|
91
|
+
});
|
|
92
|
+
if (!chunks || Object.values(optimized).some((depInfo) => !depInfo.fileHash)) return;
|
|
93
|
+
const metadata = {
|
|
94
|
+
hash,
|
|
95
|
+
lockfileHash,
|
|
96
|
+
configHash,
|
|
97
|
+
browserHash,
|
|
98
|
+
optimized: {},
|
|
99
|
+
discovered: {},
|
|
100
|
+
chunks: {},
|
|
101
|
+
depInfoList: []
|
|
102
|
+
};
|
|
103
|
+
for (const id of Object.keys(optimized)) addOptimizedDepInfo(metadata, "optimized", {
|
|
104
|
+
...optimized[id],
|
|
105
|
+
id,
|
|
106
|
+
browserHash
|
|
107
|
+
});
|
|
108
|
+
for (const id of Object.keys(chunks)) addOptimizedDepInfo(metadata, "chunks", {
|
|
109
|
+
...chunks[id],
|
|
110
|
+
id,
|
|
111
|
+
browserHash,
|
|
112
|
+
needsInterop: false
|
|
113
|
+
});
|
|
114
|
+
return metadata;
|
|
156
115
|
}
|
|
157
|
-
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L322
|
|
158
116
|
function addOptimizedDepInfo(metadata, type, depInfo) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
117
|
+
metadata[type][depInfo.id] = depInfo;
|
|
118
|
+
metadata.depInfoList.push(depInfo);
|
|
119
|
+
return depInfo;
|
|
162
120
|
}
|
|
163
|
-
// https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/optimizer/index.ts#L1248
|
|
164
121
|
/**
|
|
165
|
-
|
|
166
|
-
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
167
124
|
function optimizedDepInfoFromFile(metadata, file) {
|
|
168
|
-
|
|
125
|
+
return metadata.depInfoList.find((depInfo) => depInfo.file === file);
|
|
169
126
|
}
|
|
170
|
-
|
|
127
|
+
//#endregion
|
|
171
128
|
exports.optimizedDepInfoFromFile = optimizedDepInfoFromFile;
|
|
172
129
|
exports.tryOptimizedDepResolve = tryOptimizedDepResolve;
|