Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
a921ad03
I
incubator-echarts
项目概览
x649585723
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a921ad03
编写于
11月 05, 2017
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
print bundle version to aid debug.
上级
1f1e6895
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
76 addition
and
3 deletion
+76
-3
build/build.js
build/build.js
+2
-1
build/config.js
build/config.js
+10
-2
test/lib/config.js
test/lib/config.js
+64
-0
未找到文件。
build/build.js
浏览文件 @
a921ad03
...
@@ -95,7 +95,8 @@ function run() {
...
@@ -95,7 +95,8 @@ function run() {
input
:
commander
.
input
,
input
:
commander
.
input
,
output
:
commander
.
output
,
output
:
commander
.
output
,
sourcemap
:
commander
.
sourcemap
,
sourcemap
:
commander
.
sourcemap
,
format
:
commander
.
format
||
'
umd
'
format
:
commander
.
format
||
'
umd
'
,
addBundleVersion
:
isWatch
};
};
validateIO
(
opt
.
input
,
opt
.
output
);
validateIO
(
opt
.
input
,
opt
.
output
);
...
...
build/config.js
浏览文件 @
a921ad03
...
@@ -12,8 +12,9 @@ function getPathBasedOnECharts(path) {
...
@@ -12,8 +12,9 @@ function getPathBasedOnECharts(path) {
/**
/**
* @param {boolean} [min=false]
* @param {boolean} [min=false]
* @param {string} [lang=null] null/undefined/'' or 'en' or 'fi' or a file path
* @param {string} [lang=null] null/undefined/'' or 'en' or 'fi' or a file path
* @param {boolean} [addBundleVersion=false]
*/
*/
function
getPlugins
(
min
,
lang
)
{
function
getPlugins
(
min
,
lang
,
addBundleVersion
)
{
let
plugins
=
[
let
plugins
=
[
ecDevPlugin
()
ecDevPlugin
()
];
];
...
@@ -26,6 +27,12 @@ function getPlugins(min, lang) {
...
@@ -26,6 +27,12 @@ function getPlugins(min, lang) {
nodeResolvePlugin
()
nodeResolvePlugin
()
);
);
addBundleVersion
&&
plugins
.
push
({
outro
:
function
()
{
return
'
exports.bundleVersion = "
'
+
(
+
new
Date
())
+
'
";
'
;
}
});
min
&&
plugins
.
push
(
uglifyPlugin
({
min
&&
plugins
.
push
(
uglifyPlugin
({
compress
:
{
compress
:
{
// Eliminate __DEV__ code.
// Eliminate __DEV__ code.
...
@@ -51,6 +58,7 @@ function getPlugins(min, lang) {
...
@@ -51,6 +58,7 @@ function getPlugins(min, lang) {
* @param {string} [opt.output=undefined] If set, `opt.input` is required too, and `opt.type` is ignored.
* @param {string} [opt.output=undefined] If set, `opt.input` is required too, and `opt.type` is ignored.
* @param {boolean} [opt.sourcemap] If set, `opt.input` is required too, and `opt.type` is ignored.
* @param {boolean} [opt.sourcemap] If set, `opt.input` is required too, and `opt.type` is ignored.
* @param {string} [opt.format='umd'] If set, `opt.input` is required too, and `opt.type` is ignored.
* @param {string} [opt.format='umd'] If set, `opt.input` is required too, and `opt.type` is ignored.
* @param {boolean} [opt.addBundleVersion=false] Only for debug in watch, prompt that the two build is different.
*/
*/
exports
.
createECharts
=
function
(
opt
)
{
exports
.
createECharts
=
function
(
opt
)
{
opt
=
opt
||
{};
opt
=
opt
||
{};
...
@@ -78,7 +86,7 @@ exports.createECharts = function (opt) {
...
@@ -78,7 +86,7 @@ exports.createECharts = function (opt) {
}
}
return
{
return
{
plugins
:
getPlugins
(
opt
.
min
,
opt
.
lang
),
plugins
:
getPlugins
(
opt
.
min
,
opt
.
lang
,
opt
.
addBundleVersion
),
input
:
input
,
input
:
input
,
legacy
:
true
,
// Support IE8-
legacy
:
true
,
// Support IE8-
output
:
{
output
:
{
...
...
test/lib/config.js
浏览文件 @
a921ad03
...
@@ -45,4 +45,68 @@
...
@@ -45,4 +45,68 @@
window
.
__ECHARTS__DEFAULT__RENDERER__
=
matchResult
[
1
];
window
.
__ECHARTS__DEFAULT__RENDERER__
=
matchResult
[
1
];
}
}
// Mount bundle version print.
if
(
typeof
require
!==
'
undefined
'
)
{
var
originalRequire
=
require
;
window
.
require
=
function
(
deps
,
cb
)
{
var
newCb
=
function
()
{
if
(
deps
&&
deps
instanceof
Array
)
{
printBundleVersion
(
deps
,
[].
slice
.
call
(
arguments
));
}
cb
&&
cb
.
apply
(
this
,
arguments
);
};
return
originalRequire
.
call
(
this
,
deps
,
newCb
);
};
}
function
printBundleVersion
(
bundleIds
,
bundles
)
{
var
content
=
[];
for
(
var
i
=
0
;
i
<
bundleIds
.
length
;
i
++
)
{
var
bundle
=
bundles
[
i
];
var
bundleVersion
=
bundle
&&
bundle
.
bundleVersion
;
if
(
bundleVersion
)
{
var
date
=
new
Date
(
+
bundleVersion
);
// Check whether timestamp.
if
(
!
isNaN
(
+
date
))
{
bundleVersion
=
date
.
getHours
()
+
'
:
'
+
date
.
getMinutes
()
+
'
:
'
+
'
<span style="color:yellow">
'
+
date
.
getSeconds
()
+
'
.
'
+
date
.
getMilliseconds
()
+
'
</span>
'
;
}
else
{
bundleVersion
=
encodeHTML
(
bundleVersion
);
}
content
.
push
(
encodeHTML
(
bundleIds
[
i
])
+
'
.js:
'
+
bundleVersion
);
}
}
var
domId
=
'
ec-test-bundle-version
'
;
var
dom
=
document
.
getElementById
(
domId
);
if
(
!
dom
)
{
dom
=
document
.
createElement
(
'
div
'
);
dom
.
setAttribute
(
'
id
'
,
domId
);
dom
.
style
.
cssText
=
[
'
background: rgb(52,56,64)
'
,
'
color: rgb(215,215,215)
'
,
'
position: fixed
'
,
'
right: 0
'
,
'
top: 0
'
,
'
font-size: 10px
'
,
'
padding: 1px 2px 1px 2px
'
,
'
border-bottom-left-radius: 3px
'
].
join
(
'
;
'
);
document
.
body
.
appendChild
(
dom
);
}
dom
.
innerHTML
=
content
.
join
(
''
);
}
function
encodeHTML
(
source
)
{
return
String
(
source
)
.
replace
(
/&/g
,
'
&
'
)
.
replace
(
/</g
,
'
<
'
)
.
replace
(
/>/g
,
'
>
'
)
.
replace
(
/"/g
,
'
"
'
)
.
replace
(
/'/g
,
'
'
'
);
}
})();
})();
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录