Releases: seznam/IMA.js-core
0.16.0
First, we'd like to point out, that we have improved homepage of IMA.js and written a more complex documentation. Some of following change logs points to the new documentation.
Changelog
-
Introduced PageManagerHandlers that allows you to step into page management process by writing custom handlers. With this feature you can modify or cancel page transition process before it happens and react to it after it has happened. → PageManagerHandlers documentation.
-
Moved scroll position saving and restoration to dedicated PageManagerHandler. It's called PageNavigationHandler and you can see how it's used on a documentation page. This handler sets
window.history.scrollRestoration
property.
if ('scrollRestoration' in browserWindow.history) {
browserWindow.history.scrollRestoration = 'manual';
}
-
Extensions can obtain partial state from controller and preceding extensions. Whenever a
getState()
method is called in extension'sload
method it returns most recent page state. → Partial state documentation -
Added utility for executing asynchronous jobs in various ways. For now only
SerialBatch
is implemented. In near futureParallelBatch
andPipeline
execution methods will be implemented.
import SerialBatch from 'ima/execution/SerialBatch';
const serialBatch = new SerialBatch([asyncFunc, MyClass.staticAsync, myInstance.memberAsync]);
serialBatch.append(asyncFunc3);
serialBatch.execute(argument, argument2).then(results => {
// results = array of results from each function in the same order they were added to SerialBatch
});
-
Router passes an action object to PageManager carrying infomation about event that triggered the routing. This object also appears in
BEFORE_HANDLE_ROUTE
andAFTER_HANDLE_ROUTE
events and in PageManagerHandler callbacks. -
Using new React context API in ViewAdapter. #137
-
Allowed to override default
cache: false
option for requests withPOST
,PUT
,PATCH
orDELETE
method. 198be8c -
Added validation to EventBus listener to check if the event is actually an IMA_EVENT. #148
-
Fixed: Http options withCredentials is set to false by default.
-
Fixed bug that caused a blank error page to appear when an error in react component was thrown.
componentDidCatch
method was added to ViewAdapter. 603789e -
Fixed bug that caused
undefined
appearing in URL when callingWindow.pushState
orWindow.replaceState
in IE11 without the url argument specified (undefined). 8cd8f86 -
Fixed EventBus
unlistenAll
method to remove proper listeners. #148 -
Fixed Cookies bug - ensuring that cookies from server response are always in array before being set on client side. #154
-
Updated dependencies:
- babel-eslint:
^3.3.0
→^3.6.0
- eslint:
^4.19.1
→^5.4.0
- gulp:
github:gulpjs/gulp#c120a94
→^4.0.0
- gulp-babel:
^7.0.1
→^8.0.0
- jest:
^23.1.0
→^23.6.0
- prettier:
^1.13.5
→^1.14.3
- react:
16.2.0
→16.6.3
- react-dom:
16.2.0
→16.6.3
- babel-eslint:
0.15.2
0.15.1
Changelog
- Switch from superagent to the natvie fetch api #98
- Added new rules for match route expressions in this order:
'/:catId-:catName' for path '/20089-white-roses'
- Breaking changes: The optional param in route expression can be only at the end.
//BAD
'/home/:userId/something/:?optional/:somethingId'
//GOOD
'/home/:userId/something/:somethingId/:?optional'
- Added support for two production bundle es5 and es. The es define you as EcmaScript features which are not transpiled in babelConfig.js. It cause improving development process and reduction client bundle size for majority users.
// bundle only esx version
npm run dev
// bundle es5 and esx versions
npm run dev --legacy-compat-mode
// bundle es5 and esx versions for production
npm run build
- Added onLoad and onError methods to
$IMA.Runner
for the reporting purpose. - Added ima-clientify and loose-envify transformations to browserify.
- Added Event Dispatcher publicly accessible throught
$IMA.$Dispatcher
#105 - Added support for the @server-side compilation flag which reduce client bundle size ima-clienify.
// @server-side class ServerPageManager extends __VARIABLE__ {__CLEAR__}\nexports.default = ServerPageManager;
- Improved the performance of hydration application on the client (better in average by 100ms).
- Removed useless layout recalculating.
- The ima dependencies for libraries react, react-dom and eslint was moved to skeleton dependencies.
- Default code formatter is set to prettier.
- Updated documentation.
- Fixed some bugs
Please see the wiki for a HOWTO on upgrading to 0.15.0.
0.15.0-beta17
#! udpate version
0.14.3
0.14.2
0.14.1
0.14.0
Changelog
- Class dependencies can now be specified using a static
$dependencies
property on the class instead of having to specify them in the bind.js configuration file. Example:
class MyDate {}
class My {
static get $dependencies() {
return [MyDate, '$Http'];
}
constructor(myDateInstance, httpAgent) {}
}
// Alternatively, you can use the property initializer syntax if you enable it in
// babel:
class My2 {
static $dependencies() = [MyDate, '$Http'];
constructor(myDateInstance, httpAgent) {}
}
- The object container looks up the class dependencies in its more-general configuration when not specified for an alias:
oc.inject(PageFactory, [oc]);
oc.bind('$PageFactory', PageFactory);
- The IMA core library is no longer a stand-alone dependency but is included with other vendors, allowing for extending the IMA's core classes in 3rd party modules.
- The body of a failed HTTP request is now provided with the error thrown by the
HttpProxy
. - Added the
listeners
option for HTTP requests, which can be used to specify additional callbacks to execute when the request completes. - Integrated enzyme for tests.
- Added support for a persistent HOC (called Managed Root View) wrapping the entire view.
- Removed support for the
@server-side
compilation flag - Using the (Mac) [CMD] key + left mouse click now opens the link in a new tab (consistency with the native browser behavior).
- The
mount
andupdate
methods of thePageRenderer
class now return a promise. The promise resolves to an object containing information about the rendered page, and has been augmented with thepageState
property that contains the state object that was used to render the page. - The
clearState
method of thePageRenderer
class now sets alls keys of the state object toundefined
(used to benull
). - Enabled overriding of the
contextTypes
static property of classes extending theAbstractComponent
class. - Added the
AbstractPureComponent
class that extends theReact.PureComponent
class and provides API consistent with theAbstractComponent
class - The application now may prevent the default action of a
popstate
event. - Added
maxAge
to cookie options. - The implementation of the CSS classnames helper is now configurable using the
$CssClasses
alias. - Upgraded to gulp 4, refactored the dev and build tasks.
- Improved the performance of hot reloading.
- Reduced code transpilation to a minimum for the server side, greatly improves performance.
- Documentation now uses JSDoc instead of YUIDoc.
- Added the
postProcessor
option to HTTP request options, which can be used to provide a callback that processes the server's response before it is stored in the cache and returned to the caller. - OC constants can now be aliased.
- Added the
Window.getDocument
method. - Renamed the
PageRenderer.reactCreateFactory
method tocreateReactElementFactory
. - The
PageRendererFactory.wrapView
method now requires the view adapter component class as the first argument. - The view adapter may be overridden using the
$Page.$Render.viewAdapter
option in thesettings.js
file. - Upgraded to node.js 7 (node.js 8 or newer is recommended).
- Improved support for circular dependencies between ES modules.
- Added the optional
$Path
configuration option to theapp/config/settings.js
configuration file for use by the router.
Please see the wiki for a HOWTO on upgrading to 0.14.0.
0.13.0
Core
- the application's scripts can now be loaded asynchronously by adding the
async
attribute to the script tags - added a new base class for document layout view components
- improved the bootstrapping process of IMA plugins, plugin may export the
initSettings
,initBind
andinitServices
functions which are executed during the bootstrapping of settings, OC and services respectively - new route options: the
allowSPA
option can be used to prevent certain routes being handled by serving the SPA to the client; thedocumentView
allows specifying a different document view to use instead of the default one specified in the application's settings - fixed some bugs