mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Added definitions for convert-source-map
This commit is contained in:
13
convert-source-map/convert-source-map-tests.ts
Normal file
13
convert-source-map/convert-source-map-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import convert = require("convert-source-map");
|
||||
|
||||
var json = convert
|
||||
.fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
|
||||
.toJSON();
|
||||
|
||||
var modified = convert
|
||||
.fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
|
||||
.setProperty('sources', ['CONSOLE.LOG("HI");'])
|
||||
.toJSON();
|
||||
|
||||
console.log(json);
|
||||
console.log(modified);
|
||||
22
convert-source-map/convert-source-map.d.ts
vendored
Normal file
22
convert-source-map/convert-source-map.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
declare module "convert-source-map" {
|
||||
export interface SourceMapConverter {
|
||||
toObject(): any;
|
||||
toJSON(space?): string;
|
||||
toBase64(): string;
|
||||
toComment(): string;
|
||||
|
||||
addProperty(key, value): SourceMapConverter;
|
||||
setProperty(key, value): SourceMapConverter;
|
||||
|
||||
getProperty(key): any;
|
||||
}
|
||||
|
||||
export function removeComments(src): string;
|
||||
export var commentRegex: RegExp;
|
||||
|
||||
export function fromObject(obj): SourceMapConverter;
|
||||
export function fromJSON(json: string): SourceMapConverter;
|
||||
export function fromBase64(base64: string): SourceMapConverter;
|
||||
export function fromComment(comment: string): SourceMapConverter;
|
||||
export function fromSource(source: string): SourceMapConverter;
|
||||
}
|
||||
Reference in New Issue
Block a user