@types/webpack-sources
Advanced tools
Comparing version 0.1.7 to 1.4.0
@@ -1,5 +0,6 @@ | ||
// Type definitions for webpack-sources 0.1 | ||
// Type definitions for webpack-sources 1.4 | ||
// Project: https://github.com/webpack/webpack-sources | ||
// Definitions by: e-cloud <https://github.com/e-cloud> | ||
// Chris Eppstein <https://github.com/chriseppstein> | ||
// Piotr Błażejewicz <https://github.com/peterblazejewicz> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -13,74 +14,108 @@ | ||
export abstract class Source { | ||
size(): number; | ||
export interface MapOptions { | ||
/** | ||
* If set to false the implementation may omit mappings for columns | ||
* @default true | ||
*/ | ||
columns?: boolean; | ||
/** | ||
* If set to false the implementation may omit inner mappings for modules. | ||
* @default true | ||
*/ | ||
module?: boolean; | ||
} | ||
map(options?: any): any; | ||
export interface SourceAndMapResult { | ||
source: string; | ||
map: RawSourceMap | null; | ||
} | ||
sourceAndMap(options?: any): { | ||
source: string; | ||
map: RawSourceMap; | ||
}; | ||
/** | ||
* Base class for all sources. | ||
* A Source can be asked for source code, size, source map and hash. | ||
*/ | ||
export abstract class Source { | ||
/** | ||
* Returns the represented source code as string. | ||
*/ | ||
source(options: MapOptions): string | ArrayBuffer; | ||
updateHash(hash: Hash): void; | ||
/** | ||
* Returns the size in chars of the represented source code. | ||
*/ | ||
size(): number; | ||
source(options?: any): string; | ||
/** | ||
* Returns the SourceMap of the represented source code as JSON. | ||
* May return `null` if no SourceMap is available. | ||
*/ | ||
map(options: MapOptions): RawSourceMap | null; | ||
node(options?: any): any; | ||
/** | ||
* Returns both, source code (like `Source.prototype.source()` and SourceMap (like `Source.prototype.map()`). | ||
* This method could have better performance than calling `source()` and `map()` separately. | ||
*/ | ||
sourceAndMap(options: MapOptions): SourceAndMapResult; | ||
listNode(options?: any): any; | ||
/** | ||
* This is an optional method. It may be null if not implemented. | ||
* Returns a SourceNode (see source-map library) for the represented source code. | ||
*/ | ||
node(options: MapOptions): SourceNode; | ||
listMap(options?: any): any; | ||
/** | ||
* This is an optional method. It may be null if not implemented. | ||
* Returns a SourceListMap (see source-list-map library) for the represented source code. | ||
*/ | ||
listNode(options: MapOptions): SourceListMap; | ||
/** | ||
* Updates the provided Hash object with the content of the represented source code. | ||
* (Hash is an object with an update method, which is called with string values) | ||
*/ | ||
updateHash(hash: Hash): void; | ||
} | ||
export interface SourceAndMapMixin { | ||
map(options: { columns?: boolean }): RawSourceMap; | ||
sourceAndMap(options: { columns?: boolean }): { | ||
source: string; | ||
map: RawSourceMap; | ||
}; | ||
/** | ||
* Returns the SourceMap of the represented source code as JSON. | ||
* May return `null` if no SourceMap is available. | ||
*/ | ||
map(options?: MapOptions): RawSourceMap | null; | ||
/** | ||
* Returns both, source code (like `Source.prototype.source()` and SourceMap (like `Source.prototype.map()`). | ||
* This method could have better performance than calling `source()` and `map()` separately. | ||
*/ | ||
sourceAndMap(options?: MapOptions): SourceAndMapResult; | ||
} | ||
/** | ||
* Decorates a Source and caches returned results of map, source, size and sourceAndMap in memory. | ||
* Every other operation is delegated to the wrapped Source. | ||
*/ | ||
export class CachedSource extends Source { | ||
_source: Source; | ||
_cachedSource: string; | ||
_cachedSize: number; | ||
_cachedMaps: { | ||
[prop: string]: RawSourceMap | ||
}; | ||
constructor(source: Source); | ||
source(): string; | ||
source(): string | ArrayBuffer; | ||
size(): number; | ||
node(options: any): SourceNode; | ||
listMap(options: any): SourceListMap; | ||
sourceAndMap(options: any): { | ||
source: string; | ||
map: RawSourceMap; | ||
}; | ||
map(options: any): RawSourceMap; | ||
sourceAndMap(options: MapOptions): SourceAndMapResult; | ||
map(options: MapOptions): RawSourceMap; | ||
updateHash(hash: Hash): void; | ||
} | ||
/** | ||
* Concatenate multiple Sources or strings to a single source. | ||
*/ | ||
export class ConcatSource extends Source implements SourceAndMapMixin { | ||
children: Array<(string | Source)>; | ||
children: Array<string | Source>; | ||
constructor(...args: Array<(string | Source)>); | ||
constructor(...args: Array<string | Source>); | ||
/** | ||
* Adds an item to the source. | ||
*/ | ||
add(item: string | Source): void; | ||
source(): string; | ||
size(): number; | ||
node(options: any): SourceNode; | ||
listMap(options: any): SourceListMap; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
updateHash(hash: Hash): void; | ||
@@ -90,123 +125,99 @@ } | ||
export class LineToLineMappedSource extends Source implements SourceAndMapMixin { | ||
_value: string; | ||
_name: string; | ||
_originalSource: string; | ||
constructor(sourceCode: string, name: string, originalSource: string); | ||
constructor(value: string, name: string, originalSource: string); | ||
source(): string; | ||
node(options: any): SourceNode; | ||
listMap(options: any): SourceListMap; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
updateHash(hash: Hash): void; | ||
} | ||
/** | ||
* Represents source code, which is a copy of the original file | ||
*/ | ||
export class OriginalSource extends Source implements SourceAndMapMixin { | ||
_value: string; | ||
_name: string; | ||
constructor(value: string, name: string); | ||
/** | ||
* OriginalSource tries to create column mappings if requested, by splitting the source code at typical statement borders (;, {, }). | ||
*/ | ||
constructor(sourceCode: string, name: string); | ||
source(): string; | ||
node( | ||
options?: { | ||
columns?: boolean; | ||
} | ||
): SourceNode; | ||
listMap(options: any): SourceListMap; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
updateHash(hash: Hash): void; | ||
} | ||
/** | ||
* Prefix every line of the decorated Source with a provided string. | ||
*/ | ||
export class PrefixSource extends Source implements SourceAndMapMixin { | ||
_source: Source | string; | ||
_prefix: Source | string; | ||
constructor(prefix: Source | string, source: Source | string); | ||
source(): string; | ||
node(options: any): SourceNode; | ||
listMap(options: any): SourceListMap; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
updateHash(hash: Hash): void; | ||
} | ||
/** | ||
* Represents source code without SourceMap | ||
*/ | ||
export class RawSource extends Source { | ||
_value: string; | ||
constructor(value: string); | ||
source(): string; | ||
map(options: any): null; | ||
node(options: any): SourceNode; | ||
listMap(options: any): SourceListMap; | ||
map(options: MapOptions): null; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
updateHash(hash: Hash): void; | ||
} | ||
export interface Replacement { | ||
readonly start: number; | ||
readonly end: number; | ||
readonly content: string; | ||
readonly insertIndex: number; | ||
readonly name: string; | ||
} | ||
/** | ||
* Decorates a Source with replacements and insertions of source code. | ||
* | ||
*/ | ||
export class ReplaceSource extends Source implements SourceAndMapMixin { | ||
_source: Source; | ||
_name: string; | ||
replacements: any[][]; | ||
replacements: Replacement[]; | ||
/** | ||
* The ReplaceSource supports "identity" mappings for child source. | ||
* When original source matches generated source for a mapping it's assumed to be mapped char by char allowing to split mappings at replacements/insertions. | ||
*/ | ||
constructor(source: Source, name?: string); | ||
replace(start: number, end: number, newValue: string): void; | ||
insert(pos: number, newValue: string): void; | ||
/** | ||
* Replaces chars from start (0-indexed, inclusive) to end (0-indexed, inclusive) with replacement. | ||
*/ | ||
replace(start: number, end: number, newValue: string, name: string): void; | ||
/** | ||
* Inserts the insertion before char pos (0-indexed). | ||
*/ | ||
insert(pos: number, newValue: string, name: string): void; | ||
/** | ||
* Get decorated Source. | ||
*/ | ||
original(): Source; | ||
source(): string; | ||
_sortReplacements(): void; | ||
_replaceString(str: string): string; | ||
node(options: any): SourceNode; | ||
listMap(options: any): SourceListMap; | ||
_replacementToSourceNode(oldNode: SourceNode, newString: string): string | SourceNode; | ||
_splitSourceNode(node: SourceNode, position: SourceNode[]): SourceNode[]; | ||
_splitSourceNode(node: string, position: number): number; | ||
_splitString(str: string, position: number): string[]; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
} | ||
/** | ||
* Represents source code with SourceMap, optionally having an additional SourceMap for the original source. | ||
*/ | ||
export class SourceMapSource extends Source implements SourceAndMapMixin { | ||
_value: string; | ||
_name: string; | ||
_sourceMap: SourceMapGenerator | RawSourceMap; | ||
_originalSource: string; | ||
_innerSourceMap: RawSourceMap; | ||
constructor( | ||
value: string, | ||
sourceCode: string, | ||
name: string, | ||
sourceMap: SourceMapGenerator | RawSourceMap, | ||
originalSource?: string, | ||
innerSourceMap?: RawSourceMap, | ||
innerSourceMap?: RawSourceMap | string, | ||
removeOriginalSource?: boolean, | ||
); | ||
source(): string; | ||
node(): SourceNode; | ||
listMap( | ||
options: { | ||
module?: boolean; | ||
} | ||
): SourceListMap; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
updateHash(hash: Hash): void; | ||
} |
{ | ||
"name": "@types/webpack-sources", | ||
"version": "0.1.7", | ||
"version": "1.4.0", | ||
"description": "TypeScript definitions for webpack-sources", | ||
@@ -16,2 +16,7 @@ "license": "MIT", | ||
"githubUsername": "chriseppstein" | ||
}, | ||
{ | ||
"name": "Piotr Błażejewicz", | ||
"url": "https://github.com/peterblazejewicz", | ||
"githubUsername": "peterblazejewicz" | ||
} | ||
@@ -30,6 +35,6 @@ ], | ||
"@types/source-list-map": "*", | ||
"source-map": "^0.6.1" | ||
"source-map": "^0.7.3" | ||
}, | ||
"typesPublisherContentHash": "acde4fbf304c33e67346dd00596ce1458e3e381eac16ccd9453162eed9a6224b", | ||
"typeScriptVersion": "2.8" | ||
"typesPublisherContentHash": "189a529daa4ba250f26a8f956929269ed2e81d3f72f0c5b64c32ef415fe1d5a1", | ||
"typeScriptVersion": "3.0" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Mon, 23 Mar 2020 15:48:34 GMT | ||
* Last updated: Tue, 02 Jun 2020 00:05:14 GMT | ||
* Dependencies: [@types/source-map](https://npmjs.com/package/@types/source-map), [@types/source-list-map](https://npmjs.com/package/@types/source-list-map), [@types/node](https://npmjs.com/package/@types/node) | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by [e-cloud](https://github.com/e-cloud), and [Chris Eppstein](https://github.com/chriseppstein). | ||
These definitions were written by [e-cloud](https://github.com/e-cloud), [Chris Eppstein](https://github.com/chriseppstein), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10291
197
1
1
+ Addedsource-map@0.7.4(transitive)
- Removedsource-map@0.6.1(transitive)
Updatedsource-map@^0.7.3