Releases: BladeRunnerJS/brjs
BladeRunnerJS 1.4.0
BladeRunnerJS v1.4.0
BladeRunnerJS v1.4.0 contains some minor changes and a new feature.
New feature
- jstestdriverextensions now exports its functions to make it fully requirable.
API Documentation
BladeRunnerJS 1.3.2
BladeRunnerJS v1.3.2
BladeRunnerJS v1.3.2 contains a number of bug fixes including autocomplete improvements for JQueryAutoCompleteControl and a testing bug-fix that ensures both the ServiceRegistry and AliasRegistry states are cleared down between tests.
Fixed Bugs
- Fixed a bug where the ServiceRegistry and AliasRegistry states weren't cleared when running tests against commonjs style code.
- Fixed a bug which caused acceptance tests to fail while running on Internet Explorer.
- A number of autocomplete improvements for JQueryAutoCompleteControl.
API Documentation
Travis Build Status for v1.3.2:
Closed Issues
The following issues labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport have been closed:
- Add new test and fix different behaviour in ie #1661
- refactor: Rename alias!$data to alias!$aliases-data #1660
- Add js test driver fix for Registry not being cleared after tests #1659
- AliasRegistry / ServiceRegistry not cleared for pure commonjs tests #1657
- refactor: Inline app-metadata require #1656
- Adding clearTextAfterValidInput option to JQueryAutoCompleteControl. #1655
- Locale switcher returns incorrect localised url in IE #1653
- Autocomplete improvements #1639
- Random NullPointerException when refreshing the app #1517
- Implement service-box library #1479
10 issues closed; 10 labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport from 1 milestones:
https://github.com/BladeRunnerJS/brjs/issues?milestone=47&state=closed
Found an Issue?
- https://github.com/BladeRunnerJS/brjs/issues for any existing issues
- https://github.com/BladeRunnerJS/brjs/issues/new to raise a new issues.
Parts of this release note have been auto-generated. If you notice any problems with it tell us
BladeRunnerJS 1.3.1
BladeRunnerJS v1.3.1
BladeRunnerJS v1.3.1 contains a number of bug fixes including a fix that reduces the likelihood of a NullPointerException
which occasionally happens when refreshing an app in development.
Fixed Bugs
- A fix has been provided to improve an issue where a
NullPointerException
causes apps to error when refreshing the page in the dev environment. - Fixed a bug where apps could not be imported when using the same namespace as the original.
- Fixed a bug that caused the dashboard to load slowly.
- A clearer error message is now shown when
test-runner.conf
does not have any browsers defined for a particular OS. - Fixed a compatibility issue in
Fell
whereUtils
were not accessible.
API Documentation
Travis Build Status for v1.3.1:
Closed Issues
The following issues labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport have been closed:
- changing dashboard minifier to improve load speed #1643 #1645
- Dashboard app uses minifier which causes slow loading #1643
- Workbenches and tests not bundling all resources #1632
- Add
service!$data
source module #1622 - improving exception message #1620
11 issues closed; 5 labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport from 1 milestones:
https://github.com/BladeRunnerJS/brjs/issues?milestone=46&state=closed
Found an Issue?
- https://github.com/BladeRunnerJS/brjs/issues for any existing issues
- https://github.com/BladeRunnerJS/brjs/issues/new to raise a new issues.
Parts of this release note have been auto-generated. If you notice any problems with it tell us
BladeRunnerJS 1.3.0
BladeRunnerJS v1.3.0
BladeRunnerJS v1.3.0 is a minor release containing a new command to check for missing i18n and bugfixes to the i18n library.
New I18n Command
The new check-i18n
command will print to the console any i18n tokens which are being used by the app but do not appear in any translation files. It will also generate a CSV file containing all tokens, translations for each locale and whether they are being used in the application.
Fixed Bugs
- Fixed a bug where apps with missing translations were not loading in IE8/9 due to window.console not being defined.
API Documentation
Travis Build Status for v1.3.0:
Closed Issues
The following issues labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport have been closed:
- ensuring ie8 doesnt blow up on i18n warnings when console isnt open #1608
- change i18n to the value to be formatted when not a string or empty #1605
- Plugin to search for missing i18n tokens #1580
5 issues closed; 3 labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport from 1 milestones:
https://github.com/BladeRunnerJS/brjs/issues?milestone=45&state=closed
Found an Issue?
- https://github.com/BladeRunnerJS/brjs/issues for any existing issues
- https://github.com/BladeRunnerJS/brjs/issues/new to raise a new issues.
Parts of this release note have been auto-generated. If you notice any problems with it tell us
v1.2.0
BladeRunnerJS v1.2.0
BladeRunnerJS v1.2.0 contains a number of minor changes and features. It's backwardly compatible with BladeRunnerJS v1.1.
Improvements to missing i18n translation handling
The handling of missing i18n translations has been changed to provide better feedback to developers and translators when there are missing translations, while still ensuring that the app does the best job it can with the translations it has available when running in production. The exact behaviour is described below.
In Production (via brjs build
)
Tokens within HTML templates
The translator first attempts to find a replacement for the active locale, but falls back to using the default locale if one isn't available, causing a warning to be logged to the terminal. If there isn't even a fall-back translation available the build will fail with an error message.
Tokens accessed programmatically in JavaScript
The translator first attempts to find a replacement for the active locale, but falls back to using the default locale if one isn't available, causing a warning to be logged to the browser's console at run-time. If there isn't even a fall-back translation available, a translation of ??? token.name ???
will be used, and an error will be logged to the browser's console at run-time.
In Development (via brjs serve
)
Tokens within HTML templates
The translator first attempts to find a replacement for the active locale, but falls back to displaying a translation of ??? token.name ???
if one isn't available, causing a warning to be logged to the browser's console. In the case where a translation isn't even available in the default locale then logging occurs at error
level rather than warning
level.
Tokens accessed programmatically in JavaScript
The translator first attempts to find a replacement for the active locale, but falls back to using the default locale if one isn't available, causing a warning to be logged to the browser's console. In the case where a translation isn't even available in the default locale then logging occurs at error
level rather than warning
level.
Added a --js-minifier
setting to test
command
The test
command now has the option of specifying the minifier used when building the bundles/js/bundle.js
test bundle; previously, combined
was always used. The minifier can be specified by using the --js-minifier
flag when running tests (e.g. brjs test myApp UTs --js-minifier closure-simple
), where this flag accepts the same set of minifiers as supported by the <@js.bundle ...@/>
tag that's used within index.html
pages.
Note: The minifier flag only configures the minifier to use when a logical path of bundles/js/bundle.js
is used. Fully specified paths will continue to use the defined minifier. For example, closure-whitespace
would be used if the path was bundles/js/dev/closure-whitespace/bundle.js
, regardless of the command line setting.
API Documentation
Travis Build Status for v1.2.0:
Closed Issues
The following issues labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport have been closed:
- Make Observable.getAllObservers public #1575
- CSS bundler does not resolve file paths specified in IE filters #1574
- Add getter function for Properties #1570
- index.html missing from non default aspect when app has a single locale #1568
- Improve error when i18n token is missing #1564
- Aspects with a hyphen in the name aren't accessible without a trailing / in the URL #1562
- Bugfix jquery auto complete box blur in ie8 #1559
- Treat linux64 as a seperate browser 'OS' #1543
- Help command improvements #1541
- Add destroy method for jQueryAutoCompleteControl to clean listeners #1529
- throw an exception if an app is missing jars and a WAR is being built #1525
- Provide a
closure-medium
obfuscation setting #1504 - App deployed in tomcat root causes extra slash to appear in url #1487
- Error thrown when building app with i18n token #1462
- Create a Keybinding service #1428
- New bundle path in tests #1371
- [feature] App level alias override #1071
38 issues closed; 17 labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport from 1 milestones:
https://github.com/BladeRunnerJS/brjs/issues?milestone=43&state=closed
Found an Issue?
- https://github.com/BladeRunnerJS/brjs/issues for any existing issues
- https://github.com/BladeRunnerJS/brjs/issues/new to raise a new issues.
Parts of this release note have been auto-generated. If you notice any problems with it tell us
BladeRunnerJS 1.1.1
BladeRunnerJS v1.1.1
BladeRunnerJS v1.1.1 is a patch release containing two changes.
fell
has been upgraded to v0.1.3. The upgrade contains a backward compatability fix as well as an improvement to theonLog()
callback which makes it easier to use mocking frameworks during tests.- A
ServiceRegistry.dispose()
utility method has been added which callsdispose()
on any services within the registry that implement adispose()
method.ServiceRegistry.dispose()
should be used to clean up any services after an app has been 'unloaded' — this is particularly important for apps that may need to clean up resources on logout or apps, which use popout windows that share state with the parent window.
API Documentation
Travis Build Status for v1.1.1:
Closed Issues
The following issues labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport have been closed:
- add a ServiceRegistry.dispose() method #1537
4 issues closed; 1 labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport from 1 milestones:
https://github.com/BladeRunnerJS/brjs/issues?milestone=42&state=closed
Found an Issue?
- https://github.com/BladeRunnerJS/brjs/issues for any existing issues
- https://github.com/BladeRunnerJS/brjs/issues/new to raise a new issues.
Parts of this release note have been auto-generated. If you notice any problems with it tell us
BladeRunnerJS 1.1.0
BladeRunnerJS v1.1.0
BladeRunnerJS v1.1.0 contains a number of new features along with several bug fixes.
Token replacements can be defined using property files
App tokens (e.g. @XXX.YYY.ZZZ@
) can now be provided using .properties
files, in addition to the existing JNDI mechanism. This finally makes it easy for non J2EE apps to provide differentiated deployments for dev & prod, etc. Additionally, tokens can now be placed into any file, rather than the limited number of file types previously supported — see Using App Tokens for more information.
Ambiguous Tokens
Since tokens are now processed in all JavaScript files this can sometimes lead to exceptions where libraries use a BRJS token like string for a different use from BRJS tokens. See http://bladerunnerjs.org/docs/use/app_tokens/#token-format-ambiguity for more information and libraries known to have this issue.
Favicon Support
Favicons (.favicon
files) located in the root of the app are now served up correctly instead of returning a 404
response.
JS libraries have been converted to CommonJS
The last few remaining libraries have been converted to CommonJS, and are no longer written using namespaced style formatting. This will improve the speed of the dependency analysis, since calculating the dependencies for CommonJS is much quicker. It will also remove the need to globalise all modules to support those remaining namespaced modules. To see any benefits your app must also be changed so that it is entirely composed of CommonJS modules.
While this doesn't cause any backwards compatibility issues with public API, it will likely cause any patches you have (files within js-patches
) to break. Fixing these simply requires you to stop fully qualifying the class name in your patches too (e.g. PresentationModel
instead of br.presenter.PresentationModel
). Ideally, a pull request against the main code-base should be also be raised, since patches are intended for temporary changes only.
Bug Fixes & Minor Improvements
The following bug fixes and improvements were also made in this release:
_
characters are now supported in version strings supplied via the-v
flag.- Cutom error pages configured via
web.xml
are now used correctly in the BRJS development server. - Performance issues in tests, created in v1.0 by a change to use
<template>
tags in the HTML resource service, have been fixed. - The
brjs
script works correctly in the latest version of GitBash. - The
test
command now works correctly with symlinks on *nix. - A bug that could cause some CSS resources to not appear in the WAR has been fixed.
- A bug that caused a stackoverflow in IE8 when tests used multiple
continuesFrom()
calls has been fixed. - Fields prefixed with
m_
or_
are now treated as private within Presenter view models, and will not be used when calculating child nodes and traversing the model tree. - Several BRJS microlibraries shipped within BladeRunnerJS have been updated. Fell has been updated to v0.1.3, Topiarist to v0.1.4 and Emitr to v0.0.8.
API Documentation
Travis Build Status for v1.1.0:
Closed Issues
The following issues labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport have been closed:
- allow any jre/lib files to be accessed during tests #1544
- allow access to .dat files during test to fix java8u60 eclipse tests #1542
- using sham fix for getPrototypeOf #1531
- Multiple continuesFroms lead to stackoverflow in IE8 #1523
- m_ and _ fields are now private and extra tests for MappedNodeList #1516
- change HtmlResourceService to only loads HTML when no templates are loaded #1515
- Make ViewFixture errors more useful #1513
- css resources referenced by libs not being bundled in the WAR #1512
- Fix MappedNodeList broken paths bug #1506
- Error pages cannot be accessed when BRJS is serving files #1502
- Upgrade Fell, Topiarist and Emitr to latest versions #1498
- Initializing the knockout plugin after the template has been attached may be incompatible with some apps #1497
- build-app throws exception when using a version containing underscores #1494
- Make our micro-libraries more like other Idiomatic JavaScript micro-libraries #1481
- moving the aliasing spec utils into src/main #1465
- Extend the JQueryAutoCompleteControl to allow setting a option to blur after click #1464
- Convert libs to common-js #1444
- Can't run tests if project is in a symlinked path #1384
- support favicon.ico in apps #1381
- move the bundlePath token logic into a single shared location #775
- allow the use of tokens when exporting to static files #749
- We need to convert 'br' libraries to CommonJs style to prevent globalization of apps #424
38 issues closed; 22 labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport from 1 milestones:
https://github.com/BladeRunnerJS/brjs/issues?milestone=35&state=closed
Found an Issue?
- https://github.com/BladeRunnerJS/brjs/issues for any existing issues
- https://github.com/BladeRunnerJS/brjs/issues/new to raise a new issues.
Parts of this release note have been auto-generated. If you notice any problems with it tell us
BladeRunnerJS 1.0.2
BladeRunnerJS 1.0.2
BRJS 1.0.2 fixes two minor bugs.
- Fix for "request form name 'null' hasn't been registered" exception that was thrown if a library contained a 'themes' directory
- Returning an empty string as a token replacement if the JNDI lookup returns null due to an empty JNDI entry
API Documentation
Travis Build Status for v1.0.2:
Closed Issues
The following issues labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport have been closed:
- An empty string should be returned if the JNDI lookup returns null. #1460
- 'themes' dirs in libs cause
request form name 'null' hasn't been registered
when building apps #1443
4 issues closed; 2 labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport from 1 milestones:
https://github.com/BladeRunnerJS/brjs/issues?milestone=39&state=closed
Found an Issue?
- https://github.com/BladeRunnerJS/brjs/issues for any existing issues
- https://github.com/BladeRunnerJS/brjs/issues/new to raise a new issues.
Parts of this release note have been auto-generated. If you notice any problems with it tell us
BladeRunnerJS 1.0.1
BladeRunnerJS 1.0.1
BRJS 1.0.1 fixes a major bug in BRJS 1.0 which prevented locale redirection working in IE. It also includes several other minor bugs fixes and improvements.
Strict mode warning in IE
BRJS 1.0 introduced a change where the HTML template service uses template
tags across all browsers. To enable this in IE8+ it includes a shim which requires the browser to be in strict mode. A bug was introduced where the internal redirection page wasn't in strict mode which prevent multi locale apps working in IE*. This is fixed in 1.0.1.
Other minor fixes + improvements
- BRJS no longer incorrectly determines test folder paths if an empty
test
directory exists inside of a test location - Warnings can now be hidden with the
-q
flag. With this flag onlyerror
level messages will be displayed. - The bundled
Emitr
microlibrary has been updated to show errors thrown by event handlers rather than swallowing them. - Presenter
Parser
s no longer go in to an infinite loop if a value isNaN
. - Presenter
OptionsNodeList.getOptionByLabel()
now supports anignoreCase
argument - Presenter
Parser
s can now be removed fromEditableProperty
s. TimeoutUtility
now supports timeouts within timeouts.index.jsp
can now send redirects usingresponse.sendRedirect()
.
API Documentation
Travis Build Status for v1.0.1:
Closed Issues
The following issues labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport have been closed:
- Fix for index.jsp tokens not being replaced #1457
- Warning about strict mode in IE* #1453
- response.sendRedirect doesn't work in index.jsp #1450
- allowing nested setTimeouts in TimeUtility #1449
- allowing parsers to be removed from EditableProperty #1448
- warn if location of tests dir is ambiguous #1446
- Feature add ignore case to presenter OptionsNodeList #1431
- Allow NaN to be handled by parsers without getting into an infinite l… #1429
- [EMITR] Emitr shouldn't silently swallow errors in user code #1422
- Allow hiding warnings from BRJS #1409
- BRJS could be more friendly when leftover test folders are present #1302
18 issues closed; 11 labelled bug, feature, enhancement, experience, breaking-change, java-api, js-api or CaplinSupport from 1 milestones:
https://github.com/BladeRunnerJS/brjs/issues?milestone=38&state=closed
Found an Issue?
- https://github.com/BladeRunnerJS/brjs/issues for any existing issues
- https://github.com/BladeRunnerJS/brjs/issues/new to raise a new issues.
Parts of this release note have been auto-generated. If you notice any problems with it tell us
BladeRunnerJS 1.0
BladeRunnerJS 1.0
1.0 Features and Improvements
1.0 completes the 1.0 Roadmap which includes:
- In-built EventHub
- Node.js style client-side code
- Modularised application development and workbench developer tools
- Flat file and WAR deployment
- Global install
- A plugin architecture for custom asset types and bundled content
Backwards Compatability
Plugin API changes
The plugin API has changed considerably. Existing plugins will need to be updated to use the new API. This change does not affect application code, only Java plugins.
Other than the above, 1.0 is compatible with v0.15.4.
service!
no longer caches
The service!
notation no longer permanently caches the services that are returned, so that changes to the ServiceRegistry
are reflected in the next require('service!my-service')
invocation that is made.
Since ServiceRegister.clear()
is automatically invoked at the end of every test, this may cause tests to break for tests that require services for the duration of the test suite (e.g. within describe()
), rather than at the beginning of each test (e.g. within beforeEach()
).
Clock
utility must be installed before it is used
BRJS provides a 'Clock' class inside of 'jsunitextensions' which allows tests to validate behaviour inside of 'setTimeout' callbacks. Before the utility can be used it must now be 'installed' in the test setup and uninstall in the tear down, for example your test might look like the following:
require('jsunitextensions');
var MyTest = TestCase('MyTest');
MyTest.prototype.setUp = function() {
Clock.install();
}
MyTest.prototype.tearDown = function() {
Clock.uninstall();
}
MyTest.prototype.testSomething = function() {
// something that sets a timeout
Clock.tick(1000);
// verify the behaviour
}
Presenter no longer clones templates and removes IDs
Previously the Presenter
library was responsible for cloning templates returned from the HTML service and removing their IDs. This logic has now been moved into the HTML service. For most apps this will have no affect, however any apps or tests that were previously relying on being able to change a template via the DOM and have this persisted each time the template was requested will need to be changed. It's also worth noting that it's no longer required to clone templates or remove IDs as this is now done before the template is returned from the HTML service.
Bug fixes and features since v0.15.x
Changes to XML namespaces (xmlns
)
The XML namespaces used for BladeRunnerJS XML config has changed to use the schema.bladerunnerjs.org
domain - the old and new namespaces are shown below. All instances of the previous namespaces should be replaced with the new namespace. Apps using the old namespace will continue to work, although it has been deprecated and a warning will be logged.
http://schema.caplin.com/CaplinTrader/aliasDefinitions -> http://schema.bladerunnerjs.org/aliasDefinitions
http://schema.caplin.com/CaplinTrader/aliases -> http://schema.bladerunnerjs.org/aliases
http://schema.caplin.com/CaplinTrader/bundleConfig -> http://schema.bladerunnerjs.org/bundleConfig
http://schema.caplin.com/CaplinTrader/presenterComponent -> http://schema.bladerunnerjs.org/presenterComponent
Reviewed Plugin API
The plugin API has been reviewed and the mechanism for discovering assets has been simplified. For most users of BRJS who haven't written their own plugins this change won't have any affect, however it is a backwards incompatibility for existing plugins.
AssetPlugin
The previous AssetLocation
and AssetPlugin
interfaces have been replaced by a single new AssetPlugin
interface.
The new AssetPlugin
interface has a single method:
List<Asset> discoverAssets(AssetContainer assetContainer,
MemoizedFile dir, String requirePrefix, List<Asset> implicitDependencies,
AssetRegistry assetRegistry)
The discoverAssets
is called by the asset discovery mechanism and is the chance for each plugin to register assets. Assets can be registered using the supplied AssetRegistry
which has the following interface.
public void registerSeedAsset(LinkedAsset asset)
public void promoteRegisteredAssetToSeed(LinkedAsset asset)
public void registerAsset(Asset asset)
boolean hasSeedAsset(String requirePath)
boolean hasRegisteredAsset(String requirePath)
public Asset getRegisteredAsset(String requirePath)
public List<Asset> discoverFurtherAssets(MemoizedFile dir, String requirePrefix, List<Asset> implicitDependencies)
This provides the flexibility for each AssetPlugin
to register all assets in nested directories at the same time via registerAsset
or registering assets for the supplied directory and optionally using discoverFurtherAssets
to allow additional directories to be discovered by other plugins that aren't already discovered by the existing BRJS plugin.
An example AssetPlugin
is the CssAssetPlugin
which discovers all assets in the supplied directory.
if (assetContainer.dir() == dir) {
return Collections.emptyList();
}
if (!requirePrefix.contains("!")) {
requirePrefix = "css!"+requirePrefix;
}
for (MemoizedFile cssFile : dir.listFiles(cssFileFilter)) {
if (!assetRegistry.hasRegisteredAsset(FileAsset.calculateRequirePath(requirePrefix, cssFile))) {
Asset asset = new FileAsset(cssFile, assetContainer, requirePrefix);
assetRegistry.registerAsset( asset );
}
}
Other API changes
There have been several other minor changes to the Plugin API.
- The abstract class
ArgsParsingCommandPlugin
has been renamed toJSAPArgsParsingCommandPlugin
- The method
TagHanderPlugin
getDependentContentPluginRequestPrefixes()
method has been renamed tousedContentPluginRequestPrefixes()
- All BRJS model interfaces that form the model API have been moved to the
org.bladerunnerjs.api
package
More information about the API can be found in the JavaDocs, http://apidocs.bladerunnerjs.org/latest/java/index.html.
Plugin Ordering
Plugins were previously ordered by using methods on the Plugin
API. This has now been moved to brjs.conf
and so is used controllable. The new option in brjs.conf
is orderedPlugins
which can be used to define the order for any plugins where ordering is important, AssetPlugin
s and ContentPlugin
s.
The default ordering config is:
...
orderedPlugins:
AssetPlugin:
- ThirdpartyAssetPlugin
- BrowsableNodeSeedLocator
- BRJSConformantAssetPlugin
- '*'
ContentPlugin:
- I18nContentPlugin
- AppMetadataContentPlugin
- ThirdpartyContentPlugin
- CommonJsContentPlugin
- NamespacedJsContentPlugin
- '*'
...
The name of each plugin should be included in the configuration. '*'
can be used to match all other plugins.
HTML service improvements
Localisation pages must have a DOCTYPE
The HTML service has been changed to make use of template
elements. A shim is provided so IE8+ can use template
elements but this requires the browser to be in 'strict mode'. To enable this pages should have a DOCTYPE
, for example <!DOCTYPE html>
.
getHTMLTemplate(id)
deprecated
The getHTMLTemplate(id)
method has now been deprecated in favor of getTemplateElement(id)
& getTemplateFragment(id)
. getTemplateElement(id)
will return a cloned element for the template ID provided if the template contains a single 'top level' element, otherwise an exception will be thrown. getTemplateFragment(id)
will return a document fragment, a collection of cloned elements, for the template ID and is the recommended method for retrieving templates.
Embedded HTML templates
The HTML service now allows templates to be provided inside <template/>
tags, and automatically wraps any templates that aren't inside <template/>
tags. Additionally, a fresh element or document fragment is provided when a template is requested, rather than providing the same DOM element each time.
HTML templates can now also be embedded in index.html
rather than loading them via a separate XHR request. To do this you'll need to include <@html.bundle@/>
in the <head>
of the page, but can then continue to use the HTML service as before.
Existing apps and templates will still be compatible with these changes — see #1338 & #1352 for more information.
Apps can now live separately from the toolkit
The current working directory when brjs
is executed is now used to detirmine where applications are on disk, meaning they can be placed anywhere and don't have to be placed next to the sdk
directory.
Apps should be placed within a brjs-apps
directory anywhere on the disk. If commands are executed inside of the brjs-apps
directory this directory will be used to locate applications. Commands can also be executed from within an app, in which case the parent directory of the application will be used to locate apps.
This change is backwards compatible with previous app locations. If apps are contained within an apps
directory which is next to the sdk
directory the previous apps
directory will be used and a deprecation warning logged.
Configurable App Version
The app version can now be configured via the serve
and build-app
commands. With either command the -v
or --version
flag can be used to provide a custom version, for example brjs build-app myApp -v 1.2.3
. The current timestamp will be appended to the version to create a truely unique version in order to provide reliable cache invalidation. require(service!br.app-meta-service).getVersion()
can then be used to access the version.
Setting the version via the serve
command has the limitation where the version will be set for every app within that BRJS instance. For example if both the foo
and bar
apps exist and `brjs serv...