CT 4.0 Summary of Changes
CT 4.0 is a major enhancement over CT 3.11. Most significantly, it is built on top of the new open source version of BladeRunnerJS.
Command changes
There are many small changes in the command syntax used to execute BRJS commands and also tweaks to directory structures and configuration option files. For example, to start the development server, type the following command (in Windows).
brjs serve
To list all new and changed commands type:
brjs help
New coding style
You can write JavaScript code in a more concise idiomatic style as described here. Your old code remains fully supported and interoperates with any code written in the new style.
Unbundled source files in development
When debugging, it is easier to send each individual source file down to the browser rather than concatenating them into a bundle. Line numbers seen in the browser will match those in your source file. By default the following tag causes the server to emit multiple files:
<@js.bundle@/>
To revert to the existing behaviour where all code is downloaded as a single bundle file add the following attribute:
<@js.bundle dev-minifier="combined"@/>
URL version and localisation changes
For previous versions, every time the browser was reloaded in development, the server generated a new version number which was included in the base tag of the index page. Unfortunately this meant that breakpoints were lost between page refreshes, making debugging more difficult. Now in development the URLs remains constant and the HTTP "max-age" response header is set to 0 - forcing all page assets to be re-requested. When a new production artifact is created, a unique version number is assigned that is included in the URLs. The URLs are set to never expire so all assets are cached on the browser until a new version of the app is deployed.
Enhanced dependency analysis
If you want to look at the dependency analysis graph and/or find out why a particular file is being bundled just use the following command:
brjs app-deps dashboard
Which produces the following output:
Aspect 'default' dependencies found: +--- 'default-aspect/index.html' (seed file) | \--- '../../libs/javascript/br/src/br/Core.js' (*) | | \--- '../../libs/javascript/topiarist' | \--- '../../libs/javascript/jquery' (*) | \--- 'libs/wolf-simple-box' (*) | | \--- 'libs/jquery-browser' (static dep.) (*) | \--- 'dashboard-bladeset/blades/app/src/brjs/dashboard/app/DashboardApp.js' | | \--- 'dashboard-bladeset/blades/app/src/brjs/dashboard/app/service/browserdetector/InvalidBrowserDecider.js' | | \--- 'dashboard-bladeset/blades/app/src/brjs/dashboard/app/model/DashboardPresentationModel.js' | | | \--- '../../libs/javascript/br-presenter/src/br/presenter/PresentationModel.js' (static dep.) (*) | | | | \--- '../../libs/javascript/br-presenter/src/br/presenter/node/PresentationNode.js' (static dep.) (*)
BladeRunnerJS Plugins
BRJS introduces a new Plugin architecture to enable deep customisations. You can add new commands or pre-processors for different JavaScript variants (e.g., CofffeScript). An example of creating a command plugin is shown here.
New BladeRunnerJS core libraries
Caplin Trader uses the new core libraries available in BRJS, including:
-
Topiarist: Provides enhanced support for inheritance, mixins and class type checking
-
Emitr: Supports mixing in event handling to any object, thus supporting the JavaScript "emitter pattern" of event notification.
-
Fell: A highly performant logging library that allows configurable logging by class and log level.
-
Event Hub: An implementation of an publish/subscribe service using emitr. You can carry on using the old interface based event hub from Caplin Trader.
-
Component Interface: A new Component interface using the emitr library. You can carry on using the old component interface from Caplin Trader.
See also: