Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve types for webpack-sources #16805

Merged
merged 1 commit into from
Mar 14, 2023
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
12 changes: 11 additions & 1 deletion declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 10 additions & 1 deletion types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8934,6 +8934,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;
Expand Down Expand Up @@ -10643,7 +10652,7 @@ declare abstract class SortableSet<T> extends Set<T> {
declare class Source {
constructor();
size(): number;
map(options?: MapOptions): Object;
map(options?: MapOptions): null | RawSourceMap;
TheLarkInn marked this conversation as resolved.
Show resolved Hide resolved
sourceAndMap(options?: MapOptions): { source: string | Buffer; map: Object };
updateHash(hash: Hash): void;
source(): string | Buffer;
Expand Down