From baef92eec367340a6a764fde4879a21d97647c26 Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Wed, 18 May 2022 22:46:57 +0800 Subject: [PATCH] chore: uni-stacktracey --- .../uni-stacktracey/__tests__/test.spec.ts | 77 ++++ .../dist/uni-stacktracey.cjs.js | 374 +++++++++--------- packages/uni-stacktracey/package.json | 4 +- packages/uni-stacktracey/src/index.ts | 67 ++-- packages/uni-stacktracey/test/index.js | 65 +-- packages/uni-stacktracey/tsconfig.json | 4 + 6 files changed, 343 insertions(+), 248 deletions(-) create mode 100644 packages/uni-stacktracey/__tests__/test.spec.ts diff --git a/packages/uni-stacktracey/__tests__/test.spec.ts b/packages/uni-stacktracey/__tests__/test.spec.ts new file mode 100644 index 000000000..ee50287b4 --- /dev/null +++ b/packages/uni-stacktracey/__tests__/test.spec.ts @@ -0,0 +1,77 @@ +const { + stacktracey, + uniStracktraceyPreset, + utsStracktraceyPreset, +} = require('../dist/uni-stacktracey.cjs.js') + +const utsErrorMsg = `Appid: __UNI__E070870 +e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestComponent.kt: (68, 9): Unresolved reference: hello +e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (30, 9): Unresolved reference: hello + +FAILURE: Build failed with an exception. + +* What went wrong: +Execution failed for task ':nativeplugins:DCloud-UTSPlugin:compileReleaseKotlin'. +> Compilation error. See log for more details + +* Try: +Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. + +* Get more help at https://help.gradle.org + +BUILD FAILED in 3s` + +const uniErrorMsg = `ReferenceError: Sentry is not defined +at Proxy.throwError(/vue3/assets/pages-index-index.4077a069.js:1:295) +at e(/vue3/assets/index.2be9343a.js:1:52317) +at Ue(/vue3/assets/index.2be9343a.js:1:16271) +at He(/vue3/assets/index.2be9343a.js:1:16349) +at HTMLElement.n(/vue3/assets/index.2be9343a.js:1:51834) +at HTMLElement.o(/vue3/assets/index.2be9343a.js:21:60087)` + +describe('uni-stacktracey', () => { + test('uniStracktraceyPreset', () => { + stacktracey(uniErrorMsg, { + preset: uniStracktraceyPreset({ + base: 'https://7463-tcb-uzyfn59tqxjxtnbab2e2c-5ba40b-1303909289.tcb.qcloud.la', + platform: 'h5', + version: '1.0.0', + }), + }).then((res: string) => { + expect(res).toEqual(`ReferenceError: Sentry is not defined +at Proxy.throwError(/vue3/assets/pages-index-index.4077a069.js:1 +at e(/vue3/assets/index.2be9343a.js:1 +at Ue(/vue3/assets/index.2be9343a.js:1 +at He(/vue3/assets/index.2be9343a.js:1 +at HTMLElement.n(/vue3/assets/index.2be9343a.js:1 +at HTMLElement.o(/vue3/assets/index.2be9343a.js:21 `) + }) + }) + + test('uniStracktraceyPreset', () => { + stacktracey(utsErrorMsg, { + preset: utsStracktraceyPreset({ + base: '/usr/fxy/poroject/test/.sourcemap/src/', + sourceRoot: + '/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/', + }), + }).then((res: string) => { + expect(res).toEqual(`Appid: __UNI__E070870 +e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestComponent.kt: (68, 9): Unresolved reference: hello +e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (30, 9): Unresolved reference: hello + +FAILURE: Build failed with an exception. + +* What went wrong: +Execution failed for task ':nativeplugins:DCloud-UTSPlugin:compileReleaseKotlin'. +> Compilation error. See log for more details + +* Try: +Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. + +* Get more help at https://help.gradle.org + +BUILD FAILED in 3s`) + }) + }) +}) diff --git a/packages/uni-stacktracey/dist/uni-stacktracey.cjs.js b/packages/uni-stacktracey/dist/uni-stacktracey.cjs.js index 2423e94cc..c65a7ef7f 100644 --- a/packages/uni-stacktracey/dist/uni-stacktracey.cjs.js +++ b/packages/uni-stacktracey/dist/uni-stacktracey.cjs.js @@ -11,192 +11,194 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); var StackTracey__default = /*#__PURE__*/_interopDefaultLegacy(StackTracey); -const nixSlashes = (x) => x.replace(/\\/g, '/'); -const sourcemapCatch = {}; -function stacktracey(stacktrace, opts) { - const parseStack = []; - const stack = opts.preset.parseStacktrace(stacktrace); - stack.items.forEach((item, index) => { - const fn = () => { - const { line = 0, column = 0, file, fileName } = item; - try { - return opts.preset - .getSourceMapContent(file, fileName) - .then((content) => { - if (content) - return sourceMap.SourceMapConsumer.with(content, null, (consumer) => { - const sourceMapContent = parseSourceMapContent(consumer, { - line, - column, - }); - if (sourceMapContent) { - const { source, sourcePath, sourceLine, sourceColumn, fileName = '', } = sourceMapContent; - stack.items[index] = Object.assign({}, item, { - file: source, - line: sourceLine, - column: sourceColumn, - fileShort: sourcePath, - fileRelative: sourcePath, - fileName, - }); - } - }); - }); - } - catch (error) { - return Promise.resolve(); - } - }; - parseStack.push(fn()); - }); - return new Promise((resolve, reject) => { - Promise.all(parseStack) - .then(() => { - const parseError = opts.preset.asTableStacktrace({ - maxColumnWidths: { - callee: 999, - file: 999, - sourceLine: 999, - }, - stacktrace, - }); - resolve(parseError); - }) - .catch(() => { - resolve(stacktrace); - }); - }); -} -function getSourceMapContent(sourcemapUrl) { - try { - return (sourcemapCatch[sourcemapUrl] || - (sourcemapCatch[sourcemapUrl] = new Promise((resolve, reject) => { - try { - if (/^[a-z]+:/i.test(sourcemapUrl)) { - /* uni - .request(sourcemapUrl) - .then((res) => { - console.log('sourcemapUrl :>> ', sourcemapUrl) - sourcemapCatch[sourcemapUrl] = res.data - resolve(sourcemapCatch[sourcemapUrl]) - }) - .catch((_) => { - resolve('') - }) */ - } - else { - sourcemapCatch[sourcemapUrl] = fs__default["default"].readFileSync(sourcemapUrl, 'utf-8'); - resolve(sourcemapCatch[sourcemapUrl]); - } - } - catch (error) { - resolve(''); - } - }))); - } - catch (error) { - return ''; - } -} -function parseSourceMapContent(consumer, obj) { - // source -> 'uni-app:///node_modules/@sentry/browser/esm/helpers.js' - const { source, line: sourceLine, column: sourceColumn, } = consumer.originalPositionFor(obj); - if (source) { - const sourcePathSplit = source.split('/'); - const sourcePath = sourcePathSplit.slice(3).join('/'); - const fileName = sourcePathSplit.pop(); - return { - source, - sourcePath, - sourceLine: sourceLine === null ? 0 : sourceLine, - sourceColumn: sourceColumn === null ? 0 : sourceColumn, - fileName, - }; - } -} -function uniStracktraceyPreset(opts) { - const { base, platform, version } = opts; - let stack; - return { - parseSourceMapUrl(file, fileName) { - if (!platform || !version) - return ''; - // 根据 base,platform,version,filename 组合 sourceMapUrl - return `${base}/${version}/.sourcemap/${platform}/${file.split('.')[0]}.js.map`; - }, - getSourceMapContent(file, fileName) { - return Promise.resolve(getSourceMapContent(this.parseSourceMapUrl(file, fileName))); - }, - parseStacktrace(stacktrace) { - return (stack = new StackTracey__default["default"](stacktrace)); - }, - asTableStacktrace({ maxColumnWidths, stacktrace } = { stacktrace: '' }) { - const errorName = stacktrace.split('\n')[0]; - return errorName.indexOf('at') === -1 - ? `${errorName}\n` - : '' + (stack.asTable ? stack.asTable({ maxColumnWidths }) : ''); - }, - }; -} -function utsStracktraceyPreset(opts) { - let stack; - return { - parseSourceMapUrl(file, fileName) { - // 根据 base,filename 组合 sourceMapUrl - return `${opts.base}/${fileName}.map`; - }, - getSourceMapContent(file, fileName) { - // 根据 base,filename 组合 sourceMapUrl - return Promise.resolve(getSourceMapContent(this.parseSourceMapUrl(file, fileName))); - }, - parseStacktrace(str) { - const lines = (str || '').split('\n'); - const entries = lines - .map((line) => { - line = line.trim(); - let callee, fileLineColumn = [], planA, planB; - if ((planA = line.match(/e: \[(.+)\](.+): (.+)/))) { - callee = planA[1]; - fileLineColumn = (planA[2].match(/(.+):.*\((\d+).+?(\d+)\)/) || []).slice(1); - } - else { - return undefined; - } - const fileName = fileLineColumn[0] - ? (planB = fileLineColumn[0].match(/(\/.*)*\/(.+)/) || [])[2] || '' - : ''; - return { - beforeParse: line, - callee: callee || '', - index: false, - native: false, - file: nixSlashes(fileLineColumn[0] || ''), - line: parseInt(fileLineColumn[1] || '', 10) || undefined, - column: parseInt(fileLineColumn[2] || '', 10) || undefined, - fileName, - fileShort: planB ? planB[1] : '', - errMsg: planA[3] || '', - calleeShort: '', - fileRelative: '', - thirdParty: false, - }; - }) - .filter((x) => x !== undefined); - return (stack = { - items: entries, - }); - }, - asTableStacktrace({ stacktrace } = { stacktrace: '' }) { - const stacktraceSplit = stacktrace.split('\n'); - const errorName = stacktraceSplit[0]; - const errorMsg = stacktraceSplit.pop(); - return ((errorName.indexOf('e:') === -1 ? `${errorName}\n` : '') + - (stack.items - .map((item) => `e: [${item.callee}]${item.fileShort}/${item.fileName}: (${item.line}, ${item.column}): ${item.errMsg}`) - .join('\n') + - (errorMsg ? `\n\n${errorMsg}` : ''))); - }, - }; +const nixSlashes = (x) => x.replace(/\\/g, '/'); +const sourcemapCatch = {}; +function stacktracey(stacktrace, opts) { + const parseStack = []; + const stack = opts.preset.parseStacktrace(stacktrace); + stack.items.forEach((item, index) => { + const fn = () => { + const { line = 0, column = 0, file, fileName } = item; + try { + return opts.preset + .getSourceMapContent(file, fileName) + .then((content) => { + if (content) + return sourceMap.SourceMapConsumer.with(content, null, (consumer) => { + const sourceMapContent = parseSourceMapContent(consumer, { + line, + column, + }); + if (sourceMapContent) { + const { source, sourcePath, sourceLine, sourceColumn, fileName = '', } = sourceMapContent; + stack.items[index] = Object.assign({}, item, { + file: source, + line: sourceLine, + column: sourceColumn, + fileShort: sourcePath, + fileRelative: sourcePath, + fileName, + }); + } + }); + }); + } + catch (error) { + return Promise.resolve(); + } + }; + parseStack.push(fn()); + }); + return new Promise((resolve, reject) => { + Promise.all(parseStack) + .then(() => { + const parseError = opts.preset.asTableStacktrace({ + maxColumnWidths: { + callee: 999, + file: 999, + sourceLine: 999, + }, + stacktrace, + }); + resolve(parseError); + }) + .catch(() => { + resolve(stacktrace); + }); + }); +} +function getSourceMapContent(sourcemapUrl) { + try { + return (sourcemapCatch[sourcemapUrl] || + (sourcemapCatch[sourcemapUrl] = new Promise((resolve, reject) => { + try { + if (/^[a-z]+:/i.test(sourcemapUrl)) { + uni.request({ + url: sourcemapUrl, + success: (res) => { + console.log('sourcemapUrl :>> ', sourcemapUrl); + sourcemapCatch[sourcemapUrl] = res.data; + resolve(sourcemapCatch[sourcemapUrl]); + }, + }); + } + else { + sourcemapCatch[sourcemapUrl] = fs__default["default"].readFileSync(sourcemapUrl, 'utf-8'); + resolve(sourcemapCatch[sourcemapUrl]); + } + } + catch (error) { + resolve(''); + } + }))); + } + catch (error) { + return ''; + } +} +function parseSourceMapContent(consumer, obj) { + // source -> 'uni-app:///node_modules/@sentry/browser/esm/helpers.js' + const { source, line: sourceLine, column: sourceColumn, } = consumer.originalPositionFor(obj); + if (source) { + const sourcePathSplit = source.split('/'); + const sourcePath = sourcePathSplit.slice(3).join('/'); + const fileName = sourcePathSplit.pop(); + return { + source, + sourcePath, + sourceLine: sourceLine === null ? 0 : sourceLine, + sourceColumn: sourceColumn === null ? 0 : sourceColumn, + fileName, + }; + } +} +function uniStracktraceyPreset(opts) { + const { base, platform, version } = opts; + let stack; + return { + parseSourceMapUrl(file, fileName) { + if (!platform || !version) + return ''; + // 根据 base,platform,version,filename 组合 sourceMapUrl + return `${base}/${version}/.sourcemap/${platform}/${file.split('.')[0]}.js.map`; + }, + getSourceMapContent(file, fileName) { + return Promise.resolve(getSourceMapContent(this.parseSourceMapUrl(file, fileName))); + }, + parseStacktrace(stacktrace) { + return (stack = new StackTracey__default["default"](stacktrace)); + }, + asTableStacktrace({ maxColumnWidths, stacktrace } = { stacktrace: '' }) { + const errorName = stacktrace.split('\n')[0]; + return ((errorName.indexOf('at') === -1 ? `${errorName}\n` : '') + + (stack.asTable ? stack.asTable({ maxColumnWidths }) : '')); + }, + }; +} +function utsStracktraceyPreset(opts) { + let stack; + let errStack = []; + return { + parseSourceMapUrl(file, fileName) { + // 根据 base,filename 组合 sourceMapUrl + return `${opts.base}${file.replace(opts.sourceRoot, '')}.map`; + }, + getSourceMapContent(file, fileName) { + // 根据 base,filename 组合 sourceMapUrl + return Promise.resolve(getSourceMapContent(this.parseSourceMapUrl(file, fileName))); + }, + parseStacktrace(str) { + const lines = (str || '').split('\n'); + const entries = lines + .map((line, index) => { + line = line.trim(); + let callee, fileLineColumn = [], planA, planB; + if ((planA = line.match(/e: (.+\.kt)(.+\))*:\s*(.+)*/))) { + errStack.push('%StacktraceyItem%'); + callee = 'e: '; + fileLineColumn = (planA[2].match(/.*:.*\((\d+).+?(\d+)\)/) || []).slice(1); + } + else { + errStack.push(line); + return undefined; + } + const fileName = planA[1] + ? (planB = planA[1].match(/(.*)*\/(.+)/) || [])[2] || '' + : ''; + return { + beforeParse: line, + callee: callee || '', + index: false, + native: false, + file: nixSlashes(planA[1] || ''), + line: parseInt(fileLineColumn[0] || '', 10) || undefined, + column: parseInt(fileLineColumn[1] || '', 10) || undefined, + fileName, + fileShort: planB ? planB[1] : '', + errMsg: planA[3] || '', + calleeShort: '', + fileRelative: '', + thirdParty: false, + }; + }) + .filter((x) => x !== undefined); + return (stack = { + items: entries, + }); + }, + asTableStacktrace({ stacktrace } = { stacktrace: '' }) { + return errStack + .map((item) => { + if (item === '%StacktraceyItem%') { + const _stack = stack.items.shift(); + if (_stack) + return `${_stack.callee}${_stack.fileShort}/${_stack.fileName}: (${_stack.line}, ${_stack.column}): ${_stack.errMsg}`; + } + return item; + }) + .join('\n'); + }, + }; } exports.stacktracey = stacktracey; diff --git a/packages/uni-stacktracey/package.json b/packages/uni-stacktracey/package.json index a8e3119ac..8c71ba550 100644 --- a/packages/uni-stacktracey/package.json +++ b/packages/uni-stacktracey/package.json @@ -23,5 +23,7 @@ "stacktracey": "^2.1.8", "source-map": "^0.7.3" }, - "devDependencies": {} + "devDependencies": { + "@dcloudio/types": "^2.6.6" + } } diff --git a/packages/uni-stacktracey/src/index.ts b/packages/uni-stacktracey/src/index.ts index 673fa267c..308dd023d 100644 --- a/packages/uni-stacktracey/src/index.ts +++ b/packages/uni-stacktracey/src/index.ts @@ -120,16 +120,14 @@ function getSourceMapContent(sourcemapUrl: string) { (sourcemapCatch[sourcemapUrl] = new Promise((resolve, reject) => { try { if (/^[a-z]+:/i.test(sourcemapUrl)) { - /* uni - .request(sourcemapUrl) - .then((res) => { + uni.request({ + url: sourcemapUrl, + success: (res) => { console.log('sourcemapUrl :>> ', sourcemapUrl) - sourcemapCatch[sourcemapUrl] = res.data + sourcemapCatch[sourcemapUrl] = res.data as string resolve(sourcemapCatch[sourcemapUrl]) - }) - .catch((_) => { - resolve('') - }) */ + }, + }) } else { sourcemapCatch[sourcemapUrl] = fs.readFileSync( sourcemapUrl, @@ -212,9 +210,10 @@ export function uniStracktraceyPreset( }, asTableStacktrace({ maxColumnWidths, stacktrace } = { stacktrace: '' }) { const errorName = stacktrace.split('\n')[0] - return errorName.indexOf('at') === -1 - ? `${errorName}\n` - : '' + (stack.asTable ? stack.asTable({ maxColumnWidths }) : '') + return ( + (errorName.indexOf('at') === -1 ? `${errorName}\n` : '') + + (stack.asTable ? stack.asTable({ maxColumnWidths }) : '') + ) }, } } @@ -233,10 +232,11 @@ export function utsStracktraceyPreset( opts: UtsStracktraceyPreset ): StacktraceyPreset { let stack: Stacktracey + let errStack: string[] = [] return { parseSourceMapUrl(file, fileName) { // 根据 base,filename 组合 sourceMapUrl - return `${opts.base}/${fileName}.map` + return `${opts.base}${file.replace(opts.sourceRoot, '')}.map` }, getSourceMapContent(file, fileName) { // 根据 base,filename 组合 sourceMapUrl @@ -248,7 +248,7 @@ export function utsStracktraceyPreset( const lines = (str || '').split('\n') const entries = lines - .map((line) => { + .map((line, index) => { line = line.trim() let callee, @@ -256,17 +256,19 @@ export function utsStracktraceyPreset( planA, planB - if ((planA = line.match(/e: \[(.+)\](.+): (.+)/))) { - callee = planA[1] + if ((planA = line.match(/e: (.+\.kt)(.+\))*:\s*(.+)*/))) { + errStack.push('%StacktraceyItem%') + callee = 'e: ' fileLineColumn = ( - planA[2].match(/(.+):.*\((\d+).+?(\d+)\)/) || [] + planA[2].match(/.*:.*\((\d+).+?(\d+)\)/) || [] ).slice(1) } else { + errStack.push(line) return undefined } - const fileName = fileLineColumn[0] - ? (planB = fileLineColumn[0].match(/(\/.*)*\/(.+)/) || [])[2] || '' + const fileName = planA[1] + ? (planB = planA[1].match(/(.*)*\/(.+)/) || [])[2] || '' : '' return { @@ -274,9 +276,9 @@ export function utsStracktraceyPreset( callee: callee || '', index: false, native: false, - file: nixSlashes(fileLineColumn[0] || ''), - line: parseInt(fileLineColumn[1] || '', 10) || undefined, - column: parseInt(fileLineColumn[2] || '', 10) || undefined, + file: nixSlashes(planA[1] || ''), + line: parseInt(fileLineColumn[0] || '', 10) || undefined, + column: parseInt(fileLineColumn[1] || '', 10) || undefined, fileName, fileShort: planB ? planB[1] : '', errMsg: planA[3] || '', @@ -292,19 +294,16 @@ export function utsStracktraceyPreset( }) }, asTableStacktrace({ stacktrace } = { stacktrace: '' }) { - const stacktraceSplit = stacktrace.split('\n') - const errorName = stacktraceSplit[0] - const errorMsg = stacktraceSplit.pop() - return ( - (errorName.indexOf('e:') === -1 ? `${errorName}\n` : '') + - (stack.items - .map( - (item) => - `e: [${item.callee}]${item.fileShort}/${item.fileName}: (${item.line}, ${item.column}): ${item.errMsg}` - ) - .join('\n') + - (errorMsg ? `\n\n${errorMsg}` : '')) - ) + return errStack + .map((item) => { + if (item === '%StacktraceyItem%') { + const _stack = stack.items.shift() + if (_stack) + return `${_stack.callee}${_stack.fileShort}/${_stack.fileName}: (${_stack.line}, ${_stack.column}): ${_stack.errMsg}` + } + return item + }) + .join('\n') }, } } diff --git a/packages/uni-stacktracey/test/index.js b/packages/uni-stacktracey/test/index.js index b7e431653..a2799e1ee 100644 --- a/packages/uni-stacktracey/test/index.js +++ b/packages/uni-stacktracey/test/index.js @@ -5,34 +5,45 @@ const { } = require('../dist/uni-stacktracey.cjs.js') const utsErrorMsg = `Appid: __UNI__E070870 -e: [PackagePath]/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (8, 1): Expecting a top level declaration -e: [PackagePath]/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (8, 9): Expecting a top level declaration -e: [PackagePath]/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (8, 10): Expecting a top level declaration -e: [PackagePath]/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (8, 11): Expecting a top level declaration -e: [PackagePath]/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (8, 16): Expecting a top level declaration - -FAILURE: Build failed with an exception.` - -stacktracey( - `ReferenceError: Sentry is not defined - at Proxy.throwError(/vue3/assets/pages-index-index.4077a069.js:1:295) - at e(/vue3/assets/index.2be9343a.js:1:52317) - at Ue(/vue3/assets/index.2be9343a.js:1:16271) - at He(/vue3/assets/index.2be9343a.js:1:16349) - at HTMLElement.n(/vue3/assets/index.2be9343a.js:1:51834) - at HTMLElement.o(/vue3/assets/index.2be9343a.js:21:60087)`, - { - preset: uniStracktraceyPreset({ - base: 'https://7463-tcb-uzyfn59tqxjxtnbab2e2c-5ba40b-1303909289.tcb.qcloud.la', - platform: 'h5', - version: '1.0.0', - }), - } -).then((res) => console.log(res)) +e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestComponent.kt: (68, 9): Unresolved reference: hello +e: DCloud-UTSPlugin/android/src/io/dcloud/uniplugin/TestModule.kt: (30, 9): Unresolved reference: hello +FAILURE: Build failed with an exception. + +* What went wrong: +Execution failed for task ':nativeplugins:DCloud-UTSPlugin:compileReleaseKotlin'. +> Compilation error. See log for more details + +* Try: +Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. + +* Get more help at https://help.gradle.org + +BUILD FAILED in 3s` + +const uniErrorMsg = `ReferenceError: Sentry is not defined +at Proxy.throwError(/vue3/assets/pages-index-index.4077a069.js:1:295) +at e(/vue3/assets/index.2be9343a.js:1:52317) +at Ue(/vue3/assets/index.2be9343a.js:1:16271) +at He(/vue3/assets/index.2be9343a.js:1:16349) +at HTMLElement.n(/vue3/assets/index.2be9343a.js:1:51834) +at HTMLElement.o(/vue3/assets/index.2be9343a.js:21:60087)` + +stacktracey(uniErrorMsg, { + preset: uniStracktraceyPreset({ + base: 'https://7463-tcb-uzyfn59tqxjxtnbab2e2c-5ba40b-1303909289.tcb.qcloud.la', + platform: 'h5', + version: '1.0.0', + }), +}).then((res) => { + console.log('res :>> ', res) +}) /* stacktracey(utsErrorMsg, { preset: utsStracktraceyPreset({ - base: '/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/io/dcloud/uniplugin', - sourceRoot: '', + base: '/usr/fxy/poroject/test/.sourcemap/src/', + sourceRoot: + '/wgtRoot/__UNI__E070870/nativeplugins/DCloud-UTSPlugin/android/src/', }), -}).then((res) => console.log(res)) */ +}).then((res) => { + console.log('res :>> ', res); +}) */ diff --git a/packages/uni-stacktracey/tsconfig.json b/packages/uni-stacktracey/tsconfig.json index cc86ba150..2f36460d2 100644 --- a/packages/uni-stacktracey/tsconfig.json +++ b/packages/uni-stacktracey/tsconfig.json @@ -15,6 +15,10 @@ "lib": [ "ESNext", "DOM" + ], + "types": [ + "node", + "@dcloudio/types" ] }, "include": [ -- GitLab