6utt3rfly / jse-eval

Javascript Expression Evaluator
MIT License
22 stars 7 forks source link

include "type" and "exports" key in package.json #54

Closed JiCiT closed 2 years ago

JiCiT commented 2 years ago

"type" and "exports" keys are missing from package.json in the npm package.

6utt3rfly commented 2 years ago

Oh it seems I broke the ESM exports when moving from functions to a class! Sorry! Let me look into this...

6utt3rfly commented 2 years ago

@JiCiT - I still tend to use more CJS style code at my work, so I didn't realize that you can't destructcure static class methods in ESM (but you can in CJS).

In my opinion, because of the ability to add an evaluator, I think it still makes sense to keep the static methods in the class versus exporting numerous functions, which every plugin would then have to import as needed. Do you have any thoughts? I could just update the readme to show the usage in two steps?

import JseEval from 'jse-eval';
const { compile } = JseEval;
JiCiT commented 2 years ago

Maybe export the class as the default export and the various functions as named exports?

I think that would provide a single convenient export for any one using the extending evaluation functionality and/or moving from CJS to ESM. It would also allow anyone using ESM and needing, say, just the parse and evaluate functions to import just those.

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 1.4.0-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

6utt3rfly commented 2 years ago

@JiCiT - I just added to your PR in #55 to:

Would you mind confirming the beta release, then I can merge it to main 🙂

JiCiT commented 2 years ago

Working great for me. Thank you!!!

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 1.4.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: