Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

isolation

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isolation - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

2

lib/context/index.js

@@ -13,3 +13,3 @@ 'use strict';

...contextify.OPTIONS,
preventEscape: mode ? 'afterEvaluate' : '',
microtaskMode: mode ? 'afterEvaluate' : undefined,
});

@@ -16,0 +16,0 @@ };

@@ -23,3 +23,3 @@ 'use strict';

const READ_OPTS = { withFileTypes: true };
const futher = (max, depth) => max === true || (typeof max === 'number' && depth + 1 <= max);
const further = (max, depth) => max === true || (typeof max === 'number' && depth + 1 <= max);
function dir(src, options = {}) {

@@ -36,3 +36,3 @@ const { depth: max = true, flat = false, access } = options;

var isDir = f.isDirectory(), name = f.name, path = join(src, name);
if ((isDir && !futher(max, depth)) || !isAllow(path)) return;
if ((isDir && !further(max, depth)) || !isAllow(path)) return;
if (isDir && flat) return void await pull(path, depth + 1);

@@ -39,0 +39,0 @@ var ext = extname(name), key = base(name, ext.match(JS_EXT) ? ext : '');

{
"license": "MIT",
"version": "2.0.0",
"version": "2.1.0",
"type": "commonjs",

@@ -50,11 +50,11 @@ "name": "isolation",

"devDependencies": {
"@types/node": "^20.10.4",
"eslint": "^8.55.0",
"eslint-config-astrohelm": "^1.2.0",
"@types/node": "^20.11.28",
"eslint": "^8.57.0",
"eslint-config-astrohelm": "^1.3.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"typescript": "^5.4.2"
}
}

@@ -13,3 +13,3 @@ <h1 align="center">

>
> ## **Possible usecase**
> ## **Possible use case**
>

@@ -153,3 +153,3 @@ > May be useful as routing loader, if some loaded route makes an error while runtime, you may

>
> Remember to reuse your contexts. This will encrease performance of your application. To help you
> Remember to reuse your contexts. This will increase performance of your application. To help you
> with this we have default contexts:

@@ -285,15 +285,15 @@

| Option | Possible | Default | Description |
| ---------------- | ---------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **type** | iso&nbsp;\|&nbsp;cjs | cjs | Type&nbsp;of&nbsp;script&nbsp;handling, see [syntax types](#module-types) |
| **ctx** | object | - | Realm&nbsp;context, see [Context API](#context-api) |
| **filename** | string | ISO | Name&nbsp;of&nbsp;the&nbsp;module&nbsp;, also it is global variable **\_\_filename** for root realm |
| **dir** | string | process.cwd() | Module&nbsp;directory&nbsp;, also it is global varibale **\_\_dirname** and realm require startpoint |
| **npmIsolation** | boolean | false | Controls&nbsp;npm&nbsp;modules&nbsp;isolation |
| **access** | [Access](./types/options.d.ts#L51) | - | Isolation&nbsp;restrictions, see [Access API](#reader-api) |
| **prepare** | boolean | false | Reader&nbsp;would'nt&nbsp;execute script for you |
| **flat** | boolean | false | Reader&nbsp;will&nbsp;flat&nbsp;nested&nbsp;scripts |
| **depth** | boolean&nbsp;\|&nbsp;number | true | Restricts&nbsp;dir&nbsp;reading&nbsp;depth |
| **script** | [ScriptOptions](./types/options.d.ts#L63) | - | Configuration&nbsp;for VM.Script initialization |
| **run** | [RunningCodeOptions](./types/options.d.ts#L62) | {&nbsp;timeout:&nbsp;1000&nbsp;} | Configuration&nbsp;for VM.Script execution |
| Option | Possible | Default | Description |
| ---------------- | ---------------------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **type** | iso&nbsp;\|&nbsp;cjs | cjs | Type&nbsp;of&nbsp;script&nbsp;handling, see [syntax types](#module-types) |
| **ctx** | object | - | Realm&nbsp;context, see [Context API](#context-api) |
| **filename** | string | ISO | Name&nbsp;of&nbsp;the&nbsp;module&nbsp;, also it is global variable **\_\_filename** for root realm |
| **dir** | string | process.cwd() | Module&nbsp;directory&nbsp;, also it is global variable **\_\_dirname** and realm require start point |
| **npmIsolation** | boolean | false | Controls&nbsp;npm&nbsp;modules&nbsp;isolation |
| **access** | [Access](./types/options.d.ts#L51) | - | Isolation&nbsp;restrictions, see [Access API](#reader-api) |
| **prepare** | boolean | false | Reader&nbsp;would'nt&nbsp;execute script for you |
| **flat** | boolean | false | Reader&nbsp;will&nbsp;flat&nbsp;nested&nbsp;scripts |
| **depth** | boolean&nbsp;\|&nbsp;number | true | Restricts&nbsp;dir&nbsp;reading&nbsp;depth |
| **script** | [ScriptOptions](./types/options.d.ts#L63) | - | Configuration&nbsp;for VM.Script initialization |
| **run** | [RunningCodeOptions](./types/options.d.ts#L62) | {&nbsp;timeout:&nbsp;1000&nbsp;} | Configuration&nbsp;for VM.Script execution |

@@ -300,0 +300,0 @@ <h2 align="center">Copyright & contributors</h2>

@@ -63,3 +63,3 @@ import type { Context, Script as TScript, ScriptOptions, BaseOptions } from 'node:vm';

* @example <caption>Skip init process</caption>
* console.log(Isolation.execute(`module.exporst = (a, b) => a + b;`)(2 + 2)); // Output: 4
* console.log(Isolation.execute(`module.exports = (a, b) => a + b;`)(2 + 2)); // Output: 4
* Isolation.execute(`async (a, b) => a + b;`, { type: 'iso' })(2 + 2).then(console.log); // Output: 4

@@ -66,0 +66,0 @@ */

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc