TomerAberbach / parse-imports

⚡ A blazing fast ES module imports parser.
https://npm.im/parse-imports
Apache License 2.0
50 stars 4 forks source link

Support JSX syntax #5

Open jcdixon2 opened 2 years ago

jcdixon2 commented 2 years ago

Here are a couple of examples. I show the error message on the specific line referenced in the error.

                <FilterFieldClearButton
                  aria-label="Clear search"
                  onClick={() => {
                    setFilterValue('');
                    setSortedColumns(getFilteredColumns(''));
                  }}
                > 
                </FilterFieldClearButton>    ****** Parse error @:287:42
function SandboxApp() {
  return (
    <App>
      <DatagridInlineRowGroup licenseKey={licenseKey} />
    </App>  ****** Parse error @:9:11
  );
}
TomerAberbach commented 2 years ago

This package is pretty much a wrapper around es-module-lexer (see https://github.com/TomerAberbach/parse-imports/issues/1#issuecomment-840175682), which doesn't support JSX. I've considered writing my own lexer in Rust so I'll leave this open as a feature request for JSX support.

For now I would recommend transpiling and then parsing for imports using this package. Also, depending on what you use to transpile you may be able to get the imports as part of that step

jcdixon2 commented 2 years ago

Thanks. Hope to use parse-imports at some later date then when it supports JSX.

ivands commented 7 months ago

Hope this will be added soon !

TomerAberbach commented 4 months ago

Out of curiosity, do y'all care about/use the dynamic import support of the package? Or just the static imports support?