diff options
Diffstat (limited to 'src/commands/dev')
-rw-r--r-- | src/commands/dev/eval.ts | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 617672f..3c9b54c 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -37,13 +37,16 @@ import { SelectMenuComponent, Util } from 'discord.js'; +import path from 'path'; import ts from 'typescript'; +import { fileURLToPath } from 'url'; import { promisify } from 'util'; const { transpile } = ts, emojis = util.emojis, colors = util.colors, sh = promisify(exec), - SnowflakeUtil = new Snowflake_(1420070400000n); + SnowflakeUtil = new Snowflake_(1420070400000n), + __dirname = path.dirname(fileURLToPath(import.meta.url)); /* eslint-enable @typescript-eslint/no-unused-vars */ export default class EvalCommand extends BushCommand { @@ -191,7 +194,22 @@ export default class EvalCommand extends BushCommand { const code: { ts: string | null; js: string; lang: 'ts' | 'js' } = { ts: isTypescript ? rawCode : null, - js: isTypescript ? transpile(rawCode) : rawCode, + js: isTypescript + ? transpile(rawCode, { + module: ts.ModuleKind.ESNext, + target: ts.ScriptTarget.ESNext, + moduleResolution: ts.ModuleResolutionKind.NodeNext, + lib: ['esnext'], + sourceMap: true, + incremental: true, + experimentalDecorators: true, + emitDecoratorMetadata: true, + resolveJsonModule: true, + noImplicitOverride: true, + noErrorTruncation: true, + strict: true + }) + : rawCode, lang: isTypescript ? 'ts' : 'js' }; |