Skip to content

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
appurva21 committed Sep 25, 2024
2 parents f61dd22 + e8cc0e0 commit af620db
Show file tree
Hide file tree
Showing 12 changed files with 7,378 additions and 4,591 deletions.
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
13 changes: 13 additions & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
3.0.0:
date: 2024-09-25
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
- GH-683 Updated allowed globals list to include `Blob`
chores:
- GH-677 Updated ESLint rules
- GH-677 Updated dependencies

2.2.0:
date: 2024-03-13
new features:
Expand Down
84 changes: 73 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,87 @@ 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"
]
```

### File:
```json
[
"Blob"
]
```

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

### Stream:
```json
[
"ByteLengthQueuingStrategy", "CountQueuingStrategy",
"CompressionStream", "DecompressionStream",
"ReadableByteStreamController", "ReadableStream",
"ReadableStreamBYOBReader", "ReadableStreamBYOBRequest",
"ReadableStreamDefaultController", "ReadableStreamDefaultReader",
"TransformStream", "TransformStreamDefaultController",
"WritableStream", "WritableStreamDefaultController",
"WritableStreamDefaultWriter"
]
```
71 changes: 52 additions & 19 deletions lib/allowed-globals.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,60 @@
/* 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',

// File
// TODO: Add `File` class once support for node < v20 is dropped
'Blob',

// 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

0 comments on commit af620db

Please sign in to comment.