Comparing version
@@ -21,3 +21,3 @@ // Generated by CoffeeScript 1.10.0 | ||
'use strict'; | ||
var EXTENSIONS, _prepareRequire, _requireNative, _resolveFilename, fs, global, pa; | ||
var EXTENSIONS, _prepareRequire, _requireNative, _resolveFilename, fs, global, pa, ref; | ||
EXTENSIONS = { | ||
@@ -396,5 +396,7 @@ ".json": function(module, filename) { | ||
} | ||
global.Buffer = _requireNative('buffer').Buffer; | ||
fs = _requireNative('fs'); | ||
pa = _requireNative('path'); | ||
if (vm.options.require && ((ref = vm.options.requireNative) != null ? ref['buffer'] : void 0) === true) { | ||
global.Buffer = _requireNative('buffer').Buffer; | ||
} | ||
fs = parent.require('fs'); | ||
pa = parent.require('path'); | ||
@@ -401,0 +403,0 @@ /* |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"main": "index.js", | ||
@@ -19,0 +19,0 @@ "repository": { |
@@ -37,2 +37,15 @@ # vm2 [](https://david-dm.org/patriksimek/vm2) [](http://badge.fury.io/js/vm2) [](http://travis-ci.org/patriksimek/vm2) | ||
## Documentation | ||
* [1.x to 2.x changes](#1-x-to-2-x-changes) | ||
* [VM](#vm) | ||
* [NodeVM](#nodevm) | ||
* [Calling VM's methods](#calling-vms-methods) | ||
* [CLI](#cli) | ||
* [Known Issues](#known-issues) | ||
## 1.x to 2.x changes | ||
`Buffer` class is no longer globally available by default in NodeVM. To make `Buffer` accessible globaly, enable `require` option and make sure `buffer` module is whitelisted. More info in [Known Issues](#known-issues). | ||
## VM | ||
@@ -133,2 +146,6 @@ | ||
## Known Issues | ||
Allowing `buffer` to be required inside NodeVM may crash your app with `TypeError: Invalid non-string/buffer chunk` errors (reported [here](https://github.com/patriksimek/vm2/issues/22) and [here](https://github.com/patriksimek/vm2/issues/7)). To prevent `buffer` from loading, disable `require` option or remove `buffer` from list of whitelisted native modules. Keep in mind that modules like `fs` or `stream` do require `buffer` internally. | ||
<a name="license" /> | ||
@@ -135,0 +152,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
114357
0.74%161
11.81%19
-5%2378
-0.17%