parse-imports-exports is a JavaScript/TypeScript library designed for fast and easy parsing of ECMAScript and TypeScript import and export declarations. It currently stands at version 0.2.4, indicating it is in active development and pre-1.0, so the API might evolve. The library focuses on extracting structured information about module dependencies from syntactically correct and well-formatted code, supporting both standard ES module syntax and TypeScript-specific constructs like `import type` and `export type`. It is optimized for efficiency and is not a full Abstract Syntax Tree (AST) parser, but rather targets specific module-related statements, including dynamic `import()` and `require()` calls.
npm install parse-imports-exportsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `parseImportsExports` to analyze a TypeScript/ECMAScript source string and extract a detailed breakdown of all import, export, and re-export declarations, including dynamic imports and CommonJS `require` statements.
Ensure the source string passed to `parseImportsExports` is valid JavaScript/TypeScript, potentially pre-processed by a linter or formatter like Prettier.
Refer to the official GitHub repository for the latest API documentation and breaking change notes before upgrading. Consider pinning to exact minor versions to avoid unexpected changes.
Use a dedicated full AST parser (e.g., Acorn, Babel, TypeScript compiler API) if you require comprehensive code analysis or error detection beyond module declarations.
Validate and format your source code using a tool like ESLint or Prettier before passing it to `parseImportsExports`. Ensure all import/export statements are syntactically correct.
Use `import { parseImportsExports } from 'parse-imports-exports';` in modern Node.js and browser environments that support ES modules. If using CommonJS, ensure your project setup correctly transpiles or resolves ESM imports.Review the specific import/export statement causing the error. Ensure it adheres strictly to ECMAScript/TypeScript syntax, including correct use of keywords, module specifiers, and proper termination.
No dependency data recorded yet.