@jcoreio/toolchain-esnext 5.2.0 → 5.3.1
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 +3 -2
- package/plugins/babelPresets.cjs +7 -7
- package/plugins/compile.cjs +9 -9
- package/plugins/getConfigFiles.cjs +4 -5
- package/plugins/getEslintConfigs.cjs +22 -0
- package/util/babelPluginResolveImports.cjs +3 -3
- package/eslint.extends.cjs +0 -9
- package/plugins/getEslintExtends.cjs +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jcoreio/toolchain-esnext",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "ESNext JS build toolchain",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
"dedent-js": "^1.0.1",
|
|
30
30
|
"eslint": "^9.17.0",
|
|
31
31
|
"fs-extra": "^10.0.0",
|
|
32
|
+
"globals": "^16.0.0",
|
|
32
33
|
"resolve": "^1.22.2",
|
|
33
34
|
"resolve-bin": "^1.0.0",
|
|
34
|
-
"@jcoreio/toolchain": "5.
|
|
35
|
+
"@jcoreio/toolchain": "5.3.1"
|
|
35
36
|
},
|
|
36
37
|
"toolchainManaged": {
|
|
37
38
|
"dependencies": {
|
package/plugins/babelPresets.cjs
CHANGED
|
@@ -8,13 +8,13 @@ module.exports = [
|
|
|
8
8
|
[
|
|
9
9
|
require.resolve('@babel/preset-env'),
|
|
10
10
|
{
|
|
11
|
-
...(JCOREIO_TOOLCHAIN_ESM
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
...(JCOREIO_TOOLCHAIN_ESM ?
|
|
12
|
+
toolchainConfig.esmBabelEnv || {
|
|
13
|
+
targets: {
|
|
14
|
+
node: 16,
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
: toolchainConfig.cjsBabelEnv || { forceAllTransforms: true }),
|
|
18
18
|
modules: JCOREIO_TOOLCHAIN_ESM ? false : 'auto',
|
|
19
19
|
},
|
|
20
20
|
],
|
package/plugins/compile.cjs
CHANGED
|
@@ -30,9 +30,9 @@ module.exports = [
|
|
|
30
30
|
'dist',
|
|
31
31
|
'--out-file-extension',
|
|
32
32
|
'.js',
|
|
33
|
-
...(toolchainConfig.sourceMaps
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
...(toolchainConfig.sourceMaps ?
|
|
34
|
+
['--source-maps', toolchainConfig.sourceMaps]
|
|
35
|
+
: []),
|
|
36
36
|
],
|
|
37
37
|
{ env: { ...process.env, JCOREIO_TOOLCHAIN_CJS: '1' } }
|
|
38
38
|
)
|
|
@@ -59,9 +59,9 @@ module.exports = [
|
|
|
59
59
|
'babel',
|
|
60
60
|
[
|
|
61
61
|
'src',
|
|
62
|
-
...(extensions.length
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
...(extensions.length ?
|
|
63
|
+
['--extensions', extensions.join(',')]
|
|
64
|
+
: []),
|
|
65
65
|
...(toolchainConfig.buildIgnore || []).flatMap((pattern) => [
|
|
66
66
|
'--ignore',
|
|
67
67
|
pattern,
|
|
@@ -70,9 +70,9 @@ module.exports = [
|
|
|
70
70
|
'dist',
|
|
71
71
|
'--out-file-extension',
|
|
72
72
|
'.mjs',
|
|
73
|
-
...(toolchainConfig.sourceMaps
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
...(toolchainConfig.sourceMaps ?
|
|
74
|
+
['--source-maps', toolchainConfig.sourceMaps]
|
|
75
|
+
: []),
|
|
76
76
|
],
|
|
77
77
|
{ env: { ...process.env, JCOREIO_TOOLCHAIN_ESM: '1' } }
|
|
78
78
|
)
|
|
@@ -23,11 +23,10 @@ module.exports = [
|
|
|
23
23
|
}outputEsm: false, // disables ESM output (default: true)
|
|
24
24
|
buildIgnore: ${JSON.stringify(await initBuildIgnore(), null, 2)},
|
|
25
25
|
hasTypeScriptSources: ${
|
|
26
|
-
toolchainPackages.includes('@jcoreio/toolchain-typescript')
|
|
27
|
-
?
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
: false
|
|
26
|
+
toolchainPackages.includes('@jcoreio/toolchain-typescript') ?
|
|
27
|
+
fromVersion ? await hasTSSources()
|
|
28
|
+
: !(await hasJSSources())
|
|
29
|
+
: false
|
|
31
30
|
},
|
|
32
31
|
// esWrapper: true, // outputs ES module wrappers for CJS modules (default: false)
|
|
33
32
|
// sourceMaps: false, // default is true (outputs .map files, also accepts 'inline' or 'both')
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const globals = require('globals')
|
|
2
|
+
const { defineConfig } = require('eslint/config')
|
|
3
|
+
const babelParser = require('@babel/eslint-parser')
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
() =>
|
|
7
|
+
defineConfig([
|
|
8
|
+
{
|
|
9
|
+
files: ['**/*.{js,jsx,mjs,mjsx,cjs,cjsx}'],
|
|
10
|
+
languageOptions: {
|
|
11
|
+
parser: babelParser,
|
|
12
|
+
parserOptions: {
|
|
13
|
+
sourceType: 'unambiguous',
|
|
14
|
+
},
|
|
15
|
+
ecmaVersion: 2018,
|
|
16
|
+
globals: {
|
|
17
|
+
...globals.es2018,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
]),
|
|
22
|
+
]
|
|
@@ -26,9 +26,9 @@ module.exports = function babelPluginResolveImports({ types: t }) {
|
|
|
26
26
|
(s) => s.type !== 'ImportSpecifier'
|
|
27
27
|
)
|
|
28
28
|
path.replaceWithMultiple([
|
|
29
|
-
...(nonNamed.length
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
...(nonNamed.length ?
|
|
30
|
+
[t.importDeclaration(nonNamed, t.stringLiteral('lodash'))]
|
|
31
|
+
: []),
|
|
32
32
|
...path.node.specifiers.map((s) =>
|
|
33
33
|
t.importDeclaration(
|
|
34
34
|
[t.importDefaultSpecifier(s.local)],
|
package/eslint.extends.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = [() => [require.resolve('../eslint.extends.cjs')]]
|