Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move ensure runtime to entry #1660

Merged
merged 14 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/mako/src/compiler.rs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加个 e2e? 看下 entry 被改成什么样了

Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@
plugins.push(Arc::new(plugins::ssu::SUPlus::new()));
}

if args.watch && config.experimental.central_ensure {
plugins.push(Arc::new(plugins::central_ensure::CentralChunkEnsure {}));

Check warning on line 302 in crates/mako/src/compiler.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/compiler.rs#L302

Added line #L302 was not covered by tests
}

if let Some(minifish_config) = &config._minifish {
let inject = if let Some(inject) = &minifish_config.inject {
let mut map = HashMap::new();
Expand Down
1 change: 1 addition & 0 deletions crates/mako/src/config/experimental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct ExperimentalConfig {
pub magic_comment: bool,
#[serde(deserialize_with = "deserialize_detect_loop")]
pub detect_circular_dependence: Option<DetectCircularDependence>,
pub central_ensure: bool,
}

#[derive(Deserialize, Serialize, Debug)]
Expand Down
3 changes: 2 additions & 1 deletion crates/mako/src/config/mako.config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"detectCircularDependence": {
"ignores": ["node_modules"],
"graphviz": false
}
},
"centralEnsure": true
},
"useDefineForClassFields": true,
"emitDecoratorMetadata": false,
Expand Down
6 changes: 6 additions & 0 deletions crates/mako/src/generate/chunk_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
self.graph.node_weights().find(|c| c.has_module(module_id))
}

pub fn get_async_chunk_for_module(&self, module_id: &ModuleId) -> Option<&Chunk> {
self.graph

Check warning on line 67 in crates/mako/src/generate/chunk_graph.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/chunk_graph.rs#L66-L67

Added lines #L66 - L67 were not covered by tests
.node_weights()
.find(|c| c.has_module(module_id) && matches!(c.chunk_type, ChunkType::Async))
}

Check warning on line 70 in crates/mako/src/generate/chunk_graph.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/chunk_graph.rs#L69-L70

Added lines #L69 - L70 were not covered by tests

// pub fn get_chunk_by_id(&self, id: &String) -> Option<&Chunk> {
// self.graph.node_weights().find(|c| c.id.id.eq(id))
// }
Expand Down
16 changes: 12 additions & 4 deletions crates/mako/src/generate/hmr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@
let module_graph = &self.context.module_graph.read().unwrap();
let (js_stmts, _) = modules_to_js_stmts(module_ids, module_graph, &self.context).unwrap();
let content = include_str!("../runtime/runtime_hmr.js").to_string();
let content = content.replace("__CHUNK_ID__", &chunk.id.id).replace(
"__runtime_code__",
&format!("runtime._h='{}';", current_hash),
);

let runtime_code_snippets = [
format!("runtime._h='{}';", current_hash),
self.context

Check warning on line 28 in crates/mako/src/generate/hmr.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/hmr.rs#L26-L28

Added lines #L26 - L28 were not covered by tests
.plugin_driver
.hmr_runtime_update_code(&self.context)?,
];

Check warning on line 31 in crates/mako/src/generate/hmr.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/hmr.rs#L30-L31

Added lines #L30 - L31 were not covered by tests

let content = content
.replace("__CHUNK_ID__", &chunk.id.id)
.replace("__runtime_code__", &runtime_code_snippets.join("\n"));

Check warning on line 35 in crates/mako/src/generate/hmr.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/hmr.rs#L33-L35

Added lines #L33 - L35 were not covered by tests

let mut js_ast = JsAst::build(filename, content.as_str(), self.context.clone())
/* safe */
.unwrap();
Expand Down
95 changes: 60 additions & 35 deletions crates/mako/src/generate/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use crate::visitors::async_module::{mark_async, AsyncModule};
use crate::visitors::common_js::common_js;
use crate::visitors::css_imports::CSSImports;
use crate::visitors::dep_replacer::{DepReplacer, DependenciesToReplace};
use crate::visitors::dep_replacer::{DepReplacer, DependenciesToReplace, ResolvedReplaceInfo};
use crate::visitors::dynamic_import::DynamicImport;
use crate::visitors::mako_require::MakoRequire;
use crate::visitors::meta_url_replacer::MetaUrlReplacer;
Expand Down Expand Up @@ -84,38 +84,53 @@
thread_pool::spawn(move || {
let module_graph = context.module_graph.read().unwrap();
let deps = module_graph.get_dependencies(&module_id);
let mut resolved_deps: HashMap<String, (String, String)> = deps
.into_iter()
.map(|(id, dep)| {
(
dep.source.clone(),
(
match &dep.resolve_type {
ResolveType::Worker(import_options) => {
let chunk_id = match import_options.get_chunk_name() {
Some(chunk_name) => {
generate_module_id(chunk_name, &context)
}
None => id.generate(&context),
};
let chunk_graph = context.chunk_graph.read().unwrap();
chunk_graph.chunk(&chunk_id.into()).unwrap().filename()
}
ResolveType::DynamicImport(import_options) => {
match import_options.get_chunk_name() {
Some(chunk_name) => {
generate_module_id(chunk_name, &context)
}
None => id.generate(&context),
}
}
_ => id.generate(&context),
},
id.id.clone(),
),
)
})
.collect();
let mut resolved_deps: HashMap<String, ResolvedReplaceInfo> = Default::default();

deps.into_iter().for_each(|(id, dep)| {
let replace_info = match &dep.resolve_type {
ResolveType::Worker(import_options) => {
let chunk_id = match import_options.get_chunk_name() {
Some(chunk_name) => generate_module_id(chunk_name, &context),
None => id.generate(&context),

Check warning on line 94 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L91-L94

Added lines #L91 - L94 were not covered by tests
};
let chunk_graph = context.chunk_graph.read().unwrap();
let chunk_name = chunk_graph.chunk(&chunk_id.into()).unwrap().filename();

Check warning on line 97 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L96-L97

Added lines #L96 - L97 were not covered by tests

ResolvedReplaceInfo {
chunk_id: None,

Check warning on line 100 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L99-L100

Added lines #L99 - L100 were not covered by tests
to_replace_source: chunk_name,
resolved_module_id: id.clone(),

Check warning on line 102 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L102

Added line #L102 was not covered by tests
}
}
ResolveType::DynamicImport(import_options) => {
let chunk_id = Some(match import_options.get_chunk_name() {
Some(chunk_name) => generate_module_id(chunk_name, &context),
None => id.generate(&context),

Check warning on line 108 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L104-L108

Added lines #L104 - L108 were not covered by tests
});

ResolvedReplaceInfo {

Check warning on line 111 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L111

Added line #L111 was not covered by tests
chunk_id,
to_replace_source: id.generate(&context),
resolved_module_id: id.clone(),

Check warning on line 114 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L113-L114

Added lines #L113 - L114 were not covered by tests
}
}

Check warning on line 116 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L116

Added line #L116 was not covered by tests
_ => ResolvedReplaceInfo {
chunk_id: None,
to_replace_source: id.generate(&context),
resolved_module_id: id.clone(),
},
};

resolved_deps
.entry(dep.source.clone())
.and_modify(|info: &mut ResolvedReplaceInfo| {
match (&replace_info.chunk_id, &info.chunk_id) {

Check warning on line 127 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L127

Added line #L127 was not covered by tests
(None, _) => {}
(Some(id), _) => info.chunk_id = Some(id.clone()),

Check warning on line 129 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L129

Added line #L129 was not covered by tests
}
})

Check warning on line 131 in crates/mako/src/generate/transform.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/generate/transform.rs#L131

Added line #L131 was not covered by tests
.or_insert(replace_info);
});
insert_swc_helper_replace(&mut resolved_deps, &context);
let module = module_graph.get_module(&module_id).unwrap();
let info = module.info.as_ref().unwrap();
Expand Down Expand Up @@ -162,10 +177,20 @@
Ok(())
}

fn insert_swc_helper_replace(map: &mut HashMap<String, (String, String)>, context: &Arc<Context>) {
fn insert_swc_helper_replace(
map: &mut HashMap<String, ResolvedReplaceInfo>,
context: &Arc<Context>,
) {
SWC_HELPERS.into_iter().for_each(|h| {
let m_id: ModuleId = h.to_string().into();
map.insert(m_id.id.clone(), (m_id.generate(context), h.to_string()));
map.insert(
m_id.id.clone(),
ResolvedReplaceInfo {
chunk_id: None,
to_replace_source: m_id.generate(context),
resolved_module_id: m_id,
},
);
stormslowly marked this conversation as resolved.
Show resolved Hide resolved
});
}

Expand Down
12 changes: 12 additions & 0 deletions crates/mako/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@
Ok(Vec::new())
}

fn hmr_runtime_updates(&self, _context: &Arc<Context>) -> Result<Vec<String>> {
Ok(Vec::new())
}

Check warning on line 164 in crates/mako/src/plugin.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugin.rs#L162-L164

Added lines #L162 - L164 were not covered by tests

fn optimize_module_graph(
&self,
_module_graph: &mut ModuleGraph,
Expand Down Expand Up @@ -368,6 +372,14 @@
Ok(plugins.join("\n"))
}

pub fn hmr_runtime_update_code(&self, context: &Arc<Context>) -> Result<String> {
let mut plugins = Vec::new();
for plugin in &self.plugins {
plugins.extend(plugin.hmr_runtime_updates(context)?);

Check warning on line 378 in crates/mako/src/plugin.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugin.rs#L375-L378

Added lines #L375 - L378 were not covered by tests
}
Ok(plugins.join("\n"))
}

Check warning on line 381 in crates/mako/src/plugin.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugin.rs#L380-L381

Added lines #L380 - L381 were not covered by tests

pub fn optimize_module_graph(
&self,
module_graph: &mut ModuleGraph,
Expand Down
1 change: 1 addition & 0 deletions crates/mako/src/plugins.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod async_runtime;
pub mod bundless_compiler;
pub mod central_ensure;
pub mod context_module;
pub mod copy;
pub mod detect_circular_dependence;
Expand Down
13 changes: 10 additions & 3 deletions crates/mako/src/plugins/bundless_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use crate::config::Config;
use crate::module::{ModuleAst, ModuleId};
use crate::plugin::{Plugin, PluginTransformJsParam};
use crate::visitors::dep_replacer::{DepReplacer, DependenciesToReplace};
use crate::visitors::dep_replacer::{DepReplacer, DependenciesToReplace, ResolvedReplaceInfo};
use crate::visitors::dynamic_import::DynamicImport;

pub struct BundlessCompiler {
Expand Down Expand Up @@ -80,11 +80,18 @@
}
};

Ok((dep.source.clone(), (replacement.clone(), replacement)))
Ok((
dep.source.clone(),
ResolvedReplaceInfo {
chunk_id: None,
to_replace_source: replacement,
resolved_module_id: id.clone(),

Check warning on line 88 in crates/mako/src/plugins/bundless_compiler.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/bundless_compiler.rs#L83-L88

Added lines #L83 - L88 were not covered by tests
},
))
})
.collect::<Result<Vec<_>>>();

let resolved_deps: HashMap<String, (String, String)> =
let resolved_deps: HashMap<String, ResolvedReplaceInfo> =
resolved_deps?.into_iter().collect();

drop(module_graph);
Expand Down
90 changes: 90 additions & 0 deletions crates/mako/src/plugins/central_ensure.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
use std::collections::BTreeMap;
use std::sync::Arc;

use anyhow::anyhow;

use crate::compiler::Context;
use crate::module::generate_module_id;
use crate::plugin::Plugin;

pub struct CentralChunkEnsure {}

pub fn module_ensure_map(context: &Arc<Context>) -> anyhow::Result<BTreeMap<String, Vec<String>>> {
let mg = context

Check warning on line 13 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L12-L13

Added lines #L12 - L13 were not covered by tests
.module_graph
.read()
.map_err(|e| anyhow!("Read_Module_Graph_error:\n{:?}", e))?;
let cg = context

Check warning on line 17 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L16-L17

Added lines #L16 - L17 were not covered by tests
.chunk_graph
.read()
.map_err(|e| anyhow!("Read_Chunk_Graph_error:\n{:?}", e))?;

Check warning on line 20 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L20

Added line #L20 was not covered by tests
stormslowly marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines +12 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

建议优化锁的使用方式

当前代码连续获取两个读锁可能导致性能问题或死锁。建议合并锁的获取操作:

let (mg, cg) = {
    let (mg_guard, cg_guard) = try_join!(
        context.module_graph.try_read_timeout(Duration::from_secs(1)),
        context.chunk_graph.try_read_timeout(Duration::from_secs(1))
    ).map_err(|e| anyhow!("获取图读锁失败: {}", e))?;
    (mg_guard, cg_guard)
};


let mut chunk_async_map: BTreeMap<String, Vec<String>> = Default::default();

Check warning on line 22 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L22

Added line #L22 was not covered by tests

mg.modules().iter().for_each(|module| {
let be_dynamic_imported = mg
.get_dependents(&module.id)

Check warning on line 26 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L24-L26

Added lines #L24 - L26 were not covered by tests
.iter()
.any(|(_, dep)| dep.resolve_type.is_dynamic_esm());

Check warning on line 28 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L28

Added line #L28 was not covered by tests

if be_dynamic_imported {
cg.get_async_chunk_for_module(&module.id)

Check warning on line 31 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L30-L31

Added lines #L30 - L31 were not covered by tests
.iter()
.for_each(|chunk| {
let deps_chunks = cg
.installable_descendants_chunk(&chunk.id)

Check warning on line 35 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L33-L35

Added lines #L33 - L35 were not covered by tests
.iter()
.map(|chunk_id| chunk_id.generate(context))
.collect::<Vec<_>>();

Check warning on line 38 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L37-L38

Added lines #L37 - L38 were not covered by tests

chunk_async_map.insert(generate_module_id(&module.id.id, context), deps_chunks);
});

Check warning on line 41 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L40-L41

Added lines #L40 - L41 were not covered by tests
}
});

Check warning on line 43 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L43

Added line #L43 was not covered by tests

Ok(chunk_async_map)
}

Check warning on line 46 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L45-L46

Added lines #L45 - L46 were not covered by tests
Comment on lines +12 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

需要添加单元测试

module_ensure_map 函数实现了核心的映射逻辑,但缺少测试覆盖。建议添加以下测试场景:

  • 正常情况下的模块映射
  • 读取图结构失败的错误处理
  • 动态导入模块的处理
  • 空依赖的边界情况

需要我帮您生成测试用例代码吗?


impl Plugin for CentralChunkEnsure {
fn name(&self) -> &str {

Check warning on line 49 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L49

Added line #L49 was not covered by tests
"dev_ensure2"
}
fn runtime_plugins(&self, context: &Arc<Context>) -> anyhow::Result<Vec<String>> {
let chunk_async_map = module_ensure_map(context)?;

Check warning on line 53 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L51-L53

Added lines #L51 - L53 were not covered by tests

// TODO: compress the map to reduce duplicated chunk ids
let ensure_map = serde_json::to_string(&chunk_async_map)?;

Check warning on line 56 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L56

Added line #L56 was not covered by tests

let runtime = format!(

Check warning on line 58 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L58

Added line #L58 was not covered by tests
r#"
(function(){{
let map = {ensure_map};
requireModule.updateEnsure2Map = function(newMapping) {{
map = newMapping;
}}
requireModule.ensure2 = function(chunkId){{
let toEnsure = map[chunkId];
if (toEnsure) {{
return Promise.all(toEnsure.map(function(c){{ return requireModule.ensure(c); }}))
}}else{{
return Promise.resolve();
}}
}};
}})();
"#
Comment on lines +59 to +74
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

优化 JavaScript 代码质量

JavaScript 代码有以下需要改进的地方:

  1. 拼写错误:updateEnsure2Map
  2. 缺少严格模式声明
  3. 可以使用更现代的语法

建议修改如下:

 r#"
+'use strict';
 (function(){{
   let map = {ensure_map};
-  requireModule.updateEnsure2Map = function(newMapping) {{
+  requireModule.updateEnsure2Map = function(newMapping) {{
     map = newMapping;
   }}
-  requireModule.ensure2 = function(chunkId){{
+  requireModule.ensure2 = async function(chunkId) {{
     let toEnsure = map[chunkId];
-    if (toEnsure) {{
-      return Promise.all(toEnsure.map(function(c){{ return requireModule.ensure(c); }}))
-    }}else{{
-      return Promise.resolve();
-    }}
+    if (!toEnsure) return;
+    return Promise.all(toEnsure.map(c => requireModule.ensure(c)));
   }};
 }})();
 "#
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
r#"
(function(){{
let map = {ensure_map};
requireModule.updateEnsure2Map = function(newMapping) {{
map = newMapping;
}}
requireModule.ensure2 = function(chunkId){{
let toEnsure = map[chunkId];
if (toEnsure) {{
return Promise.all(toEnsure.map(function(c){{ return requireModule.ensure(c); }}))
}}else{{
return Promise.resolve();
}}
}};
}})();
"#
r#"
'use strict';
(function(){{
let map = {ensure_map};
requireModule.updateEnsure2Map = function(newMapping) {{
map = newMapping;
}}
requireModule.ensure2 = async function(chunkId) {{
let toEnsure = map[chunkId];
if (!toEnsure) return;
return Promise.all(toEnsure.map(c => requireModule.ensure(c)));
}};
}})();
"#

);

Ok(vec![runtime])
}

Check warning on line 78 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L77-L78

Added lines #L77 - L78 were not covered by tests

fn hmr_runtime_updates(&self, _context: &Arc<Context>) -> anyhow::Result<Vec<String>> {
let map = module_ensure_map(_context)?;

Check warning on line 81 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L80-L81

Added lines #L80 - L81 were not covered by tests

let update_mapping = format!(

Check warning on line 83 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L83

Added line #L83 was not covered by tests
"runtime.updateEnsure2Map({});",
serde_json::to_string(&map)?

Check warning on line 85 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L85

Added line #L85 was not covered by tests
);

Ok(vec![update_mapping])
}

Check warning on line 89 in crates/mako/src/plugins/central_ensure.rs

View check run for this annotation

Codecov / codecov/patch

crates/mako/src/plugins/central_ensure.rs#L88-L89

Added lines #L88 - L89 were not covered by tests
}
Loading
Loading