| @@ -0,0 +1,3 | |||
|
|
1 | export function createContextResolver(moduleName: string) { | |
|
|
2 | return (m: string) => { }; | |
|
|
3 | } | |
| @@ -1,110 +1,134 | |||
|
|
1 | 1 | if (release != 'rtm') { |
|
|
2 | 2 | version += "-$release" |
|
|
3 | 3 | } |
|
|
4 | 4 | |
|
|
5 | 5 | if(!npmName) |
|
|
6 | 6 | npmName = name; |
|
|
7 | 7 | |
|
|
8 | ext.packageName="$npmScope/$npmName"; | |
|
|
8 | if(!["amd", "cjs"].contains(platform)) | |
|
|
9 | throw new Exception("Invalid platform specified: $platform"); | |
|
|
10 | ||
|
|
11 | def moduleTypes = [ | |
|
|
12 | "amd": "amd", | |
|
|
13 | "cjs": "commonjs" | |
|
|
14 | ] | |
|
|
9 | 15 | |
|
|
10 | def packageDir = "$buildDir/dist" | |
|
|
11 | def distDir = "$packageDir/$platform" | |
|
|
12 |
def |
|
|
|
16 | ext.packageName="$npmScope/$npmName-$platform"; | |
|
|
17 | ||
|
|
18 | def srcDir = "$projectDir/src" | |
|
|
19 | def typingsDir = "$srcDir/typings" | |
|
|
20 | def distDir = "$buildDir/dist/$platform" | |
|
|
21 | def testDir = "$buildDir/test/$platform" | |
|
|
22 | def moduleType = moduleTypes[platform] | |
|
|
23 | ||
|
|
24 | def sourceSets = ["main", "amd", "cjs", "test"]; | |
|
|
13 | 25 | |
|
|
14 | 26 | task printVersion { |
|
|
15 | 27 | doLast { |
|
|
16 | 28 | println "version: $version" |
|
|
17 | 29 | println "packageName: $packageName" |
|
|
18 | 30 | println "platform: $platform" |
|
|
31 | println "module: $moduleType" | |
|
|
19 | 32 | } |
|
|
20 | 33 | } |
|
|
21 | 34 | |
|
|
22 | ||
|
|
23 | 35 | task clean { |
|
|
24 | 36 | doLast { |
|
|
25 | 37 | delete buildDir |
|
|
26 | 38 | delete "node_modules/$packageName" |
|
|
39 | delete typingsDir | |
|
|
27 | 40 | } |
|
|
28 | 41 | } |
|
|
29 | 42 | |
|
|
30 | 43 | task cleanNpm { |
|
|
31 | 44 | doLast { |
|
|
32 | 45 | delete 'node_modules' |
|
|
33 | 46 | } |
|
|
34 | 47 | } |
|
|
35 | 48 | |
|
|
36 | 49 | task _npmInstall() { |
|
|
37 | 50 | inputs.file("package.json") |
|
|
38 | 51 | outputs.dir("node_modules") |
|
|
39 | 52 | doLast { |
|
|
40 | 53 | exec { |
|
|
41 | 54 | commandLine 'npm', 'install' |
|
|
42 | 55 | } |
|
|
43 | 56 | } |
|
|
44 | 57 | } |
|
|
45 | 58 | |
|
|
46 | task _legacyJs(type:Copy) { | |
|
|
47 | from 'src/main/js/' | |
|
|
59 | sourceSets.each { | |
|
|
60 | def setName = it.capitalize(); | |
|
|
61 | ||
|
|
62 | def destDir = "$buildDir/compile/$it" | |
|
|
63 | def declDir = "$typingsDir/$it" | |
|
|
64 | def setDir = "$projectDir/src/$it" | |
|
|
65 | ||
|
|
66 | task "_copyJs$setName"(type:Copy) { | |
|
|
67 | from "$setDir/js" | |
|
|
48 | 68 | into distDir |
|
|
49 | 69 | } |
|
|
50 | 70 | |
|
|
51 |
task |
|
|
|
52 |
inputs.dir( |
|
|
|
53 |
inputs.file( |
|
|
|
54 |
inputs.file( |
|
|
|
55 |
outputs.dir(d |
|
|
|
71 | task "_compileTs$setName"(dependsOn: _npmInstall, type:Exec) { | |
|
|
72 | inputs.dir("$setDir/ts") | |
|
|
73 | inputs.file("$srcDir/tsconfig.json") | |
|
|
74 | inputs.file("$setDir/tsconfig.json") | |
|
|
75 | outputs.dir(destDir) | |
|
|
76 | outputs.dir(declDir) | |
|
|
56 | 77 | |
|
|
57 | 78 | commandLine 'node_modules/.bin/tsc', |
|
|
58 |
'-p', |
|
|
|
59 | '--outDir', distDir | |
|
|
79 | '-p', "$setDir/tsconfig.json", | |
|
|
80 | '-m', moduleType, | |
|
|
81 | '--outDir', destDir, | |
|
|
82 | '--declarationDir', declDir | |
|
|
83 | } | |
|
|
84 | ||
|
|
85 | task "_buildTs$setName"(dependsOn: "_compileTs$setName", type:Copy) { | |
|
|
86 | from tasks.getByPath("_compileTs$setName"); | |
|
|
87 | into distDir | |
|
|
88 | } | |
|
|
89 | } | |
|
|
90 | ||
|
|
91 | _compileTsAmd { | |
|
|
92 | dependsOn _buildTsMain | |
|
|
93 | } | |
|
|
94 | ||
|
|
95 | _buildTsTest { | |
|
|
96 | into testDir | |
|
|
97 | } | |
|
|
98 | ||
|
|
99 | _copyJsTest { | |
|
|
100 | into testDir | |
|
|
60 | 101 | } |
|
|
61 | 102 | |
|
|
62 | 103 | task _packageMeta(type: Copy) { |
|
|
63 | 104 | inputs.property("version", version) |
|
|
64 | 105 | from('.') { |
|
|
65 |
include |
|
|
|
106 | include '.npmignore', 'readme.md', 'license', 'history.md' | |
|
|
107 | } | |
|
|
108 | from("$srcDir/package.template.json") { | |
|
|
109 | expand project.properties | |
|
|
110 | rename { "package.json" } | |
|
|
66 | 111 | } |
|
|
67 | 112 | into distDir |
|
|
68 | doLast { | |
|
|
69 | exec { | |
|
|
70 | workingDir distDir | |
|
|
71 | commandLine 'npm', 'version', version | |
|
|
72 | } | |
|
|
73 | } | |
|
|
74 | 113 | } |
|
|
75 | 114 | |
|
|
76 |
task build(dependsOn: [_ |
|
|
|
115 | task build(dependsOn: [_copyJsMain, _copyJsAmd, _npmInstall, _buildTsMain, _buildTsAmd, _packageMeta]) { | |
|
|
77 | 116 | |
|
|
78 | 117 | } |
|
|
79 | 118 | |
|
|
80 | task _localInstall(dependsOn: build, type: Exec) { | |
|
|
81 | inputs.file("$distDir/package.json") | |
|
|
82 | outputs.upToDateWhen { | |
|
|
83 | new File("$projectDir/node_modules/$packageName").exists() | |
|
|
84 | } | |
|
|
85 | ||
|
|
86 | commandLine 'npm', 'install', '--no-save', '--force', distDir | |
|
|
119 | _compileTsTest { | |
|
|
120 | dependsOn build | |
|
|
87 | 121 | } |
|
|
88 | 122 | |
|
|
89 | task copyJsTests(type: Copy) { | |
|
|
90 | from 'test/js' | |
|
|
91 | into testDir | |
|
|
123 | task buildTests(dependsOn: [_copyJsTest, _buildTsTest]) { | |
|
|
92 | 124 | } |
|
|
93 | 125 | |
|
|
94 |
task |
|
|
|
95 | inputs.dir('test/ts') | |
|
|
96 | inputs.file('test/tsconfig.json') | |
|
|
97 | outputs.dir(testDir) | |
|
|
98 | ||
|
|
99 | commandLine 'node_modules/.bin/tsc', '-p', 'test/tsconfig.json', '--outDir', distDir | |
|
|
100 | } | |
|
|
101 | ||
|
|
102 | task test(dependsOn: [copyJsTests, buildTests], type: Exec) { | |
|
|
103 | commandLine 'node', 'run-amd-tests.js' | |
|
|
126 | task test(dependsOn: buildTests, type: Exec) { | |
|
|
127 | commandLine 'node', "$testDir/run-amd-tests.js" | |
|
|
104 | 128 | } |
|
|
105 | 129 | |
|
|
106 | 130 | task pack(dependsOn: build, type: Exec) { |
|
|
107 |
workingDir |
|
|
|
131 | workingDir distDir | |
|
|
108 | 132 | |
|
|
109 | 133 | commandLine 'npm', 'pack' |
|
|
110 | 134 | } No newline at end of file |
| @@ -1,8 +1,9 | |||
|
|
1 | 1 | version=1.2.0 |
|
|
2 | 2 | release=rc |
|
|
3 | author=Implab team | |
|
|
3 | 4 | platform=amd |
|
|
4 |
descript |
|
|
|
5 | description=Dependency injection, logging, simple and fast text template engine | |
|
|
5 | 6 | license=BSD-2-Clause |
|
|
6 | 7 | repository=https://bitbucket.org/implab/implabjs |
|
|
7 | 8 | npmScope=@implab |
|
|
8 | 9 | npmName=core No newline at end of file |
| @@ -1,456 +1,462 | |||
|
|
1 | 1 | { |
|
|
2 | 2 | "name": "@implab/core", |
|
|
3 | 3 | "version": "0.0.1-dev", |
|
|
4 | 4 | "lockfileVersion": 1, |
|
|
5 | 5 | "requires": true, |
|
|
6 | 6 | "dependencies": { |
|
|
7 | 7 | "@types/node": { |
|
|
8 |
"version": "10.12.1 |
|
|
|
9 |
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.1 |
|
|
|
10 | "integrity": "sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A==", | |
|
|
8 | "version": "10.12.15", | |
|
|
9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.15.tgz", | |
|
|
10 | "integrity": "sha512-9kROxduaN98QghwwHmxXO2Xz3MaWf+I1sLVAA6KJDF5xix+IyXVhds0MAfdNwtcpSrzhaTsNB0/jnL86fgUhqA==", | |
|
|
11 | 11 | "dev": true |
|
|
12 | 12 | }, |
|
|
13 | 13 | "@types/requirejs": { |
|
|
14 | 14 | "version": "2.1.31", |
|
|
15 | 15 | "resolved": "https://registry.npmjs.org/@types/requirejs/-/requirejs-2.1.31.tgz", |
|
|
16 | 16 | "integrity": "sha512-b2soeyuU76rMbcRJ4e0hEl0tbMhFwZeTC0VZnfuWlfGlk6BwWNsev6kFu/twKABPX29wkX84wU2o+cEJoXsiTw==", |
|
|
17 | 17 | "dev": true |
|
|
18 | 18 | }, |
|
|
19 | 19 | "@types/tape": { |
|
|
20 | 20 | "version": "4.2.32", |
|
|
21 | 21 | "resolved": "http://registry.npmjs.org/@types/tape/-/tape-4.2.32.tgz", |
|
|
22 | 22 | "integrity": "sha512-xil0KO5wkPoixdBWGIGolPv9dekf6dVkjjJLAFYchfKcd4DICou67rgGCIO7wAh3i5Ff/6j9IDgZz+GU9cMaqQ==", |
|
|
23 | 23 | "dev": true, |
|
|
24 | 24 | "requires": { |
|
|
25 | 25 | "@types/node": "*" |
|
|
26 | 26 | } |
|
|
27 | 27 | }, |
|
|
28 | 28 | "balanced-match": { |
|
|
29 | 29 | "version": "1.0.0", |
|
|
30 | 30 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", |
|
|
31 | 31 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", |
|
|
32 | 32 | "dev": true |
|
|
33 | 33 | }, |
|
|
34 | 34 | "brace-expansion": { |
|
|
35 | 35 | "version": "1.1.11", |
|
|
36 | 36 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", |
|
|
37 | 37 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", |
|
|
38 | 38 | "dev": true, |
|
|
39 | 39 | "requires": { |
|
|
40 | 40 | "balanced-match": "^1.0.0", |
|
|
41 | 41 | "concat-map": "0.0.1" |
|
|
42 | 42 | } |
|
|
43 | 43 | }, |
|
|
44 | 44 | "concat-map": { |
|
|
45 | 45 | "version": "0.0.1", |
|
|
46 | 46 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", |
|
|
47 | 47 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", |
|
|
48 | 48 | "dev": true |
|
|
49 | 49 | }, |
|
|
50 | 50 | "core-util-is": { |
|
|
51 | 51 | "version": "1.0.2", |
|
|
52 | 52 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", |
|
|
53 | 53 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", |
|
|
54 | 54 | "dev": true |
|
|
55 | 55 | }, |
|
|
56 | 56 | "deep-equal": { |
|
|
57 | 57 | "version": "0.1.2", |
|
|
58 | 58 | "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.1.2.tgz", |
|
|
59 | 59 | "integrity": "sha1-skbCuApXCkfBG+HZvRBw7IeLh84=", |
|
|
60 | 60 | "dev": true |
|
|
61 | 61 | }, |
|
|
62 | 62 | "define-properties": { |
|
|
63 | 63 | "version": "1.1.3", |
|
|
64 | 64 | "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", |
|
|
65 | 65 | "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", |
|
|
66 | 66 | "dev": true, |
|
|
67 | 67 | "requires": { |
|
|
68 | 68 | "object-keys": "^1.0.12" |
|
|
69 | 69 | }, |
|
|
70 | 70 | "dependencies": { |
|
|
71 | 71 | "object-keys": { |
|
|
72 | 72 | "version": "1.0.12", |
|
|
73 | 73 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", |
|
|
74 | 74 | "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", |
|
|
75 | 75 | "dev": true |
|
|
76 | 76 | } |
|
|
77 | 77 | } |
|
|
78 | 78 | }, |
|
|
79 | 79 | "defined": { |
|
|
80 | 80 | "version": "0.0.0", |
|
|
81 | 81 | "resolved": "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz", |
|
|
82 | 82 | "integrity": "sha1-817qfXBekzuvE7LwOz+D2SFAOz4=", |
|
|
83 | 83 | "dev": true |
|
|
84 | 84 | }, |
|
|
85 | 85 | "dojo": { |
|
|
86 | 86 | "version": "1.14.2", |
|
|
87 | 87 | "resolved": "https://registry.npmjs.org/dojo/-/dojo-1.14.2.tgz", |
|
|
88 | 88 | "integrity": "sha512-TI+Ytgfh/VfmHWERp45Jte6NFMdoJTPsvUP/uzJUvAXET8FP2h442LePWWJ/q/xZ4V0V8OtdJhx8It/GB+Zbxg==", |
|
|
89 | 89 | "dev": true |
|
|
90 | 90 | }, |
|
|
91 | 91 | "duplexer": { |
|
|
92 | 92 | "version": "0.1.1", |
|
|
93 |
"resolved": "http |
|
|
|
93 | "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", | |
|
|
94 | 94 | "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", |
|
|
95 | 95 | "dev": true |
|
|
96 | 96 | }, |
|
|
97 | 97 | "es-abstract": { |
|
|
98 | 98 | "version": "1.12.0", |
|
|
99 | 99 | "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", |
|
|
100 | 100 | "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", |
|
|
101 | 101 | "dev": true, |
|
|
102 | 102 | "requires": { |
|
|
103 | 103 | "es-to-primitive": "^1.1.1", |
|
|
104 | 104 | "function-bind": "^1.1.1", |
|
|
105 | 105 | "has": "^1.0.1", |
|
|
106 | 106 | "is-callable": "^1.1.3", |
|
|
107 | 107 | "is-regex": "^1.0.4" |
|
|
108 | 108 | } |
|
|
109 | 109 | }, |
|
|
110 | 110 | "es-to-primitive": { |
|
|
111 | 111 | "version": "1.2.0", |
|
|
112 | 112 | "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", |
|
|
113 | 113 | "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", |
|
|
114 | 114 | "dev": true, |
|
|
115 | 115 | "requires": { |
|
|
116 | 116 | "is-callable": "^1.1.4", |
|
|
117 | 117 | "is-date-object": "^1.0.1", |
|
|
118 | 118 | "is-symbol": "^1.0.2" |
|
|
119 | 119 | } |
|
|
120 | 120 | }, |
|
|
121 | 121 | "faucet": { |
|
|
122 | 122 | "version": "0.0.1", |
|
|
123 | 123 | "resolved": "https://registry.npmjs.org/faucet/-/faucet-0.0.1.tgz", |
|
|
124 | 124 | "integrity": "sha1-WX3PHSGJosBiMhtZHo8VHtIDnZw=", |
|
|
125 | 125 | "dev": true, |
|
|
126 | 126 | "requires": { |
|
|
127 | 127 | "defined": "0.0.0", |
|
|
128 | 128 | "duplexer": "~0.1.1", |
|
|
129 | 129 | "minimist": "0.0.5", |
|
|
130 | 130 | "sprintf": "~0.1.3", |
|
|
131 | 131 | "tap-parser": "~0.4.0", |
|
|
132 | 132 | "tape": "~2.3.2", |
|
|
133 | 133 | "through2": "~0.2.3" |
|
|
134 | 134 | }, |
|
|
135 | 135 | "dependencies": { |
|
|
136 | 136 | "tape": { |
|
|
137 | 137 | "version": "2.3.3", |
|
|
138 |
"resolved": "http |
|
|
|
138 | "resolved": "http://registry.npmjs.org/tape/-/tape-2.3.3.tgz", | |
|
|
139 | 139 | "integrity": "sha1-Lnzgox3wn41oUWZKcYQuDKUFevc=", |
|
|
140 | 140 | "dev": true, |
|
|
141 | 141 | "requires": { |
|
|
142 | 142 | "deep-equal": "~0.1.0", |
|
|
143 | 143 | "defined": "~0.0.0", |
|
|
144 | 144 | "inherits": "~2.0.1", |
|
|
145 | 145 | "jsonify": "~0.0.0", |
|
|
146 | 146 | "resumer": "~0.0.0", |
|
|
147 | 147 | "through": "~2.3.4" |
|
|
148 | 148 | } |
|
|
149 | 149 | } |
|
|
150 | 150 | } |
|
|
151 | 151 | }, |
|
|
152 | 152 | "for-each": { |
|
|
153 | 153 | "version": "0.3.3", |
|
|
154 | 154 | "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", |
|
|
155 | 155 | "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", |
|
|
156 | 156 | "dev": true, |
|
|
157 | 157 | "requires": { |
|
|
158 | 158 | "is-callable": "^1.1.3" |
|
|
159 | 159 | } |
|
|
160 | 160 | }, |
|
|
161 | 161 | "fs.realpath": { |
|
|
162 | 162 | "version": "1.0.0", |
|
|
163 | 163 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", |
|
|
164 | 164 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", |
|
|
165 | 165 | "dev": true |
|
|
166 | 166 | }, |
|
|
167 | 167 | "function-bind": { |
|
|
168 | 168 | "version": "1.1.1", |
|
|
169 | 169 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", |
|
|
170 | 170 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", |
|
|
171 | 171 | "dev": true |
|
|
172 | 172 | }, |
|
|
173 | 173 | "glob": { |
|
|
174 | 174 | "version": "7.1.3", |
|
|
175 | 175 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", |
|
|
176 | 176 | "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", |
|
|
177 | 177 | "dev": true, |
|
|
178 | 178 | "requires": { |
|
|
179 | 179 | "fs.realpath": "^1.0.0", |
|
|
180 | 180 | "inflight": "^1.0.4", |
|
|
181 | 181 | "inherits": "2", |
|
|
182 | 182 | "minimatch": "^3.0.4", |
|
|
183 | 183 | "once": "^1.3.0", |
|
|
184 | 184 | "path-is-absolute": "^1.0.0" |
|
|
185 | 185 | } |
|
|
186 | 186 | }, |
|
|
187 | 187 | "has": { |
|
|
188 | 188 | "version": "1.0.3", |
|
|
189 | 189 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", |
|
|
190 | 190 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", |
|
|
191 | 191 | "dev": true, |
|
|
192 | 192 | "requires": { |
|
|
193 | 193 | "function-bind": "^1.1.1" |
|
|
194 | 194 | } |
|
|
195 | 195 | }, |
|
|
196 | 196 | "has-symbols": { |
|
|
197 | 197 | "version": "1.0.0", |
|
|
198 | 198 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", |
|
|
199 | 199 | "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", |
|
|
200 | 200 | "dev": true |
|
|
201 | 201 | }, |
|
|
202 | 202 | "inflight": { |
|
|
203 | 203 | "version": "1.0.6", |
|
|
204 | 204 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", |
|
|
205 | 205 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", |
|
|
206 | 206 | "dev": true, |
|
|
207 | 207 | "requires": { |
|
|
208 | 208 | "once": "^1.3.0", |
|
|
209 | 209 | "wrappy": "1" |
|
|
210 | 210 | } |
|
|
211 | 211 | }, |
|
|
212 | 212 | "inherits": { |
|
|
213 | 213 | "version": "2.0.3", |
|
|
214 | 214 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", |
|
|
215 | 215 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", |
|
|
216 | 216 | "dev": true |
|
|
217 | 217 | }, |
|
|
218 | 218 | "is-callable": { |
|
|
219 | 219 | "version": "1.1.4", |
|
|
220 | 220 | "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", |
|
|
221 | 221 | "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", |
|
|
222 | 222 | "dev": true |
|
|
223 | 223 | }, |
|
|
224 | 224 | "is-date-object": { |
|
|
225 | 225 | "version": "1.0.1", |
|
|
226 | 226 | "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", |
|
|
227 | 227 | "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", |
|
|
228 | 228 | "dev": true |
|
|
229 | 229 | }, |
|
|
230 | 230 | "is-regex": { |
|
|
231 | 231 | "version": "1.0.4", |
|
|
232 | 232 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", |
|
|
233 | 233 | "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", |
|
|
234 | 234 | "dev": true, |
|
|
235 | 235 | "requires": { |
|
|
236 | 236 | "has": "^1.0.1" |
|
|
237 | 237 | } |
|
|
238 | 238 | }, |
|
|
239 | 239 | "is-symbol": { |
|
|
240 | 240 | "version": "1.0.2", |
|
|
241 | 241 | "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", |
|
|
242 | 242 | "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", |
|
|
243 | 243 | "dev": true, |
|
|
244 | 244 | "requires": { |
|
|
245 | 245 | "has-symbols": "^1.0.0" |
|
|
246 | 246 | } |
|
|
247 | 247 | }, |
|
|
248 | 248 | "isarray": { |
|
|
249 | 249 | "version": "0.0.1", |
|
|
250 | 250 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", |
|
|
251 | 251 | "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", |
|
|
252 | 252 | "dev": true |
|
|
253 | 253 | }, |
|
|
254 | 254 | "jsonify": { |
|
|
255 | 255 | "version": "0.0.0", |
|
|
256 | 256 | "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", |
|
|
257 | 257 | "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", |
|
|
258 | 258 | "dev": true |
|
|
259 | 259 | }, |
|
|
260 | 260 | "minimatch": { |
|
|
261 | 261 | "version": "3.0.4", |
|
|
262 | 262 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", |
|
|
263 | 263 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", |
|
|
264 | 264 | "dev": true, |
|
|
265 | 265 | "requires": { |
|
|
266 | 266 | "brace-expansion": "^1.1.7" |
|
|
267 | 267 | } |
|
|
268 | 268 | }, |
|
|
269 | 269 | "minimist": { |
|
|
270 | 270 | "version": "0.0.5", |
|
|
271 | 271 | "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.5.tgz", |
|
|
272 | 272 | "integrity": "sha1-16oye87PUY+RBqxrjwA/o7zqhWY=", |
|
|
273 | 273 | "dev": true |
|
|
274 | 274 | }, |
|
|
275 | 275 | "object-inspect": { |
|
|
276 | 276 | "version": "1.6.0", |
|
|
277 | 277 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", |
|
|
278 | 278 | "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==", |
|
|
279 | 279 | "dev": true |
|
|
280 | 280 | }, |
|
|
281 | 281 | "object-keys": { |
|
|
282 | 282 | "version": "0.4.0", |
|
|
283 | 283 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", |
|
|
284 | 284 | "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=", |
|
|
285 | 285 | "dev": true |
|
|
286 | 286 | }, |
|
|
287 | 287 | "once": { |
|
|
288 | 288 | "version": "1.4.0", |
|
|
289 | 289 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", |
|
|
290 | 290 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", |
|
|
291 | 291 | "dev": true, |
|
|
292 | 292 | "requires": { |
|
|
293 | 293 | "wrappy": "1" |
|
|
294 | 294 | } |
|
|
295 | 295 | }, |
|
|
296 | 296 | "path-is-absolute": { |
|
|
297 | 297 | "version": "1.0.1", |
|
|
298 |
"resolved": "http |
|
|
|
298 | "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", | |
|
|
299 | 299 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", |
|
|
300 | 300 | "dev": true |
|
|
301 | 301 | }, |
|
|
302 | 302 | "path-parse": { |
|
|
303 | 303 | "version": "1.0.6", |
|
|
304 | 304 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", |
|
|
305 | 305 | "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", |
|
|
306 | 306 | "dev": true |
|
|
307 | 307 | }, |
|
|
308 | 308 | "readable-stream": { |
|
|
309 | 309 | "version": "1.1.14", |
|
|
310 |
"resolved": "http |
|
|
|
310 | "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", | |
|
|
311 | 311 | "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", |
|
|
312 | 312 | "dev": true, |
|
|
313 | 313 | "requires": { |
|
|
314 | 314 | "core-util-is": "~1.0.0", |
|
|
315 | 315 | "inherits": "~2.0.1", |
|
|
316 | 316 | "isarray": "0.0.1", |
|
|
317 | 317 | "string_decoder": "~0.10.x" |
|
|
318 | 318 | } |
|
|
319 | 319 | }, |
|
|
320 | 320 | "requirejs": { |
|
|
321 | 321 | "version": "2.3.6", |
|
|
322 | 322 | "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", |
|
|
323 | 323 | "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", |
|
|
324 | 324 | "dev": true |
|
|
325 | 325 | }, |
|
|
326 | 326 | "resolve": { |
|
|
327 | 327 | "version": "1.7.1", |
|
|
328 |
"resolved": "http |
|
|
|
328 | "resolved": "http://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", | |
|
|
329 | 329 | "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", |
|
|
330 | 330 | "dev": true, |
|
|
331 | 331 | "requires": { |
|
|
332 | 332 | "path-parse": "^1.0.5" |
|
|
333 | 333 | } |
|
|
334 | 334 | }, |
|
|
335 | 335 | "resumer": { |
|
|
336 | 336 | "version": "0.0.0", |
|
|
337 | 337 | "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", |
|
|
338 | 338 | "integrity": "sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=", |
|
|
339 | 339 | "dev": true, |
|
|
340 | 340 | "requires": { |
|
|
341 | 341 | "through": "~2.3.4" |
|
|
342 | 342 | } |
|
|
343 | 343 | }, |
|
|
344 | 344 | "sprintf": { |
|
|
345 | 345 | "version": "0.1.5", |
|
|
346 | 346 | "resolved": "https://registry.npmjs.org/sprintf/-/sprintf-0.1.5.tgz", |
|
|
347 | 347 | "integrity": "sha1-j4PjmpMXwaUCy324BQ5Rxnn27c8=", |
|
|
348 | 348 | "dev": true |
|
|
349 | 349 | }, |
|
|
350 | 350 | "string.prototype.trim": { |
|
|
351 | 351 | "version": "1.1.2", |
|
|
352 | 352 | "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", |
|
|
353 | 353 | "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=", |
|
|
354 | 354 | "dev": true, |
|
|
355 | 355 | "requires": { |
|
|
356 | 356 | "define-properties": "^1.1.2", |
|
|
357 | 357 | "es-abstract": "^1.5.0", |
|
|
358 | 358 | "function-bind": "^1.0.2" |
|
|
359 | 359 | } |
|
|
360 | 360 | }, |
|
|
361 | 361 | "string_decoder": { |
|
|
362 | 362 | "version": "0.10.31", |
|
|
363 |
"resolved": "http |
|
|
|
363 | "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", | |
|
|
364 | 364 | "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", |
|
|
365 | 365 | "dev": true |
|
|
366 | 366 | }, |
|
|
367 | 367 | "tap-parser": { |
|
|
368 | 368 | "version": "0.4.3", |
|
|
369 | 369 | "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-0.4.3.tgz", |
|
|
370 | 370 | "integrity": "sha1-pOrhkMENdsehEZIf84u+TVjwnuo=", |
|
|
371 | 371 | "dev": true, |
|
|
372 | 372 | "requires": { |
|
|
373 | 373 | "inherits": "~2.0.1", |
|
|
374 | 374 | "readable-stream": "~1.1.11" |
|
|
375 | 375 | } |
|
|
376 | 376 | }, |
|
|
377 | 377 | "tape": { |
|
|
378 | 378 | "version": "4.9.1", |
|
|
379 | 379 | "resolved": "https://registry.npmjs.org/tape/-/tape-4.9.1.tgz", |
|
|
380 | 380 | "integrity": "sha512-6fKIXknLpoe/Jp4rzHKFPpJUHDHDqn8jus99IfPnHIjyz78HYlefTGD3b5EkbQzuLfaEvmfPK3IolLgq2xT3kw==", |
|
|
381 | 381 | "dev": true, |
|
|
382 | 382 | "requires": { |
|
|
383 | 383 | "deep-equal": "~1.0.1", |
|
|
384 | 384 | "defined": "~1.0.0", |
|
|
385 | 385 | "for-each": "~0.3.3", |
|
|
386 | 386 | "function-bind": "~1.1.1", |
|
|
387 | 387 | "glob": "~7.1.2", |
|
|
388 | 388 | "has": "~1.0.3", |
|
|
389 | 389 | "inherits": "~2.0.3", |
|
|
390 | 390 | "minimist": "~1.2.0", |
|
|
391 | 391 | "object-inspect": "~1.6.0", |
|
|
392 | 392 | "resolve": "~1.7.1", |
|
|
393 | 393 | "resumer": "~0.0.0", |
|
|
394 | 394 | "string.prototype.trim": "~1.1.2", |
|
|
395 | 395 | "through": "~2.3.8" |
|
|
396 | 396 | }, |
|
|
397 | 397 | "dependencies": { |
|
|
398 | 398 | "deep-equal": { |
|
|
399 | 399 | "version": "1.0.1", |
|
|
400 | 400 | "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", |
|
|
401 | 401 | "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", |
|
|
402 | 402 | "dev": true |
|
|
403 | 403 | }, |
|
|
404 | 404 | "defined": { |
|
|
405 | 405 | "version": "1.0.0", |
|
|
406 | 406 | "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", |
|
|
407 | 407 | "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", |
|
|
408 | 408 | "dev": true |
|
|
409 | 409 | }, |
|
|
410 | 410 | "minimist": { |
|
|
411 | 411 | "version": "1.2.0", |
|
|
412 | 412 | "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", |
|
|
413 | 413 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", |
|
|
414 | 414 | "dev": true |
|
|
415 | 415 | } |
|
|
416 | 416 | } |
|
|
417 | 417 | }, |
|
|
418 | 418 | "through": { |
|
|
419 | 419 | "version": "2.3.8", |
|
|
420 |
"resolved": "http |
|
|
|
420 | "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", | |
|
|
421 | 421 | "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", |
|
|
422 | 422 | "dev": true |
|
|
423 | 423 | }, |
|
|
424 | 424 | "through2": { |
|
|
425 | 425 | "version": "0.2.3", |
|
|
426 |
"resolved": "http |
|
|
|
426 | "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", | |
|
|
427 | 427 | "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", |
|
|
428 | 428 | "dev": true, |
|
|
429 | 429 | "requires": { |
|
|
430 | 430 | "readable-stream": "~1.1.9", |
|
|
431 | 431 | "xtend": "~2.1.1" |
|
|
432 | 432 | } |
|
|
433 | 433 | }, |
|
|
434 | "tslib": { | |
|
|
435 | "version": "1.9.3", | |
|
|
436 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", | |
|
|
437 | "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", | |
|
|
438 | "dev": true | |
|
|
439 | }, | |
|
|
434 | 440 | "typescript": { |
|
|
435 |
"version": "3.2. |
|
|
|
436 |
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2. |
|
|
|
437 | "integrity": "sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg==", | |
|
|
441 | "version": "3.2.2", | |
|
|
442 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz", | |
|
|
443 | "integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==", | |
|
|
438 | 444 | "dev": true |
|
|
439 | 445 | }, |
|
|
440 | 446 | "wrappy": { |
|
|
441 | 447 | "version": "1.0.2", |
|
|
442 | 448 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", |
|
|
443 | 449 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", |
|
|
444 | 450 | "dev": true |
|
|
445 | 451 | }, |
|
|
446 | 452 | "xtend": { |
|
|
447 | 453 | "version": "2.1.2", |
|
|
448 | 454 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", |
|
|
449 | 455 | "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", |
|
|
450 | 456 | "dev": true, |
|
|
451 | 457 | "requires": { |
|
|
452 | 458 | "object-keys": "~0.4.0" |
|
|
453 | 459 | } |
|
|
454 | 460 | } |
|
|
455 | 461 | } |
|
|
456 | 462 | } |
| @@ -1,32 +1,35 | |||
|
|
1 | 1 | { |
|
|
2 | 2 | "name": "@implab/core", |
|
|
3 | 3 | "version": "0.0.1-dev", |
|
|
4 | 4 | "description": "Dependency injection, logging, simple and fast text template engine", |
|
|
5 | 5 | "main": "main.js", |
|
|
6 | 6 | "keywords": [ |
|
|
7 | 7 | "di", |
|
|
8 | 8 | "ioc", |
|
|
9 | 9 | "logging", |
|
|
10 | 10 | "template engine", |
|
|
11 | 11 | "dependency injection" |
|
|
12 | 12 | ], |
|
|
13 | 13 | "author": "Implab team", |
|
|
14 | 14 | "license": "BSD-2-Clause", |
|
|
15 | 15 | "repository": "https://bitbucket.org/implab/implabjs", |
|
|
16 | 16 | "publishConfig": { |
|
|
17 | 17 | "access": "public" |
|
|
18 | 18 | }, |
|
|
19 | 19 | "peerDependencies": { |
|
|
20 | "dojo": "^1.10.0" | |
|
|
20 | "dojo": "^1.10.0", | |
|
|
21 | "tslib": "latest" | |
|
|
21 | 22 | }, |
|
|
22 | 23 | "devDependencies": { |
|
|
23 | 24 | "typescript": "latest", |
|
|
24 | 25 | "tape": "latest", |
|
|
25 | 26 | "@types/tape": "latest", |
|
|
26 | 27 | "@types/requirejs": "latest", |
|
|
28 | "@types/node": "latest", | |
|
|
27 | 29 | "requirejs": "latest", |
|
|
28 | 30 | "faucet": "latest", |
|
|
29 | "dojo": "^1.10.0" | |
|
|
31 | "dojo": "^1.10.0", | |
|
|
32 | "tslib": "latest" | |
|
|
30 | 33 | }, |
|
|
31 | 34 | "types": "main.d.ts" |
|
|
32 | 35 | } |
|
|
1 | NO CONTENT: file renamed from src/main/js/Uri.js to src/amd/js/Uri.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/DataContext.js to src/amd/js/data/DataContext.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/MapSchema.js to src/amd/js/data/MapSchema.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/ObjectStore.js to src/amd/js/data/ObjectStore.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/RestStore.js to src/amd/js/data/RestStore.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/StatefullStoreAdapter.js to src/amd/js/data/StatefullStoreAdapter.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/StoreAdapter.js to src/amd/js/data/StoreAdapter.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/_ModelBase.js to src/amd/js/data/_ModelBase.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/_StatefulModelMixin.js to src/amd/js/data/_StatefulModelMixin.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/data/declare-model.js to src/amd/js/data/declare-model.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/declare/_load.js to src/amd/js/declare/_load.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/declare/override.js to src/amd/js/declare/override.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/log/trace.js to src/amd/js/log/trace.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/messaging/Client.js to src/amd/js/messaging/Client.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/messaging/Destination.js to src/amd/js/messaging/Destination.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/messaging/Listener.js to src/amd/js/messaging/Listener.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/messaging/Session.js to src/amd/js/messaging/Session.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/text/format-compile.js to src/amd/js/text/format-compile.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/text/format.js to src/amd/js/text/format.js |
|
|
1 | NO CONTENT: file renamed from src/main/js/text/template-compile.js to src/amd/js/text/template-compile.js |
| @@ -1,40 +1,41 | |||
|
|
1 | 1 | import { Uuid } from "../Uuid"; |
|
|
2 | 2 | import { argumentNotEmptyString, argumentNotNull } from "../safe"; |
|
|
3 | 3 | import { TraceSource } from "../log/TraceSource"; |
|
|
4 | import m = require("module"); | |
|
|
4 | 5 | |
|
|
5 |
const trace = TraceSource.get( |
|
|
|
6 | const trace = TraceSource.get(m.id); | |
|
|
6 | 7 | |
|
|
7 | 8 | export async function createContextRequire(moduleName: string): Promise<Require> { |
|
|
8 | 9 | argumentNotEmptyString(moduleName, "moduleName"); |
|
|
9 | 10 | |
|
|
10 | 11 | const parts = moduleName.split("/"); |
|
|
11 | 12 | if (parts[0] === ".") |
|
|
12 | 13 | throw new Error("An absolute module path is required"); |
|
|
13 | 14 | |
|
|
14 | 15 | if (parts.length > 1) |
|
|
15 | 16 | parts.splice(-1, 1, Uuid()); |
|
|
16 | 17 | else |
|
|
17 | 18 | parts.push(Uuid()); |
|
|
18 | 19 | |
|
|
19 | 20 | const shim = parts.join("/"); |
|
|
20 | 21 | |
|
|
21 | 22 | trace.debug(`define shim ${shim}`); |
|
|
22 | 23 | |
|
|
23 | 24 | return new Promise<Require>(cb => { |
|
|
24 | 25 | define(shim, ["require"], r => { |
|
|
25 | 26 | trace.debug("shim resolved"); |
|
|
26 | 27 | return r; |
|
|
27 | 28 | }); |
|
|
28 | 29 | require([shim], cb); |
|
|
29 | 30 | }); |
|
|
30 | 31 | } |
|
|
31 | 32 | |
|
|
32 | 33 | export function makeResolver(req: Require) { |
|
|
33 | 34 | argumentNotNull(req, "req"); |
|
|
34 | 35 | |
|
|
35 | 36 | return (name: string) => { |
|
|
36 | 37 | return new Promise<any>((cb, eb) => { |
|
|
37 | 38 | req([name], cb, eb); |
|
|
38 | 39 | }); |
|
|
39 | 40 | }; |
|
|
40 | 41 | } |
| @@ -1,11 +1,16 | |||
|
|
1 | 1 | { |
|
|
2 |
"extends": "../tsconfig |
|
|
|
2 | "extends": "../tsconfig", | |
|
|
3 | 3 | "compilerOptions": { |
|
|
4 | 4 | "types": [ |
|
|
5 |
" |
|
|
|
5 | "requirejs" | |
|
|
6 | ], | |
|
|
7 | "rootDir": "ts", | |
|
|
8 | "rootDirs": [ | |
|
|
9 | "ts", | |
|
|
10 | "../typings/main" | |
|
|
6 | 11 | ] |
|
|
7 | 12 | }, |
|
|
8 | 13 | "include": [ |
|
|
9 | 14 | "ts/**/*.ts" |
|
|
10 | 15 | ] |
|
|
11 | 16 | } No newline at end of file |
| @@ -1,11 +1,11 | |||
|
|
1 | 1 | { |
|
|
2 |
"extends": "../tsconfig |
|
|
|
2 | "extends": "../tsconfig", | |
|
|
3 | 3 | "compilerOptions": { |
|
|
4 | 4 | "types": [ |
|
|
5 | 5 | "@types/node" |
|
|
6 | 6 | ] |
|
|
7 | 7 | }, |
|
|
8 | 8 | "include": [ |
|
|
9 | 9 | "ts/**/*.ts" |
|
|
10 | 10 | ] |
|
|
11 | 11 | } No newline at end of file |
| @@ -1,322 +1,348 | |||
|
|
1 | 1 | import { |
|
|
2 | 2 | ServiceRegistration, |
|
|
3 | 3 | TypeRegistration, |
|
|
4 | 4 | FactoryRegistration, |
|
|
5 | 5 | ServiceMap, |
|
|
6 | 6 | isDescriptor, |
|
|
7 | 7 | isDependencyRegistration, |
|
|
8 | 8 | DependencyRegistration, |
|
|
9 | 9 | ValueRegistration, |
|
|
10 | 10 | ActivationType, |
|
|
11 | 11 | isValueRegistration, |
|
|
12 | 12 | isTypeRegistration, |
|
|
13 | 13 | isFactoryRegistration |
|
|
14 | 14 | } from "./interfaces"; |
|
|
15 | 15 | |
|
|
16 | 16 | import { argumentNotEmptyString, isPrimitive, isPromise, delegate, argumentOfType, argumentNotNull, get } from "../safe"; |
|
|
17 | 17 | import { AggregateDescriptor } from "./AggregateDescriptor"; |
|
|
18 | 18 | import { ValueDescriptor } from "./ValueDescriptor"; |
|
|
19 | 19 | import { Container } from "./Container"; |
|
|
20 | 20 | import { ReferenceDescriptor } from "./ReferenceDescriptor"; |
|
|
21 | 21 | import { TypeServiceDescriptor } from "./TypeServiceDescriptor"; |
|
|
22 | 22 | import { FactoryServiceDescriptor } from "./FactoryServiceDescriptor"; |
|
|
23 | 23 | import { TraceSource } from "../log/TraceSource"; |
|
|
24 | 24 | import { ConfigError } from "./ConfigError"; |
|
|
25 | 25 | import { Cancellation } from "../Cancellation"; |
|
|
26 | 26 | |
|
|
27 | 27 | const trace = TraceSource.get("@implab/core/di/Configuration"); |
|
|
28 | 28 | |
|
|
29 | declare const define; | |
|
|
30 | declare const require; | |
|
|
31 | ||
|
|
32 | function hasAmdLoader() { | |
|
|
33 | return (typeof define === "function" && define.amd); | |
|
|
34 | } | |
|
|
35 | ||
|
|
29 | 36 | async function mapAll(data: object | any[], map?: (v, k) => any): Promise<any> { |
|
|
30 | 37 | if (data instanceof Array) { |
|
|
31 | 38 | return Promise.all(map ? data.map(map) : data); |
|
|
32 | 39 | } else { |
|
|
33 | 40 | const keys = Object.keys(data); |
|
|
34 | 41 | |
|
|
35 | 42 | const o: any = {}; |
|
|
36 | 43 | |
|
|
37 | 44 | await Promise.all(keys.map(async k => { |
|
|
38 | 45 | const v = map ? map(data[k], k) : data[k]; |
|
|
39 | 46 | o[k] = isPromise(v) ? await v : v; |
|
|
40 | 47 | })); |
|
|
41 | 48 | |
|
|
42 | 49 | return o; |
|
|
43 | 50 | } |
|
|
44 | 51 | } |
|
|
45 | 52 | |
|
|
46 | 53 | type Resolver = (qname: string) => any; |
|
|
47 | 54 | |
|
|
48 | 55 | type _key = string | number; |
|
|
49 | 56 | |
|
|
50 | 57 | export class Configuration { |
|
|
51 | 58 | |
|
|
52 | 59 | _hasInnerDescriptors = false; |
|
|
53 | 60 | |
|
|
54 | 61 | _container: Container; |
|
|
55 | 62 | |
|
|
56 | 63 | _path: Array<_key>; |
|
|
57 | 64 | |
|
|
58 | 65 | _configName: string; |
|
|
59 | 66 | |
|
|
60 | 67 | _require: Resolver; |
|
|
61 | 68 | |
|
|
62 | 69 | constructor(container: Container) { |
|
|
63 | 70 | argumentNotNull(container, container); |
|
|
64 | 71 | this._container = container; |
|
|
65 | 72 | this._path = []; |
|
|
66 | 73 | } |
|
|
67 | 74 | |
|
|
75 | async loadConfiguration(moduleName: string, ct = Cancellation.none) { | |
|
|
76 | argumentNotEmptyString(moduleName, "moduleName"); | |
|
|
77 | // TODO remove the code below somewehere else | |
|
|
78 | if (hasAmdLoader()) { | |
|
|
79 | // if we have a requirejs loader, use it directly | |
|
|
80 | // don't rely on typescript 'import' function | |
|
|
81 | const m = await new Promise<any>(cb => require(["./RequireJsHelper"], cb)); | |
|
|
82 | const r = m.makeResolver(require); | |
|
|
83 | const config = await r(moduleName); | |
|
|
84 | ||
|
|
85 | return this.applyConfiguration( | |
|
|
86 | config, | |
|
|
87 | m.makeResolver(await m.createContextRequire(moduleName)) | |
|
|
88 | ); | |
|
|
89 | } else { | |
|
|
90 | throw new Error("This feature is supported only with the amd loader"); | |
|
|
91 | } | |
|
|
92 | } | |
|
|
93 | ||
|
|
68 | 94 | async applyConfiguration(data: object, resolver?: Resolver, ct = Cancellation.none) { |
|
|
69 | 95 | argumentNotNull(data, "data"); |
|
|
70 | 96 | |
|
|
71 | 97 | trace.log("applyConfiguration"); |
|
|
72 | 98 | |
|
|
73 | 99 | this._configName = "$"; |
|
|
74 | 100 | |
|
|
75 | 101 | if (resolver) |
|
|
76 | 102 | this._require = resolver; |
|
|
77 | 103 | |
|
|
78 | 104 | let services: ServiceMap; |
|
|
79 | 105 | |
|
|
80 | 106 | try { |
|
|
81 | 107 | services = await this._visitRegistrations(data, "$"); |
|
|
82 | 108 | } catch (e) { |
|
|
83 | 109 | throw this._makeError(e); |
|
|
84 | 110 | } |
|
|
85 | 111 | |
|
|
86 | 112 | this._container.register(services); |
|
|
87 | 113 | } |
|
|
88 | 114 | |
|
|
89 | 115 | _makeError(inner) { |
|
|
90 | 116 | const e = new ConfigError("Failed to load configuration", inner); |
|
|
91 | 117 | e.configName = this._configName; |
|
|
92 | 118 | e.path = this._makePath(); |
|
|
93 | 119 | return e; |
|
|
94 | 120 | } |
|
|
95 | 121 | |
|
|
96 | 122 | _makePath() { |
|
|
97 | 123 | return this._path |
|
|
98 | 124 | .reduce( |
|
|
99 | 125 | (prev, cur) => typeof cur === "number" ? |
|
|
100 | 126 | `${prev}[${cur}]` : |
|
|
101 | 127 | `${prev}.${cur}` |
|
|
102 | 128 | ) |
|
|
103 | 129 | .toString(); |
|
|
104 | 130 | } |
|
|
105 | 131 | |
|
|
106 | 132 | async _resolveType(moduleName: string, localName: string) { |
|
|
107 | 133 | trace.log("resolveType moduleName={0}, localName={1}", moduleName, localName); |
|
|
108 | 134 | try { |
|
|
109 | 135 | const m = await this._loadModule(moduleName); |
|
|
110 | 136 | return localName ? get(localName, m) : m; |
|
|
111 | 137 | } catch (e) { |
|
|
112 | 138 | trace.error("Failed to resolve type moduleName={0}, localName={1}", moduleName, localName); |
|
|
113 | 139 | throw e; |
|
|
114 | 140 | } |
|
|
115 | 141 | } |
|
|
116 | 142 | |
|
|
117 | 143 | async _loadModule(moduleName: string) { |
|
|
118 | 144 | trace.debug("loadModule {0}", moduleName); |
|
|
119 | 145 | |
|
|
120 | 146 | const m = await this._require(moduleName); |
|
|
121 | 147 | |
|
|
122 | 148 | return m; |
|
|
123 | 149 | } |
|
|
124 | 150 | |
|
|
125 | 151 | async _visitRegistrations(data, name: _key) { |
|
|
126 | 152 | this._enter(name); |
|
|
127 | 153 | |
|
|
128 | 154 | if (data.constructor && |
|
|
129 | 155 | data.constructor.prototype !== Object.prototype) |
|
|
130 | 156 | throw new Error("Configuration must be a simple object"); |
|
|
131 | 157 | |
|
|
132 | 158 | const o: ServiceMap = {}; |
|
|
133 | 159 | const keys = Object.keys(data); |
|
|
134 | 160 | |
|
|
135 | 161 | const services = await mapAll(data, async (v, k) => { |
|
|
136 | 162 | const d = await this._visit(v, k); |
|
|
137 | 163 | return isDescriptor(d) ? d : new AggregateDescriptor(d); |
|
|
138 | 164 | }) as ServiceMap; |
|
|
139 | 165 | |
|
|
140 | 166 | this._leave(); |
|
|
141 | 167 | |
|
|
142 | 168 | return services; |
|
|
143 | 169 | } |
|
|
144 | 170 | |
|
|
145 | 171 | _enter(name: _key) { |
|
|
146 | 172 | this._path.push(name); |
|
|
147 | 173 | trace.debug(">{0}", name); |
|
|
148 | 174 | } |
|
|
149 | 175 | |
|
|
150 | 176 | _leave() { |
|
|
151 | 177 | const name = this._path.pop(); |
|
|
152 | 178 | trace.debug("<{0}", name); |
|
|
153 | 179 | } |
|
|
154 | 180 | |
|
|
155 | 181 | async _visit(data, name: string): Promise<any> { |
|
|
156 | 182 | if (isPrimitive(data) || isDescriptor(data)) |
|
|
157 | 183 | return data; |
|
|
158 | 184 | |
|
|
159 | 185 | if (isDependencyRegistration(data)) { |
|
|
160 | 186 | return this._visitDependencyRegistration(data, name); |
|
|
161 | 187 | } else if (isValueRegistration(data)) { |
|
|
162 | 188 | return this._visitValueRegistration(data, name); |
|
|
163 | 189 | } else if (isTypeRegistration(data)) { |
|
|
164 | 190 | return this._visitTypeRegistration(data, name); |
|
|
165 | 191 | } else if (isFactoryRegistration(data)) { |
|
|
166 | 192 | return this._visitFactoryRegistration(data, name); |
|
|
167 | 193 | } else if (data instanceof Array) { |
|
|
168 | 194 | return this._visitArray(data, name); |
|
|
169 | 195 | } |
|
|
170 | 196 | |
|
|
171 | 197 | return this._visitObject(data, name); |
|
|
172 | 198 | } |
|
|
173 | 199 | |
|
|
174 | 200 | async _visitObject(data: object, name: _key) { |
|
|
175 | 201 | if (data.constructor && |
|
|
176 | 202 | data.constructor.prototype !== Object.prototype) |
|
|
177 | 203 | return new ValueDescriptor(data); |
|
|
178 | 204 | |
|
|
179 | 205 | this._enter(name); |
|
|
180 | 206 | |
|
|
181 | 207 | const v = await mapAll(data, delegate(this, "_visit")); |
|
|
182 | 208 | |
|
|
183 | 209 | // TODO: handle inline descriptors properly |
|
|
184 | 210 | // const ex = { |
|
|
185 | 211 | // activate(ctx) { |
|
|
186 | 212 | // const value = ctx.activate(this.prop, "prop"); |
|
|
187 | 213 | // // some code |
|
|
188 | 214 | // }, |
|
|
189 | 215 | // // will be turned to ReferenceDescriptor |
|
|
190 | 216 | // prop: { $dependency: "depName" } |
|
|
191 | 217 | // }; |
|
|
192 | 218 | |
|
|
193 | 219 | this._leave(); |
|
|
194 | 220 | return v; |
|
|
195 | 221 | } |
|
|
196 | 222 | |
|
|
197 | 223 | async _visitArray(data: any[], name: _key) { |
|
|
198 | 224 | if (data.constructor && |
|
|
199 | 225 | data.constructor.prototype !== Array.prototype) |
|
|
200 | 226 | return new ValueDescriptor(data); |
|
|
201 | 227 | |
|
|
202 | 228 | this._enter(name); |
|
|
203 | 229 | |
|
|
204 | 230 | const v = await mapAll(data, delegate(this, "_visit")); |
|
|
205 | 231 | this._leave(); |
|
|
206 | 232 | |
|
|
207 | 233 | return v; |
|
|
208 | 234 | } |
|
|
209 | 235 | |
|
|
210 | 236 | _makeServiceParams(data: ServiceRegistration) { |
|
|
211 | 237 | const opts: any = { |
|
|
212 | 238 | owner: this._container |
|
|
213 | 239 | }; |
|
|
214 | 240 | if (data.services) |
|
|
215 | 241 | opts.services = this._visitRegistrations(data.services, "services"); |
|
|
216 | 242 | |
|
|
217 | 243 | if (data.inject) { |
|
|
218 | 244 | this._path.push("inject"); |
|
|
219 | 245 | opts.inject = mapAll( |
|
|
220 | 246 | data.inject instanceof Array ? |
|
|
221 | 247 | data.inject : |
|
|
222 | 248 | [data.inject], |
|
|
223 | 249 | delegate(this, "_visitObject") |
|
|
224 | 250 | ); |
|
|
225 | 251 | this._leave(); |
|
|
226 | 252 | } |
|
|
227 | 253 | |
|
|
228 | 254 | if ("params" in data) |
|
|
229 | 255 | opts.params = data.params instanceof Array ? |
|
|
230 | 256 | this._visitArray(data.params, "params") : |
|
|
231 | 257 | this._visit(data.params, "params"); |
|
|
232 | 258 | |
|
|
233 | 259 | if (data.activation) { |
|
|
234 | 260 | if (typeof (data.activation) === "string") { |
|
|
235 | 261 | switch (data.activation.toLowerCase()) { |
|
|
236 | 262 | case "singleton": |
|
|
237 | 263 | opts.activation = ActivationType.Singleton; |
|
|
238 | 264 | break; |
|
|
239 | 265 | case "container": |
|
|
240 | 266 | opts.activation = ActivationType.Container; |
|
|
241 | 267 | break; |
|
|
242 | 268 | case "hierarchy": |
|
|
243 | 269 | opts.activation = ActivationType.Hierarchy; |
|
|
244 | 270 | break; |
|
|
245 | 271 | case "context": |
|
|
246 | 272 | opts.activation = ActivationType.Context; |
|
|
247 | 273 | break; |
|
|
248 | 274 | case "call": |
|
|
249 | 275 | opts.activation = ActivationType.Call; |
|
|
250 | 276 | break; |
|
|
251 | 277 | default: |
|
|
252 | 278 | throw new Error("Unknown activation type: " + |
|
|
253 | 279 | data.activation); |
|
|
254 | 280 | } |
|
|
255 | 281 | } else { |
|
|
256 | 282 | opts.activation = Number(data.activation); |
|
|
257 | 283 | } |
|
|
258 | 284 | } |
|
|
259 | 285 | |
|
|
260 | 286 | if (data.cleanup) |
|
|
261 | 287 | opts.cleanup = data.cleanup; |
|
|
262 | 288 | |
|
|
263 | 289 | return opts; |
|
|
264 | 290 | } |
|
|
265 | 291 | |
|
|
266 | 292 | async _visitValueRegistration(data: ValueRegistration, name: _key) { |
|
|
267 | 293 | this._enter(name); |
|
|
268 | 294 | const d = data.parse ? new AggregateDescriptor(data.$value) : new ValueDescriptor(data.$value); |
|
|
269 | 295 | this._leave(); |
|
|
270 | 296 | return d; |
|
|
271 | 297 | } |
|
|
272 | 298 | |
|
|
273 | 299 | async _visitDependencyRegistration(data: DependencyRegistration, name: _key) { |
|
|
274 | 300 | argumentNotEmptyString(data && data.$dependency, "data.$dependency"); |
|
|
275 | 301 | this._enter(name); |
|
|
276 | 302 | const d = new ReferenceDescriptor({ |
|
|
277 | 303 | name: data.$dependency, |
|
|
278 | 304 | lazy: data.lazy, |
|
|
279 | 305 | optional: data.optional, |
|
|
280 | 306 | default: data.default, |
|
|
281 | 307 | services: data.services && await this._visitRegistrations(data.services, "services") |
|
|
282 | 308 | }); |
|
|
283 | 309 | this._leave(); |
|
|
284 | 310 | return d; |
|
|
285 | 311 | } |
|
|
286 | 312 | |
|
|
287 | 313 | async _visitTypeRegistration(data: TypeRegistration, name: _key) { |
|
|
288 | 314 | argumentNotNull(data.$type, "data.$type"); |
|
|
289 | 315 | this._enter(name); |
|
|
290 | 316 | |
|
|
291 | 317 | const opts = this._makeServiceParams(data); |
|
|
292 | 318 | if (data.$type instanceof Function) { |
|
|
293 | 319 | opts.type = data.$type; |
|
|
294 | 320 | } else { |
|
|
295 | 321 | const [moduleName, typeName] = data.$type.split(":", 2); |
|
|
296 | 322 | opts.type = this._resolveType(moduleName, typeName); |
|
|
297 | 323 | } |
|
|
298 | 324 | |
|
|
299 | 325 | const d = new TypeServiceDescriptor( |
|
|
300 | 326 | await mapAll(opts) |
|
|
301 | 327 | ); |
|
|
302 | 328 | |
|
|
303 | 329 | this._leave(); |
|
|
304 | 330 | |
|
|
305 | 331 | return d; |
|
|
306 | 332 | } |
|
|
307 | 333 | |
|
|
308 | 334 | async _visitFactoryRegistration(data: FactoryRegistration, name: _key) { |
|
|
309 | 335 | argumentOfType(data.$factory, Function, "data.$type"); |
|
|
310 | 336 | this._enter(name); |
|
|
311 | 337 | |
|
|
312 | 338 | const opts = this._makeServiceParams(data); |
|
|
313 | 339 | opts.factory = opts.$factory; |
|
|
314 | 340 | |
|
|
315 | 341 | const d = new FactoryServiceDescriptor( |
|
|
316 | 342 | await mapAll(opts) |
|
|
317 | 343 | ); |
|
|
318 | 344 | |
|
|
319 | 345 | this._leave(); |
|
|
320 | 346 | return d; |
|
|
321 | 347 | } |
|
|
322 | 348 | } |
| @@ -1,6 +1,9 | |||
|
|
1 | 1 | { |
|
|
2 |
"extends": "../tsconfig |
|
|
|
2 | "extends": "../tsconfig", | |
|
|
3 | "compilerOptions": { | |
|
|
4 | "rootDir": "ts" | |
|
|
5 | }, | |
|
|
3 | 6 | "include": [ |
|
|
4 | 7 | "ts/**/*.ts" |
|
|
5 | 8 | ] |
|
|
6 | 9 | } No newline at end of file |
| @@ -1,23 +1,23 | |||
|
|
1 | 1 | { |
|
|
2 | 2 | "name": "${packageName}", |
|
|
3 |
"version": "${vers |
|
|
|
3 | "version": "${version}", | |
|
|
4 | 4 | "description": "${description}", |
|
|
5 | 5 | "main": "main.js", |
|
|
6 | 6 | "keywords": [ |
|
|
7 | 7 | "di", |
|
|
8 | 8 | "ioc", |
|
|
9 | 9 | "logging", |
|
|
10 | 10 | "template engine", |
|
|
11 | 11 | "dependency injection" |
|
|
12 | 12 | ], |
|
|
13 | 13 | "author": "${author}", |
|
|
14 | 14 | "license": "${license}", |
|
|
15 | 15 | "repository": "$repository", |
|
|
16 | 16 | "publishConfig": { |
|
|
17 | 17 | "access": "public" |
|
|
18 | 18 | }, |
|
|
19 | 19 | "peerDependencies": { |
|
|
20 | 20 | "dojo": "^1.10.0" |
|
|
21 | 21 | } |
|
|
22 | 22 | } |
|
|
23 | 23 | No newline at end of file |
| @@ -1,4 +1,8 | |||
|
|
1 | //define(["./ActivatableTests", "./trace-test", "./TraceSourceTests", "./CancellationTests"]); | |
|
|
2 | //define(["./CancellationTests"]); | |
|
|
3 | //define(["./ObservableTests"]); | |
|
|
4 | define(["./ContainerTests"]); No newline at end of file | |
|
|
1 | define([ | |
|
|
2 | "./ActivatableTests", | |
|
|
3 | "./trace-test", | |
|
|
4 | "./TraceSourceTests", | |
|
|
5 | "./CancellationTests", | |
|
|
6 | "./ObservableTests", | |
|
|
7 | "./ContainerTests" | |
|
|
8 | ]); No newline at end of file | |
| @@ -1,27 +1,22 | |||
|
|
1 | 1 | var requirejs = require('requirejs'); |
|
|
2 | 2 | |
|
|
3 | 3 | requirejs.config({ |
|
|
4 | 4 | baseUrl: '.', |
|
|
5 | map: { | |
|
|
6 | "*": { | |
|
|
7 | "@implab/core": "core" | |
|
|
8 | } | |
|
|
9 | }, | |
|
|
10 | 5 | packages: [{ |
|
|
11 | name: "core", | |
|
|
12 | location: "build/dist" | |
|
|
6 | name: "@implab/core", | |
|
|
7 | location: "build/dist/amd" | |
|
|
13 | 8 | }, |
|
|
14 | 9 | { |
|
|
15 | 10 | name: "test", |
|
|
16 | location: "build/test" | |
|
|
11 | location: "build/test/amd" | |
|
|
17 | 12 | }, |
|
|
18 | 13 | { |
|
|
19 | 14 | name: "dojo", |
|
|
20 | 15 | location: "node_modules/dojo" |
|
|
21 | 16 | } |
|
|
22 | 17 | ], |
|
|
23 | 18 | nodeRequire: require |
|
|
24 | 19 | }); |
|
|
25 | 20 | |
|
|
26 | 21 | |
|
|
27 | 22 | requirejs(['test/plan']); No newline at end of file |
| @@ -1,30 +1,30 | |||
|
|
1 | 1 | define(["tape"], function(tape) { |
|
|
2 | 2 | "use strict"; |
|
|
3 | 3 | var sourceId = '73a633f3-eab8-49b0-8601-07cae710f234'; |
|
|
4 | 4 | var sourceId2 = '3ba9c7cd-ed77-437b-9a2f-1cbeb1226b5b'; |
|
|
5 | 5 | tape('Load TraceSource for the module', function(t) { |
|
|
6 | require(["core/log/trace!" + sourceId, "core/log/TraceSource"], function(trace, TraceSource_1) { | |
|
|
6 | require(["@implab/core/log/trace!" + sourceId, "@implab/core/log/TraceSource"], function(trace, TraceSource_1) { | |
|
|
7 | 7 | var TraceSource = TraceSource_1.TraceSource; |
|
|
8 | 8 | t.equal(trace && trace.id, sourceId, "trace should be taken from the loader plugin parameter"); |
|
|
9 | 9 | |
|
|
10 | 10 | var count = 0; |
|
|
11 | 11 | |
|
|
12 | 12 | var h = TraceSource.on(function(x) { |
|
|
13 | 13 | if(x.id == sourceId || x.id == sourceId2) |
|
|
14 | 14 | count++; |
|
|
15 | 15 | }); |
|
|
16 | 16 | |
|
|
17 | 17 | t.equal(count, 1, "should see created channel immediatelly"); |
|
|
18 | 18 | t.equal(trace, TraceSource.get(sourceId), "should get same TraceSource from registry"); |
|
|
19 | 19 | t.equal(count, 1); |
|
|
20 | 20 | |
|
|
21 | 21 | TraceSource.get(sourceId2); |
|
|
22 | 22 | |
|
|
23 | 23 | t.equal(count, 2); |
|
|
24 | 24 | |
|
|
25 | 25 | h.destroy(); |
|
|
26 | 26 | |
|
|
27 | 27 | t.end(); |
|
|
28 | 28 | }); |
|
|
29 | 29 | }); |
|
|
30 | 30 | }); No newline at end of file |
| @@ -1,14 +1,15 | |||
|
|
1 | 1 | { |
|
|
2 | "extends": "../tsconfig", | |
|
|
2 | 3 | "compilerOptions": { |
|
|
3 |
" |
|
|
|
4 |
" |
|
|
|
5 | "sourceMap": true, | |
|
|
6 | "moduleResolution": "node", | |
|
|
7 | "lib": [ | |
|
|
8 | "es2015" | |
|
|
4 | "rootDir": "ts", | |
|
|
5 | "baseUrl": ".", | |
|
|
6 | "paths": { | |
|
|
7 | "@implab/core/*": [ | |
|
|
8 | "../../build/dist/amd/*" | |
|
|
9 | 9 | ] |
|
|
10 | } | |
|
|
10 | 11 | }, |
|
|
11 | 12 | "include" : [ |
|
|
12 | 13 | "ts/**/*.ts" |
|
|
13 | 14 | ] |
|
|
14 | 15 | } No newline at end of file |
| @@ -1,22 +1,18 | |||
|
|
1 | 1 | { |
|
|
2 | 2 | "compilerOptions": { |
|
|
3 | 3 | "target": "es3", |
|
|
4 | "module": "amd", | |
|
|
5 | 4 | "sourceMap": true, |
|
|
6 | 5 | "declaration": true, |
|
|
7 | 6 | "moduleResolution": "node", |
|
|
7 | "noEmitOnError": true, | |
|
|
8 | 8 | "listFiles": true, |
|
|
9 | 9 | "lib": [ |
|
|
10 | 10 | "es5", |
|
|
11 | 11 | "es2015.promise", |
|
|
12 | 12 | "es2015.symbol", |
|
|
13 | 13 | "dom" |
|
|
14 | 14 | ], |
|
|
15 | "rootDirs": [ | |
|
|
16 | "main/ts", | |
|
|
17 | "amd/ts", | |
|
|
18 | "cjs/ts" | |
|
|
19 | ], | |
|
|
20 | 15 | "types": [] |
|
|
21 | } | |
|
|
16 | }, | |
|
|
17 | "files": [] | |
|
|
22 | 18 | } No newline at end of file |
|
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now
