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

fix(x-ios): 修复 错误日志sourcemap解析

上级 98bbbde1
...@@ -75,6 +75,7 @@ export function uniAppIOSPlugin(): UniVitePlugin { ...@@ -75,6 +75,7 @@ export function uniAppIOSPlugin(): UniVitePlugin {
process.env.UNI_APP_X_CACHE_DIR process.env.UNI_APP_X_CACHE_DIR
? path.resolve( ? path.resolve(
process.env.UNI_APP_X_CACHE_DIR, process.env.UNI_APP_X_CACHE_DIR,
'sourcemap',
APP_SERVICE_FILENAME_MAP APP_SERVICE_FILENAME_MAP
) )
: path.resolve( : path.resolve(
......
...@@ -62,7 +62,11 @@ export { parseInjectModules, parseExtApiProviders } from './utils' ...@@ -62,7 +62,11 @@ export { parseInjectModules, parseExtApiProviders } from './utils'
export * from './sourceMap' export * from './sourceMap'
export { parseUTSKotlinRuntimeStacktrace } from './stacktrace' export {
parseUTSRuntimeStacktrace,
parseUTSKotlinRuntimeStacktrace,
parseUTSJavaScriptRuntimeStacktrace,
} from './stacktrace'
export { compile as toKotlin } from './kotlin' export { compile as toKotlin } from './kotlin'
export { compile as toSwift } from './swift' export { compile as toSwift } from './swift'
......
import { relative } from '../utils' import { relative } from '../utils'
import {
type GenerateJavaScriptRuntimeCodeFrameOptions,
parseUTSJavaScriptRuntimeStacktrace,
} from './js'
import {
type GenerateKotlinRuntimeCodeFrameOptions,
parseUTSKotlinRuntimeStacktrace,
} from './kotlin'
export { parseUTSSwiftPluginStacktrace } from './swift' export { parseUTSSwiftPluginStacktrace } from './swift'
...@@ -7,6 +15,21 @@ export { ...@@ -7,6 +15,21 @@ export {
parseUTSKotlinRuntimeStacktrace, parseUTSKotlinRuntimeStacktrace,
} from './kotlin' } from './kotlin'
export { parseUTSJavaScriptRuntimeStacktrace } from './js'
export function parseUTSRuntimeStacktrace(
stacktrace: string,
options:
| GenerateKotlinRuntimeCodeFrameOptions
| GenerateJavaScriptRuntimeCodeFrameOptions
) {
if (options.language === 'kotlin') {
return parseUTSKotlinRuntimeStacktrace(stacktrace, options)
} else if (options.language === 'javascript') {
return parseUTSJavaScriptRuntimeStacktrace(stacktrace, options)
}
}
export function parseUTSSyntaxError(error: any, inputDir: string): string { export function parseUTSSyntaxError(error: any, inputDir: string): string {
if (error instanceof Error) { if (error instanceof Error) {
error = error.message error = error.message
......
...@@ -9,8 +9,11 @@ import { ...@@ -9,8 +9,11 @@ import {
splitRE, splitRE,
} from './utils' } from './utils'
interface GenerateJavaScriptRuntimeCodeFrameOptions export interface GenerateJavaScriptRuntimeCodeFrameOptions
extends GenerateRuntimeCodeFrameOptions {} extends GenerateRuntimeCodeFrameOptions {
language: 'javascript'
}
const JS_ERROR_RE = /\(\d+:\d+\)\s(.*)\s@([^\s]+\.js)\:(\d+)\:(\d+)/ const JS_ERROR_RE = /\(\d+:\d+\)\s(.*)\s@([^\s]+\.js)\:(\d+)\:(\d+)/
const VUE_ERROR_RE = /@([^\s]+\.js)\:(\d+)\:(\d+)/ const VUE_ERROR_RE = /@([^\s]+\.js)\:(\d+)\:(\d+)/
......
...@@ -183,9 +183,10 @@ function parseFilenameByClassName(className: string) { ...@@ -183,9 +183,10 @@ function parseFilenameByClassName(className: string) {
return kotlinManifest.manifest[className.split('$')[0]] || 'index.kt' return kotlinManifest.manifest[className.split('$')[0]] || 'index.kt'
} }
interface GenerateKotlinRuntimeCodeFrameOptions export interface GenerateKotlinRuntimeCodeFrameOptions
extends GenerateRuntimeCodeFrameOptions { extends GenerateRuntimeCodeFrameOptions {
appid: string appid: string
language: 'kotlin'
} }
export function parseUTSKotlinRuntimeStacktrace( export function parseUTSKotlinRuntimeStacktrace(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册