Giter Club home page Giter Club logo

Comments (7)

guybedford avatar guybedford commented on May 24, 2024 1

@SimenB I can get behind unifying the APIs to do that sure. That sounds like a good suggestion to me.

from cjs-module-lexer.

SimenB avatar SimenB commented on May 24, 2024 1

Cool. I can send a couple of PRs tomorrow if you don't get to it.

Current thinking is init should just be Promise.resolve() so you know you can always call it. Without worrying about what API

from cjs-module-lexer.

guybedford avatar guybedford commented on May 24, 2024 1

Thanks for the PRs! I've published a 0.6.0 with these.

from cjs-module-lexer.

guybedford avatar guybedford commented on May 24, 2024

I've marked this as an enhancement issue and will leave it open here. If anyone would like to contribute please do.

from cjs-module-lexer.

SimenB avatar SimenB commented on May 24, 2024

I was gonna send a PR since the types aren't too advanced, but it seems the functions are different between CJS and ESM with CJS having parse and ESM having {init, parse}.

Thoughts on changing the API to be the same across module types? I.e. changing CJS to

module.exports.parse = parseCJS;
module.exports.init = () => Promise.reject(new Error('init is not supported when using CommonJS'));

Could potentially just no-op in the last one, or warn?

from cjs-module-lexer.

SimenB avatar SimenB commented on May 24, 2024

Some time freed up tonight, so sent #27 & #28 👍

from cjs-module-lexer.

SimenB avatar SimenB commented on May 24, 2024

Thanks @guybedford!

from cjs-module-lexer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.