feat: install moo and use in toy example

I failed to find a satisfactory way to compile and import moo.js with
   fixed specifiers, so finally I just gave up and patched the distributed
   code to be an es6 module. A bit ugly but it works.
This commit is contained in:
Glen Whitney 2023-09-01 14:21:56 -07:00
parent 67a07e2000
commit 77bd983cbc
11 changed files with 86 additions and 25 deletions

7
tools/modulize.mjs Normal file
View file

@ -0,0 +1,7 @@
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))