CT 4.4 Upgrade Guide
|If you are upgrading from a version prior to Caplin Trader 4.x, read CT 4.0 Upgrade Guide: Configuration and CT 4.0 Upgrade Guide: Code first.|
Caplin Trader 4.4 is the first version of Caplin Trader 4 to be released with all SDK modules written in CommonJS format. While NamespacedJS is still supported as a module format in Caplin Trader 4.4, the move to CommonJS as the format for all SDK modules has changed some aspects of the bundling process. This page outlines the compatibility implications this has for your code.
For an introduction to the differences between NamespacedJS and CommonJS module formats, see Module format.
The conversion to CommonJS has the following implications for your code:
js-patchesmust be in CommonJS format.
Namespaced references continue to be recognised within NamespacedJS modules.
Namespaced references are no longer recognised within CommonJS modules.
requireto get a reference to a class. For example, to get a reference to the class
var ISODateValidator = require('br/validation/ISODateValidator')
Caplin-bootstrap methods are now also available as method-specific modules. For example, to get a reference to the caplin-bootstrap method
var notifyAfterClassLoad = require('caplin/notifyAfterClassLoad')
caplin.thirdparty('thirdparty_library_name')should be replaced with
require('thirdparty_library_name'). For example, to reference the library
var sljs = require('sljs')
In applications without any NamespacedJS modules, class definitions for aliases are no longer implicitly bundled. To bundle the class-definition for an alias, use
require('alias!logical_alias'). For example, to bundle the class definition for the alias
require('alias!br.presenter-component'). For more information on aliases, see Inversion of Control using the AliasRegistry on the BladeRunnerJS website.
There is a small chance that CommonJS code within your codebase may raise circular-dependency errors. For the reasons why these errors occur and for guidance on how to resolve the errors, see BladeRunnerJS: CommonJS Compliance on the BladeRunnerJs website.
Converting your code to CommonJS format
Support for NamespacedJS will be dropped in the next major release of Caplin Trader after Caplin Trader 4. To maintain a clean upgrade path to later releases of Caplin Trader, we recommend that you convert your code to CommonJS format. For more information on the conversion process, see Migration path from NamespacedJS to CommonJS.