mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 15:00:26 +00:00
source-map: Provides its own types (#22307)
This commit is contained in:
@@ -1116,6 +1116,12 @@
|
||||
"sourceRepoURL": "https://www.npmjs.com/package/soap",
|
||||
"asOfVersion": "0.21.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "source-map",
|
||||
"typingsPackageName": "source-map",
|
||||
"sourceRepoURL": "https://github.com/mozilla/source-map",
|
||||
"asOfVersion": "0.5.7"
|
||||
},
|
||||
{
|
||||
"libraryName": "Spin.js",
|
||||
"typingsPackageName": "spin.js",
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
} from 'istanbul-lib-instrument';
|
||||
|
||||
import * as babelTypes from 'babel-types';
|
||||
import { RawSourceMap } from 'source-map';
|
||||
|
||||
const code = 'foo';
|
||||
const filename = 'bar.txt';
|
||||
@@ -24,8 +25,8 @@ const instrumenter = createInstrumenter({
|
||||
debug: false
|
||||
});
|
||||
|
||||
const sourceMap = {
|
||||
version: 1,
|
||||
const sourceMap: RawSourceMap = {
|
||||
version: 1 as any as string, // Fixed by https://github.com/mozilla/source-map/pull/293 but the fix is not yet published
|
||||
sources: ['foo', 'bar'],
|
||||
names: ['foo', 'bar'],
|
||||
mappings: 'foo',
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"source-map": "^0.6.1"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createSourceMapStore } from 'istanbul-lib-source-maps';
|
||||
import { CoverageMap } from 'istanbul-lib-coverage';
|
||||
import { RawSourceMap } from 'source-map';
|
||||
|
||||
createSourceMapStore();
|
||||
createSourceMapStore({});
|
||||
@@ -12,8 +13,8 @@ const store = createSourceMapStore({
|
||||
|
||||
store.data['foo'].type.trim();
|
||||
|
||||
const sourceMap = {
|
||||
version: 1,
|
||||
const sourceMap: RawSourceMap = {
|
||||
version: 1 as any as string, // Fixed by https://github.com/mozilla/source-map/pull/293 but the fix is not yet published
|
||||
sources: ['foo', 'bar'],
|
||||
names: ['foo', 'bar'],
|
||||
mappings: 'foo',
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"source-map": "^0.6.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"source-map": "^0.6.1"
|
||||
}
|
||||
}
|
||||
Vendored
-334
@@ -1,334 +0,0 @@
|
||||
// Type definitions for source-map 0.5
|
||||
// Project: https://github.com/mozilla/source-map
|
||||
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>,
|
||||
// Ron Buckton <https://github.com/rbuckton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace sourceMap;
|
||||
|
||||
export type SourceMapUrl = string;
|
||||
|
||||
export interface StartOfSourceMap {
|
||||
file?: string;
|
||||
sourceRoot?: string;
|
||||
skipValidation?: boolean;
|
||||
}
|
||||
|
||||
export interface RawSourceMap {
|
||||
version: number;
|
||||
sources: string[];
|
||||
names: string[];
|
||||
sourceRoot?: string;
|
||||
sourcesContent?: string[];
|
||||
mappings: string;
|
||||
file: string;
|
||||
}
|
||||
|
||||
export interface RawIndexMap extends StartOfSourceMap {
|
||||
version: number;
|
||||
sections: RawSection[];
|
||||
}
|
||||
|
||||
export interface RawSection {
|
||||
offset: Position;
|
||||
map: RawSourceMap;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface NullablePosition {
|
||||
line: number | null;
|
||||
column: number | null;
|
||||
lastColumn: number | null;
|
||||
}
|
||||
|
||||
export interface MappedPosition {
|
||||
source: string;
|
||||
line: number;
|
||||
column: number;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface NullableMappedPosition {
|
||||
source: string | null;
|
||||
line: number | null;
|
||||
column: number | null;
|
||||
name: string | null;
|
||||
}
|
||||
|
||||
export interface MappingItem {
|
||||
source: string;
|
||||
generatedLine: number;
|
||||
generatedColumn: number;
|
||||
originalLine: number;
|
||||
originalColumn: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Mapping {
|
||||
generated: Position;
|
||||
original: Position;
|
||||
source: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface CodeWithSourceMap {
|
||||
code: string;
|
||||
map: SourceMapGenerator;
|
||||
}
|
||||
|
||||
export interface SourceMapConsumer {
|
||||
/**
|
||||
* Compute the last column for each generated mapping. The last column is
|
||||
* inclusive.
|
||||
*/
|
||||
computeColumnSpans(): void;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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[];
|
||||
|
||||
/**
|
||||
* Return true if we have the source content for every source in the source
|
||||
* map, false otherwise.
|
||||
*/
|
||||
hasContentsOfAllSources(): boolean;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
export interface SourceMapConsumerConstructor {
|
||||
prototype: SourceMapConsumer;
|
||||
|
||||
GENERATED_ORDER: number;
|
||||
ORIGINAL_ORDER: number;
|
||||
GREATEST_LOWER_BOUND: number;
|
||||
LEAST_UPPER_BOUND: number;
|
||||
|
||||
new (rawSourceMap: RawSourceMap, sourceMapUrl?: SourceMapUrl): BasicSourceMapConsumer;
|
||||
new (rawSourceMap: RawIndexMap, sourceMapUrl?: SourceMapUrl): IndexedSourceMapConsumer;
|
||||
new (rawSourceMap: RawSourceMap | RawIndexMap | string, sourceMapUrl?: SourceMapUrl): BasicSourceMapConsumer | IndexedSourceMapConsumer;
|
||||
|
||||
/**
|
||||
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
|
||||
*
|
||||
* @param sourceMap
|
||||
* The source map that will be consumed.
|
||||
*/
|
||||
fromSourceMap(sourceMap: SourceMapGenerator, sourceMapUrl?: SourceMapUrl): BasicSourceMapConsumer;
|
||||
}
|
||||
|
||||
export const SourceMapConsumer: SourceMapConsumerConstructor;
|
||||
|
||||
export interface BasicSourceMapConsumer extends SourceMapConsumer {
|
||||
file: string;
|
||||
sourceRoot: string;
|
||||
sources: string[];
|
||||
sourcesContent: string[];
|
||||
}
|
||||
|
||||
export interface BasicSourceMapConsumerConstructor {
|
||||
prototype: BasicSourceMapConsumer;
|
||||
|
||||
new (rawSourceMap: RawSourceMap | string): BasicSourceMapConsumer;
|
||||
|
||||
/**
|
||||
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
|
||||
*
|
||||
* @param sourceMap
|
||||
* The source map that will be consumed.
|
||||
*/
|
||||
fromSourceMap(sourceMap: SourceMapGenerator): BasicSourceMapConsumer;
|
||||
}
|
||||
|
||||
export const BasicSourceMapConsumer: BasicSourceMapConsumerConstructor;
|
||||
|
||||
export interface IndexedSourceMapConsumer extends SourceMapConsumer {
|
||||
sources: string[];
|
||||
}
|
||||
|
||||
export interface IndexedSourceMapConsumerConstructor {
|
||||
prototype: IndexedSourceMapConsumer;
|
||||
|
||||
new (rawSourceMap: RawIndexMap | string): IndexedSourceMapConsumer;
|
||||
}
|
||||
|
||||
export const IndexedSourceMapConsumer: IndexedSourceMapConsumerConstructor;
|
||||
|
||||
export class SourceMapGenerator {
|
||||
constructor(startOfSourceMap?: StartOfSourceMap);
|
||||
|
||||
/**
|
||||
* Creates a new SourceMapGenerator based on a SourceMapConsumer
|
||||
*
|
||||
* @param sourceMapConsumer The SourceMap.
|
||||
*/
|
||||
static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
|
||||
|
||||
/**
|
||||
* 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 | null,
|
||||
column: number | null,
|
||||
source: string | null,
|
||||
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;
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
import SourceMap = require('source-map');
|
||||
|
||||
function testSourceMapConsumer() {
|
||||
function testConstructor() {
|
||||
let scm: SourceMap.SourceMapConsumer;
|
||||
|
||||
// create with full RawSourceMap
|
||||
scm = new SourceMap.SourceMapConsumer({
|
||||
version: 3,
|
||||
sources: ['foo', 'bar'],
|
||||
names: ['foo', 'bar'],
|
||||
sourcesContent: ['foo'],
|
||||
mappings: 'foo',
|
||||
file: 'sdf'
|
||||
});
|
||||
|
||||
scm = new SourceMap.SourceMapConsumer(JSON.stringify({
|
||||
version: 3,
|
||||
sources: ['foo', 'bar'],
|
||||
names: ['foo', 'bar'],
|
||||
sourcesContent: ['foo'],
|
||||
mappings: 'foo',
|
||||
file: 'sdf'
|
||||
}));
|
||||
|
||||
// create with partial RawSourceMap
|
||||
scm = new SourceMap.SourceMapConsumer({
|
||||
version: 3,
|
||||
sources: ['foo', 'bar'],
|
||||
names: ['foo', 'bar'],
|
||||
mappings: 'foo',
|
||||
file: 'sdf'
|
||||
});
|
||||
|
||||
// create from index map
|
||||
const iscm: SourceMap.IndexedSourceMapConsumer = new SourceMap.SourceMapConsumer({
|
||||
version: 3,
|
||||
sections: [
|
||||
{ offset: { line: 0, column: 0 }, map: {
|
||||
version: 3,
|
||||
sources: ['foo', 'bar'],
|
||||
names: ['foo', 'bar'],
|
||||
mappings: 'foo',
|
||||
file: 'foo'
|
||||
} }
|
||||
]
|
||||
});
|
||||
|
||||
let scg: SourceMap.SourceMapGenerator;
|
||||
const bscm: SourceMap.BasicSourceMapConsumer = SourceMap.SourceMapConsumer.fromSourceMap(scg);
|
||||
}
|
||||
|
||||
function testOriginalPositionFor(scm: SourceMap.SourceMapConsumer) {
|
||||
let origPos: SourceMap.MappedPosition;
|
||||
origPos = scm.originalPositionFor({ line: 42, column: 42 });
|
||||
origPos = scm.originalPositionFor({ line: 42, column: 42, bias: SourceMap.SourceMapConsumer.LEAST_UPPER_BOUND });
|
||||
}
|
||||
|
||||
function testAllGeneratedPositionsFor(scm: SourceMap.SourceMapConsumer) {
|
||||
let origPos: SourceMap.MappedPosition;
|
||||
let origPoses: SourceMap.Position[];
|
||||
origPoses = scm.allGeneratedPositionsFor(origPos);
|
||||
}
|
||||
|
||||
function testGeneratedPositionFor(scm: SourceMap.SourceMapConsumer) {
|
||||
let genPos: SourceMap.Position;
|
||||
genPos = scm.generatedPositionFor({ line: 42, column: 42, source: 'foo' });
|
||||
genPos = scm.generatedPositionFor({ line: 42, column: 42, source: 'foo', name: 'bar' });
|
||||
genPos = scm.generatedPositionFor({ line: 42, column: 42, source: 'foo', name: 'bar', bias: SourceMap.SourceMapConsumer.LEAST_UPPER_BOUND });
|
||||
}
|
||||
|
||||
function testSourceContentFor(scm: SourceMap.SourceMapConsumer) {
|
||||
let content: string;
|
||||
content = scm.sourceContentFor('foo');
|
||||
}
|
||||
|
||||
function testEachMapping(scm: SourceMap.SourceMapConsumer) {
|
||||
let x: SourceMap.MappingItem;
|
||||
let context: {};
|
||||
|
||||
scm.eachMapping(mapping => { x = mapping; });
|
||||
scm.eachMapping(mapping => { x = mapping; }, context);
|
||||
scm.eachMapping(mapping => { x = mapping; }, context, SourceMap.SourceMapConsumer.GENERATED_ORDER);
|
||||
scm.eachMapping(mapping => { x = mapping; }, context, SourceMap.SourceMapConsumer.ORIGINAL_ORDER);
|
||||
}
|
||||
}
|
||||
|
||||
function testSourceMapGenerator() {
|
||||
function testConstructor() {
|
||||
let generator: SourceMap.SourceMapGenerator;
|
||||
|
||||
generator = new SourceMap.SourceMapGenerator();
|
||||
generator = new SourceMap.SourceMapGenerator({
|
||||
file: 'foo'
|
||||
});
|
||||
generator = new SourceMap.SourceMapGenerator({
|
||||
sourceRoot: 'foo'
|
||||
});
|
||||
generator = new SourceMap.SourceMapGenerator({
|
||||
file: 'foo',
|
||||
sourceRoot: 'bar'
|
||||
});
|
||||
}
|
||||
|
||||
function testFromSourceMap(generator: SourceMap.SourceMapGenerator, scm: SourceMap.SourceMapConsumer) {
|
||||
generator = SourceMap.SourceMapGenerator.fromSourceMap(scm);
|
||||
}
|
||||
|
||||
function testAddMapping(generator: SourceMap.SourceMapGenerator) {
|
||||
generator.addMapping({
|
||||
generated: { line: 42, column: 42 },
|
||||
original: { line: 42, column: 42 },
|
||||
source: 'foo',
|
||||
name: 'foo'
|
||||
});
|
||||
|
||||
generator.addMapping({
|
||||
generated: { line: 42, column: 42 },
|
||||
original: { line: 42, column: 42 },
|
||||
source: 'foo'
|
||||
});
|
||||
}
|
||||
|
||||
function testSetSourceContent(generator: SourceMap.SourceMapGenerator) {
|
||||
generator.setSourceContent('foo', 'bar');
|
||||
}
|
||||
|
||||
function testApplySourceMap(generator: SourceMap.SourceMapGenerator, scm: SourceMap.SourceMapConsumer) {
|
||||
generator.applySourceMap(scm);
|
||||
generator.applySourceMap(scm, 'foo');
|
||||
generator.applySourceMap(scm, 'foo', 'bar');
|
||||
}
|
||||
|
||||
function testToString(generator: SourceMap.SourceMapGenerator) {
|
||||
let str: string;
|
||||
str = generator.toString();
|
||||
}
|
||||
}
|
||||
|
||||
function testSourceNode() {
|
||||
function testConstructor() {
|
||||
let node: SourceMap.SourceNode;
|
||||
|
||||
node = new SourceMap.SourceNode();
|
||||
node = new SourceMap.SourceNode(42, 42, 'foo');
|
||||
node = new SourceMap.SourceNode(42, 42, 'foo', 'bar');
|
||||
node = new SourceMap.SourceNode(42, 42, 'foo', 'bar', 'slam');
|
||||
node = new SourceMap.SourceNode(42, 42, 'foo', ['bar', 'slam']);
|
||||
}
|
||||
|
||||
function testFromStringWithSourceMap(scm: SourceMap.SourceMapConsumer) {
|
||||
let node: SourceMap.SourceNode;
|
||||
|
||||
node = SourceMap.SourceNode.fromStringWithSourceMap('foo', scm);
|
||||
node = SourceMap.SourceNode.fromStringWithSourceMap('foo', scm, 'bar');
|
||||
}
|
||||
|
||||
function testAdd(node: SourceMap.SourceNode) {
|
||||
node.add('foo');
|
||||
node.add(new SourceMap.SourceNode());
|
||||
node.add([new SourceMap.SourceNode(), 'bar']);
|
||||
}
|
||||
|
||||
function testPrepend(node: SourceMap.SourceNode) {
|
||||
node.prepend('foo');
|
||||
node.prepend(new SourceMap.SourceNode());
|
||||
node.prepend([new SourceMap.SourceNode(), 'bar']);
|
||||
}
|
||||
|
||||
function testSetSourceContent(node: SourceMap.SourceNode) {
|
||||
node.setSourceContent('foo', 'bar');
|
||||
}
|
||||
|
||||
function testWalk(node: SourceMap.SourceNode) {
|
||||
let chunk: string;
|
||||
let mapping: SourceMap.MappedPosition;
|
||||
|
||||
node.walk((c, m) => { chunk = c; mapping = m; });
|
||||
}
|
||||
|
||||
function testWalkSourceContents(node: SourceMap.SourceNode) {
|
||||
let file: string;
|
||||
let content: string;
|
||||
|
||||
node.walkSourceContents((f, c) => { file = f; content = c; });
|
||||
}
|
||||
|
||||
function testJoin(node: SourceMap.SourceNode) {
|
||||
node = node.join('foo');
|
||||
}
|
||||
|
||||
function testReplaceRight(node: SourceMap.SourceNode) {
|
||||
node = node.replaceRight('foo', 'bar');
|
||||
}
|
||||
|
||||
function testToString(node: SourceMap.SourceNode) {
|
||||
let str: string;
|
||||
str = node.toString();
|
||||
}
|
||||
|
||||
function testToStringWithSourceMap(node: SourceMap.SourceNode, sos: SourceMap.StartOfSourceMap) {
|
||||
let result: SourceMap.CodeWithSourceMap;
|
||||
result = node.toStringWithSourceMap();
|
||||
result = node.toStringWithSourceMap(sos);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"source-map-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"prefer-const": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"source-map": "^0.6.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"source-map": "^0.6.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user