diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-10-26 14:03:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-26 14:03:03 +0100 |
commit | 57cad539457dff7fc273bed5ecaf08bd3dc40d1b (patch) | |
tree | 1b0c01aeaaf2c0a1723712d6b9b5baf91bfeecff /cli/module_graph2.rs | |
parent | aebbdd5cc2c75151be28c839878b0dee915147ef (diff) |
refactor(cli): rewrite Deno.transpileOnly() to use SWC (#8090)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Diffstat (limited to 'cli/module_graph2.rs')
-rw-r--r-- | cli/module_graph2.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cli/module_graph2.rs b/cli/module_graph2.rs index 8ee60eb59..cc063c6c3 100644 --- a/cli/module_graph2.rs +++ b/cli/module_graph2.rs @@ -320,7 +320,8 @@ impl Module { /// Parse a module, populating the structure with data retrieved from the /// source of the module. pub fn parse(&mut self) -> Result<(), AnyError> { - let parsed_module = parse(&self.specifier, &self.source, &self.media_type)?; + let parsed_module = + parse(self.specifier.as_str(), &self.source, &self.media_type)?; // parse out any triple slash references for comment in parsed_module.get_leading_comments().iter() { @@ -639,12 +640,13 @@ impl Graph2 { let mut ts_config = TsConfig::new(json!({ "checkJs": false, "emitDecoratorMetadata": false, + "inlineSourceMap": true, "jsx": "react", "jsxFactory": "React.createElement", "jsxFragmentFactory": "React.Fragment", })); let maybe_ignored_options = - ts_config.merge_user_config(options.maybe_config_path)?; + ts_config.merge_tsconfig(options.maybe_config_path)?; let emit_options: EmitOptions = ts_config.into(); let cm = Rc::new(swc_common::SourceMap::new( swc_common::FilePathMapping::empty(), @@ -730,7 +732,7 @@ impl Graph2 { })); } let maybe_ignored_options = - config.merge_user_config(options.maybe_config_path)?; + config.merge_tsconfig(options.maybe_config_path)?; // Short circuit if none of the modules require an emit, or all of the // modules that require an emit have a valid emit. There is also an edge @@ -1187,13 +1189,14 @@ impl Graph2 { let mut ts_config = TsConfig::new(json!({ "checkJs": false, "emitDecoratorMetadata": false, + "inlineSourceMap": true, "jsx": "react", "jsxFactory": "React.createElement", "jsxFragmentFactory": "React.Fragment", })); let maybe_ignored_options = - ts_config.merge_user_config(options.maybe_config_path)?; + ts_config.merge_tsconfig(options.maybe_config_path)?; let emit_options: EmitOptions = ts_config.clone().into(); |