shapesecurity / shift-parser-js

ECMAScript parser that produces a Shift format AST
http://shift-ast.org/parser.html
Apache License 2.0
251 stars 28 forks source link

proper es module #452

Open felixroos opened 2 years ago

felixroos commented 2 years ago

It would be great if this could be packaged as a proper es module. I could not use this package with snowpack, also, it won't work with skypack. For example, the following html:

<script type="module">
  import { parseScriptWithLocation } from 'https://cdn.skypack.dev/shift-parser';
</script>

will produce the following error

shift-parser.js:4857 Uncaught TypeError: Super expression must either be null or a function, not undefined
    at _inherits (shift-parser.js:4857:13)
    at shift-parser.js:4931:5
    at shift-parser.js:5690:4
    at createCommonjsModule (shift-parser.js:15:6)
    at shift-parser.js:4785:19

Generally, I wonder if shift is still maintained?

bakkot commented 2 years ago

It is still maintained, though I'm behind at the moment.

I'll think about publishing an ES module. The state of ESM was kind of chaotic last I checked but there's probably a reasonable solution.

felixroos commented 2 years ago

that would be great! I could also try it myself and send a PR if you want