File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1- // tsc generates a module.exports for TypeScript files so we have this wrapper to load the module
1+ // tsc assigns to a global exports variable for TypeScript files which doesn't pair well
2+ // with mongosh scripts so we have this wrapper to load the module and minimize rewriting.
23( ( ) => {
34 const localRequire = require ( 'module' ) . createRequire ( __filename ) ;
45 // eslint-disable-next-line no-undef
Original file line number Diff line number Diff line change @@ -2,27 +2,27 @@ const _localRequire = require('module').createRequire(__filename);
22const localRequire = < T > ( module : string ) : T => _localRequire ( module ) ;
33const { EventEmitter } = localRequire < typeof import ( 'events' ) > ( 'events' ) ;
44
5- const IS_DEBUG = process . env . DEBUG === 'true' ;
5+ const MONGOSH_AI_IS_DEBUG = process . env . DEBUG === 'true' ;
66
77class Logger extends EventEmitter {
88 debug ( ...args : unknown [ ] ) {
9- if ( IS_DEBUG ) {
9+ if ( MONGOSH_AI_IS_DEBUG ) {
1010 // eslint-disable-next-line no-console
1111 console . debug ( ...args ) ;
1212 this . emit ( 'debug' , ...args ) ;
1313 }
1414 }
1515
1616 info ( ...args : unknown [ ] ) {
17- if ( IS_DEBUG ) {
17+ if ( MONGOSH_AI_IS_DEBUG ) {
1818 // eslint-disable-next-line no-console
1919 console . info ( ...args ) ;
2020 this . emit ( 'info' , ...args ) ;
2121 }
2222 }
2323
2424 error ( ...args : unknown [ ] ) {
25- if ( IS_DEBUG ) {
25+ if ( MONGOSH_AI_IS_DEBUG ) {
2626 // eslint-disable-next-line no-console
2727 console . error ( ...args ) ;
2828 this . emit ( 'error' , ...args ) ;
You can’t perform that action at this time.
0 commit comments