syavorsky / comment-parser

Generic JSDoc-like comment parser.
MIT License
239 stars 24 forks source link

Fix CommonJS #133

Closed brettz9 closed 3 years ago

brettz9 commented 3 years ago

This is a fix for the beta channel, but one I think you are going to want to merge once confirmed it is working.

In my #130 PR, I had neglected to consider that the exports for CJS files needed to be .cjs given that with the change to type: 'module', Node will interpret .js as ESM instead.

I also added convert-extension, a useful tool created because TypeScript has apparently insisted they will not be allowing control of output of extensions--as is needed for native ESM.

I also added an --include=".js" to the existing code to avoid converting paths within TypeScript files. I'm assuming those are safe to leave alone (if not required to be left alone).

Finally, I believe the tests were broken because exports will no longer find the .cjs extension. (In the future, I'd recommend switching to ESM tests, but this fixes the tests for now while they are using CJS.)

And if you are ok to merge, if I could trouble you for one more beta release...

Thanks so much!

syavorsky commented 3 years ago

thanks, published comment-parser@1.1.6-beta.2