Socket
Socket
Sign inDemoInstall

@types/source-map

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/source-map - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

source-map/LICENSE

388

source-map/index.d.ts

@@ -1,136 +0,332 @@

// Type definitions for source-map v0.5.6
// Type definitions for source-map 0.5
// Project: https://github.com/mozilla/source-map
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>,
// Ron Buckton <https://github.com/rbuckton>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = SourceMap;
export as namespace sourceMap;
declare namespace SourceMap {
interface StartOfSourceMap {
file?: string;
sourceRoot?: string;
skipValidation?: boolean;
}
export interface StartOfSourceMap {
file?: string;
sourceRoot?: string;
skipValidation?: boolean;
}
interface RawSourceMap {
version: number;
sources: string[];
names: string[];
sourceRoot?: string;
sourcesContent?: string[];
mappings: string;
file: string;
}
export interface RawSourceMap {
version: number;
sources: string[];
names: string[];
sourceRoot?: string;
sourcesContent?: string[];
mappings: string;
file: string;
}
interface Position {
line: number;
column: number;
}
export interface RawIndexMap extends StartOfSourceMap {
version: number;
sections: RawSection[];
}
interface MappedPosition extends Position {
source: string;
name?: string;
}
export interface RawSection {
offset: Position;
map: RawSourceMap;
}
interface MappingItem {
source: string;
generatedLine: number;
generatedColumn: number;
originalLine: number;
originalColumn: number;
name: string;
}
export interface Position {
line: number;
column: number;
}
interface Mapping {
generated: Position;
original: Position;
source: string;
name?: string;
}
export interface NullablePosition {
line: number | null;
column: number | null;
lastColumn: number | null;
}
interface CodeWithSourceMap {
code: string;
map: SourceMapGenerator;
}
export interface MappedPosition {
source: string;
line: number;
column: number;
name?: string;
}
class SourceMapConsumer {
public static GENERATED_ORDER: number;
public static ORIGINAL_ORDER: number;
export interface NullableMappedPosition {
source: string | null;
line: number | null;
column: number | null;
name: string | null;
}
constructor(rawSourceMap: RawSourceMap | string);
export interface MappingItem {
source: string;
generatedLine: number;
generatedColumn: number;
originalLine: number;
originalColumn: number;
name: string;
}
public computeColumnSpans(): void;
export interface Mapping {
generated: Position;
original: Position;
source: string;
name?: string;
}
public originalPositionFor(generatedPosition: Position): MappedPosition;
export interface CodeWithSourceMap {
code: string;
map: SourceMapGenerator;
}
public generatedPositionFor(originalPosition: MappedPosition): Position;
export interface SourceMapConsumer {
/**
* Compute the last column for each generated mapping. The last column is
* inclusive.
*/
computeColumnSpans(): void;
public allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source.
* - column: The column number in the generated source.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null.
* - column: The column number in the original source, or null.
* - name: The original identifier, or null.
*/
originalPositionFor(generatedPosition: Position & { bias?: number }): NullableMappedPosition;
public hasContentsOfAllSources(): boolean;
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: The column number in the original source.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
generatedPositionFor(originalPosition: MappedPosition & { bias?: number }): NullablePosition;
public sourceContentFor(source: string, returnNullOnMissing?: boolean): string;
/**
* Returns all generated line and column information for the original source,
* line, and column provided. If no column is provided, returns all mappings
* corresponding to a either the line we are searching for or the next
* closest line that has any mappings. Otherwise, returns all mappings
* corresponding to the given line and either the column we are searching for
* or the next closest column that has any offsets.
*
* The only argument is an object with the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: Optional. the column number in the original source.
*
* and an array of objects is returned, each with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
allGeneratedPositionsFor(originalPosition: MappedPosition): NullablePosition[];
public eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
}
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
hasContentsOfAllSources(): boolean;
class SourceMapGenerator {
constructor(startOfSourceMap?: StartOfSourceMap);
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null;
public static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
/**
* Iterate over each mapping between an original source/line/column and a
* generated line/column in this source map.
*
* @param callback
* The function that is called with each mapping.
* @param context
* Optional. If specified, this object will be the value of `this` every
* time that `aCallback` is called.
* @param order
* Either `SourceMapConsumer.GENERATED_ORDER` or
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
* iterate over the mappings sorted by the generated file's line/column
* order or the original's source/line/column order, respectively. Defaults to
* `SourceMapConsumer.GENERATED_ORDER`.
*/
eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
}
public addMapping(mapping: Mapping): void;
export interface SourceMapConsumerConstructor {
prototype: SourceMapConsumer;
public setSourceContent(sourceFile: string, sourceContent: string): void;
GENERATED_ORDER: number;
ORIGINAL_ORDER: number;
GREATEST_LOWER_BOUND: number;
LEAST_UPPER_BOUND: number;
public applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
new (rawSourceMap: RawSourceMap): BasicSourceMapConsumer;
new (rawSourceMap: RawIndexMap): IndexedSourceMapConsumer;
new (rawSourceMap: RawSourceMap | RawIndexMap | string): BasicSourceMapConsumer | IndexedSourceMapConsumer;
public toString(): string;
/**
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
*
* @param sourceMap
* The source map that will be consumed.
*/
fromSourceMap(sourceMap: SourceMapGenerator): BasicSourceMapConsumer;
}
public toJSON(): RawSourceMap;
}
export const SourceMapConsumer: SourceMapConsumerConstructor;
class SourceNode {
children: SourceNode [];
sourceContents: any;
line: number;
column: number;
source: string;
name: string;
export interface BasicSourceMapConsumer extends SourceMapConsumer {
file: string;
sourceRoot: string;
sources: string[];
sourcesContent: string[];
}
constructor();
constructor(line: number, column: number, source: string);
constructor(
line: number,
column: number,
source: string,
chunks?: (string | SourceNode)[] | SourceNode | string,
name?: string
);
export interface BasicSourceMapConsumerConstructor {
prototype: BasicSourceMapConsumer;
public static fromStringWithSourceMap(
code: string,
sourceMapConsumer: SourceMapConsumer,
relativePath?: string
): SourceNode;
new (rawSourceMap: RawSourceMap | string): BasicSourceMapConsumer;
public add(chunk: (string | SourceNode)[] | SourceNode | string): SourceNode;
/**
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
*
* @param sourceMap
* The source map that will be consumed.
*/
fromSourceMap(sourceMap: SourceMapGenerator): BasicSourceMapConsumer;
}
public prepend(chunk: (string | SourceNode)[] | SourceNode | string): SourceNode;
export const BasicSourceMapConsumer: BasicSourceMapConsumerConstructor;
public setSourceContent(sourceFile: string, sourceContent: string): void;
export interface IndexedSourceMapConsumer extends SourceMapConsumer {
sources: string[];
}
public walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
export interface IndexedSourceMapConsumerConstructor {
prototype: IndexedSourceMapConsumer;
public walkSourceContents(fn: (file: string, content: string) => void): void;
new (rawSourceMap: RawIndexMap | string): IndexedSourceMapConsumer;
}
public join(sep: string): SourceNode;
export const IndexedSourceMapConsumer: IndexedSourceMapConsumerConstructor;
public replaceRight(pattern: string, replacement: string): SourceNode;
export class SourceMapGenerator {
constructor(startOfSourceMap?: StartOfSourceMap);
public toString(): string;
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param sourceMapConsumer The SourceMap.
*/
static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
public toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
}
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
addMapping(mapping: Mapping): void;
/**
* Set the source content for a source file.
*/
setSourceContent(sourceFile: string, sourceContent: string): void;
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param sourceMapConsumer The source map to be applied.
* @param sourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
* @param sourceMapPath Optional. The dirname of the path to the source map
* to be applied. If relative, it is relative to the SourceMapConsumer.
* This parameter is needed when the two source maps aren't in the same
* directory, and the source map to be applied contains relative source
* paths. If so, those relative source paths need to be rewritten
* relative to the SourceMapGenerator.
*/
applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
toString(): string;
toJSON(): RawSourceMap;
}
export class SourceNode {
children: SourceNode[];
sourceContents: any;
line: number;
column: number;
source: string;
name: string;
constructor();
constructor(
line: number,
column: number,
source: string,
chunks?: Array<(string | SourceNode)> | SourceNode | string,
name?: string
);
static fromStringWithSourceMap(
code: string,
sourceMapConsumer: SourceMapConsumer,
relativePath?: string
): SourceNode;
add(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode;
prepend(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode;
setSourceContent(sourceFile: string, sourceContent: string): void;
walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
walkSourceContents(fn: (file: string, content: string) => void): void;
join(sep: string): SourceNode;
replaceRight(pattern: string, replacement: string): SourceNode;
toString(): string;
toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
}
{
"name": "@types/source-map",
"version": "0.5.0",
"description": "TypeScript definitions for source-map v0.5.6",
"version": "0.5.1",
"description": "TypeScript definitions for source-map",
"license": "MIT",
"author": "Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>",
"contributors": [
{
"name": "Morten Houston Ludvigsen",
"url": "https://github.com/MortenHoustonLudvigsen"
},
{
"name": "Ron Buckton",
"url": "https://github.com/rbuckton"
}
],
"main": "",

@@ -15,4 +24,4 @@ "repository": {

"peerDependencies": {},
"typings": "index.d.ts",
"typesPublisherContentHash": "4d8b199bd9638cd0a287d03b1152f2a59c39094fc1c02ce1910d6371e2f62e18"
"typesPublisherContentHash": "0028285860374741cf34594dd4bdc763cda2988429fcd2a32bae38c3a8dd26b1",
"typeScriptVersion": "2.0"
}

@@ -5,15 +5,13 @@ # Installation

# Summary
This package contains type definitions for source-map v0.5.6 (https://github.com/mozilla/source-map).
This package contains type definitions for source-map (https://github.com/mozilla/source-map).
# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/source-map
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/source-map
Additional Details
* Last updated: Mon, 14 Nov 2016 19:35:02 GMT
* File structure: UMD
* Library Dependencies: none
* Module Dependencies: none
* Global values: SourceMap, sourceMap
* Last updated: Thu, 03 Aug 2017 13:57:01 GMT
* Dependencies: none
* Global values: sourceMap
# Credits
These definitions were written by Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>.
These definitions were written by Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>, Ron Buckton <https://github.com/rbuckton>.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc