Skip to content

Commit

Permalink
Version 1.2.6
Browse files Browse the repository at this point in the history
PR-URL: #110
  • Loading branch information
tshemsedinov committed Jul 31, 2023
1 parent d0f7cd7 commit 41c30a2
Show file tree
Hide file tree
Showing 6 changed files with 1,549 additions and 329 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## [Unreleased][unreleased]

## [1.2.6][] - 2023-07-31

- Classes added to COMMON_CONTEXT: AbortController, Event, EventTarget,
MessageChannel, MessageEvent, MessagePort
- Added NODE_CONTEXT with: global, console, process and everything from
COMMON_CONTEXT

## [1.2.5][] - 2023-04-29

- Drop node.js 14 support, add node.js 20
Expand Down Expand Up @@ -74,7 +81,8 @@ First metavm implementation with following features
- Contexts, use default empty and frozen, emulated or pass one
- Use `microtaskMode` https://github.com/nodejs/node/pull/34023

[unreleased]: https://github.com/metarhia/metavm/compare/v1.2.5...HEAD
[unreleased]: https://github.com/metarhia/metavm/compare/v1.2.6...HEAD
[1.2.6]: https://github.com/metarhia/metavm/compare/v1.2.5...v1.2.6
[1.2.5]: https://github.com/metarhia/metavm/compare/v1.2.4...v1.2.5
[1.2.4]: https://github.com/metarhia/metavm/compare/v1.2.3...v1.2.4
[1.2.3]: https://github.com/metarhia/metavm/compare/v1.2.2...v1.2.3
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2022 Metarhia contributors
Copyright (c) 2020-2023 Metarhia contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
53 changes: 31 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ const metavm = require('metavm');
const src = `({ field: 'value' });`;
const ms = metavm.createScript('Example', src);
console.log(ms);
```

Output:

// Output:
// MetaScript {
// name: 'Example',
// script: Script {},
// context: {},
// exports: { field: 'value' }
// }
```js
MetaScript {
name: 'Example',
script: Script {},
context: {},
exports: { field: 'value' }
}
```

Script contains function expression. You can use it for api endpoints, domain
Expand All @@ -37,14 +40,17 @@ const metavm = require('metavm');
const src = `(a, b) => a + b;`;
const ms = metavm.createScript('Example', src);
console.log(ms);
```

Output:

// Output:
// MetaScript {
// name: 'Example',
// script: Script {},
// context: {},
// exports: [Function]
// }
```js
MetaScript {
name: 'Example',
script: Script {},
context: {},
exports: [Function]
}
```

## Read script from file
Expand All @@ -56,18 +62,21 @@ const metavm = require('.');
const ms = await metavm.readScript('./test/examples/simple.js');
console.log(ms);
})();
```

// Output:
// MetaScript {
// name: 'simple',
// script: Script {},
// context: {},
// exports: { field: 'value', add: [Function: add], sub: [Function: sub] }
// }
Output:

```
MetaScript {
name: 'simple',
script: Script {},
context: {},
exports: { field: 'value', add: [Function: add], sub: [Function: sub] }
}
```

## License & Contributors

Copyright (c) 2020-2022 [Metarhia contributors](https://github.com/metarhia/metavm/graphs/contributors).
Copyright (c) 2020-2023 [Metarhia contributors](https://github.com/metarhia/metavm/graphs/contributors).
Metavm is [MIT licensed](./LICENSE).\
Metavm is a part of [Metarhia](https://github.com/metarhia) technology stack.
1 change: 1 addition & 0 deletions metavm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Context, Script, ScriptOptions, BaseOptions } from 'node:vm';

export const EMPTY_CONTEXT: Context;
export const COMMON_CONTEXT: Context;
export const NODE_CONTEXT: Context;

export class MetavmError extends Error {}

Expand Down
Loading

0 comments on commit 41c30a2

Please sign in to comment.