Skip to content

Commit

Permalink
chore(all): prepare release 1.3.0-rc.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jun 21, 2018
1 parent a44e714 commit 5de9585
Show file tree
Hide file tree
Showing 11 changed files with 713 additions and 338 deletions.
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -19,14 +19,14 @@
"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",
"aurelia-metadata": "^1.0.0",
"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"
}
}
161 changes: 117 additions & 44 deletions dist/amd/aurelia-framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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;

Expand All @@ -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);
});
Expand All @@ -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);
});
});
};
Expand Down
22 changes: 15 additions & 7 deletions dist/aurelia-framework.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
ViewResources,
TemplatingEngine,
CompositionTransaction,
ViewEngine
ViewEngine,
HtmlBehaviorResource
} from 'aurelia-templating';
import {
DOM,
Expand All @@ -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.
Expand Down Expand Up @@ -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<Aurelia>;
setRoot(root?: string | Function, applicationHost?: string | Element): Promise<Aurelia>;
}

/**
Expand Down Expand Up @@ -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<string | Function>): FrameworkConfiguration;

/**
* Renames a global resource that was imported.
Expand All @@ -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.
Expand Down Expand Up @@ -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';
Loading

0 comments on commit 5de9585

Please sign in to comment.