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.

In order to take advantage of advances in JavaScript tooling, support for NamespacedJS will be dropped in the next major release of Caplin Trader following Caplin Trader 4.

For an introduction to the differences between NamespacedJS and CommonJS module formats, see Module format.

Compatibility notes

The conversion to CommonJS has the following implications for your code:

  • All JavaScript patches under js-patches must be in CommonJS format.

  • Namespaced references continue to be recognised within NamespacedJS modules.

  • Namespaced references are no longer recognised within CommonJS modules.

    • Use require to get a reference to a class. For example, to get a reference to the class br.validation.ISODateValidator, use 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 notifyAfterClassLoad, use var notifyAfterClassLoad = require('caplin/notifyAfterClassLoad')

  • Use of caplin.thirdparty('thirdparty_library_name') should be replaced with require('thirdparty_library_name'). For example, to reference the library sljs, use 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 br.presenter-component, use 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.


See also: