@coderline/alphatab-vite 1.8.2 → 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 +15 -15
package/dist/bridge/asset.cjs
CHANGED
|
@@ -1,87 +1,57 @@
|
|
|
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
|
-
const bridge_utils = require('./utils.cjs');
|
|
43
|
-
|
|
44
|
-
function _interopNamespaceDefault(e) {
|
|
45
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
46
|
-
if (e) {
|
|
47
|
-
for (const k in e) {
|
|
48
|
-
if (k !== 'default') {
|
|
49
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
50
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: () => e[k]
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
n.default = e;
|
|
58
|
-
return Object.freeze(n);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
62
|
-
|
|
63
|
-
// index.ts for more details on contents and license of this file
|
|
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
|
+
let node_path = require("node:path");
|
|
40
|
+
node_path = require_chunk.__toESM(node_path, 1);
|
|
41
|
+
//#region src/bridge/asset.ts
|
|
64
42
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
var FS_PREFIX = "/@fs/";
|
|
68
46
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
71
49
|
async function fileToUrl(id, config) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
// outside of project root, use absolute fs path
|
|
79
|
-
// (this is special handled by the serve static middleware
|
|
80
|
-
rtn = path__namespace.posix.join(FS_PREFIX, id);
|
|
81
|
-
}
|
|
82
|
-
const base = bridge_utils.joinUrlSegments(config.server?.origin ?? '', config.base);
|
|
83
|
-
return bridge_utils.joinUrlSegments(base, bridge_utils.removeLeadingSlash(rtn));
|
|
50
|
+
let rtn;
|
|
51
|
+
if (id.startsWith(require_bridge_utils.withTrailingSlash(config.root))) rtn = `/${node_path.posix.relative(config.root, id)}`;
|
|
52
|
+
else rtn = node_path.posix.join(FS_PREFIX, id);
|
|
53
|
+
return require_bridge_utils.joinUrlSegments(require_bridge_utils.joinUrlSegments(config.server?.origin ?? "", config.base), require_bridge_utils.removeLeadingSlash(rtn));
|
|
84
54
|
}
|
|
85
|
-
|
|
55
|
+
//#endregion
|
|
86
56
|
exports.FS_PREFIX = FS_PREFIX;
|
|
87
57
|
exports.fileToUrl = fileToUrl;
|
package/dist/bridge/asset.mjs
CHANGED
|
@@ -1,63 +1,53 @@
|
|
|
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 * as path from
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// index.ts for more details on contents and license of this file
|
|
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 { joinUrlSegments, removeLeadingSlash, withTrailingSlash } from "./utils.mjs";
|
|
37
|
+
import * as path$1 from "node:path";
|
|
38
|
+
//#region src/bridge/asset.ts
|
|
41
39
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
var FS_PREFIX = "/@fs/";
|
|
45
43
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
48
46
|
async function fileToUrl(id, config) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
// outside of project root, use absolute fs path
|
|
56
|
-
// (this is special handled by the serve static middleware
|
|
57
|
-
rtn = path.posix.join(FS_PREFIX, id);
|
|
58
|
-
}
|
|
59
|
-
const base = joinUrlSegments(config.server?.origin ?? '', config.base);
|
|
60
|
-
return joinUrlSegments(base, removeLeadingSlash(rtn));
|
|
47
|
+
let rtn;
|
|
48
|
+
if (id.startsWith(withTrailingSlash(config.root))) rtn = `/${path$1.posix.relative(config.root, id)}`;
|
|
49
|
+
else rtn = path$1.posix.join(FS_PREFIX, id);
|
|
50
|
+
return joinUrlSegments(joinUrlSegments(config.server?.origin ?? "", config.base), removeLeadingSlash(rtn));
|
|
61
51
|
}
|
|
62
|
-
|
|
52
|
+
//#endregion
|
|
63
53
|
export { FS_PREFIX, fileToUrl };
|
package/dist/bridge/build.cjs
CHANGED
|
@@ -1,242 +1,180 @@
|
|
|
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
|
-
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
|
-
|
|
65
|
-
// index.ts for more details on contents and license of this file
|
|
66
|
-
const needsEscapeRegEx = /[\n\r'\\\u2028\u2029]/;
|
|
67
|
-
const quoteNewlineRegEx = /([\n\r'\u2028\u2029])/g;
|
|
68
|
-
const backSlashRegEx = /\\/g;
|
|
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_plugins = require("./plugins.cjs");
|
|
41
|
+
let node_path = require("node:path");
|
|
42
|
+
node_path = require_chunk.__toESM(node_path, 1);
|
|
43
|
+
//#region src/bridge/build.ts
|
|
44
|
+
var needsEscapeRegEx = /[\n\r'\\\u2028\u2029]/;
|
|
45
|
+
var quoteNewlineRegEx = /([\n\r'\u2028\u2029])/g;
|
|
46
|
+
var backSlashRegEx = /\\/g;
|
|
69
47
|
function escapeId(id) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
return id.replace(backSlashRegEx, '\\\\').replace(quoteNewlineRegEx, '\\$1');
|
|
48
|
+
if (!needsEscapeRegEx.test(id)) return id;
|
|
49
|
+
return id.replace(backSlashRegEx, "\\\\").replace(quoteNewlineRegEx, "\\$1");
|
|
74
50
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
system: relativePath => getResolveUrl(`'${escapeId(bridge_utils.partialEncodeURIPath(relativePath))}', module.meta.url`),
|
|
91
|
-
umd: relativePath => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`
|
|
92
|
-
};
|
|
93
|
-
const customRelativeUrlMechanisms = {
|
|
94
|
-
...relativeUrlMechanisms,
|
|
95
|
-
'worker-iife': relativePath => getResolveUrl(`'${escapeId(bridge_utils.partialEncodeURIPath(relativePath))}', self.location.href`)
|
|
51
|
+
var getResolveUrl = (path, URL = "URL") => `new ${URL}(${path}).href`;
|
|
52
|
+
var getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl(`'${escapeId(require_bridge_utils.partialEncodeURIPath(relativePath))}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ""}document.currentScript && document.currentScript.src || document.baseURI`);
|
|
53
|
+
var getFileUrlFromFullPath = (path) => `require('u' + 'rl').pathToFileURL(${path}).href`;
|
|
54
|
+
var getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${escapeId(path)}'`);
|
|
55
|
+
var customRelativeUrlMechanisms = {
|
|
56
|
+
amd: (relativePath) => {
|
|
57
|
+
if (relativePath[0] !== ".") relativePath = `./${relativePath}`;
|
|
58
|
+
return getResolveUrl(`require.toUrl('${escapeId(relativePath)}'), document.baseURI`);
|
|
59
|
+
},
|
|
60
|
+
cjs: (relativePath) => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath)})`,
|
|
61
|
+
es: (relativePath) => getResolveUrl(`'${escapeId(require_bridge_utils.partialEncodeURIPath(relativePath))}', import.meta.url`),
|
|
62
|
+
iife: (relativePath) => getRelativeUrlFromDocument(relativePath),
|
|
63
|
+
system: (relativePath) => getResolveUrl(`'${escapeId(require_bridge_utils.partialEncodeURIPath(relativePath))}', module.meta.url`),
|
|
64
|
+
umd: (relativePath) => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`,
|
|
65
|
+
"worker-iife": (relativePath) => getResolveUrl(`'${escapeId(require_bridge_utils.partialEncodeURIPath(relativePath))}', self.location.href`)
|
|
96
66
|
};
|
|
97
67
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
100
70
|
function createToImportMetaURLBasedRelativeRuntime(format, isWorker) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return (filename, importer) => ({
|
|
104
|
-
runtime: toRelativePath(path__namespace.posix.relative(path__namespace.dirname(importer), filename))
|
|
105
|
-
});
|
|
71
|
+
const toRelativePath = customRelativeUrlMechanisms[isWorker && format === "iife" ? "worker-iife" : format];
|
|
72
|
+
return (filename, importer) => ({ runtime: toRelativePath(node_path.posix.relative(node_path.dirname(importer), filename)) });
|
|
106
73
|
}
|
|
107
74
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
110
77
|
function toOutputFilePathInJS(filename, type, hostId, hostType, config, toRelative) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
else if (result) {
|
|
129
|
-
return result;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (relative && !config.build.ssr) {
|
|
133
|
-
return toRelative(filename, hostId);
|
|
134
|
-
}
|
|
135
|
-
return bridge_utils.joinUrlSegments(config.base, filename);
|
|
78
|
+
const { renderBuiltUrl } = config.experimental;
|
|
79
|
+
let relative = config.base === "" || config.base === "./";
|
|
80
|
+
if (renderBuiltUrl) {
|
|
81
|
+
const result = renderBuiltUrl(filename, {
|
|
82
|
+
hostId,
|
|
83
|
+
hostType,
|
|
84
|
+
type,
|
|
85
|
+
ssr: !!config.build.ssr
|
|
86
|
+
});
|
|
87
|
+
if (typeof result === "object") {
|
|
88
|
+
if (result.runtime) return { runtime: result.runtime };
|
|
89
|
+
if (typeof result.relative === "boolean") relative = result.relative;
|
|
90
|
+
} else if (result) return result;
|
|
91
|
+
}
|
|
92
|
+
if (relative && !config.build.ssr) return toRelative(filename, hostId);
|
|
93
|
+
return require_bridge_utils.joinUrlSegments(config.base, filename);
|
|
136
94
|
}
|
|
137
|
-
// https://github.com/vitejs/vite/blob/v6.1.1/packages/vite/src/node/build.ts#L1131
|
|
138
95
|
/**
|
|
139
|
-
|
|
140
|
-
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
141
98
|
function injectEnvironmentToHooks(environment, plugin) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return clone;
|
|
99
|
+
const { resolveId, load, transform } = plugin;
|
|
100
|
+
const clone = { ...plugin };
|
|
101
|
+
for (const hook of Object.keys(clone)) switch (hook) {
|
|
102
|
+
case "resolveId":
|
|
103
|
+
clone[hook] = wrapEnvironmentResolveId(environment, resolveId);
|
|
104
|
+
break;
|
|
105
|
+
case "load":
|
|
106
|
+
clone[hook] = wrapEnvironmentLoad(environment, load);
|
|
107
|
+
break;
|
|
108
|
+
case "transform":
|
|
109
|
+
clone[hook] = wrapEnvironmentTransform(environment, transform);
|
|
110
|
+
break;
|
|
111
|
+
default:
|
|
112
|
+
if (require_bridge_constants.ROLLUP_HOOKS.includes(hook)) clone[hook] = wrapEnvironmentHook(environment, clone[hook]);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
return clone;
|
|
163
116
|
}
|
|
164
117
|
function wrapEnvironmentResolveId(environment, hook) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
handler
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
return handler;
|
|
118
|
+
if (!hook) return;
|
|
119
|
+
const fn = require_bridge_plugins.getHookHandler(hook);
|
|
120
|
+
const handler = function(id, importer, options) {
|
|
121
|
+
return fn.call(injectEnvironmentInContext(this, environment), id, importer, injectSsrFlag(options, environment));
|
|
122
|
+
};
|
|
123
|
+
if ("handler" in hook) return {
|
|
124
|
+
...hook,
|
|
125
|
+
handler
|
|
126
|
+
};
|
|
127
|
+
return handler;
|
|
179
128
|
}
|
|
180
129
|
function wrapEnvironmentLoad(environment, hook) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
handler
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
return handler;
|
|
130
|
+
if (!hook) return;
|
|
131
|
+
const fn = require_bridge_plugins.getHookHandler(hook);
|
|
132
|
+
const handler = function(id, ...args) {
|
|
133
|
+
return fn.call(injectEnvironmentInContext(this, environment), id, injectSsrFlag(args[0], environment));
|
|
134
|
+
};
|
|
135
|
+
if ("handler" in hook) return {
|
|
136
|
+
...hook,
|
|
137
|
+
handler
|
|
138
|
+
};
|
|
139
|
+
return handler;
|
|
195
140
|
}
|
|
196
141
|
function wrapEnvironmentTransform(environment, hook) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
handler
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
return handler;
|
|
142
|
+
if (!hook) return;
|
|
143
|
+
const fn = require_bridge_plugins.getHookHandler(hook);
|
|
144
|
+
const handler = function(code, importer, ...args) {
|
|
145
|
+
return fn.call(injectEnvironmentInContext(this, environment), code, importer, injectSsrFlag(args[0], environment));
|
|
146
|
+
};
|
|
147
|
+
if ("handler" in hook) return {
|
|
148
|
+
...hook,
|
|
149
|
+
handler
|
|
150
|
+
};
|
|
151
|
+
return handler;
|
|
211
152
|
}
|
|
212
153
|
function wrapEnvironmentHook(environment, hook) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return {
|
|
225
|
-
...hook,
|
|
226
|
-
handler
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
return handler;
|
|
154
|
+
if (!hook) return;
|
|
155
|
+
const fn = require_bridge_plugins.getHookHandler(hook);
|
|
156
|
+
if (typeof fn !== "function") return hook;
|
|
157
|
+
const handler = function(...args) {
|
|
158
|
+
return fn.call(injectEnvironmentInContext(this, environment), ...args);
|
|
159
|
+
};
|
|
160
|
+
if ("handler" in hook) return {
|
|
161
|
+
...hook,
|
|
162
|
+
handler
|
|
163
|
+
};
|
|
164
|
+
return handler;
|
|
230
165
|
}
|
|
231
166
|
function injectEnvironmentInContext(context, environment) {
|
|
232
|
-
|
|
233
|
-
|
|
167
|
+
context.environment ??= environment;
|
|
168
|
+
return context;
|
|
234
169
|
}
|
|
235
170
|
function injectSsrFlag(options, environment) {
|
|
236
|
-
|
|
237
|
-
|
|
171
|
+
const ssr = environment ? environment.config.consumer === "server" : true;
|
|
172
|
+
return {
|
|
173
|
+
...options ?? {},
|
|
174
|
+
ssr
|
|
175
|
+
};
|
|
238
176
|
}
|
|
239
|
-
|
|
177
|
+
//#endregion
|
|
240
178
|
exports.createToImportMetaURLBasedRelativeRuntime = createToImportMetaURLBasedRelativeRuntime;
|
|
241
179
|
exports.injectEnvironmentToHooks = injectEnvironmentToHooks;
|
|
242
180
|
exports.toOutputFilePathInJS = toOutputFilePathInJS;
|