vrml1to97/tools/modulize.mjs

10 lines
363 B
JavaScript

import {stdin, argv} from 'node:process'
import {streamToString} from '../etc/streamToString.js'
const preamble = `// ES6 Module converted from https://github.com/no-context/moo
export default (((f) => f())(function () {
`
const umd = await streamToString(stdin)
const realStart = umd.indexOf(" 'use strict'")
console.log(preamble + umd.substring(realStart))