@jcoreio/toolchain-esnext 5.8.4 → 5.8.6
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 +2 -2
- package/plugins/compile.cjs +24 -0
- package/util/resolveImportSource.cjs +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcoreio/toolchain-esnext",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.6",
|
|
4
4
|
"description": "ESNext JS build toolchain",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"resolve": "^1.22.2",
|
|
34
34
|
"resolve-bin": "^1.0.0",
|
|
35
35
|
"semver": "^7.5.3",
|
|
36
|
-
"@jcoreio/toolchain": "5.8.
|
|
36
|
+
"@jcoreio/toolchain": "5.8.6"
|
|
37
37
|
},
|
|
38
38
|
"toolchainManaged": {
|
|
39
39
|
"dependencies": {
|
package/plugins/compile.cjs
CHANGED
|
@@ -48,6 +48,18 @@ module.exports = [
|
|
|
48
48
|
'--ignore',
|
|
49
49
|
pattern,
|
|
50
50
|
]),
|
|
51
|
+
// ignore any .js/.ts files for which there's an alternate .cjs/.cts file
|
|
52
|
+
...(extension.startsWith('.c') ?
|
|
53
|
+
[]
|
|
54
|
+
: (
|
|
55
|
+
await glob(
|
|
56
|
+
`src/**/*${extension.replace('.', '.c')}`,
|
|
57
|
+
buildGlobOpts
|
|
58
|
+
)
|
|
59
|
+
).flatMap((file) => [
|
|
60
|
+
'--ignore',
|
|
61
|
+
file.replace(/\.c([jt]sx?)$/i, '.$1'),
|
|
62
|
+
])),
|
|
51
63
|
'--out-dir',
|
|
52
64
|
'dist',
|
|
53
65
|
'--out-file-extension',
|
|
@@ -96,6 +108,18 @@ module.exports = [
|
|
|
96
108
|
'--ignore',
|
|
97
109
|
pattern,
|
|
98
110
|
]),
|
|
111
|
+
// ignore any .js/.ts files for which there's an alternate .mjs/.mts file
|
|
112
|
+
...(extension.startsWith('.m') ?
|
|
113
|
+
[]
|
|
114
|
+
: (
|
|
115
|
+
await glob(
|
|
116
|
+
`src/**/*${extension.replace('.', '.m')}`,
|
|
117
|
+
buildGlobOpts
|
|
118
|
+
)
|
|
119
|
+
).flatMap((file) => [
|
|
120
|
+
'--ignore',
|
|
121
|
+
file.replace(/\.m([jt]sx?)$/i, '.$1'),
|
|
122
|
+
])),
|
|
99
123
|
'--out-dir',
|
|
100
124
|
'dist',
|
|
101
125
|
'--out-file-extension',
|
|
@@ -15,7 +15,7 @@ module.exports = function resolveImportSource({
|
|
|
15
15
|
if (altTypeResolved) return altTypeResolved
|
|
16
16
|
|
|
17
17
|
if (
|
|
18
|
-
/(\.d\.ts|\.[cm]?jsx?)$/i.test(source) ||
|
|
18
|
+
/(\.d\.[cm]?ts|\.[cm]?jsx?)$/i.test(source) ||
|
|
19
19
|
source.startsWith('node:') ||
|
|
20
20
|
builtinModules.has(source)
|
|
21
21
|
) {
|
|
@@ -24,7 +24,7 @@ module.exports = function resolveImportSource({
|
|
|
24
24
|
|
|
25
25
|
if (source.startsWith('.')) {
|
|
26
26
|
if (/\.[cm]?tsx?$/i.test(source) && /\.d\.[cm]?ts$/i.test(file)) {
|
|
27
|
-
source = source.replace(/\.[
|
|
27
|
+
source = source.replace(/\.[^.\\/]+$/, '')
|
|
28
28
|
}
|
|
29
29
|
const resolved = resolve(source, {
|
|
30
30
|
basedir,
|
|
@@ -46,7 +46,9 @@ module.exports = function resolveImportSource({
|
|
|
46
46
|
],
|
|
47
47
|
})
|
|
48
48
|
let result = path.relative(basedir, resolved)
|
|
49
|
-
if (outputExtension)
|
|
49
|
+
if (outputExtension) {
|
|
50
|
+
result = result.replace(/((\.d)?\.[^.\\/]+)?$/, outputExtension)
|
|
51
|
+
}
|
|
50
52
|
return result.startsWith('.') ? result : `./${result}`
|
|
51
53
|
}
|
|
52
54
|
const match = /^((?:@[^/]+\/)?[^/]+)(?:\/(.+))?$/.exec(source)
|