Skip to content

Commit

Permalink
chore(*): prepare release
Browse files Browse the repository at this point in the history
This release is primarily focused around experimentation with jspm
configuration.
  • Loading branch information
EisenbergEffect committed Dec 8, 2014
1 parent f936d5a commit cd2b886
Show file tree
Hide file tree
Showing 17 changed files with 443 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules
jspm_packages
bower_components
dist
.idea
.DS_STORE
6 changes: 2 additions & 4 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
System.config({
"paths": {
"*": "*.js",
"~/*": "lib/*.js"
"*": "*.js"
}
});

});
54 changes: 54 additions & 0 deletions dist/amd/annotations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
define(["exports"], function (exports) {
"use strict";

exports.normalize = normalize;
exports.getAnnotation = getAnnotation;
exports.getAllAnnotations = getAllAnnotations;
exports.addAnnotation = addAnnotation;
function normalize(fn) {
if (typeof fn.annotations === "function") {
fn.annotations = fn.annotations();
}
}

function getAnnotation(fn, annotationType) {
var annotations = fn.annotations, i, ii, annotation;

if (annotations === undefined) {
return null;
}

for (i = 0, ii = annotations.length; i < ii; ++i) {
annotation = annotations[i];

if (annotation instanceof annotationType) {
return annotation;
}
}

return null;
}

function getAllAnnotations(fn, annotationType) {
var annotations = fn.annotations, found = [], i, ii, annotation;

if (annotations === undefined) {
return found;
}

for (i = 0, ii = annotations.length; i < ii; ++i) {
annotation = annotations[i];

if (annotation instanceof annotationType) {
found.push(annotation);
}
}

return found;
}

function addAnnotation(fn, annotation) {
var annotations = fn.annotations || (fn.annotations = []);
annotations.push(annotation);
}
});
10 changes: 10 additions & 0 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
define(["exports", "./origin", "./resource-type", "./annotations"], function (exports, _origin, _resourceType, _annotations) {
"use strict";

exports.Origin = _origin.Origin;
exports.ResourceType = _resourceType.ResourceType;
exports.getAnnotation = _annotations.getAnnotation;
exports.getAllAnnotations = _annotations.getAllAnnotations;
exports.addAnnotation = _annotations.addAnnotation;
exports.normalize = _annotations.normalize;
});
46 changes: 46 additions & 0 deletions dist/amd/origin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
define(["exports"], function (exports) {
"use strict";

function ensureType(value) {
if (value instanceof Origin) {
return value;
}

return new Origin(value);
}

var Origin = (function () {
var Origin = function Origin(moduleId, moduleMember) {
this.moduleId = moduleId;
this.moduleMember = moduleMember;
};

Origin.get = function (fn) {
var origin = fn.__origin__;

if (origin !== undefined) {
return origin;
}

if (typeof fn.origin === "function") {
return fn.__origin__ = ensureType(fn.origin());
}

if (fn.origin !== undefined) {
return fn.__origin__ = ensureType(fn.origin);
}

return null;
};

Origin.set = function (fn, origin) {
if (Origin.get(fn) === null) {
fn.__origin__ = origin;
}
};

return Origin;
})();

exports.Origin = Origin;
});
19 changes: 19 additions & 0 deletions dist/amd/resource-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
define(["exports"], function (exports) {
"use strict";

var ResourceType = (function () {
var ResourceType = function ResourceType() {};

ResourceType.prototype.load = function (container, target) {
return this;
};

ResourceType.prototype.register = function (registry, name) {
throw new Error("All descendents of \"ResourceType\" must implement the \"register\" method.");
};

return ResourceType;
})();

exports.ResourceType = ResourceType;
});
52 changes: 52 additions & 0 deletions dist/commonjs/annotations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"use strict";

exports.normalize = normalize;
exports.getAnnotation = getAnnotation;
exports.getAllAnnotations = getAllAnnotations;
exports.addAnnotation = addAnnotation;
function normalize(fn) {
if (typeof fn.annotations === "function") {
fn.annotations = fn.annotations();
}
}

function getAnnotation(fn, annotationType) {
var annotations = fn.annotations, i, ii, annotation;

if (annotations === undefined) {
return null;
}

for (i = 0, ii = annotations.length; i < ii; ++i) {
annotation = annotations[i];

if (annotation instanceof annotationType) {
return annotation;
}
}

return null;
}

function getAllAnnotations(fn, annotationType) {
var annotations = fn.annotations, found = [], i, ii, annotation;

if (annotations === undefined) {
return found;
}

for (i = 0, ii = annotations.length; i < ii; ++i) {
annotation = annotations[i];

if (annotation instanceof annotationType) {
found.push(annotation);
}
}

return found;
}

function addAnnotation(fn, annotation) {
var annotations = fn.annotations || (fn.annotations = []);
annotations.push(annotation);
}
8 changes: 8 additions & 0 deletions dist/commonjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use strict";

exports.Origin = require("./origin").Origin;
exports.ResourceType = require("./resource-type").ResourceType;
exports.getAnnotation = require("./annotations").getAnnotation;
exports.getAllAnnotations = require("./annotations").getAllAnnotations;
exports.addAnnotation = require("./annotations").addAnnotation;
exports.normalize = require("./annotations").normalize;
44 changes: 44 additions & 0 deletions dist/commonjs/origin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"use strict";

function ensureType(value) {
if (value instanceof Origin) {
return value;
}

return new Origin(value);
}

var Origin = (function () {
var Origin = function Origin(moduleId, moduleMember) {
this.moduleId = moduleId;
this.moduleMember = moduleMember;
};

Origin.get = function (fn) {
var origin = fn.__origin__;

if (origin !== undefined) {
return origin;
}

if (typeof fn.origin === "function") {
return fn.__origin__ = ensureType(fn.origin());
}

if (fn.origin !== undefined) {
return fn.__origin__ = ensureType(fn.origin);
}

return null;
};

Origin.set = function (fn, origin) {
if (Origin.get(fn) === null) {
fn.__origin__ = origin;
}
};

return Origin;
})();

exports.Origin = Origin;
17 changes: 17 additions & 0 deletions dist/commonjs/resource-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";

var ResourceType = (function () {
var ResourceType = function ResourceType() {};

ResourceType.prototype.load = function (container, target) {
return this;
};

ResourceType.prototype.register = function (registry, name) {
throw new Error("All descendents of \"ResourceType\" must implement the \"register\" method.");
};

return ResourceType;
})();

exports.ResourceType = ResourceType;
81 changes: 81 additions & 0 deletions dist/es6/annotations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* Normalizes a function's annotation representation.
*
* @method normalize
* @param {Function} fn The function whose annotations may require normalization.
* @for export
*/
export function normalize(fn){
if(typeof fn.annotations === 'function'){
fn.annotations = fn.annotations();
}
}

/**
* Searches a function's metadata for an annotation of a particular type.
*
* @method getAnnotation
* @param {Function} fn The function whose annotations are being inspected.
* @param {Function} annotationType The annotation type to look for.
* @return {Object} Returns an instance of the specified annotation type if found; otherwise null.
* @for export
*/
export function getAnnotation(fn, annotationType){
var annotations = fn.annotations,
i, ii, annotation;

if(annotations === undefined){
return null;
}

for(i = 0, ii = annotations.length; i < ii; ++i){
annotation = annotations[i];

if(annotation instanceof annotationType){
return annotation;
}
}

return null;
}

/**
* Searches a function's metadata for all annotations of a particular type.
*
* @method getAllAnnotations
* @param {Function} fn The function whose annotations are being inspected.
* @param {Function} annotationType The annotation type to look for.
* @return {Array} Returns an array of the specified annotation type.
* @for export
*/
export function getAllAnnotations(fn, annotationType){
var annotations = fn.annotations,
found = [], i, ii, annotation;

if(annotations === undefined){
return found;
}

for(i = 0, ii = annotations.length; i < ii; ++i){
annotation = annotations[i];

if(annotation instanceof annotationType){
found.push(annotation);
}
}

return found;
}

/**
* Adds metadata to a function.
*
* @method addAnnotation
* @param {Function} fn The function being tagged with metadata.
* @param {Object} annotation The annotation instance to add.
* @for export
*/
export function addAnnotation(fn, annotation){
var annotations = fn.annotations || (fn.annotations = []);
annotations.push(annotation);
}
3 changes: 3 additions & 0 deletions dist/es6/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export {Origin} from './origin';
export {ResourceType} from './resource-type';
export {getAnnotation, getAllAnnotations, addAnnotation, normalize} from './annotations';
Loading

0 comments on commit cd2b886

Please sign in to comment.