4 |
5 |
6 |
7 | InversifyJS DevTools
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 2,
3 | "name": "InversifyJS DevTools",
4 | "description": "The official InverisyJS development tools",
5 | "version": "1.0.0",
6 | "devtools_page": "devtools.html",
7 | "permissions": [
8 | "tabs"
9 | ]
10 | }
--------------------------------------------------------------------------------
/media/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/inversify/inversify-chrome-devtools/1155e3018497e264c0816b931f68a111c35e3345/media/icon.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "inversify-chrome-devtools",
3 | "version": "1.0.0",
4 | "description": "A chrome extension that aims to help developers working with InversifyJS",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "gulp"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/inversify/inversify-chrome-devtools.git"
12 | },
13 | "keywords": [
14 | "chrome",
15 | "extension",
16 | "inversifyjs",
17 | "dependency",
18 | "inversion",
19 | "control",
20 | "ioc"
21 | ],
22 | "author": "Remo H. Jansen (http://www.remojansen.com)",
23 | "license": "MIT",
24 | "bugs": {
25 | "url": "https://github.com/inversify/inversify-chrome-devtools/issues"
26 | },
27 | "homepage": "https://github.com/inversify/inversify-chrome-devtools#readme",
28 | "dependencies": {
29 | "inversify-devtools": "^1.0.0-beta.5"
30 | },
31 | "devDependencies": {
32 | "browserify": "^13.0.1",
33 | "envify": "^3.4.1",
34 | "gulp": "^3.9.1",
35 | "gulp-clean-css": "^2.0.10",
36 | "gulp-concat": "^2.6.0",
37 | "gulp-tslint": "^5.0.0",
38 | "gulp-typescript": "^2.13.6",
39 | "inversify": "^2.0.0-rc.5",
40 | "inversify-dts": "^1.6.0",
41 | "reflect-metadata": "^0.1.3",
42 | "run-sequence": "^1.2.1",
43 | "tslint": "^3.12.1",
44 | "vinyl-buffer": "^1.0.0",
45 | "vinyl-source-stream": "^1.1.0"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import render from "inversify-devtools";
2 |
3 | document.addEventListener("DOMContentLoaded", function() {
4 | let connectKernel = render("root");
5 | let win: any = window;
6 | win.__inversifyDevtools__ = connectKernel;
7 | });
8 |
--------------------------------------------------------------------------------
/temp/main.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var inversify_devtools_1 = require("inversify-devtools");
3 | document.addEventListener("DOMContentLoaded", function () {
4 | var connectKernel = inversify_devtools_1.default("root");
5 | var win = window;
6 | win.__inversifyDevtools__ = connectKernel;
7 | });
8 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "commonjs",
5 | "moduleResolution": "node",
6 | "isolatedModules": false,
7 | "jsx": "react",
8 | "experimentalDecorators": true,
9 | "emitDecoratorMetadata": true,
10 | "declaration": false,
11 | "noImplicitAny": true,
12 | "removeComments": true,
13 | "noLib": false,
14 | "preserveConstEnums": true,
15 | "suppressImplicitAnyIndexErrors": false
16 | },
17 | "files": [
18 | "typings/index.d.ts",
19 | "node_modules/reflect-metadata/reflect-metadata.d.ts",
20 | "node_modules/inversify-dts/inversify-devtools/inversify-devtools.d.ts",
21 | "src/main.ts"
22 | ]
23 | }
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "class-name": true,
4 | "comment-format": [true, "check-space"],
5 | "curly": true,
6 | "eofline": true,
7 | "forin": true,
8 | "indent": [true, "spaces"],
9 | "label-position": true,
10 | "label-undefined": true,
11 | "max-line-length": [true, 140],
12 | "member-access": true,
13 | "member-ordering": [true,
14 | "public-before-private",
15 | "static-before-instance",
16 | "variables-before-functions"
17 | ],
18 | "no-arg": true,
19 | "no-bitwise": true,
20 | "no-console": [true,
21 | "debug",
22 | "info",
23 | "time",
24 | "timeEnd",
25 | "trace"
26 | ],
27 | "no-construct": true,
28 | "no-debugger": true,
29 | "no-duplicate-key": true,
30 | "no-duplicate-variable": true,
31 | "no-empty": true,
32 | "no-eval": true,
33 | "no-inferrable-types": true,
34 | "no-shadowed-variable": true,
35 | "no-string-literal": true,
36 | "no-switch-case-fall-through": false,
37 | "no-trailing-whitespace": true,
38 | "no-unused-expression": true,
39 | "no-unused-variable": false,
40 | "no-unreachable": true,
41 | "no-use-before-declare": true,
42 | "no-var-keyword": true,
43 | "object-literal-sort-keys": true,
44 | "one-line": [true,
45 | "check-open-brace",
46 | "check-catch",
47 | "check-else",
48 | "check-whitespace"
49 | ],
50 | "quotemark": [true, "double", "avoid-escape"],
51 | "radix": true,
52 | "semicolon": true,
53 | "trailing-comma": false,
54 | "triple-equals": [true, "allow-null-check"],
55 | "typedef-whitespace": [true, {
56 | "call-signature": "nospace",
57 | "index-signature": "nospace",
58 | "parameter": "nospace",
59 | "property-declaration": "nospace",
60 | "variable-declaration": "nospace"
61 | }],
62 | "variable-name": false,
63 | "whitespace": [true,
64 | "check-branch",
65 | "check-decl",
66 | "check-operator",
67 | "check-separator",
68 | "check-type"
69 | ]
70 | }
71 | }
--------------------------------------------------------------------------------
/typings.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "inversify-chrome-devtools",
3 | "dependencies": {},
4 | "globalDependencies": {
5 | "bluebird": "registry:dt/bluebird#2.0.0+20160319051630",
6 | "mocha": "registry:dt/mocha#2.2.5+20160619032855"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/typings/globals/bluebird/index.d.ts:
--------------------------------------------------------------------------------
1 | // Generated by typings
2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/149aa09a23582fb6aac6f5e2518ce19b1efe25b8/bluebird/bluebird.d.ts
3 | declare var Promise: PromiseConstructor;
4 |
5 | interface PromiseConstructor {
6 | /**
7 | * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise.
8 | */
9 | new (callback: (resolve: (thenableOrResult?: T | PromiseLike) => void, reject: (error: any) => void) => void): Promise;
10 |
11 | config(options: {
12 | warnings?: boolean | {wForgottenReturn?: boolean};
13 | longStackTraces?: boolean;
14 | cancellation?: boolean;
15 | monitoring?: boolean;
16 | }): void;
17 |
18 | // Ideally, we'd define e.g. "export class RangeError extends Error {}",
19 | // but as Error is defined as an interface (not a class), TypeScript doesn't
20 | // allow extending Error, only implementing it.
21 | // However, if we want to catch() only a specific error type, we need to pass
22 | // a constructor function to it. So, as a workaround, we define them here as such.
23 | RangeError(): RangeError;
24 | CancellationError(): Promise.CancellationError;
25 | TimeoutError(): Promise.TimeoutError;
26 | TypeError(): Promise.TypeError;
27 | RejectionError(): Promise.RejectionError;
28 | OperationalError(): Promise.OperationalError;
29 |
30 | /**
31 | * Changes how bluebird schedules calls a-synchronously.
32 | *
33 | * @param scheduler Should be a function that asynchronously schedules
34 | * the calling of the passed in function
35 | */
36 | setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void;
37 |
38 | /**
39 | * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise.
40 | *
41 | * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call.
42 | *
43 | * Alias for `attempt();` for compatibility with earlier ECMAScript version.
44 | */
45 | try(fn: () => T | PromiseLike, args?: any[], ctx?: any): Promise;
46 |
47 | attempt(fn: () => T | PromiseLike, args?: any[], ctx?: any): Promise;
48 |
49 | /**
50 | * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function.
51 | * This method is convenient when a function can sometimes return synchronously or throw synchronously.
52 | */
53 | method(fn: Function): Function;
54 |
55 | /**
56 | * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state.
57 | */
58 | resolve(value: T | PromiseLike): Promise;
59 | resolve(): Promise;
60 |
61 | /**
62 | * Create a promise that is rejected with the given `reason`.
63 | */
64 | reject(reason: any): Promise;
65 | reject(reason: any): Promise;
66 |
67 | /**
68 | * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution).
69 | */
70 | defer(): Promise.Resolver;
71 |
72 | /**
73 | * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable.
74 | */
75 | cast(value: T | PromiseLike): Promise;
76 |
77 | /**
78 | * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`.
79 | */
80 | bind(thisArg: any): Promise;
81 |
82 | /**
83 | * See if `value` is a trusted Promise.
84 | */
85 | is(value: any): boolean;
86 |
87 | /**
88 | * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency.
89 | */
90 | longStackTraces(): void;
91 |
92 | /**
93 | * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise.
94 | */
95 | // TODO enable more overloads
96 | delay(ms: number, value: T | PromiseLike): Promise;
97 | delay(ms: number): Promise;
98 |
99 | /**
100 | * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument.
101 | *
102 | * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them.
103 | *
104 | * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`.
105 | */
106 | promisify(func: (callback: (err: any, result: T) => void) => void, receiver?: any): () => Promise;
107 | promisify(func: (arg1: A1, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1) => Promise;
108 | promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2) => Promise;
109 | promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3) => Promise;
110 | promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise;
111 | promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise;
112 | promisify(nodeFunction: Function, receiver?: any): Function;
113 |
114 | /**
115 | * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object.
116 | *
117 | * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method.
118 | */
119 | // TODO how to model promisifyAll?
120 | promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any;
121 |
122 |
123 | /**
124 | * Returns a promise that is resolved by a node style callback function.
125 | */
126 | fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise;
127 | fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise;
128 |
129 | /**
130 | * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
131 | */
132 | // TODO fix coroutine GeneratorFunction
133 | coroutine(generatorFunction: Function): Function;
134 |
135 | /**
136 | * Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
137 | */
138 | // TODO fix spawn GeneratorFunction
139 | spawn(generatorFunction: Function): Promise;
140 |
141 | /**
142 | * This is relevant to browser environments with no module loader.
143 | *
144 | * Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else.
145 | */
146 | noConflict(): typeof Promise;
147 |
148 | /**
149 | * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers.
150 | *
151 | * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections.
152 | */
153 | onPossiblyUnhandledRejection(handler: (reason: any) => any): void;
154 |
155 | /**
156 | * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason.
157 | */
158 | // TODO enable more overloads
159 | // promise of array with promises of value
160 | all(values: PromiseLike[]>): Promise;
161 | // promise of array with values
162 | all(values: PromiseLike): Promise;
163 | // array with promises of value
164 | all(values: PromiseLike[]): Promise;
165 | // array with promises of different types
166 | all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4, T5]>;
167 | all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4]>;
168 | all(values: [PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3]>;
169 | all(values: [PromiseLike, PromiseLike]): Promise<[T1, T2]>;
170 | // array with values
171 | all(values: T[]): Promise;
172 |
173 | /**
174 | * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason.
175 | *
176 | * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties.
177 | *
178 | * *The original object is not modified.*
179 | */
180 | // TODO verify this is correct
181 | // trusted promise for object
182 | props(object: Promise