From bfeafe46601578e61f8010dec8d743a7e99416ae Mon Sep 17 00:00:00 2001 From: Andrew Gaspar Date: Fri, 16 Aug 2013 14:53:34 -0500 Subject: [PATCH 1/2] Added definitions for convert-source-map --- .../convert-source-map-tests.ts | 13 +++++++++++ convert-source-map/convert-source-map.d.ts | 22 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 convert-source-map/convert-source-map-tests.ts create mode 100644 convert-source-map/convert-source-map.d.ts diff --git a/convert-source-map/convert-source-map-tests.ts b/convert-source-map/convert-source-map-tests.ts new file mode 100644 index 0000000000..a89cfb7127 --- /dev/null +++ b/convert-source-map/convert-source-map-tests.ts @@ -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); \ No newline at end of file diff --git a/convert-source-map/convert-source-map.d.ts b/convert-source-map/convert-source-map.d.ts new file mode 100644 index 0000000000..0a938af09e --- /dev/null +++ b/convert-source-map/convert-source-map.d.ts @@ -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; +} \ No newline at end of file From 108f41dad9077f0f8d64e119c62699b763ea5337 Mon Sep 17 00:00:00 2001 From: Andrew Gaspar Date: Fri, 16 Aug 2013 14:55:32 -0500 Subject: [PATCH 2/2] Added comment header to definiton. --- convert-source-map/convert-source-map.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/convert-source-map/convert-source-map.d.ts b/convert-source-map/convert-source-map.d.ts index 0a938af09e..6034d13f7e 100644 --- a/convert-source-map/convert-source-map.d.ts +++ b/convert-source-map/convert-source-map.d.ts @@ -1,3 +1,8 @@ +// Type definitions for convert-source-map +// Project: https://github.com/thlorenz/convert-source-map +// Definitions by: Andrew Gaspar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module "convert-source-map" { export interface SourceMapConverter { toObject(): any;