From fd5dbb05d741fec683c210aed012a55c7da0ca87 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Mon, 31 Jan 2022 21:29:06 -0500 Subject: misc --- src/commands/dev/eval.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/commands/dev/eval.ts') 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' }; -- cgit