@jcoreio/toolchain 3.9.1 → 3.9.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain",
3
- "version": "3.9.1",
3
+ "version": "3.9.2",
4
4
  "description": "base JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -6,6 +6,8 @@ module.exports = async function getModules(packageJsonFile) {
6
6
  const cjs = new Set()
7
7
  const esm = new Set()
8
8
 
9
+ const cwd = path.dirname(packageJsonFile)
10
+
9
11
  const {
10
12
  type = 'commonjs',
11
13
  main,
@@ -42,9 +44,10 @@ module.exports = async function getModules(packageJsonFile) {
42
44
  async function checkExport(exp, type) {
43
45
  if (typeof exp === 'string') {
44
46
  if (exp.includes('*')) {
45
- const files = await glob(exp.replace('*', '**'), {
46
- cwd: path.dirname(packageJsonFile),
47
- })
47
+ const files = [
48
+ ...(await glob(exp, { cwd })),
49
+ ...(await glob(exp.replace(/\/?\*/g, '/**/*'), { cwd })),
50
+ ]
48
51
  for (const file of files) checkFile(file, type)
49
52
  } else {
50
53
  checkFile(exp, type)
@@ -66,7 +69,10 @@ module.exports = async function getModules(packageJsonFile) {
66
69
 
67
70
  await checkExport(exports)
68
71
 
69
- const resolvePath = (f) => path.resolve(path.dirname(packageJsonFile), f)
72
+ const resolvePath = (f) => path.resolve(cwd, f)
70
73
 
71
- return { cjs: [...cjs].map(resolvePath), esm: [...esm].map(resolvePath) }
74
+ return {
75
+ cjs: [...new Set([...cjs].map(resolvePath))],
76
+ esm: [...new Set([...esm].map(resolvePath))],
77
+ }
72
78
  }