oxc/napi/parser
Boshen 32303b20fb
New tool: oxc_module_lexer (#2650)
# Oxc Module Lexer

This is not a lexer. The name "lexer" is used for easier recognition.

## [es-module-lexer](https://github.com/guybedford/es-module-lexer)

Outputs the list of exports and locations of import specifiers,
including dynamic import and import meta handling.

Does not have any
[limitations](https://github.com/guybedford/es-module-lexer?tab=readme-ov-file#limitations)
mentioned in `es-module-lexer`.

I'll also work on the following cases to make this feature complete.

- [ ] get imported variables
https://github.com/guybedford/es-module-lexer/issues/163
- [ ] track star exports as imports as well
https://github.com/guybedford/es-module-lexer/issues/76
- [ ] TypeScript specific syntax
- [ ] TypeScript `type` import / export keyword

## [cjs-module-lexer](https://github.com/nodejs/cjs-module-lexer)

- [ ] TODO

## Benchmark

This is 2 times slower than `es-module-lexer`, but will be significantly
faster when TypeScript is processed.

The difference is around 10ms vs 20ms on a large file (700k).
2024-03-09 23:23:55 +08:00
..
src New tool: oxc_module_lexer (#2650) 2024-03-09 23:23:55 +08:00
.gitignore
build.rs
Cargo.toml New tool: oxc_module_lexer (#2650) 2024-03-09 23:23:55 +08:00
index.d.ts New tool: oxc_module_lexer (#2650) 2024-03-09 23:23:55 +08:00
index.js New tool: oxc_module_lexer (#2650) 2024-03-09 23:23:55 +08:00
package.json New tool: oxc_module_lexer (#2650) 2024-03-09 23:23:55 +08:00
pnpm-lock.yaml New tool: oxc_module_lexer (#2650) 2024-03-09 23:23:55 +08:00
README.md feat: Release resolver with NAPI (#1212) 2023-11-10 15:25:17 +00:00
test.mjs feat(napi): return comments (#2469) 2024-02-21 22:43:40 +08:00
test_buffer.js feat(parser/napi): add flexbuffer to AST transfer (2x speedup) (#1680) 2023-12-15 02:52:33 +00:00
test_module_lexer.mjs New tool: oxc_module_lexer (#2650) 2024-03-09 23:23:55 +08:00

Installation

corepack enable

Build

pnpm install
pnpm run build

Test

pnpm test