Skip to content

version 0.9.8

@aljimenez aljimenez released this Dec 8, 2014

version 0.9.8

Features

  • Updated to the latest version of YUI (3.18.x).

Bug Fixes

  • Action context now inherits the addons required by any yui module required by a controller.

Downloads

0.9.7

@aljimenez aljimenez released this Aug 9, 2014 · 14 commits to develop since this release

version 0.9.7

Features

  • Controllers, models, and binders can be defined as a function with a prototype.
  • Support for easily extending YUI modules in a different mojit, by using Y.mojito.Util.extend. Y.mojito.Util.extend, defined in 'mojito-util', is the equivalent of Y.extend, and can accept object literals in addition to functions.
  • Controllers inherit the addons of any controller that is listed in its requires array.
  • Mojit dependencies can be specified in defaults.json, which ensures that required dependencies are loaded when resourceStore.lazyMojits is set to true.

Below is an example where the ImageResult controller extends the Result controller:

mojits/Result/controller.server.js

YUI.add('ResultController', function (Y, NAME) {
    Y.namespace('mojito.controllers')[NAME] = {
        index: function (ac) {
            var result = this.createResultObject(ac);
            ac.done({
                result: result
            });
        },
        createResultObject: function (ac) {
            return {
                title: ac.config.get('title'),
                text: ac.config.get('text')
            };
        }
    };
}, '0.0.1', {
    requires: [
        'mojito-config-addon'
    ]
});

mojits/ImageResult/controller.server.js

YUI.add('ImageResultController', function (Y, NAME) {
    var ResultController = Y.mojito.controllers.ResultController,
        // Constructor for this controller.
        ImageResultController = function () {
            // Hook into the original createResultObject method, in order
            // to call this controller's augmentResult method.
            Y.Do.after(this.augmentResult, this, 'createResultObject')
        };

    Y.namespace('mojito.controllers')[NAME] = ImageResultController;

    // Extend the ResultController, adding the augmentResult custom method.
    Y.mojito.Util.extend(ImageResultController, ResultController, {
        augmentResult: function () {
            Y.Do.currentRetVal.image = {
                src: 'myImage'
            };
        }
    });
}, '0.0.1', {
    requires: [
        'ResultController',
        'mojito-util'
    ]
});

The ImageResult controller uses Y.mojito.Util.extend in order to extend the Result controller and add custom methods. The controller is defined as a function that serves as a constructor. In this function, the controller hooks into createResultObject in order to call augmentResult after. Notice that the ImageResult controller does not have to re-specify the config addon in its requires array since this addon is inferred from the required ResultController.

Note:
If resourceStore.lazyMojits is set to true, then mojits that depend on the resources of other mojits must let Mojito know of the dependencies. This ensures that once a mojit is lazy loaded, its dependency mojits are also loaded. Dependencies can be specified in the mojit's defaults.json. Below is how ImageResult's defaults.json would specify that it depends on resources in the Result mojit:

ImageResult/defaults.json

[{
    "settings": ["master"],
    "dependencies": ["Result"]
}]

Downloads

0.9.6

@aljimenez aljimenez released this Jul 15, 2014 · 37 commits to develop since this release

version 0.9.6

Features

  • Clearer and more specific error messages regarding invalid mojits and exceptions.
  • Routes.json now accepts an annotations object (see express annotations). Also the "client" annotation can be used to specify whether to expose the route to the client; by default, routes are exposed to the client.

Ex. routes.json:

...
"route": {
     "verbs": ["get"],
     "path": "/path",
     "call": "spec.action",
     "annotations": {
        "client": false
     }
}
...

Bug Fixes

  • Catching any uncaught exception during binder execution. This prevents binder errors from interfering with other binders and the mojito client.

Downloads

0.9.5

@aljimenez aljimenez released this Jun 2, 2014 · 73 commits to develop since this release

version 0.9.5

Notes

  • Reduced start up time by up to 25% by capturing YUI module details and executing them in one step instead of two.
  • Now YUI modules are only executed once, with the real runtime YUI object scoped.
  • Syntax errors are now reported with line numbers after failing to compile YUI modules.
  • Better handling of translations in the Intl addon, which finds the best available lang while avoiding potential interference from a previously set language.

Bug Fixes

  • Fixed issue where application start up would crash due to syntax errors in a YUI module.

Downloads

0.9.4

@aljimenez aljimenez released this Apr 30, 2014 · 58 commits to master since this release

Features

  • Added the lazyLangs and lazyMojits options, which significantly reduce start up time. By default these options are set to false, and can be set to true under the resourceStore option in application.json. After a resource is lazy loaded, it does not need to be loaded again in subsequent requests.

    lazyLangs and lazyMojits are ideal options for large applications during development when developers often have to restart an application and don't necessarily use all mojits or languages.

    • lazyLangs only loads the lang files necessary for a given request's lang context; this substantially reduces start up time for applications that have many lang files.

      Note that lazyLangs requires lang files to follow proper naming conventions ({mojitName}_{locale}.js or {mojitName}.js for default lang, e.g. Main_es-ES.js or Main.js); default langs are specified with the empty string within the lang file.

    • lazyMojits only loads mojits as they appear during a request; this option is especially useful for applications with many mojits that don't appear often.

      Note that if lazyMojits is on then YUI modules within mojits must let YUI know of any YUI modules it requires that are outside of the mojit. Usually this is not necessary since mojits are meant to be self contained, but if it is not, then let YUI know of the external YUI module with this code on top of the requiring YUI module:

      if (typeof YUI === 'function') {
          // Making sure the PipelineFrame controller is available to this module if lazyMojits is on.
          YUI().applyConfig({
              modules: {
                  PipelineFrameMojit: {
                      fullpath: require('path').join(__dirname, '../PipelineFrame/controller.server.js')
                  }
              }
          });
      }
      

Bug Fixes

  • Fixed issue where the mojito-handler-static middleware was sometimes setting the header max-age value to NaN.

Downloads

0.9.3

@aljimenez aljimenez released this Apr 17, 2014 · 131 commits to develop since this release

Notes

  • Various improvements to the Resource Store, which reduce start up time by 30% to 50%.
  • YUI dependency was upgraded to yui@3.16.x
  • Request dependency was upgraded to request@2.34.x
  • Yahoo Arrow devDependency was upgraded to yahoo-arrow@0.5.x

Downloads

0.9.2

@aljimenez aljimenez released this Apr 8, 2014 · 137 commits to develop since this release

Notes

Downloads

0.9.1

@aljimenez aljimenez released this Apr 4, 2014 · 143 commits to develop since this release

Notes

Downloads

0.9.0

@aljimenez aljimenez released this Mar 24, 2014 · 155 commits to develop since this release

Notes

This release introduces a set of new APIs and concepts.

Please refer to some of the examples apps under the examples/ folder to get
an overview of what has changed.

Deprecations, Removals

  • Mojito no longer supports index.js and server.js to start up the server.
    Applications will instead instantiate Mojito as follows:

    var libmojito = require('mojito'),
        express = require('express'),
        app;
    
    app = express();
    libmojito.extend(app, { /* context */ });
    // at this point, access mojito instance via `app.mojito`
    
  • appPort configuration is no longer supported via application.json.
    Instead, the Express app instance should call listen() when ready.

  • Middleware configuration is no longer supported via application.json.
    Applications can register their middleware using the Express API. To enable
    Mojito default list of middleware, use the following:

    app.use(libmojito.middleware());
    

    If you want to have more granular control, use the following:

    app.use(libmojito.middleware['mojito-handler-static']());
    app.use(libmojito.middleware['mojito-parser-body']());
    app.use(libmojito.middleware['mojito-parser-cookies']());
    app.use(myCustomContextualizerMiddleware());
    app.use(libmojito.middleware['mojito-contextualizer']());
    app.use(libmojito.middleware['mojito-handler-tunnel']());
    app.use(anotherCustomMiddleware());
    
  • routes.json configuration is no longer loaded by default. To tell Mojito to
    do so, use the following:

    app.mojito.attachRoutes();
    

    Applications can also pass in an array of route configuration names if
    needed.

  • ac.url.make() and Y.mojito.RouteMaker.make() no longer throws exception.
    Instead, the api returns null in order to provide the application more
    control on how best to handle this error.

  • The ac.url.find() and Y.mojito.RouteMaker.find() methods are now
    deprecated and will be removed in a future version.

    Applications that rely on this API should familiarize with the express-map
    package by querying the route object by name or path.

  • Expanded metadata is now removed. This means we will not longer support
    synthetic modules that were expanded by default, e.g.:
    loader-yui3-base, loader-yui3-expanded and loader-app-resolved.
    If you are using any of those 3 entries in the YUI configuration,
    you should use loader-app and loader-app-base as your seed modules.
    In fact we recommend to not customize yui.config.seed in your application.json

Features

  • To register Mojito routes programmatically instead of using routes.json:
// app.js
app.get('/foo', mojito.dispatch('foo.index'));
app.map('/foo', 'foo');
app.map('/foo', 'get#foo.index');

In addition to setting up the path /foo to be routed to the Mojito
dispatcher, setup 2 additional "aliases". The second alias is the HTTP method
concatenated with the call value using the # delimiter.

This is equivalent to doing this in routes.json in previous releases.

[{
    "settings": [ "master" ],
    "foo": {
        verbs: [ "get" ],
        path: "/foo",
        call: "foo.index",
        params: { /* optional prams */ }
    }
}]

For more detail information, please check any of the applications under
examples/ folder.

New Dependencies

Downloads

Mojito 0.9.0 RC2

@imalberto imalberto released this Feb 28, 2014 · 194 commits to develop since this release

This is a preview release ahead of the GA.

Please see HISTORY.md for list of changes.

For more in depth information, please refer to the wiki.

Downloads

Something went wrong with that request. Please try again.