Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
4afae7fd
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4afae7fd
编写于
7月 18, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
es6ify build scripts
上级
a8074f7e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
86 addition
and
105 deletion
+86
-105
.eslintrc
.eslintrc
+2
-1
build/lib/reporter.js
build/lib/reporter.js
+7
-11
build/lib/util.js
build/lib/util.js
+77
-93
未找到文件。
.eslintrc
浏览文件 @
4afae7fd
...
...
@@ -4,7 +4,8 @@
"es6": true
},
"rules": {
"no-console": 0
"no-console": 0,
"no-cond-assign": 0
},
"extends": "eslint:recommended"
}
\ No newline at end of file
build/lib/reporter.js
浏览文件 @
4afae7fd
...
...
@@ -27,23 +27,23 @@ function onEnd() {
return
;
}
var
errors
=
_
.
flatten
(
allErrors
);
const
errors
=
_
.
flatten
(
allErrors
);
errors
.
map
(
err
=>
util
.
log
(
`
${
util
.
colors
.
red
(
'
Error
'
)
}
:
${
err
}
`
));
util
.
log
(
`Finished
${
util
.
colors
.
green
(
'
compilation
'
)
}
with
${
errors
.
length
}
errors after
${
util
.
colors
.
magenta
((
new
Date
().
getTime
()
-
startTime
)
+
'
ms
'
)
}
`
);
}
module
.
exports
=
function
()
{
var
errors
=
[];
module
.
exports
=
()
=>
{
const
errors
=
[];
allErrors
.
push
(
errors
);
var
result
=
function
(
err
)
{
errors
.
push
(
err
);
};
const
result
=
err
=>
errors
.
push
(
err
);
result
.
hasErrors
=
()
=>
errors
.
length
>
0
;
result
.
end
=
function
(
emitError
)
{
result
.
end
=
emitError
=>
{
errors
.
length
=
0
;
onStart
();
return
es
.
through
(
null
,
function
()
{
onEnd
();
...
...
@@ -55,9 +55,5 @@ module.exports = function () {
});
};
result
.
hasErrors
=
function
()
{
return
errors
.
length
>
0
;
}
return
result
;
};
\ No newline at end of file
build/lib/util.js
浏览文件 @
4afae7fd
...
...
@@ -3,46 +3,39 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var
es
=
require
(
'
event-stream
'
);
var
debounce
=
require
(
'
debounce
'
);
var
filter
=
require
(
'
gulp-filter
'
);
var
azure
=
require
(
'
gulp-azure-storage
'
);
var
rename
=
require
(
'
gulp-rename
'
);
var
vzip
=
require
(
'
gulp-vinyl-zip
'
);
var
util
=
require
(
'
gulp-util
'
);
var
_
=
require
(
'
underscore
'
);
var
path
=
require
(
'
path
'
);
var
fs
=
require
(
'
fs
'
);
var
rimraf
=
require
(
'
rimraf
'
);
var
git
=
require
(
'
./git
'
);
var
NoCancellationToken
=
{
isCancellationRequested
:
function
()
{
return
false
;
}
};
exports
.
incremental
=
function
(
streamProvider
,
initial
,
supportsCancellation
)
{
var
state
=
'
idle
'
;
var
input
=
es
.
through
();
var
output
=
es
.
through
();
var
buffer
=
Object
.
create
(
null
);
var
token
=
!
supportsCancellation
?
null
:
{
isCancellationRequested
:
function
()
{
// console.log('isCancellationRequested', Object.keys(buffer).length, new Date());
return
Object
.
keys
(
buffer
).
length
>
0
;
}
};
var
run
=
function
(
input
,
isCancellable
)
{
'
use strict
'
;
const
es
=
require
(
'
event-stream
'
);
const
debounce
=
require
(
'
debounce
'
);
const
filter
=
require
(
'
gulp-filter
'
);
const
azure
=
require
(
'
gulp-azure-storage
'
);
const
rename
=
require
(
'
gulp-rename
'
);
const
vzip
=
require
(
'
gulp-vinyl-zip
'
);
const
util
=
require
(
'
gulp-util
'
);
const
_
=
require
(
'
underscore
'
);
const
path
=
require
(
'
path
'
);
const
fs
=
require
(
'
fs
'
);
const
rimraf
=
require
(
'
rimraf
'
);
const
git
=
require
(
'
./git
'
);
const
NoCancellationToken
=
{
isCancellationRequested
:
()
=>
false
};
exports
.
incremental
=
(
streamProvider
,
initial
,
supportsCancellation
)
=>
{
const
input
=
es
.
through
();
const
output
=
es
.
through
();
let
state
=
'
idle
'
;
let
buffer
=
Object
.
create
(
null
);
const
token
=
!
supportsCancellation
?
null
:
{
isCancellationRequested
:
()
=>
Object
.
keys
(
buffer
).
length
>
0
};
const
run
=
(
input
,
isCancellable
)
=>
{
state
=
'
running
'
;
var
stream
=
!
supportsCancellation
?
streamProvider
()
:
streamProvider
(
isCancellable
?
token
:
NoCancellationToken
);
const
stream
=
!
supportsCancellation
?
streamProvider
()
:
streamProvider
(
isCancellable
?
token
:
NoCancellationToken
);
input
.
pipe
(
stream
)
.
pipe
(
es
.
through
(
null
,
function
()
{
.
pipe
(
es
.
through
(
null
,
()
=>
{
state
=
'
idle
'
;
eventuallyRun
();
}))
...
...
@@ -53,22 +46,19 @@ exports.incremental = function (streamProvider, initial, supportsCancellation) {
run
(
initial
,
false
);
}
var
eventuallyRun
=
debounce
(
function
()
{
var
paths
=
Object
.
keys
(
buffer
);
const
eventuallyRun
=
debounce
(()
=>
{
const
paths
=
Object
.
keys
(
buffer
);
if
(
paths
.
length
===
0
)
{
return
;
}
var
data
=
paths
.
map
(
function
(
path
)
{
return
buffer
[
path
];
});
const
data
=
paths
.
map
(
path
=>
buffer
[
path
]);
buffer
=
Object
.
create
(
null
);
run
(
es
.
readArray
(
data
),
true
);
},
500
);
input
.
on
(
'
data
'
,
f
unction
(
f
)
{
input
.
on
(
'
data
'
,
f
=>
{
buffer
[
f
.
path
]
=
f
;
if
(
state
===
'
idle
'
)
{
...
...
@@ -79,12 +69,12 @@ exports.incremental = function (streamProvider, initial, supportsCancellation) {
return
es
.
duplex
(
input
,
output
);
};
exports
.
fixWin32DirectoryPermissions
=
function
()
{
exports
.
fixWin32DirectoryPermissions
=
()
=>
{
if
(
!
/win32/
.
test
(
process
.
platform
))
{
return
es
.
through
();
}
return
es
.
mapSync
(
f
unction
(
f
)
{
return
es
.
mapSync
(
f
=>
{
if
(
f
.
stat
&&
f
.
stat
.
isDirectory
&&
f
.
stat
.
isDirectory
())
{
f
.
stat
.
mode
=
16877
;
}
...
...
@@ -93,8 +83,8 @@ exports.fixWin32DirectoryPermissions = function () {
});
};
exports
.
setExecutableBit
=
function
(
pattern
)
{
var
setBit
=
es
.
mapSync
(
f
unction
(
f
)
{
exports
.
setExecutableBit
=
pattern
=>
{
var
setBit
=
es
.
mapSync
(
f
=>
{
f
.
stat
.
mode
=
/* 100755 */
33261
;
return
f
;
});
...
...
@@ -113,30 +103,30 @@ exports.setExecutableBit = function (pattern) {
return
es
.
duplex
(
input
,
output
);
};
exports
.
handleAzureJson
=
function
(
env
)
{
var
input
=
es
.
through
();
var
azureJsonFilter
=
filter
(
'
**/*.azure.json
'
,
{
restore
:
true
});
exports
.
handleAzureJson
=
env
=>
{
const
input
=
es
.
through
();
const
azureJsonFilter
=
filter
(
'
**/*.azure.json
'
,
{
restore
:
true
});
var
allOpts
=
[];
var
result
=
es
.
through
();
const
allOpts
=
[];
const
result
=
es
.
through
();
var
output
=
input
const
output
=
input
.
pipe
(
azureJsonFilter
)
.
pipe
(
es
.
through
(
f
unction
(
f
)
{
.
pipe
(
es
.
through
(
f
=>
{
util
.
log
(
'
Downloading binaries from Azure:
'
,
util
.
colors
.
yellow
(
f
.
relative
),
'
...
'
);
var
opts
=
JSON
.
parse
(
f
.
contents
.
toString
());
const
opts
=
JSON
.
parse
(
f
.
contents
.
toString
());
opts
.
prefix
=
_
.
template
(
opts
.
zip
||
opts
.
prefix
)(
env
);
opts
.
output
=
path
.
join
(
path
.
dirname
(
f
.
relative
),
opts
.
output
);
allOpts
.
push
(
opts
);
},
function
()
{
var
streams
=
allOpts
.
map
(
function
(
opts
)
{
var
result
=
azure
.
download
(
_
.
extend
(
opts
,
{
buffer
:
true
,
quiet
:
true
}));
const
streams
=
allOpts
.
map
(
opts
=>
{
let
result
=
azure
.
download
(
_
.
extend
(
opts
,
{
buffer
:
true
,
quiet
:
true
}));
if
(
opts
.
zip
)
{
result
=
result
.
pipe
(
vzip
.
src
());
}
return
result
.
pipe
(
rename
(
function
(
p
)
{
return
result
.
pipe
(
rename
(
p
=>
{
p
.
dirname
=
path
.
join
(
opts
.
output
,
p
.
dirname
);
}));
});
...
...
@@ -154,8 +144,8 @@ exports.handleAzureJson = function (env) {
return
es
.
duplex
(
input
,
es
.
merge
(
output
,
result
));
};
exports
.
toFileUri
=
f
unction
(
filePath
)
{
var
match
=
filePath
.
match
(
/^
([
a-z
])\:(
.*
)
$/i
);
exports
.
toFileUri
=
f
ilePath
=>
{
const
match
=
filePath
.
match
(
/^
([
a-z
])\:(
.*
)
$/i
);
if
(
match
)
{
filePath
=
'
/
'
+
match
[
1
].
toUpperCase
()
+
'
:
'
+
match
[
2
];
...
...
@@ -164,38 +154,39 @@ exports.toFileUri = function (filePath) {
return
'
file://
'
+
filePath
.
replace
(
/
\\
/g
,
'
/
'
);
};
exports
.
rebase
=
function
(
base
,
append
)
{
return
es
.
mapSync
(
f
unction
(
f
)
{
exports
.
rebase
=
(
base
,
append
)
=>
{
return
es
.
mapSync
(
f
=>
{
if
(
append
)
{
f
.
base
=
path
.
join
(
f
.
base
,
base
);
}
else
{
f
.
base
=
base
;
}
return
f
;
});
};
exports
.
skipDirectories
=
function
()
{
return
es
.
mapSync
(
f
unction
(
f
)
{
exports
.
skipDirectories
=
()
=>
{
return
es
.
mapSync
(
f
=>
{
if
(
!
f
.
isDirectory
())
{
return
f
;
}
});
};
exports
.
cleanNodeModule
=
function
(
name
,
excludes
,
includes
)
{
var
glob
=
function
(
path
)
{
return
'
**/node_modules/
'
+
name
+
(
path
?
'
/
'
+
path
:
''
);
}
;
var
negate
=
function
(
str
)
{
return
'
!
'
+
str
;
}
;
exports
.
cleanNodeModule
=
(
name
,
excludes
,
includes
)
=>
{
const
glob
=
path
=>
'
**/node_modules/
'
+
name
+
(
path
?
'
/
'
+
path
:
''
)
;
const
negate
=
str
=>
'
!
'
+
str
;
var
allFilter
=
filter
(
glob
(
'
**
'
),
{
restore
:
true
});
var
globs
=
[
glob
(
'
**
'
)].
concat
(
excludes
.
map
(
_
.
compose
(
negate
,
glob
)));
const
allFilter
=
filter
(
glob
(
'
**
'
),
{
restore
:
true
});
const
globs
=
[
glob
(
'
**
'
)].
concat
(
excludes
.
map
(
_
.
compose
(
negate
,
glob
)));
var
input
=
es
.
through
();
var
nodeModuleInput
=
input
.
pipe
(
allFilter
);
var
output
=
nodeModuleInput
.
pipe
(
filter
(
globs
));
const
input
=
es
.
through
();
const
nodeModuleInput
=
input
.
pipe
(
allFilter
);
let
output
=
nodeModuleInput
.
pipe
(
filter
(
globs
));
if
(
includes
)
{
var
includeGlobs
=
includes
.
map
(
glob
);
const
includeGlobs
=
includes
.
map
(
glob
);
output
=
es
.
merge
(
output
,
nodeModuleInput
.
pipe
(
filter
(
includeGlobs
)));
}
...
...
@@ -203,11 +194,11 @@ exports.cleanNodeModule = function (name, excludes, includes) {
return
es
.
duplex
(
input
,
output
);
};
exports
.
loadSourcemaps
=
function
()
{
var
input
=
es
.
through
();
exports
.
loadSourcemaps
=
()
=>
{
const
input
=
es
.
through
();
var
output
=
input
.
pipe
(
es
.
map
(
function
(
f
,
cb
)
{
const
output
=
input
.
pipe
(
es
.
map
(
(
f
,
cb
)
=>
{
if
(
f
.
sourceMap
)
{
return
cb
(
null
,
f
);
}
...
...
@@ -216,11 +207,10 @@ exports.loadSourcemaps = function () {
return
cb
(
new
Error
(
'
empty file
'
));
}
var
contents
=
f
.
contents
.
toString
(
'
utf8
'
);
const
contents
=
f
.
contents
.
toString
(
'
utf8
'
);
var
reg
=
/
\/\/
# sourceMappingURL=
(
.*
)
$/g
;
var
lastMatch
=
null
;
var
match
=
null
;
const
reg
=
/
\/\/
# sourceMappingURL=
(
.*
)
$/g
;
let
lastMatch
=
null
,
match
=
null
;
while
(
match
=
reg
.
exec
(
contents
))
{
lastMatch
=
match
;
...
...
@@ -240,7 +230,7 @@ exports.loadSourcemaps = function () {
f
.
contents
=
new
Buffer
(
contents
.
replace
(
/
\/\/
# sourceMappingURL=
(
.*
)
$/g
,
''
),
'
utf8
'
);
fs
.
readFile
(
path
.
join
(
path
.
dirname
(
f
.
path
),
lastMatch
[
1
]),
'
utf8
'
,
function
(
err
,
contents
)
{
fs
.
readFile
(
path
.
join
(
path
.
dirname
(
f
.
path
),
lastMatch
[
1
]),
'
utf8
'
,
(
err
,
contents
)
=>
{
if
(
err
)
{
return
cb
(
err
);
}
f
.
sourceMap
=
JSON
.
parse
(
contents
);
...
...
@@ -251,16 +241,10 @@ exports.loadSourcemaps = function () {
return
es
.
duplex
(
input
,
output
);
};
exports
.
rimraf
=
function
(
dir
)
{
return
function
(
cb
)
{
rimraf
(
dir
,
{
maxBusyTries
:
1
},
cb
);
};
};
exports
.
rimraf
=
dir
=>
cb
=>
rimraf
(
dir
,
{
maxBusyTries
:
1
},
cb
);
exports
.
getVersion
=
function
(
root
)
{
var
version
=
process
.
env
[
'
BUILD_SOURCEVERSION
'
];
exports
.
getVersion
=
root
=>
{
let
version
=
process
.
env
[
'
BUILD_SOURCEVERSION
'
];
if
(
!
version
||
!
/^
[
0-9a-f
]{40}
$/i
.
test
(
version
))
{
version
=
git
.
getVersion
(
root
);
...
...
@@ -269,9 +253,9 @@ exports.getVersion = function (root) {
return
version
;
};
exports
.
rebase
=
function
(
count
)
{
return
rename
(
f
unction
(
f
)
{
var
parts
=
f
.
dirname
.
split
(
/
[\/\\]
/
);
exports
.
rebase
=
count
=>
{
return
rename
(
f
=>
{
const
parts
=
f
.
dirname
.
split
(
/
[\/\\]
/
);
f
.
dirname
=
parts
.
slice
(
count
).
join
(
path
.
sep
);
});
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录