Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
44a565c8
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
44a565c8
编写于
2月 09, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor bootstrap
related to #2785
上级
9f9aa618
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
85 addition
and
112 deletion
+85
-112
package.json
package.json
+1
-1
src/bootstrap-amd.js
src/bootstrap-amd.js
+34
-62
src/bootstrap.js
src/bootstrap.js
+12
-49
src/main.js
src/main.js
+38
-0
未找到文件。
package.json
浏览文件 @
44a565c8
...
...
@@ -5,7 +5,7 @@
"author"
:
{
"name"
:
"Microsoft Corporation"
},
"main"
:
"./out/
vs/workbench/electron-main/bootstrap
"
,
"main"
:
"./out/
main
"
,
"private"
:
true
,
"engines"
:
{
"node"
:
">= 0.10.0 < 0.11.0"
...
...
src/
vs/workbench/electron-main/bootstrap
.js
→
src/
bootstrap-amd
.js
浏览文件 @
44a565c8
...
...
@@ -3,52 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* global __filename, __dirname, global, process */
// Perf measurements
global
.
vscodeStart
=
Date
.
now
();
var
app
=
require
(
'
electron
'
).
app
;
var
path
=
require
(
'
path
'
);
var
fs
=
require
(
'
fs
'
);
// Change cwd if given via env variable
try
{
process
.
env
.
VSCODE_CWD
&&
process
.
chdir
(
process
.
env
.
VSCODE_CWD
);
}
catch
(
err
)
{
// noop
}
// Set path according to being built or not
if
(
!!
process
.
env
.
VSCODE_DEV
)
{
var
appData
=
app
.
getPath
(
'
appData
'
);
app
.
setPath
(
'
userData
'
,
path
.
join
(
appData
,
'
Code-Development
'
));
}
// Mac: when someone drops a file to the not-yet running VSCode, the open-file event fires even before
// the app-ready event. We listen very early for open-file and remember this upon startup as path to open.
global
.
macOpenFiles
=
[];
app
.
on
(
'
open-file
'
,
function
(
event
,
path
)
{
global
.
macOpenFiles
.
push
(
path
);
});
// TODO: Duplicated in:
// * src\bootstrap.js
// * src\vs\workbench\electron-main\bootstrap.js
// * src\vs\platform\plugins\common\nativePluginService.ts
function
uriFromPath
(
_path
)
{
var
pathName
=
path
.
resolve
(
_path
).
replace
(
/
\\
/g
,
'
/
'
);
if
(
pathName
.
length
>
0
&&
pathName
.
charAt
(
0
)
!==
'
/
'
)
{
pathName
=
'
/
'
+
pathName
;
}
return
encodeURI
(
'
file://
'
+
pathName
);
}
var
loader
=
require
(
'
./vs/loader
'
);
// Duplicated in ../index.html for the renderes.
function
getNLSConfiguration
()
{
if
(
process
.
env
[
'
VSCODE_NLS_CONFIG
'
])
{
return
JSON
.
parse
(
process
.
env
[
'
VSCODE_NLS_CONFIG
'
]);
}
var
locale
=
undefined
;
var
localeOpts
=
'
--locale
'
;
for
(
var
i
=
0
;
i
<
process
.
argv
.
length
;
i
++
)
{
...
...
@@ -82,29 +45,38 @@ function getNLSConfiguration() {
}
}
}
return
{
availableLanguages
:
{}
};
}
// Load our code once ready
app
.
once
(
'
ready
'
,
function
()
{
var
nlsConfig
=
getNLSConfiguration
();
process
.
env
[
'
VSCODE_NLS_CONFIG
'
]
=
JSON
.
stringify
(
nlsConfig
);
var
loader
=
require
(
'
../../loader
'
);
loader
.
config
({
nodeRequire
:
require
,
nodeMain
:
__filename
,
baseUrl
:
uriFromPath
(
path
.
dirname
(
path
.
dirname
(
path
.
dirname
((
__dirname
))))),
'
vs/nls
'
:
nlsConfig
});
function
uriFromPath
(
_path
)
{
var
pathName
=
path
.
resolve
(
_path
).
replace
(
/
\\
/g
,
'
/
'
);
if
(
nlsConfig
.
pseudo
)
{
loader
([
'
vs/nls
'
],
function
(
nlsPlugin
)
{
nlsPlugin
.
setPseudoTranslation
(
nlsConfig
.
pseudo
);
});
if
(
pathName
.
length
>
0
&&
pathName
.
charAt
(
0
)
!==
'
/
'
)
{
pathName
=
'
/
'
+
pathName
;
}
loader
([
'
vs/workbench/electron-main/main
'
],
function
(
main
)
{
// Loading done
},
function
(
err
)
{
console
.
error
(
err
);
});
});
\ No newline at end of file
return
encodeURI
(
'
file://
'
+
pathName
);
}
var
nlsConfig
=
getNLSConfiguration
();
process
.
env
[
'
VSCODE_NLS_CONFIG
'
]
=
JSON
.
stringify
(
nlsConfig
);
loader
.
config
({
baseUrl
:
uriFromPath
(
path
.
join
(
__dirname
)),
catchError
:
true
,
nodeRequire
:
require
,
nodeMain
:
__filename
,
'
vs/nls
'
:
nlsConfig
});
if
(
nlsConfig
.
pseudo
)
{
loader
([
'
vs/nls
'
],
function
(
nlsPlugin
)
{
nlsPlugin
.
setPseudoTranslation
(
nlsConfig
.
pseudo
);
});
}
var
entrypoint
=
process
.
env
[
'
AMD_ENTRYPOINT
'
];
if
(
entrypoint
)
{
loader
([
entrypoint
],
function
()
{
},
function
(
err
)
{
console
.
error
(
err
);
});
}
src/bootstrap.js
浏览文件 @
44a565c8
...
...
@@ -86,18 +86,19 @@ if (!!process.send && process.env.PIPE_LOGGING === 'true') {
}
console
.
error
=
function
()
{
safeSend
({
type
:
'
__$console
'
,
severity
:
'
error
'
,
arguments
:
safeStringify
(
arguments
)
});
};
// Let stdout, stderr and stdin be no-op streams. This prevents an issue where we would get an EBADF
// error when we are inside a forked process and this process tries to access those channels.
var
stream
=
require
(
'
stream
'
);
var
writable
=
new
stream
.
Writable
({
write
:
function
(
chunk
,
encoding
,
next
)
{
/* No OP */
}
});
process
.
__defineGetter__
(
'
stdout
'
,
function
()
{
return
writable
;
});
process
.
__defineGetter__
(
'
stderr
'
,
function
()
{
return
writable
;
});
process
.
__defineGetter__
(
'
stdin
'
,
function
()
{
return
writable
;
});
}
// Let stdout, stderr and stdin be no-op streams. This prevents an issue where we would get an EBADF
// error when we are inside a forked process and this process tries to access those channels.
var
stream
=
require
(
'
stream
'
);
var
writable
=
new
stream
.
Writable
({
write
:
function
(
chunk
,
encoding
,
next
)
{
/* No OP */
}
});
process
.
__defineGetter__
(
'
stdout
'
,
function
()
{
return
writable
;
});
process
.
__defineGetter__
(
'
stderr
'
,
function
()
{
return
writable
;
});
process
.
__defineGetter__
(
'
stdin
'
,
function
()
{
return
writable
;
});
// Handle uncaught exceptions
process
.
on
(
'
uncaughtException
'
,
function
(
err
)
{
console
.
error
(
'
Uncaught Exception:
'
,
err
.
toString
());
...
...
@@ -106,42 +107,4 @@ process.on('uncaughtException', function (err) {
}
});
var
path
=
require
(
'
path
'
);
var
loader
=
require
(
'
./vs/loader
'
);
// TODO: Duplicated in:
// * src\bootstrap.js
// * src\vs\workbench\electron-main\bootstrap.js
// * src\vs\platform\plugins\common\nativePluginService.ts
function
uriFromPath
(
_path
)
{
var
pathName
=
path
.
resolve
(
_path
).
replace
(
/
\\
/g
,
'
/
'
);
if
(
pathName
.
length
>
0
&&
pathName
.
charAt
(
0
)
!==
'
/
'
)
{
pathName
=
'
/
'
+
pathName
;
}
return
encodeURI
(
'
file://
'
+
pathName
);
}
var
nlsConfig
=
undefined
;
if
(
process
.
env
.
VSCODE_NLS_CONFIG
)
{
nlsConfig
=
JSON
.
parse
(
process
.
env
.
VSCODE_NLS_CONFIG
);
}
loader
.
config
({
baseUrl
:
uriFromPath
(
path
.
join
(
__dirname
)),
catchError
:
true
,
nodeRequire
:
require
,
nodeMain
:
__filename
,
'
vs/nls
'
:
nlsConfig
||
{
availableLanguages
:
{}
}
});
if
(
nlsConfig
&&
nlsConfig
.
pseudo
)
{
loader
([
'
vs/nls
'
],
function
(
nlsPlugin
)
{
nlsPlugin
.
setPseudoTranslation
(
nlsConfig
.
pseudo
);
});
}
var
entrypoint
=
process
.
env
.
AMD_ENTRYPOINT
;
if
(
entrypoint
)
{
loader
([
entrypoint
],
function
()
{
},
function
(
err
)
{
console
.
error
(
err
);
});
}
require
(
'
./bootstrap-amd
'
);
\ No newline at end of file
src/main.js
0 → 100644
浏览文件 @
44a565c8
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Perf measurements
global
.
vscodeStart
=
Date
.
now
();
var
app
=
require
(
'
electron
'
).
app
;
var
path
=
require
(
'
path
'
);
// Change cwd if given via env variable
try
{
if
(
process
.
env
.
VSCODE_CWD
)
{
process
.
chdir
(
process
.
env
.
VSCODE_CWD
);
}
}
catch
(
err
)
{
// noop
}
// Set path according to being built or not
if
(
process
.
env
.
VSCODE_DEV
)
{
var
appData
=
app
.
getPath
(
'
appData
'
);
app
.
setPath
(
'
userData
'
,
path
.
join
(
appData
,
'
Code-Development
'
));
}
// Mac: when someone drops a file to the not-yet running VSCode, the open-file event fires even before
// the app-ready event. We listen very early for open-file and remember this upon startup as path to open.
global
.
macOpenFiles
=
[];
app
.
on
(
'
open-file
'
,
function
(
event
,
path
)
{
global
.
macOpenFiles
.
push
(
path
);
});
// Load our code once ready
app
.
once
(
'
ready
'
,
function
()
{
process
.
env
[
'
AMD_ENTRYPOINT
'
]
=
'
vs/workbench/electron-main/main
'
;
require
(
'
./bootstrap-amd
'
);
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录