##// END OF EJS Templates
changed the project structure
cin -
r49:1a91da7b15f7 di-typescript
parent child
Show More
@@ -0,0 +1,11
1 {
2 "extends": "../tsconfig.json",
3 "compilerOptions": {
4 "types": [
5 "@types/requirejs"
6 ]
7 },
8 "include": [
9 "ts/**/*.ts"
10 ]
11 } No newline at end of file
@@ -0,0 +1,6
1 {
2 "extends": "../tsconfig.json",
3 "include": [
4 "ts/**/*.ts"
5 ]
6 } No newline at end of file
@@ -44,20 +44,19 task _npmInstall() {
44 }
44 }
45
45
46 task _legacyJs(type:Copy) {
46 task _legacyJs(type:Copy) {
47 from 'src/js/'
47 from 'src/main/js/'
48 into distDir
48 into distDir
49 }
49 }
50
50
51 task _buildTs(dependsOn: _npmInstall, type:Exec) {
51 task _buildTs(dependsOn: _npmInstall, type:Exec) {
52 inputs.dir('src/ts')
52 inputs.dir('src/main/ts')
53 inputs.file('src/tsconfig.json')
53 inputs.file('src/tsconfig.json')
54 inputs.file('src/main/tsconfig.json')
54 outputs.dir(distDir)
55 outputs.dir(distDir)
55
56
56 commandLine 'node_modules/.bin/tsc',
57 commandLine 'node_modules/.bin/tsc',
57 '-p', 'src/tsconfig.json',
58 '-p', 'src/main/tsconfig.json',
58 '--outDir', distDir,
59 '--outDir', distDir
59 '--listFiles',
60 '--traceResolution'
61 }
60 }
62
61
63 task _packageMeta(type: Copy) {
62 task _packageMeta(type: Copy) {
@@ -10,6 +10,12
10 "integrity": "sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A==",
10 "integrity": "sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A==",
11 "dev": true
11 "dev": true
12 },
12 },
13 "@types/requirejs": {
14 "version": "2.1.31",
15 "resolved": "https://registry.npmjs.org/@types/requirejs/-/requirejs-2.1.31.tgz",
16 "integrity": "sha512-b2soeyuU76rMbcRJ4e0hEl0tbMhFwZeTC0VZnfuWlfGlk6BwWNsev6kFu/twKABPX29wkX84wU2o+cEJoXsiTw==",
17 "dev": true
18 },
13 "@types/tape": {
19 "@types/tape": {
14 "version": "4.2.32",
20 "version": "4.2.32",
15 "resolved": "http://registry.npmjs.org/@types/tape/-/tape-4.2.32.tgz",
21 "resolved": "http://registry.npmjs.org/@types/tape/-/tape-4.2.32.tgz",
@@ -84,7 +90,7
84 },
90 },
85 "duplexer": {
91 "duplexer": {
86 "version": "0.1.1",
92 "version": "0.1.1",
87 "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
93 "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
88 "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
94 "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
89 "dev": true
95 "dev": true
90 },
96 },
@@ -129,7 +135,7
129 "dependencies": {
135 "dependencies": {
130 "tape": {
136 "tape": {
131 "version": "2.3.3",
137 "version": "2.3.3",
132 "resolved": "https://registry.npmjs.org/tape/-/tape-2.3.3.tgz",
138 "resolved": "http://registry.npmjs.org/tape/-/tape-2.3.3.tgz",
133 "integrity": "sha1-Lnzgox3wn41oUWZKcYQuDKUFevc=",
139 "integrity": "sha1-Lnzgox3wn41oUWZKcYQuDKUFevc=",
134 "dev": true,
140 "dev": true,
135 "requires": {
141 "requires": {
@@ -289,7 +295,7
289 },
295 },
290 "path-is-absolute": {
296 "path-is-absolute": {
291 "version": "1.0.1",
297 "version": "1.0.1",
292 "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
298 "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
293 "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
299 "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
294 "dev": true
300 "dev": true
295 },
301 },
@@ -301,7 +307,7
301 },
307 },
302 "readable-stream": {
308 "readable-stream": {
303 "version": "1.1.14",
309 "version": "1.1.14",
304 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
310 "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
305 "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
311 "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
306 "dev": true,
312 "dev": true,
307 "requires": {
313 "requires": {
@@ -354,7 +360,7
354 },
360 },
355 "string_decoder": {
361 "string_decoder": {
356 "version": "0.10.31",
362 "version": "0.10.31",
357 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
363 "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
358 "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
364 "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
359 "dev": true
365 "dev": true
360 },
366 },
@@ -411,13 +417,13
411 },
417 },
412 "through": {
418 "through": {
413 "version": "2.3.8",
419 "version": "2.3.8",
414 "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
420 "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
415 "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
421 "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
416 "dev": true
422 "dev": true
417 },
423 },
418 "through2": {
424 "through2": {
419 "version": "0.2.3",
425 "version": "0.2.3",
420 "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz",
426 "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz",
421 "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=",
427 "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=",
422 "dev": true,
428 "dev": true,
423 "requires": {
429 "requires": {
@@ -23,6 +23,7
23 "typescript": "latest",
23 "typescript": "latest",
24 "tape": "latest",
24 "tape": "latest",
25 "@types/tape": "latest",
25 "@types/tape": "latest",
26 "@types/requirejs": "latest",
26 "requirejs": "latest",
27 "requirejs": "latest",
27 "faucet": "latest",
28 "faucet": "latest",
28 "dojo": "^1.10.0"
29 "dojo": "^1.10.0"
@@ -2,25 +2,14 import { Uuid } from "../Uuid";
2 import { argumentNotEmptyString } from "../safe";
2 import { argumentNotEmptyString } from "../safe";
3 import { TraceSource } from "../log/TraceSource";
3 import { TraceSource } from "../log/TraceSource";
4
4
5 export interface RequireFn {
6 (module: string): any;
7 (modules: string[], cb?: (...args: any[]) => any): void;
8 }
9
10 declare const require: RequireFn;
11
12 export const rjs = require;
5 export const rjs = require;
13
6
14 declare function define(name: string, modules: string[], cb?: (...args: any[]) => any, eb?: (e) => any): void;
7 declare function define(name: string, modules: string[], cb?: (...args: any[]) => any, eb?: (e) => any): void;
15 declare function define(modules: string[], cb?: (...args: any[]) => any, eb?: (e) => any): void;
8 declare function define(modules: string[], cb?: (...args: any[]) => any, eb?: (e) => any): void;
16
9
17 interface RequireJsResolverParams {
18 contextRequire: RequireFn;
19 }
20
21 const trace = TraceSource.get("@implab/core/di/RequireJsHelper");
10 const trace = TraceSource.get("@implab/core/di/RequireJsHelper");
22
11
23 export async function createContextRequire(moduleName: string): Promise<RequireFn> {
12 export async function createContextRequire(moduleName: string): Promise<Require> {
24 argumentNotEmptyString(moduleName, "moduleName");
13 argumentNotEmptyString(moduleName, "moduleName");
25
14
26 const parts = moduleName.split("/");
15 const parts = moduleName.split("/");
@@ -36,7 +25,7 export async function createContextRequi
36
25
37 trace.debug(`define shim ${shim}`);
26 trace.debug(`define shim ${shim}`);
38
27
39 return new Promise<RequireFn>(fulfill => {
28 return new Promise<Require>(fulfill => {
40 define(shim, ["require"], r => {
29 define(shim, ["require"], r => {
41 trace.debug("shim resolved");
30 trace.debug("shim resolved");
42 return r;
31 return r;
1 NO CONTENT: file renamed from src/js/Uri.js to src/main/js/Uri.js
NO CONTENT: file renamed from src/js/Uri.js to src/main/js/Uri.js
1 NO CONTENT: file renamed from src/js/data/DataContext.js to src/main/js/data/DataContext.js
NO CONTENT: file renamed from src/js/data/DataContext.js to src/main/js/data/DataContext.js
1 NO CONTENT: file renamed from src/js/data/MapSchema.js to src/main/js/data/MapSchema.js
NO CONTENT: file renamed from src/js/data/MapSchema.js to src/main/js/data/MapSchema.js
1 NO CONTENT: file renamed from src/js/data/ObjectStore.js to src/main/js/data/ObjectStore.js
NO CONTENT: file renamed from src/js/data/ObjectStore.js to src/main/js/data/ObjectStore.js
1 NO CONTENT: file renamed from src/js/data/RestStore.js to src/main/js/data/RestStore.js
NO CONTENT: file renamed from src/js/data/RestStore.js to src/main/js/data/RestStore.js
1 NO CONTENT: file renamed from src/js/data/StatefullStoreAdapter.js to src/main/js/data/StatefullStoreAdapter.js
NO CONTENT: file renamed from src/js/data/StatefullStoreAdapter.js to src/main/js/data/StatefullStoreAdapter.js
1 NO CONTENT: file renamed from src/js/data/StoreAdapter.js to src/main/js/data/StoreAdapter.js
NO CONTENT: file renamed from src/js/data/StoreAdapter.js to src/main/js/data/StoreAdapter.js
1 NO CONTENT: file renamed from src/js/data/_ModelBase.js to src/main/js/data/_ModelBase.js
NO CONTENT: file renamed from src/js/data/_ModelBase.js to src/main/js/data/_ModelBase.js
1 NO CONTENT: file renamed from src/js/data/_StatefulModelMixin.js to src/main/js/data/_StatefulModelMixin.js
NO CONTENT: file renamed from src/js/data/_StatefulModelMixin.js to src/main/js/data/_StatefulModelMixin.js
1 NO CONTENT: file renamed from src/js/data/declare-model.js to src/main/js/data/declare-model.js
NO CONTENT: file renamed from src/js/data/declare-model.js to src/main/js/data/declare-model.js
1 NO CONTENT: file renamed from src/js/declare/_load.js to src/main/js/declare/_load.js
NO CONTENT: file renamed from src/js/declare/_load.js to src/main/js/declare/_load.js
1 NO CONTENT: file renamed from src/js/declare/override.js to src/main/js/declare/override.js
NO CONTENT: file renamed from src/js/declare/override.js to src/main/js/declare/override.js
1 NO CONTENT: file renamed from src/js/log/trace.js to src/main/js/log/trace.js
NO CONTENT: file renamed from src/js/log/trace.js to src/main/js/log/trace.js
1 NO CONTENT: file renamed from src/js/messaging/Client.js to src/main/js/messaging/Client.js
NO CONTENT: file renamed from src/js/messaging/Client.js to src/main/js/messaging/Client.js
1 NO CONTENT: file renamed from src/js/messaging/Destination.js to src/main/js/messaging/Destination.js
NO CONTENT: file renamed from src/js/messaging/Destination.js to src/main/js/messaging/Destination.js
1 NO CONTENT: file renamed from src/js/messaging/Listener.js to src/main/js/messaging/Listener.js
NO CONTENT: file renamed from src/js/messaging/Listener.js to src/main/js/messaging/Listener.js
1 NO CONTENT: file renamed from src/js/messaging/Session.js to src/main/js/messaging/Session.js
NO CONTENT: file renamed from src/js/messaging/Session.js to src/main/js/messaging/Session.js
1 NO CONTENT: file renamed from src/js/text/format-compile.js to src/main/js/text/format-compile.js
NO CONTENT: file renamed from src/js/text/format-compile.js to src/main/js/text/format-compile.js
1 NO CONTENT: file renamed from src/js/text/format.js to src/main/js/text/format.js
NO CONTENT: file renamed from src/js/text/format.js to src/main/js/text/format.js
1 NO CONTENT: file renamed from src/js/text/template-compile.js to src/main/js/text/template-compile.js
NO CONTENT: file renamed from src/js/text/template-compile.js to src/main/js/text/template-compile.js
1 NO CONTENT: file renamed from src/ts/Cancellation.ts to src/main/ts/Cancellation.ts
NO CONTENT: file renamed from src/ts/Cancellation.ts to src/main/ts/Cancellation.ts
1 NO CONTENT: file renamed from src/ts/Observable.ts to src/main/ts/Observable.ts
NO CONTENT: file renamed from src/ts/Observable.ts to src/main/ts/Observable.ts
1 NO CONTENT: file renamed from src/ts/Uuid.ts to src/main/ts/Uuid.ts
NO CONTENT: file renamed from src/ts/Uuid.ts to src/main/ts/Uuid.ts
1 NO CONTENT: file renamed from src/ts/components/ActivatableMixin.ts to src/main/ts/components/ActivatableMixin.ts
NO CONTENT: file renamed from src/ts/components/ActivatableMixin.ts to src/main/ts/components/ActivatableMixin.ts
1 NO CONTENT: file renamed from src/ts/components/AsyncComponent.ts to src/main/ts/components/AsyncComponent.ts
NO CONTENT: file renamed from src/ts/components/AsyncComponent.ts to src/main/ts/components/AsyncComponent.ts
1 NO CONTENT: file renamed from src/ts/di.ts to src/main/ts/di.ts
NO CONTENT: file renamed from src/ts/di.ts to src/main/ts/di.ts
1 NO CONTENT: file renamed from src/ts/di/ActivationContext.ts to src/main/ts/di/ActivationContext.ts
NO CONTENT: file renamed from src/ts/di/ActivationContext.ts to src/main/ts/di/ActivationContext.ts
1 NO CONTENT: file renamed from src/ts/di/ActivationError.ts to src/main/ts/di/ActivationError.ts
NO CONTENT: file renamed from src/ts/di/ActivationError.ts to src/main/ts/di/ActivationError.ts
1 NO CONTENT: file renamed from src/ts/di/AggregateDescriptor.ts to src/main/ts/di/AggregateDescriptor.ts
NO CONTENT: file renamed from src/ts/di/AggregateDescriptor.ts to src/main/ts/di/AggregateDescriptor.ts
1 NO CONTENT: file renamed from src/ts/di/ConfigError.ts to src/main/ts/di/ConfigError.ts
NO CONTENT: file renamed from src/ts/di/ConfigError.ts to src/main/ts/di/ConfigError.ts
@@ -20,7 +20,7 import { Container } from "./Container";
20 import { ReferenceDescriptor } from "./ReferenceDescriptor";
20 import { ReferenceDescriptor } from "./ReferenceDescriptor";
21 import { TypeServiceDescriptor } from "./TypeServiceDescriptor";
21 import { TypeServiceDescriptor } from "./TypeServiceDescriptor";
22 import { FactoryServiceDescriptor } from "./FactoryServiceDescriptor";
22 import { FactoryServiceDescriptor } from "./FactoryServiceDescriptor";
23 import { rjs, createContextRequire, RequireFn } from "../../amd/ts/RequireJsHelper";
23 import { rjs, createContextRequire } from "./RequireJsHelper";
24 import { TraceSource } from "../log/TraceSource";
24 import { TraceSource } from "../log/TraceSource";
25 import { ConfigError } from "./ConfigError";
25 import { ConfigError } from "./ConfigError";
26 import { Cancellation } from "../Cancellation";
26 import { Cancellation } from "../Cancellation";
@@ -90,7 +90,7 export class Configuration {
90 this._container.register(services);
90 this._container.register(services);
91 }
91 }
92
92
93 async applyConfiguration(data: object, contextRequire?: RequireFn, ct = Cancellation.none) {
93 async applyConfiguration(data: object, contextRequire?: Require, ct = Cancellation.none) {
94 argumentNotNull(data, "data");
94 argumentNotNull(data, "data");
95
95
96 trace.log("applyConfiguration");
96 trace.log("applyConfiguration");
1 NO CONTENT: file renamed from src/ts/di/Container.ts to src/main/ts/di/Container.ts
NO CONTENT: file renamed from src/ts/di/Container.ts to src/main/ts/di/Container.ts
1 NO CONTENT: file renamed from src/ts/di/FactoryServiceDescriptor.ts to src/main/ts/di/FactoryServiceDescriptor.ts
NO CONTENT: file renamed from src/ts/di/FactoryServiceDescriptor.ts to src/main/ts/di/FactoryServiceDescriptor.ts
1 NO CONTENT: file renamed from src/ts/di/ReferenceDescriptor.ts to src/main/ts/di/ReferenceDescriptor.ts
NO CONTENT: file renamed from src/ts/di/ReferenceDescriptor.ts to src/main/ts/di/ReferenceDescriptor.ts
1 NO CONTENT: file renamed from src/ts/di/ServiceDescriptor.ts to src/main/ts/di/ServiceDescriptor.ts
NO CONTENT: file renamed from src/ts/di/ServiceDescriptor.ts to src/main/ts/di/ServiceDescriptor.ts
1 NO CONTENT: file renamed from src/ts/di/TypeServiceDescriptor.ts to src/main/ts/di/TypeServiceDescriptor.ts
NO CONTENT: file renamed from src/ts/di/TypeServiceDescriptor.ts to src/main/ts/di/TypeServiceDescriptor.ts
1 NO CONTENT: file renamed from src/ts/di/ValueDescriptor.ts to src/main/ts/di/ValueDescriptor.ts
NO CONTENT: file renamed from src/ts/di/ValueDescriptor.ts to src/main/ts/di/ValueDescriptor.ts
1 NO CONTENT: file renamed from src/ts/di/interfaces.ts to src/main/ts/di/interfaces.ts
NO CONTENT: file renamed from src/ts/di/interfaces.ts to src/main/ts/di/interfaces.ts
1 NO CONTENT: file renamed from src/ts/interfaces.ts to src/main/ts/interfaces.ts
NO CONTENT: file renamed from src/ts/interfaces.ts to src/main/ts/interfaces.ts
1 NO CONTENT: file renamed from src/ts/log/TraceSource.ts to src/main/ts/log/TraceSource.ts
NO CONTENT: file renamed from src/ts/log/TraceSource.ts to src/main/ts/log/TraceSource.ts
1 NO CONTENT: file renamed from src/ts/log/writers/ConsoleWriter.ts to src/main/ts/log/writers/ConsoleWriter.ts
NO CONTENT: file renamed from src/ts/log/writers/ConsoleWriter.ts to src/main/ts/log/writers/ConsoleWriter.ts
1 NO CONTENT: file renamed from src/ts/main.ts to src/main/ts/main.ts
NO CONTENT: file renamed from src/ts/main.ts to src/main/ts/main.ts
1 NO CONTENT: file renamed from src/ts/safe.ts to src/main/ts/safe.ts
NO CONTENT: file renamed from src/ts/safe.ts to src/main/ts/safe.ts
1 NO CONTENT: file renamed from src/ts/text/format.d.ts to src/main/ts/text/format.d.ts
NO CONTENT: file renamed from src/ts/text/format.d.ts to src/main/ts/text/format.d.ts
@@ -4,6 +4,8
4 "module": "amd",
4 "module": "amd",
5 "sourceMap": true,
5 "sourceMap": true,
6 "declaration": true,
6 "declaration": true,
7 "moduleResolution": "node",
8 "listFiles": true,
7 "lib": [
9 "lib": [
8 "es5",
10 "es5",
9 "es2015.promise",
11 "es2015.promise",
@@ -11,12 +13,9
11 "dom"
13 "dom"
12 ],
14 ],
13 "rootDirs": [
15 "rootDirs": [
14 "ts",
16 "main/ts",
15 "amd/ts"
17 "amd/ts"
16 ],
18 ],
17 "types": []
19 "types": []
18 },
20 }
19 "include" : [
20 "ts/**/*.ts", "amd/ts/**/*.ts"
21 ]
22 } No newline at end of file
21 }
General Comments 0
You need to be logged in to leave comments. Login now