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.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#### :bug: Bug fix

- Fix rewatch swallowing parse warnings (%todo). https://github.com/rescript-lang/rescript/pull/8135
- Rewatch: log errors to `stderr`. https://github.com/rescript-lang/rescript/pull/8147
- Rewatch: log errors and warnings to `stderr`. https://github.com/rescript-lang/rescript/pull/8147 https://github.com/rescript-lang/rescript/pull/8148

#### :memo: Documentation

Expand Down
12 changes: 6 additions & 6 deletions rewatch/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ pub fn incremental_build(
}
}
if helpers::contains_ascii_characters(&parse_warnings) {
println!("{}", &parse_warnings);
eprintln!("{}", &parse_warnings);
}

mark_modules_with_expired_deps_dirty(build_state);
Expand Down Expand Up @@ -371,7 +371,7 @@ pub fn incremental_build(
}
}
if helpers::contains_ascii_characters(&compile_warnings) {
println!("{}", &compile_warnings);
eprintln!("{}", &compile_warnings);
}
if initial_build {
log_config_warnings(build_state);
Expand Down Expand Up @@ -400,7 +400,7 @@ pub fn incremental_build(
}

if helpers::contains_ascii_characters(&compile_warnings) {
println!("{}", &compile_warnings);
eprintln!("{}", &compile_warnings);
}
if initial_build {
log_config_warnings(build_state);
Expand Down Expand Up @@ -451,21 +451,21 @@ fn log_deprecated_config_field(package_name: &str, field_name: &str, new_field_n
"The field '{field_name}' found in the package config of '{package_name}' is deprecated and will be removed in a future version.\n\
Use '{new_field_name}' instead."
);
println!("\n{}", style(warning).yellow());
eprintln!("\n{}", style(warning).yellow());
}

fn log_unsupported_config_field(package_name: &str, field_name: &str) {
let warning = format!(
"The field '{field_name}' found in the package config of '{package_name}' is not supported by ReScript 12's new build system."
);
println!("\n{}", style(warning).yellow());
eprintln!("\n{}", style(warning).yellow());
}

fn log_unknown_config_field(package_name: &str, field_name: &str) {
let warning = format!(
"Unknown field '{field_name}' found in the package config of '{package_name}'. This option will be ignored."
);
println!("\n{}", style(warning).yellow());
eprintln!("\n{}", style(warning).yellow());
}

// write build.ninja files in the packages after a non-incremental build
Expand Down
7 changes: 3 additions & 4 deletions rewatch/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,9 @@ impl log::Log for SplitLogger {
}

fn log(&self, record: &log::Record) {
if record.level() == log::Level::Error {
self.stderr.log(record);
} else {
self.stdout.log(record);
match record.level() {
log::Level::Error | log::Level::Warn => self.stderr.log(record),
_ => self.stdout.log(record),
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/build_tests/build_warn_as_error/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const o1 = await execBuild();
// biome-ignore lint/suspicious/noControlCharactersInRegex: strip ANSI color codes from output
const stripAnsi = s => s.replace(/\x1b\[[0-9;]*m/g, "");

const first_message = stripAnsi(o1.stdout)
const first_message = stripAnsi(o1.stderr)
.split("\n")
.map(s => s.trim())
.find(s => s === "Warning number 110");
Expand Down
Loading