bajo 0.2.7 → 0.2.9
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.
|
@@ -23,7 +23,7 @@ async function _eachPlugins (handler, { key = 'name', glob, ns, useBajo } = {})
|
|
|
23
23
|
if (isString(pattern)) pattern = [pattern]
|
|
24
24
|
opts = omit(opts, ['pattern'])
|
|
25
25
|
for (const i in pattern) {
|
|
26
|
-
pattern[i] = `${base}/${pattern[i]}`
|
|
26
|
+
if (!path.isAbsolute(pattern[i])) pattern[i] = `${base}/${pattern[i]}`
|
|
27
27
|
}
|
|
28
28
|
const files = await fastGlob(pattern, opts)
|
|
29
29
|
for (const f of files) {
|
|
@@ -27,7 +27,7 @@ import fs from 'fs-extra'
|
|
|
27
27
|
* @returns
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
async function importPkg (...pkg) {
|
|
31
31
|
const result = {}
|
|
32
32
|
let opts = { returnDefault: true, thrownNotFound: false }
|
|
33
33
|
if (isPlainObject(last(pkg))) {
|
|
@@ -44,7 +44,7 @@ const importPkg = async (...pkg) => {
|
|
|
44
44
|
name = orgName
|
|
45
45
|
}
|
|
46
46
|
if (isEmpty(name)) name = orgName
|
|
47
|
-
const dir = getModuleDir(orgName, ns)
|
|
47
|
+
const dir = getModuleDir.call(this, orgName, ns)
|
|
48
48
|
const pkg = readJson(`${dir}/package.json`, opts.thrownNotFound)
|
|
49
49
|
const mainFileOrg = dir + '/' + (pkg.main ?? get(pkg, 'exports.default', 'index.js'))
|
|
50
50
|
let mainFile = resolvePath(mainFileOrg, os.platform() === 'win32')
|