You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is to be able to inject repetitive code inside all ACEs in the compilation step.
You could define an object of middlewares, where each key is a RegEx pattern to match the ACE function signature, and the value is a callback of the injected code.
The idea of the sintaxis is meant to be simple as you were writing normal code, however I suspect it will be a pain to implement, as this code will probably need to be transformed to an AST and probably recursively walked through without actually evaluating it:
The following parameters can be used on the function:
self: The instance reference. This should be replaced to this in the compilation step.
next: A reference of the next middleware callback. This will need to get the values of each parameter passed through AST, this allows more flexibility to mutate for the developer.
name: The function signature of the ACE.
type: The type of the ACE to check.
An alternative to AST, and replacing values, is to have this on runtime. Injecting the callbacks inside the code. If so, the way to do it would be:
Convert string values from @AceClass.middlewares to AST.
Then validate the node is a function.
Then instantiate a new Function(...) with it.
The text was updated successfully, but these errors were encountered:
The idea is to be able to inject repetitive code inside all ACEs in the compilation step.
You could define an object of middlewares, where each key is a RegEx pattern to match the ACE function signature, and the value is a callback of the injected code.
The idea of the sintaxis is meant to be simple as you were writing normal code, however I suspect it will be a pain to implement, as this code will probably need to be transformed to an AST and probably recursively walked through without actually evaluating it:
The following parameters can be used on the function:
self
: The instance reference. This should be replaced tothis
in the compilation step.next
: A reference of the next middleware callback. This will need to get the values of each parameter passed through AST, this allows more flexibility to mutate for the developer.name
: The function signature of the ACE.type
: The type of the ACE to check.An alternative to AST, and replacing values, is to have this on runtime. Injecting the callbacks inside the code. If so, the way to do it would be:
The text was updated successfully, but these errors were encountered: