Một mục mã nguồn mở trong kho dữ liệu GitHub của TopGit: JakeChampion/parse-imports, 1 sao.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/JakeChampion/parse-imports là nguồn chính thức.
JakeChampion/parse-imports có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho JakeChampion/parse-imports. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
JakeChampion/parse-imports có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho JakeChampion/parse-imports. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
JakeChampion/parse-imports có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho JakeChampion/parse-imports. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
JakeChampion/parse-imports còn được duy trì không?
TopGit chưa ghi nhận lần push gần đây của JakeChampion/parse-imports. Xem lịch sử commit trực tiếp trên GitHub để biết thông tin chính xác nhất.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về parse-imports?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về parse-imports.