Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion CHANGELOG_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
`2024-06-26`

- 改进 module concatenate 实现,合并后的模块仍然支持 Shared Reference by [@stormslowly](https://github.com/stormslowly) in [#1295](https://github.com/umijs/mako/pull/1295)
- 修复 hmr http 响应未设置 content-typ 导致乱码问题 by [@whyer11](https://github.com/whyer11) in [#1307](https://github.com/umijs/mako/pull/1307)
- 修复 hmr http 响应未设置 content-type 导致乱码问题 by [@whyer11](https://github.com/whyer11) in [#1307](https://github.com/umijs/mako/pull/1307)

## 0.7.1

Expand Down
59 changes: 26 additions & 33 deletions crates/binding/src/js_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,38 +257,31 @@ impl Plugin for JsPlugin {

fn before_rebuild(&self, paths: Vec<PathBuf>) -> Result<Vec<PathBuf>> {
// TODO: 临时方案,出于热更性能考虑只在less/sass文件变动时调用js-hook,后续优化。
let mut has_less_or_sass = false;
for path in &paths {
if path
.extension()
.map(|ext| ext == "less" || ext == "scss")
.unwrap_or(false)
{
has_less_or_sass = true;
break;
}
}
if !has_less_or_sass {
return Ok(paths);
}

if let Some(hook) = &self.hooks.before_rebuild {
let result: Option<Vec<String>> = match hook.call((
(),
paths
.iter()
.map(|p| p.to_string_lossy().to_string())
.collect(),
)) {
Ok(res) => res,
Err(_) => return Ok(paths),
};

if let Some(result) = result {
return Ok(result.iter().map(PathBuf::from).collect());
}
}

Ok(paths)
let (less_or_sass, others): (Vec<PathBuf>, Vec<PathBuf>) = paths
.into_iter()
.partition(|p| p.extension().is_some_and(|p| p == "less" || p == "sass"));
Ok([
match &self.hooks.before_rebuild {
Some(hook) => {
match hook.call((
(),
less_or_sass
.iter()
.map(|p| p.to_string_lossy().to_string())
.collect(),
)) {
Ok(paths) => paths.map_or(less_or_sass, |paths| {
paths.iter().map(PathBuf::from).collect()
}),
Err(_) => less_or_sass,
}
}
None => less_or_sass,
},
others,
]
.into_iter()
.flatten()
.collect())
}
}
4 changes: 2 additions & 2 deletions e2e/fixtures/javascript.typescript/src/ts-advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ type example = NonNullable<string | number | undefined>;
// Parameters & ReturnType
type IFoo = (
uname: string,
uage: number
usage: number
) => {
name: string;
age: number;
};

//参数类型
type Ibar = Parameters<IFoo>;
// type Ibar = [uname: string, uage: number]
// type Ibar = [uname: string, usage: number]

type T_RT = ReturnType<IFoo>;
// type T_RT = {
Expand Down
2 changes: 1 addition & 1 deletion e2e/fixtures/module-federation.producer/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const manifest = JSON.parse(files["mf-manifest.json"]);

assert(
manifest.metaData.remoteEntry.name === 'remoteEntry.js',
"should generate mf contanier entry"
"should generate mf container entry"
)

assert(
Expand Down
Loading