Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
fe45a7d2
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,发现更多精彩内容 >>
提交
fe45a7d2
编写于
10月 02, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix remaining strict null errors in build scripts
上级
5862b416
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
29 addition
and
22 deletion
+29
-22
build/lib/compilation.js
build/lib/compilation.js
+2
-2
build/lib/compilation.ts
build/lib/compilation.ts
+2
-2
build/lib/electron.js
build/lib/electron.js
+2
-0
build/lib/extensions.js
build/lib/extensions.js
+2
-2
build/lib/extensions.ts
build/lib/extensions.ts
+4
-4
build/lib/optimize.js
build/lib/optimize.js
+4
-4
build/lib/optimize.ts
build/lib/optimize.ts
+4
-4
build/lib/reporter.js
build/lib/reporter.js
+1
-0
build/lib/reporter.ts
build/lib/reporter.ts
+1
-0
build/lib/treeshaking.ts
build/lib/treeshaking.ts
+2
-2
build/lib/typings/lazy.js.d.ts
build/lib/typings/lazy.js.d.ts
+5
-2
未找到文件。
build/lib/compilation.js
浏览文件 @
fe45a7d2
...
...
@@ -36,7 +36,7 @@ function createCompile(src, build, emitError) {
var
opts
=
_
.
clone
(
getTypeScriptCompilerOptions
(
src
));
opts
.
inlineSources
=
!!
build
;
opts
.
noFilesystemLookup
=
true
;
var
ts
=
tsb
.
create
(
opts
,
true
,
null
,
function
(
err
)
{
return
reporter
(
err
.
toString
());
});
var
ts
=
tsb
.
create
(
opts
,
true
,
undefined
,
function
(
err
)
{
return
reporter
(
err
.
toString
());
});
return
function
(
token
)
{
var
utf8Filter
=
util
.
filter
(
function
(
data
)
{
return
/
(\/
|
\\)
test
(\/
|
\\)
.*utf8/
.
test
(
data
.
path
);
});
var
tsFilter
=
util
.
filter
(
function
(
data
)
{
return
/
\.
ts$/
.
test
(
data
.
path
);
});
...
...
@@ -58,7 +58,7 @@ function createCompile(src, build, emitError) {
sourceRoot
:
opts
.
sourceRoot
}))
.
pipe
(
tsFilter
.
restore
)
.
pipe
(
reporter
.
end
(
emitError
));
.
pipe
(
reporter
.
end
(
!!
emitError
));
return
es
.
duplex
(
input
,
output
);
};
}
...
...
build/lib/compilation.ts
浏览文件 @
fe45a7d2
...
...
@@ -41,7 +41,7 @@ function createCompile(src: string, build: boolean, emitError?: boolean): (token
opts
.
inlineSources
=
!!
build
;
opts
.
noFilesystemLookup
=
true
;
const
ts
=
tsb
.
create
(
opts
,
true
,
null
,
err
=>
reporter
(
err
.
toString
()));
const
ts
=
tsb
.
create
(
opts
,
true
,
undefined
,
err
=>
reporter
(
err
.
toString
()));
return
function
(
token
?:
util
.
ICancellationToken
)
{
...
...
@@ -66,7 +66,7 @@ function createCompile(src: string, build: boolean, emitError?: boolean): (token
sourceRoot
:
opts
.
sourceRoot
}))
.
pipe
(
tsFilter
.
restore
)
.
pipe
(
reporter
.
end
(
emitError
));
.
pipe
(
reporter
.
end
(
!!
emitError
));
return
es
.
duplex
(
input
,
output
);
};
...
...
build/lib/electron.js
浏览文件 @
fe45a7d2
...
...
@@ -11,6 +11,7 @@ const root = path.dirname(path.dirname(__dirname));
function
getElectronVersion
()
{
const
yarnrc
=
fs
.
readFileSync
(
path
.
join
(
root
,
'
.yarnrc
'
),
'
utf8
'
);
// @ts-ignore
const
target
=
/^target "
(
.*
)
"$/m
.
exec
(
yarnrc
)[
1
];
return
target
;
...
...
@@ -19,6 +20,7 @@ function getElectronVersion() {
module
.
exports
.
getElectronVersion
=
getElectronVersion
;
// returns 0 if the right version of electron is in .build/electron
// @ts-ignore
if
(
require
.
main
===
module
)
{
const
version
=
getElectronVersion
();
const
versionFile
=
path
.
join
(
root
,
'
.build
'
,
'
electron
'
,
'
version
'
);
...
...
build/lib/extensions.js
浏览文件 @
fe45a7d2
...
...
@@ -211,8 +211,8 @@ function sequence(streamProviders) {
pop
();
return
result
;
}
function
packageExtensionsStream
(
opts
)
{
opts
=
opts
||
{};
function
packageExtensionsStream
(
opts
In
)
{
var
opts
=
optsIn
||
{};
var
localExtensionDescriptions
=
glob
.
sync
(
'
extensions/*/package.json
'
)
.
map
(
function
(
manifestPath
)
{
var
extensionPath
=
path
.
dirname
(
path
.
join
(
root
,
manifestPath
));
...
...
build/lib/extensions.ts
浏览文件 @
fe45a7d2
...
...
@@ -34,7 +34,7 @@ function fromLocal(extensionPath: string, sourceMappingURLBase?: string): Stream
}
}
function
fromLocalWebpack
(
extensionPath
:
string
,
sourceMappingURLBase
:
string
):
Stream
{
function
fromLocalWebpack
(
extensionPath
:
string
,
sourceMappingURLBase
:
string
|
undefined
):
Stream
{
let
result
=
es
.
through
();
let
packagedDependencies
:
string
[]
=
[];
...
...
@@ -249,7 +249,7 @@ function sequence(streamProviders: { (): Stream }[]): Stream {
if
(
streamProviders
.
length
===
0
)
{
result
.
emit
(
'
end
'
);
}
else
{
const
fn
=
streamProviders
.
shift
();
const
fn
=
streamProviders
.
shift
()
!
;
fn
()
.
on
(
'
end
'
,
function
()
{
setTimeout
(
pop
,
0
);
})
.
pipe
(
result
,
{
end
:
false
});
...
...
@@ -260,8 +260,8 @@ function sequence(streamProviders: { (): Stream }[]): Stream {
return
result
;
}
export
function
packageExtensionsStream
(
opts
?:
IPackageExtensionsOptions
):
NodeJS
.
ReadWriteStream
{
opts
=
opts
||
{};
export
function
packageExtensionsStream
(
opts
In
?:
IPackageExtensionsOptions
):
NodeJS
.
ReadWriteStream
{
const
opts
=
optsIn
||
{};
const
localExtensionDescriptions
=
(
<
string
[]
>
glob
.
sync
(
'
extensions/*/package.json
'
))
.
map
(
manifestPath
=>
{
...
...
build/lib/optimize.js
浏览文件 @
fe45a7d2
...
...
@@ -124,7 +124,7 @@ function optimizeTask(opts) {
var
resourcesStream
=
es
.
through
();
// this stream will contain the resources
var
bundleInfoStream
=
es
.
through
();
// this stream will contain bundleInfo.json
bundle
.
bundle
(
entryPoints
,
loaderConfig
,
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
||
!
result
)
{
return
bundlesStream
.
emit
(
'
error
'
,
JSON
.
stringify
(
err
));
}
toBundleStream
(
src
,
bundledFileHeader
,
result
.
files
).
pipe
(
bundlesStream
);
...
...
@@ -163,7 +163,7 @@ function optimizeTask(opts) {
var
result
=
es
.
merge
(
loader
(
src
,
bundledFileHeader
,
bundleLoader
),
bundlesStream
,
otherSourcesStream
,
resourcesStream
,
bundleInfoStream
);
return
result
.
pipe
(
sourcemaps
.
write
(
'
./
'
,
{
sourceRoot
:
null
,
sourceRoot
:
undefined
,
addComment
:
true
,
includeContent
:
true
}))
...
...
@@ -219,13 +219,13 @@ function uglifyWithCopyrights() {
return
es
.
duplex
(
input
,
output
);
}
function
minifyTask
(
src
,
sourceMapBaseUrl
)
{
var
sourceMappingURL
=
sourceMapBaseUrl
&&
(
function
(
f
)
{
return
sourceMapBaseUrl
+
"
/
"
+
f
.
relative
+
"
.map
"
;
})
;
var
sourceMappingURL
=
sourceMapBaseUrl
?
(
function
(
f
)
{
return
sourceMapBaseUrl
+
"
/
"
+
f
.
relative
+
"
.map
"
;
})
:
undefined
;
return
function
(
cb
)
{
var
jsFilter
=
filter
(
'
**/*.js
'
,
{
restore
:
true
});
var
cssFilter
=
filter
(
'
**/*.css
'
,
{
restore
:
true
});
pump
(
gulp
.
src
([
src
+
'
/**
'
,
'
!
'
+
src
+
'
/**/*.map
'
]),
jsFilter
,
sourcemaps
.
init
({
loadMaps
:
true
}),
uglifyWithCopyrights
(),
jsFilter
.
restore
,
cssFilter
,
minifyCSS
({
reduceIdents
:
false
}),
cssFilter
.
restore
,
sourcemaps
.
write
(
'
./
'
,
{
sourceMappingURL
:
sourceMappingURL
,
sourceRoot
:
null
,
sourceRoot
:
undefined
,
includeContent
:
true
,
addComment
:
true
}),
gulp
.
dest
(
src
+
'
-min
'
),
function
(
err
)
{
...
...
build/lib/optimize.ts
浏览文件 @
fe45a7d2
...
...
@@ -188,7 +188,7 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
const
bundleInfoStream
=
es
.
through
();
// this stream will contain bundleInfo.json
bundle
.
bundle
(
entryPoints
,
loaderConfig
,
function
(
err
,
result
)
{
if
(
err
)
{
return
bundlesStream
.
emit
(
'
error
'
,
JSON
.
stringify
(
err
));
}
if
(
err
||
!
result
)
{
return
bundlesStream
.
emit
(
'
error
'
,
JSON
.
stringify
(
err
));
}
toBundleStream
(
src
,
bundledFileHeader
,
result
.
files
).
pipe
(
bundlesStream
);
...
...
@@ -237,7 +237,7 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
return
result
.
pipe
(
sourcemaps
.
write
(
'
./
'
,
{
sourceRoot
:
null
,
sourceRoot
:
undefined
,
addComment
:
true
,
includeContent
:
true
}))
...
...
@@ -302,7 +302,7 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
}
export
function
minifyTask
(
src
:
string
,
sourceMapBaseUrl
?:
string
):
(
cb
:
any
)
=>
void
{
const
sourceMappingURL
=
sourceMapBaseUrl
&&
(
f
=>
`
${
sourceMapBaseUrl
}
/
${
f
.
relative
}
.map`
)
;
const
sourceMappingURL
=
sourceMapBaseUrl
?
((
f
:
any
)
=>
`
${
sourceMapBaseUrl
}
/
${
f
.
relative
}
.map`
)
:
undefined
;
return
cb
=>
{
const
jsFilter
=
filter
(
'
**/*.js
'
,
{
restore
:
true
});
...
...
@@ -319,7 +319,7 @@ export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) =>
cssFilter
.
restore
,
sourcemaps
.
write
(
'
./
'
,
{
sourceMappingURL
,
sourceRoot
:
null
,
sourceRoot
:
undefined
,
includeContent
:
true
,
addComment
:
true
}),
...
...
build/lib/reporter.js
浏览文件 @
fe45a7d2
...
...
@@ -45,6 +45,7 @@ function log() {
var
messages
=
errors
.
map
(
function
(
err
)
{
return
regex
.
exec
(
err
);
})
.
filter
(
function
(
match
)
{
return
!!
match
;
})
.
map
(
function
(
x
)
{
return
x
;
})
.
map
(
function
(
_a
)
{
var
path
=
_a
[
1
],
line
=
_a
[
2
],
column
=
_a
[
3
],
message
=
_a
[
4
];
return
({
path
:
path
,
line
:
parseInt
(
line
),
column
:
parseInt
(
column
),
message
:
message
});
...
...
build/lib/reporter.ts
浏览文件 @
fe45a7d2
...
...
@@ -55,6 +55,7 @@ function log(): void {
const
messages
=
errors
.
map
(
err
=>
regex
.
exec
(
err
))
.
filter
(
match
=>
!!
match
)
.
map
(
x
=>
x
as
string
[])
.
map
(([,
path
,
line
,
column
,
message
])
=>
({
path
,
line
:
parseInt
(
line
),
column
:
parseInt
(
column
),
message
}));
try
{
...
...
build/lib/treeshaking.ts
浏览文件 @
fe45a7d2
...
...
@@ -448,7 +448,7 @@ function markNodes(languageService: ts.LanguageService, options: ITreeShakingOpt
}
if
(
options
.
shakeLevel
===
ShakeLevel
.
ClassMembers
&&
(
ts
.
isClassDeclaration
(
declaration
)
||
ts
.
isInterfaceDeclaration
(
declaration
)))
{
enqueue_black
(
declaration
.
name
);
enqueue_black
(
declaration
.
name
!
);
for
(
let
j
=
0
;
j
<
declaration
.
members
.
length
;
j
++
)
{
const
member
=
declaration
.
members
[
j
];
...
...
@@ -635,7 +635,7 @@ function generateResult(languageService: ts.LanguageService, shakeLevel: ShakeLe
/**
* Returns the node's symbol and the `import` node (if the symbol resolved from a different module)
*/
function
getRealNodeSymbol
(
checker
:
ts
.
TypeChecker
,
node
:
ts
.
Node
):
[
ts
.
Symbol
,
ts
.
Declaration
]
{
function
getRealNodeSymbol
(
checker
:
ts
.
TypeChecker
,
node
:
ts
.
Node
):
[
ts
.
Symbol
|
null
,
ts
.
Declaration
|
null
]
{
/**
* Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 }
*/
...
...
build/lib/typings/lazy.js.d.ts
浏览文件 @
fe45a7d2
...
...
@@ -18,7 +18,7 @@ declare module Lazy {
function
on
<
T
>
(
eventType
:
string
):
Sequence
<
T
>
;
function
readFile
(
path
:
string
):
StringLikeSequence
;
function
makeHttpRequest
(
path
:
string
):
StringLikeSequence
;
interface
StrictLazy
{
(
value
:
string
):
StringLikeSequence
;
<
T
>
(
value
:
T
[]):
ArrayLikeSequence
<
T
>
;
...
...
@@ -87,7 +87,7 @@ declare module Lazy {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface
Iterator
<
T
>
{
new
(
sequence
:
Sequence
<
T
>
):
Iterator
<
T
>
;
new
(
sequence
:
Sequence
<
T
>
):
Iterator
<
T
>
;
current
():
T
;
moveNext
():
boolean
;
}
...
...
@@ -159,6 +159,9 @@ declare module Lazy {
map
<
U
>
(
mapFn
:
MapCallback
<
T
,
U
[]
>
):
ArraySequence
<
U
>
;
map
<
U
>
(
mapFn
:
MapCallback
<
T
,
U
>
):
Sequence
<
U
>
;
// TODO: vscode addition to workaround strict null errors
flatten
():
Sequence
<
any
>
;
max
(
valueFn
?:
NumberCallback
<
T
>
):
T
;
min
(
valueFn
?:
NumberCallback
<
T
>
):
T
;
none
(
valueFn
?:
TestCallback
<
T
>
):
boolean
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录