Skip to content

Commit c55d58e

Browse files
committed
refactor: add a warning for more unsupported runtimes
1 parent 0c0a5b6 commit c55d58e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": ["airbnb-base", "plugin:redos/recommended"],
33
"globals": {
4-
"globalThis": true
4+
"globalThis": true,
5+
"navigator": true
56
},
67
"rules": {
78
"no-empty": ["error", { "allowEmptyCatch": true }],

lib/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
// eslint-disable-next-line import/order
33
import * as attention from './helpers/attention.js';
44

5+
const deno = typeof Deno !== 'undefined';
6+
const bun = typeof Bun !== 'undefined';
7+
const workerd = navigator.userAgent === 'Cloudflare-Workers';
8+
59
const minimal = 'Jod';
6-
const { lts: codename } = process.release || {};
7-
if (!codename || codename.charCodeAt(0) < minimal.charCodeAt(0) || typeof Bun !== 'undefined' || typeof Deno !== 'undefined') {
10+
const release = globalThis.process?.release;
11+
if (!release?.lts || release?.lts.charCodeAt(0) < minimal.charCodeAt(0) || deno || bun || workerd) {
812
attention.warn('Unsupported runtime. Use Node.js v22.x LTS, or a later LTS release.');
913
}
1014

0 commit comments

Comments
 (0)