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 of options { sandbox } in 3.x #119

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased][unreleased]

- Drop support of options `{ sandbox }` use `{ context }` instead

## [2.2.0][] - 2023-10-27

- Drop node 16 and 19, add node 21 support
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ Use custom context (sandbox) to execute configuration js file in it:
const vm = require('node:vm');
const metautil = require('metautil');
const { Config } = require('metaconfiguration');
const sandbox = { Duration: metautil.duration };
vm.createContext(sandbox);
const options = { sandbox };
const context = { duration: metautil.duration };
vm.createContext(context);
const options = { context };
const config = await new Config('./configDirectory', options);
```

Expand Down
1 change: 0 additions & 1 deletion config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ interface ConfigOptions {
names?: Array<string>;
mode?: string;
context?: vm.Context;
sandbox?: vm.Context;
}

export class Config {
Expand Down
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const fsp = require('node:fs').promises;

class Config {
constructor(dirPath, options = {}) {
const { names, mode, context, sandbox } = options;
const { names, mode, context } = options;
this.sections = {};
this.path = dirPath;
this.names = names || null;
this.mode = mode || '';
this.context = context || sandbox || metavm.createContext();
this.context = context || metavm.createContext();
return this.load();
}

Expand Down