diff --git a/bower.json b/bower.json index aa588a14..57a3ec65 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-framework", - "version": "1.2.0", + "version": "1.3.0-rc.1", "description": "The aurelia framework brings together all the required core aurelia libraries into a ready-to-go application-building platform.", "keywords": [ "aurelia", @@ -19,7 +19,7 @@ "url": "http://github.com/aurelia/framework" }, "dependencies": { - "aurelia-binding": "^1.0.0", + "aurelia-binding": "^1.0.0 || ^2.0.0", "aurelia-dependency-injection": "^1.0.0", "aurelia-loader": "^1.0.0", "aurelia-logging": "^1.0.0", @@ -27,6 +27,6 @@ "aurelia-pal": "^1.0.0", "aurelia-path": "^1.0.0", "aurelia-task-queue": "^1.0.0", - "aurelia-templating": "^1.0.0" + "aurelia-templating": "^1.8.0-rc.1" } } diff --git a/dist/amd/aurelia-framework.js b/dist/amd/aurelia-framework.js index f5ed1b7a..0f5d3d8a 100644 --- a/dist/amd/aurelia-framework.js +++ b/dist/amd/aurelia-framework.js @@ -97,6 +97,12 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m } } + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + function preventActionlessFormSubmit() { @@ -258,36 +264,53 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m return next(); } - function loadPlugin(config, loader, info) { + function loadPlugin(fwConfig, loader, info) { logger.debug('Loading plugin ' + info.moduleId + '.'); - config.resourcesRelativeTo = info.resourcesRelativeTo; + if (typeof info.moduleId === 'string') { + fwConfig.resourcesRelativeTo = info.resourcesRelativeTo; - var id = info.moduleId; + var id = info.moduleId; - if (info.resourcesRelativeTo.length > 1) { - return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { - return _loadPlugin(normalizedId); - }); - } + if (info.resourcesRelativeTo.length > 1) { + return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { + return _loadPlugin(normalizedId); + }); + } - return _loadPlugin(id); + return _loadPlugin(id); + } else if (typeof info.configure === 'function') { + if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) { + return Promise.resolve(); + } + fwConfig.configuredPlugins.push(info.configure); + + return Promise.resolve(info.configure.call(null, fwConfig, info.config || {})); + } + throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin')); function _loadPlugin(moduleId) { return loader.loadModule(moduleId).then(function (m) { if ('configure' in m) { - return Promise.resolve(m.configure(config, info.config || {})).then(function () { - config.resourcesRelativeTo = null; + if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) { + return Promise.resolve(); + } + return Promise.resolve(m.configure(fwConfig, info.config || {})).then(function () { + fwConfig.configuredPlugins.push(m.configure); + fwConfig.resourcesRelativeTo = null; logger.debug('Configured plugin ' + info.moduleId + '.'); }); } - config.resourcesRelativeTo = null; + fwConfig.resourcesRelativeTo = null; logger.debug('Loaded plugin ' + info.moduleId + '.'); }); } } function loadResources(aurelia, resourcesToLoad, appResources) { + if (Object.keys(resourcesToLoad).length === 0) { + return Promise.resolve(); + } var viewEngine = aurelia.container.get(_aureliaTemplating.ViewEngine); return Promise.all(Object.keys(resourcesToLoad).map(function (n) { @@ -344,12 +367,24 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m } } + function loadBehaviors(config) { + return Promise.all(config.behaviorsToLoad.map(function (m) { + return m.load(config.container, m.target); + })).then(function () { + config.behaviorsToLoad = null; + }); + } + function assertProcessed(plugins) { if (plugins.processed) { throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.'); } } + function invalidConfigMsg(cfg, type) { + return 'Invalid ' + type + ' [' + cfg + '], ' + type + ' must be specified as functions or relative module IDs.'; + } + var FrameworkConfiguration = function () { function FrameworkConfiguration(aurelia) { var _this4 = this; @@ -358,10 +393,15 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m this.aurelia = aurelia; this.container = aurelia.container; + this.info = []; this.processed = false; this.preTasks = []; this.postTasks = []; + + this.behaviorsToLoad = []; + + this.configuredPlugins = []; this.resourcesToLoad = {}; this.preTask(function () { return aurelia.loader.normalize('aurelia-bootstrapper').then(function (name) { @@ -403,13 +443,26 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m FrameworkConfiguration.prototype.feature = function feature(plugin) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var hasIndex = /\/index$/i.test(plugin); - var moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; - var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; - return this.plugin({ moduleId: moduleId, resourcesRelativeTo: [root, ''], config: config }); + switch (typeof plugin === 'undefined' ? 'undefined' : _typeof(plugin)) { + case 'string': + var hasIndex = /\/index$/i.test(plugin); + var _moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; + var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; + this.info.push({ moduleId: _moduleId, resourcesRelativeTo: [root, ''], config: config }); + break; + + case 'function': + this.info.push({ configure: plugin, config: config || {} }); + break; + default: + throw new Error(invalidConfigMsg(plugin, 'feature')); + } + return this; }; FrameworkConfiguration.prototype.globalResources = function globalResources(resources) { + var _this5 = this; + assertProcessed(this); var toAdd = Array.isArray(resources) ? resources : arguments; @@ -418,19 +471,31 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m for (var i = 0, ii = toAdd.length; i < ii; ++i) { resource = toAdd[i]; - if (typeof resource !== 'string') { - throw new Error('Invalid resource path [' + resource + ']. Resources must be specified as relative module IDs.'); + switch (typeof resource === 'undefined' ? 'undefined' : _typeof(resource)) { + case 'string': + var parent = resourcesRelativeTo[0]; + var grandParent = resourcesRelativeTo[1]; + var name = resource; + + if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { + name = (0, _aureliaPath.join)(parent, resource); + } + + this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; + break; + case 'function': + var meta = this.aurelia.resources.autoRegister(this.container, resource); + if (meta instanceof _aureliaTemplating.HtmlBehaviorResource && meta.elementName !== null) { + if (this.behaviorsToLoad.push(meta) === 1) { + this.postTask(function () { + return loadBehaviors(_this5); + }); + } + } + break; + default: + throw new Error(invalidConfigMsg(resource, 'resource')); } - - var parent = resourcesRelativeTo[0]; - var grandParent = resourcesRelativeTo[1]; - var name = resource; - - if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { - name = (0, _aureliaPath.join)(parent, resource); - } - - this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; } return this; @@ -442,25 +507,32 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m return this; }; - FrameworkConfiguration.prototype.plugin = function plugin(_plugin, config) { + FrameworkConfiguration.prototype.plugin = function plugin(_plugin, pluginConfig) { assertProcessed(this); - if (typeof _plugin === 'string') { - return this.plugin({ moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: config || {} }); + var info = void 0; + switch (typeof _plugin === 'undefined' ? 'undefined' : _typeof(_plugin)) { + case 'string': + info = { moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: pluginConfig || {} }; + break; + case 'function': + info = { configure: _plugin, config: pluginConfig || {} }; + break; + default: + throw new Error(invalidConfigMsg(_plugin, 'plugin')); } - - this.info.push(_plugin); + this.info.push(info); return this; }; FrameworkConfiguration.prototype._addNormalizedPlugin = function _addNormalizedPlugin(name, config) { - var _this5 = this; + var _this6 = this; var plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} }; this.plugin(plugin); this.preTask(function () { - var relativeTo = [name, _this5.bootstrapperName]; + var relativeTo = [name, _this6.bootstrapperName]; plugin.moduleId = name; plugin.resourcesRelativeTo = relativeTo; return Promise.resolve(); @@ -498,7 +570,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m }; FrameworkConfiguration.prototype.developmentLogging = function developmentLogging(level) { - var _this6 = this; + var _this7 = this; var logLevel = level ? TheLogManager.logLevel[level] : undefined; @@ -507,8 +579,8 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m } this.preTask(function () { - return _this6.aurelia.loader.normalize('aurelia-logging-console', _this6.bootstrapperName).then(function (name) { - return _this6.aurelia.loader.loadModule(name).then(function (m) { + return _this7.aurelia.loader.normalize('aurelia-logging-console', _this7.bootstrapperName).then(function (name) { + return _this7.aurelia.loader.loadModule(name).then(function (m) { TheLogManager.addAppender(new m.ConsoleAppender()); TheLogManager.setLevel(logLevel); }); @@ -519,29 +591,30 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-m }; FrameworkConfiguration.prototype.apply = function apply() { - var _this7 = this; + var _this8 = this; if (this.processed) { return Promise.resolve(); } return runTasks(this, this.preTasks).then(function () { - var loader = _this7.aurelia.loader; - var info = _this7.info; + var loader = _this8.aurelia.loader; + var info = _this8.info; var current = void 0; var next = function next() { current = info.shift(); if (current) { - return loadPlugin(_this7, loader, current).then(next); + return loadPlugin(_this8, loader, current).then(next); } - _this7.processed = true; + _this8.processed = true; + _this8.configuredPlugins = null; return Promise.resolve(); }; return next().then(function () { - return runTasks(_this7, _this7.postTasks); + return runTasks(_this8, _this8.postTasks); }); }); }; diff --git a/dist/aurelia-framework.d.ts b/dist/aurelia-framework.d.ts index 4cbcadde..ec650e93 100644 --- a/dist/aurelia-framework.d.ts +++ b/dist/aurelia-framework.d.ts @@ -11,7 +11,8 @@ import { ViewResources, TemplatingEngine, CompositionTransaction, - ViewEngine + ViewEngine, + HtmlBehaviorResource } from 'aurelia-templating'; import { DOM, @@ -21,6 +22,12 @@ import { relativeToFile, join } from 'aurelia-path'; +export declare interface FrameworkPluginInfo { + moduleId?: string; + resourcesRelativeTo?: string[]; + configure?: (config: FrameworkConfiguration, pluginConfig?: any) => any; + config?: any; +} /** * The framework core that provides the main Aurelia object. @@ -81,7 +88,7 @@ export declare class Aurelia { * @param applicationHost The DOM object that Aurelia will attach to. * @return Returns a Promise of the current Aurelia instance. */ - setRoot(root?: string, applicationHost?: string | Element): Promise; + setRoot(root?: string | Function, applicationHost?: string | Element): Promise; } /** @@ -149,14 +156,14 @@ export declare class FrameworkConfiguration { * @param config The configuration for the specified plugin. * @return Returns the current FrameworkConfiguration instance. */ - feature(plugin: string, config?: any): FrameworkConfiguration; + feature(plugin: string | ((config: FrameworkConfiguration, pluginConfig?: any) => any), config?: any): FrameworkConfiguration; /** * Adds globally available view resources to be imported into the Aurelia framework. * @param resources The relative module id to the resource. (Relative to the plugin's installer.) * @return Returns the current FrameworkConfiguration instance. */ - globalResources(resources: string | string[]): FrameworkConfiguration; + globalResources(resources: string | Function | Array): FrameworkConfiguration; /** * Renames a global resource that was imported. @@ -169,10 +176,10 @@ export declare class FrameworkConfiguration { /** * Configures an external, 3rd party plugin before Aurelia starts. * @param plugin The ID of the 3rd party plugin to configure. - * @param config The configuration for the specified plugin. + * @param pluginConfig The configuration for the specified plugin. * @return Returns the current FrameworkConfiguration instance. */ - plugin(plugin: string, config?: any): FrameworkConfiguration; + plugin(plugin: string | ((frameworkConfig: FrameworkConfiguration) => any) | FrameworkPluginInfo, pluginConfig?: any): FrameworkConfiguration; // Default configuration helpers // Note: Please do NOT add PLATFORM.moduleName() around those module names. @@ -243,8 +250,9 @@ export * from 'aurelia-templating'; export * from 'aurelia-loader'; export * from 'aurelia-task-queue'; export * from 'aurelia-path'; +export * from 'aurelia-pal'; + /** * The log manager. */ export const LogManager: typeof TheLogManager; -export * from 'aurelia-pal'; diff --git a/dist/aurelia-framework.js b/dist/aurelia-framework.js index bf6e32b4..89abb587 100644 --- a/dist/aurelia-framework.js +++ b/dist/aurelia-framework.js @@ -1,7 +1,7 @@ import * as TheLogManager from 'aurelia-logging'; import {Container} from 'aurelia-dependency-injection'; import {Loader} from 'aurelia-loader'; -import {BindingLanguage,ViewSlot,ViewResources,TemplatingEngine,CompositionTransaction,ViewEngine} from 'aurelia-templating'; +import {BindingLanguage,ViewSlot,ViewResources,TemplatingEngine,CompositionTransaction,ViewEngine,HtmlBehaviorResource} from 'aurelia-templating'; import {DOM,PLATFORM} from 'aurelia-pal'; import {relativeToFile,join} from 'aurelia-path'; @@ -113,7 +113,7 @@ export class Aurelia { * @param applicationHost The DOM object that Aurelia will attach to. * @return Returns a Promise of the current Aurelia instance. */ - setRoot(root: string = null, applicationHost: string | Element = null): Promise { + setRoot(root: string | Function = null, applicationHost: string | Element = null): Promise { let instruction = {}; if (this.root && this.root.viewModel && this.root.viewModel.router) { @@ -180,7 +180,7 @@ export class Aurelia { const logger = TheLogManager.getLogger('aurelia'); const extPattern = /\.[^/.]+$/; -function runTasks(config, tasks) { +function runTasks(config: FrameworkConfiguration, tasks) { let current; let next = () => { current = tasks.shift(); @@ -194,35 +194,62 @@ function runTasks(config, tasks) { return next(); } -function loadPlugin(config, loader, info) { +interface FrameworkPluginInfo { + moduleId?: string; + resourcesRelativeTo?: string[]; + configure?: (config: FrameworkConfiguration, pluginConfig?: any) => any; + config?: any; +} + +function loadPlugin(fwConfig: FrameworkConfiguration, loader: Loader, info: FrameworkPluginInfo) { logger.debug(`Loading plugin ${info.moduleId}.`); - config.resourcesRelativeTo = info.resourcesRelativeTo; + if (typeof info.moduleId === 'string') { + fwConfig.resourcesRelativeTo = info.resourcesRelativeTo; - let id = info.moduleId; // General plugins installed/configured by the end user. + let id = info.moduleId; // General plugins installed/configured by the end user. - if (info.resourcesRelativeTo.length > 1 ) { // In case of bootstrapper installed plugins like `aurelia-templating-resources` or `aurelia-history-browser`. - return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]) - .then(normalizedId => _loadPlugin(normalizedId)); - } + if (info.resourcesRelativeTo.length > 1 ) { // In case of bootstrapper installed plugins like `aurelia-templating-resources` or `aurelia-history-browser`. + return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]) + .then(normalizedId => _loadPlugin(normalizedId)); + } - return _loadPlugin(id); + return _loadPlugin(id); + } else if (typeof info.configure === 'function') { + if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) { + return Promise.resolve(); + } + fwConfig.configuredPlugins.push(info.configure); + // use info.config || {} to keep behavior consistent with loading from string + return Promise.resolve(info.configure.call(null, fwConfig, info.config || {})); + } + throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin')); function _loadPlugin(moduleId) { return loader.loadModule(moduleId).then(m => { // eslint-disable-line consistent-return if ('configure' in m) { - return Promise.resolve(m.configure(config, info.config || {})).then(() => { - config.resourcesRelativeTo = null; + if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) { + return Promise.resolve(); + } + return Promise.resolve(m.configure(fwConfig, info.config || {})).then(() => { + fwConfig.configuredPlugins.push(m.configure); + fwConfig.resourcesRelativeTo = null; logger.debug(`Configured plugin ${info.moduleId}.`); }); } - config.resourcesRelativeTo = null; + fwConfig.resourcesRelativeTo = null; logger.debug(`Loaded plugin ${info.moduleId}.`); }); } } function loadResources(aurelia, resourcesToLoad, appResources) { + // if devs want to go all in static, and remove loader + // the code after this fucntion shouldn't run + // add a check to make sure it only runs when there is something to do so + if (Object.keys(resourcesToLoad).length === 0) { + return Promise.resolve(); + } let viewEngine = aurelia.container.get(ViewEngine); return Promise.all(Object.keys(resourcesToLoad).map(n => _normalize(resourcesToLoad[n]))) @@ -272,19 +299,29 @@ function loadResources(aurelia, resourcesToLoad, appResources) { } } -function getExt(name) { // eslint-disable-line consistent-return +function getExt(name: string) { // eslint-disable-line consistent-return let match = name.match(extPattern); if (match && match.length > 0) { return (match[0].split('.'))[1]; } } -function assertProcessed(plugins) { +function loadBehaviors(config: FrameworkConfiguration) { + return Promise.all(config.behaviorsToLoad.map(m => m.load(config.container, m.target))).then(() => { + config.behaviorsToLoad = null; + }); +} + +function assertProcessed(plugins: FrameworkConfiguration) { if (plugins.processed) { throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.'); } } +function invalidConfigMsg(cfg: any, type: string) { + return `Invalid ${type} [${cfg}], ${type} must be specified as functions or relative module IDs.`; +} + /** * Manages configuring the aurelia framework instance. */ @@ -306,10 +343,24 @@ export class FrameworkConfiguration { constructor(aurelia: Aurelia) { this.aurelia = aurelia; this.container = aurelia.container; + /** + * Plugin / feature loading instruction + * @type {FrameworkPluginInfo[]} + */ this.info = []; this.processed = false; this.preTasks = []; this.postTasks = []; + /** + * Custom element's metadata queue for loading view factory + * @type {HtmlBehaviorResource[]} + */ + this.behaviorsToLoad = []; + /** + * Plugin configure functions temporary cache for avoid duplicate calls + * @type {Function[]} + */ + this.configuredPlugins = []; this.resourcesToLoad = {}; this.preTask(() => aurelia.loader.normalize('aurelia-bootstrapper').then(name => this.bootstrapperName = name)); this.postTask(() => loadResources(aurelia, this.resourcesToLoad, aurelia.resources)); @@ -376,11 +427,23 @@ export class FrameworkConfiguration { * @param config The configuration for the specified plugin. * @return Returns the current FrameworkConfiguration instance. */ - feature(plugin: string, config?: any = {}): FrameworkConfiguration { - let hasIndex = /\/index$/i.test(plugin); - let moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; - let root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; - return this.plugin({ moduleId, resourcesRelativeTo: [root, ''], config }); + feature(plugin: string | ((config: FrameworkConfiguration, pluginConfig?: any) => any), config?: any = {}): FrameworkConfiguration { + switch (typeof plugin) { + case 'string': + let hasIndex = /\/index$/i.test(plugin); + let moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; + let root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; + this.info.push({ moduleId, resourcesRelativeTo: [root, ''], config }); + break; + // return this.plugin({ moduleId, resourcesRelativeTo: [root, ''], config }); + case 'function': + this.info.push({ configure: plugin, config: config || {} }); + break; + default: + throw new Error(invalidConfigMsg(plugin, 'feature')); + } + return this; + // return this.plugin(plugin, config); } /** @@ -388,7 +451,7 @@ export class FrameworkConfiguration { * @param resources The relative module id to the resource. (Relative to the plugin's installer.) * @return Returns the current FrameworkConfiguration instance. */ - globalResources(resources: string|string[]): FrameworkConfiguration { + globalResources(resources: string | Function | Array): FrameworkConfiguration { assertProcessed(this); let toAdd = Array.isArray(resources) ? resources : arguments; @@ -397,19 +460,29 @@ export class FrameworkConfiguration { for (let i = 0, ii = toAdd.length; i < ii; ++i) { resource = toAdd[i]; - if (typeof resource !== 'string') { - throw new Error(`Invalid resource path [${resource}]. Resources must be specified as relative module IDs.`); - } - - let parent = resourcesRelativeTo[0]; - let grandParent = resourcesRelativeTo[1]; - let name = resource; + switch (typeof resource) { + case 'string': + let parent = resourcesRelativeTo[0]; + let grandParent = resourcesRelativeTo[1]; + let name = resource; + + if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { + name = join(parent, resource); + } - if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { - name = join(parent, resource); + this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; + break; + case 'function': + let meta = this.aurelia.resources.autoRegister(this.container, resource); + if (meta instanceof HtmlBehaviorResource && meta.elementName !== null) { + if (this.behaviorsToLoad.push(meta) === 1) { + this.postTask(() => loadBehaviors(this)); + } + } + break; + default: + throw new Error(invalidConfigMsg(resource, 'resource')); } - - this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; } return this; @@ -430,17 +503,27 @@ export class FrameworkConfiguration { /** * Configures an external, 3rd party plugin before Aurelia starts. * @param plugin The ID of the 3rd party plugin to configure. - * @param config The configuration for the specified plugin. + * @param pluginConfig The configuration for the specified plugin. * @return Returns the current FrameworkConfiguration instance. */ - plugin(plugin: string, config?: any): FrameworkConfiguration { + plugin( + plugin: string | ((frameworkConfig: FrameworkConfiguration) => any) | FrameworkPluginInfo, + pluginConfig?: any + ): FrameworkConfiguration { assertProcessed(this); - if (typeof (plugin) === 'string') { - return this.plugin({ moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: config || {} }); + let info: FrameworkPluginInfo; + switch (typeof plugin) { + case 'string': + info = { moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: pluginConfig || {} }; + break; + case 'function': + info = { configure: plugin, config: pluginConfig || {} }; + break; + default: + throw new Error(invalidConfigMsg(plugin, 'plugin')); } - - this.info.push(plugin); + this.info.push(info); return this; } @@ -567,6 +650,7 @@ export class FrameworkConfiguration { } this.processed = true; + this.configuredPlugins = null; return Promise.resolve(); }; diff --git a/dist/commonjs/aurelia-framework.js b/dist/commonjs/aurelia-framework.js index 37b49003..35a1859c 100644 --- a/dist/commonjs/aurelia-framework.js +++ b/dist/commonjs/aurelia-framework.js @@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", { }); exports.LogManager = exports.FrameworkConfiguration = exports.Aurelia = undefined; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + var _aureliaDependencyInjection = require('aurelia-dependency-injection'); Object.keys(_aureliaDependencyInjection).forEach(function (key) { @@ -268,36 +270,53 @@ function runTasks(config, tasks) { return next(); } -function loadPlugin(config, loader, info) { +function loadPlugin(fwConfig, loader, info) { logger.debug('Loading plugin ' + info.moduleId + '.'); - config.resourcesRelativeTo = info.resourcesRelativeTo; + if (typeof info.moduleId === 'string') { + fwConfig.resourcesRelativeTo = info.resourcesRelativeTo; - var id = info.moduleId; + var id = info.moduleId; - if (info.resourcesRelativeTo.length > 1) { - return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { - return _loadPlugin(normalizedId); - }); - } + if (info.resourcesRelativeTo.length > 1) { + return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { + return _loadPlugin(normalizedId); + }); + } - return _loadPlugin(id); + return _loadPlugin(id); + } else if (typeof info.configure === 'function') { + if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) { + return Promise.resolve(); + } + fwConfig.configuredPlugins.push(info.configure); + + return Promise.resolve(info.configure.call(null, fwConfig, info.config || {})); + } + throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin')); function _loadPlugin(moduleId) { return loader.loadModule(moduleId).then(function (m) { if ('configure' in m) { - return Promise.resolve(m.configure(config, info.config || {})).then(function () { - config.resourcesRelativeTo = null; + if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) { + return Promise.resolve(); + } + return Promise.resolve(m.configure(fwConfig, info.config || {})).then(function () { + fwConfig.configuredPlugins.push(m.configure); + fwConfig.resourcesRelativeTo = null; logger.debug('Configured plugin ' + info.moduleId + '.'); }); } - config.resourcesRelativeTo = null; + fwConfig.resourcesRelativeTo = null; logger.debug('Loaded plugin ' + info.moduleId + '.'); }); } } function loadResources(aurelia, resourcesToLoad, appResources) { + if (Object.keys(resourcesToLoad).length === 0) { + return Promise.resolve(); + } var viewEngine = aurelia.container.get(_aureliaTemplating.ViewEngine); return Promise.all(Object.keys(resourcesToLoad).map(function (n) { @@ -354,12 +373,24 @@ function getExt(name) { } } +function loadBehaviors(config) { + return Promise.all(config.behaviorsToLoad.map(function (m) { + return m.load(config.container, m.target); + })).then(function () { + config.behaviorsToLoad = null; + }); +} + function assertProcessed(plugins) { if (plugins.processed) { throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.'); } } +function invalidConfigMsg(cfg, type) { + return 'Invalid ' + type + ' [' + cfg + '], ' + type + ' must be specified as functions or relative module IDs.'; +} + var FrameworkConfiguration = function () { function FrameworkConfiguration(aurelia) { var _this4 = this; @@ -368,10 +399,15 @@ var FrameworkConfiguration = function () { this.aurelia = aurelia; this.container = aurelia.container; + this.info = []; this.processed = false; this.preTasks = []; this.postTasks = []; + + this.behaviorsToLoad = []; + + this.configuredPlugins = []; this.resourcesToLoad = {}; this.preTask(function () { return aurelia.loader.normalize('aurelia-bootstrapper').then(function (name) { @@ -413,13 +449,26 @@ var FrameworkConfiguration = function () { FrameworkConfiguration.prototype.feature = function feature(plugin) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var hasIndex = /\/index$/i.test(plugin); - var moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; - var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; - return this.plugin({ moduleId: moduleId, resourcesRelativeTo: [root, ''], config: config }); + switch (typeof plugin === 'undefined' ? 'undefined' : _typeof(plugin)) { + case 'string': + var hasIndex = /\/index$/i.test(plugin); + var _moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; + var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; + this.info.push({ moduleId: _moduleId, resourcesRelativeTo: [root, ''], config: config }); + break; + + case 'function': + this.info.push({ configure: plugin, config: config || {} }); + break; + default: + throw new Error(invalidConfigMsg(plugin, 'feature')); + } + return this; }; FrameworkConfiguration.prototype.globalResources = function globalResources(resources) { + var _this5 = this; + assertProcessed(this); var toAdd = Array.isArray(resources) ? resources : arguments; @@ -428,19 +477,31 @@ var FrameworkConfiguration = function () { for (var i = 0, ii = toAdd.length; i < ii; ++i) { resource = toAdd[i]; - if (typeof resource !== 'string') { - throw new Error('Invalid resource path [' + resource + ']. Resources must be specified as relative module IDs.'); + switch (typeof resource === 'undefined' ? 'undefined' : _typeof(resource)) { + case 'string': + var parent = resourcesRelativeTo[0]; + var grandParent = resourcesRelativeTo[1]; + var name = resource; + + if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { + name = (0, _aureliaPath.join)(parent, resource); + } + + this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; + break; + case 'function': + var meta = this.aurelia.resources.autoRegister(this.container, resource); + if (meta instanceof _aureliaTemplating.HtmlBehaviorResource && meta.elementName !== null) { + if (this.behaviorsToLoad.push(meta) === 1) { + this.postTask(function () { + return loadBehaviors(_this5); + }); + } + } + break; + default: + throw new Error(invalidConfigMsg(resource, 'resource')); } - - var parent = resourcesRelativeTo[0]; - var grandParent = resourcesRelativeTo[1]; - var name = resource; - - if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { - name = (0, _aureliaPath.join)(parent, resource); - } - - this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; } return this; @@ -452,25 +513,32 @@ var FrameworkConfiguration = function () { return this; }; - FrameworkConfiguration.prototype.plugin = function plugin(_plugin, config) { + FrameworkConfiguration.prototype.plugin = function plugin(_plugin, pluginConfig) { assertProcessed(this); - if (typeof _plugin === 'string') { - return this.plugin({ moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: config || {} }); + var info = void 0; + switch (typeof _plugin === 'undefined' ? 'undefined' : _typeof(_plugin)) { + case 'string': + info = { moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: pluginConfig || {} }; + break; + case 'function': + info = { configure: _plugin, config: pluginConfig || {} }; + break; + default: + throw new Error(invalidConfigMsg(_plugin, 'plugin')); } - - this.info.push(_plugin); + this.info.push(info); return this; }; FrameworkConfiguration.prototype._addNormalizedPlugin = function _addNormalizedPlugin(name, config) { - var _this5 = this; + var _this6 = this; var plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} }; this.plugin(plugin); this.preTask(function () { - var relativeTo = [name, _this5.bootstrapperName]; + var relativeTo = [name, _this6.bootstrapperName]; plugin.moduleId = name; plugin.resourcesRelativeTo = relativeTo; return Promise.resolve(); @@ -508,7 +576,7 @@ var FrameworkConfiguration = function () { }; FrameworkConfiguration.prototype.developmentLogging = function developmentLogging(level) { - var _this6 = this; + var _this7 = this; var logLevel = level ? TheLogManager.logLevel[level] : undefined; @@ -517,8 +585,8 @@ var FrameworkConfiguration = function () { } this.preTask(function () { - return _this6.aurelia.loader.normalize('aurelia-logging-console', _this6.bootstrapperName).then(function (name) { - return _this6.aurelia.loader.loadModule(name).then(function (m) { + return _this7.aurelia.loader.normalize('aurelia-logging-console', _this7.bootstrapperName).then(function (name) { + return _this7.aurelia.loader.loadModule(name).then(function (m) { TheLogManager.addAppender(new m.ConsoleAppender()); TheLogManager.setLevel(logLevel); }); @@ -529,29 +597,30 @@ var FrameworkConfiguration = function () { }; FrameworkConfiguration.prototype.apply = function apply() { - var _this7 = this; + var _this8 = this; if (this.processed) { return Promise.resolve(); } return runTasks(this, this.preTasks).then(function () { - var loader = _this7.aurelia.loader; - var info = _this7.info; + var loader = _this8.aurelia.loader; + var info = _this8.info; var current = void 0; var next = function next() { current = info.shift(); if (current) { - return loadPlugin(_this7, loader, current).then(next); + return loadPlugin(_this8, loader, current).then(next); } - _this7.processed = true; + _this8.processed = true; + _this8.configuredPlugins = null; return Promise.resolve(); }; return next().then(function () { - return runTasks(_this7, _this7.postTasks); + return runTasks(_this8, _this8.postTasks); }); }); }; diff --git a/dist/es2015/aurelia-framework.js b/dist/es2015/aurelia-framework.js index d79ca65f..623f2d98 100644 --- a/dist/es2015/aurelia-framework.js +++ b/dist/es2015/aurelia-framework.js @@ -1,7 +1,7 @@ import * as TheLogManager from 'aurelia-logging'; import { Container } from 'aurelia-dependency-injection'; import { Loader } from 'aurelia-loader'; -import { BindingLanguage, ViewSlot, ViewResources, TemplatingEngine, CompositionTransaction, ViewEngine } from 'aurelia-templating'; +import { BindingLanguage, ViewSlot, ViewResources, TemplatingEngine, CompositionTransaction, ViewEngine, HtmlBehaviorResource } from 'aurelia-templating'; import { DOM, PLATFORM } from 'aurelia-pal'; import { relativeToFile, join } from 'aurelia-path'; @@ -146,34 +146,51 @@ function runTasks(config, tasks) { return next(); } -function loadPlugin(config, loader, info) { +function loadPlugin(fwConfig, loader, info) { logger.debug(`Loading plugin ${info.moduleId}.`); - config.resourcesRelativeTo = info.resourcesRelativeTo; + if (typeof info.moduleId === 'string') { + fwConfig.resourcesRelativeTo = info.resourcesRelativeTo; - let id = info.moduleId; + let id = info.moduleId; - if (info.resourcesRelativeTo.length > 1) { - return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(normalizedId => _loadPlugin(normalizedId)); - } + if (info.resourcesRelativeTo.length > 1) { + return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(normalizedId => _loadPlugin(normalizedId)); + } + + return _loadPlugin(id); + } else if (typeof info.configure === 'function') { + if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) { + return Promise.resolve(); + } + fwConfig.configuredPlugins.push(info.configure); - return _loadPlugin(id); + return Promise.resolve(info.configure.call(null, fwConfig, info.config || {})); + } + throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin')); function _loadPlugin(moduleId) { return loader.loadModule(moduleId).then(m => { if ('configure' in m) { - return Promise.resolve(m.configure(config, info.config || {})).then(() => { - config.resourcesRelativeTo = null; + if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) { + return Promise.resolve(); + } + return Promise.resolve(m.configure(fwConfig, info.config || {})).then(() => { + fwConfig.configuredPlugins.push(m.configure); + fwConfig.resourcesRelativeTo = null; logger.debug(`Configured plugin ${info.moduleId}.`); }); } - config.resourcesRelativeTo = null; + fwConfig.resourcesRelativeTo = null; logger.debug(`Loaded plugin ${info.moduleId}.`); }); } } function loadResources(aurelia, resourcesToLoad, appResources) { + if (Object.keys(resourcesToLoad).length === 0) { + return Promise.resolve(); + } let viewEngine = aurelia.container.get(ViewEngine); return Promise.all(Object.keys(resourcesToLoad).map(n => _normalize(resourcesToLoad[n]))).then(loads => { @@ -228,20 +245,35 @@ function getExt(name) { } } +function loadBehaviors(config) { + return Promise.all(config.behaviorsToLoad.map(m => m.load(config.container, m.target))).then(() => { + config.behaviorsToLoad = null; + }); +} + function assertProcessed(plugins) { if (plugins.processed) { throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.'); } } +function invalidConfigMsg(cfg, type) { + return `Invalid ${type} [${cfg}], ${type} must be specified as functions or relative module IDs.`; +} + export let FrameworkConfiguration = class FrameworkConfiguration { constructor(aurelia) { this.aurelia = aurelia; this.container = aurelia.container; + this.info = []; this.processed = false; this.preTasks = []; this.postTasks = []; + + this.behaviorsToLoad = []; + + this.configuredPlugins = []; this.resourcesToLoad = {}; this.preTask(() => aurelia.loader.normalize('aurelia-bootstrapper').then(name => this.bootstrapperName = name)); this.postTask(() => loadResources(aurelia, this.resourcesToLoad, aurelia.resources)); @@ -275,10 +307,21 @@ export let FrameworkConfiguration = class FrameworkConfiguration { } feature(plugin, config = {}) { - let hasIndex = /\/index$/i.test(plugin); - let moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; - let root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; - return this.plugin({ moduleId, resourcesRelativeTo: [root, ''], config }); + switch (typeof plugin) { + case 'string': + let hasIndex = /\/index$/i.test(plugin); + let moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; + let root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; + this.info.push({ moduleId, resourcesRelativeTo: [root, ''], config }); + break; + + case 'function': + this.info.push({ configure: plugin, config: config || {} }); + break; + default: + throw new Error(invalidConfigMsg(plugin, 'feature')); + } + return this; } globalResources(resources) { @@ -290,19 +333,29 @@ export let FrameworkConfiguration = class FrameworkConfiguration { for (let i = 0, ii = toAdd.length; i < ii; ++i) { resource = toAdd[i]; - if (typeof resource !== 'string') { - throw new Error(`Invalid resource path [${resource}]. Resources must be specified as relative module IDs.`); - } - - let parent = resourcesRelativeTo[0]; - let grandParent = resourcesRelativeTo[1]; - let name = resource; - - if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { - name = join(parent, resource); + switch (typeof resource) { + case 'string': + let parent = resourcesRelativeTo[0]; + let grandParent = resourcesRelativeTo[1]; + let name = resource; + + if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { + name = join(parent, resource); + } + + this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; + break; + case 'function': + let meta = this.aurelia.resources.autoRegister(this.container, resource); + if (meta instanceof HtmlBehaviorResource && meta.elementName !== null) { + if (this.behaviorsToLoad.push(meta) === 1) { + this.postTask(() => loadBehaviors(this)); + } + } + break; + default: + throw new Error(invalidConfigMsg(resource, 'resource')); } - - this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; } return this; @@ -314,14 +367,21 @@ export let FrameworkConfiguration = class FrameworkConfiguration { return this; } - plugin(plugin, config) { + plugin(plugin, pluginConfig) { assertProcessed(this); - if (typeof plugin === 'string') { - return this.plugin({ moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: config || {} }); + let info; + switch (typeof plugin) { + case 'string': + info = { moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: pluginConfig || {} }; + break; + case 'function': + info = { configure: plugin, config: pluginConfig || {} }; + break; + default: + throw new Error(invalidConfigMsg(plugin, 'plugin')); } - - this.info.push(plugin); + this.info.push(info); return this; } @@ -403,6 +463,7 @@ export let FrameworkConfiguration = class FrameworkConfiguration { } this.processed = true; + this.configuredPlugins = null; return Promise.resolve(); }; diff --git a/dist/native-modules/aurelia-framework.js b/dist/native-modules/aurelia-framework.js index 5ecebbdf..df432971 100644 --- a/dist/native-modules/aurelia-framework.js +++ b/dist/native-modules/aurelia-framework.js @@ -1,9 +1,11 @@ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + import * as TheLogManager from 'aurelia-logging'; import { Container } from 'aurelia-dependency-injection'; import { Loader } from 'aurelia-loader'; -import { BindingLanguage, ViewSlot, ViewResources, TemplatingEngine, CompositionTransaction, ViewEngine } from 'aurelia-templating'; +import { BindingLanguage, ViewSlot, ViewResources, TemplatingEngine, CompositionTransaction, ViewEngine, HtmlBehaviorResource } from 'aurelia-templating'; import { DOM, PLATFORM } from 'aurelia-pal'; import { relativeToFile, join } from 'aurelia-path'; @@ -166,36 +168,53 @@ function runTasks(config, tasks) { return next(); } -function loadPlugin(config, loader, info) { +function loadPlugin(fwConfig, loader, info) { logger.debug('Loading plugin ' + info.moduleId + '.'); - config.resourcesRelativeTo = info.resourcesRelativeTo; + if (typeof info.moduleId === 'string') { + fwConfig.resourcesRelativeTo = info.resourcesRelativeTo; - var id = info.moduleId; + var id = info.moduleId; - if (info.resourcesRelativeTo.length > 1) { - return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { - return _loadPlugin(normalizedId); - }); - } + if (info.resourcesRelativeTo.length > 1) { + return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { + return _loadPlugin(normalizedId); + }); + } - return _loadPlugin(id); + return _loadPlugin(id); + } else if (typeof info.configure === 'function') { + if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) { + return Promise.resolve(); + } + fwConfig.configuredPlugins.push(info.configure); + + return Promise.resolve(info.configure.call(null, fwConfig, info.config || {})); + } + throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin')); function _loadPlugin(moduleId) { return loader.loadModule(moduleId).then(function (m) { if ('configure' in m) { - return Promise.resolve(m.configure(config, info.config || {})).then(function () { - config.resourcesRelativeTo = null; + if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) { + return Promise.resolve(); + } + return Promise.resolve(m.configure(fwConfig, info.config || {})).then(function () { + fwConfig.configuredPlugins.push(m.configure); + fwConfig.resourcesRelativeTo = null; logger.debug('Configured plugin ' + info.moduleId + '.'); }); } - config.resourcesRelativeTo = null; + fwConfig.resourcesRelativeTo = null; logger.debug('Loaded plugin ' + info.moduleId + '.'); }); } } function loadResources(aurelia, resourcesToLoad, appResources) { + if (Object.keys(resourcesToLoad).length === 0) { + return Promise.resolve(); + } var viewEngine = aurelia.container.get(ViewEngine); return Promise.all(Object.keys(resourcesToLoad).map(function (n) { @@ -252,12 +271,24 @@ function getExt(name) { } } +function loadBehaviors(config) { + return Promise.all(config.behaviorsToLoad.map(function (m) { + return m.load(config.container, m.target); + })).then(function () { + config.behaviorsToLoad = null; + }); +} + function assertProcessed(plugins) { if (plugins.processed) { throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.'); } } +function invalidConfigMsg(cfg, type) { + return 'Invalid ' + type + ' [' + cfg + '], ' + type + ' must be specified as functions or relative module IDs.'; +} + var FrameworkConfiguration = function () { function FrameworkConfiguration(aurelia) { var _this4 = this; @@ -266,10 +297,15 @@ var FrameworkConfiguration = function () { this.aurelia = aurelia; this.container = aurelia.container; + this.info = []; this.processed = false; this.preTasks = []; this.postTasks = []; + + this.behaviorsToLoad = []; + + this.configuredPlugins = []; this.resourcesToLoad = {}; this.preTask(function () { return aurelia.loader.normalize('aurelia-bootstrapper').then(function (name) { @@ -311,13 +347,26 @@ var FrameworkConfiguration = function () { FrameworkConfiguration.prototype.feature = function feature(plugin) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var hasIndex = /\/index$/i.test(plugin); - var moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; - var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; - return this.plugin({ moduleId: moduleId, resourcesRelativeTo: [root, ''], config: config }); + switch (typeof plugin === 'undefined' ? 'undefined' : _typeof(plugin)) { + case 'string': + var hasIndex = /\/index$/i.test(plugin); + var _moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; + var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; + this.info.push({ moduleId: _moduleId, resourcesRelativeTo: [root, ''], config: config }); + break; + + case 'function': + this.info.push({ configure: plugin, config: config || {} }); + break; + default: + throw new Error(invalidConfigMsg(plugin, 'feature')); + } + return this; }; FrameworkConfiguration.prototype.globalResources = function globalResources(resources) { + var _this5 = this; + assertProcessed(this); var toAdd = Array.isArray(resources) ? resources : arguments; @@ -326,19 +375,31 @@ var FrameworkConfiguration = function () { for (var i = 0, ii = toAdd.length; i < ii; ++i) { resource = toAdd[i]; - if (typeof resource !== 'string') { - throw new Error('Invalid resource path [' + resource + ']. Resources must be specified as relative module IDs.'); + switch (typeof resource === 'undefined' ? 'undefined' : _typeof(resource)) { + case 'string': + var parent = resourcesRelativeTo[0]; + var grandParent = resourcesRelativeTo[1]; + var name = resource; + + if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { + name = join(parent, resource); + } + + this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; + break; + case 'function': + var meta = this.aurelia.resources.autoRegister(this.container, resource); + if (meta instanceof HtmlBehaviorResource && meta.elementName !== null) { + if (this.behaviorsToLoad.push(meta) === 1) { + this.postTask(function () { + return loadBehaviors(_this5); + }); + } + } + break; + default: + throw new Error(invalidConfigMsg(resource, 'resource')); } - - var parent = resourcesRelativeTo[0]; - var grandParent = resourcesRelativeTo[1]; - var name = resource; - - if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { - name = join(parent, resource); - } - - this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; } return this; @@ -350,25 +411,32 @@ var FrameworkConfiguration = function () { return this; }; - FrameworkConfiguration.prototype.plugin = function plugin(_plugin, config) { + FrameworkConfiguration.prototype.plugin = function plugin(_plugin, pluginConfig) { assertProcessed(this); - if (typeof _plugin === 'string') { - return this.plugin({ moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: config || {} }); + var info = void 0; + switch (typeof _plugin === 'undefined' ? 'undefined' : _typeof(_plugin)) { + case 'string': + info = { moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: pluginConfig || {} }; + break; + case 'function': + info = { configure: _plugin, config: pluginConfig || {} }; + break; + default: + throw new Error(invalidConfigMsg(_plugin, 'plugin')); } - - this.info.push(_plugin); + this.info.push(info); return this; }; FrameworkConfiguration.prototype._addNormalizedPlugin = function _addNormalizedPlugin(name, config) { - var _this5 = this; + var _this6 = this; var plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} }; this.plugin(plugin); this.preTask(function () { - var relativeTo = [name, _this5.bootstrapperName]; + var relativeTo = [name, _this6.bootstrapperName]; plugin.moduleId = name; plugin.resourcesRelativeTo = relativeTo; return Promise.resolve(); @@ -406,7 +474,7 @@ var FrameworkConfiguration = function () { }; FrameworkConfiguration.prototype.developmentLogging = function developmentLogging(level) { - var _this6 = this; + var _this7 = this; var logLevel = level ? TheLogManager.logLevel[level] : undefined; @@ -415,8 +483,8 @@ var FrameworkConfiguration = function () { } this.preTask(function () { - return _this6.aurelia.loader.normalize('aurelia-logging-console', _this6.bootstrapperName).then(function (name) { - return _this6.aurelia.loader.loadModule(name).then(function (m) { + return _this7.aurelia.loader.normalize('aurelia-logging-console', _this7.bootstrapperName).then(function (name) { + return _this7.aurelia.loader.loadModule(name).then(function (m) { TheLogManager.addAppender(new m.ConsoleAppender()); TheLogManager.setLevel(logLevel); }); @@ -427,29 +495,30 @@ var FrameworkConfiguration = function () { }; FrameworkConfiguration.prototype.apply = function apply() { - var _this7 = this; + var _this8 = this; if (this.processed) { return Promise.resolve(); } return runTasks(this, this.preTasks).then(function () { - var loader = _this7.aurelia.loader; - var info = _this7.info; + var loader = _this8.aurelia.loader; + var info = _this8.info; var current = void 0; var next = function next() { current = info.shift(); if (current) { - return loadPlugin(_this7, loader, current).then(next); + return loadPlugin(_this8, loader, current).then(next); } - _this7.processed = true; + _this8.processed = true; + _this8.configuredPlugins = null; return Promise.resolve(); }; return next().then(function () { - return runTasks(_this7, _this7.postTasks); + return runTasks(_this8, _this8.postTasks); }); }); }; diff --git a/dist/system/aurelia-framework.js b/dist/system/aurelia-framework.js index f837117e..b163c995 100644 --- a/dist/system/aurelia-framework.js +++ b/dist/system/aurelia-framework.js @@ -3,7 +3,7 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loader', 'aurelia-templating', 'aurelia-pal', 'aurelia-path', 'aurelia-binding', 'aurelia-metadata', 'aurelia-task-queue'], function (_export, _context) { "use strict"; - var TheLogManager, Container, Loader, BindingLanguage, ViewSlot, ViewResources, TemplatingEngine, CompositionTransaction, ViewEngine, DOM, PLATFORM, relativeToFile, join, Aurelia, logger, extPattern, FrameworkConfiguration, LogManager; + var TheLogManager, Container, Loader, BindingLanguage, ViewSlot, ViewResources, TemplatingEngine, CompositionTransaction, ViewEngine, HtmlBehaviorResource, DOM, PLATFORM, relativeToFile, join, _typeof, Aurelia, logger, extPattern, FrameworkConfiguration, LogManager; @@ -32,36 +32,53 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa return next(); } - function loadPlugin(config, loader, info) { + function loadPlugin(fwConfig, loader, info) { logger.debug('Loading plugin ' + info.moduleId + '.'); - config.resourcesRelativeTo = info.resourcesRelativeTo; + if (typeof info.moduleId === 'string') { + fwConfig.resourcesRelativeTo = info.resourcesRelativeTo; - var id = info.moduleId; + var id = info.moduleId; - if (info.resourcesRelativeTo.length > 1) { - return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { - return _loadPlugin(normalizedId); - }); - } + if (info.resourcesRelativeTo.length > 1) { + return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { + return _loadPlugin(normalizedId); + }); + } - return _loadPlugin(id); + return _loadPlugin(id); + } else if (typeof info.configure === 'function') { + if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) { + return Promise.resolve(); + } + fwConfig.configuredPlugins.push(info.configure); + + return Promise.resolve(info.configure.call(null, fwConfig, info.config || {})); + } + throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin')); function _loadPlugin(moduleId) { return loader.loadModule(moduleId).then(function (m) { if ('configure' in m) { - return Promise.resolve(m.configure(config, info.config || {})).then(function () { - config.resourcesRelativeTo = null; + if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) { + return Promise.resolve(); + } + return Promise.resolve(m.configure(fwConfig, info.config || {})).then(function () { + fwConfig.configuredPlugins.push(m.configure); + fwConfig.resourcesRelativeTo = null; logger.debug('Configured plugin ' + info.moduleId + '.'); }); } - config.resourcesRelativeTo = null; + fwConfig.resourcesRelativeTo = null; logger.debug('Loaded plugin ' + info.moduleId + '.'); }); } } function loadResources(aurelia, resourcesToLoad, appResources) { + if (Object.keys(resourcesToLoad).length === 0) { + return Promise.resolve(); + } var viewEngine = aurelia.container.get(ViewEngine); return Promise.all(Object.keys(resourcesToLoad).map(function (n) { @@ -118,12 +135,24 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa } } + function loadBehaviors(config) { + return Promise.all(config.behaviorsToLoad.map(function (m) { + return m.load(config.container, m.target); + })).then(function () { + config.behaviorsToLoad = null; + }); + } + function assertProcessed(plugins) { if (plugins.processed) { throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.'); } } + function invalidConfigMsg(cfg, type) { + return 'Invalid ' + type + ' [' + cfg + '], ' + type + ' must be specified as functions or relative module IDs.'; + } + return { setters: [function (_aureliaLogging) { TheLogManager = _aureliaLogging; @@ -152,6 +181,7 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa TemplatingEngine = _aureliaTemplating.TemplatingEngine; CompositionTransaction = _aureliaTemplating.CompositionTransaction; ViewEngine = _aureliaTemplating.ViewEngine; + HtmlBehaviorResource = _aureliaTemplating.HtmlBehaviorResource; var _exportObj3 = {}; for (var _key3 in _aureliaTemplating) { @@ -205,6 +235,12 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa _export(_exportObj8); }], execute: function () { + _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + _export('Aurelia', Aurelia = function () { function Aurelia(loader, container, resources) { @@ -349,10 +385,15 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa this.aurelia = aurelia; this.container = aurelia.container; + this.info = []; this.processed = false; this.preTasks = []; this.postTasks = []; + + this.behaviorsToLoad = []; + + this.configuredPlugins = []; this.resourcesToLoad = {}; this.preTask(function () { return aurelia.loader.normalize('aurelia-bootstrapper').then(function (name) { @@ -394,13 +435,26 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa FrameworkConfiguration.prototype.feature = function feature(plugin) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var hasIndex = /\/index$/i.test(plugin); - var moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; - var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; - return this.plugin({ moduleId: moduleId, resourcesRelativeTo: [root, ''], config: config }); + switch (typeof plugin === 'undefined' ? 'undefined' : _typeof(plugin)) { + case 'string': + var hasIndex = /\/index$/i.test(plugin); + var _moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; + var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; + this.info.push({ moduleId: _moduleId, resourcesRelativeTo: [root, ''], config: config }); + break; + + case 'function': + this.info.push({ configure: plugin, config: config || {} }); + break; + default: + throw new Error(invalidConfigMsg(plugin, 'feature')); + } + return this; }; FrameworkConfiguration.prototype.globalResources = function globalResources(resources) { + var _this5 = this; + assertProcessed(this); var toAdd = Array.isArray(resources) ? resources : arguments; @@ -409,19 +463,31 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa for (var i = 0, ii = toAdd.length; i < ii; ++i) { resource = toAdd[i]; - if (typeof resource !== 'string') { - throw new Error('Invalid resource path [' + resource + ']. Resources must be specified as relative module IDs.'); - } - - var parent = resourcesRelativeTo[0]; - var grandParent = resourcesRelativeTo[1]; - var name = resource; - - if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { - name = join(parent, resource); + switch (typeof resource === 'undefined' ? 'undefined' : _typeof(resource)) { + case 'string': + var parent = resourcesRelativeTo[0]; + var grandParent = resourcesRelativeTo[1]; + var name = resource; + + if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { + name = join(parent, resource); + } + + this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; + break; + case 'function': + var meta = this.aurelia.resources.autoRegister(this.container, resource); + if (meta instanceof HtmlBehaviorResource && meta.elementName !== null) { + if (this.behaviorsToLoad.push(meta) === 1) { + this.postTask(function () { + return loadBehaviors(_this5); + }); + } + } + break; + default: + throw new Error(invalidConfigMsg(resource, 'resource')); } - - this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; } return this; @@ -433,25 +499,32 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa return this; }; - FrameworkConfiguration.prototype.plugin = function plugin(_plugin, config) { + FrameworkConfiguration.prototype.plugin = function plugin(_plugin, pluginConfig) { assertProcessed(this); - if (typeof _plugin === 'string') { - return this.plugin({ moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: config || {} }); + var info = void 0; + switch (typeof _plugin === 'undefined' ? 'undefined' : _typeof(_plugin)) { + case 'string': + info = { moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: pluginConfig || {} }; + break; + case 'function': + info = { configure: _plugin, config: pluginConfig || {} }; + break; + default: + throw new Error(invalidConfigMsg(_plugin, 'plugin')); } - - this.info.push(_plugin); + this.info.push(info); return this; }; FrameworkConfiguration.prototype._addNormalizedPlugin = function _addNormalizedPlugin(name, config) { - var _this5 = this; + var _this6 = this; var plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} }; this.plugin(plugin); this.preTask(function () { - var relativeTo = [name, _this5.bootstrapperName]; + var relativeTo = [name, _this6.bootstrapperName]; plugin.moduleId = name; plugin.resourcesRelativeTo = relativeTo; return Promise.resolve(); @@ -489,7 +562,7 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa }; FrameworkConfiguration.prototype.developmentLogging = function developmentLogging(level) { - var _this6 = this; + var _this7 = this; var logLevel = level ? TheLogManager.logLevel[level] : undefined; @@ -498,8 +571,8 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa } this.preTask(function () { - return _this6.aurelia.loader.normalize('aurelia-logging-console', _this6.bootstrapperName).then(function (name) { - return _this6.aurelia.loader.loadModule(name).then(function (m) { + return _this7.aurelia.loader.normalize('aurelia-logging-console', _this7.bootstrapperName).then(function (name) { + return _this7.aurelia.loader.loadModule(name).then(function (m) { TheLogManager.addAppender(new m.ConsoleAppender()); TheLogManager.setLevel(logLevel); }); @@ -510,29 +583,30 @@ System.register(['aurelia-logging', 'aurelia-dependency-injection', 'aurelia-loa }; FrameworkConfiguration.prototype.apply = function apply() { - var _this7 = this; + var _this8 = this; if (this.processed) { return Promise.resolve(); } return runTasks(this, this.preTasks).then(function () { - var loader = _this7.aurelia.loader; - var info = _this7.info; + var loader = _this8.aurelia.loader; + var info = _this8.info; var current = void 0; var next = function next() { current = info.shift(); if (current) { - return loadPlugin(_this7, loader, current).then(next); + return loadPlugin(_this8, loader, current).then(next); } - _this7.processed = true; + _this8.processed = true; + _this8.configuredPlugins = null; return Promise.resolve(); }; return next().then(function () { - return runTasks(_this7, _this7.postTasks); + return runTasks(_this8, _this8.postTasks); }); }); }; diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 2f5fb954..58484328 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,14 @@ + +# [1.3.0-rc.1](https://github.com/aurelia/framework/compare/1.2.0...1.3.0-rc.1) (2018-06-21) + + +### Features + +* **Aurelia:** ability to define root with constructor ([15fc9dd](https://github.com/aurelia/framework/commit/15fc9dd)) +* **config:** accepts classes beside module id string ([80a3d39](https://github.com/aurelia/framework/commit/80a3d39)) + + + # [1.2.0](https://github.com/aurelia/framework/compare/1.1.5...1.2.0) (2018-03-29) diff --git a/doc/api.json b/doc/api.json index db34f6b7..59968e2e 100644 --- a/doc/api.json +++ b/doc/api.json @@ -1 +1 @@ -{"name":"aurelia-framework","children":[{"id":2,"name":"Aurelia","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"The framework core that provides the main Aurelia object."},"children":[{"id":8,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates an instance of Aurelia."},"signatures":[{"id":9,"name":"new Aurelia","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates an instance of Aurelia."},"parameters":[{"id":10,"name":"loader","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The loader for this Aurelia instance to use. If a loader is not specified, Aurelia will use the loader type specified by PLATFORM.Loader."},"type":{"type":"reference","name":"Loader"}},{"id":11,"name":"container","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The dependency injection container for this Aurelia instance to use. If a container is not specified, Aurelia will create an empty, global container."},"type":{"type":"reference","name":"Container"}},{"id":12,"name":"resources","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.\n"},"type":{"type":"reference","name":"ViewResources"}}],"type":{"type":"reference","name":"Aurelia","id":2}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":54,"character":30}]},{"id":5,"name":"container","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The root DI container used by the application."},"sources":[{"fileName":"aurelia-framework.d.ts","line":44,"character":11}],"type":{"type":"reference","name":"Container"}},{"id":3,"name":"host","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The DOM Element that Aurelia will attach to."},"sources":[{"fileName":"aurelia-framework.d.ts","line":33,"character":6}],"type":{"type":"reference","name":"Element"}},{"id":4,"name":"loader","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"/**\nThe loader used by the application."},"sources":[{"fileName":"aurelia-framework.d.ts","line":39,"character":8}],"type":{"type":"reference","name":"Loader"}},{"id":6,"name":"resources","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The global view resources used by the application."},"sources":[{"fileName":"aurelia-framework.d.ts","line":49,"character":11}],"type":{"type":"reference","name":"ViewResources"}},{"id":7,"name":"use","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The configuration used during application startup."},"sources":[{"fileName":"aurelia-framework.d.ts","line":54,"character":5}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}},{"id":15,"name":"enhance","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":16,"name":"enhance","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Enhances the host's existing elements with behaviors and bindings.","returns":"Returns a Promise for the current Aurelia instance.\n"},"parameters":[{"id":17,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"A binding context for the enhanced elements."},"type":{"type":"reference","name":"Object"}},{"id":18,"name":"applicationHost","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The DOM object that Aurelia will enhance."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Element"}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia","id":2}]}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":76,"character":9}]},{"id":19,"name":"setRoot","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":20,"name":"setRoot","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Instantiates the root component and adds it to the DOM.","returns":"Returns a Promise of the current Aurelia instance.\n"},"parameters":[{"id":21,"name":"root","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The root component to load upon bootstrap."},"type":{"type":"intrinsic","name":"string"}},{"id":22,"name":"applicationHost","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The DOM object that Aurelia will attach to."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Element"}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia","id":2}]}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":84,"character":9}]},{"id":13,"name":"start","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":14,"name":"start","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads plugins, then resources, and then starts the Aurelia instance.","returns":"Returns a Promise with the started Aurelia instance.\n"},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia","id":2}]}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":68,"character":7}]}],"groups":[{"title":"Constructors","kind":512,"children":[8]},{"title":"Properties","kind":1024,"children":[5,3,4,6,7]},{"title":"Methods","kind":2048,"children":[15,19,13]}],"sources":[{"fileName":"aurelia-framework.d.ts","line":28,"character":28}]},{"id":23,"name":"FrameworkConfiguration","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Manages configuring the aurelia framework instance."},"children":[{"id":26,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates an instance of FrameworkConfiguration."},"signatures":[{"id":27,"name":"new FrameworkConfiguration","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates an instance of FrameworkConfiguration."},"parameters":[{"id":28,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"An instance of Aurelia.\n"},"type":{"type":"reference","name":"Aurelia","id":2}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":100,"character":19}]},{"id":25,"name":"aurelia","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The aurelia instance."},"sources":[{"fileName":"aurelia-framework.d.ts","line":100,"character":9}],"type":{"type":"reference","name":"Aurelia","id":2}},{"id":24,"name":"container","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The root DI container used by the application."},"sources":[{"fileName":"aurelia-framework.d.ts","line":95,"character":11}],"type":{"type":"reference","name":"Container"}},{"id":79,"name":"apply","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":80,"name":"apply","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads and configures the plugins registered with this instance.","returns":"Returns a promise which resolves when all plugins are loaded and configured.\n"},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":237,"character":7}]},{"id":72,"name":"basicConfiguration","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":73,"name":"basicConfiguration","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets up a basic Aurelia configuration. This is equivalent to calling `.defaultBindingLanguage().defaultResources().eventAggregator();`","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":218,"character":20}]},{"id":62,"name":"defaultBindingLanguage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":63,"name":"defaultBindingLanguage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the default binding language from aurelia-templating-binding.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":188,"character":24}]},{"id":68,"name":"defaultResources","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":69,"name":"defaultResources","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the default templating resources (if, repeat, show, compose, etc.) from aurelia-templating-resources.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":206,"character":18}]},{"id":76,"name":"developmentLogging","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":77,"name":"developmentLogging","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the ConsoleAppender and sets the log level to debug.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":78,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The log level (none/error/warn/info/debug), default to 'debug'."},"type":{"type":"reference","name":"String"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":231,"character":20}]},{"id":70,"name":"eventAggregator","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":71,"name":"eventAggregator","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the event aggregator from aurelia-event-aggregator.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":212,"character":17}]},{"id":47,"name":"feature","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":48,"name":"feature","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Configures an internal feature plugin before Aurelia starts.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":49,"name":"plugin","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The folder for the internal plugin to configure (expects an index.js in that folder)."},"type":{"type":"intrinsic","name":"string"}},{"id":50,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The configuration for the specified plugin."},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":152,"character":9}]},{"id":54,"name":"globalName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":55,"name":"globalName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Renames a global resource that was imported.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":56,"name":"resourcePath","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The path to the resource."},"type":{"type":"intrinsic","name":"string"}},{"id":57,"name":"newName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The new name."},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":167,"character":12}]},{"id":51,"name":"globalResources","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":52,"name":"globalResources","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds globally available view resources to be imported into the Aurelia framework.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":53,"name":"resources","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The relative module id to the resource. (Relative to the plugin's installer.)"},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"array","elementType":{"type":"intrinsic","name":"string"}}]}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":159,"character":17}]},{"id":66,"name":"history","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":67,"name":"history","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the default history implementation from aurelia-history-browser.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":200,"character":9}]},{"id":29,"name":"instance","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":30,"name":"instance","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an existing object to the framework's dependency injection container.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":31,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object type of the dependency that the framework will inject."},"type":{"type":"intrinsic","name":"any"}},{"id":32,"name":"instance","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The existing instance of the dependency that the framework will inject."},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":114,"character":10}]},{"id":58,"name":"plugin","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":59,"name":"plugin","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Configures an external, 3rd party plugin before Aurelia starts.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":60,"name":"plugin","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The ID of the 3rd party plugin to configure."},"type":{"type":"intrinsic","name":"string"}},{"id":61,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The configuration for the specified plugin."},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":175,"character":8}]},{"id":44,"name":"postTask","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":45,"name":"postTask","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an async function that runs after the plugins are run.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":46,"name":"task","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to run after start."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":144,"character":10}]},{"id":41,"name":"preTask","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":42,"name":"preTask","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an async function that runs before the plugins are run.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":43,"name":"task","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to run before start."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":137,"character":9}]},{"id":64,"name":"router","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":65,"name":"router","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the router from aurelia-templating-router.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":194,"character":8}]},{"id":33,"name":"singleton","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":34,"name":"singleton","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a singleton to the framework's dependency injection container.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":35,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object type of the dependency that the framework will inject."},"type":{"type":"intrinsic","name":"any"}},{"id":36,"name":"implementation","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The constructor function of the dependency that the framework will inject."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":122,"character":11}]},{"id":74,"name":"standardConfiguration","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":75,"name":"standardConfiguration","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets up the standard Aurelia configuration. This is equivalent to calling `.defaultBindingLanguage().defaultResources().eventAggregator().history().router();`","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":224,"character":23}]},{"id":37,"name":"transient","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":38,"name":"transient","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a transient to the framework's dependency injection container.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":39,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object type of the dependency that the framework will inject."},"type":{"type":"intrinsic","name":"any"}},{"id":40,"name":"implementation","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The constructor function of the dependency that the framework will inject."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":23}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":130,"character":11}]}],"groups":[{"title":"Constructors","kind":512,"children":[26]},{"title":"Properties","kind":1024,"children":[25,24]},{"title":"Methods","kind":2048,"children":[79,72,62,68,76,70,47,54,51,66,29,58,44,41,64,33,74,37]}],"sources":[{"fileName":"aurelia-framework.d.ts","line":90,"character":43}]},{"id":81,"name":"LogManager","kind":32,"kindString":"Variable","flags":{"isExported":true,"isConst":true},"comment":{"shortText":"The log manager."},"sources":[{"fileName":"aurelia-framework.d.ts","line":249,"character":23}],"type":{"type":"reference","name":"\"/Users/EisenbergEffect/Documents/GitHub/aurelia/framework/node_modules/aurelia-logging/dist/aurelia-logging\""}}],"groups":[{"title":"Classes","kind":128,"children":[2,23]},{"title":"Variables","kind":32,"children":[81]}]} \ No newline at end of file +{"name":"aurelia-framework","children":[{"id":11,"name":"Aurelia","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"The framework core that provides the main Aurelia object."},"children":[{"id":17,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates an instance of Aurelia."},"signatures":[{"id":18,"name":"new Aurelia","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates an instance of Aurelia."},"parameters":[{"id":19,"name":"loader","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The loader for this Aurelia instance to use. If a loader is not specified, Aurelia will use the loader type specified by PLATFORM.Loader."},"type":{"type":"reference","name":"Loader"}},{"id":20,"name":"container","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The dependency injection container for this Aurelia instance to use. If a container is not specified, Aurelia will create an empty, global container."},"type":{"type":"reference","name":"Container"}},{"id":21,"name":"resources","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.\n"},"type":{"type":"reference","name":"ViewResources"}}],"type":{"type":"reference","name":"Aurelia","id":11}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":61,"character":30}]},{"id":14,"name":"container","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The root DI container used by the application."},"sources":[{"fileName":"aurelia-framework.d.ts","line":51,"character":11}],"type":{"type":"reference","name":"Container"}},{"id":12,"name":"host","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The DOM Element that Aurelia will attach to."},"sources":[{"fileName":"aurelia-framework.d.ts","line":40,"character":6}],"type":{"type":"reference","name":"Element"}},{"id":13,"name":"loader","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"/**\nThe loader used by the application."},"sources":[{"fileName":"aurelia-framework.d.ts","line":46,"character":8}],"type":{"type":"reference","name":"Loader"}},{"id":15,"name":"resources","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The global view resources used by the application."},"sources":[{"fileName":"aurelia-framework.d.ts","line":56,"character":11}],"type":{"type":"reference","name":"ViewResources"}},{"id":16,"name":"use","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The configuration used during application startup."},"sources":[{"fileName":"aurelia-framework.d.ts","line":61,"character":5}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}},{"id":24,"name":"enhance","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":25,"name":"enhance","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Enhances the host's existing elements with behaviors and bindings.","returns":"Returns a Promise for the current Aurelia instance.\n"},"parameters":[{"id":26,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"A binding context for the enhanced elements."},"type":{"type":"reference","name":"Object"}},{"id":27,"name":"applicationHost","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The DOM object that Aurelia will enhance."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Element"}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia","id":11}]}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":83,"character":9}]},{"id":28,"name":"setRoot","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":29,"name":"setRoot","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Instantiates the root component and adds it to the DOM.","returns":"Returns a Promise of the current Aurelia instance.\n"},"parameters":[{"id":30,"name":"root","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The root component to load upon bootstrap."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Function"}]}},{"id":31,"name":"applicationHost","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The DOM object that Aurelia will attach to."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Element"}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia","id":11}]}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":91,"character":9}]},{"id":22,"name":"start","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":23,"name":"start","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads plugins, then resources, and then starts the Aurelia instance.","returns":"Returns a Promise with the started Aurelia instance.\n"},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia","id":11}]}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":75,"character":7}]}],"groups":[{"title":"Constructors","kind":512,"children":[17]},{"title":"Properties","kind":1024,"children":[14,12,13,15,16]},{"title":"Methods","kind":2048,"children":[24,28,22]}],"sources":[{"fileName":"aurelia-framework.d.ts","line":35,"character":28}]},{"id":32,"name":"FrameworkConfiguration","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Manages configuring the aurelia framework instance."},"children":[{"id":35,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates an instance of FrameworkConfiguration."},"signatures":[{"id":36,"name":"new FrameworkConfiguration","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates an instance of FrameworkConfiguration."},"parameters":[{"id":37,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"An instance of Aurelia.\n"},"type":{"type":"reference","name":"Aurelia","id":11}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":107,"character":19}]},{"id":34,"name":"aurelia","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The aurelia instance."},"sources":[{"fileName":"aurelia-framework.d.ts","line":107,"character":9}],"type":{"type":"reference","name":"Aurelia","id":11}},{"id":33,"name":"container","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The root DI container used by the application."},"sources":[{"fileName":"aurelia-framework.d.ts","line":102,"character":11}],"type":{"type":"reference","name":"Container"}},{"id":95,"name":"apply","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":96,"name":"apply","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads and configures the plugins registered with this instance.","returns":"Returns a promise which resolves when all plugins are loaded and configured.\n"},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":244,"character":7}]},{"id":88,"name":"basicConfiguration","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":89,"name":"basicConfiguration","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets up a basic Aurelia configuration. This is equivalent to calling `.defaultBindingLanguage().defaultResources().eventAggregator();`","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":225,"character":20}]},{"id":78,"name":"defaultBindingLanguage","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":79,"name":"defaultBindingLanguage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the default binding language from aurelia-templating-binding.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":195,"character":24}]},{"id":84,"name":"defaultResources","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":85,"name":"defaultResources","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the default templating resources (if, repeat, show, compose, etc.) from aurelia-templating-resources.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":213,"character":18}]},{"id":92,"name":"developmentLogging","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":93,"name":"developmentLogging","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the ConsoleAppender and sets the log level to debug.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":94,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The log level (none/error/warn/info/debug), default to 'debug'."},"type":{"type":"reference","name":"String"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":238,"character":20}]},{"id":86,"name":"eventAggregator","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":87,"name":"eventAggregator","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the event aggregator from aurelia-event-aggregator.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":219,"character":17}]},{"id":56,"name":"feature","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":57,"name":"feature","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Configures an internal feature plugin before Aurelia starts.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":58,"name":"plugin","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The folder for the internal plugin to configure (expects an index.js in that folder)."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reflection","declaration":{"id":59,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":60,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":61,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}},{"id":62,"name":"pluginConfig","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"any"}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":159,"character":26}]}}]}},{"id":63,"name":"config","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The configuration for the specified plugin."},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":159,"character":9}]},{"id":67,"name":"globalName","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":68,"name":"globalName","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Renames a global resource that was imported.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":69,"name":"resourcePath","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The path to the resource."},"type":{"type":"intrinsic","name":"string"}},{"id":70,"name":"newName","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The new name."},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":174,"character":12}]},{"id":64,"name":"globalResources","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":65,"name":"globalResources","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds globally available view resources to be imported into the Aurelia framework.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":66,"name":"resources","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The relative module id to the resource. (Relative to the plugin's installer.)"},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Function"},{"type":"reference","name":"Array","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Function"}]}]}]}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":166,"character":17}]},{"id":82,"name":"history","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":83,"name":"history","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the default history implementation from aurelia-history-browser.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":207,"character":9}]},{"id":38,"name":"instance","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":39,"name":"instance","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an existing object to the framework's dependency injection container.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":40,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object type of the dependency that the framework will inject."},"type":{"type":"intrinsic","name":"any"}},{"id":41,"name":"instance","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The existing instance of the dependency that the framework will inject."},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":121,"character":10}]},{"id":71,"name":"plugin","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":72,"name":"plugin","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Configures an external, 3rd party plugin before Aurelia starts.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":73,"name":"plugin","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The ID of the 3rd party plugin to configure."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reflection","declaration":{"id":74,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":75,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":76,"name":"frameworkConfig","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"type":{"type":"intrinsic","name":"any"}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":182,"character":25}]}},{"type":"reference","name":"FrameworkPluginInfo","id":2}]}},{"id":77,"name":"pluginConfig","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The configuration for the specified plugin."},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":182,"character":8}]},{"id":53,"name":"postTask","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":54,"name":"postTask","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an async function that runs after the plugins are run.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":55,"name":"task","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to run after start."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":151,"character":10}]},{"id":50,"name":"preTask","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":51,"name":"preTask","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an async function that runs before the plugins are run.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":52,"name":"task","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The function to run before start."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":144,"character":9}]},{"id":80,"name":"router","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":81,"name":"router","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Plugs in the router from aurelia-templating-router.","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":201,"character":8}]},{"id":42,"name":"singleton","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":43,"name":"singleton","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a singleton to the framework's dependency injection container.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":44,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object type of the dependency that the framework will inject."},"type":{"type":"intrinsic","name":"any"}},{"id":45,"name":"implementation","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The constructor function of the dependency that the framework will inject."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":129,"character":11}]},{"id":90,"name":"standardConfiguration","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":91,"name":"standardConfiguration","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets up the standard Aurelia configuration. This is equivalent to calling `.defaultBindingLanguage().defaultResources().eventAggregator().history().router();`","returns":"Returns the current FrameworkConfiguration instance.\n"},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":231,"character":23}]},{"id":46,"name":"transient","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":47,"name":"transient","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a transient to the framework's dependency injection container.","returns":"Returns the current FrameworkConfiguration instance.\n"},"parameters":[{"id":48,"name":"type","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The object type of the dependency that the framework will inject."},"type":{"type":"intrinsic","name":"any"}},{"id":49,"name":"implementation","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The constructor function of the dependency that the framework will inject."},"type":{"type":"reference","name":"Function"}}],"type":{"type":"reference","name":"FrameworkConfiguration","id":32}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":137,"character":11}]}],"groups":[{"title":"Constructors","kind":512,"children":[35]},{"title":"Properties","kind":1024,"children":[34,33]},{"title":"Methods","kind":2048,"children":[95,88,78,84,92,86,56,67,64,82,38,71,53,50,80,42,90,46]}],"sources":[{"fileName":"aurelia-framework.d.ts","line":97,"character":43}]},{"id":2,"name":"FrameworkPluginInfo","kind":256,"kindString":"Interface","flags":{"isExported":true},"children":[{"id":10,"name":"config","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"sources":[{"fileName":"aurelia-framework.d.ts","line":29,"character":8}],"type":{"type":"intrinsic","name":"any"}},{"id":5,"name":"configure","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"sources":[{"fileName":"aurelia-framework.d.ts","line":28,"character":11}],"type":{"type":"reflection","declaration":{"id":6,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":7,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":8,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FrameworkConfiguration","id":32}},{"id":9,"name":"pluginConfig","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"any"}}],"sources":[{"fileName":"aurelia-framework.d.ts","line":28,"character":13}]}}},{"id":3,"name":"moduleId","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"sources":[{"fileName":"aurelia-framework.d.ts","line":26,"character":10}],"type":{"type":"intrinsic","name":"string"}},{"id":4,"name":"resourcesRelativeTo","kind":1024,"kindString":"Property","flags":{"isExported":true,"isOptional":true},"sources":[{"fileName":"aurelia-framework.d.ts","line":27,"character":21}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}}],"groups":[{"title":"Properties","kind":1024,"children":[10,5,3,4]}],"sources":[{"fileName":"aurelia-framework.d.ts","line":25,"character":44}]}],"groups":[{"title":"Classes","kind":128,"children":[11,32]},{"title":"Interfaces","kind":256,"children":[2]}]} \ No newline at end of file diff --git a/package.json b/package.json index ae0785a4..54bf42b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-framework", - "version": "1.2.0", + "version": "1.3.0-rc.1", "description": "The aurelia framework brings together all the required core aurelia libraries into a ready-to-go application-building platform.", "keywords": [ "aurelia", @@ -36,7 +36,7 @@ "aurelia-pal": "^1.0.0", "aurelia-path": "^1.0.0", "aurelia-task-queue": "^1.0.0", - "aurelia-templating": "^1.0.0" + "aurelia-templating": "^1.8.0-rc.1" }, "dependencies": { "aurelia-binding": "^1.0.0 || ^2.0.0", @@ -47,7 +47,7 @@ "aurelia-pal": "^1.0.0", "aurelia-path": "^1.0.0", "aurelia-task-queue": "^1.0.0", - "aurelia-templating": "^1.0.0" + "aurelia-templating": "^1.8.0-rc.1" }, "devDependencies": { "aurelia-pal-browser": "^1.0.0-rc.1.0.0", @@ -65,7 +65,7 @@ "aurelia-pal": "^1.0.0", "aurelia-path": "^1.0.0", "aurelia-task-queue": "^1.0.0", - "aurelia-templating": "^1.0.0" + "aurelia-templating": "^1.8.0-rc.1" }, "devDependencies": { "aurelia-tools": "^0.2.4", @@ -113,79 +113,5 @@ "vinyl": "^1.1.1", "vinyl-paths": "^2.1.0", "yargs": "^4.8.1" - }, - "aurelia": { - "documentation": { - "articles": [ - { - "title": "What is Aurelia?", - "href": "doc/article/en-US/what-is-aurelia.md" - }, - { - "title": "Quick Start", - "href": "doc/article/en-US/quick-start.md" - }, - { - "title": "Contact Manager Tutorial", - "href": "doc/article/en-US/contact-manager-tutorial.md" - }, - { - "title": "The Aurelia CLI", - "href": "doc/article/en-US/the-aurelia-cli.md" - }, - { - "title": "JSPM Setup", - "href": "doc/article/en-US/setup-jspm.md" - }, - { - "title": "JSPM Bundling", - "href": "doc/article/en-US/bundling-jspm.md" - }, - { - "title": "Webpack Setup", - "href": "doc/article/en-US/setup-webpack.md" - }, - { - "title": "Webpack Bundling", - "href": "doc/article/en-US/bundling-webpack.md" - }, - { - "title": "Creating Components", - "href": "doc/article/en-US/creating-components.md" - }, - { - "title": "App Configuration and Startup", - "href": "doc/article/en-US/app-configuration-and-startup.md" - }, - { - "title": "Securing Your App", - "href": "doc/article/en-US/securing-your-app.md" - }, - { - "title": "Cheat Sheet", - "href": "doc/article/en-US/cheat-sheet.md" - }, - { - "title": "Getting Help", - "href": "doc/article/en-US/getting-help.md" - }, - { - "title": "Technical Benefits", - "href": "doc/article/en-US/technical-benefits.md" - }, - { - "title": "Business Advantages", - "href": "doc/article/en-US/business-advantages.md" - }, - { - "title": "Integrating with Polymer", - "href": "doc/article/en-US/integrating-with-polymer.md" - }, - { - "title": "Migrating from Angular 1", - "href": "doc/article/en-US/migrating-from-angular-1.md" - } - ] - } } }