Giter Club home page Giter Club logo

seafox's People

Contributors

0xflotus avatar 3cp avatar dependabot[bot] avatar kflash avatar nicolo-ribaudo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seafox's Issues

What is Seafox?

This is my private parser code made public. It strictly conforms to the standard ECMAScript® 2020 (ECMA-262 10th Edition) language specification, and can not be used as an drop-in replacement for other parsers.

The main reason for this is that all parsers uses a parse() method - Seafox uses either parseScript or parseModule.

Seafox focus only on performance, and if you are soft hearted and / or can't understand super low level code - this parser isn't for you :)

I would recommend to use the Meriyah parser instead of Seafox if you need a parser that behave like other public parsers, and also if you are in need of performance even the fact that Seafox is 15 - 25 % faster than the mentioned parser.

Seafox Performance

Seafox is build for performance, and this is the current benchmark results.

yup

Variable declarations inside of for loop breaks

When parsing for loops with variable declarations, the type attribute is incorrectly set.

for (const x of y) {

}

AST Output:

{
  "type": "VariableDeclaration",
  "kind": 32,
  "declarations": [
    {
      "type": "VariableDeclarator",
      "id": {
        "type": "Identifier",
        "name": "x"
      },
      "init": null
    }
  ]
}

Expected:

{
  "type": "VariableDeclaration",
  "kind": "const",
  "declarations": [
    {
      "type": "VariableDeclarator",
      "id": {
        "type": "Identifier",
        "name": "x"
      },
      "init": null
    }
  ]
}
```

Confused about the AST related to optional chaining expressions

The following two expressions produce unexpectedly different output structures. I'm confused why this might be the case, and (assuming it's not a bug) how I should logically understand the structure when it comes to rendering. It's not clear, based on the AST, exactly where the optional chain operator should go. Why is c optional in the second example but not the first? Why does a computed property affect the structure so much? Also why is there always a base property? Why not just an array of chaining members?

Note that I'm trying this with Seafox as I was previously trying to do it with Meriyah, but Meriyah was producing an even more confusing structure with a kind of weird backward-nested structure that seems to chain in reverse via nested base properties.

seafox.parse(`a?.b?.[c]`)
seafox.parse(`a?.b?.c`)

Relevant outputs:

{
  "type": "MemberExpression",
  "object": {
    "type": "ChainingExpression",
    "base": {
      "type": "Identifier",
      "name": "a"
    },
    "chain": [
      {
        "type": "MemberChain",
        "computed": false,
        "property": {
          "type": "Identifier",
          "name": "b"
        },
        "optional": true
      }
    ]
  },
  "computed": true,
  "property": {
    "type": "Identifier",
    "name": "c"
  }
}
{
  "type": "ChainingExpression",
  "base": {
    "type": "Identifier",
    "name": "a"
  },
  "chain": [
    {
      "type": "MemberChain",
      "computed": false,
      "property": {
        "type": "Identifier",
        "name": "b"
      },
      "optional": true
    },
    {
      "type": "MemberChain",
      "computed": false,
      "property": {
        "type": "Identifier",
        "name": "c"
      },
      "optional": true
    }
  ]
}

Current released version includes debug logging

I was trying out the released version of seafox (1.6.9) and note that it appears to have shipped with lots of baked-in debug logging (via console.log()). I suspect that this was a mistake and wonder if a new release might be cut with those bits of logging removed.

I have a use-case where I need to perform semantic analysis in the browser and am looking for a combination of performance and bundle size. Seafox looks like a great candidate there!

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.