Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Jan 11, 2024
1 parent 971fa85 commit d4387d3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions crates/rspack_core/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ pub fn resolve_for_error_hints(
return Some(format!("Did you mean '{}'?
The request '{}' failed to resolve only because it was resolved as fully specified,
probably because the origin '{}' is strict EcmaScript Module,
probably because the origin is strict EcmaScript Module,
e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\"type\": \"module\"'.
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.", suggestion, args.specifier, args.issuer.unwrap_or_default()));
Add the extension to the request.", suggestion, args.specifier));
}
Err(_) => return None,
_ => {}
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_error/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ impl Diagnostic {

impl Diagnostic {
pub fn render_report(&self, colored: bool) -> crate::Result<String> {
let mut buf = String::new();
let h = GraphicalReportHandler::new()
.with_theme(if colored {
GraphicalTheme::unicode()
} else {
GraphicalTheme::unicode_nocolor()
})
.with_context_lines(2);
let mut buf = String::new();
h.render_report(&mut buf, self.as_ref()).into_diagnostic()?;
Ok(buf)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"build": "tsc -b ./tsconfig.build.json",
"dev": "tsc -w",
"test": "cross-env NO_COLOR=1 RSPACK_DEP_WARNINGS=false node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --testPathIgnorePatterns \".diff.test.ts\" --runInBand --logHeapUsage"
"test": "cross-env NO_COLOR=1 RSPACK_DEP_WARNINGS=false node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --testPathIgnorePatterns \".diff.test.ts\" --runInBand --logHeapUsage diagnostic"
},
"files": [
"dist"
Expand Down
18 changes: 9 additions & 9 deletions packages/rspack/tests/__snapshots__/StatsTestCases.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ exports[`StatsTestCases should print correct stats for hot+production 1`] = `
"hotModuleReplacement": false,
},
"name": "bundle.js",
"size": 9038,
"size": 9108,
"type": "asset",
},
],
Expand Down Expand Up @@ -894,10 +894,10 @@ exports[`StatsTestCases should print correct stats for hot+production 1`] = `
"assets": [
{
"name": "bundle.js",
"size": 9038,
"size": 9108,
},
],
"assetsSize": 9038,
"assetsSize": 9108,
"chunks": [
"909",
],
Expand All @@ -907,7 +907,7 @@ exports[`StatsTestCases should print correct stats for hot+production 1`] = `
"errors": [],
"errorsCount": 0,
"filteredModules": undefined,
"hash": "d938674585ad9aa214d9",
"hash": "5f9f75789352d7c6b706",
"logging": {},
"modules": [
{
Expand Down Expand Up @@ -1065,10 +1065,10 @@ exports[`StatsTestCases should print correct stats for hot+production 1`] = `
"assets": [
{
"name": "bundle.js",
"size": 9038,
"size": 9108,
},
],
"assetsSize": 9038,
"assetsSize": 9108,
"chunks": [
"909",
],
Expand All @@ -1084,8 +1084,8 @@ exports[`StatsTestCases should print correct stats for hot+production 1`] = `

exports[`StatsTestCases should print correct stats for hot+production 2`] = `
"PublicPath: (none)
asset bundle.js 8.83 KiB {909} [emitted] (name: main)
Entrypoint main 8.83 KiB = bundle.js
asset bundle.js 8.89 KiB {909} [emitted] (name: main)
Entrypoint main 8.89 KiB = bundle.js
chunk {909} bundle.js (main) [entry]
./index.js [10] {909}
entry ./index.js
Expand All @@ -1098,7 +1098,7 @@ webpack/runtime/hot_module_replacement {909}
webpack/runtime/get_chunk_update_filename {909}
webpack/runtime/get_main_filename/update manifest {909}
Rspack compiled successfully (d938674585ad9aa214d9)"
Rspack compiled successfully (5f9f75789352d7c6b706)"
`;

exports[`StatsTestCases should print correct stats for identifier-let-strict-mode 1`] = `
Expand Down
1 change: 1 addition & 0 deletions packages/rspack/tests/diagnostics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe("Diagnostics", function () {
const updateSnapshot =
process.argv.includes("-u") ||
process.argv.includes("--updateSnapshot");
console.log(output);
if (!fs.existsSync(errorOutputPath) || updateSnapshot) {
fs.writeFileSync(errorOutputPath, output);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ERROR in ./index.js
help: Did you mean './foo.js'?

The request './foo' failed to resolve only because it was resolved as fully specified,
probably because the origin '<PROJECT_ROOT>/tests/diagnostics/factorize/fully-specified-resolve-suggestions/index.js' is strict EcmaScript Module,
probably because the origin is strict EcmaScript Module,
e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'.

The extension in the request is mandatory for it to be fully specified.
Expand Down

0 comments on commit d4387d3

Please sign in to comment.