bajo 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import resolvePath from './resolve-path.js'
|
|
2
2
|
import { isFunction, isPlainObject } from 'lodash-es'
|
|
3
3
|
import error from './error.js'
|
|
4
|
+
import fs from 'fs-extra'
|
|
4
5
|
|
|
5
6
|
async function load (file, asDefaultImport = true) {
|
|
6
7
|
const imported = await import(resolvePath(file, true))
|
|
@@ -9,6 +10,7 @@ async function load (file, asDefaultImport = true) {
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
async function importModule (file, { asDefaultImport, asHandler } = {}) {
|
|
13
|
+
if (!fs.existsSync(file)) return
|
|
12
14
|
let mod = await load(file, asDefaultImport)
|
|
13
15
|
if (!asHandler) return mod
|
|
14
16
|
if (isFunction(mod)) mod = { level: 999, handler: mod }
|