Skip to content

Commit

Permalink
Bump minimum required version to Node 14.8
Browse files Browse the repository at this point in the history
  • Loading branch information
kherock committed May 31, 2022
1 parent 1751868 commit 8f38417
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 51 deletions.
37 changes: 18 additions & 19 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 2 additions & 15 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
12 changes: 0 additions & 12 deletions lib/loaders/resolve.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"lib/"
],
"engines": {
"node": ">=12.17"
"node": ">=14.8.0"
},
"scripts": {
"lint": "eslint lib test bin",
Expand Down
4 changes: 0 additions & 4 deletions test/spawn/esmodule.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down

0 comments on commit 8f38417

Please sign in to comment.