Browse Source

Upgrade to new Typescript and Solidity

Juan Blanco 3 years ago
parent
commit
d271eb0cbe

+ 4 - 4
.vscode/launch.json

@@ -7,11 +7,11 @@
             "type": "extensionHost",
             "request": "launch",
             "runtimeExecutable": "${execPath}",
-            "args": ["code --extensionDevelopmentPath=${workspaceRoot}"],
-            "stopOnEntry": false,
+            "args": ["--extensionDevelopmentPath=${workspaceRoot}"],
             "sourceMaps": true,
-            "outFiles": ["${workspaceRoot}/out/src"],
-            "preLaunchTask": "npm"
+            "outFiles": ["${workspaceRoot}/out/src/**/*.js"],
+            "preLaunchTask": "npm",
+             "stopOnEntry": false
         },
         {
             "name": "Launch Tests",

+ 9 - 0
.vscodeignore

@@ -0,0 +1,9 @@
+.vscode/**
+.vscode-test/**
+out/test/**
+test/**
+src/**
+**/*.map
+.gitignore
+tsconfig.json
+vsc-extension-quickstart.md

+ 1 - 0
README.md

@@ -21,6 +21,7 @@ To compile using a different version of Solidity, for example latest or 'v0.4.3+
 Work in progress, any feedback appreciated.
 
 For ideas, issues, additions, modifications please raise an issue or a pull request at https://github.com/juanfranblanco/vscode-solidity/
+and / or send a message on gitter at https://gitter.im/vscode-solidity/Lobby
 
 # Credits
 

+ 17 - 16
package.json

@@ -4,7 +4,7 @@
   "keywords": [
     "soliity", "ethereum", "blockchain", "compiler"
   ],
-  "version": "0.0.21",
+  "version": "0.0.22",
   "publisher": "JuanBlanco",
   "engines": {
     "vscode": "^1.5.1"
@@ -29,25 +29,26 @@
     "onCommand:solidity.compile.active",
     "onCommand:solidity.codegen"
   ],
-  
-  "main": "./out/src/extension",
-  "scripts": {
-    "vscode:prepublish": "node ./node_modules/vscode/bin/compile",
-    "compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
-    "postinstall": "node ./node_modules/vscode/bin/install"
-  },
-  "dependencies": {
+    "main": "./out/src/extension",
+    "scripts": {
+        "vscode:prepublish": "tsc -p ./",
+        "compile": "tsc -watch -p ./",
+        "postinstall": "node ./node_modules/vscode/bin/install"
+    },
+
+ "dependencies": {
     "fs-extra": "^0.30.0",
     "read-yaml": "^1.0.0",
-    "solc": "^0.4.9",
+    "solc": "^0.4.10",
     "abi-code-gen": "0.0.3",
     "truffle-artifactor":"2.1.3"
   },
-  "devDependencies": {
-    "tslint": "^3.15.1",
-    "typescript": "1.8.10",
-    "vscode": "^0.11.18"
-  },
+ "devDependencies": {
+        "typescript": "^2.0.3",
+        "vscode": "^1.0.0",
+        "@types/node": "^6.0.40",
+        "tslint": "^3.15.1"
+    },
   "contributes": {
     "configuration": {
         "type": "object",
@@ -114,4 +115,4 @@
       }
     ]
   }
-}
+}

+ 3 - 1
src/compiler.ts

@@ -208,13 +208,15 @@ function writeCompilationOutputToBuildDirectory(output: any, buildDir: string, s
                             };
 
                             fs.writeFileSync(contractJsonPath, JSON.stringify(shortJsonOutput, null, 4));
-
+                            /*
                             let contract_data = {
+                                contract_name: contractName,
                                 abi: output.contracts[source + ':' + contractName].interface,
                                 unlinked_binary: output.contracts[source + ':' + contractName].bytecode,
                                 };
 
                             artifactor.save(contract_data, truffleArtifactPath);
+                            */
                         }
                     });
                 }

+ 5 - 2
tsconfig.json

@@ -3,11 +3,14 @@
         "module": "commonjs",
         "target": "es6",
         "outDir": "out",
-        "noLib": true,
+        "lib": [
+            "es6"
+        ],
         "sourceMap": true,
         "rootDir": "."
     },
     "exclude": [
-        "node_modules"
+        "node_modules",
+        ".vscode-test"
     ]
 }

+ 0 - 4
typings/abi-code-gen.d.ts

@@ -1,4 +0,0 @@
-declare module "abi-code-gen" {
- var abicodegen: any; 
- export = abicodegen;
-}

+ 0 - 52
typings/diff-match-patch.d.ts

@@ -1,52 +0,0 @@
-// Type definitions for diff-match-patch v1.0.0
-// Project: https://www.npmjs.com/package/diff-match-patch
-// Definitions by: Asana <https://asana.com>
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-declare module "diff-match-patch" {
-	type Diff = [number, string];
-	export class Patch {
-		diffs: Diff[];
-		start1: number;
-		start2: number;
-		length1: number;
-		length2: number;
-	}
-
-	export class diff_match_patch {
-		static new (): diff_match_patch;
-
-		Diff_Timeout: number;
-		Diff_EditCost: number;
-		Match_Threshold: number;
-		Match_Distance: number;
-		Patch_DeleteThreshold: number;
-		Patch_Margin: number;
-		Match_MaxBits: number;
-
-		diff_main(text1: string, text2: string, opt_checklines?: boolean, opt_deadline?: number): Diff[];
-		diff_commonPrefix(text1: string, text2: string): number;
-		diff_commonSuffix(text1: string, text2: string): number;
-		diff_cleanupSemantic(diffs: Diff[]): void;
-		diff_cleanupSemanticLossless(diffs: Diff[]): void;
-		diff_cleanupEfficiency(diffs: Diff[]): void;
-		diff_cleanupMerge(diffs: Diff[]): void;
-		diff_xIndex(diffs: Diff[], loc: number): number;
-		diff_prettyHtml(diffs: Diff[]): string;
-		diff_text1(diffs: Diff[]): string;
-		diff_text2(diffs: Diff[]): string;
-		diff_levenshtein(diffs: Diff[]): number;
-		diff_toDelta(diffs: Diff[]): string;
-		diff_fromDelta(text1: string, delta: string): Diff[];
-
-		patch_make(text1, text2: string): Patch[];
-		patch_deepCopy(patches: Patch[]): Patch[];
-		patch_apply(patches: Patch[], text: string): [string, boolean[]];
-		patch_fromText(text: string): Patch[];
-		patch_toText(patches: Patch[]): string;
-	}
-
-	export var DIFF_DELETE: number;
-	export var DIFF_INSERT: number;
-	export var DIFF_EQUAL: number;
-}

+ 0 - 195
typings/fs-extra/fs-extra.d.ts

@@ -1,195 +0,0 @@
-// Type definitions for fs-extra
-// Project: https://github.com/jprichardson/node-fs-extra
-// Definitions by: midknight41 <https://github.com/midknight41>
-// Definitions: https://github.com/borisyankov/DefinitelyTyped
-
-// Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts
-
-///<reference path="../node/node.d.ts"/>
-
-declare module "fs-extra" {
-	import stream = require("stream");
-
-	export interface Stats {
-		isFile(): boolean;
-		isDirectory(): boolean;
-		isBlockDevice(): boolean;
-		isCharacterDevice(): boolean;
-		isSymbolicLink(): boolean;
-		isFIFO(): boolean;
-		isSocket(): boolean;
-		dev: number;
-		ino: number;
-		mode: number;
-		nlink: number;
-		uid: number;
-		gid: number;
-		rdev: number;
-		size: number;
-		blksize: number;
-		blocks: number;
-		atime: Date;
-		mtime: Date;
-		ctime: Date;
-	}
-
-	export interface FSWatcher {
-		close(): void;
-	}
-
-	export class ReadStream extends stream.Readable { }
-	export class WriteStream extends stream.Writable { }
-
-	//extended methods
-	export function copy(src: string, dest: string, callback?: (err: Error) => void): void;
-	export function copy(src: string, dest: string, filter: (src: string) => boolean, callback?: (err: Error) => void): void;
-
-	export function copySync(src: string, dest: string): void;
-	export function copySync(src: string, dest: string, filter: (src: string) => boolean): void;
-
-	export function createFile(file: string, callback?: (err: Error) => void): void;
-	export function createFileSync(file: string): void;
-
-	export function mkdirs(dir: string, callback?: (err: Error) => void): void;
-	export function mkdirp(dir: string, callback?: (err: Error) => void): void;
-	export function mkdirs(dir: string, options?: MkdirOptions, callback?: (err: Error) => void): void;
-	export function mkdirp(dir: string, options?: MkdirOptions, callback?: (err: Error) => void): void;
-	export function mkdirsSync(dir: string, options?: MkdirOptions): void;
-	export function mkdirpSync(dir: string, options?: MkdirOptions): void;
-
-	export function outputFile(file: string, data: any, callback?: (err: Error) => void): void;
-	export function outputFileSync(file: string, data: any): void;
-
-	export function outputJson(file: string, data: any, callback?: (err: Error) => void): void;
-	export function outputJSON(file: string, data: any, callback?: (err: Error) => void): void;
-	export function outputJsonSync(file: string, data: any): void;
-	export function outputJSONSync(file: string, data: any): void;
-
-	export function readJson(file: string, callback?: (err: Error) => void): void;
-	export function readJson(file: string, options?: OpenOptions, callback?: (err: Error) => void): void;
-	export function readJSON(file: string, callback?: (err: Error) => void): void;
-	export function readJSON(file: string, options?: OpenOptions, callback?: (err: Error) => void): void;
-
-	export function readJsonSync(file: string, options?: OpenOptions): void;
-	export function readJSONSync(file: string, options?: OpenOptions): void;
-
-	export function remove(dir: string, callback?: (err: Error) => void): void;
-	export function removeSync(dir: string): void;
-	// export function delete(dir: string, callback?: (err: Error) => void): void;
-	// export function deleteSync(dir: string): void;
-
-	export function writeJson(file: string, object: any, callback?: (err: Error) => void): void;
-	export function writeJson(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void;
-	export function writeJSON(file: string, object: any, callback?: (err: Error) => void): void;
-	export function writeJSON(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void;
-
-	export function writeJsonSync(file: string, object: any, options?: OpenOptions): void;
-	export function writeJSONSync(file: string, object: any, options?: OpenOptions): void;
-
-	export function rename(oldPath: string, newPath: string, callback?: (err: Error) => void): void;
-	export function renameSync(oldPath: string, newPath: string): void;
-	export function truncate(fd: number, len: number, callback?: (err: Error) => void): void;
-	export function truncateSync(fd: number, len: number): void;
-	export function chown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void;
-	export function chownSync(path: string, uid: number, gid: number): void;
-	export function fchown(fd: number, uid: number, gid: number, callback?: (err: Error) => void): void;
-	export function fchownSync(fd: number, uid: number, gid: number): void;
-	export function lchown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void;
-	export function lchownSync(path: string, uid: number, gid: number): void;
-	export function chmod(path: string, mode: number, callback?: (err: Error) => void): void;
-	export function chmod(path: string, mode: string, callback?: (err: Error) => void): void;
-	export function chmodSync(path: string, mode: number): void;
-	export function chmodSync(path: string, mode: string): void;
-	export function fchmod(fd: number, mode: number, callback?: (err: Error) => void): void;
-	export function fchmod(fd: number, mode: string, callback?: (err: Error) => void): void;
-	export function fchmodSync(fd: number, mode: number): void;
-	export function fchmodSync(fd: number, mode: string): void;
-	export function lchmod(path: string, mode: string, callback?: (err: Error) => void): void;
-	export function lchmod(path: string, mode: number, callback?: (err: Error) => void): void;
-	export function lchmodSync(path: string, mode: number): void;
-	export function lchmodSync(path: string, mode: string): void;
-	export function stat(path: string, callback?: (err: Error, stats: Stats) => void): void;
-	export function lstat(path: string, callback?: (err: Error, stats: Stats) => void): void;
-	export function fstat(fd: number, callback?: (err: Error, stats: Stats) => void): void;
-	export function statSync(path: string): Stats;
-	export function lstatSync(path: string): Stats;
-	export function fstatSync(fd: number): Stats;
-	export function link(srcpath: string, dstpath: string, callback?: (err: Error) => void): void;
-	export function linkSync(srcpath: string, dstpath: string): void;
-	export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err: Error) => void): void;
-	export function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
-	export function readlink(path: string, callback?: (err: Error, linkString: string) => void): void;
-	export function realpath(path: string, callback?: (err: Error, resolvedPath: string) => void): void;
-	export function realpath(path: string, cache: string, callback: (err: Error, resolvedPath: string) => void): void;
-	export function realpathSync(path: string, cache?: boolean): string;
-	export function unlink(path: string, callback?: (err: Error) => void): void;
-	export function unlinkSync(path: string): void;
-	export function rmdir(path: string, callback?: (err: Error) => void): void;
-	export function rmdirSync(path: string): void;
-	export function mkdir(path: string, mode?: number, callback?: (err: Error) => void): void;
-	export function mkdir(path: string, mode?: string, callback?: (err: Error) => void): void;
-	export function mkdirSync(path: string, mode?: number): void;
-	export function mkdirSync(path: string, mode?: string): void;
-	export function readdir(path: string, callback?: (err: Error, files: string[]) => void ): void;
-	export function readdirSync(path: string): string[];
-	export function close(fd: number, callback?: (err: Error) => void): void;
-	export function closeSync(fd: number): void;
-	export function open(path: string, flags: string, mode?: string, callback?: (err: Error, fs: number) => void): void;
-	export function openSync(path: string, flags: string, mode?: string): number;
-	export function utimes(path: string, atime: number, mtime: number, callback?: (err: Error) => void): void;
-	export function utimesSync(path: string, atime: number, mtime: number): void;
-	export function futimes(fd: number, atime: number, mtime: number, callback?: (err: Error) => void): void;
-	export function futimesSync(fd: number, atime: number, mtime: number): void;
-	export function fsync(fd: number, callback?: (err: Error) => void): void;
-	export function fsyncSync(fd: number): void;
-	export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: NodeBuffer) => void): void;
-	export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
-	export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void ): void;
-	export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
-	export function readFile(filename: string, encoding: string, callback: (err: Error, data: string) => void ): void;
-	export function readFile(filename: string, options: OpenOptions, callback: (err: Error, data: string) => void ): void;
-	export function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void ): void;
-	export function readFileSync(filename: string): NodeBuffer;
-	export function readFileSync(filename: string, encoding: string): string;
-	export function readFileSync(filename: string, options: OpenOptions): string;
-	export function writeFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void;
-	export function writeFile(filename: string, data: any, options?: OpenOptions, callback?: (err: Error) => void): void;
-	export function writeFileSync(filename: string, data: any, encoding?: string): void;
-	export function writeFileSync(filename: string, data: any, option?: OpenOptions): void;
-	export function appendFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void;
-	export function appendFile(filename: string, data: any,option?: OpenOptions, callback?: (err: Error) => void): void;
-	export function appendFileSync(filename: string, data: any, encoding?: string): void;
-	export function appendFileSync(filename: string, data: any, option?: OpenOptions): void;
-	export function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void;
-	export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void;
-	export function unwatchFile(filename: string, listener?: Stats): void;
-	export function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
-	export function exists(path: string, callback?: (exists: boolean) => void ): void;
-	export function existsSync(path: string): boolean;
-	export function ensureDir(path: string, cb: (err: Error) => void): void;
-
-	export interface OpenOptions {
-		encoding?: string;
-		flag?: string;
-	}
-
-	export interface MkdirOptions {
-		fs?: any;
-		mode?: number;
-	}
-
-	export interface ReadStreamOptions {
-		flags?: string;
-		encoding?: string;
-		fd?: number;
-		mode?: number;
-		bufferSize?: number;
-	}
-	export interface WriteStreamOptions {
-		flags?: string;
-		encoding?: string;
-		string?: string;
-	}
-	export function createReadStream(path: string, options?: ReadStreamOptions): ReadStream;
-	export function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream;
-}

+ 0 - 10
typings/json-rpc2.d.ts

@@ -1,10 +0,0 @@
-declare module "json-rpc2" {
-	export interface RPCConnection {
-		call<T>(command: string, args: any[], callback: (err: Error, result:T) => void): void;
-	}
-	
-	export class Client {
-		static $create(port: number, addr: string): Client;
-		connectSocket(callback: (err: Error, conn: RPCConnection) => void): void;
-	}
-}

File diff suppressed because it is too large
+ 0 - 13760
typings/lodash.d.ts


+ 0 - 1
typings/node/node.d.ts

@@ -1 +0,0 @@
-/// <reference path="../../node_modules/vscode/typings/index.d.ts" />

+ 0 - 4
typings/read-yaml.d.ts

@@ -1,4 +0,0 @@
-declare module "read-yaml" {
- var readyaml: any; 
- export = readyaml;
-}

+ 0 - 4
typings/solc.d.ts

@@ -1,4 +0,0 @@
-declare module "solc" {
- var solc: any; 
- export = solc;
-}

+ 0 - 4
typings/truffle-artifactor.d.ts

@@ -1,4 +0,0 @@
-declare module "truffle-artifactor" {
- var truffleartifactor: any; 
- export = truffleartifactor;
-}

+ 0 - 1
typings/vscode-typings.d.ts

@@ -1 +0,0 @@
-/// <reference path="../node_modules/vscode/typings/index.d.ts" />