diff --git a/config/babel.config.js b/config/babel.config.js deleted file mode 100644 index 3d82cc23..00000000 --- a/config/babel.config.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = { - overrides: [ - { - test: /\.js$/, - plugins: [ - '@babel/plugin-transform-class-properties', - '@babel/plugin-transform-nullish-coalescing-operator' - ] - }, - { - test: /\.ts$/, - plugins: [ - ['@babel/plugin-transform-typescript', { allowDeclareFields: true }], - '@babel/plugin-transform-class-properties', - '@babel/plugin-transform-nullish-coalescing-operator' - ] - } - ] -} - -if (process.env.NODE_ENV === 'test') - module.exports.presets = [['@babel/env', { targets: { node: 'current' } }]] diff --git a/config/jest.config.js b/config/jest.config.js index 39b16c48..a63616c1 100644 --- a/config/jest.config.js +++ b/config/jest.config.js @@ -1,9 +1,22 @@ let moduleNameMapper + +const babel = [ + 'babel-jest', + { + overrides: [ + { + test: '**/*.ts', + plugins: [ + ['@babel/plugin-transform-typescript', { allowDeclareFields: true }] + ] + } + ], + presets: [['@babel/env', { targets: { node: 'current' } }]] + } +] + const transform = { - '[/\\\\]tests[/\\\\].*\\.(m?js|ts)$': [ - 'babel-jest', - { configFile: './config/babel.config.js' } - ] + '[/\\\\]tests[/\\\\].*\\.(m?js|ts)$': babel } // The npm script name is significant. @@ -16,10 +29,7 @@ switch (process.env.npm_lifecycle_event) { '^yaml/util$': '/dist/util.js', '^../src/test-events$': '/dist/test-events.js' } - transform['[/\\\\]dist[/\\\\].*\\.mjs$'] = [ - 'babel-jest', - { configFile: './config/babel.config.js' } - ] + transform['[/\\\\]dist[/\\\\].*\\.mjs$'] = babel break case 'test': @@ -30,10 +40,7 @@ switch (process.env.npm_lifecycle_event) { '^yaml/cli$': '/src/cli.ts', '^yaml/util$': '/src/util.ts' } - transform['[/\\\\]src[/\\\\].*\\.ts$'] = [ - 'babel-jest', - { configFile: './config/babel.config.js' } - ] + transform['[/\\\\]src[/\\\\].*\\.ts$'] = babel } module.exports = { diff --git a/config/rollup.browser-config.mjs b/config/rollup.browser-config.mjs index 0928bea0..b4824d4b 100644 --- a/config/rollup.browser-config.mjs +++ b/config/rollup.browser-config.mjs @@ -16,7 +16,6 @@ export default { }), babel({ babelHelpers: 'bundled', - configFile: './config/babel.config.js', presets: [['@babel/env', { modules: false }]] }), typescript({ declaration: false, outDir: 'browser/dist' }) diff --git a/package-lock.json b/package-lock.json index 67f07f4b..3c3d47c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,8 +13,6 @@ }, "devDependencies": { "@babel/core": "^7.12.10", - "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", "@babel/plugin-transform-typescript": "^7.12.17", "@babel/preset-env": "^7.12.11", "@eslint/js": "^9.9.1", diff --git a/package.json b/package.json index cb6bd59c..52820225 100644 --- a/package.json +++ b/package.json @@ -69,8 +69,6 @@ }, "devDependencies": { "@babel/core": "^7.12.10", - "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", "@babel/plugin-transform-typescript": "^7.12.17", "@babel/preset-env": "^7.12.11", "@eslint/js": "^9.9.1",