Skip to content

Commit

Permalink
Merge branch 'main' into action_scope_0906
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Sep 9, 2024
2 parents 6905655 + 2e42f0b commit d84e516
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ exports[`statsOutput statsOutput/logging-loader should print correct stats for 1
"
`;
exports[`statsOutput statsOutput/match-resource-data-url should print correct stats for 1`] = `
"runtime modules 677 bytes 3 modules
./index.js 150 bytes [built] [code generated]
./a.js!=!data:javascript,var __looooooooo.. 98 bytes [built] [code generated]"
`;
exports[`statsOutput statsOutput/minify-error should print correct stats for 1`] = `
"ERROR in × JavaScript parsing error: Expected a semicolon
╭─[1:8]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import name from "./a.js!=!data:javascript,var __looooooooooooong_variable_name__ = 1;export default __looooooooooooong_variable_name__ != 1;";
name;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @type {import('@rspack/core').RspackOptions}
*/
module.exports = {
entry: "./index.js",
mode: "development",
stats: {
all: false,
modules: true,
}
};
7 changes: 1 addition & 6 deletions packages/rspack/src/loader-runner/loadLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ export default function loadLoader(
(e as NodeJS.ErrnoException).code === "EMFILE"
) {
const retry = loadLoader.bind(null, loader, callback);
if (typeof setImmediate === "function") {
// node >= 0.9.0
return void setImmediate(retry);
}
// node < 0.9.0
return process.nextTick(retry);
return void setImmediate(retry);
}
return callback(e);
}
Expand Down
7 changes: 6 additions & 1 deletion packages/rspack/src/stats/DefaultStatsPrinterPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ const getResourceName = (resource: string) => {
};

const getModuleName = (name: string) => {
const [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(name) || [];
const matchResourceMatch = /^([^!]+)!=!/.exec(name);
const n = matchResourceMatch
? matchResourceMatch[0] +
getResourceName(name.slice(matchResourceMatch[0].length))
: name;
const [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(n) || [];
return [prefix, getResourceName(resource)];
};

Expand Down

0 comments on commit d84e516

Please sign in to comment.