JakeChampion/parse-imports sits at 1 stars on GitHub.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Use parseImports when you're able to await a Promise result and
parseImportsSync otherwise.
[!IMPORTANT]
You can only call parseImportsSync once the WASM has loaded. You can be sure
this has happened by awaiting the exported wasmLoadPromise.
See the type definitions for details.
Types
type ModuleSpecifierType =
| 'invalid'
| 'absolute'
| 'relative'
| 'builtin'
| 'package'
| 'unknown'
type Import = {
startIndex: number
endIndex: number
isDynamicImport: boolean
moduleSpecifier: {
type: ModuleSpecifierType
startIndex: number
endIndex: number
isConstant: boolean
code: string
value?: string
resolved?: string
}
importClause?: {
default?: string
named: string[]
namespace?: string
}
}
Import
code.substring(startIndex, endIndex) returns the full import statement or
expression.
code.substring(moduleSpecifier.startIndex, moduleSpecifier.endIndex) returns
the module specifier including quotes.
moduleSpecifier.isConstant is true when the import is not a dynamic import
(isDynamicImport is false), or when the import is a dynamic import where the
specifier is a simple string literal (e.g. import('fs'), import("fs"),
import(`fs`)).
If moduleSpecifier.isConstant is false, then moduleSpecifier.type is
'unknown'. Otherwise, it is set according to the following rules:
'invalid' if the module specifier is the empty string
'absolute' if the module specifier is an absolute file path
'relative' if the module specifier is a relative file path
'builtin' if the module specifier is the name of a builtin Node.js package
'package' otherwise
moduleSpecifier.code is the module specifier as it was written in the code.
For non-constant dynamic imports it could be a complex expression.
moduleSpecifier.value is moduleSpecifier.code without string literal quotes
and unescaped if moduleSpecifier.isConstant is true. Otherwise, it is
undefined.
moduleSpecifier.resolved is set if the resolveFrom option is set and
moduleSpecifier.value is not undefined.
importClause is only undefined if isDynamicImport is true.
importClause.default is the default import identifier or undefined if the
import statement does not have a default import.
importClause.named is the array of objects representing the named imports of
the import statement. It is empty if the import statement does not have any
named imports. Each object in the array has a specifier field set to the
imported identifier and a binding field set to the identifier for accessing
the imported value. For example, import { a, x as y } from 'something' would
have the following array for importClause.named:
[{ specifier: 'a', binding: 'a' }, { specifier: 'x', binding: 'y' }].
importClause.namespace is the namespace import identifier or undefined if
the import statement does not have a namespace import.
Contributing
Stars are always welcome!
For bugs and feature requests,
please create an issue.
Does JakeChampion/parse-imports have a project website?
No homepage URL was recorded for JakeChampion/parse-imports in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Does JakeChampion/parse-imports have any tags?
TopGit's last sync did not record any GitHub topics for JakeChampion/parse-imports. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
Is JakeChampion/parse-imports open source?
TopGit's metadata for JakeChampion/parse-imports does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
Is JakeChampion/parse-imports still maintained?
TopGit's metadata for JakeChampion/parse-imports does not include a recent push date. Check the commit history on the GitHub repository page for the most authoritative activity timeline.
Where do I read more about JakeChampion/parse-imports?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/JakeChampion/parse-imports is the definitive source.
Read full README in the tab above.
Want a second opinion on parse-imports?
Ask an AI that can read this page — one click and you get its take on parse-imports.