Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7d38cdcb
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d38cdcb
编写于
2月 08, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Render more task names
上级
0a61bab1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
73 addition
and
42 deletion
+73
-42
build/gulpfile.extensions.js
build/gulpfile.extensions.js
+9
-5
build/lib/compilation.js
build/lib/compilation.js
+6
-2
build/lib/compilation.ts
build/lib/compilation.ts
+6
-2
build/lib/util.js
build/lib/util.js
+25
-16
build/lib/util.ts
build/lib/util.ts
+27
-17
未找到文件。
build/gulpfile.extensions.js
浏览文件 @
7d38cdcb
...
...
@@ -100,18 +100,20 @@ const tasks = compilations.map(function (tsconfigFile) {
const
srcOpts
=
{
cwd
:
path
.
dirname
(
__dirname
),
base
:
srcBase
};
const
cleanTask
=
()
=>
util
.
p
rimraf
(
out
);
const
cleanTask
=
util
.
rimraf
(
out
);
const
compileTask
=
util
.
task
.
series
(
cleanTask
,
()
=>
{
const
compileTask
_
=
()
=>
{
const
pipeline
=
createPipeline
(
false
,
true
);
const
input
=
gulp
.
src
(
src
,
srcOpts
);
return
input
.
pipe
(
pipeline
())
.
pipe
(
gulp
.
dest
(
out
));
});
};
compileTask_
.
displayName
=
`compile-extension-
${
name
}
`
;
const
compileTask
=
util
.
task
.
series
(
cleanTask
,
compileTask_
);
const
watchTask
=
util
.
task
.
series
(
cleanTask
,
()
=>
{
const
watchTask
_
=
()
=>
{
const
pipeline
=
createPipeline
(
false
);
const
input
=
gulp
.
src
(
src
,
srcOpts
);
const
watchInput
=
watcher
(
src
,
srcOpts
);
...
...
@@ -119,7 +121,9 @@ const tasks = compilations.map(function (tsconfigFile) {
return
watchInput
.
pipe
(
util
.
incremental
(
pipeline
,
input
))
.
pipe
(
gulp
.
dest
(
out
));
});
};
watchTask_
.
displayName
=
`watch-extension-
${
name
}
`
;
const
watchTask
=
util
.
task
.
series
(
cleanTask
,
watchTask_
);
const
compileBuildTask
=
util
.
task
.
series
(
cleanTask
,
()
=>
{
const
pipeline
=
createPipeline
(
true
,
true
);
...
...
build/lib/compilation.js
浏览文件 @
7d38cdcb
...
...
@@ -78,7 +78,7 @@ const typesDts = [
'
!node_modules/@types/uglify-js/**/*
'
,
];
function
compileTask
(
src
,
out
,
build
)
{
return
function
()
{
const
result
=
function
()
{
const
compile
=
createCompile
(
src
,
build
,
true
);
const
srcPipe
=
es
.
merge
(
gulp
.
src
(
`
${
src
}
/**`
,
{
base
:
`
${
src
}
`
}),
gulp
.
src
(
typesDts
));
let
generator
=
new
MonacoGenerator
(
false
);
...
...
@@ -90,10 +90,12 @@ function compileTask(src, out, build) {
.
pipe
(
compile
())
.
pipe
(
gulp
.
dest
(
out
));
};
result
.
displayName
=
`compile-task-
${
out
}${
build
?
'
-build
'
:
''
}
`
;
return
result
;
}
exports
.
compileTask
=
compileTask
;
function
watchTask
(
out
,
build
)
{
return
function
()
{
const
result
=
function
()
{
const
compile
=
createCompile
(
'
src
'
,
build
);
const
src
=
es
.
merge
(
gulp
.
src
(
'
src/**
'
,
{
base
:
'
src
'
}),
gulp
.
src
(
typesDts
));
const
watchSrc
=
watch
(
'
src/**
'
,
{
base
:
'
src
'
});
...
...
@@ -104,6 +106,8 @@ function watchTask(out, build) {
.
pipe
(
util
.
incremental
(
compile
,
src
,
true
))
.
pipe
(
gulp
.
dest
(
out
));
};
result
.
displayName
=
`watch-task-
${
out
}${
build
?
'
-build
'
:
''
}
`
;
return
result
;
}
exports
.
watchTask
=
watchTask
;
const
REPO_SRC_FOLDER
=
path
.
join
(
__dirname
,
'
../../src
'
);
...
...
build/lib/compilation.ts
浏览文件 @
7d38cdcb
...
...
@@ -90,7 +90,7 @@ const typesDts = [
export
function
compileTask
(
src
:
string
,
out
:
string
,
build
:
boolean
):
()
=>
NodeJS
.
ReadWriteStream
{
return
function
()
{
const
result
=
function
()
{
const
compile
=
createCompile
(
src
,
build
,
true
);
const
srcPipe
=
es
.
merge
(
...
...
@@ -108,11 +108,13 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod
.
pipe
(
compile
())
.
pipe
(
gulp
.
dest
(
out
));
};
result
.
displayName
=
`compile-task-
${
out
}${
build
?
'
-build
'
:
''
}
`
;
return
result
;
}
export
function
watchTask
(
out
:
string
,
build
:
boolean
):
()
=>
NodeJS
.
ReadWriteStream
{
return
function
()
{
const
result
=
function
()
{
const
compile
=
createCompile
(
'
src
'
,
build
);
const
src
=
es
.
merge
(
...
...
@@ -129,6 +131,8 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt
.
pipe
(
util
.
incremental
(
compile
,
src
,
true
))
.
pipe
(
gulp
.
dest
(
out
));
};
result
.
displayName
=
`watch-task-
${
out
}${
build
?
'
-build
'
:
''
}
`
;
return
result
;
}
const
REPO_SRC_FOLDER
=
path
.
join
(
__dirname
,
'
../../src
'
);
...
...
build/lib/util.js
浏览文件 @
7d38cdcb
...
...
@@ -14,6 +14,8 @@ const fs = require("fs");
const
_rimraf
=
require
(
"
rimraf
"
);
const
git
=
require
(
"
./git
"
);
const
VinylFile
=
require
(
"
vinyl
"
);
const
fancyLog
=
require
(
"
fancy-log
"
);
const
ansiColors
=
require
(
"
ansi-colors
"
);
const
NoCancellationToken
=
{
isCancellationRequested
:
()
=>
false
};
function
incremental
(
streamProvider
,
initial
,
supportsCancellation
)
{
const
input
=
es
.
through
();
...
...
@@ -180,24 +182,10 @@ function rimraf(dir) {
return
cb
(
err
);
});
};
return
cb
=>
retry
(
cb
);
retry
.
displayName
=
`clean-
${
path
.
basename
(
dir
)}
`
;
return
retry
;
}
exports
.
rimraf
=
rimraf
;
/**
* Like rimraf (with 5 retries), but with a promise instead of a callback.
*/
function
primraf
(
dir
)
{
const
fn
=
rimraf
(
dir
);
return
new
Promise
((
resolve
,
reject
)
=>
{
fn
((
err
)
=>
{
if
(
err
)
{
return
reject
(
err
);
}
resolve
();
});
});
}
exports
.
primraf
=
primraf
;
var
task
;
(
function
(
task_1
)
{
function
_isPromise
(
p
)
{
...
...
@@ -206,7 +194,28 @@ var task;
}
return
false
;
}
function
_renderTime
(
time
)
{
if
(
time
<
1000
)
{
return
`
${
time
.
toFixed
(
2
)}
ms`
;
}
let
seconds
=
time
/
1000
;
if
(
seconds
<
60
)
{
return
`
${
seconds
.
toFixed
(
1
)}
s`
;
}
let
minutes
=
Math
.
floor
(
seconds
/
60
);
seconds
-=
minutes
*
60
;
return
`
${
minutes
}
m and
${
seconds
}
s`
;
}
async
function
_execute
(
task
)
{
const
name
=
task
.
displayName
||
task
.
name
||
`<anonymous>`
;
fancyLog
(
'
Starting
'
,
ansiColors
.
cyan
(
name
),
'
...
'
);
const
startTime
=
process
.
hrtime
();
await
_doExecute
(
task
);
const
elapsedArr
=
process
.
hrtime
(
startTime
);
const
elapsedNanoseconds
=
(
elapsedArr
[
0
]
*
1
e9
+
elapsedArr
[
1
]);
fancyLog
(
`Finished`
,
ansiColors
.
cyan
(
name
),
'
after
'
,
ansiColors
.
green
(
_renderTime
(
elapsedNanoseconds
/
1
e6
)));
}
async
function
_doExecute
(
task
)
{
// Always invoke as if it were a callback task
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
task
.
length
===
1
)
{
...
...
build/lib/util.ts
浏览文件 @
7d38cdcb
...
...
@@ -17,6 +17,8 @@ import * as git from './git';
import
*
as
VinylFile
from
'
vinyl
'
;
import
{
ThroughStream
}
from
'
through
'
;
import
*
as
sm
from
'
source-map
'
;
import
*
as
fancyLog
from
'
fancy-log
'
;
import
*
as
ansiColors
from
'
ansi-colors
'
;
export
interface
ICancellationToken
{
isCancellationRequested
():
boolean
;
...
...
@@ -233,23 +235,8 @@ export function rimraf(dir: string): (cb: any) => void {
return
cb
(
err
);
});
};
return
cb
=>
retry
(
cb
);
}
/**
* Like rimraf (with 5 retries), but with a promise instead of a callback.
*/
export
function
primraf
(
dir
:
string
):
Promise
<
void
>
{
const
fn
=
rimraf
(
dir
);
return
new
Promise
((
resolve
,
reject
)
=>
{
fn
((
err
:
any
)
=>
{
if
(
err
)
{
return
reject
(
err
);
}
resolve
();
});
});
retry
.
displayName
=
`clean-
${
path
.
basename
(
dir
)}
`
;
return
retry
;
}
export
type
PromiseTask
=
()
=>
Promise
<
void
>
;
...
...
@@ -266,7 +253,30 @@ export namespace task {
return
false
;
}
function
_renderTime
(
time
:
number
):
string
{
if
(
time
<
1000
)
{
return
`
${
time
.
toFixed
(
2
)}
ms`
;
}
let
seconds
=
time
/
1000
;
if
(
seconds
<
60
)
{
return
`
${
seconds
.
toFixed
(
1
)}
s`
;
}
let
minutes
=
Math
.
floor
(
seconds
/
60
);
seconds
-=
minutes
*
60
;
return
`
${
minutes
}
m and
${
seconds
}
s`
;
}
async
function
_execute
(
task
:
Task
):
Promise
<
void
>
{
const
name
=
(
<
any
>
task
).
displayName
||
task
.
name
||
`<anonymous>`
;
fancyLog
(
'
Starting
'
,
ansiColors
.
cyan
(
name
),
'
...
'
);
const
startTime
=
process
.
hrtime
();
await
_doExecute
(
task
);
const
elapsedArr
=
process
.
hrtime
(
startTime
);
const
elapsedNanoseconds
=
(
elapsedArr
[
0
]
*
1
e9
+
elapsedArr
[
1
]);
fancyLog
(
`Finished`
,
ansiColors
.
cyan
(
name
),
'
after
'
,
ansiColors
.
green
(
_renderTime
(
elapsedNanoseconds
/
1
e6
)));
}
async
function
_doExecute
(
task
:
Task
):
Promise
<
void
>
{
// Always invoke as if it were a callback task
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
task
.
length
===
1
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录