Skip to content
This repository was archived by the owner on Jun 14, 2018. It is now read-only.

Commit 5c97e56

Browse files
committed
chore(): updated webpack type definitions
Updated webpack TypeScript type definition (and associated dependencies). Updated build process to relfect changes in latest webpack type def & remove settings from the UglifyJs plugin as the settings we were setting are now the defaults. Closes #147.
1 parent 9e7127f commit 5c97e56

File tree

7 files changed

+811
-20
lines changed

7 files changed

+811
-20
lines changed

build/gulp/tasks/build-lib.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,7 @@ export class GulpTask extends BaseGulpTask {
5858
if (!this._args.dev) {
5959
config.output.filename = BuildConfig.OUTPUT_LIB_NAME + '.min.js';
6060
// use uglify plugin to remove comments & sourcemaps
61-
webpackPlugins.push(
62-
new webpack.optimize.UglifyJsPlugin({
63-
output: {
64-
comments: false
65-
},
66-
sourceMap: false
67-
})
68-
);
61+
webpackPlugins.push(new webpack.optimize.UglifyJsPlugin());
6962
} else { // else gen un-uglified & include inline sourcemaps
7063
config.output.filename = BuildConfig.OUTPUT_LIB_NAME + '.js';
7164
config.devtool = 'inline-source-map';
+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Type definitions for source-map v0.1.38
2+
// Project: https://github.com/mozilla/source-map
3+
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>
4+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5+
6+
declare module SourceMap {
7+
interface StartOfSourceMap {
8+
file?: string;
9+
sourceRoot?: string;
10+
}
11+
12+
interface RawSourceMap extends StartOfSourceMap {
13+
version: string;
14+
sources: Array<string>;
15+
names: Array<string>;
16+
sourcesContent?: string[];
17+
mappings: string;
18+
}
19+
20+
interface Position {
21+
line: number;
22+
column: number;
23+
}
24+
25+
interface MappedPosition extends Position {
26+
source: string;
27+
name?: string;
28+
}
29+
30+
interface MappingItem {
31+
source: string;
32+
generatedLine: number;
33+
generatedColumn: number;
34+
originalLine: number;
35+
originalColumn: number;
36+
name: string;
37+
}
38+
39+
interface Mapping {
40+
generated: Position;
41+
original: Position;
42+
source: string;
43+
name?: string;
44+
}
45+
46+
interface CodeWithSourceMap {
47+
code: string;
48+
map: SourceMapGenerator;
49+
}
50+
51+
class SourceMapConsumer {
52+
public static GENERATED_ORDER: number;
53+
public static ORIGINAL_ORDER: number;
54+
55+
constructor(rawSourceMap: RawSourceMap);
56+
public originalPositionFor(generatedPosition: Position): MappedPosition;
57+
public generatedPositionFor(originalPosition: MappedPosition): Position;
58+
public sourceContentFor(source: string): string;
59+
public eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
60+
}
61+
62+
class SourceMapGenerator {
63+
constructor(startOfSourceMap?: StartOfSourceMap);
64+
public static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
65+
public addMapping(mapping: Mapping): void;
66+
public setSourceContent(sourceFile: string, sourceContent: string): void;
67+
public applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
68+
public toString(): string;
69+
}
70+
71+
class SourceNode {
72+
constructor();
73+
constructor(line: number, column: number, source: string);
74+
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
75+
public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
76+
public add(chunk: any): SourceNode;
77+
public prepend(chunk: any): SourceNode;
78+
public setSourceContent(sourceFile: string, sourceContent: string): void;
79+
public walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
80+
public walkSourceContents(fn: (file: string, content: string) => void): void;
81+
public join(sep: string): SourceNode;
82+
public replaceRight(pattern: string, replacement: string): SourceNode;
83+
public toString(): string;
84+
public toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
85+
}
86+
}
87+
88+
declare module 'source-map' {
89+
export = SourceMap;
90+
}

build/typings/tsd.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@
2929
/// <reference path="vinyl/vinyl.d.ts" />
3030
/// <reference path="webpack/webpack.d.ts" />
3131
/// <reference path="yargs/yargs.d.ts" />
32+
/// <reference path="uglify-js/uglify-js.d.ts" />
33+
/// <reference path="source-map/source-map.d.ts" />

0 commit comments

Comments
 (0)