From b419a4d967e15a215f42484d69d1a420392f9e32 Mon Sep 17 00:00:00 2001 From: vvakame Date: Sun, 19 Apr 2015 02:21:14 +0900 Subject: [PATCH 1/3] add donna definitions --- donna/donna-tests.ts | 81 ++++++++++++++++++++++++++++++++++++++++++++ donna/donna.d.ts | 34 +++++++++++++++++++ donna/tsconfig.json | 19 +++++++++++ 3 files changed, 134 insertions(+) create mode 100644 donna/donna-tests.ts create mode 100644 donna/donna.d.ts create mode 100644 donna/tsconfig.json diff --git a/donna/donna-tests.ts b/donna/donna-tests.ts new file mode 100644 index 0000000000..a1695e42a2 --- /dev/null +++ b/donna/donna-tests.ts @@ -0,0 +1,81 @@ +/// + +import donna = require("donna"); +var metadata = donna.generateMetadata(['/path/to/my-module', '/path/to/another-module']); + +metadata = { + "files": { + "spec/metadata_templates/classes/class_with_prototype_properties.coffee": { + "objects": { + "3": { + "0": { + "type": "class", + "name": "TextBuffer", + "bindingType": null, + "classProperties": [], + "prototypeProperties": [ + [ + 4, + 9 + ], + [ + 11, + 11 + ] + ], + "doc": " Public: A mutable text container with undo/redo support and the ability to\nannotate logical regions in the text.\n\n ", + "range": [ + [ + 3, + 0 + ], + [ + 11, + 17 + ] + ] + } + }, + "4": { + "9": { + "name": "prop2", + "type": "primitive", + "range": [ + [ + 4, + 9 + ], + [ + 4, + 13 + ] + ], + "bindingType": "prototypeProperty" + } + }, + "11": { + "11": { + "name": "method2", + "bindingType": "prototypeProperty", + "type": "function", + "paramNames": [ + "a" + ], + "range": [ + [ + 11, + 11 + ], + [ + 11, + 16 + ] + ], + "doc": " Public: Takes an argument and does some stuff.\n\na - A {String}\n\nReturns {Boolean}. " + } + } + }, + "exports": {} + } + } +}; diff --git a/donna/donna.d.ts b/donna/donna.d.ts new file mode 100644 index 0000000000..fed09fa988 --- /dev/null +++ b/donna/donna.d.ts @@ -0,0 +1,34 @@ +// Type definitions for donna +// Project: https://github.com/atom/donna +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "donna" { + function generateMetadata(modules: string[]): DonnaTypes.Metadata; +} + +declare module DonnaTypes { + interface Metadata { + files: { [filePath: string]: File; }; + } + + interface File { + objects: { [line: number]: Line; }; + exports: any; + } + + interface Line { + [row: number]: Object; + } + + interface Object { + type: string; + name: string; + bindingType: string; + classProperties?: any[]; + prototypeProperties?: number[][]; + doc?: string; + range: number[][]; + + } +} diff --git a/donna/tsconfig.json b/donna/tsconfig.json new file mode 100644 index 0000000000..e079acce07 --- /dev/null +++ b/donna/tsconfig.json @@ -0,0 +1,19 @@ +{ + "version": "1.4.1", + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "declaration": false, + "noImplicitAny": false, + "removeComments": true, + "noLib": false + }, + "filesGlob": [ + "./**/*.ts", + "!./node_modules/**/*.ts" + ], + "files": [ + "./donna-tests.ts", + "./donna.d.ts" + ] +} \ No newline at end of file From 26587ce0dfd3f3155511ae3cac273f0d58f34dee Mon Sep 17 00:00:00 2001 From: vvakame Date: Sun, 19 Apr 2015 02:42:12 +0900 Subject: [PATCH 2/3] add atom/api-docs.d.ts --- atom/api-docs.d.ts | 107 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 atom/api-docs.d.ts diff --git a/atom/api-docs.d.ts b/atom/api-docs.d.ts new file mode 100644 index 0000000000..a4fc19eea1 --- /dev/null +++ b/atom/api-docs.d.ts @@ -0,0 +1,107 @@ +// Type definitions for Atom API docs +// Project: https://github.com/atom/atom/blob/master/build/tasks/docs-task.coffee +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* + How to generate. + $ git clone git@github.com:atom/atom.git + $ cd atom + $ npm install + $ cd build + $ npm install + $ grunt build-docs + $ cd ../ + $ ls -la la docs/output/api.json + api.json example https://gist.github.com/vvakame/10f8d2f3884affc32476 + */ + +declare module AtomDocTypes { + interface Metadata { + classes: { [className: string]: ClassInfo; }; + } + + interface ClassInfo { + name: string; + superClass: string; + visibility: string; + + filename: string; + srcUrl: string; + summary: string; + description: string; + examples: Example[]; + sections: Section[]; + + classMethods: ClassMethod[]; + classProperties: ClassProperty[]; + instanceMethods: InstanceMethod[]; + instanceProperties: InstanceProperty[]; + } + + interface Example { + description: string; + lang: string; + code: string; + raw: string; + } + + interface Section { + name: string; + description: string; + } + + interface ClassMethod { + name: string; + sectionName: string; + srcUrl: string; + visibility: string; + summary: string; + description: string; + arguments: Argument[]; + returnValues: ReturnValue[]; + } + + interface ClassProperty { + } + + interface InstanceMethod { + name: string; + sectionName: string; + srcUrl: string; + visibility: string; + summary: string; + description: string; + arguments: Argument[]; + returnValues: ReturnValue[]; + titledArguments: TitledArgument[]; + } + + interface InstanceProperty { + name: string; + sectionName: string; + srcUrl: string; + visibility: string; + summary: string; + description: string; + } + + interface Argument { + name: string; + description: string; + type: string; + isOptional: boolean; + children: Argument[]; + } + + interface TitledArgument { + title: string; + description: string; + arguments: Argument[]; + } + + interface ReturnValue { + type: string; + description: string; + } +} From ed9db05fc6b91d88fbd9aa02a349c0845745d894 Mon Sep 17 00:00:00 2001 From: vvakame Date: Sun, 19 Apr 2015 10:52:15 +0900 Subject: [PATCH 3/3] remove tsconfig.json --- donna/tsconfig.json | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 donna/tsconfig.json diff --git a/donna/tsconfig.json b/donna/tsconfig.json deleted file mode 100644 index e079acce07..0000000000 --- a/donna/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "1.4.1", - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "removeComments": true, - "noLib": false - }, - "filesGlob": [ - "./**/*.ts", - "!./node_modules/**/*.ts" - ], - "files": [ - "./donna-tests.ts", - "./donna.d.ts" - ] -} \ No newline at end of file