@@ -7,15 +7,6 @@ local scope = require 'workspace.scope'
77local ws = require ' workspace'
88local fs = require ' bee.filesystem'
99
10- --- @class pluginInterfaces
11- local pluginConfigs = {
12- -- create plugin for vm module
13- VM = {
14- OnCompileFunctionParam = function (next , func , source )
15- end
16- }
17- }
18-
1910--- @class plugin
2011local m = {}
2112
@@ -60,14 +51,13 @@ function m.dispatch(event, uri, ...)
6051 return failed == 0 , res1 , res2
6152end
6253
63- function m .getVmPlugin (uri )
54+ function m .getPluginInterfaces (uri )
6455 local scp = scope .getScope (uri )
65- --- @type pluginInterfaces
6656 local interfaces = scp :get (' pluginInterfaces' )
6757 if not interfaces then
6858 return
6959 end
70- return interfaces . VM
60+ return interfaces
7161end
7262
7363--- @async
@@ -100,40 +90,6 @@ local function checkTrustLoad(scp)
10090 return true
10191end
10292
103- local function createMethodGroup (interfaces , key , methods )
104- local methodGroup = {}
105-
106- for method in pairs (methods ) do
107- local funcs = setmetatable ({}, {
108- __call = function (t , next , ...)
109- if # t == 0 then
110- return next (... )
111- else
112- local result
113- for _ , fn in ipairs (t ) do
114- result = fn (next , ... )
115- end
116- return result
117- end
118- end
119- })
120- for _ , interface in ipairs (interfaces ) do
121- local func = interface [method ]
122- if not func then
123- local namespace = interface [key ]
124- if namespace then
125- func = namespace [method ]
126- end
127- end
128- if func then
129- funcs [# funcs + 1 ] = func
130- end
131- end
132- methodGroup [method ] = funcs
133- end
134- return # methodGroup > 0 and methodGroup or nil
135- end
136-
13793--- @param uri uri
13894local function initPlugin (uri )
13995 await .call (function () --- @async
@@ -206,10 +162,6 @@ local function initPlugin(uri)
206162 interfaces [# interfaces + 1 ] = interface
207163 end
208164
209- for key , config in pairs (pluginConfigs ) do
210- interfaces [key ] = createMethodGroup (interfaces , key , config )
211- end
212-
213165 ws .resetFiles (scp )
214166 end )
215167end
0 commit comments