forked from canjs/canjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
103 lines (92 loc) · 2.12 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
var stealTools = require("steal-tools");
var globalJS = require("steal-tools/lib/build/helpers/global").js;
var ignoreModuleNamesStartingWith = [
"jquery",
"kefir",
'ms-signalr-client',
'prop-types',
'fbjs',
'create-react-class'
];
var ignoreModuleNames = [
'react'
];
var baseNormalize = globalJS.normalize();
var ignoreModules = [function(name){
var foundMatch = ignoreModuleNamesStartingWith.some(function(matchName){
return name.indexOf(matchName) === 0;
})
if(foundMatch) {
return true;
}
foundMatch = ignoreModuleNames.some(function(matchName){
return name.indexOf(matchName+"@") === 0;
});
if(foundMatch) {
return true;
}
return false;
}];
var exportsMap = {
"jquery": "jQuery",
"can-namespace": "can",
"kefir": "Kefir",
"validate.js": "validate",
"react": "React"
};
var globalConfig = {
format: "global",
useNormalizedDependencies: true,
normalize: function(depName, depLoad, curName, curLoad, loader){
return baseNormalize.call(this, depName, depLoad, curName, curLoad, loader, true);
},
ignore: ignoreModules,
exports: exportsMap,
removeDevelopmentCode: false
};
stealTools.export({
steal: {
config: __dirname + "/package.json!npm",
main: "can/can"
},
options: {
useNormalizedDependencies: false,
verbose: true
},
outputs: {
"global core": Object.assign({
modules: ["can/core"],
dest: globalJS.dest(__dirname+"/dist/global/core.js")
}, globalConfig),
"global ecosystem": Object.assign({
modules: ["can/can"],
dest: globalJS.dest(__dirname+"/dist/global/ecosystem.js")
}, globalConfig),
"+bundled-es core": {
modules: ["can/core"],
addProcessShim: true,
dest: __dirname + "/core.mjs"
},
"+bundled-es core minified": {
modules: ["can/core"],
addProcessShim: true,
minify: true,
dest: __dirname + "/core.min.mjs"
},
"+bundled-es all": {
modules: ["can/can"],
addProcessShim: true,
dest: __dirname + "/ecosystem.mjs"
},
"+bundled-es all minified": {
modules: ["can/can"],
addProcessShim: true,
minify: true,
dest: __dirname + "/ecosystem.min.mjs"
}
}
}).catch(function(e){
setTimeout(function(){
throw e;
},1);
});