mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
parent
7c61fe6409
commit
8e77afed9c
1 changed files with 7 additions and 34 deletions
|
@ -32,7 +32,6 @@ use deno_core::futures::future;
|
||||||
use deno_core::parking_lot::Mutex;
|
use deno_core::parking_lot::Mutex;
|
||||||
use deno_core::url;
|
use deno_core::url;
|
||||||
use deno_core::ModuleSpecifier;
|
use deno_core::ModuleSpecifier;
|
||||||
use deno_graph::DefaultParsedSourceStore;
|
|
||||||
use deno_graph::GraphImport;
|
use deno_graph::GraphImport;
|
||||||
use deno_graph::Resolved;
|
use deno_graph::Resolved;
|
||||||
use deno_runtime::deno_node::NodeResolutionMode;
|
use deno_runtime::deno_node::NodeResolutionMode;
|
||||||
|
@ -1440,40 +1439,14 @@ fn analyze_module(
|
||||||
maybe_headers: Option<&HashMap<String, String>>,
|
maybe_headers: Option<&HashMap<String, String>>,
|
||||||
maybe_resolver: Option<&dyn deno_graph::source::Resolver>,
|
maybe_resolver: Option<&dyn deno_graph::source::Resolver>,
|
||||||
) -> ModuleResult {
|
) -> ModuleResult {
|
||||||
use deno_graph::ParsedSourceStore;
|
|
||||||
|
|
||||||
struct UnreachableParser;
|
|
||||||
|
|
||||||
impl deno_graph::ModuleParser for UnreachableParser {
|
|
||||||
fn parse_module(
|
|
||||||
&self,
|
|
||||||
_specifier: &deno_graph::ModuleSpecifier,
|
|
||||||
_source: Arc<str>,
|
|
||||||
_media_type: MediaType,
|
|
||||||
) -> deno_core::anyhow::Result<ParsedSource, deno_ast::Diagnostic> {
|
|
||||||
// should have re-used the parsed source from the store
|
|
||||||
unreachable!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match parsed_source_result {
|
match parsed_source_result {
|
||||||
Ok(parsed_source) => {
|
Ok(parsed_source) => Ok(deno_graph::parse_module_from_ast(
|
||||||
let store = DefaultParsedSourceStore::default();
|
specifier,
|
||||||
store.set_parsed_source(specifier.clone(), parsed_source.clone());
|
deno_graph::ModuleKind::Esm,
|
||||||
let analyzer = deno_graph::CapturingModuleAnalyzer::new(
|
maybe_headers,
|
||||||
// should never parse because it will get the parsed source from the store
|
parsed_source,
|
||||||
Some(Box::new(UnreachableParser)),
|
maybe_resolver,
|
||||||
Some(Box::new(store)),
|
)),
|
||||||
);
|
|
||||||
deno_graph::parse_module(
|
|
||||||
specifier,
|
|
||||||
maybe_headers,
|
|
||||||
parsed_source.text_info().text(),
|
|
||||||
Some(deno_graph::ModuleKind::Esm),
|
|
||||||
maybe_resolver,
|
|
||||||
Some(&analyzer),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Err(err) => Err(deno_graph::ModuleGraphError::ParseErr(
|
Err(err) => Err(deno_graph::ModuleGraphError::ParseErr(
|
||||||
specifier.clone(),
|
specifier.clone(),
|
||||||
err.clone(),
|
err.clone(),
|
||||||
|
|
Loading…
Reference in a new issue