Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d8e13dc7
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,发现更多精彩内容 >>
提交
d8e13dc7
编写于
7月 19, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a compile-editor-build task
上级
03103a4f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
71 addition
and
44 deletion
+71
-44
.gitignore
.gitignore
+1
-0
build/gulpfile.editor.js
build/gulpfile.editor.js
+5
-0
build/lib/compilation.js
build/lib/compilation.js
+22
-18
build/lib/compilation.ts
build/lib/compilation.ts
+23
-19
build/lib/standalone.js
build/lib/standalone.js
+8
-2
build/lib/standalone.ts
build/lib/standalone.ts
+10
-3
gulpfile.js
gulpfile.js
+2
-2
未找到文件。
.gitignore
浏览文件 @
d8e13dc7
...
...
@@ -7,6 +7,7 @@ out/
out-build/
out-editor/
out-editor-src/
out-editor-build/
out-editor-esm/
out-editor-min/
out-monaco-editor-core/
...
...
build/gulpfile.editor.js
浏览文件 @
d8e13dc7
...
...
@@ -12,6 +12,7 @@ const File = require('vinyl');
const
i18n
=
require
(
'
./lib/i18n
'
);
const
standalone
=
require
(
'
./lib/standalone
'
);
const
cp
=
require
(
'
child_process
'
);
const
compilation
=
require
(
'
./lib/compilation
'
);
var
root
=
path
.
dirname
(
__dirname
);
var
sha1
=
util
.
getVersion
(
root
);
...
...
@@ -115,6 +116,10 @@ gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-client-build'],
languages
:
languages
}));
// Full compile, including nls and inline sources in sourcemaps, for build
gulp
.
task
(
'
clean-editor-build
'
,
util
.
rimraf
(
'
out-editor-build
'
));
gulp
.
task
(
'
compile-editor-build
'
,
[
'
clean-editor-build
'
,
'
extract-editor-src
'
],
compilation
.
compileTask
(
'
out-editor-src
'
,
'
out-editor-build
'
,
true
));
gulp
.
task
(
'
clean-minified-editor
'
,
util
.
rimraf
(
'
out-editor-min
'
));
gulp
.
task
(
'
minify-editor
'
,
[
'
clean-minified-editor
'
,
'
optimize-editor
'
],
common
.
minifyTask
(
'
out-editor
'
));
...
...
build/lib/compilation.js
浏览文件 @
d8e13dc7
...
...
@@ -18,18 +18,21 @@ var _ = require("underscore");
var
monacodts
=
require
(
"
../monaco/api
"
);
var
fs
=
require
(
"
fs
"
);
var
reporter
=
reporter_1
.
createReporter
();
var
rootDir
=
path
.
join
(
__dirname
,
'
../../src
'
);
var
options
=
require
(
'
../../src/tsconfig.json
'
).
compilerOptions
;
options
.
verbose
=
false
;
options
.
sourceMap
=
true
;
if
(
process
.
env
[
'
VSCODE_NO_SOURCEMAP
'
])
{
// To be used by developers in a hurry
options
.
sourceMap
=
false
;
function
getTypeScriptCompilerOptions
(
src
)
{
var
rootDir
=
path
.
join
(
__dirname
,
"
../../
"
+
src
);
var
options
=
require
(
"
../../
"
+
src
+
"
/tsconfig.json
"
).
compilerOptions
;
options
.
verbose
=
false
;
options
.
sourceMap
=
true
;
if
(
process
.
env
[
'
VSCODE_NO_SOURCEMAP
'
])
{
// To be used by developers in a hurry
options
.
sourceMap
=
false
;
}
options
.
rootDir
=
rootDir
;
options
.
sourceRoot
=
util
.
toFileUri
(
rootDir
);
options
.
newLine
=
/
\r\n
/
.
test
(
fs
.
readFileSync
(
__filename
,
'
utf8
'
))
?
'
CRLF
'
:
'
LF
'
;
return
options
;
}
options
.
rootDir
=
rootDir
;
options
.
sourceRoot
=
util
.
toFileUri
(
rootDir
);
options
.
newLine
=
/
\r\n
/
.
test
(
fs
.
readFileSync
(
__filename
,
'
utf8
'
))
?
'
CRLF
'
:
'
LF
'
;
function
createCompile
(
build
,
emitError
)
{
var
opts
=
_
.
clone
(
options
);
function
createCompile
(
src
,
build
,
emitError
)
{
var
opts
=
_
.
clone
(
getTypeScriptCompilerOptions
(
src
));
opts
.
inlineSources
=
!!
build
;
opts
.
noFilesystemLookup
=
true
;
var
ts
=
tsb
.
create
(
opts
,
null
,
null
,
function
(
err
)
{
return
reporter
(
err
.
toString
());
});
...
...
@@ -51,31 +54,31 @@ function createCompile(build, emitError) {
.
pipe
(
sourcemaps
.
write
(
'
.
'
,
{
addComment
:
false
,
includeContent
:
!!
build
,
sourceRoot
:
opt
ion
s
.
sourceRoot
sourceRoot
:
opts
.
sourceRoot
}))
.
pipe
(
tsFilter
.
restore
)
.
pipe
(
reporter
.
end
(
emitError
));
return
es
.
duplex
(
input
,
output
);
};
}
function
compileTask
(
out
,
build
)
{
function
compileTask
(
src
,
out
,
build
)
{
return
function
()
{
var
compile
=
createCompile
(
build
,
true
);
var
src
=
es
.
merge
(
gulp
.
src
(
'
src/**
'
,
{
base
:
'
src
'
}),
gulp
.
src
(
'
node_modules/typescript/lib/lib.d.ts
'
));
var
compile
=
createCompile
(
src
,
build
,
true
);
var
src
Pipe
=
es
.
merge
(
gulp
.
src
(
src
+
"
/**
"
,
{
base
:
""
+
src
}),
gulp
.
src
(
'
node_modules/typescript/lib/lib.d.ts
'
));
// Do not write .d.ts files to disk, as they are not needed there.
var
dtsFilter
=
util
.
filter
(
function
(
data
)
{
return
!
/
\.
d
\.
ts$/
.
test
(
data
.
path
);
});
return
src
return
src
Pipe
.
pipe
(
compile
())
.
pipe
(
dtsFilter
)
.
pipe
(
gulp
.
dest
(
out
))
.
pipe
(
dtsFilter
.
restore
)
.
pipe
(
monacodtsTask
(
out
,
false
));
.
pipe
(
src
!==
'
src
'
?
es
.
through
()
:
monacodtsTask
(
out
,
false
));
};
}
exports
.
compileTask
=
compileTask
;
function
watchTask
(
out
,
build
)
{
return
function
()
{
var
compile
=
createCompile
(
build
);
var
compile
=
createCompile
(
'
src
'
,
build
);
var
src
=
es
.
merge
(
gulp
.
src
(
'
src/**
'
,
{
base
:
'
src
'
}),
gulp
.
src
(
'
node_modules/typescript/lib/lib.d.ts
'
));
var
watchSrc
=
watch
(
'
src/**
'
,
{
base
:
'
src
'
});
// Do not write .d.ts files to disk, as they are not needed there.
...
...
@@ -122,6 +125,7 @@ function monacodtsTask(out, isWatch) {
fs
.
writeFileSync
(
result
.
filePath
,
result
.
content
);
}
else
{
fs
.
writeFileSync
(
result
.
filePath
,
result
.
content
);
resultStream
.
emit
(
'
error
'
,
'
monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.
'
);
}
}
...
...
build/lib/compilation.ts
浏览文件 @
d8e13dc7
...
...
@@ -21,19 +21,22 @@ import * as fs from 'fs';
const
reporter
=
createReporter
();
const
rootDir
=
path
.
join
(
__dirname
,
'
../../src
'
);
const
options
=
require
(
'
../../src/tsconfig.json
'
).
compilerOptions
;
options
.
verbose
=
false
;
options
.
sourceMap
=
true
;
if
(
process
.
env
[
'
VSCODE_NO_SOURCEMAP
'
])
{
// To be used by developers in a hurry
options
.
sourceMap
=
false
;
function
getTypeScriptCompilerOptions
(
src
:
string
)
{
const
rootDir
=
path
.
join
(
__dirname
,
`../../
${
src
}
`
);
const
options
=
require
(
`../../
${
src
}
/tsconfig.json`
).
compilerOptions
;
options
.
verbose
=
false
;
options
.
sourceMap
=
true
;
if
(
process
.
env
[
'
VSCODE_NO_SOURCEMAP
'
])
{
// To be used by developers in a hurry
options
.
sourceMap
=
false
;
}
options
.
rootDir
=
rootDir
;
options
.
sourceRoot
=
util
.
toFileUri
(
rootDir
);
options
.
newLine
=
/
\r\n
/
.
test
(
fs
.
readFileSync
(
__filename
,
'
utf8
'
))
?
'
CRLF
'
:
'
LF
'
;
return
options
;
}
options
.
rootDir
=
rootDir
;
options
.
sourceRoot
=
util
.
toFileUri
(
rootDir
);
options
.
newLine
=
/
\r\n
/
.
test
(
fs
.
readFileSync
(
__filename
,
'
utf8
'
))
?
'
CRLF
'
:
'
LF
'
;
function
createCompile
(
build
:
boolean
,
emitError
?:
boolean
):
(
token
?:
util
.
ICancellationToken
)
=>
NodeJS
.
ReadWriteStream
{
const
opts
=
_
.
clone
(
options
);
function
createCompile
(
src
:
string
,
build
:
boolean
,
emitError
?:
boolean
):
(
token
?:
util
.
ICancellationToken
)
=>
NodeJS
.
ReadWriteStream
{
const
opts
=
_
.
clone
(
getTypeScriptCompilerOptions
(
src
)
);
opts
.
inlineSources
=
!!
build
;
opts
.
noFilesystemLookup
=
true
;
...
...
@@ -59,7 +62,7 @@ function createCompile(build: boolean, emitError?: boolean): (token?: util.ICanc
.
pipe
(
sourcemaps
.
write
(
'
.
'
,
{
addComment
:
false
,
includeContent
:
!!
build
,
sourceRoot
:
opt
ion
s
.
sourceRoot
sourceRoot
:
opts
.
sourceRoot
}))
.
pipe
(
tsFilter
.
restore
)
.
pipe
(
reporter
.
end
(
emitError
));
...
...
@@ -68,32 +71,32 @@ function createCompile(build: boolean, emitError?: boolean): (token?: util.ICanc
};
}
export
function
compileTask
(
out
:
string
,
build
:
boolean
):
()
=>
NodeJS
.
ReadWriteStream
{
export
function
compileTask
(
src
:
string
,
out
:
string
,
build
:
boolean
):
()
=>
NodeJS
.
ReadWriteStream
{
return
function
()
{
const
compile
=
createCompile
(
build
,
true
);
const
compile
=
createCompile
(
src
,
build
,
true
);
const
src
=
es
.
merge
(
gulp
.
src
(
'
src/**
'
,
{
base
:
'
src
'
}),
const
src
Pipe
=
es
.
merge
(
gulp
.
src
(
`
${
src
}
/**`
,
{
base
:
`
${
src
}
`
}),
gulp
.
src
(
'
node_modules/typescript/lib/lib.d.ts
'
),
);
// Do not write .d.ts files to disk, as they are not needed there.
const
dtsFilter
=
util
.
filter
(
data
=>
!
/
\.
d
\.
ts$/
.
test
(
data
.
path
));
return
src
return
src
Pipe
.
pipe
(
compile
())
.
pipe
(
dtsFilter
)
.
pipe
(
gulp
.
dest
(
out
))
.
pipe
(
dtsFilter
.
restore
)
.
pipe
(
monacodtsTask
(
out
,
false
));
.
pipe
(
src
!==
'
src
'
?
es
.
through
()
:
monacodtsTask
(
out
,
false
));
};
}
export
function
watchTask
(
out
:
string
,
build
:
boolean
):
()
=>
NodeJS
.
ReadWriteStream
{
return
function
()
{
const
compile
=
createCompile
(
build
);
const
compile
=
createCompile
(
'
src
'
,
build
);
const
src
=
es
.
merge
(
gulp
.
src
(
'
src/**
'
,
{
base
:
'
src
'
}),
...
...
@@ -150,6 +153,7 @@ function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
if
(
isWatch
)
{
fs
.
writeFileSync
(
result
.
filePath
,
result
.
content
);
}
else
{
fs
.
writeFileSync
(
result
.
filePath
,
result
.
content
);
resultStream
.
emit
(
'
error
'
,
'
monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.
'
);
}
}
...
...
build/lib/standalone.js
浏览文件 @
d8e13dc7
...
...
@@ -42,7 +42,7 @@ function extractEditor(options) {
copied
[
fileName
]
=
true
;
var
srcPath
=
path
.
join
(
options
.
sourcesRoot
,
fileName
);
var
dstPath
=
path
.
join
(
options
.
destRoot
,
fileName
);
fs
.
writeFileSync
(
dstPath
,
fs
.
readFileSync
(
srcPath
));
writeFile
(
dstPath
,
fs
.
readFileSync
(
srcPath
));
};
var
writeOutputFile
=
function
(
fileName
,
contents
)
{
writeFile
(
path
.
join
(
options
.
destRoot
,
fileName
),
contents
);
...
...
@@ -74,8 +74,10 @@ function extractEditor(options) {
}
}
}
var
tsConfig
=
JSON
.
parse
(
fs
.
readFileSync
(
path
.
join
(
options
.
sourcesRoot
,
'
tsconfig.json
'
)).
toString
());
tsConfig
.
compilerOptions
.
noUnusedLocals
=
false
;
writeOutputFile
(
'
tsconfig.json
'
,
JSON
.
stringify
(
tsConfig
,
null
,
'
\t
'
));
[
'
tsconfig.json
'
,
'
vs/css.build.js
'
,
'
vs/css.d.ts
'
,
'
vs/css.js
'
,
...
...
@@ -85,6 +87,10 @@ function extractEditor(options) {
'
vs/nls.d.ts
'
,
'
vs/nls.js
'
,
'
vs/nls.mock.ts
'
,
'
typings/lib.ie11_safe_es6.d.ts
'
,
'
typings/thenable.d.ts
'
,
'
typings/es6-promise.d.ts
'
,
'
typings/require.d.ts
'
,
].
forEach
(
copyFile
);
}
exports
.
extractEditor
=
extractEditor
;
...
...
build/lib/standalone.ts
浏览文件 @
d8e13dc7
...
...
@@ -14,7 +14,7 @@ const OUT_EDITOR = path.join(REPO_ROOT, 'out-editor');
let
dirCache
:
{
[
dir
:
string
]:
boolean
;
}
=
{};
function
writeFile
(
filePath
:
string
,
contents
:
string
):
void
{
function
writeFile
(
filePath
:
string
,
contents
:
Buffer
|
string
):
void
{
function
ensureDirs
(
dirPath
:
string
):
void
{
if
(
dirCache
[
dirPath
])
{
return
;
...
...
@@ -46,7 +46,7 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
copied
[
fileName
]
=
true
;
const
srcPath
=
path
.
join
(
options
.
sourcesRoot
,
fileName
);
const
dstPath
=
path
.
join
(
options
.
destRoot
,
fileName
);
fs
.
writeFileSync
(
dstPath
,
fs
.
readFileSync
(
srcPath
));
writeFile
(
dstPath
,
fs
.
readFileSync
(
srcPath
));
};
const
writeOutputFile
=
(
fileName
:
string
,
contents
:
string
)
=>
{
writeFile
(
path
.
join
(
options
.
destRoot
,
fileName
),
contents
);
...
...
@@ -80,8 +80,11 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
}
}
const
tsConfig
=
JSON
.
parse
(
fs
.
readFileSync
(
path
.
join
(
options
.
sourcesRoot
,
'
tsconfig.json
'
)).
toString
());
tsConfig
.
compilerOptions
.
noUnusedLocals
=
false
;
writeOutputFile
(
'
tsconfig.json
'
,
JSON
.
stringify
(
tsConfig
,
null
,
'
\t
'
));
[
'
tsconfig.json
'
,
'
vs/css.build.js
'
,
'
vs/css.d.ts
'
,
'
vs/css.js
'
,
...
...
@@ -91,6 +94,10 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
'
vs/nls.d.ts
'
,
'
vs/nls.js
'
,
'
vs/nls.mock.ts
'
,
'
typings/lib.ie11_safe_es6.d.ts
'
,
'
typings/thenable.d.ts
'
,
'
typings/es6-promise.d.ts
'
,
'
typings/require.d.ts
'
,
].
forEach
(
copyFile
);
}
...
...
gulpfile.js
浏览文件 @
d8e13dc7
...
...
@@ -15,12 +15,12 @@ const compilation = require('./build/lib/compilation');
// Fast compile for development time
gulp
.
task
(
'
clean-client
'
,
util
.
rimraf
(
'
out
'
));
gulp
.
task
(
'
compile-client
'
,
[
'
clean-client
'
],
compilation
.
compileTask
(
'
out
'
,
false
));
gulp
.
task
(
'
compile-client
'
,
[
'
clean-client
'
],
compilation
.
compileTask
(
'
src
'
,
'
out
'
,
false
));
gulp
.
task
(
'
watch-client
'
,
[
'
clean-client
'
],
compilation
.
watchTask
(
'
out
'
,
false
));
// Full compile, including nls and inline sources in sourcemaps, for build
gulp
.
task
(
'
clean-client-build
'
,
util
.
rimraf
(
'
out-build
'
));
gulp
.
task
(
'
compile-client-build
'
,
[
'
clean-client-build
'
],
compilation
.
compileTask
(
'
out-build
'
,
true
));
gulp
.
task
(
'
compile-client-build
'
,
[
'
clean-client-build
'
],
compilation
.
compileTask
(
'
src
'
,
'
out-build
'
,
true
));
gulp
.
task
(
'
watch-client-build
'
,
[
'
clean-client-build
'
],
compilation
.
watchTask
(
'
out-build
'
,
true
));
// Default
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录