Merge pull request #7734 from kaeluka/js-add-node-prefix-to-module-import

js: add support for the 'node:' prefix for importing internal modules
This commit is contained in:
Stephan Brandauer
2022-01-26 10:15:08 +01:00
committed by GitHub
3 changed files with 212 additions and 1 deletions

View File

@@ -741,7 +741,10 @@ module ModuleImportNode {
* This predicate can be extended by subclassing `ModuleImportNode::Range`.
*/
cached
ModuleImportNode moduleImport(string path) { Stages::Imports::ref() and result.getPath() = path }
ModuleImportNode moduleImport(string path) {
// NB. internal modules may be imported with a "node:" prefix
Stages::Imports::ref() and result.getPath() = ["node:" + path, path]
}
/**
* Gets a (default) import of the given dependency `dep`, such as