diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eae341b..d6d41ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,3 +48,26 @@ jobs: - run: pnpm install - run: pnpm tsc - run: pnpm test + + babel-8: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + - name: Use Node.js 24 + uses: actions/setup-node@v3 + with: + node-version: 24 + cache: pnpm + - run: pnpm install + - run: pnpm tsc + # Babel 8 is ESM-only. Jest 30 loads it with require(esm) when vm modules are on. + - run: pnpm add --save-dev --ignore-scripts @babel/core@^8.0.0 @babel/preset-env@^8.0.0 jest@^30.0.0 + - run: pnpm test + env: + NODE_OPTIONS: --experimental-vm-modules diff --git a/package.json b/package.json index 5893140..b12003e 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "typescript": "^5.4.5" }, "peerDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.0.0 || ^8.0.0" }, "engines": { "node": ">=16" diff --git a/tests/create-tests.ts b/tests/create-tests.ts index 51e915a..e5e38c1 100644 --- a/tests/create-tests.ts +++ b/tests/create-tests.ts @@ -1,7 +1,7 @@ import DebugToolsPlugin from '../src/index.js'; import fs from 'fs'; import 'code-equality-assertions/jest'; -import { type TransformOptions, transform } from '@babel/core'; +import { type TransformOptions, transformSync } from '@babel/core'; import * as Babel from '@babel/core'; import { types as t } from '@babel/core'; import { UserOptions } from '../src/utils/normalize-options.js'; @@ -11,7 +11,7 @@ const CONSOLE = Object.assign({}, console); export interface Options { presets: TransformOptions['presets']; babelVersion: 7; - transform: typeof transform; + transform: typeof transformSync; } export default function createTests(options: Options) { diff --git a/tests/debug-tools-babel7-test.ts b/tests/debug-tools-babel7-test.ts index 03a3964..83c68e1 100644 --- a/tests/debug-tools-babel7-test.ts +++ b/tests/debug-tools-babel7-test.ts @@ -1,5 +1,5 @@ import createTests from './create-tests.js'; -import { transform } from '@babel/core'; +import { transformSync as transform } from '@babel/core'; const presets = [ [