| @@ -0,0 +1,3 | |||||
|
|
1 | export function createContextResolver(moduleName: string) { | |||
|
|
2 | return (m: string) => { }; | |||
|
|
3 | } | |||
| @@ -2,3 +2,4 syntax: glob | |||||
| 2 | .gradle/ |
|
2 | .gradle/ | |
| 3 | build/ |
|
3 | build/ | |
| 4 | node_modules/ |
|
4 | node_modules/ | |
|
|
5 | src/typings/ | |||
| @@ -5,25 +5,38 if (release != 'rtm') { | |||||
| 5 | if(!npmName) |
|
5 | if(!npmName) | |
| 6 | npmName = name; |
|
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" |
|
16 | ext.packageName="$npmScope/$npmName-$platform"; | |
| 11 | def distDir = "$packageDir/$platform" |
|
17 | ||
| 12 |
def |
|
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 | task printVersion { |
|
26 | task printVersion { | |
| 15 | doLast { |
|
27 | doLast { | |
| 16 | println "version: $version" |
|
28 | println "version: $version" | |
| 17 | println "packageName: $packageName" |
|
29 | println "packageName: $packageName" | |
| 18 | println "platform: $platform" |
|
30 | println "platform: $platform" | |
|
|
31 | println "module: $moduleType" | |||
| 19 | } |
|
32 | } | |
| 20 | } |
|
33 | } | |
| 21 |
|
34 | |||
| 22 |
|
||||
| 23 | task clean { |
|
35 | task clean { | |
| 24 | doLast { |
|
36 | doLast { | |
| 25 | delete buildDir |
|
37 | delete buildDir | |
| 26 | delete "node_modules/$packageName" |
|
38 | delete "node_modules/$packageName" | |
|
|
39 | delete typingsDir | |||
| 27 | } |
|
40 | } | |
| 28 | } |
|
41 | } | |
| 29 |
|
42 | |||
| @@ -43,68 +56,79 task _npmInstall() { | |||||
| 43 | } |
|
56 | } | |
| 44 | } |
|
57 | } | |
| 45 |
|
58 | |||
| 46 | task _legacyJs(type:Copy) { |
|
59 | sourceSets.each { | |
| 47 | from 'src/main/js/' |
|
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 | into distDir |
|
68 | into distDir | |
| 49 | } |
|
69 | } | |
| 50 |
|
70 | |||
| 51 |
task |
|
71 | task "_compileTs$setName"(dependsOn: _npmInstall, type:Exec) { | |
| 52 |
inputs.dir( |
|
72 | inputs.dir("$setDir/ts") | |
| 53 |
inputs.file( |
|
73 | inputs.file("$srcDir/tsconfig.json") | |
| 54 |
inputs.file( |
|
74 | inputs.file("$setDir/tsconfig.json") | |
| 55 |
outputs.dir(d |
|
75 | outputs.dir(destDir) | |
|
|
76 | outputs.dir(declDir) | |||
| 56 |
|
77 | |||
| 57 | commandLine 'node_modules/.bin/tsc', |
|
78 | commandLine 'node_modules/.bin/tsc', | |
| 58 |
'-p', |
|
79 | '-p', "$setDir/tsconfig.json", | |
| 59 | '--outDir', distDir |
|
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 | task _packageMeta(type: Copy) { |
|
103 | task _packageMeta(type: Copy) { | |
| 63 | inputs.property("version", version) |
|
104 | inputs.property("version", version) | |
| 64 | from('.') { |
|
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 | into distDir |
|
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) { |
|
119 | _compileTsTest { | |
| 81 | inputs.file("$distDir/package.json") |
|
120 | dependsOn build | |
| 82 | outputs.upToDateWhen { |
|
|||
| 83 | new File("$projectDir/node_modules/$packageName").exists() |
|
|||
| 84 | } |
|
|||
| 85 |
|
||||
| 86 | commandLine 'npm', 'install', '--no-save', '--force', distDir |
|
|||
| 87 | } |
|
121 | } | |
| 88 |
|
122 | |||
| 89 | task copyJsTests(type: Copy) { |
|
123 | task buildTests(dependsOn: [_copyJsTest, _buildTsTest]) { | |
| 90 | from 'test/js' |
|
|||
| 91 | into testDir |
|
|||
| 92 | } |
|
124 | } | |
| 93 |
|
125 | |||
| 94 |
task |
|
126 | task test(dependsOn: buildTests, type: Exec) { | |
| 95 | inputs.dir('test/ts') |
|
127 | commandLine 'node', "$testDir/run-amd-tests.js" | |
| 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' |
|
|||
| 104 | } |
|
128 | } | |
| 105 |
|
129 | |||
| 106 | task pack(dependsOn: build, type: Exec) { |
|
130 | task pack(dependsOn: build, type: Exec) { | |
| 107 |
workingDir |
|
131 | workingDir distDir | |
| 108 |
|
132 | |||
| 109 | commandLine 'npm', 'pack' |
|
133 | commandLine 'npm', 'pack' | |
| 110 | } No newline at end of file |
|
134 | } | |
| @@ -1,7 +1,8 | |||||
| 1 | version=1.2.0 |
|
1 | version=1.2.0 | |
| 2 | release=rc |
|
2 | release=rc | |
|
|
3 | author=Implab team | |||
| 3 | platform=amd |
|
4 | platform=amd | |
| 4 |
descript |
|
5 | description=Dependency injection, logging, simple and fast text template engine | |
| 5 | license=BSD-2-Clause |
|
6 | license=BSD-2-Clause | |
| 6 | repository=https://bitbucket.org/implab/implabjs |
|
7 | repository=https://bitbucket.org/implab/implabjs | |
| 7 | npmScope=@implab |
|
8 | npmScope=@implab | |
| @@ -5,9 +5,9 | |||||
| 5 | "requires": true, |
|
5 | "requires": true, | |
| 6 | "dependencies": { |
|
6 | "dependencies": { | |
| 7 | "@types/node": { |
|
7 | "@types/node": { | |
| 8 |
"version": "10.12.1 |
|
8 | "version": "10.12.15", | |
| 9 |
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.1 |
|
9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.15.tgz", | |
| 10 | "integrity": "sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A==", |
|
10 | "integrity": "sha512-9kROxduaN98QghwwHmxXO2Xz3MaWf+I1sLVAA6KJDF5xix+IyXVhds0MAfdNwtcpSrzhaTsNB0/jnL86fgUhqA==", | |
| 11 | "dev": true |
|
11 | "dev": true | |
| 12 | }, |
|
12 | }, | |
| 13 | "@types/requirejs": { |
|
13 | "@types/requirejs": { | |
| @@ -90,7 +90,7 | |||||
| 90 | }, |
|
90 | }, | |
| 91 | "duplexer": { |
|
91 | "duplexer": { | |
| 92 | "version": "0.1.1", |
|
92 | "version": "0.1.1", | |
| 93 |
"resolved": "http |
|
93 | "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", | |
| 94 | "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", |
|
94 | "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", | |
| 95 | "dev": true |
|
95 | "dev": true | |
| 96 | }, |
|
96 | }, | |
| @@ -135,7 +135,7 | |||||
| 135 | "dependencies": { |
|
135 | "dependencies": { | |
| 136 | "tape": { |
|
136 | "tape": { | |
| 137 | "version": "2.3.3", |
|
137 | "version": "2.3.3", | |
| 138 |
"resolved": "http |
|
138 | "resolved": "http://registry.npmjs.org/tape/-/tape-2.3.3.tgz", | |
| 139 | "integrity": "sha1-Lnzgox3wn41oUWZKcYQuDKUFevc=", |
|
139 | "integrity": "sha1-Lnzgox3wn41oUWZKcYQuDKUFevc=", | |
| 140 | "dev": true, |
|
140 | "dev": true, | |
| 141 | "requires": { |
|
141 | "requires": { | |
| @@ -295,7 +295,7 | |||||
| 295 | }, |
|
295 | }, | |
| 296 | "path-is-absolute": { |
|
296 | "path-is-absolute": { | |
| 297 | "version": "1.0.1", |
|
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 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", |
|
299 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", | |
| 300 | "dev": true |
|
300 | "dev": true | |
| 301 | }, |
|
301 | }, | |
| @@ -307,7 +307,7 | |||||
| 307 | }, |
|
307 | }, | |
| 308 | "readable-stream": { |
|
308 | "readable-stream": { | |
| 309 | "version": "1.1.14", |
|
309 | "version": "1.1.14", | |
| 310 |
"resolved": "http |
|
310 | "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", | |
| 311 | "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", |
|
311 | "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", | |
| 312 | "dev": true, |
|
312 | "dev": true, | |
| 313 | "requires": { |
|
313 | "requires": { | |
| @@ -325,7 +325,7 | |||||
| 325 | }, |
|
325 | }, | |
| 326 | "resolve": { |
|
326 | "resolve": { | |
| 327 | "version": "1.7.1", |
|
327 | "version": "1.7.1", | |
| 328 |
"resolved": "http |
|
328 | "resolved": "http://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", | |
| 329 | "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", |
|
329 | "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", | |
| 330 | "dev": true, |
|
330 | "dev": true, | |
| 331 | "requires": { |
|
331 | "requires": { | |
| @@ -360,7 +360,7 | |||||
| 360 | }, |
|
360 | }, | |
| 361 | "string_decoder": { |
|
361 | "string_decoder": { | |
| 362 | "version": "0.10.31", |
|
362 | "version": "0.10.31", | |
| 363 |
"resolved": "http |
|
363 | "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", | |
| 364 | "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", |
|
364 | "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", | |
| 365 | "dev": true |
|
365 | "dev": true | |
| 366 | }, |
|
366 | }, | |
| @@ -417,13 +417,13 | |||||
| 417 | }, |
|
417 | }, | |
| 418 | "through": { |
|
418 | "through": { | |
| 419 | "version": "2.3.8", |
|
419 | "version": "2.3.8", | |
| 420 |
"resolved": "http |
|
420 | "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", | |
| 421 | "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", |
|
421 | "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", | |
| 422 | "dev": true |
|
422 | "dev": true | |
| 423 | }, |
|
423 | }, | |
| 424 | "through2": { |
|
424 | "through2": { | |
| 425 | "version": "0.2.3", |
|
425 | "version": "0.2.3", | |
| 426 |
"resolved": "http |
|
426 | "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", | |
| 427 | "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", |
|
427 | "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", | |
| 428 | "dev": true, |
|
428 | "dev": true, | |
| 429 | "requires": { |
|
429 | "requires": { | |
| @@ -431,10 +431,16 | |||||
| 431 | "xtend": "~2.1.1" |
|
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 | "typescript": { |
|
440 | "typescript": { | |
| 435 |
"version": "3.2. |
|
441 | "version": "3.2.2", | |
| 436 |
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2. |
|
442 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz", | |
| 437 | "integrity": "sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg==", |
|
443 | "integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==", | |
| 438 | "dev": true |
|
444 | "dev": true | |
| 439 | }, |
|
445 | }, | |
| 440 | "wrappy": { |
|
446 | "wrappy": { | |
| @@ -17,16 +17,19 | |||||
| 17 | "access": "public" |
|
17 | "access": "public" | |
| 18 | }, |
|
18 | }, | |
| 19 | "peerDependencies": { |
|
19 | "peerDependencies": { | |
| 20 | "dojo": "^1.10.0" |
|
20 | "dojo": "^1.10.0", | |
|
|
21 | "tslib": "latest" | |||
| 21 | }, |
|
22 | }, | |
| 22 | "devDependencies": { |
|
23 | "devDependencies": { | |
| 23 | "typescript": "latest", |
|
24 | "typescript": "latest", | |
| 24 | "tape": "latest", |
|
25 | "tape": "latest", | |
| 25 | "@types/tape": "latest", |
|
26 | "@types/tape": "latest", | |
| 26 | "@types/requirejs": "latest", |
|
27 | "@types/requirejs": "latest", | |
|
|
28 | "@types/node": "latest", | |||
| 27 | "requirejs": "latest", |
|
29 | "requirejs": "latest", | |
| 28 | "faucet": "latest", |
|
30 | "faucet": "latest", | |
| 29 | "dojo": "^1.10.0" |
|
31 | "dojo": "^1.10.0", | |
|
|
32 | "tslib": "latest" | |||
| 30 | }, |
|
33 | }, | |
| 31 | "types": "main.d.ts" |
|
34 | "types": "main.d.ts" | |
| 32 | } |
|
35 | } | |
| 1 | NO CONTENT: file renamed from src/main/js/Uri.js to src/amd/js/Uri.js |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
NO CONTENT: file renamed from src/main/js/text/template-compile.js to src/amd/js/text/template-compile.js |
| @@ -1,8 +1,9 | |||||
| 1 | import { Uuid } from "../Uuid"; |
|
1 | import { Uuid } from "../Uuid"; | |
| 2 | import { argumentNotEmptyString, argumentNotNull } from "../safe"; |
|
2 | import { argumentNotEmptyString, argumentNotNull } from "../safe"; | |
| 3 | import { TraceSource } from "../log/TraceSource"; |
|
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 | export async function createContextRequire(moduleName: string): Promise<Require> { |
|
8 | export async function createContextRequire(moduleName: string): Promise<Require> { | |
| 8 | argumentNotEmptyString(moduleName, "moduleName"); |
|
9 | argumentNotEmptyString(moduleName, "moduleName"); | |
| @@ -1,8 +1,13 | |||||
| 1 | { |
|
1 | { | |
| 2 |
"extends": "../tsconfig |
|
2 | "extends": "../tsconfig", | |
| 3 | "compilerOptions": { |
|
3 | "compilerOptions": { | |
| 4 | "types": [ |
|
4 | "types": [ | |
| 5 |
" |
|
5 | "requirejs" | |
|
|
6 | ], | |||
|
|
7 | "rootDir": "ts", | |||
|
|
8 | "rootDirs": [ | |||
|
|
9 | "ts", | |||
|
|
10 | "../typings/main" | |||
| 6 | ] |
|
11 | ] | |
| 7 | }, |
|
12 | }, | |
| 8 | "include": [ |
|
13 | "include": [ | |
| @@ -1,5 +1,5 | |||||
| 1 | { |
|
1 | { | |
| 2 |
"extends": "../tsconfig |
|
2 | "extends": "../tsconfig", | |
| 3 | "compilerOptions": { |
|
3 | "compilerOptions": { | |
| 4 | "types": [ |
|
4 | "types": [ | |
| 5 | "@types/node" |
|
5 | "@types/node" | |
| @@ -26,6 +26,13 import { Cancellation } from "../Cancell | |||||
| 26 |
|
26 | |||
| 27 | const trace = TraceSource.get("@implab/core/di/Configuration"); |
|
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 | async function mapAll(data: object | any[], map?: (v, k) => any): Promise<any> { |
|
36 | async function mapAll(data: object | any[], map?: (v, k) => any): Promise<any> { | |
| 30 | if (data instanceof Array) { |
|
37 | if (data instanceof Array) { | |
| 31 | return Promise.all(map ? data.map(map) : data); |
|
38 | return Promise.all(map ? data.map(map) : data); | |
| @@ -65,6 +72,25 export class Configuration { | |||||
| 65 | this._path = []; |
|
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 | async applyConfiguration(data: object, resolver?: Resolver, ct = Cancellation.none) { |
|
94 | async applyConfiguration(data: object, resolver?: Resolver, ct = Cancellation.none) { | |
| 69 | argumentNotNull(data, "data"); |
|
95 | argumentNotNull(data, "data"); | |
| 70 |
|
96 | |||
| @@ -1,5 +1,8 | |||||
| 1 | { |
|
1 | { | |
| 2 |
"extends": "../tsconfig |
|
2 | "extends": "../tsconfig", | |
|
|
3 | "compilerOptions": { | |||
|
|
4 | "rootDir": "ts" | |||
|
|
5 | }, | |||
| 3 | "include": [ |
|
6 | "include": [ | |
| 4 | "ts/**/*.ts" |
|
7 | "ts/**/*.ts" | |
| 5 | ] |
|
8 | ] | |
| @@ -1,6 +1,6 | |||||
| 1 | { |
|
1 | { | |
| 2 | "name": "${packageName}", |
|
2 | "name": "${packageName}", | |
| 3 |
"version": "${vers |
|
3 | "version": "${version}", | |
| 4 | "description": "${description}", |
|
4 | "description": "${description}", | |
| 5 | "main": "main.js", |
|
5 | "main": "main.js", | |
| 6 | "keywords": [ |
|
6 | "keywords": [ | |
| @@ -1,4 +1,8 | |||||
| 1 | //define(["./ActivatableTests", "./trace-test", "./TraceSourceTests", "./CancellationTests"]); |
|
1 | define([ | |
| 2 | //define(["./CancellationTests"]); |
|
2 | "./ActivatableTests", | |
| 3 | //define(["./ObservableTests"]); |
|
3 | "./trace-test", | |
| 4 | define(["./ContainerTests"]); No newline at end of file |
|
4 | "./TraceSourceTests", | |
|
|
5 | "./CancellationTests", | |||
|
|
6 | "./ObservableTests", | |||
|
|
7 | "./ContainerTests" | |||
|
|
8 | ]); No newline at end of file | |||
| @@ -2,18 +2,13 var requirejs = require('requirejs'); | |||||
| 2 |
|
2 | |||
| 3 | requirejs.config({ |
|
3 | requirejs.config({ | |
| 4 | baseUrl: '.', |
|
4 | baseUrl: '.', | |
| 5 | map: { |
|
|||
| 6 | "*": { |
|
|||
| 7 | "@implab/core": "core" |
|
|||
| 8 | } |
|
|||
| 9 | }, |
|
|||
| 10 | packages: [{ |
|
5 | packages: [{ | |
| 11 | name: "core", |
|
6 | name: "@implab/core", | |
| 12 | location: "build/dist" |
|
7 | location: "build/dist/amd" | |
| 13 | }, |
|
8 | }, | |
| 14 | { |
|
9 | { | |
| 15 | name: "test", |
|
10 | name: "test", | |
| 16 | location: "build/test" |
|
11 | location: "build/test/amd" | |
| 17 | }, |
|
12 | }, | |
| 18 | { |
|
13 | { | |
| 19 | name: "dojo", |
|
14 | name: "dojo", | |
| @@ -3,7 +3,7 define(["tape"], function(tape) { | |||||
| 3 | var sourceId = '73a633f3-eab8-49b0-8601-07cae710f234'; |
|
3 | var sourceId = '73a633f3-eab8-49b0-8601-07cae710f234'; | |
| 4 | var sourceId2 = '3ba9c7cd-ed77-437b-9a2f-1cbeb1226b5b'; |
|
4 | var sourceId2 = '3ba9c7cd-ed77-437b-9a2f-1cbeb1226b5b'; | |
| 5 | tape('Load TraceSource for the module', function(t) { |
|
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 | var TraceSource = TraceSource_1.TraceSource; |
|
7 | var TraceSource = TraceSource_1.TraceSource; | |
| 8 | t.equal(trace && trace.id, sourceId, "trace should be taken from the loader plugin parameter"); |
|
8 | t.equal(trace && trace.id, sourceId, "trace should be taken from the loader plugin parameter"); | |
| 9 |
|
9 | |||
| @@ -1,12 +1,13 | |||||
| 1 | { |
|
1 | { | |
|
|
2 | "extends": "../tsconfig", | |||
| 2 | "compilerOptions": { |
|
3 | "compilerOptions": { | |
| 3 |
" |
|
4 | "rootDir": "ts", | |
| 4 |
" |
|
5 | "baseUrl": ".", | |
| 5 | "sourceMap": true, |
|
6 | "paths": { | |
| 6 | "moduleResolution": "node", |
|
7 | "@implab/core/*": [ | |
| 7 | "lib": [ |
|
8 | "../../build/dist/amd/*" | |
| 8 | "es2015" |
|
|||
| 9 | ] |
|
9 | ] | |
|
|
10 | } | |||
| 10 | }, |
|
11 | }, | |
| 11 | "include" : [ |
|
12 | "include" : [ | |
| 12 | "ts/**/*.ts" |
|
13 | "ts/**/*.ts" | |
| @@ -1,10 +1,10 | |||||
| 1 | { |
|
1 | { | |
| 2 | "compilerOptions": { |
|
2 | "compilerOptions": { | |
| 3 | "target": "es3", |
|
3 | "target": "es3", | |
| 4 | "module": "amd", |
|
|||
| 5 | "sourceMap": true, |
|
4 | "sourceMap": true, | |
| 6 | "declaration": true, |
|
5 | "declaration": true, | |
| 7 | "moduleResolution": "node", |
|
6 | "moduleResolution": "node", | |
|
|
7 | "noEmitOnError": true, | |||
| 8 | "listFiles": true, |
|
8 | "listFiles": true, | |
| 9 | "lib": [ |
|
9 | "lib": [ | |
| 10 | "es5", |
|
10 | "es5", | |
| @@ -12,11 +12,7 | |||||
| 12 | "es2015.symbol", |
|
12 | "es2015.symbol", | |
| 13 | "dom" |
|
13 | "dom" | |
| 14 | ], |
|
14 | ], | |
| 15 | "rootDirs": [ |
|
|||
| 16 | "main/ts", |
|
|||
| 17 | "amd/ts", |
|
|||
| 18 | "cjs/ts" |
|
|||
| 19 | ], |
|
|||
| 20 | "types": [] |
|
15 | "types": [] | |
| 21 | } |
|
16 | }, | |
|
|
17 | "files": [] | |||
| 22 | } No newline at end of file |
|
18 | } | |
| 1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now
