Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
72ef20b5
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,发现更多精彩内容 >>
提交
72ef20b5
编写于
9月 18, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve monaco-editor-core bundling
上级
fa48339a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
121 addition
and
22 deletion
+121
-22
build/gulpfile.common.js
build/gulpfile.common.js
+19
-8
build/gulpfile.editor.js
build/gulpfile.editor.js
+6
-5
build/lib/bundle.js
build/lib/bundle.js
+34
-3
build/lib/bundle.ts
build/lib/bundle.ts
+57
-3
build/monaco/package.json
build/monaco/package.json
+1
-1
src/vs/base/worker/workerMain.ts
src/vs/base/worker/workerMain.ts
+3
-1
src/vs/loader.js
src/vs/loader.js
+1
-1
未找到文件。
build/gulpfile.common.js
浏览文件 @
72ef20b5
...
...
@@ -39,13 +39,21 @@ exports.loaderConfig = function (emptyPaths) {
const
IS_OUR_COPYRIGHT_REGEXP
=
/Copyright
\(
C
\)
Microsoft Corporation/i
;
function
loader
(
bundledFileHeader
)
{
function
loader
(
bundledFileHeader
,
bundleLoader
)
{
let
sources
=
[
'
out-build/vs/loader.js
'
];
if
(
bundleLoader
)
{
sources
=
sources
.
concat
([
'
out-build/vs/css.js
'
,
'
out-build/vs/nls.js
'
]);
}
let
isFirst
=
true
;
return
gulp
.
src
([
'
out-build/vs/loader.js
'
,
'
out-build/vs/css.js
'
,
'
out-build/vs/nls.js
'
],
{
base
:
'
out-build
'
})
return
(
gulp
.
src
(
sources
,
{
base
:
'
out-build
'
})
.
pipe
(
es
.
through
(
function
(
data
)
{
if
(
isFirst
)
{
isFirst
=
false
;
...
...
@@ -64,7 +72,8 @@ function loader(bundledFileHeader) {
.
pipe
(
es
.
mapSync
(
function
(
f
)
{
f
.
sourceMap
.
sourceRoot
=
util
.
toFileUri
(
path
.
join
(
path
.
dirname
(
__dirname
),
'
src
'
));
return
f
;
}));
}))
);
}
function
toConcatStream
(
bundledFileHeader
,
sources
,
dest
)
{
...
...
@@ -116,6 +125,7 @@ function toBundleStream(bundledFileHeader, bundles) {
* - otherSources (for non-AMD files that should get Copyright treatment)
* - resources (svg, etc.)
* - loaderConfig
* - bundleLoader (boolean - true by default - append css and nls to loader)
* - header (basically the Copyright treatment)
* - bundleInfo (boolean - emit bundleInfo.json file)
* - out (out folder name)
...
...
@@ -126,6 +136,7 @@ exports.optimizeTask = function(opts) {
const
resources
=
opts
.
resources
;
const
loaderConfig
=
opts
.
loaderConfig
;
const
bundledFileHeader
=
opts
.
header
;
const
bundleLoader
=
(
typeof
opts
.
bundleLoader
===
'
undefined
'
?
true
:
opts
.
bundleLoader
);
const
out
=
opts
.
out
;
return
function
()
{
...
...
@@ -174,7 +185,7 @@ exports.optimizeTask = function(opts) {
}));
const
result
=
es
.
merge
(
loader
(
bundledFileHeader
),
loader
(
bundledFileHeader
,
bundleLoader
),
bundlesStream
,
otherSourcesStream
,
resourcesStream
,
...
...
build/gulpfile.editor.js
浏览文件 @
72ef20b5
...
...
@@ -22,12 +22,15 @@ var editorEntryPoints = [
{
name
:
'
vs/editor/editor.main
'
,
include
:
[],
exclude
:
[
'
vs/css
'
,
'
vs/nls
'
]
exclude
:
[],
prepend
:
[
'
vs/css.js
'
,
'
vs/nls.js
'
],
},
{
name
:
'
vs/base/common/worker/simpleWorker
'
,
include
:
[
'
vs/editor/common/services/editorSimpleWorker
'
],
exclude
:
[
'
vs/css
'
,
'
vs/nls
'
]
prepend
:
[
'
vs/loader.js
'
],
append
:
[
'
vs/base/worker/workerMain
'
],
dest
:
'
vs/base/worker/workerMain.js
'
},
]
...
...
@@ -37,14 +40,11 @@ var editorResources = [
'
!out-build/vs/base/browser/ui/toolbar/**/*
'
,
'
!out-build/vs/base/browser/ui/octiconLabel/**/*
'
,
'
!out-build/vs/editor/contrib/defineKeybinding/**/*
'
,
'
out-build/vs/base/worker/workerMain.{js,js.map}
'
,
'
!out-build/vs/workbench/**
'
,
'
!**/test/**
'
];
var
editorOtherSources
=
[
'
out-build/vs/css.js
'
,
'
out-build/vs/nls.js
'
];
var
BUNDLED_FILE_HEADER
=
[
...
...
@@ -75,6 +75,7 @@ gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-build'], common
otherSources
:
editorOtherSources
,
resources
:
editorResources
,
loaderConfig
:
editorLoaderConfig
(),
bundleLoader
:
false
,
header
:
BUNDLED_FILE_HEADER
,
bundleInfo
:
true
,
out
:
'
out-editor
'
...
...
build/lib/bundle.js
浏览文件 @
72ef20b5
...
...
@@ -31,6 +31,24 @@ function bundle(entryPoints, config, callback) {
var
loader
=
loaderModule
.
exports
;
config
.
isBuild
=
true
;
loader
.
config
(
config
);
loader
([
'
require
'
],
function
(
localRequire
)
{
var
resolvePath
=
function
(
path
)
{
var
r
=
localRequire
.
toUrl
(
path
);
if
(
!
/
\.
js/
.
test
(
r
))
{
return
r
+
'
.js
'
;
}
return
r
;
};
for
(
var
moduleId
in
entryPointsMap
)
{
var
entryPoint
=
entryPointsMap
[
moduleId
];
if
(
entryPoint
.
append
)
{
entryPoint
.
append
=
entryPoint
.
append
.
map
(
resolvePath
);
}
if
(
entryPoint
.
prepend
)
{
entryPoint
.
prepend
=
entryPoint
.
prepend
.
map
(
resolvePath
);
}
}
});
loader
(
Object
.
keys
(
allMentionedModulesMap
),
function
()
{
var
modules
=
loader
.
getBuildInfo
();
var
partialResult
=
emitEntryPoints
(
modules
,
entryPointsMap
);
...
...
@@ -74,7 +92,7 @@ function emitEntryPoints(modules, entryPoints) {
return
allDependencies
[
module
];
});
bundleData
.
bundles
[
moduleToBundle
]
=
includedModules
;
var
res
=
emitEntryPoint
(
modulesMap
,
modulesGraph
,
moduleToBundle
,
includedModules
);
var
res
=
emitEntryPoint
(
modulesMap
,
modulesGraph
,
moduleToBundle
,
includedModules
,
info
.
prepend
,
info
.
append
,
info
.
dest
);
result
=
result
.
concat
(
res
.
files
);
for
(
var
pluginName
in
res
.
usedPlugins
)
{
usedPlugins
[
pluginName
]
=
usedPlugins
[
pluginName
]
||
res
.
usedPlugins
[
pluginName
];
...
...
@@ -235,10 +253,13 @@ function removeDuplicateTSBoilerplate(destFiles) {
});
return
destFiles
;
}
function
emitEntryPoint
(
modulesMap
,
deps
,
entryPoint
,
includedModules
)
{
function
emitEntryPoint
(
modulesMap
,
deps
,
entryPoint
,
includedModules
,
prepend
,
append
,
dest
)
{
if
(
!
dest
)
{
dest
=
entryPoint
+
'
.js
'
;
}
var
mainResult
=
{
sources
:
[],
dest
:
entryPoint
+
'
.js
'
dest
:
dest
},
results
=
[
mainResult
];
var
usedPlugins
=
{};
var
getLoaderPlugin
=
function
(
pluginName
)
{
...
...
@@ -286,6 +307,16 @@ function emitEntryPoint(modulesMap, deps, entryPoint, includedModules) {
plugin
.
writeFile
(
pluginName
,
entryPoint
,
req
,
write
,
{});
}
});
var
toIFile
=
function
(
path
)
{
var
contents
=
readFileAndRemoveBOM
(
path
);
return
{
path
:
path
,
contents
:
contents
};
};
var
toPrepend
=
(
prepend
||
[]).
map
(
toIFile
);
var
toAppend
=
(
append
||
[]).
map
(
toIFile
);
mainResult
.
sources
=
toPrepend
.
concat
(
mainResult
.
sources
).
concat
(
toAppend
);
return
{
files
:
results
,
usedPlugins
:
usedPlugins
...
...
build/lib/bundle.ts
浏览文件 @
72ef20b5
...
...
@@ -46,6 +46,9 @@ export interface IEntryPoint {
name
:
string
;
include
:
string
[];
exclude
:
string
[];
prepend
:
string
[];
append
:
string
[];
dest
:
string
;
}
interface
IEntryPointMap
{
...
...
@@ -120,6 +123,25 @@ export function bundle(entryPoints:IEntryPoint[], config:ILoaderConfig, callback
config
.
isBuild
=
true
;
loader
.
config
(
config
);
loader
([
'
require
'
],
(
localRequire
)
=>
{
let
resolvePath
=
(
path
:
string
)
=>
{
let
r
=
localRequire
.
toUrl
(
path
);
if
(
!
/
\.
js/
.
test
(
r
))
{
return
r
+
'
.js
'
;
}
return
r
;
};
for
(
let
moduleId
in
entryPointsMap
)
{
let
entryPoint
=
entryPointsMap
[
moduleId
];
if
(
entryPoint
.
append
)
{
entryPoint
.
append
=
entryPoint
.
append
.
map
(
resolvePath
);
}
if
(
entryPoint
.
prepend
)
{
entryPoint
.
prepend
=
entryPoint
.
prepend
.
map
(
resolvePath
);
}
}
});
loader
(
Object
.
keys
(
allMentionedModulesMap
),
()
=>
{
let
modules
=
<
IBuildModuleInfo
[]
>
loader
.
getBuildInfo
();
let
partialResult
=
emitEntryPoints
(
modules
,
entryPointsMap
);
...
...
@@ -171,7 +193,15 @@ function emitEntryPoints(modules:IBuildModuleInfo[], entryPoints:IEntryPointMap)
bundleData
.
bundles
[
moduleToBundle
]
=
includedModules
;
let
res
=
emitEntryPoint
(
modulesMap
,
modulesGraph
,
moduleToBundle
,
includedModules
);
let
res
=
emitEntryPoint
(
modulesMap
,
modulesGraph
,
moduleToBundle
,
includedModules
,
info
.
prepend
,
info
.
append
,
info
.
dest
);
result
=
result
.
concat
(
res
.
files
);
for
(
let
pluginName
in
res
.
usedPlugins
)
{
...
...
@@ -355,10 +385,21 @@ interface IEmitEntryPointResult {
usedPlugins
:
IPluginMap
;
}
function
emitEntryPoint
(
modulesMap
:
IBuildModuleInfoMap
,
deps
:
IGraph
,
entryPoint
:
string
,
includedModules
:
string
[]):
IEmitEntryPointResult
{
function
emitEntryPoint
(
modulesMap
:
IBuildModuleInfoMap
,
deps
:
IGraph
,
entryPoint
:
string
,
includedModules
:
string
[],
prepend
:
string
[],
append
:
string
[],
dest
:
string
):
IEmitEntryPointResult
{
if
(
!
dest
)
{
dest
=
entryPoint
+
'
.js
'
;
}
let
mainResult
:
IConcatFile
=
{
sources
:
[],
dest
:
entryPoint
+
'
.js
'
dest
:
dest
},
results
:
IConcatFile
[]
=
[
mainResult
];
...
...
@@ -416,6 +457,19 @@ function emitEntryPoint(modulesMap:IBuildModuleInfoMap, deps:IGraph, entryPoint:
}
});
let
toIFile
=
(
path
):
IFile
=>
{
let
contents
=
readFileAndRemoveBOM
(
path
);
return
{
path
:
path
,
contents
:
contents
};
};
let
toPrepend
=
(
prepend
||
[]).
map
(
toIFile
);
let
toAppend
=
(
append
||
[]).
map
(
toIFile
);
mainResult
.
sources
=
toPrepend
.
concat
(
mainResult
.
sources
).
concat
(
toAppend
);
return
{
files
:
results
,
usedPlugins
:
usedPlugins
...
...
build/monaco/package.json
浏览文件 @
72ef20b5
{
"name"
:
"monaco-editor-core"
,
"private"
:
true
,
"version"
:
"0.7.
0-next.5
"
,
"version"
:
"0.7.
1
"
,
"description"
:
"A browser based code editor"
,
"author"
:
"Microsoft Corporation"
,
"license"
:
"MIT"
,
...
...
src/vs/base/worker/workerMain.ts
浏览文件 @
72ef20b5
...
...
@@ -9,7 +9,9 @@
let
MonacoEnvironment
=
(
<
any
>
self
).
MonacoEnvironment
;
let
monacoBaseUrl
=
MonacoEnvironment
&&
MonacoEnvironment
.
baseUrl
?
MonacoEnvironment
.
baseUrl
:
'
../../../
'
;
importScripts
(
monacoBaseUrl
+
'
vs/loader.js
'
);
if
(
typeof
(
<
any
>
self
).
define
!==
'
function
'
||
!
(
<
any
>
self
).
define
.
amd
)
{
importScripts
(
monacoBaseUrl
+
'
vs/loader.js
'
);
}
require
.
config
({
baseUrl
:
monacoBaseUrl
,
...
...
src/vs/loader.js
浏览文件 @
72ef20b5
...
...
@@ -1926,7 +1926,7 @@ var AMDLoader;
RequireFunc
.
config
(
global
.
require
);
}
if
(
!
isElectronRenderer
)
{
global
.
define
=
DefineFunc
;
global
.
define
=
define
=
DefineFunc
;
}
else
{
define
=
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录