@jcoreio/toolchain-esnext 4.8.0 → 4.9.0
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-esnext",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "ESNext JS build toolchain",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"fs-extra": "^10.0.0",
|
|
32
32
|
"resolve": "^1.22.2",
|
|
33
33
|
"resolve-bin": "^1.0.0",
|
|
34
|
-
"@jcoreio/toolchain": "4.
|
|
34
|
+
"@jcoreio/toolchain": "4.9.0"
|
|
35
35
|
},
|
|
36
36
|
"toolchainManaged": {
|
|
37
37
|
"dependencies": {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
const glob = require('@jcoreio/toolchain/util/glob.cjs')
|
|
1
|
+
const { glob } = require('@jcoreio/toolchain/util/glob.cjs')
|
|
2
2
|
const Path = require('path')
|
|
3
3
|
const fs = require('@jcoreio/toolchain/util/projectFs.cjs')
|
|
4
|
+
const buildGlobOpts = require('@jcoreio/toolchain/util/buildGlobOpts.cjs')
|
|
4
5
|
|
|
5
6
|
module.exports = [
|
|
6
7
|
[
|
|
7
8
|
async function buildDistPackageJson(packageJson) {
|
|
8
|
-
const files = await glob(
|
|
9
|
+
const files = await glob(
|
|
10
|
+
Path.join('dist', '**', '*.{js,cjs,mjs,d.ts}'),
|
|
11
|
+
buildGlobOpts
|
|
12
|
+
)
|
|
9
13
|
let usesBabelRuntime = false
|
|
10
14
|
for (const file of files) {
|
|
11
15
|
if ((await fs.readFile(file, 'utf8')).includes('@babel/runtime')) {
|
package/plugins/compile.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const execa = require('@jcoreio/toolchain/util/execa.cjs')
|
|
2
2
|
const fs = require('@jcoreio/toolchain/util/projectFs.cjs')
|
|
3
|
-
const glob = require('@jcoreio/toolchain/util/glob.cjs')
|
|
3
|
+
const { glob } = require('@jcoreio/toolchain/util/glob.cjs')
|
|
4
|
+
const buildGlobOpts = require('@jcoreio/toolchain/util/buildGlobOpts.cjs')
|
|
4
5
|
const path = require('path')
|
|
5
6
|
const dedent = require('dedent-js')
|
|
6
7
|
const {
|
|
@@ -21,6 +22,10 @@ module.exports = [
|
|
|
21
22
|
'src',
|
|
22
23
|
...(extensions.length ? ['--extensions', extensions.join(',')] : []),
|
|
23
24
|
...(extensions.includes('.ts') ? ['--ignore', '**/*.d.ts'] : []),
|
|
25
|
+
...(toolchainConfig.buildIgnore || []).flatMap((pattern) => [
|
|
26
|
+
'--ignore',
|
|
27
|
+
pattern,
|
|
28
|
+
]),
|
|
24
29
|
'--out-dir',
|
|
25
30
|
'dist',
|
|
26
31
|
'--out-file-extension',
|
|
@@ -57,6 +62,10 @@ module.exports = [
|
|
|
57
62
|
...(extensions.length
|
|
58
63
|
? ['--extensions', extensions.join(',')]
|
|
59
64
|
: []),
|
|
65
|
+
...(toolchainConfig.buildIgnore || []).flatMap((pattern) => [
|
|
66
|
+
'--ignore',
|
|
67
|
+
pattern,
|
|
68
|
+
]),
|
|
60
69
|
'--out-dir',
|
|
61
70
|
'dist',
|
|
62
71
|
'--out-file-extension',
|
|
@@ -74,6 +83,7 @@ module.exports = [
|
|
|
74
83
|
for (const ext of ['.js', '.mjs']) {
|
|
75
84
|
if (!extensions.includes(ext)) {
|
|
76
85
|
const srcFiles = await glob(path.join('**', '*' + ext), {
|
|
86
|
+
...buildGlobOpts,
|
|
77
87
|
cwd: path.join(projectDir, 'src'),
|
|
78
88
|
})
|
|
79
89
|
for (const file of srcFiles) {
|
|
@@ -90,7 +100,10 @@ module.exports = [
|
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
if (toolchainConfig.sourceMaps) {
|
|
93
|
-
const srcFiles = await glob(path.join('src', '**'), {
|
|
103
|
+
const srcFiles = await glob(path.join('src', '**'), {
|
|
104
|
+
...buildGlobOpts,
|
|
105
|
+
nodir: true,
|
|
106
|
+
})
|
|
94
107
|
await Promise.all(
|
|
95
108
|
srcFiles.map(async (src) => {
|
|
96
109
|
if (src === 'src') return
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const { name } = require('../package.json')
|
|
2
2
|
const confirmOutputEsm = require('@jcoreio/toolchain/scripts/migrate/confirmOutputEsm.cjs')
|
|
3
3
|
const dedent = require('dedent-js')
|
|
4
|
+
const hasTSSources = require('@jcoreio/toolchain/util/hasTSSources.cjs')
|
|
5
|
+
const initBuildIgnore = require('@jcoreio/toolchain/util/initBuildIgnore.cjs')
|
|
4
6
|
|
|
5
7
|
module.exports = [
|
|
6
8
|
[
|
|
@@ -17,6 +19,8 @@ module.exports = [
|
|
|
17
19
|
${
|
|
18
20
|
outputEsm ? '// ' : ''
|
|
19
21
|
}outputEsm: false, // disables ESM output (default: true)
|
|
22
|
+
buildIgnore: ${JSON.stringify(await initBuildIgnore(), null, 2)},
|
|
23
|
+
hasTypeScriptSources: ${await hasTSSources()},
|
|
20
24
|
// esWrapper: true, // outputs ES module wrappers for CJS modules (default: false)
|
|
21
25
|
// sourceMaps: false, // default is true (outputs .map files, also accepts 'inline' or 'both')
|
|
22
26
|
// scripts: {
|
package/util/fixSourceMaps.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const fs = require('@jcoreio/toolchain/util/projectFs.cjs')
|
|
3
|
-
const glob = require('@jcoreio/toolchain/util/glob.cjs')
|
|
3
|
+
const { glob } = require('@jcoreio/toolchain/util/glob.cjs')
|
|
4
4
|
|
|
5
5
|
module.exports = async function fixSourceMaps() {
|
|
6
6
|
const mapFiles = await glob(
|