Comparing version 3.1.4 to 3.1.5
import { Program } from 'estree'; | ||
export declare const parseJS: (code: string) => Program; | ||
export declare const generateJS: (ast: Program) => any; | ||
export declare const FN_ID = "cy2_injected"; | ||
export declare const instrumentCypressInit: (code: string, injectedModulePath: string) => any; | ||
export declare function hasInjected(ast: Program): boolean; |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.hasInjected = hasInjected; | ||
exports.parseJS = exports.instrumentCypressInit = exports.FN_ID = void 0; | ||
exports.instrumentCypressInit = exports.generateJS = exports.parseJS = exports.FN_ID = void 0; | ||
var _acorn = require("acorn"); | ||
@@ -21,2 +21,7 @@ var _escodegen = _interopRequireDefault(require("escodegen")); | ||
exports.parseJS = parseJS; | ||
const generateJS = (ast)=>_escodegen.default.generate(ast, { | ||
verbatim: 'raw' | ||
}) | ||
; | ||
exports.generateJS = generateJS; | ||
const FN_ID = 'cy2_injected'; | ||
@@ -33,5 +38,5 @@ exports.FN_ID = FN_ID; | ||
if (!hasInjected(ast)) { | ||
return _escodegen.default.generate(injectAST(ast, parseJS(injectedCode))); | ||
return generateJS(injectAST(ast, parseJS(injectedCode))); | ||
} | ||
return _escodegen.default.generate(replaceAST(ast, parseJS(injectedFn))); | ||
return generateJS(replaceAST(ast, parseJS(injectedFn))); | ||
}; | ||
@@ -38,0 +43,0 @@ exports.instrumentCypressInit = instrumentCypressInit; |
{ | ||
"name": "cy2", | ||
"version": "3.1.4", | ||
"version": "3.1.5", | ||
"author": "Andrew Goldis", | ||
@@ -5,0 +5,0 @@ "main": "./dist", |
46197
1102