File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ export function evalCode(code: string) {
6767 }
6868 catch ( error ) {
6969 logger ( `eval code:\n${ code } ` )
70- throw new Error ( ' evalCode 无法运行, 请在控制台中查看错误信息' )
70+ throw new Error ( ` evalCode 无法运行, 请在控制台中查看错误信息: ${ ( error as any ) . message } ` )
7171 }
7272}
7373
@@ -90,10 +90,8 @@ export class Deob {
9090 this . ast = parser . parse ( rawCode , { sourceType : 'unambiguous' , allowReturnOutsideFunction : true } )
9191 }
9292 catch ( error ) {
93- console . error ( '代码初始化解析有误!' )
94-
9593 handleError ( error , rawCode )
96- throw new Error ( `代码初始化解析有误! ${ error } ` )
94+ throw error
9795 }
9896 }
9997
@@ -284,6 +282,5 @@ function getMangleMatcher(options: Options): ((id: string) => boolean) | undefin
284282
285283 }
286284 }
287- default :
288285 }
289286}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const editorOptions = computed<monaco.editor.IStandaloneEditorConstructionOption
1515 readOnly: true ,
1616 fontSize: 13 ,
1717 tabSize: 2 ,
18- wordWrap: editorWordWrap .value ? ( ' on' as const ) : ( ' off' as const ) ,
18+ wordWrap: editorWordWrap .value ? ' on' : ' off' ,
1919 stickyScroll: {
2020 enabled: editorStickyScroll .value ,
2121 },
@@ -126,9 +126,17 @@ function openOptions() {
126126 </div >
127127 <div
128128 v-else-if =" error"
129- class =" w-full overflow-auto p-3 text-sm text-red-600 dark:text-red-400 "
129+ class =" w-full overflow-auto p-4 text-sm"
130130 >
131- <pre class =" whitespace-pre-wrap" v-text =" String(error)" />
131+ <div class =" flex items-start gap-2 rounded-lg border border-red-200 bg-red-50/90 p-3 text-red-800 shadow-sm dark:(border-red-900/60 bg-red-900/30 text-red-100)" >
132+ <div class =" i-ri:error-warning-line mt-0.5 text-lg" />
133+ <div class =" space-y-2" >
134+ <div class =" text-xs uppercase tracking-wide text-red-500 dark:text-red-200" >
135+ 解析失败
136+ </div >
137+ <pre class =" max-h-60 whitespace-pre-wrap break-all font-mono text-xs leading-5" v-text =" String(error)" />
138+ </div >
139+ </div >
132140 </div >
133141 <div
134142 v-else-if =" !output"
Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import type * as monaco from ' monaco-editor'
3-
43import { codePrettier , parser } from ' deob'
54
65// eslint-disable-next-line ts/consistent-type-imports
@@ -13,7 +12,6 @@ interface Example {
1312}
1413
1514const files = import .meta .glob (' ../../example/**/input.js' , { as: ' raw' })
16-
1715const examples: Example [] = Object .entries (files ).map (([key , value ]) => ({
1816 name: key .replace (' ../../example/' , ' ' ),
1917 value ,
@@ -26,7 +24,7 @@ const editorOptions = computed<monaco.editor.IStandaloneEditorConstructionOption
2624 theme: editorTheme .value ,
2725 fontSize: 13 ,
2826 tabSize: 2 ,
29- wordWrap: editorWordWrap .value ? ( ' on' as const ) : ( ' off' as const ) ,
27+ wordWrap: editorWordWrap .value ? ' on' : ' off' ,
3028 stickyScroll: {
3129 enabled: editorStickyScroll .value ,
3230 },
@@ -106,7 +104,7 @@ async function beautify() {
106104 <span class =" text-[11px] text-zinc-500 dark:text-zinc-400" >粘贴混淆代码,或直接加载示例/上传文件。</span >
107105 </div >
108106 <div class =" flex flex-wrap items-center gap-2" >
109- <label class =" flex items-center gap-2 rounded-md border border-zinc-200/80 bg-white/90 px-3 py-1 text-[11px ] font-medium shadow-sm transition hover:border-amber-300 dark:(border-zinc-700 bg-zinc-900/80)" >
107+ <label class =" flex items-center gap-2 rounded-md border border-zinc-200/80 bg-white/90 px-3 py-1 text-10px ] font-medium shadow-sm transition hover:border-amber-300 dark:(border-zinc-700 bg-zinc-900/80)" >
110108 <span >示例</span >
111109 <select
112110 name =" example-select"
You can’t perform that action at this time.
0 commit comments