Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for node < v18 #677

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
293 changes: 149 additions & 144 deletions .eslintrc

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'npm'

- name: Install
Expand All @@ -39,10 +39,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
cache: 'npm'

- name: Install
Expand All @@ -57,11 +57,11 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [10, 12]
node-version: [18, 20]
os: [ubuntu-latest, windows-latest]
include:
- coverage: true
node-version: 16
node-version: latest
os: ubuntu-latest

steps:
Expand All @@ -85,7 +85,7 @@ jobs:

- if: ${{ matrix.coverage }}
name: Upload coverage
run: npm run codecov -- -c -Z -f .coverage/coverage-final.json -F unit
run: npm run codecov -- -c -Z -f .coverage/coverage-final.json -F unit -t ${{ secrets.CODECOV_TOKEN }}

- name: Run integration tests
run: npm run test-integration
11 changes: 11 additions & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
unreleased:
breaking changes:
- GH-677 Dropped support for Node < v18
new features:
- >-
GH-676 Updated allowed globals list to include:
URL, Encoding, Cryptographic, and Stream APIs
chores:
- GH-677 Updated ESLint rules
- GH-677 Updated dependencies

2.2.0:
date: 2024-03-13
new features:
Expand Down
77 changes: 66 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,80 @@ myscope.exec('setTimeout(function () { __exitscope(null); }, 1000)', { async: tr

These are the list of globals available to scripts in the scope

### Standard Built-ins:

```json
[
"Array", "ArrayBuffer", "Atomics",
"BigInt", "BigInt64Array", "BigUint64Array",
"Boolean", "DataView", "Date",
"Error", "EvalError", "Float32Array",
"Float64Array", "Function", "Infinity",
"Int16Array", "Int32Array", "Int8Array",
"BigInt", "Boolean", "DataView",
"Date", "Function", "Infinity",
"JSON", "Map", "Math",
"NaN", "Number", "Object",
"Promise", "Proxy", "RangeError",
"ReferenceError", "Reflect", "RegExp",
"Set", "SharedArrayBuffer", "String",
"Symbol", "SyntaxError", "TypeError",
"URIError", "Uint16Array", "Uint32Array",
"Uint8Array", "Uint8ClampedArray", "WeakMap",
"Promise", "Proxy", "Reflect",
"RegExp", "Set", "SharedArrayBuffer",
"String", "Symbol", "WeakMap",
"WeakSet", "decodeURI", "decodeURIComponent",
"encodeURI", "encodeURIComponent", "escape",
"isFinite", "isNaN", "parseFloat",
"parseInt", "undefined", "unescape"
]
```
### Errors:

```json
[
"Error", "EvalError", "RangeError",
"ReferenceError", "SyntaxError", "TypeError",
"URIError"
]
```

### Typed Arrays:

```json
[
"BigInt64Array", "BigUint64Array", "Float32Array",
"Float64Array", "Int16Array", "Int32Array",
"Int8Array", "Uint16Array", "Uint32Array",
"Uint8Array", "Uint8ClampedArray"
]
```

### URL:

```json
[
"URL", "URLSearchParams"
]
```

### Encoding:
```json
[
"atob", "btoa",
"TextDecoder", "TextDecoderStream",
"TextEncoder", "TextEncoderStream"
]
```

### Cryptography:
```json
[
"Crypto", "CryptoKey",
"crypto", "SubtleCrypto"
]
```

### Stream:
```json
[
"ByteLengthQueuingStrategy", "CountQueuingStrategy",
"CompressionStream", "DecompressionStream",
"ReadableByteStreamController", "ReadableStream",
"ReadableStreamBYOBReader", "ReadableStreamBYOBRequest",
"ReadableStreamDefaultController", "ReadableStreamDefaultReader",
"TransformStream", "TransformStreamDefaultController",
"WritableStream", "WritableStreamDefaultController",
"WritableStreamDefaultWriter"
]
```
67 changes: 48 additions & 19 deletions lib/allowed-globals.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
/* eslint-disable no-multi-spaces */
/* eslint-disable one-var */
/* eslint-disable @stylistic/js/no-multi-spaces */

/**
* Add variables here that will be available as globals inside the scope during execution.
*
* @const
* @type {String[]}
*/
module.exports = [
'Array', 'ArrayBuffer', 'Atomics',
'BigInt', 'BigInt64Array', 'BigUint64Array',
'Boolean', 'DataView', 'Date',
'Error', 'EvalError', 'Float32Array',
'Float64Array', 'Function', 'Infinity',
'Int16Array', 'Int32Array', 'Int8Array',
'JSON', 'Map', 'Math',
'NaN', 'Number', 'Object',
'Promise', 'Proxy', 'RangeError',
'ReferenceError', 'Reflect', 'RegExp',
'Set', 'SharedArrayBuffer', 'String',
'Symbol', 'SyntaxError', 'TypeError',
'URIError', 'Uint16Array', 'Uint32Array',
'Uint8Array', 'Uint8ClampedArray', 'WeakMap',
'WeakSet', 'decodeURI', 'decodeURIComponent',
'encodeURI', 'encodeURIComponent', 'escape',
'isFinite', 'isNaN', 'parseFloat',
'parseInt', 'undefined', 'unescape'
'Array', 'ArrayBuffer', 'Atomics',
'BigInt', 'Boolean', 'DataView',
'Date', 'Function', 'Infinity',
'JSON', 'Map', 'Math',
'NaN', 'Number', 'Object',
'Promise', 'Proxy', 'Reflect',
'RegExp', 'Set', 'SharedArrayBuffer',
'String', 'Symbol', 'WeakMap',
'WeakSet', 'decodeURI', 'decodeURIComponent',
'encodeURI', 'encodeURIComponent', 'escape',
'isFinite', 'isNaN', 'parseFloat',
'parseInt', 'undefined', 'unescape',

// Error
'Error', 'EvalError', 'RangeError',
'ReferenceError', 'SyntaxError', 'TypeError',
'URIError',

// Typed Arrays
'BigInt64Array', 'BigUint64Array', 'Float32Array',
'Float64Array', 'Int16Array', 'Int32Array',
'Int8Array', 'Uint16Array', 'Uint32Array',
'Uint8Array', 'Uint8ClampedArray',

// URL
'URL', 'URLSearchParams',

// Encoding
'atob', 'btoa',
'TextDecoder', 'TextDecoderStream',
'TextEncoder', 'TextEncoderStream',

// Cryptography
'Crypto', 'CryptoKey',
'crypto', 'SubtleCrypto',

// Stream
'ByteLengthQueuingStrategy', 'CountQueuingStrategy',
'CompressionStream', 'DecompressionStream',
'ReadableByteStreamController', 'ReadableStream',
'ReadableStreamBYOBReader', 'ReadableStreamBYOBRequest',
'ReadableStreamDefaultController', 'ReadableStreamDefaultReader',
'TransformStream', 'TransformStreamDefaultController',
'WritableStream', 'WritableStreamDefaultController',
'WritableStreamDefaultWriter'
];
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
has (source, target) {
return Object.prototype.hasOwnProperty.call(source, target);
return Object.hasOwn(source, target);
},

isObject (subject) {
Expand Down
Loading
Loading