Open Oceanswave opened 6 years ago
The upstream changes should be incorporated in ChakraCore 1.9.x
This functionality is now partially implemented thanks to the upstream changes in ChakraCore 1.10.x.
The relevant sections of BaristaModuleRecord.cs still parse script, however, as 1) It doesn't appear to be able to set variables in namespaces 2) attempting to eval getnamespace during module loading breaks the runtime and throws an exception.
Thanks to https://github.com/Microsoft/ChakraCore/pull/4707, it's now possible to programmatically get at namespace objects.
This allows the functionality in https://github.com/BaristaLabs/BaristaCore/blob/master/src/BaristaLabs.BaristaCore.Common/BaristaContext.cs#L456 and https://github.com/BaristaLabs/BaristaCore/blob/master/src/BaristaLabs.BaristaCore.Common/BaristaModuleRecord.cs#L260
to no longer rely on a 'shim' script in order to get at the variables exported by modules. This should improve execution speed, remove pollution of the global namespace, reduce the possibility of down-stream side effects, and allow the export of non-default values as well.