@types/webpack-sources
Advanced tools
Comparing version 1.4.2 to 2.0.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for webpack-sources 1.4 | ||
// Type definitions for webpack-sources 2.0 | ||
// Project: https://github.com/webpack/webpack-sources | ||
@@ -7,205 +7,14 @@ // Definitions by: e-cloud <https://github.com/e-cloud> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
/// <reference types="node" /> | ||
import { Hash } from 'crypto'; | ||
import { SourceNode, RawSourceMap, SourceMapGenerator } from 'source-map'; | ||
import { SourceListMap } from 'source-list-map'; | ||
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; | ||
} | ||
export interface SourceAndMapResult { | ||
source: string; | ||
map: RawSourceMap | null; | ||
} | ||
/** | ||
* 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(): string | ArrayBuffer; | ||
/** | ||
* Returns the size in chars of the represented source code. | ||
*/ | ||
size(): number; | ||
/** | ||
* 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; | ||
/** | ||
* 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; | ||
/** | ||
* 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 { | ||
/** | ||
* 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 { | ||
constructor(source: Source); | ||
map(options?: MapOptions): RawSourceMap; | ||
} | ||
/** | ||
* Concatenate multiple Sources or strings to a single source. | ||
*/ | ||
export class ConcatSource extends Source implements SourceAndMapMixin { | ||
children: Array<string | Source>; | ||
constructor(...args: Array<string | Source>); | ||
/** | ||
* Adds an item to the source. | ||
*/ | ||
add(item: string | Source): void; | ||
source(): string; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
} | ||
export class LineToLineMappedSource extends Source implements SourceAndMapMixin { | ||
constructor(sourceCode: string, name: string, originalSource: string); | ||
source(): string; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
} | ||
/** | ||
* Represents source code, which is a copy of the original file | ||
*/ | ||
export class OriginalSource extends Source implements SourceAndMapMixin { | ||
/** | ||
* 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: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
} | ||
/** | ||
* Prefix every line of the decorated Source with a provided string. | ||
*/ | ||
export class PrefixSource extends Source implements SourceAndMapMixin { | ||
constructor(prefix: Source | string, source: Source | string); | ||
source(): string; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
} | ||
/** | ||
* Represents source code without SourceMap | ||
*/ | ||
export class RawSource extends Source { | ||
constructor(value: string); | ||
source(): string; | ||
map(options: MapOptions): null; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
} | ||
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 { | ||
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); | ||
/** | ||
* 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; | ||
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 { | ||
constructor( | ||
sourceCode: string, | ||
name: string, | ||
sourceMap: SourceMapGenerator | RawSourceMap, | ||
originalSource?: string, | ||
innerSourceMap?: RawSourceMap | string, | ||
removeOriginalSource?: boolean, | ||
); | ||
source(): string; | ||
node(options: MapOptions): SourceNode; | ||
listMap(options: MapOptions): SourceListMap; | ||
} | ||
export import CachedSource = require('./lib/CachedSource'); | ||
export import CompatSource = require('./lib/CompatSource'); | ||
export import ConcatSource = require('./lib/ConcatSource'); | ||
export import OriginalSource = require('./lib/OriginalSource'); | ||
export import PrefixSource = require('./lib/PrefixSource'); | ||
export import RawSource = require('./lib/RawSource'); | ||
export import ReplaceSource = require('./lib/ReplaceSource'); | ||
export import SizeOnlySource = require('./lib/SizeOnlySource'); | ||
export import Source = require('./lib/Source'); | ||
export import SourceMapSource = require('./lib/SourceMapSource'); | ||
export { CachedData, MapOptions, Replacement, SourceAndMapMixin, SourceAndMapResult, SourceLike } from './lib/index'; |
{ | ||
"name": "@types/webpack-sources", | ||
"version": "1.4.2", | ||
"version": "2.0.0", | ||
"description": "TypeScript definitions for webpack-sources", | ||
@@ -36,4 +36,4 @@ "license": "MIT", | ||
}, | ||
"typesPublisherContentHash": "fdd917e71a3009915811c057da70108f4ae12f0c656466a04a2f60095dc2a593", | ||
"typeScriptVersion": "3.0" | ||
"typesPublisherContentHash": "cf81fa13fced43d1d5be972d12075be6f147698af7ea9a3a783b00f4deacecdf", | ||
"typeScriptVersion": "3.2" | ||
} |
@@ -11,4 +11,4 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 28 Jul 2020 16:32:49 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) | ||
* Last updated: Wed, 30 Sep 2020 10:42:00 GMT | ||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node), [@types/source-map](https://npmjs.com/package/@types/source-map), [@types/source-list-map](https://npmjs.com/package/@types/source-list-map) | ||
* Global values: none | ||
@@ -15,0 +15,0 @@ |
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
11872
15
234
1