提交 e1a0204f 编写于 作者: fxy060608's avatar fxy060608

wip(uvue): 优化 web 端日志输出,sourcemap

上级 2c123ed4
...@@ -31,33 +31,37 @@ class PendingRequests extends Map<string, PendingRequest> { ...@@ -31,33 +31,37 @@ class PendingRequests extends Map<string, PendingRequest> {
_inputDir!: string _inputDir!: string
_server!: ViteDevServer _server!: ViteDevServer
set(key: string, value: PendingRequest) { set(key: string, value: PendingRequest) {
value.request = Promise.resolve(value.request).then(async (request) => { value.request = value.request
const map = request?.map .then(async (request) => {
if (map) { const map = request?.map
const mod = await this._server.moduleGraph.ensureEntryFromUrl(key) if (map) {
if (mod.file && isAbsolute(mod.file)) { const mod = await this._server.moduleGraph.ensureEntryFromUrl(key)
const dir = normalizePath(dirname(mod.file)) if (mod.file && isAbsolute(mod.file)) {
if (dir.startsWith(this._inputDir)) { const dir = normalizePath(dirname(mod.file))
for ( if (dir.startsWith(this._inputDir)) {
let sourcesIndex = 0; for (
sourcesIndex < map.sources.length; let sourcesIndex = 0;
++sourcesIndex sourcesIndex < map.sources.length;
) { ++sourcesIndex
const sourcePath = map.sources[sourcesIndex] ) {
if (sourcePath) { const sourcePath = map.sources[sourcesIndex]
// 将相对路径转换为绝对路径 if (sourcePath) {
if (!isAbsolute(sourcePath)) { // 将相对路径转换为绝对路径
map.sources[sourcesIndex] = normalizePath( if (!isAbsolute(sourcePath)) {
join(dir, sourcePath) map.sources[sourcesIndex] = normalizePath(
) join(dir, sourcePath)
)
}
} }
} }
} }
} }
} }
} return request
return request })
}) .catch(() => {
return null
})
return super.set(key, value) return super.set(key, value)
} }
} }
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.23.5",
"@dcloudio/uts": "3.0.0-alpha-4000020240111001", "@dcloudio/uts": "3.0.0-alpha-4000020240111001",
"@rollup/pluginutils": "^5.0.5", "@rollup/pluginutils": "^5.0.5",
"@vue/shared": "3.3.11", "@vue/shared": "3.3.11",
"android-versions": "^1.8.1",
"adm-zip": "^0.5.9", "adm-zip": "^0.5.9",
"android-versions": "^1.8.1",
"colors": "^1.4.0", "colors": "^1.4.0",
"fast-glob": "^3.2.11", "fast-glob": "^3.2.11",
"find-cache-dir": "^3.3.2", "find-cache-dir": "^3.3.2",
......
...@@ -1397,6 +1397,9 @@ importers: ...@@ -1397,6 +1397,9 @@ importers:
packages/uni-uts-v1: packages/uni-uts-v1:
dependencies: dependencies:
'@babel/code-frame':
specifier: ^7.23.5
version: 7.23.5
'@dcloudio/uts': '@dcloudio/uts':
specifier: 3.0.0-alpha-4000020240111001 specifier: 3.0.0-alpha-4000020240111001
version: link:../uts version: link:../uts
...@@ -1651,12 +1654,6 @@ packages: ...@@ -1651,12 +1654,6 @@ packages:
/@antfu/utils@0.7.6: /@antfu/utils@0.7.6:
resolution: {integrity: sha512-pvFiLP2BeOKA/ZOS6jxx4XhKzdVLHDhGlFEaZ2flWWYf2xOqVniqpk38I04DFRyz+L0ASggl7SkItTc+ZLju4w==} resolution: {integrity: sha512-pvFiLP2BeOKA/ZOS6jxx4XhKzdVLHDhGlFEaZ2flWWYf2xOqVniqpk38I04DFRyz+L0ASggl7SkItTc+ZLju4w==}
/@babel/code-frame@7.21.4:
resolution: {integrity: sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/highlight': 7.18.6
/@babel/code-frame@7.23.5: /@babel/code-frame@7.23.5:
resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
...@@ -1913,14 +1910,6 @@ packages: ...@@ -1913,14 +1910,6 @@ packages:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
/@babel/highlight@7.18.6:
resolution: {integrity: sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-validator-identifier': 7.19.1
chalk: 2.4.2
js-tokens: 4.0.0
/@babel/highlight@7.23.4: /@babel/highlight@7.23.4:
resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
...@@ -2758,7 +2747,7 @@ packages: ...@@ -2758,7 +2747,7 @@ packages:
resolution: {integrity: sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==} resolution: {integrity: sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
dependencies: dependencies:
'@babel/code-frame': 7.21.4 '@babel/code-frame': 7.23.5
'@babel/generator': 7.21.5 '@babel/generator': 7.21.5
'@babel/helper-environment-visitor': 7.21.5 '@babel/helper-environment-visitor': 7.21.5
'@babel/helper-function-name': 7.21.0 '@babel/helper-function-name': 7.21.0
...@@ -7930,7 +7919,7 @@ packages: ...@@ -7930,7 +7919,7 @@ packages:
resolution: {integrity: sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==} resolution: {integrity: sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==}
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
dependencies: dependencies:
'@babel/code-frame': 7.21.4 '@babel/code-frame': 7.23.5
'@jest/types': 27.5.1 '@jest/types': 27.5.1
'@types/stack-utils': 2.0.1 '@types/stack-utils': 2.0.1
chalk: 4.1.2 chalk: 4.1.2
...@@ -7945,7 +7934,7 @@ packages: ...@@ -7945,7 +7934,7 @@ packages:
resolution: {integrity: sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==} resolution: {integrity: sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies: dependencies:
'@babel/code-frame': 7.21.4 '@babel/code-frame': 7.23.5
'@jest/types': 29.5.0 '@jest/types': 29.5.0
'@types/stack-utils': 2.0.1 '@types/stack-utils': 2.0.1
chalk: 4.1.2 chalk: 4.1.2
...@@ -9298,7 +9287,7 @@ packages: ...@@ -9298,7 +9287,7 @@ packages:
resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==}
engines: {node: '>=8'} engines: {node: '>=8'}
dependencies: dependencies:
'@babel/code-frame': 7.21.4 '@babel/code-frame': 7.23.5
error-ex: 1.3.2 error-ex: 1.3.2
json-parse-even-better-errors: 2.3.1 json-parse-even-better-errors: 2.3.1
lines-and-columns: 1.2.4 lines-and-columns: 1.2.4
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册