Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit e6e881f

Browse files
committed
fix: Remove lazy loading of libraries in deps
2 parents 958fa13 + 733403c commit e6e881f

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/deps.ts

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// tslint:disable no-implicit-dependencies
21
import chalk = require('chalk')
32

43
import args = require('./args')
@@ -10,27 +9,18 @@ import validate = require('./validate')
109

1110
export const deps = {
1211
// local
13-
get args(): typeof args { return fetch('./args') },
14-
get flags(): typeof flags { return fetch('./flags') },
15-
get parse(): typeof parse { return fetch('./parse') },
16-
get validate(): typeof validate { return fetch('./validate') },
17-
get renderList(): typeof list.renderList { return fetch('./list').renderList },
18-
get errors(): typeof errors { return fetch('./errors') },
12+
get args(): typeof args { return args },
13+
get flags(): typeof flags { return flags },
14+
get parse(): typeof parse { return parse },
15+
get validate(): typeof validate { return validate },
16+
get renderList(): typeof list.renderList { return list.renderList },
17+
get errors(): typeof errors { return errors },
1918

2019
// remote
2120
get chalk(): typeof chalk.default | undefined {
2221
try {
23-
return fetch('chalk').default
22+
return chalk.default
2423
// tslint:disable-next-line no-unused
2524
} catch (err) {}
2625
},
2726
}
28-
29-
const cache: any = {}
30-
31-
function fetch(s: string) {
32-
if (!cache[s]) {
33-
cache[s] = require(s)
34-
}
35-
return cache[s]
36-
}

0 commit comments

Comments
 (0)