Sha256: a3b2626083376a8a5f3b264b9d0c6914cab02612138f4bfbf9d7dc8f77e9e10b

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

const path = require("path")

module.exports = (esbuildOptions) => {
  let inputData = [];

  process.stdin.resume();
  process.stdin.setEncoding('utf8');

  process.stdin.on('data', data => {
    inputData.push(data)
  })

  process.stdin.on('end', () => {
    const inputValues = JSON.parse(inputData.join())

    require('esbuild').build({
      ...esbuildOptions,
      stdin: {
        contents: inputValues.code,
        resolveDir: process.cwd(),
        sourcefile: 'lit-ssr-output.js' // imaginary file
      },
      platform: "node",
      inject: [path.join(__dirname, "import-meta-url-shim.js")],
      define: { "import.meta.url": "import_meta_url" },
      bundle: true,
      write: false,
    }).then(result => {
      process.stdout.write(result.outputFiles[0].text)
    }).catch(_e => { })
  })
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bridgetown-lit-renderer-1.1.1 src/build.js
bridgetown-lit-renderer-1.1.0 src/build.js
bridgetown-lit-renderer-1.0.0 src/build.js