Skip to content

Commit 86b1cc7

Browse files
author
Sagi
committed
some minor tscc changes and support two sides enums
1 parent 4655711 commit 86b1cc7

File tree

6 files changed

+37
-68
lines changed

6 files changed

+37
-68
lines changed

LICENSE

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Apache License
2-
Version 2.0, January 2004
3-
http://www.apache.org/licenses/
1+
Copyright (c) 2016 Sagi Fogel
2+
3+
Apache License
4+
Version 2.0, January 2004
5+
http://www.apache.org/licenses/
46

57
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
68

compiler.ts

-51
This file was deleted.

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "typescript-closure-compiler",
33
"version": "0.0.0",
4-
"description": "typescript-closure-compiler",
4+
"description": "Patches the TypeScript compiler to generate JSDoc annotations",
5+
"repository": "https://github.com/sagifogel/typescript-closure-compiler.git",
56
"author": {
6-
"name": "sagi",
7-
"email": "[email protected]"
7+
"name": "Sagi Fogel"
88
},
99
"dependencies": {
10-
"jake": "^8.0.12"
10+
"typescript": "1.7.5"
1111
},
1212
"devDependencies": {
13-
"typescript": "^1.7.5"
13+
"jake": "8.0.12"
1414
}
1515
}

src/compiler/emitter.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace ts {
1515
interface CompilerExtendedOptions extends ts.CompilerOptions {
1616
emitInterfaces: boolean;
1717
emitAnnotations: boolean;
18+
emitOneSideEnum: boolean;
1819
}
1920

2021
let entities: Map<number> = {
@@ -7072,7 +7073,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
70727073
write(",");
70737074
}
70747075
});
7075-
7076+
if (!compilerOptions.emitOneSideEnum) {
7077+
write(",");
7078+
ts.forEach(node.members, (member, i) => {
7079+
writeLine();
7080+
write("\"");
7081+
writeEnumMemberDeclarationValue(member);
7082+
write("\"");
7083+
write(": ");
7084+
write("\"");
7085+
emitExpressionForPropertyName(member.name);
7086+
write("\"");
7087+
if (i < membersLength) {
7088+
write(",");
7089+
}
7090+
});
7091+
}
70767092
decreaseIndent();
70777093
writeLine();
70787094
write("};");

tscc

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ var ts = require("typescript");
44
var pkg = require(__dirname + "/package.json");
55

66
function reportDiagnostic(diagnostic) {
7-
var output = "";
7+
var output = "";
88
if (diagnostic.file) {
99
var loc = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
1010
output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): ";
1111
}
12-
var category = Object.keys(ts.DiagnosticCategory).filter(function(key) { return ts.DiagnosticCategory[key] === diagnostic.category; })[0];
12+
var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase();
1313
output += category.toLowerCase() + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine;
1414
ts.sys.write(output);
1515
}
@@ -131,11 +131,12 @@ function executeCommandLine(args) {
131131
}
132132

133133
compilerOptions = ts.extend({
134-
target: "es5",
135-
emitAnnotations: true
134+
emitAnnotations: true,
135+
emitOneSideEnum: true,
136+
target: ts.ScriptTarget.ES5
136137
}, compilerOptions);
137138

138-
if (!ts.hasOwnProperty(compilerOptions, "emitInterfaces")) {
139+
if (!compilerOptions.hasOwnProperty("emitInterfaces")) {
139140
compilerOptions.emitInterfaces = true;
140141
}
141142

@@ -156,4 +157,4 @@ function executeCommandLine(args) {
156157
}
157158
}
158159

159-
executeCommandLine();
160+
executeCommandLine(ts.sys.args);

typescript-closure-compiler.njsproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
66
<Name>typescript-closure-compiler</Name>
77
<RootNamespace>typescript-closure-compiler</RootNamespace>
8+
<ScriptArguments>
9+
</ScriptArguments>
810
</PropertyGroup>
911
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1012
<PropertyGroup>
@@ -24,7 +26,7 @@
2426
<TypeScriptSourceMap>true</TypeScriptSourceMap>
2527
<TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
2628
<EnableTypeScript>true</EnableTypeScript>
27-
<StartWebBrowser>false</StartWebBrowser>
29+
<StartWebBrowser>False</StartWebBrowser>
2830
</PropertyGroup>
2931
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
3032
<DebugSymbols>true</DebugSymbols>
@@ -36,7 +38,6 @@
3638
<Content Include="package.json" />
3739
<Content Include="README.md" />
3840
<Content Include="tscc" />
39-
<TypeScriptCompile Include="compiler.ts" />
4041
<TypeScriptCompile Include="Scripts\typings\node\node.d.ts" />
4142
<TypeScriptCompile Include="src\compiler\binder.ts" />
4243
<TypeScriptCompile Include="src\compiler\checker.ts" />

0 commit comments

Comments
 (0)