diff --git a/Gulpfile.ts b/Gulpfile.ts
index 57da2b62aa812..8797f6d2ee122 100644
--- a/Gulpfile.ts
+++ b/Gulpfile.ts
@@ -710,7 +710,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
const originalMap = file.sourceMap;
const prebundledContent = file.contents.toString();
// Make paths absolute to help sorcery deal with all the terrible paths being thrown around
- originalMap.sources = originalMap.sources.map(s => path.resolve(s));
+ originalMap.sources = originalMap.sources.map(s => path.resolve("src", s));
// intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap
originalMap.file = "built/local/_stream_0.js";
diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts
index 63f929c0a2620..89db876ae5e48 100644
--- a/src/compiler/performance.ts
+++ b/src/compiler/performance.ts
@@ -2,7 +2,7 @@
namespace ts {
declare const performance: { now?(): number } | undefined;
/** Gets a timestamp with (at least) ms resolution */
- export const timestamp = typeof performance !== "undefined" && performance.now ? performance.now : Date.now ? Date.now : () => +(new Date());
+ export const timestamp = typeof performance !== "undefined" && performance.now ? () => performance.now() : Date.now ? Date.now : () => +(new Date());
}
/*@internal*/
@@ -106,4 +106,4 @@ namespace ts.performance {
measures = undefined;
profilerEvent = undefined;
}
-}
\ No newline at end of file
+}
diff --git a/src/harness/unittests/tsconfigParsing.ts b/src/harness/unittests/tsconfigParsing.ts
index 736d567a33a75..557379dff3b7d 100644
--- a/src/harness/unittests/tsconfigParsing.ts
+++ b/src/harness/unittests/tsconfigParsing.ts
@@ -1,185 +1,185 @@
-///
-///
-
-namespace ts {
- describe("parseConfigFileTextToJson", () => {
- function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: Diagnostic }) {
- const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
- assert.equal(JSON.stringify(parsed), JSON.stringify(expectedConfigObject));
- }
-
- function assertParseError(jsonText: string) {
- const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
- assert.isTrue(undefined === parsed.config);
- assert.isTrue(undefined !== parsed.error);
- }
-
- function assertParseErrorWithExcludesKeyword(jsonText: string) {
- const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
- const parsedCommand = ts.parseJsonConfigFileContent(parsed.config, ts.sys, "tests/cases/unittests");
- assert.isTrue(parsedCommand.errors && parsedCommand.errors.length === 1 &&
- parsedCommand.errors[0].code === ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude.code);
- }
-
- function assertParseFileList(jsonText: string, configFileName: string, basePath: string, allFileList: string[], expectedFileList: string[]) {
- const json = JSON.parse(jsonText);
- const host: ParseConfigHost = new Utils.MockParseConfigHost(basePath, true, allFileList);
- const parsed = ts.parseJsonConfigFileContent(json, host, basePath, /*existingOptions*/ undefined, configFileName);
- assert.isTrue(arrayIsEqualTo(parsed.fileNames.sort(), expectedFileList.sort()));
- }
-
- it("returns empty config for file with only whitespaces", () => {
- assertParseResult("", { config : {} });
- assertParseResult(" ", { config : {} });
- });
-
- it("returns empty config for file with comments only", () => {
- assertParseResult("// Comment", { config: {} });
- assertParseResult("/* Comment*/", { config: {} });
- });
-
- it("returns empty config when config is empty object", () => {
- assertParseResult("{}", { config: {} });
- });
-
- it("returns config object without comments", () => {
- assertParseResult(
- `{ // Excluded files
- "exclude": [
- // Exclude d.ts
- "file.d.ts"
- ]
- }`, { config: { exclude: ["file.d.ts"] } });
-
- assertParseResult(
- `{
- /* Excluded
- Files
- */
- "exclude": [
- /* multiline comments can be in the middle of a line */"file.d.ts"
- ]
- }`, { config: { exclude: ["file.d.ts"] } });
- });
-
- it("keeps string content untouched", () => {
- assertParseResult(
- `{
- "exclude": [
- "xx//file.d.ts"
- ]
- }`, { config: { exclude: ["xx//file.d.ts"] } });
- assertParseResult(
- `{
- "exclude": [
- "xx/*file.d.ts*/"
- ]
- }`, { config: { exclude: ["xx/*file.d.ts*/"] } });
- });
-
- it("handles escaped characters in strings correctly", () => {
- assertParseResult(
- `{
- "exclude": [
- "xx\\"//files"
- ]
- }`, { config: { exclude: ["xx\"//files"] } });
-
- assertParseResult(
- `{
- "exclude": [
- "xx\\\\" // end of line comment
- ]
- }`, { config: { exclude: ["xx\\"] } });
- });
-
- it("returns object with error when json is invalid", () => {
- assertParseError("invalid");
- });
-
- it("returns object when users correctly specify library", () => {
- assertParseResult(
- `{
- "compilerOptions": {
- "lib": ["es5"]
- }
- }`, {
- config: { compilerOptions: { lib: ["es5"] } }
- });
-
- assertParseResult(
- `{
- "compilerOptions": {
- "lib": ["es5", "es6"]
- }
- }`, {
- config: { compilerOptions: { lib: ["es5", "es6"] } }
- });
- });
-
- it("returns error when tsconfig have excludes", () => {
- assertParseErrorWithExcludesKeyword(
- `{
- "compilerOptions": {
- "lib": ["es5"]
- },
- "excludes": [
- "foge.ts"
- ]
- }`);
- });
-
- it("ignore dotted files and folders", () => {
- assertParseFileList(
- `{}`,
- "tsconfig.json",
- "/apath",
- ["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"],
- ["/apath/test.ts"]
- );
- });
-
- it("allow dotted files and folders when explicitly requested", () => {
- assertParseFileList(
- `{
- "files": ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"]
- }`,
- "tsconfig.json",
- "/apath",
- ["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"],
- ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"]
- );
- });
-
- it("always exclude outDir", () => {
- const tsconfigWithoutExclude =
- `{
- "compilerOptions": {
- "outDir": "bin"
- }
- }`;
- const tsconfigWithExclude =
- `{
- "compilerOptions": {
- "outDir": "bin"
- },
- "exclude": [ "obj" ]
- }`;
- const rootDir = "/";
- const allFiles = ["/bin/a.ts", "/b.ts"];
- const expectedFiles = ["/b.ts"];
- assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
- assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
- });
-
- it("implicitly exclude common package folders", () => {
- assertParseFileList(
- `{}`,
- "tsconfig.json",
- "/",
- ["/node_modules/a.ts", "/bower_components/b.ts", "/jspm_packages/c.ts", "/d.ts", "/folder/e.ts"],
- ["/d.ts", "/folder/e.ts"]
- );
- });
- });
-}
+///
+///
+
+namespace ts {
+ describe("parseConfigFileTextToJson", () => {
+ function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: Diagnostic }) {
+ const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
+ assert.equal(JSON.stringify(parsed), JSON.stringify(expectedConfigObject));
+ }
+
+ function assertParseError(jsonText: string) {
+ const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
+ assert.isTrue(undefined === parsed.config);
+ assert.isTrue(undefined !== parsed.error);
+ }
+
+ function assertParseErrorWithExcludesKeyword(jsonText: string) {
+ const parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
+ const parsedCommand = ts.parseJsonConfigFileContent(parsed.config, ts.sys, "tests/cases/unittests");
+ assert.isTrue(parsedCommand.errors && parsedCommand.errors.length === 1 &&
+ parsedCommand.errors[0].code === ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude.code);
+ }
+
+ function assertParseFileList(jsonText: string, configFileName: string, basePath: string, allFileList: string[], expectedFileList: string[]) {
+ const json = JSON.parse(jsonText);
+ const host: ParseConfigHost = new Utils.MockParseConfigHost(basePath, true, allFileList);
+ const parsed = ts.parseJsonConfigFileContent(json, host, basePath, /*existingOptions*/ undefined, configFileName);
+ assert.isTrue(arrayIsEqualTo(parsed.fileNames.sort(), expectedFileList.sort()));
+ }
+
+ it("returns empty config for file with only whitespaces", () => {
+ assertParseResult("", { config : {} });
+ assertParseResult(" ", { config : {} });
+ });
+
+ it("returns empty config for file with comments only", () => {
+ assertParseResult("// Comment", { config: {} });
+ assertParseResult("/* Comment*/", { config: {} });
+ });
+
+ it("returns empty config when config is empty object", () => {
+ assertParseResult("{}", { config: {} });
+ });
+
+ it("returns config object without comments", () => {
+ assertParseResult(
+ `{ // Excluded files
+ "exclude": [
+ // Exclude d.ts
+ "file.d.ts"
+ ]
+ }`, { config: { exclude: ["file.d.ts"] } });
+
+ assertParseResult(
+ `{
+ /* Excluded
+ Files
+ */
+ "exclude": [
+ /* multiline comments can be in the middle of a line */"file.d.ts"
+ ]
+ }`, { config: { exclude: ["file.d.ts"] } });
+ });
+
+ it("keeps string content untouched", () => {
+ assertParseResult(
+ `{
+ "exclude": [
+ "xx//file.d.ts"
+ ]
+ }`, { config: { exclude: ["xx//file.d.ts"] } });
+ assertParseResult(
+ `{
+ "exclude": [
+ "xx/*file.d.ts*/"
+ ]
+ }`, { config: { exclude: ["xx/*file.d.ts*/"] } });
+ });
+
+ it("handles escaped characters in strings correctly", () => {
+ assertParseResult(
+ `{
+ "exclude": [
+ "xx\\"//files"
+ ]
+ }`, { config: { exclude: ["xx\"//files"] } });
+
+ assertParseResult(
+ `{
+ "exclude": [
+ "xx\\\\" // end of line comment
+ ]
+ }`, { config: { exclude: ["xx\\"] } });
+ });
+
+ it("returns object with error when json is invalid", () => {
+ assertParseError("invalid");
+ });
+
+ it("returns object when users correctly specify library", () => {
+ assertParseResult(
+ `{
+ "compilerOptions": {
+ "lib": ["es5"]
+ }
+ }`, {
+ config: { compilerOptions: { lib: ["es5"] } }
+ });
+
+ assertParseResult(
+ `{
+ "compilerOptions": {
+ "lib": ["es5", "es6"]
+ }
+ }`, {
+ config: { compilerOptions: { lib: ["es5", "es6"] } }
+ });
+ });
+
+ it("returns error when tsconfig have excludes", () => {
+ assertParseErrorWithExcludesKeyword(
+ `{
+ "compilerOptions": {
+ "lib": ["es5"]
+ },
+ "excludes": [
+ "foge.ts"
+ ]
+ }`);
+ });
+
+ it("ignore dotted files and folders", () => {
+ assertParseFileList(
+ `{}`,
+ "tsconfig.json",
+ "/apath",
+ ["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"],
+ ["/apath/test.ts"]
+ );
+ });
+
+ it("allow dotted files and folders when explicitly requested", () => {
+ assertParseFileList(
+ `{
+ "files": ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"]
+ }`,
+ "tsconfig.json",
+ "/apath",
+ ["/apath/test.ts", "/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"],
+ ["/apath/.git/a.ts", "/apath/.b.ts", "/apath/..c.ts"]
+ );
+ });
+
+ it("always exclude outDir", () => {
+ const tsconfigWithoutExclude =
+ `{
+ "compilerOptions": {
+ "outDir": "bin"
+ }
+ }`;
+ const tsconfigWithExclude =
+ `{
+ "compilerOptions": {
+ "outDir": "bin"
+ },
+ "exclude": [ "obj" ]
+ }`;
+ const rootDir = "/";
+ const allFiles = ["/bin/a.ts", "/b.ts"];
+ const expectedFiles = ["/b.ts"];
+ assertParseFileList(tsconfigWithoutExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
+ assertParseFileList(tsconfigWithExclude, "tsconfig.json", rootDir, allFiles, expectedFiles);
+ });
+
+ it("implicitly exclude common package folders", () => {
+ assertParseFileList(
+ `{}`,
+ "tsconfig.json",
+ "/",
+ ["/node_modules/a.ts", "/bower_components/b.ts", "/jspm_packages/c.ts", "/d.ts", "/folder/e.ts"],
+ ["/d.ts", "/folder/e.ts"]
+ );
+ });
+ });
+}
diff --git a/tslint.json b/tslint.json
index ee116c6fcb0c5..c8fd777d3d6c3 100644
--- a/tslint.json
+++ b/tslint.json
@@ -7,6 +7,7 @@
"indent": [true,
"spaces"
],
+ "linebreak-style": [true, "CRLF"],
"one-line": [true,
"check-open-brace",
"check-whitespace"