vrml1to97/tools/modulize.mjs

8 lines
303 B
JavaScript

import {stdin, argv} from 'node:process'
import {streamToString} from '../etc/streamToString.js'
const preamble = 'export default (((f) => f())(function () {'
const umd = await streamToString(stdin)
const realStart = umd.indexOf(" 'use strict'")
console.log(preamble + "\n" + umd.substring(realStart))