Skip to content

Commit

Permalink
chore: fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
shulaoda committed Jul 31, 2024
1 parent 64f18cd commit 40875f0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
3 changes: 1 addition & 2 deletions packages/rspack-dev-server/src/ansiHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ export default function ansiHTML(text: string) {
)(ansiCodes);
}
// If current sequence has been opened, close it.
if (~ansiCodes.indexOf(seq)) {
// eslint-disable-line no-extra-boolean-cast
if (ansiCodes.indexOf(seq) !== -1) {
ansiCodes.pop();
return "</span>";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export function getAdditionalEntries({
devServer: any;
options: NormalizedPluginOptions;
}): AdditionalEntries {
/** @type {Record<string, string | number>} */
const resourceQuery: Record<string, string | number> = {};

if (devServer) {
Expand Down Expand Up @@ -78,12 +77,8 @@ export function getAdditionalEntries({
undefined,
undefined,
{
/**
* @param {string} string
* @returns {string}
*/
encodeURIComponent(string) {
return string;
encodeURIComponent(str: string): string {
return str;
}
}
);
Expand All @@ -95,7 +90,8 @@ export function getAdditionalEntries({

const overlayEntries = [
// Error overlay runtime
options.overlay?.entry &&
options.overlay !== false &&
options.overlay?.entry &&
`${require.resolve(options.overlay.entry)}${queryString ? `?${queryString}` : ""}`
].filter(Boolean) as string[];

Expand Down
3 changes: 0 additions & 3 deletions packages/rspack/etc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4428,7 +4428,6 @@ export const javascript: JavaScript;

// @public (undocumented)
class JavascriptModulesPlugin extends RspackBuiltinPlugin {
constructor();
// (undocumented)
affectedHooks: "compilation";
// (undocumented)
Expand Down Expand Up @@ -12803,7 +12802,6 @@ export const rspackOptions: z.ZodObject<{

// @public (undocumented)
class RspackOptionsApply {
constructor();
// (undocumented)
process(options: RspackOptionsNormalized, compiler: Compiler): void;
}
Expand Down Expand Up @@ -14513,7 +14511,6 @@ export const WebpackError: ErrorConstructor;
class WebpackError_2 extends Error {
// (undocumented)
[inspect.custom](): string;
constructor(message?: string);
// (undocumented)
chunk?: Chunk;
// (undocumented)
Expand Down
1 change: 0 additions & 1 deletion packages/rspack/src/Module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type {
JsCodegenerationResult,
JsCodegenerationResults,
JsCreateData,
JsFactoryMeta,
JsModule
Expand Down
7 changes: 4 additions & 3 deletions packages/rspack/src/util/smartGrouping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,16 @@ export const smartGrouping = <T, R>(
) || false;
}

const force = options?.force;
const force = options !== false && options.force;
if (!force) {
if (bestGroupOptions?.force) continue;
if (bestGroupOptions !== false && bestGroupOptions?.force) continue;
if (used) continue;
if (items.size <= 1 || totalSize - items.size <= 1) {
continue;
}
}
const targetGroupCount = options?.targetGroupCount || 4;
const targetGroupCount =
(options !== false && options.targetGroupCount) || 4;
const sizeValue = force
? items.size
: Math.min(
Expand Down

0 comments on commit 40875f0

Please sign in to comment.