2021-10-14 12:51:05 +02:00
|
|
|
import vm from "vm"
|
|
|
|
import templates from "./index.js"
|
|
|
|
import { setJSRunner } from "./helpers/javascript"
|
2021-01-30 03:54:52 +01:00
|
|
|
|
|
|
|
/**
|
2021-10-14 12:51:05 +02:00
|
|
|
* ES6 entrypoint for rollup
|
2021-01-30 03:54:52 +01:00
|
|
|
*/
|
|
|
|
export const isValid = templates.isValid
|
|
|
|
export const makePropSafe = templates.makePropSafe
|
|
|
|
export const getManifest = templates.getManifest
|
2021-10-11 15:53:55 +02:00
|
|
|
export const isJSBinding = templates.isJSBinding
|
|
|
|
export const encodeJSBinding = templates.encodeJSBinding
|
|
|
|
export const decodeJSBinding = templates.decodeJSBinding
|
2021-01-30 03:54:52 +01:00
|
|
|
export const processStringSync = templates.processStringSync
|
|
|
|
export const processObjectSync = templates.processObjectSync
|
|
|
|
export const processString = templates.processString
|
|
|
|
export const processObject = templates.processObject
|
2021-10-14 12:51:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Use polyfilled vm to run JS scripts in a browser Env
|
|
|
|
*/
|
|
|
|
setJSRunner((js, context) => {
|
|
|
|
vm.createContext(context)
|
|
|
|
return vm.runInNewContext(js, context, { timeout: 1000 })
|
|
|
|
})
|