Developing a suite of JSVM middleware components. Is there anyway to have a shared set of functions defined in another file that they can all share? or call one another?
You can put shored code into the tyk.js file, though you would need to make sure that you back this up as it might get deleted or replaced on an upgrade. This code is parsed first and so can be made available to all JSVM functions.
thats parsed and cached on a gateway restart? or per API request invocation?
TykJS gets parsed on gateway start, not hot-reload, so it should only be used for shared code, nothing dynamic that relies on API config data.
All JSVM MW code is parsed and cached on hot-reload, nothing gets parsed at runtime, it's too slow.