Merge pull request #16805 from snitin315/fix/improve-source-types

Improve types for `webpack-sources` to match in webpack core.
This commit is contained in:
Sean Larkin 2023-03-14 08:58:36 -07:00 committed by GitHub
commit 796b51175c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

12
declarations.d.ts vendored
View File

@ -246,10 +246,20 @@ declare module "@webassemblyjs/ast" {
declare module "webpack-sources" {
export type MapOptions = { columns?: boolean; module?: boolean };
export type RawSourceMap = {
version: number;
sources: string[];
names: string[];
sourceRoot?: string;
sourcesContent?: string[];
mappings: string;
file: string;
};
export abstract class Source {
size(): number;
map(options?: MapOptions): Object;
map(options?: MapOptions): RawSourceMap | null;
sourceAndMap(options?: MapOptions): {
source: string | Buffer;

11
types.d.ts vendored
View File

@ -9358,6 +9358,15 @@ declare class RawSource extends Source {
constructor(source: string | Buffer, convertToString?: boolean);
isBuffer(): boolean;
}
declare interface RawSourceMap {
version: number;
sources: string[];
names: string[];
sourceRoot?: string;
sourcesContent?: string[];
mappings: string;
file: string;
}
declare class ReadFileCompileWasmPlugin {
constructor(options?: any);
options: any;
@ -11104,7 +11113,7 @@ declare abstract class SortableSet<T> extends Set<T> {
declare class Source {
constructor();
size(): number;
map(options?: MapOptions): Object;
map(options?: MapOptions): null | RawSourceMap;
sourceAndMap(options?: MapOptions): { source: string | Buffer; map: Object };
updateHash(hash: Hash): void;
source(): string | Buffer;