📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

es-module-lexer

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-module-lexer

Lexes ES modules returning their import/export metadata

1.7.0
latest
Source
npm
Version published
Weekly downloads
26M
-10.7%
Maintainers
1
Weekly downloads
 
Created

What is es-module-lexer?

The es-module-lexer package is designed to perform lexical analysis of JavaScript modules to identify import and export statements. It is particularly useful for tools that need to analyze or transform ES module syntax, such as bundlers, compilers, and code analysis tools.

What are es-module-lexer's main functionalities?

Lexical Analysis

This feature allows you to perform lexical analysis on a string containing ES module source code. The `parse` function returns two arrays: one for the import statements and one for the export statements found in the source code.

import { init, parse } from 'es-module-lexer';

(async () => {
  await init;
  const source = `import { a } from 'module-a';`;
  const [imports, exports] = parse(source);
  console.log(imports);
  console.log(exports);
})();

Other packages similar to es-module-lexer

FAQs

Package last updated on 22 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts