13
13
* See the License for the specific language governing permissions and
14
14
* limitations under the License.
15
15
*/
16
-
17
16
/*
18
17
* Dojo build profile for building the loader
19
18
*/
20
19
const nodeRequire = require . rawConfig && require . rawConfig . loaderPatch . nodeRequire || require ;
21
20
const path = nodeRequire ( "path" ) ;
22
21
const fs = nodeRequire ( "fs" ) ;
23
- var profile = ( ( ) => {
24
- var profilePath , dojoPath ;
25
- process . argv . forEach ( ( arg , i ) => {
26
- if ( arg === '--profile' ) {
27
- profilePath = process . argv [ i + 1 ] ;
28
- } else if ( arg === '--dojoPath' ) {
29
- dojoPath = process . argv [ i + 1 ] ;
30
- }
31
- } ) ;
32
- if ( ! profilePath ) {
33
- throw new Error ( "--profile command line option not specified" ) ;
34
- }
35
- if ( ! dojoPath ) {
36
- throw new Error ( "--dojoPath command line option not specified" ) ;
22
+
23
+ var profilePath , dojoPath ;
24
+ process . argv . forEach ( ( arg , i ) => {
25
+ if ( arg === '--profile' ) {
26
+ profilePath = process . argv [ i + 1 ] ;
27
+ } else if ( arg === '--dojoPath' ) {
28
+ dojoPath = process . argv [ i + 1 ] ;
37
29
}
30
+ } ) ;
31
+ if ( ! profilePath ) {
32
+ throw new Error ( "--profile command line option not specified" ) ;
33
+ }
34
+ if ( ! dojoPath ) {
35
+ throw new Error ( "--dojoPath command line option not specified" ) ;
36
+ }
37
+
38
+ const version = nodeRequire ( path . resolve ( dojoPath , "../" , "./package.json" ) ) . version ;
39
+ const versionParts = version . split ( "." ) ;
40
+ const majorVersion = parseInt ( versionParts [ 0 ] ) , minorVersion = parseInt ( versionParts [ 1 ] ) , patchVersion = parseInt ( versionParts [ 2 ] ) ;
41
+ if ( majorVersion !== 1 ) {
42
+ throw new Error ( "Unsupported Dojo Version" ) ;
43
+ }
44
+ const hasInjectApiFix = /* True if the version of Dojo has https://github.com/dojo/dojo/pull/266 */
45
+ minorVersion > 12 ||
46
+ minorVersion === 12 && patchVersion >= 3 ||
47
+ minorVersion === 11 && patchVersion >= 5 ||
48
+ minorVersion === 10 && patchVersion >= 9 ;
49
+
50
+ var profile = ( ( ) => {
38
51
const profileDir = path . resolve ( profilePath ) ;
39
52
const dojoDir = path . resolve ( dojoPath , ".." ) ;
40
53
var util = "../dojo-util" ;
@@ -61,7 +74,7 @@ var profile = (() => {
61
74
62
75
staticHasFeatures :{
63
76
'dojo-config-api' : 1 ,
64
- 'dojo-inject-api' : 1 ,
77
+ 'dojo-inject-api' : hasInjectApiFix ? 0 : 1 ,
65
78
'dojo-built' : 1 ,
66
79
'config-dojo-loader-catches' : 0 ,
67
80
'config-tlmSiblingOfDojo' : 0 ,
0 commit comments