degenerator
Advanced tools
Comparing version 2.1.0 to 2.1.1
/// <reference types="node" /> | ||
import { Context } from 'vm'; | ||
import { Context, RunningScriptOptions } from 'vm'; | ||
/** | ||
@@ -18,7 +18,7 @@ * Turns sync JavaScript code into an JavaScript with async Functions. | ||
} | ||
interface CompileOptions extends DegeneratorOptions { | ||
type CompileOptions = DegeneratorOptions & RunningScriptOptions & { | ||
sandbox?: Context; | ||
} | ||
}; | ||
function compile<T>(code: string, returnName: string, names: DegeneratorNames, options?: CompileOptions): T; | ||
} | ||
export = degenerator; |
@@ -9,4 +9,4 @@ "use strict"; | ||
const esprima_1 = require("esprima"); | ||
const ast_types_1 = require("ast-types"); | ||
const vm_1 = require("vm"); | ||
const ast_types_1 = require("ast-types"); | ||
const supports_async_1 = __importDefault(require("./supports-async")); | ||
@@ -127,3 +127,3 @@ /** | ||
const compiled = degenerator(code, names, Object.assign(Object.assign({}, options), { output })); | ||
const fn = vm_1.runInNewContext(`${compiled};${returnName}`, options.sandbox); | ||
const fn = vm_1.runInNewContext(`${compiled};${returnName}`, options.sandbox, options); | ||
if (supports_async_1.default) { | ||
@@ -130,0 +130,0 @@ return fn; |
{ | ||
"name": "degenerator", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Turns sync functions into async generator functions", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19861