diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-01-31 21:29:06 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-01-31 21:29:06 -0500 |
commit | fd5dbb05d741fec683c210aed012a55c7da0ca87 (patch) | |
tree | 7ba4b0e86830114843dd225b5d45a44675877b72 /src/commands/dev/eval.ts | |
parent | 9a051637d1e529f634c1becf0934b9559a6f1b90 (diff) | |
download | tanzanite-fd5dbb05d741fec683c210aed012a55c7da0ca87.tar.gz tanzanite-fd5dbb05d741fec683c210aed012a55c7da0ca87.tar.bz2 tanzanite-fd5dbb05d741fec683c210aed012a55c7da0ca87.zip |
misc
Diffstat (limited to 'src/commands/dev/eval.ts')
-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' }; |