mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
module: named exports for CJS via static analysis
PR-URL: https://github.com/nodejs/node/pull/35249 Reviewed-By: Mary Marchini <oss@mmarchini.me> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
1 parent
062b35d4e8
commit
1e8cb08edc
20 files changed
+1935
-94
No files matched your search
@@ -78,6 +78,9 @@ void NativeModuleLoader::InitializeModuleCategories() {
|
||||
"internal/main/"
|
||||
};
|
||||
|
||||
module_categories_.can_be_required.emplace(
|
||||
"internal/deps/cjs-module-lexer/lexer");
|
||||
|
||||
module_categories_.cannot_be_required = std::set<std::string> {
|
||||
#if !HAVE_INSPECTOR
|
||||
"inspector",
|
||||
@@ -118,7 +121,8 @@ void NativeModuleLoader::InitializeModuleCategories() {
|
||||
if (prefix.length() > id.length()) {
|
||||
continue;
|
||||
}
|
||||
if (id.find(prefix) == 0) {
|
||||
if (id.find(prefix) == 0 &&
|
||||
module_categories_.can_be_required.count(id) == 0) {
|
||||
module_categories_.cannot_be_required.emplace(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user