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:
commit
796b51175c
|
@ -246,10 +246,20 @@ declare module "@webassemblyjs/ast" {
|
||||||
declare module "webpack-sources" {
|
declare module "webpack-sources" {
|
||||||
export type MapOptions = { columns?: boolean; module?: boolean };
|
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 {
|
export abstract class Source {
|
||||||
size(): number;
|
size(): number;
|
||||||
|
|
||||||
map(options?: MapOptions): Object;
|
map(options?: MapOptions): RawSourceMap | null;
|
||||||
|
|
||||||
sourceAndMap(options?: MapOptions): {
|
sourceAndMap(options?: MapOptions): {
|
||||||
source: string | Buffer;
|
source: string | Buffer;
|
||||||
|
|
|
@ -9358,6 +9358,15 @@ declare class RawSource extends Source {
|
||||||
constructor(source: string | Buffer, convertToString?: boolean);
|
constructor(source: string | Buffer, convertToString?: boolean);
|
||||||
isBuffer(): boolean;
|
isBuffer(): boolean;
|
||||||
}
|
}
|
||||||
|
declare interface RawSourceMap {
|
||||||
|
version: number;
|
||||||
|
sources: string[];
|
||||||
|
names: string[];
|
||||||
|
sourceRoot?: string;
|
||||||
|
sourcesContent?: string[];
|
||||||
|
mappings: string;
|
||||||
|
file: string;
|
||||||
|
}
|
||||||
declare class ReadFileCompileWasmPlugin {
|
declare class ReadFileCompileWasmPlugin {
|
||||||
constructor(options?: any);
|
constructor(options?: any);
|
||||||
options: any;
|
options: any;
|
||||||
|
@ -11104,7 +11113,7 @@ declare abstract class SortableSet<T> extends Set<T> {
|
||||||
declare class Source {
|
declare class Source {
|
||||||
constructor();
|
constructor();
|
||||||
size(): number;
|
size(): number;
|
||||||
map(options?: MapOptions): Object;
|
map(options?: MapOptions): null | RawSourceMap;
|
||||||
sourceAndMap(options?: MapOptions): { source: string | Buffer; map: Object };
|
sourceAndMap(options?: MapOptions): { source: string | Buffer; map: Object };
|
||||||
updateHash(hash: Hash): void;
|
updateHash(hash: Hash): void;
|
||||||
source(): string | Buffer;
|
source(): string | Buffer;
|
||||||
|
|
Loading…
Reference in New Issue