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 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=2278",
"lint:type": "rslint --config rslint.json --max-warnings=2281",
"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
44 changes: 44 additions & 0 deletions packages/rspack/etc/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,14 @@ function createNativePlugin<T extends any[], R>(name: CustomPluginName, resolve:
};
};

// @public (undocumented)
type CreateReadStream = (path: PathLike, options?: NodeJS.BufferEncoding | ReadStreamOptions) => NodeJS.ReadableStream;

// @public (undocumented)
type CreateReadStreamFSImplementation = FSImplementation & {
read: (...args: any[]) => any;
};

// @public (undocumented)
type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<string, any>;

Expand Down Expand Up @@ -2803,6 +2811,14 @@ interface ForStatement extends Node_4, HasSpan {
update?: Expression;
}

// @public (undocumented)
interface FSImplementation {
// (undocumented)
close?: (...args: any[]) => any;
// (undocumented)
open?: (...args: any[]) => any;
}

// @public (undocumented)
interface FunctionDeclaration extends Fn {
// (undocumented)
Expand Down Expand Up @@ -5381,6 +5397,8 @@ export interface OutputFileSystem {
// (undocumented)
chmod: (arg0: string, arg1: number, arg2: (arg0?: NodeJS.ErrnoException | null) => void) => void;
// (undocumented)
createReadStream?: CreateReadStream;
// (undocumented)
dirname?: (arg0: string) => string;
// (undocumented)
join?: (arg0: string, arg1: string) => string;
Expand Down Expand Up @@ -5971,6 +5989,12 @@ type ReadlinkSync = {
// @public (undocumented)
type ReadStream = ReadStream_2;

// @public (undocumented)
type ReadStreamOptions = StreamOptions & {
fs?: null | CreateReadStreamFSImplementation;
end?: number;
};

// @public (undocumented)
type RealPath = {
(path: PathLike, options: EncodingOption, callback: StringCallback): void;
Expand Down Expand Up @@ -7566,6 +7590,26 @@ type StatSyncOptions = {
throwIfNoEntry?: boolean;
};

// @public (undocumented)
interface StreamOptions {
// (undocumented)
autoClose?: boolean;
// (undocumented)
emitClose?: boolean;
// (undocumented)
encoding?: NodeJS.BufferEncoding;
// (undocumented)
fd?: any;
// (undocumented)
flags?: string;
// (undocumented)
mode?: number;
// (undocumented)
signal?: null | AbortSignal;
// (undocumented)
start?: number;
}

// @public
export type StrictModuleErrorHandling = boolean;

Expand Down
31 changes: 31 additions & 0 deletions packages/rspack/src/util/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,36 @@ interface IDirent {
name: string | Buffer;
}

export interface StreamOptions {
flags?: string;
encoding?: NodeJS.BufferEncoding;
fd?: any;
mode?: number;
autoClose?: boolean;
emitClose?: boolean;
start?: number;
signal?: null | AbortSignal;
}

export interface FSImplementation {
open?: (...args: any[]) => any;
close?: (...args: any[]) => any;
}

export type CreateReadStreamFSImplementation = FSImplementation & {
read: (...args: any[]) => any;
};

export type ReadStreamOptions = StreamOptions & {
fs?: null | CreateReadStreamFSImplementation;
end?: number;
};

export type CreateReadStream = (
path: PathLike,
options?: NodeJS.BufferEncoding | ReadStreamOptions
) => NodeJS.ReadableStream;

export interface OutputFileSystem {
writeFile: (
arg0: string | number,
Expand Down Expand Up @@ -122,6 +152,7 @@ export interface OutputFileSystem {
join?: (arg0: string, arg1: string) => string;
relative?: (arg0: string, arg1: string) => string;
dirname?: (arg0: string) => string;
createReadStream?: CreateReadStream;
}

export type JsonPrimitive = string | number | boolean | null;
Expand Down
Loading