Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
335b422a
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,发现更多精彩内容 >>
提交
335b422a
编写于
12月 02, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update loader to eeafe10
上级
9791f64b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
72 deletion
+45
-72
src/vs/loader.js
src/vs/loader.js
+45
-72
未找到文件。
src/vs/loader.js
浏览文件 @
335b422a
...
...
@@ -122,7 +122,7 @@ var AMDLoader;
};
Utilities
.
NEXT_ANONYMOUS_ID
=
1
;
return
Utilities
;
}
());
}());
AMDLoader
.
Utilities
=
Utilities
;
var
ConfigurationOptionsUtil
=
(
function
()
{
function
ConfigurationOptionsUtil
()
{
...
...
@@ -248,7 +248,7 @@ var AMDLoader;
return
ConfigurationOptionsUtil
.
validateConfigurationOptions
(
result
);
};
return
ConfigurationOptionsUtil
;
}
());
}());
AMDLoader
.
ConfigurationOptionsUtil
=
ConfigurationOptionsUtil
;
var
Configuration
=
(
function
()
{
function
Configuration
(
options
)
{
...
...
@@ -542,7 +542,7 @@ var AMDLoader;
this
.
options
.
onError
(
err
);
};
return
Configuration
;
}
());
}());
AMDLoader
.
Configuration
=
Configuration
;
// ------------------------------------------------------------------------
// ModuleIdResolver
...
...
@@ -622,7 +622,7 @@ var AMDLoader;
this
.
_config
.
onError
(
err
);
};
return
ModuleIdResolver
;
}
());
}());
AMDLoader
.
ModuleIdResolver
=
ModuleIdResolver
;
// ------------------------------------------------------------------------
// Module
...
...
@@ -852,7 +852,7 @@ var AMDLoader;
return
this
.
_unresolvedDependenciesCount
===
0
;
};
return
Module
;
}
());
}());
AMDLoader
.
Module
=
Module
;
// ------------------------------------------------------------------------
// LoaderEvent
...
...
@@ -879,7 +879,7 @@ var AMDLoader;
this
.
timestamp
=
timestamp
;
}
return
LoaderEvent
;
}
());
}());
AMDLoader
.
LoaderEvent
=
LoaderEvent
;
var
LoaderEventRecorder
=
(
function
()
{
function
LoaderEventRecorder
(
loaderAvailableTimestamp
)
{
...
...
@@ -892,7 +892,7 @@ var AMDLoader;
return
this
.
_events
;
};
return
LoaderEventRecorder
;
}
());
}());
AMDLoader
.
LoaderEventRecorder
=
LoaderEventRecorder
;
var
NullLoaderEventRecorder
=
(
function
()
{
function
NullLoaderEventRecorder
()
{
...
...
@@ -905,7 +905,7 @@ var AMDLoader;
};
NullLoaderEventRecorder
.
INSTANCE
=
new
NullLoaderEventRecorder
();
return
NullLoaderEventRecorder
;
}
());
}());
AMDLoader
.
NullLoaderEventRecorder
=
NullLoaderEventRecorder
;
var
ModuleManager
=
(
function
()
{
function
ModuleManager
(
scriptLoader
)
{
...
...
@@ -920,7 +920,6 @@ var AMDLoader;
this
.
_queuedDefineCalls
=
[];
this
.
_loadingScriptsCount
=
0
;
this
.
_resolvedScriptPaths
=
{};
this
.
_checksums
=
{};
}
ModuleManager
.
_findRelevantLocationInStack
=
function
(
needle
,
stack
)
{
var
normalize
=
function
(
str
)
{
return
str
.
replace
(
/
\\
/g
,
'
/
'
);
};
...
...
@@ -982,12 +981,6 @@ var AMDLoader;
ModuleManager
.
prototype
.
getLoaderEvents
=
function
()
{
return
this
.
getRecorder
().
getEvents
();
};
ModuleManager
.
prototype
.
recordChecksum
=
function
(
scriptSrc
,
checksum
)
{
this
.
_checksums
[
scriptSrc
]
=
checksum
;
};
ModuleManager
.
prototype
.
getChecksums
=
function
()
{
return
this
.
_checksums
;
};
/**
* Defines a module.
* @param id @see defineModule
...
...
@@ -1311,9 +1304,6 @@ var AMDLoader;
result
.
getStats
=
function
()
{
return
_this
.
getLoaderEvents
();
};
result
.
getChecksums
=
function
()
{
return
_this
.
getChecksums
();
};
result
.
__$__nodeRequire
=
global
.
nodeRequire
;
return
result
;
};
...
...
@@ -1550,7 +1540,7 @@ var AMDLoader;
}
};
return
ModuleManager
;
}
());
}());
AMDLoader
.
ModuleManager
=
ModuleManager
;
/**
* Load `scriptSrc` only once (avoid multiple <script> tags)
...
...
@@ -1591,7 +1581,7 @@ var AMDLoader;
}
};
return
OnlyOnceScriptLoader
;
}
());
}());
var
BrowserScriptLoader
=
(
function
()
{
function
BrowserScriptLoader
()
{
}
...
...
@@ -1658,7 +1648,7 @@ var AMDLoader;
document
.
getElementsByTagName
(
'
head
'
)[
0
].
appendChild
(
script
);
};
return
BrowserScriptLoader
;
}
());
}());
var
WorkerScriptLoader
=
(
function
()
{
function
WorkerScriptLoader
()
{
this
.
loadCalls
=
[];
...
...
@@ -1711,7 +1701,7 @@ var AMDLoader;
}
};
return
WorkerScriptLoader
;
}
());
}());
var
NodeScriptLoader
=
(
function
()
{
function
NodeScriptLoader
()
{
this
.
_initialized
=
false
;
...
...
@@ -1732,7 +1722,6 @@ var AMDLoader;
NodeScriptLoader
.
prototype
.
load
=
function
(
scriptSrc
,
callback
,
errorback
,
recorder
)
{
var
_this
=
this
;
var
opts
=
this
.
_moduleManager
.
getConfigurationOptions
();
var
checksum
=
opts
.
checksum
||
false
;
var
nodeRequire
=
(
opts
.
nodeRequire
||
global
.
nodeRequire
);
var
nodeInstrumenter
=
(
opts
.
nodeInstrumenter
||
function
(
c
)
{
return
c
;
});
this
.
_init
(
nodeRequire
);
...
...
@@ -1759,15 +1748,6 @@ var AMDLoader;
errorback
(
err
);
return
;
}
if
(
checksum
)
{
var
hash
=
_this
.
_crypto
.
createHash
(
'
md5
'
)
.
update
(
data
,
'
utf8
'
)
.
digest
(
'
base64
'
)
.
replace
(
/=+$/
,
''
);
_this
.
_moduleManager
.
recordChecksum
(
scriptSrc
,
hash
);
}
recorder
.
record
(
LoaderEventType
.
NodeBeginEvaluatingScript
,
scriptSrc
);
var
vmScriptSrc
=
_this
.
_path
.
normalize
(
scriptSrc
);
// Make the script src friendly towards electron
if
(
isElectronRenderer
)
{
...
...
@@ -1786,9 +1766,7 @@ var AMDLoader;
}
contents
=
nodeInstrumenter
(
contents
,
vmScriptSrc
);
if
(
!
opts
.
nodeCachedDataDir
)
{
var
r
=
_this
.
_vm
.
runInThisContext
(
contents
,
{
filename
:
vmScriptSrc
});
r
.
call
(
global
,
RequireFunc
,
DefineFunc
,
vmScriptSrc
,
_this
.
_path
.
dirname
(
scriptSrc
));
recorder
.
record
(
LoaderEventType
.
NodeEndEvaluatingScript
,
scriptSrc
);
_this
.
_loadAndEvalScript
(
scriptSrc
,
vmScriptSrc
,
contents
,
{
filename
:
vmScriptSrc
},
recorder
);
callback
();
}
else
{
...
...
@@ -1800,12 +1778,7 @@ var AMDLoader;
produceCachedData
:
typeof
data
===
'
undefined
'
,
cachedData
:
data
};
// create script, run script
var
script
=
new
_this
.
_vm
.
Script
(
contents
,
scriptOptions
);
var
r
=
script
.
runInThisContext
(
scriptOptions
);
r
.
call
(
global
,
RequireFunc
,
DefineFunc
,
vmScriptSrc
,
_this
.
_path
.
dirname
(
scriptSrc
));
// signal done
recorder
.
record
(
LoaderEventType
.
NodeEndEvaluatingScript
,
scriptSrc
);
var
script
=
_this
.
_loadAndEvalScript
(
scriptSrc
,
vmScriptSrc
,
contents
,
scriptOptions
,
recorder
);
callback
();
// cached code after math
if
(
script
.
cachedDataRejected
)
{
...
...
@@ -1814,37 +1787,43 @@ var AMDLoader;
errorCode
:
'
cachedDataRejected
'
,
path
:
cachedDataPath_1
});
NodeScriptLoader
.
_runSoon
(
function
()
{
return
_this
.
_fs
.
unlink
(
cachedDataPath_1
,
function
(
err
)
{
if
(
err
)
{
opts
.
onNodeCachedDataError
({
errorCode
:
'
unlink
'
,
path
:
cachedDataPath_1
,
detail
:
err
});
}
});
},
opts
.
nodeCachedDataWriteDelay
);
NodeScriptLoader
.
_runSoon
(
function
()
{
return
_this
.
_fs
.
unlink
(
cachedDataPath_1
,
function
(
err
)
{
if
(
err
)
{
opts
.
onNodeCachedDataError
({
errorCode
:
'
unlink
'
,
path
:
cachedDataPath_1
,
detail
:
err
});
}
});
},
opts
.
nodeCachedDataWriteDelay
);
}
else
if
(
script
.
cachedDataProduced
)
{
// data produced => write cache file
NodeScriptLoader
.
_runSoon
(
function
()
{
return
_this
.
_fs
.
writeFile
(
cachedDataPath_1
,
script
.
cachedData
,
function
(
err
)
{
if
(
err
)
{
opts
.
onNodeCachedDataError
({
errorCode
:
'
writeFile
'
,
path
:
cachedDataPath_1
,
detail
:
err
});
}
});
},
opts
.
nodeCachedDataWriteDelay
);
NodeScriptLoader
.
_runSoon
(
function
()
{
return
_this
.
_fs
.
writeFile
(
cachedDataPath_1
,
script
.
cachedData
,
function
(
err
)
{
if
(
err
)
{
opts
.
onNodeCachedDataError
({
errorCode
:
'
writeFile
'
,
path
:
cachedDataPath_1
,
detail
:
err
});
}
});
},
opts
.
nodeCachedDataWriteDelay
);
}
});
}
});
}
};
NodeScriptLoader
.
prototype
.
_loadAndEvalScript
=
function
(
scriptSrc
,
vmScriptSrc
,
contents
,
options
,
recorder
)
{
// create script, run script
recorder
.
record
(
LoaderEventType
.
NodeBeginEvaluatingScript
,
scriptSrc
);
var
script
=
new
this
.
_vm
.
Script
(
contents
,
options
);
var
r
=
script
.
runInThisContext
(
options
);
r
.
call
(
global
,
RequireFunc
,
DefineFunc
,
vmScriptSrc
,
this
.
_path
.
dirname
(
scriptSrc
));
// signal done
recorder
.
record
(
LoaderEventType
.
NodeEndEvaluatingScript
,
scriptSrc
);
return
script
;
};
NodeScriptLoader
.
prototype
.
_getCachedDataPath
=
function
(
baseDir
,
filename
)
{
var
hash
=
this
.
_crypto
.
createHash
(
'
md5
'
).
update
(
filename
,
'
utf8
'
).
digest
(
'
hex
'
);
var
basename
=
this
.
_path
.
basename
(
filename
).
replace
(
/
\.
js$/
,
''
);
...
...
@@ -1856,7 +1835,7 @@ var AMDLoader;
};
NodeScriptLoader
.
_BOM
=
0xFEFF
;
return
NodeScriptLoader
;
}
());
}());
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
...
...
@@ -1886,7 +1865,7 @@ var AMDLoader;
jQuery
:
true
};
return
DefineFunc
;
}
());
}());
var
RequireFunc
=
(
function
()
{
function
RequireFunc
()
{
if
(
arguments
.
length
===
1
)
{
...
...
@@ -1932,14 +1911,8 @@ var AMDLoader;
RequireFunc
.
getStats
=
function
()
{
return
moduleManager
.
getLoaderEvents
();
};
/**
* Non standard extension to fetch checksums
*/
RequireFunc
.
getChecksums
=
function
()
{
return
moduleManager
.
getChecksums
();
};
return
RequireFunc
;
}
());
}());
var
global
=
_amdLoaderGlobal
,
hasPerformanceNow
=
(
global
.
performance
&&
typeof
global
.
performance
.
now
===
'
function
'
),
isWebWorker
,
isElectronRenderer
,
isElectronMain
,
isNode
,
scriptLoader
,
moduleManager
,
loaderAvailableTimestamp
;
function
initVars
()
{
isWebWorker
=
(
typeof
global
.
importScripts
===
'
function
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录