From 8f384170af909461afe9f97827779e9aeed72bf4 Mon Sep 17 00:00:00 2001 From: Kyle Herock Date: Sun, 27 Mar 2022 22:30:51 -0400 Subject: [PATCH] Bump minimum required version to Node 14.8 --- .github/workflows/nodejs.yml | 37 ++++++++++++++++++------------------ lib/index.js | 17 ++--------------- lib/loaders/resolve.mjs | 12 ------------ package.json | 2 +- test/spawn/esmodule.js | 4 ---- 5 files changed, 21 insertions(+), 51 deletions(-) delete mode 100644 lib/loaders/resolve.mjs diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index d9dc452..712c426 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -2,40 +2,39 @@ name: Node.js CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build_ubuntu: - runs-on: ubuntu-latest strategy: matrix: - node-version: ["12.10", "12.16", "12.x", "14.x", "16.x", "17.x"] + node-version: ["14.x", "16.x", "17.x"] steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm i - - run: npm test + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm i + - run: npm test build_windows: runs-on: windows-latest strategy: matrix: - node-version: ["12.10", "12.16", "12.x", "14.x", "16.x", "17.x"] + node-version: ["14.x", "16.x", "17.x"] steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm i - - run: npm test + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm i + - run: npm test diff --git a/lib/index.js b/lib/index.js index d8b024e..0972487 100644 --- a/lib/index.js +++ b/lib/index.js @@ -99,23 +99,10 @@ export default function ( if (patchFork) execArgv.push(`--require=${resolveHook('patch-fork')}`); if (patchVm) execArgv.push(`--require=${resolveHook('patch-vm')}`); - if (semver.satisfies(process.version, '<12.17.0')) { - execArgv.push('--experimental-modules'); - } - - const loaderName = semver.satisfies(process.version, '>=16.12.0') - ? 'load' - : semver.satisfies(process.version, '>=12.11.1') - ? 'get-format' - : 'resolve'; + const loaderName = semver.satisfies(process.version, '>=16.12.0') ? 'load' : 'get-format'; const loaderURL = new URL(`./loaders/${loaderName}.mjs`, import.meta.url); - - const experimentalPrefix = semver.satisfies(process.version, '>=12.11.1') - ? 'experimental-' - : ''; - - execArgv.push(`--${experimentalPrefix}loader=${loaderURL.href}`); + execArgv.push(`--experimental-loader=${loaderURL.href}`); child = fork(script, scriptArgs, { cwd: process.cwd(), diff --git a/lib/loaders/resolve.mjs b/lib/loaders/resolve.mjs deleted file mode 100644 index 4d85e24..0000000 --- a/lib/loaders/resolve.mjs +++ /dev/null @@ -1,12 +0,0 @@ -import { fileURLToPath } from 'url'; -import { send } from '../ipc.cjs'; - -export function resolve(specifier, parentModule, defaultResolve) { - const resolved = defaultResolve(specifier, parentModule); - const { url } = resolved; - const required = url.startsWith('file://') ? fileURLToPath(url) : url; - - if (parentModule) send({ required }); - - return resolved; -} diff --git a/package.json b/package.json index f174ab0..d3fbd91 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "lib/" ], "engines": { - "node": ">=12.17" + "node": ">=14.8.0" }, "scripts": { "lint": "eslint lib test bin", diff --git a/test/spawn/esmodule.js b/test/spawn/esmodule.js index b38b8a2..ae122e1 100644 --- a/test/spawn/esmodule.js +++ b/test/spawn/esmodule.js @@ -1,12 +1,8 @@ -import semver from 'semver'; import tap from 'tap'; import { spawn, touchFile } from '../utils.js'; tap.test('Supports ECMAScript modules with experimental-specifier-resolution', t => { - if (semver.satisfies(process.version, '<12.17')) - return t.skip('experimental-specifier-resolution requires node >= 12.17'); - spawn('--experimental-specifier-resolution=node resolution.mjs', out => { if (out.match(/touch message.js/)) { touchFile('message.js');