Sha256: ddf72c49afe8371ec90ad27c0c27c31a55976310845c4b79690a8d70820abfb4

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 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: require,
      console: console,
      process: process,
      global: global,
      URL: URL,
      Buffer: Buffer,
      __filename: "__lit_eval.js",
    }

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bridgetown-lit-renderer-2.0.0.beta3 src/server/ssr_exec.js
bridgetown-lit-renderer-2.0.0.beta2 src/server/ssr_exec.js
bridgetown-lit-renderer-2.0.0.beta1 src/server/ssr_exec.js
bridgetown-lit-renderer-1.1.1 src/ssr_exec.js
bridgetown-lit-renderer-1.1.0 src/ssr_exec.js