From 57248a9890d3f32d784faeb275f1ea05bf19ebe7 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Fri, 7 Jul 2023 14:12:34 -0400 Subject: [PATCH] feat(NODE-5415)!: bump minimum Node.js version to v16.20.1 --- .evergreen/config.yml | 10 ---------- .evergreen/install-dependencies.sh | 2 +- package-lock.json | 2 +- package.json | 2 +- rollup.config.mjs | 4 ++-- test/load_bson.js | 8 ++------ tsconfig.json | 4 ++-- 7 files changed, 9 insertions(+), 23 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 63888967..d602f68b 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -95,16 +95,6 @@ functions: - .evergreen/run-bundling-test.sh tasks: - - name: node-tests-v14 - tags: ["node"] - commands: - - func: fetch source - vars: - NODE_LTS_VERSION: 14 - - func: install dependencies - - func: run tests - vars: - TEST_TARGET: node - name: node-tests-v16 tags: ["node"] commands: diff --git a/.evergreen/install-dependencies.sh b/.evergreen/install-dependencies.sh index 152a4aa5..cfdc2d55 100755 --- a/.evergreen/install-dependencies.sh +++ b/.evergreen/install-dependencies.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -o errexit # Exit the script with error if any of the commands fail -NODE_LTS_VERSION=${NODE_LTS_VERSION:-14} +NODE_LTS_VERSION=${NODE_LTS_VERSION:-16} source "${PROJECT_DIRECTORY}/.evergreen/init-node-and-npm-env.sh" diff --git a/package-lock.json b/package-lock.json index 8b4eaf5d..c3dff4ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "v8-profiler-next": "^1.9.0" }, "engines": { - "node": ">=14.20.1" + "node": ">=16.20.1" } }, "etc/eslint/no-bigint-usage": { diff --git a/package.json b/package.json index ae1d8b00..4c28acde 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "require": "./lib/bson.cjs" }, "engines": { - "node": ">=14.20.1" + "node": ">=16.20.1" }, "scripts": { "pretest": "npm run build", diff --git a/rollup.config.mjs b/rollup.config.mjs index 8da8eb9e..b44e4cd7 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -9,11 +9,11 @@ const tsConfig = { checkJs: false, strict: true, alwaysStrict: true, - target: 'es2020', + target: 'es2021', module: 'esnext', moduleResolution: 'node', removeComments: true, - lib: ['es2020'], + lib: ['es2021'], importHelpers: false, noEmitHelpers: false, noEmitOnError: true, diff --git a/test/load_bson.js b/test/load_bson.js index c35b34a0..6951d346 100644 --- a/test/load_bson.js +++ b/test/load_bson.js @@ -5,15 +5,11 @@ const fs = require('node:fs'); const path = require('node:path'); const crypto = require('node:crypto'); -// TODO(NODE-4787): Node.js 16 was when the atob and btoa globals were introduced, so we need replacements for testing on 14 -const shim_btoa = input => Buffer.prototype.toString.call(Buffer.from(input), 'base64'); -const shim_atob = input => Buffer.from(input, 'base64').toString('binary'); - const commonGlobals = { TextEncoder, TextDecoder, - btoa: typeof btoa !== 'undefined' ? btoa : shim_btoa, - atob: typeof atob !== 'undefined' ? atob : shim_atob, + btoa, + atob, crypto: { getRandomValues(buffer) { const random = crypto.randomBytes(buffer.byteLength); diff --git a/tsconfig.json b/tsconfig.json index 38aa7fd0..b439bf5b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,12 +4,12 @@ "checkJs": false, "strict": true, "alwaysStrict": true, - "target": "es2020", + "target": "es2021", "module": "commonjs", "moduleResolution": "node", "skipLibCheck": true, "lib": [ - "es2020", + "es2021", ], "outDir": "lib", "importHelpers": false,