@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.
Files changed (47) hide show
  1. package/dist/AlphaTabVitePluginOptions.cjs +34 -37
  2. package/dist/AlphaTabVitePluginOptions.mjs +34 -35
  3. package/dist/alphaTab.vite.cjs +37 -44
  4. package/dist/alphaTab.vite.mjs +36 -36
  5. package/dist/alphaTabVitePlugin.cjs +50 -54
  6. package/dist/alphaTabVitePlugin.mjs +49 -50
  7. package/dist/bridge/asset.cjs +50 -80
  8. package/dist/bridge/asset.mjs +47 -57
  9. package/dist/bridge/build.cjs +152 -214
  10. package/dist/bridge/build.mjs +149 -191
  11. package/dist/bridge/bundler.cjs +54 -0
  12. package/dist/bridge/bundler.mjs +52 -0
  13. package/dist/bridge/config.cjs +34 -37
  14. package/dist/bridge/config.mjs +34 -35
  15. package/dist/bridge/constants.cjs +73 -80
  16. package/dist/bridge/constants.mjs +72 -76
  17. package/dist/bridge/fsUtils.cjs +46 -55
  18. package/dist/bridge/fsUtils.mjs +43 -51
  19. package/dist/bridge/index.cjs +58 -68
  20. package/dist/bridge/index.mjs +42 -42
  21. package/dist/bridge/optimizer.cjs +112 -155
  22. package/dist/bridge/optimizer.mjs +108 -132
  23. package/dist/bridge/plugins.cjs +39 -45
  24. package/dist/bridge/plugins.mjs +38 -41
  25. package/dist/bridge/resolve.cjs +54 -66
  26. package/dist/bridge/resolve.mjs +53 -62
  27. package/dist/bridge/typeUtils.cjs +34 -37
  28. package/dist/bridge/typeUtils.mjs +34 -35
  29. package/dist/bridge/utils.cjs +87 -121
  30. package/dist/bridge/utils.mjs +84 -117
  31. package/dist/bridge/worker.cjs +179 -183
  32. package/dist/bridge/worker.mjs +175 -160
  33. package/dist/chunk.cjs +63 -0
  34. package/dist/copyAssetsPlugin.cjs +102 -163
  35. package/dist/copyAssetsPlugin.mjs +35 -141
  36. package/dist/copyAssetsPlugin2.mjs +108 -0
  37. package/dist/detectionGlobalPlugin.cjs +65 -68
  38. package/dist/detectionGlobalPlugin.mjs +62 -64
  39. package/dist/dist.cjs +6595 -0
  40. package/dist/dist.mjs +6589 -0
  41. package/dist/importMetaPlugin.cjs +147 -192
  42. package/dist/importMetaPlugin.mjs +143 -188
  43. package/dist/prompt-DewH0PjV.cjs +885 -0
  44. package/dist/prompt-DewH0PjV.mjs +882 -0
  45. package/dist/workerPlugin.cjs +145 -219
  46. package/dist/workerPlugin.mjs +141 -196
  47. package/package.json +17 -17
@@ -1,71 +1,62 @@
1
1
  /*!
2
- * alphaTab Vite Plugin v1.8.1 (, build 30)
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
-
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
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 } from "./utils.mjs";
37
+ import { tryResolveRealFile } from "./fsUtils.mjs";
38
+ import { normalizePath } from "vite";
39
+ //#region src/bridge/resolve.ts
43
40
  function splitFileAndPostfix(path) {
44
- const file = cleanUrl(path);
45
- return { file, postfix: path.slice(file.length) };
41
+ const file = cleanUrl(path);
42
+ return {
43
+ file,
44
+ postfix: path.slice(file.length)
45
+ };
46
46
  }
47
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/plugins/resolve.ts#L566-L574
48
47
  /**
49
- * @internal
50
- */
48
+ * @internal
49
+ */
51
50
  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;
51
+ const { file, postfix } = splitFileAndPostfix(fsPath);
52
+ const res = tryCleanFsResolve(file, preserveSymlinks);
53
+ if (res) return res + postfix;
58
54
  }
59
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/plugins/resolve.ts#L580
60
55
  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;
56
+ if (file.includes("node_modules")) return tryResolveRealFile(file, preserveSymlinks);
57
+ const normalizedResolved = tryResolveRealFile(normalizePath(file));
58
+ if (!normalizedResolved) return tryResolveRealFile(file, preserveSymlinks);
59
+ return normalizedResolved;
69
60
  }
70
-
61
+ //#endregion
71
62
  export { tryFsResolve };
@@ -1,38 +1,35 @@
1
1
  /*!
2
- * alphaTab Vite Plugin v1.8.1 (, build 30)
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
-
37
- 'use strict';
38
-
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
+ */
@@ -1,36 +1,35 @@
1
1
  /*!
2
- * alphaTab Vite Plugin v1.8.1 (, build 30)
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
-
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
+ */
@@ -1,157 +1,123 @@
1
1
  /*!
2
- * alphaTab Vite Plugin v1.8.1 (, build 30)
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
-
37
- 'use strict';
38
-
39
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
-
41
- const fs = require('node:fs');
42
- const node_crypto = require('node:crypto');
43
-
44
- // index.ts for more details on contents and license of this file
45
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/utils.ts#L1302
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_crypto = require("node:crypto");
41
+ //#region src/bridge/utils.ts
46
42
  /**
47
- * @internal
48
- */
43
+ * @internal
44
+ */
49
45
  function evalValue(rawValue) {
50
- const fn = new Function(`
46
+ return new Function(`
51
47
  var console, exports, global, module, process, require
52
48
  return (\n${rawValue}\n)
53
- `);
54
- return fn();
49
+ `)();
55
50
  }
56
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/shared/utils.ts#L31-L34
57
- const postfixRE = /[?#].*$/;
51
+ var postfixRE = /[?#].*$/;
58
52
  /**
59
- * @internal
60
- */
53
+ * @internal
54
+ */
61
55
  function cleanUrl(url) {
62
- return url.replace(postfixRE, '');
56
+ return url.replace(postfixRE, "");
63
57
  }
64
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/utils.ts#L393
65
58
  /**
66
- * @internal
67
- */
59
+ * @internal
60
+ */
68
61
  function tryStatSync(file) {
69
- try {
70
- // The "throwIfNoEntry" is a performance optimization for cases where the file does not exist
71
- return fs.statSync(file, { throwIfNoEntry: false });
72
- }
73
- catch {
74
- // Ignore errors
75
- }
76
- return;
62
+ try {
63
+ return node_fs.default.statSync(file, { throwIfNoEntry: false });
64
+ } catch {}
77
65
  }
78
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/utils.ts#L1030
79
66
  /**
80
- * @internal
81
- */
67
+ * @internal
68
+ */
82
69
  function getHash(text, length = 8) {
83
- const h = node_crypto.createHash('sha256').update(text).digest('hex').substring(0, length);
84
- if (length <= 64) {
85
- return h;
86
- }
87
- return h.padEnd(length, '_');
70
+ const h = (0, node_crypto.createHash)("sha256").update(text).digest("hex").substring(0, length);
71
+ if (length <= 64) return h;
72
+ return h.padEnd(length, "_");
88
73
  }
89
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/shared/utils.ts#L40
90
74
  /**
91
- * @internal
92
- */
75
+ * @internal
76
+ */
93
77
  function withTrailingSlash(path) {
94
- if (path[path.length - 1] !== '/') {
95
- return `${path}/`;
96
- }
97
- return path;
78
+ if (path[path.length - 1] !== "/") return `${path}/`;
79
+ return path;
98
80
  }
99
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/utils.ts#L1268
100
81
  /**
101
- * @internal
102
- */
82
+ * @internal
83
+ */
103
84
  function joinUrlSegments(a, b) {
104
- if (!a || !b) {
105
- return a || b || '';
106
- }
107
- if (a[a.length - 1] === '/') {
108
- a = a.substring(0, a.length - 1);
109
- }
110
- if (b[0] !== '/') {
111
- b = `/${b}`;
112
- }
113
- return a + b;
85
+ if (!a || !b) return a || b || "";
86
+ if (a[a.length - 1] === "/") a = a.substring(0, a.length - 1);
87
+ if (b[0] !== "/") b = `/${b}`;
88
+ return a + b;
114
89
  }
115
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/utils.ts#L1281
116
90
  /**
117
- * @internal
118
- */
91
+ * @internal
92
+ */
119
93
  function removeLeadingSlash(str) {
120
- return str[0] === '/' ? str.slice(1) : str;
94
+ return str[0] === "/" ? str.slice(1) : str;
121
95
  }
122
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/utils.ts#L319
123
96
  /**
124
- * @internal
125
- */
97
+ * @internal
98
+ */
126
99
  function injectQuery(builtUrl, query) {
127
- const queryIndex = builtUrl.indexOf('?');
128
- return builtUrl + (queryIndex === -1 ? '?' : '&') + query;
100
+ return builtUrl + (builtUrl.indexOf("?") === -1 ? "?" : "&") + query;
129
101
  }
130
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/utils.ts#L1435
131
102
  /**
132
- * @internal
133
- */
103
+ * @internal
104
+ */
134
105
  function partialEncodeURIPath(uri) {
135
- if (uri.startsWith('data:')) {
136
- return uri;
137
- }
138
- const filePath = cleanUrl(uri);
139
- const postfix = filePath !== uri ? uri.slice(filePath.length) : '';
140
- return filePath.replaceAll('%', '%25') + postfix;
106
+ if (uri.startsWith("data:")) return uri;
107
+ const filePath = cleanUrl(uri);
108
+ const postfix = filePath !== uri ? uri.slice(filePath.length) : "";
109
+ return filePath.replaceAll("%", "%25") + postfix;
141
110
  }
142
- // https://github.com/vitejs/vite/blob/b7ddfae5f852c2948fab03e94751ce56f5f31ce0/packages/vite/src/node/utils.ts#L1424
143
111
  /**
144
- * @internal
145
- */
112
+ * @internal
113
+ */
146
114
  function encodeURIPath(uri) {
147
- if (uri.startsWith('data:')) {
148
- return uri;
149
- }
150
- const filePath = cleanUrl(uri);
151
- const postfix = filePath !== uri ? uri.slice(filePath.length) : '';
152
- return encodeURI(filePath) + postfix;
115
+ if (uri.startsWith("data:")) return uri;
116
+ const filePath = cleanUrl(uri);
117
+ const postfix = filePath !== uri ? uri.slice(filePath.length) : "";
118
+ return encodeURI(filePath) + postfix;
153
119
  }
154
-
120
+ //#endregion
155
121
  exports.cleanUrl = cleanUrl;
156
122
  exports.encodeURIPath = encodeURIPath;
157
123
  exports.evalValue = evalValue;