Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5ba85917
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,发现更多精彩内容 >>
未验证
提交
5ba85917
编写于
7月 27, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Align build scripts
上级
bf8b5c9a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
119 addition
and
118 deletion
+119
-118
build/gulpfile.extensions.js
build/gulpfile.extensions.js
+2
-2
build/lib/extensions.js
build/lib/extensions.js
+44
-50
build/lib/extensions.ts
build/lib/extensions.ts
+73
-66
未找到文件。
build/gulpfile.extensions.js
浏览文件 @
5ba85917
...
...
@@ -165,8 +165,8 @@ gulp.task(compileExtensionsBuildLegacyTask);
const
cleanExtensionsBuildTask
=
task
.
define
(
'
clean-extensions-build
'
,
util
.
rimraf
(
'
.build/extensions
'
));
const
compileExtensionsBuildTask
=
task
.
define
(
'
compile-extensions-build
'
,
task
.
series
(
cleanExtensionsBuildTask
,
task
.
define
(
'
bundle-extensions-build
'
,
()
=>
ext
.
packageLocalExtensionsStream
().
pipe
(
gulp
.
dest
(
'
.build
'
))),
task
.
define
(
'
bundle-marketplace-extensions-build
'
,
()
=>
ext
.
packageMarketplaceExtensionsStream
().
pipe
(
gulp
.
dest
(
'
.build
'
))),
task
.
define
(
'
bundle-extensions-build
'
,
()
=>
ext
.
packageLocalExtensionsStream
(
false
).
pipe
(
gulp
.
dest
(
'
.build
'
))),
task
.
define
(
'
bundle-marketplace-extensions-build
'
,
()
=>
ext
.
packageMarketplaceExtensionsStream
(
false
).
pipe
(
gulp
.
dest
(
'
.build
'
))),
));
gulp
.
task
(
compileExtensionsBuildTask
);
...
...
build/lib/extensions.js
浏览文件 @
5ba85917
...
...
@@ -4,7 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
translatePackageJSON
=
exports
.
scanBuiltinExtensions
=
exports
.
packageMarketplace
WebExtensionsStream
=
exports
.
packageMarketplaceExtensionsStream
=
exports
.
packageLocalWeb
ExtensionsStream
=
exports
.
packageLocalExtensionsStream
=
exports
.
fromMarketplace
=
void
0
;
exports
.
translatePackageJSON
=
exports
.
scanBuiltinExtensions
=
exports
.
packageMarketplaceExtensionsStream
=
exports
.
packageLocalExtensionsStream
=
exports
.
fromMarketplace
=
void
0
;
const
es
=
require
(
"
event-stream
"
);
const
fs
=
require
(
"
fs
"
);
const
glob
=
require
(
"
glob
"
);
...
...
@@ -200,68 +200,66 @@ const excludedExtensions = [
'
ms-vscode.node-debug2
'
,
'
vscode-notebook-tests
'
];
const
marketplaceWebExtensions
=
[
'
ms-vscode.references-view
'
];
const
builtInExtensions
=
JSON
.
parse
(
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
../../product.json
'
),
'
utf8
'
)).
builtInExtensions
;
function
packageLocalExtensionsStream
()
{
const
localExtensionDescriptions
=
glob
.
sync
(
'
extensions/*/package.json
'
)
/**
* Loosely based on `getExtensionKind` from `src/vs/workbench/services/extensions/common/extensionsUtil.ts`
*/
function
isWebExtension
(
manifest
)
{
if
(
typeof
manifest
.
extensionKind
!==
'
undefined
'
)
{
const
extensionKind
=
Array
.
isArray
(
manifest
.
extensionKind
)
?
manifest
.
extensionKind
:
[
manifest
.
extensionKind
];
return
(
extensionKind
.
indexOf
(
'
web
'
)
>=
0
);
}
return
(
!
Boolean
(
manifest
.
main
)
||
Boolean
(
manifest
.
browser
));
}
function
packageLocalExtensionsStream
(
forWeb
)
{
const
localExtensionsDescriptions
=
(
glob
.
sync
(
'
extensions/*/package.json
'
)
.
map
(
manifestPath
=>
{
const
absoluteManifestPath
=
path
.
join
(
root
,
manifestPath
);
const
extensionPath
=
path
.
dirname
(
path
.
join
(
root
,
manifestPath
));
const
extensionName
=
path
.
basename
(
extensionPath
);
return
{
name
:
extensionName
,
path
:
extensionPath
};
return
{
name
:
extensionName
,
path
:
extensionPath
,
manifestPath
:
absoluteManifestPath
};
})
.
filter
(({
name
})
=>
excludedExtensions
.
indexOf
(
name
)
===
-
1
)
.
filter
(({
name
})
=>
builtInExtensions
.
every
(
b
=>
b
.
name
!==
name
));
const
localExtensions
=
localExtensionDescriptions
.
map
(
extension
=>
{
return
fromLocal
(
extension
.
path
,
false
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
});
const
nodeModules
=
gulp
.
src
(
'
extensions/node_modules/**
'
,
{
base
:
'
.
'
});
return
minifyExtensionResources
(
es
.
merge
(
nodeModules
,
...
localExtensions
)
.
pipe
(
util2
.
setExecutableBit
([
'
**/*.sh
'
])));
}
exports
.
packageLocalExtensionsStream
=
packageLocalExtensionsStream
;
function
packageLocalWebExtensionsStream
()
{
const
localExtensionDescriptions
=
glob
.
sync
(
'
extensions/*/package.json
'
)
.
filter
(
manifestPath
=>
{
const
packageJsonConfig
=
require
(
path
.
join
(
root
,
manifestPath
));
return
!
packageJsonConfig
.
main
||
packageJsonConfig
.
browser
;
})
.
map
(
manifestPath
=>
{
const
extensionPath
=
path
.
dirname
(
path
.
join
(
root
,
manifestPath
));
const
extensionName
=
path
.
basename
(
extensionPath
);
return
{
name
:
extensionName
,
path
:
extensionPath
};
});
return
minifyExtensionResources
(
es
.
merge
(...
localExtensionDescriptions
.
map
(
extension
=>
{
return
fromLocal
(
extension
.
path
,
true
)
.
filter
(({
name
})
=>
builtInExtensions
.
every
(
b
=>
b
.
name
!==
name
))
.
filter
(({
manifestPath
})
=>
(
forWeb
?
isWebExtension
(
require
(
manifestPath
))
:
true
)));
const
localExtensionsStream
=
minifyExtensionResources
(
es
.
merge
(...
localExtensionsDescriptions
.
map
(
extension
=>
{
return
fromLocal
(
extension
.
path
,
forWeb
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
})));
}
exports
.
packageLocalWebExtensionsStream
=
packageLocalWebExtensionsStream
;
function
packageMarketplaceExtensionsStream
()
{
const
extensions
=
builtInExtensions
.
map
(
extension
=>
{
return
fromMarketplace
(
extension
.
name
,
extension
.
version
,
extension
.
metadata
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
});
return
minifyExtensionResources
(
es
.
merge
(
extensions
)
let
result
;
if
(
forWeb
)
{
result
=
localExtensionsStream
;
}
else
{
// also include shared node modules
result
=
es
.
merge
(
localExtensionsStream
,
gulp
.
src
(
'
extensions/node_modules/**
'
,
{
base
:
'
.
'
}));
}
return
(
result
.
pipe
(
util2
.
setExecutableBit
([
'
**/*.sh
'
])));
}
exports
.
packageMarketplaceExtensionsStream
=
packageMarketplaceExtensionsStream
;
function
packageMarketplaceWebExtensionsStream
(
builtInExtensions
)
{
const
extensions
=
builtInExtensions
exports
.
packageLocalExtensionsStream
=
packageLocalExtensionsStream
;
function
packageMarketplaceExtensionsStream
(
forWeb
)
{
const
marketplaceExtensionsDescriptions
=
(
builtInExtensions
.
filter
(({
name
})
=>
(
forWeb
?
marketplaceWebExtensions
.
indexOf
(
name
)
>=
0
:
true
)));
const
marketplaceExtensionsStream
=
minifyExtensionResources
(
es
.
merge
(...
marketplaceExtensionsDescriptions
.
map
(
extension
=>
{
const
input
=
fromMarketplace
(
extension
.
name
,
extension
.
version
,
extension
.
metadata
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
return
updateExtensionPackageJSON
(
input
,
(
data
)
=>
{
if
(
data
.
main
)
{
data
.
browser
=
data
.
main
;
}
data
.
extensionKind
=
[
'
web
'
];
delete
data
.
scripts
;
delete
data
.
dependencies
;
delete
data
.
devDependencies
;
return
data
;
});
});
return
minifyExtensionResources
(
es
.
merge
(
extensions
));
})));
return
(
marketplaceExtensionsStream
.
pipe
(
util2
.
setExecutableBit
([
'
**/*.sh
'
])));
}
exports
.
packageMarketplace
WebExtensionsStream
=
packageMarketplaceWeb
ExtensionsStream
;
function
scanBuiltinExtensions
(
extensionsRoot
,
forWeb
)
{
exports
.
packageMarketplace
ExtensionsStream
=
packageMarketplace
ExtensionsStream
;
function
scanBuiltinExtensions
(
extensionsRoot
)
{
const
scannedExtensions
=
[];
const
extensionsFolders
=
fs
.
readdirSync
(
extensionsRoot
);
for
(
const
extensionFolder
of
extensionsFolders
)
{
...
...
@@ -270,10 +268,6 @@ function scanBuiltinExtensions(extensionsRoot, forWeb) {
continue
;
}
let
packageJSON
=
JSON
.
parse
(
fs
.
readFileSync
(
packageJSONPath
).
toString
(
'
utf8
'
));
const
extensionKind
=
packageJSON
[
'
extensionKind
'
]
||
[];
if
(
forWeb
&&
extensionKind
.
indexOf
(
'
web
'
)
===
-
1
)
{
continue
;
}
const
children
=
fs
.
readdirSync
(
path
.
join
(
extensionsRoot
,
extensionFolder
));
const
packageNLS
=
children
.
filter
(
child
=>
child
===
'
package.nls.json
'
)[
0
];
const
readme
=
children
.
filter
(
child
=>
/^readme
(\.
txt|
\.
md|
)
$/i
.
test
(
child
))[
0
];
...
...
build/lib/extensions.ts
浏览文件 @
5ba85917
...
...
@@ -235,6 +235,10 @@ const excludedExtensions = [
'
vscode-notebook-tests
'
];
const
marketplaceWebExtensions
=
[
'
ms-vscode.references-view
'
];
interface
IBuiltInExtension
{
name
:
string
;
version
:
string
;
...
...
@@ -244,76 +248,83 @@ interface IBuiltInExtension {
const
builtInExtensions
:
IBuiltInExtension
[]
=
JSON
.
parse
(
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
../../product.json
'
),
'
utf8
'
)).
builtInExtensions
;
export
function
packageLocalExtensionsStream
():
Stream
{
const
localExtensionDescriptions
=
(
<
string
[]
>
glob
.
sync
(
'
extensions/*/package.json
'
))
.
map
(
manifestPath
=>
{
const
extensionPath
=
path
.
dirname
(
path
.
join
(
root
,
manifestPath
));
const
extensionName
=
path
.
basename
(
extensionPath
);
return
{
name
:
extensionName
,
path
:
extensionPath
};
})
.
filter
(({
name
})
=>
excludedExtensions
.
indexOf
(
name
)
===
-
1
)
.
filter
(({
name
})
=>
builtInExtensions
.
every
(
b
=>
b
.
name
!==
name
));
const
localExtensions
=
localExtensionDescriptions
.
map
(
extension
=>
{
return
fromLocal
(
extension
.
path
,
false
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
});
type
ExtensionKind
=
'
ui
'
|
'
workspace
'
|
'
web
'
;
interface
IExtensionManifest
{
main
:
string
;
browser
:
string
;
extensionKind
?:
ExtensionKind
|
ExtensionKind
[];
}
/**
* Loosely based on `getExtensionKind` from `src/vs/workbench/services/extensions/common/extensionsUtil.ts`
*/
function
isWebExtension
(
manifest
:
IExtensionManifest
):
boolean
{
if
(
typeof
manifest
.
extensionKind
!==
'
undefined
'
)
{
const
extensionKind
=
Array
.
isArray
(
manifest
.
extensionKind
)
?
manifest
.
extensionKind
:
[
manifest
.
extensionKind
];
return
(
extensionKind
.
indexOf
(
'
web
'
)
>=
0
);
}
return
(
!
Boolean
(
manifest
.
main
)
||
Boolean
(
manifest
.
browser
));
}
const
nodeModules
=
gulp
.
src
(
'
extensions/node_modules/**
'
,
{
base
:
'
.
'
});
return
minifyExtensionResources
(
es
.
merge
(
nodeModules
,
...
localExtensions
)
.
pipe
(
util2
.
setExecutableBit
([
'
**/*.sh
'
]))
export
function
packageLocalExtensionsStream
(
forWeb
:
boolean
):
Stream
{
const
localExtensionsDescriptions
=
(
(
<
string
[]
>
glob
.
sync
(
'
extensions/*/package.json
'
))
.
map
(
manifestPath
=>
{
const
absoluteManifestPath
=
path
.
join
(
root
,
manifestPath
);
const
extensionPath
=
path
.
dirname
(
path
.
join
(
root
,
manifestPath
));
const
extensionName
=
path
.
basename
(
extensionPath
);
return
{
name
:
extensionName
,
path
:
extensionPath
,
manifestPath
:
absoluteManifestPath
};
})
.
filter
(({
name
})
=>
excludedExtensions
.
indexOf
(
name
)
===
-
1
)
.
filter
(({
name
})
=>
builtInExtensions
.
every
(
b
=>
b
.
name
!==
name
))
.
filter
(({
manifestPath
})
=>
(
forWeb
?
isWebExtension
(
require
(
manifestPath
))
:
true
))
);
const
localExtensionsStream
=
minifyExtensionResources
(
es
.
merge
(
...
localExtensionsDescriptions
.
map
(
extension
=>
{
return
fromLocal
(
extension
.
path
,
forWeb
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
})
)
);
}
export
function
packageLocalWebExtensionsStream
():
Stream
{
const
localExtensionDescriptions
=
(
<
string
[]
>
glob
.
sync
(
'
extensions/*/package.json
'
))
.
filter
(
manifestPath
=>
{
const
packageJsonConfig
=
require
(
path
.
join
(
root
,
manifestPath
));
return
!
packageJsonConfig
.
main
||
packageJsonConfig
.
browser
;
})
.
map
(
manifestPath
=>
{
const
extensionPath
=
path
.
dirname
(
path
.
join
(
root
,
manifestPath
));
const
extensionName
=
path
.
basename
(
extensionPath
);
return
{
name
:
extensionName
,
path
:
extensionPath
};
});
let
result
:
Stream
;
if
(
forWeb
)
{
result
=
localExtensionsStream
;
}
else
{
// also include shared node modules
result
=
es
.
merge
(
localExtensionsStream
,
gulp
.
src
(
'
extensions/node_modules/**
'
,
{
base
:
'
.
'
}));
}
return
minifyExtensionResources
(
es
.
merge
(...
localExtensionDescriptions
.
map
(
extension
=>
{
return
fromLocal
(
extension
.
path
,
true
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
}))
return
(
result
.
pipe
(
util2
.
setExecutableBit
([
'
**/*.sh
'
]))
);
}
export
function
packageMarketplaceExtensionsStream
():
Stream
{
const
extensions
=
builtInExtensions
.
map
(
extension
=>
{
return
fromMarketplace
(
extension
.
name
,
extension
.
version
,
extension
.
metadata
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
});
return
minifyExtensionResources
(
es
.
merge
(
extensions
)
.
pipe
(
util2
.
setExecutableBit
([
'
**/*.sh
'
]))
export
function
packageMarketplaceExtensionsStream
(
forWeb
:
boolean
):
Stream
{
const
marketplaceExtensionsDescriptions
=
(
builtInExtensions
.
filter
(({
name
})
=>
(
forWeb
?
marketplaceWebExtensions
.
indexOf
(
name
)
>=
0
:
true
))
);
const
marketplaceExtensionsStream
=
minifyExtensionResources
(
es
.
merge
(
...
marketplaceExtensionsDescriptions
.
map
(
extension
=>
{
const
input
=
fromMarketplace
(
extension
.
name
,
extension
.
version
,
extension
.
metadata
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
return
updateExtensionPackageJSON
(
input
,
(
data
:
any
)
=>
{
delete
data
.
scripts
;
delete
data
.
dependencies
;
delete
data
.
devDependencies
;
return
data
;
});
})
)
);
}
export
function
packageMarketplaceWebExtensionsStream
(
builtInExtensions
:
IBuiltInExtension
[]):
Stream
{
const
extensions
=
builtInExtensions
.
map
(
extension
=>
{
const
input
=
fromMarketplace
(
extension
.
name
,
extension
.
version
,
extension
.
metadata
)
.
pipe
(
rename
(
p
=>
p
.
dirname
=
`extensions/
${
extension
.
name
}
/
${
p
.
dirname
}
`
));
return
updateExtensionPackageJSON
(
input
,
(
data
:
any
)
=>
{
if
(
data
.
main
)
{
data
.
browser
=
data
.
main
;
}
data
.
extensionKind
=
[
'
web
'
];
return
data
;
});
});
return
minifyExtensionResources
(
es
.
merge
(
extensions
)
return
(
marketplaceExtensionsStream
.
pipe
(
util2
.
setExecutableBit
([
'
**/*.sh
'
]))
);
}
...
...
@@ -325,7 +336,7 @@ export interface IScannedBuiltinExtension {
changelogPath
?:
string
,
}
export
function
scanBuiltinExtensions
(
extensionsRoot
:
string
,
forWeb
:
boolean
):
IScannedBuiltinExtension
[]
{
export
function
scanBuiltinExtensions
(
extensionsRoot
:
string
):
IScannedBuiltinExtension
[]
{
const
scannedExtensions
:
IScannedBuiltinExtension
[]
=
[];
const
extensionsFolders
=
fs
.
readdirSync
(
extensionsRoot
);
for
(
const
extensionFolder
of
extensionsFolders
)
{
...
...
@@ -334,10 +345,6 @@ export function scanBuiltinExtensions(extensionsRoot: string, forWeb: boolean):
continue
;
}
let
packageJSON
=
JSON
.
parse
(
fs
.
readFileSync
(
packageJSONPath
).
toString
(
'
utf8
'
));
const
extensionKind
:
string
[]
=
packageJSON
[
'
extensionKind
'
]
||
[];
if
(
forWeb
&&
extensionKind
.
indexOf
(
'
web
'
)
===
-
1
)
{
continue
;
}
const
children
=
fs
.
readdirSync
(
path
.
join
(
extensionsRoot
,
extensionFolder
));
const
packageNLS
=
children
.
filter
(
child
=>
child
===
'
package.nls.json
'
)[
0
];
const
readme
=
children
.
filter
(
child
=>
/^readme
(\.
txt|
\.
md|
)
$/i
.
test
(
child
))[
0
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录