Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
Koishi Thirdeye
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
Koishi Thirdeye
Commits
2c25ae0f
Commit
2c25ae0f
authored
Dec 28, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix plugin types again
parent
4c5d536c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
11 deletions
+50
-11
package-lock.json
package-lock.json
+1
-1
src/def/interfaces.ts
src/def/interfaces.ts
+18
-8
tests/inner-plugin.spec.ts
tests/inner-plugin.spec.ts
+29
-0
tests/on-apply.spec.ts
tests/on-apply.spec.ts
+2
-2
No files found.
package-lock.json
View file @
2c25ae0f
...
...
@@ -38,7 +38,7 @@
"ws"
:
"^8.2.3"
},
"peerDependencies"
:
{
"koishi"
:
"^4.0.0-rc.
0
"
"koishi"
:
"^4.0.0-rc.
1
"
}
},
"node_modules/@babel/code-frame"
:
{
...
...
src/def/interfaces.ts
View file @
2c25ae0f
...
...
@@ -24,22 +24,32 @@ export interface ContextSelector {
export
type
KoishiPluginOptions
<
T
extends
Plugin
>
=
boolean
|
Plugin
.
Config
<
T
>
;
export
interface
KoishiModulePlugin
<
T
extends
Plugin
>
extends
ContextSelector
{
plugin
:
T
|
string
;
options
?:
boolean
|
KoishiPluginOptions
<
T
>
|
any
;
export
interface
KoishiModulePluginExact
<
T
extends
Plugin
>
extends
ContextSelector
{
plugin
:
T
;
options
?:
boolean
|
KoishiPluginOptions
<
T
>
;
}
export
function
PluginDef
<
T
extends
keyof
Plugin
>
(
export
interface
KoishiModulePluginName
extends
ContextSelector
{
plugin
:
string
;
options
?:
any
;
}
export
type
KoishiModulePlugin
<
T
extends
Plugin
=
any
>
=
|
KoishiModulePluginExact
<
T
>
|
KoishiModulePluginName
;
export
function
PluginDef
(
name
:
string
,
options
?:
any
,
select
?:
Selection
,
);
)
:
KoishiModulePluginName
;
export
function
PluginDef
<
T
extends
Plugin
>
(
plugin
:
T
,
options
?:
Koishi
ModulePlugin
<
T
>
,
options
?:
Koishi
PluginOptions
<
T
>
,
select
?:
Selection
,
);
export
function
PluginDef
<
T
extends
keyof
Plugin
>
(
)
:
KoishiModulePluginExact
<
T
>
;
export
function
PluginDef
<
T
extends
Plugin
>
(
plugin
:
T
,
options
?:
KoishiPluginOptions
<
T
>
,
select
?:
Selection
,
...
...
tests/inner-plugin.spec.ts
0 → 100644
View file @
2c25ae0f
import
{
App
}
from
'
koishi
'
;
import
{
DefinePlugin
}
from
'
../src/register
'
;
import
{
UsePlugin
}
from
'
../src/decorators
'
;
import
{
PluginDef
}
from
'
../src/def
'
;
import
PluginLru
from
'
@koishijs/plugin-cache-lru
'
;
import
PluginOnebot
from
'
@koishijs/plugin-adapter-onebot
'
;
@
DefinePlugin
()
class
MyPlugin
{
@
UsePlugin
()
loadLru
()
{
return
PluginDef
(
PluginLru
);
}
@
UsePlugin
()
loadOnebot
()
{
return
PluginDef
(
PluginOnebot
,
{
bots
:
[]
});
}
}
describe
(
'
Inner plugin
'
,
()
=>
{
let
app
:
App
;
beforeEach
(()
=>
{
app
=
new
App
();
// app.plugin(PluginOnebot, { bots: [] });
});
it
(
'
should load inner plugin properly
'
,
()
=>
{});
});
tests/on-apply.spec.ts
View file @
2c25ae0f
...
...
@@ -94,8 +94,8 @@ describe('Apply and Connect in koishi-thirdeye', () => {
app
.
plugin
(
MyPlugin2
);
await
RunApplyTest
(
app
);
});
/*
it('should be applied and connected with non-immediate dependency', async () => {
it
(
'
should be applied and connected with non-immediate dependency
'
,
async
()
=>
{
app
.
plugin
(
MyPlugin3
);
await
RunApplyTest
(
app
);
});
*/
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment