Sha256: a77f8b0b53f3df759b4b7ecf04b00de8f300fccaf7011d259e9e5d389305cc7e

Contents?: true

Size: 679 Bytes

Versions: 3

Compression:

Stored size: 679 Bytes

Contents

const colors = require("colors/safe")

const originalConsoleLog = console.log

console.log = function () {
  args = []
  args.push(colors.rainbow("[LitSSR]"))
  // Note: arguments is part of the prototype
  for (let i = 0; i < arguments.length; i++) {
    args.push(arguments[i])
  }
  originalConsoleLog.apply(console, args)
}

module.exports = {
  execScript(str) {
    const vm = require("vm")
    const contextObject = {
      require,
      console,
      process,
      global,
      URL,
      URLSearchParams,
      Buffer,
      setTimeout() {},
      clearTimeout() {},
      __filename: "__lit_eval.js",
    }

    return vm.runInNewContext(str, contextObject)
  },
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bridgetown-lit-renderer-2.1.0.beta2 src/server/ssr_exec.js
bridgetown-lit-renderer-2.1.0.beta1 src/server/ssr_exec.js
bridgetown-lit-renderer-2.0.0 src/server/ssr_exec.js