Giter Club home page Giter Club logo

Comments (5)

wangchuan95 avatar wangchuan95 commented on July 4, 2024

I met same problem, and there are some types can be detected.

module.exports = {
  a: true,
  b: null,
  c: undefined,
  d: function () {},
};

from cjs-module-lexer.

jaggli avatar jaggli commented on July 4, 2024

@guybedford why did you add the "wontfix" tag? The same goes for

module.exports = {
  a: "a",
  b: 'b'
};

The exports are just empty.

from cjs-module-lexer.

aduh95 avatar aduh95 commented on July 4, 2024

Probably because of

_Detection patterns for this project are **frozen**_. This is because adding any new export detection patterns would result in fragmented backwards-compatibility. Specifically, it would be very difficult to figure out why an ES module named export for CommonJS might work in newer Node.js versions but not older versions. This problem would only be discovered downstream of module authors, with the fix for module authors being to then have to understand which patterns in this project provide full backwards-compatibily. Rather, by fully freezing the detected patterns, if it works in any Node.js version it will work in any other. Build tools can also reliably treat the supported syntax for this project as a part of their output target for ensuring syntax support.

from cjs-module-lexer.

jaggli avatar jaggli commented on July 4, 2024

@hanayashiki why closing it? The lexer is wrong... It's not about adding new detection patterns, it's about "not crashing when some funny values show up". I mean, we don't care about values (of any case if an object literal is exported..)

Would you like me to do a PR? I could fix it, but i want to make sure, if it has any chance to be merged...

from cjs-module-lexer.

hanayashiki avatar hanayashiki commented on July 4, 2024

@hanayashiki why closing it? The lexer is wrong... It's not about adding new detection patterns, it's about "not crashing when some funny values show up". I mean, we don't care about values (of any case if an object literal is exported..)

Would you like me to do a PR? I could fix it, but i want to make sure, if it has any chance to be merged...

it says no new patterns should be added. And I don't think the lexer should crash in any cases

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.