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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"lint:js": "pnpm run lint-ci:js --write",
"lint-ci:js": "biome check --diagnostic-level=warn --no-errors-on-unmatched --max-diagnostics=none --error-on-warnings",
"lint:rs": "cargo clippy --workspace --all-targets",
"lint:type": "rslint --config rslint.json --max-warnings=2486",
"lint:type": "rslint --config rslint.json --max-warnings=2456",
"build:binding:dev": "pnpm --filter @rspack/binding run build:dev",
"build:binding:debug": "pnpm --filter @rspack/binding run build:debug",
"build:binding:ci": "pnpm --filter @rspack/binding run build:ci",
Expand Down Expand Up @@ -101,4 +101,4 @@
"esbuild"
]
}
}
}
33 changes: 15 additions & 18 deletions packages/rspack/etc/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ export class Compilation {
log: liteTapable.SyncBailHook<[string, LogEntry], true>;
additionalAssets: any;
optimizeModules: liteTapable.SyncBailHook<Iterable<Module>, void>;
afterOptimizeModules: liteTapable.SyncHook<Iterable<Module>, void>;
afterOptimizeModules: liteTapable.SyncHook<Iterable<Module>>;
optimizeTree: liteTapable.AsyncSeriesHook<[
Iterable<Chunk>,
Iterable<Module>
Expand All @@ -965,21 +965,18 @@ export class Compilation {
Iterable<Module>
], void>;
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
chunkHash: liteTapable.SyncHook<[Chunk, Hash], void>;
chunkAsset: liteTapable.SyncHook<[Chunk, string], void>;
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
chunkAsset: liteTapable.SyncHook<[Chunk, string]>;
processWarnings: liteTapable.SyncWaterfallHook<[WebpackError_2[]]>;
succeedModule: liteTapable.SyncHook<[Module], void>;
stillValidModule: liteTapable.SyncHook<[Module], void>;
statsPreset: liteTapable.HookMap<liteTapable.SyncHook<[
Partial<StatsOptions>,
CreateStatsOptionsContext
], void>>;
succeedModule: liteTapable.SyncHook<[Module]>;
stillValidModule: liteTapable.SyncHook<[Module]>;
statsPreset: liteTapable.HookMap<liteTapable.SyncHook<[Partial<StatsOptions>, CreateStatsOptionsContext]>>;
statsNormalize: liteTapable.SyncHook<[
Partial<StatsOptions>,
CreateStatsOptionsContext
], void>;
statsFactory: liteTapable.SyncHook<[StatsFactory, StatsOptions], void>;
statsPrinter: liteTapable.SyncHook<[StatsPrinter, StatsOptions], void>;
]>;
statsFactory: liteTapable.SyncHook<[StatsFactory, StatsOptions]>;
statsPrinter: liteTapable.SyncHook<[StatsPrinter, StatsOptions]>;
buildModule: liteTapable.SyncHook<[Module]>;
executeModule: liteTapable.SyncHook<[
ExecuteModuleArgument,
Expand All @@ -988,10 +985,10 @@ export class Compilation {
additionalTreeRuntimeRequirements: liteTapable.SyncHook<[
Chunk,
Set<string>
], void>;
]>;
runtimeRequirementInTree: liteTapable.HookMap<liteTapable.SyncBailHook<[Chunk, Set<string>], void>>;
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
seal: liteTapable.SyncHook<[], void>;
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk]>;
seal: liteTapable.SyncHook<[]>;
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
needAdditionalPass: liteTapable.SyncBailHook<[], boolean>;
}>;
Expand Down Expand Up @@ -1784,7 +1781,7 @@ type DevServerOptions<A extends BasicApplication = BasicApplication, S extends B
open?: string | boolean | Open_2 | (string | Open_2)[] | undefined;
setupExitSignals?: boolean | undefined;
client?: boolean | ClientConfiguration | undefined;
headers?: Headers_2 | ((req: Request_2, res: Response_2, context: DevMiddlewareContext<Request_2, Response_2> | undefined) => Headers_2) | undefined;
headers?: Headers_2 | ((req: Request_2, res: Response_2, context: DevMiddlewareContext | undefined) => Headers_2) | undefined;
onListening?: ((devServer: Server_4) => void) | undefined;
setupMiddlewares?: ((middlewares: DevServerMiddleware[], devServer: Server_4) => DevServerMiddleware[]) | undefined;
};
Expand Down Expand Up @@ -3281,9 +3278,9 @@ type IntermediateFileSystem = InputFileSystem & OutputFileSystem & IntermediateF
type IntermediateFileSystemExtras = {
rename: (arg0: PathLike, arg1: PathLike, arg2: (arg0: null | NodeJS.ErrnoException) => void) => void;
mkdirSync: MkdirSync;
write: Write<Buffer>;
write: Write;
open: Open;
read: Read<Buffer>;
read: Read;
close: (arg0: number, arg1: (arg0: null | NodeJS.ErrnoException) => void) => void;
};

Expand Down
33 changes: 13 additions & 20 deletions packages/rspack/src/Compilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class Compilation {
log: liteTapable.SyncBailHook<[string, LogEntry], true>;
additionalAssets: any;
optimizeModules: liteTapable.SyncBailHook<Iterable<Module>, void>;
afterOptimizeModules: liteTapable.SyncHook<Iterable<Module>, void>;
afterOptimizeModules: liteTapable.SyncHook<Iterable<Module>>;
optimizeTree: liteTapable.AsyncSeriesHook<
[Iterable<Chunk>, Iterable<Module>]
>;
Expand All @@ -227,38 +227,33 @@ export class Compilation {
void
>;
finishModules: liteTapable.AsyncSeriesHook<[Iterable<Module>], void>;
chunkHash: liteTapable.SyncHook<[Chunk, Hash], void>;
chunkAsset: liteTapable.SyncHook<[Chunk, string], void>;
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
chunkAsset: liteTapable.SyncHook<[Chunk, string]>;
processWarnings: liteTapable.SyncWaterfallHook<[WebpackError[]]>;
succeedModule: liteTapable.SyncHook<[Module], void>;
stillValidModule: liteTapable.SyncHook<[Module], void>;
succeedModule: liteTapable.SyncHook<[Module]>;
stillValidModule: liteTapable.SyncHook<[Module]>;

statsPreset: liteTapable.HookMap<
liteTapable.SyncHook<
[Partial<StatsOptions>, CreateStatsOptionsContext],
void
>
liteTapable.SyncHook<[Partial<StatsOptions>, CreateStatsOptionsContext]>
>;
statsNormalize: liteTapable.SyncHook<
[Partial<StatsOptions>, CreateStatsOptionsContext],
void
[Partial<StatsOptions>, CreateStatsOptionsContext]
>;
statsFactory: liteTapable.SyncHook<[StatsFactory, StatsOptions], void>;
statsPrinter: liteTapable.SyncHook<[StatsPrinter, StatsOptions], void>;
statsFactory: liteTapable.SyncHook<[StatsFactory, StatsOptions]>;
statsPrinter: liteTapable.SyncHook<[StatsPrinter, StatsOptions]>;

buildModule: liteTapable.SyncHook<[Module]>;
executeModule: liteTapable.SyncHook<
[ExecuteModuleArgument, ExecuteModuleContext]
>;
additionalTreeRuntimeRequirements: liteTapable.SyncHook<
[Chunk, Set<string>],
void
[Chunk, Set<string>]
>;
runtimeRequirementInTree: liteTapable.HookMap<
liteTapable.SyncBailHook<[Chunk, Set<string>], void>
>;
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
seal: liteTapable.SyncHook<[], void>;
runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk]>;
seal: liteTapable.SyncHook<[]>;
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
needAdditionalPass: liteTapable.SyncBailHook<[], boolean>;
}>;
Expand Down Expand Up @@ -1237,9 +1232,7 @@ export class Entries implements Map<string, EntryData> {
return this.entries();
}

get [Symbol.toStringTag](): string {
return "Map";
}
readonly [Symbol.toStringTag] = "Map";

has(key: string): boolean {
return this.#data.has(key);
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/config/devServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export type DevServerOptions<
| ((
req: Request,
res: Response,
context: DevMiddlewareContext<Request, Response> | undefined
context: DevMiddlewareContext | undefined
) => Headers)
| undefined;
onListening?: ((devServer: Server) => void) | undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/loader-runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ export async function runLoaders(
});
Object.defineProperty(loaderContext, "cacheable", {
enumerable: true,
get: () => (cacheable: boolean) => {
get: () => (cacheable?: boolean) => {
if (cacheable === false) {
context.cacheable = cacheable;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/rspack/src/loader-runner/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ export const run = async (
}
});
mainPort.on("messageerror", handleError);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
mainSyncPort.on("message", async (message: WorkerRequestSyncMessage) => {
const sharedBuffer = message.sharedBuffer;
const { sharedBuffer } = message;
const sharedBufferView = new Int32Array(sharedBuffer);

let result: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/loader-runner/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ async function loaderImpl(
return options;
};

loaderContext.cacheable = function cacheable(flag: boolean) {
loaderContext.cacheable = function cacheable(flag?: boolean) {
if (flag === false) {
sendRequest(RequestType.SetCacheable, false);
}
Expand Down
7 changes: 2 additions & 5 deletions packages/rspack/src/stats/StatsPrinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ export type StatsPrinterContext = KnownStatsPrinterContext &
Record<string, any>;

export class StatsPrinter {
private _levelHookCache: Map<
HookMap<Hook<any, any>>,
Map<string, Hook<any, any>[]>
>;
private _levelHookCache: Map<HookMap<Hook>, Map<string, Hook[]>>;
private _inPrint: boolean;

hooks: Readonly<{
Expand Down Expand Up @@ -133,7 +130,7 @@ export class StatsPrinter {
/**
* get all level hooks
*/
private _getAllLevelHooks<T extends Hook<any, any>>(
private _getAllLevelHooks<T extends Hook>(
hookMap: HookMap<T>,
type: string
): T[] {
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/util/SizeFormatHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

export const formatSize = (size: unknown) => {
if (typeof size !== "number" || Number.isNaN(size) === true) {
if (typeof size !== "number" || Number.isNaN(size)) {
return "unknown size";
}

Expand Down
4 changes: 2 additions & 2 deletions packages/rspack/src/util/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ export type IntermediateFileSystemExtras = {
arg2: (arg0: null | NodeJS.ErrnoException) => void
) => void;
mkdirSync: MkdirSync;
write: Write<Buffer>;
write: Write;
open: Open;
read: Read<Buffer>;
read: Read;
close: (
arg0: number,
arg1: (arg0: null | NodeJS.ErrnoException) => void
Expand Down
4 changes: 0 additions & 4 deletions rslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-type-assertion": "warn",
"@typescript-eslint/restrict-template-expressions": "warn",
"@typescript-eslint/no-unnecessary-type-arguments": "warn",
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-confusing-void-expression": "warn",
"@typescript-eslint/promise-function-async": "warn",
Expand All @@ -31,11 +30,9 @@
"@typescript-eslint/await-thenable": "warn",
"@typescript-eslint/return-await": "warn",
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/no-misused-spread": "warn",
"@typescript-eslint/unbound-method": "warn",
"@typescript-eslint/prefer-promise-reject-errors": "warn",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
"@typescript-eslint/no-implied-eval": "warn",
"@typescript-eslint/no-unused-vars": [
Expand All @@ -44,7 +41,6 @@
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/class-literal-property-style": "warn",
"@typescript-eslint/no-var-requires": "warn",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-empty-function": "warn",
Expand Down
Loading