Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
cc46bf5c
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,发现更多精彩内容 >>
未验证
提交
cc46bf5c
编写于
3月 27, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove `registerAndGetAmdImageURL` and support for it in the build scripts
上级
053ee8ed
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
0 addition
and
101 deletion
+0
-101
build/gulpfile.vscode.js
build/gulpfile.vscode.js
+0
-1
build/lib/optimize.js
build/lib/optimize.js
+0
-42
build/lib/optimize.ts
build/lib/optimize.ts
+0
-49
src/vs/base/common/amd.ts
src/vs/base/common/amd.ts
+0
-9
未找到文件。
build/gulpfile.vscode.js
浏览文件 @
cc46bf5c
...
...
@@ -93,7 +93,6 @@ const optimizeVSCodeTask = task.define('optimize-vscode', task.series(
resources
:
vscodeResources
,
loaderConfig
:
common
.
loaderConfig
(
nodeModules
),
out
:
'
out-vscode
'
,
inlineAmdImages
:
true
,
bundleInfo
:
undefined
})
));
...
...
build/lib/optimize.js
浏览文件 @
cc46bf5c
...
...
@@ -6,7 +6,6 @@
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
minifyTask
=
exports
.
optimizeTask
=
exports
.
loaderConfig
=
void
0
;
const
es
=
require
(
"
event-stream
"
);
const
fs
=
require
(
"
fs
"
);
const
gulp
=
require
(
"
gulp
"
);
const
concat
=
require
(
"
gulp-concat
"
);
const
minifyCSS
=
require
(
"
gulp-cssnano
"
);
...
...
@@ -134,14 +133,6 @@ function optimizeTask(opts) {
if
(
err
||
!
result
)
{
return
bundlesStream
.
emit
(
'
error
'
,
JSON
.
stringify
(
err
));
}
if
(
opts
.
inlineAmdImages
)
{
try
{
result
=
inlineAmdImages
(
src
,
result
);
}
catch
(
err
)
{
return
bundlesStream
.
emit
(
'
error
'
,
JSON
.
stringify
(
err
));
}
}
toBundleStream
(
src
,
bundledFileHeader
,
result
.
files
).
pipe
(
bundlesStream
);
// Remove css inlined resources
const
filteredResources
=
resources
.
slice
();
...
...
@@ -177,39 +168,6 @@ function optimizeTask(opts) {
};
}
exports
.
optimizeTask
=
optimizeTask
;
function
inlineAmdImages
(
src
,
result
)
{
for
(
const
outputFile
of
result
.
files
)
{
for
(
const
sourceFile
of
outputFile
.
sources
)
{
if
(
sourceFile
.
path
&&
/
\.
js$/
.
test
(
sourceFile
.
path
))
{
sourceFile
.
contents
=
sourceFile
.
contents
.
replace
(
/
\([^
.
]
+
\.
registerAndGetAmdImageURL
\(([^
)
]
+
)\)\)
/g
,
(
_
,
m0
)
=>
{
let
imagePath
=
m0
;
// remove `` or ''
if
((
imagePath
.
charAt
(
0
)
===
'
`
'
&&
imagePath
.
charAt
(
imagePath
.
length
-
1
)
===
'
`
'
)
||
(
imagePath
.
charAt
(
0
)
===
'
\'
'
&&
imagePath
.
charAt
(
imagePath
.
length
-
1
)
===
'
\'
'
))
{
imagePath
=
imagePath
.
substr
(
1
,
imagePath
.
length
-
2
);
}
if
(
!
/
\.(
png|svg
)
$/
.
test
(
imagePath
))
{
console
.
log
(
`original:
${
_
}
`
);
return
_
;
}
const
repoLocation
=
path
.
join
(
src
,
imagePath
);
const
absoluteLocation
=
path
.
join
(
REPO_ROOT_PATH
,
repoLocation
);
if
(
!
fs
.
existsSync
(
absoluteLocation
))
{
const
message
=
`Invalid amd image url in file
${
sourceFile
.
path
}
:
${
imagePath
}
`
;
console
.
log
(
message
);
throw
new
Error
(
message
);
}
const
fileContents
=
fs
.
readFileSync
(
absoluteLocation
);
const
mime
=
/
\.
svg$/
.
test
(
imagePath
)
?
'
image/svg+xml
'
:
'
image/png
'
;
// Mark the file as inlined so we don't ship it by itself
result
.
cssInlinedResources
.
push
(
repoLocation
);
return
`("data:
${
mime
}
;base64,
${
fileContents
.
toString
(
'
base64
'
)}
")`
;
});
}
}
}
return
result
;
}
/**
* Wrap around uglify and allow the preserveComments function
* to have a file "context" to include our copyright only once per file.
...
...
build/lib/optimize.ts
浏览文件 @
cc46bf5c
...
...
@@ -6,7 +6,6 @@
'
use strict
'
;
import
*
as
es
from
'
event-stream
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
gulp
from
'
gulp
'
;
import
*
as
concat
from
'
gulp-concat
'
;
import
*
as
minifyCSS
from
'
gulp-cssnano
'
;
...
...
@@ -160,10 +159,6 @@ export interface IOptimizeTaskOpts {
* (emit bundleInfo.json file)
*/
bundleInfo
:
boolean
;
/**
* replace calls to `registerAndGetAmdImageURL` with data uris
*/
inlineAmdImages
:
boolean
;
/**
* (out folder name)
*/
...
...
@@ -197,14 +192,6 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
bundle
.
bundle
(
entryPoints
,
loaderConfig
,
function
(
err
,
result
)
{
if
(
err
||
!
result
)
{
return
bundlesStream
.
emit
(
'
error
'
,
JSON
.
stringify
(
err
));
}
if
(
opts
.
inlineAmdImages
)
{
try
{
result
=
inlineAmdImages
(
src
,
result
);
}
catch
(
err
)
{
return
bundlesStream
.
emit
(
'
error
'
,
JSON
.
stringify
(
err
));
}
}
toBundleStream
(
src
,
bundledFileHeader
,
result
.
files
).
pipe
(
bundlesStream
);
// Remove css inlined resources
...
...
@@ -249,42 +236,6 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
};
}
function
inlineAmdImages
(
src
:
string
,
result
:
bundle
.
IBundleResult
):
bundle
.
IBundleResult
{
for
(
const
outputFile
of
result
.
files
)
{
for
(
const
sourceFile
of
outputFile
.
sources
)
{
if
(
sourceFile
.
path
&&
/
\.
js$/
.
test
(
sourceFile
.
path
))
{
sourceFile
.
contents
=
sourceFile
.
contents
.
replace
(
/
\([^
.
]
+
\.
registerAndGetAmdImageURL
\(([^
)
]
+
)\)\)
/g
,
(
_
,
m0
)
=>
{
let
imagePath
=
m0
;
// remove `` or ''
if
((
imagePath
.
charAt
(
0
)
===
'
`
'
&&
imagePath
.
charAt
(
imagePath
.
length
-
1
)
===
'
`
'
)
||
(
imagePath
.
charAt
(
0
)
===
'
\'
'
&&
imagePath
.
charAt
(
imagePath
.
length
-
1
)
===
'
\'
'
))
{
imagePath
=
imagePath
.
substr
(
1
,
imagePath
.
length
-
2
);
}
if
(
!
/
\.(
png|svg
)
$/
.
test
(
imagePath
))
{
console
.
log
(
`original:
${
_
}
`
);
return
_
;
}
const
repoLocation
=
path
.
join
(
src
,
imagePath
);
const
absoluteLocation
=
path
.
join
(
REPO_ROOT_PATH
,
repoLocation
);
if
(
!
fs
.
existsSync
(
absoluteLocation
))
{
const
message
=
`Invalid amd image url in file
${
sourceFile
.
path
}
:
${
imagePath
}
`
;
console
.
log
(
message
);
throw
new
Error
(
message
);
}
const
fileContents
=
fs
.
readFileSync
(
absoluteLocation
);
const
mime
=
/
\.
svg$/
.
test
(
imagePath
)
?
'
image/svg+xml
'
:
'
image/png
'
;
// Mark the file as inlined so we don't ship it by itself
result
.
cssInlinedResources
.
push
(
repoLocation
);
return
`("data:
${
mime
}
;base64,
${
fileContents
.
toString
(
'
base64
'
)}
")`
;
});
}
}
}
return
result
;
}
declare
class
FileWithCopyright
extends
VinylFile
{
public
__hasOurCopyright
:
boolean
;
}
...
...
src/vs/base/common/amd.ts
浏览文件 @
cc46bf5c
...
...
@@ -12,12 +12,3 @@ export function getPathFromAmdModule(requirefn: typeof require, relativePath: st
export
function
getUriFromAmdModule
(
requirefn
:
typeof
require
,
relativePath
:
string
):
URI
{
return
URI
.
parse
(
requirefn
.
toUrl
(
relativePath
));
}
/**
* Reference a resource that might be inlined.
* Do not inline icons that will be used by the native mac touchbar.
* Do not rename this method unless you adopt the build scripts.
*/
export
function
registerAndGetAmdImageURL
(
absolutePath
:
string
):
string
{
return
require
.
toUrl
(
absolutePath
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录