Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gzupanda
code-server
提交
68709480
C
code-server
项目概览
gzupanda
/
code-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
68709480
编写于
11月 03, 2020
作者:
A
Anmol Sethi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
plugin.ts: Make application endpoint paths absolute
上级
139a28e0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
13 deletion
+20
-13
src/node/plugin.ts
src/node/plugin.ts
+5
-3
test/plugin.test.ts
test/plugin.test.ts
+3
-2
test/test-plugin/Makefile
test/test-plugin/Makefile
+2
-1
test/test-plugin/src/index.ts
test/test-plugin/src/index.ts
+2
-1
typings/pluginapi.d.ts
typings/pluginapi.d.ts
+8
-6
未找到文件。
src/node/plugin.ts
浏览文件 @
68709480
...
...
@@ -60,6 +60,8 @@ export class PluginAPI {
// Add plugin key to each app.
apps
.
push
(
...
pluginApps
.
map
((
app
)
=>
{
app
=
{...
app
,
path
:
path
.
join
(
p
.
routerPath
,
app
.
path
||
""
)}
app
=
{...
app
,
iconPath
:
path
.
join
(
app
.
path
||
""
,
app
.
iconPath
)}
return
{
...
app
,
plugin
:
{
...
...
@@ -69,7 +71,7 @@ export class PluginAPI {
displayName
:
p
.
displayName
,
description
:
p
.
description
,
path
:
p
.
p
ath
,
routerPath
:
p
.
routerP
ath
,
},
}
}),
...
...
@@ -192,8 +194,8 @@ export class PluginAPI {
if
(
!
p
.
description
)
{
throw
new
Error
(
"
plugin missing description
"
)
}
if
(
!
p
.
p
ath
)
{
throw
new
Error
(
"
plugin missing path
"
)
if
(
!
p
.
routerP
ath
)
{
throw
new
Error
(
"
plugin missing
router
path
"
)
}
p
.
init
({
...
...
test/plugin.test.ts
浏览文件 @
68709480
...
...
@@ -21,7 +21,8 @@ describe("plugin", () => {
version
:
"
4.0.0
"
,
description
:
"
This app does XYZ.
"
,
iconPath
:
"
/icon.svg
"
,
iconPath
:
"
/test-plugin/test-app/icon.svg
"
,
path
:
"
/test-plugin/test-app
"
,
plugin
:
{
name
:
"
test-plugin
"
,
...
...
@@ -30,7 +31,7 @@ describe("plugin", () => {
displayName
:
"
Test Plugin
"
,
description
:
"
Plugin used in code-server tests.
"
,
p
ath
:
"
/test-plugin
"
,
routerP
ath
:
"
/test-plugin
"
,
},
},
],
...
...
test/test-plugin/Makefile
浏览文件 @
68709480
out/index.js
:
src/index.ts
yarn build
# Typescript always emits, even on errors.
yarn build
||
rm
out/index.js
node_modules
:
package.json yarn.lock
yarn
test/test-plugin/src/index.ts
浏览文件 @
68709480
...
...
@@ -3,7 +3,7 @@ import * as fspath from "path"
import
*
as
pluginapi
from
"
../../../typings/pluginapi
"
export
const
displayName
=
"
Test Plugin
"
export
const
p
ath
=
"
/test-plugin
"
export
const
routerP
ath
=
"
/test-plugin
"
export
const
description
=
"
Plugin used in code-server tests.
"
export
function
init
(
config
:
pluginapi
.
PluginConfig
)
{
...
...
@@ -24,6 +24,7 @@ export function applications(): pluginapi.Application[] {
name
:
"
Test App
"
,
version
:
"
4.0.0
"
,
iconPath
:
"
/icon.svg
"
,
path
:
"
/test-app
"
,
description
:
"
This app does XYZ.
"
,
},
...
...
typings/pluginapi.d.ts
浏览文件 @
68709480
...
...
@@ -45,7 +45,9 @@ import * as express from "express"
*
* There is also a /api/applications endpoint to allow programmatic access to all
* available applications. It could be used to create a custom application dashboard
* for example.
* for example. An important difference with the API is that all application paths
* will be absolute (i.e have the plugin path prepended) so that they may be used
* directly.
*/
/**
...
...
@@ -60,30 +62,30 @@ export interface Plugin {
*
* Fetched from package.json.
*/
name
?:
string
readonly
name
?:
string
/**
* The version for the plugin in the overlay.
*
* Fetched from package.json.
*/
version
?:
string
readonly
version
?:
string
/**
* Name used in the overlay.
*/
displayName
:
string
readonly
displayName
:
string
/**
* Used in overlay.
* Should be a full sentence describing the plugin.
*/
description
:
string
readonly
description
:
string
/**
* The path at which the plugin router is to be registered.
*/
p
ath
:
string
readonly
routerP
ath
:
string
/**
* init is called so that the plugin may initialize itself with the config.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录