@jcoreio/toolchain 3.9.0 → 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 +1 -1
- package/util/findUps.cjs +10 -3
- package/util/getModules.cjs +11 -5
package/package.json
CHANGED
package/util/findUps.cjs
CHANGED
|
@@ -72,6 +72,7 @@ const toolchainManaged = (exports.toolchainManaged = {})
|
|
|
72
72
|
for (const toolchainPkgJson of Object.values(toolchainPackageJsons)) {
|
|
73
73
|
const toolchainPkgDeps = toolchainPkgJson.dependencies || {}
|
|
74
74
|
const toolchainPkgDevDeps = toolchainPkgJson.devDependencies || {}
|
|
75
|
+
const toolchainPkgPeerDeps = toolchainPkgJson.peerDependencies || {}
|
|
75
76
|
if (toolchainPkgJson.toolchainManaged) {
|
|
76
77
|
for (const section in toolchainPkgJson.toolchainManaged) {
|
|
77
78
|
if (!toolchainManaged[section]) toolchainManaged[section] = {}
|
|
@@ -79,9 +80,15 @@ for (const toolchainPkgJson of Object.values(toolchainPackageJsons)) {
|
|
|
79
80
|
if (section.endsWith('ependencies')) {
|
|
80
81
|
for (const dep in sectionCfg) {
|
|
81
82
|
let version = sectionCfg[dep]
|
|
82
|
-
if (version === '*')
|
|
83
|
-
version =
|
|
84
|
-
|
|
83
|
+
if (version === '*') {
|
|
84
|
+
version =
|
|
85
|
+
toolchainPkgDevDeps[dep] ||
|
|
86
|
+
toolchainPkgDeps[dep] ||
|
|
87
|
+
toolchainPkgPeerDeps[dep]
|
|
88
|
+
}
|
|
89
|
+
if (version && version !== '*') {
|
|
90
|
+
toolchainManaged[section][dep] = version
|
|
91
|
+
}
|
|
85
92
|
}
|
|
86
93
|
continue
|
|
87
94
|
}
|
package/util/getModules.cjs
CHANGED
|
@@ -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 =
|
|
46
|
-
cwd
|
|
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(
|
|
72
|
+
const resolvePath = (f) => path.resolve(cwd, f)
|
|
70
73
|
|
|
71
|
-
return {
|
|
74
|
+
return {
|
|
75
|
+
cjs: [...new Set([...cjs].map(resolvePath))],
|
|
76
|
+
esm: [...new Set([...esm].map(resolvePath))],
|
|
77
|
+
}
|
|
72
78
|
}
|