diff --git a/bower.json b/bower.json index 6de674e..6f2008a 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-metadata", - "version": "1.0.0-beta.1.1.4", + "version": "1.0.0-beta.1.1.5", "description": "Utilities for reading and writing the metadata of JavaScript functions.", "keywords": [ "aurelia", diff --git a/dist/amd/aurelia-metadata.d.ts b/dist/amd/aurelia-metadata.d.ts index 7117f8f..ff625b2 100644 --- a/dist/amd/aurelia-metadata.d.ts +++ b/dist/amd/aurelia-metadata.d.ts @@ -1,5 +1,4 @@ declare module 'aurelia-metadata' { - import 'core-js'; import { PLATFORM } from 'aurelia-pal'; /** diff --git a/dist/amd/aurelia-metadata.js b/dist/amd/aurelia-metadata.js index cdbb75c..9c763f0 100644 --- a/dist/amd/aurelia-metadata.js +++ b/dist/amd/aurelia-metadata.js @@ -1,4 +1,4 @@ -define(['exports', 'core-js', 'aurelia-pal'], function (exports, _coreJs, _aureliaPal) { +define(['exports', 'aurelia-pal'], function (exports, _aureliaPal) { 'use strict'; exports.__esModule = true; @@ -12,36 +12,6 @@ define(['exports', 'core-js', 'aurelia-pal'], function (exports, _coreJs, _aurel function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - var theGlobal = _aureliaPal.PLATFORM.global; - var emptyMetadata = Object.freeze({}); - var metadataContainerKey = '__metadata__'; - - if (typeof theGlobal.Reflect === 'undefined') { - theGlobal.Reflect = {}; - } - - if (typeof theGlobal.Reflect.getOwnMetadata === 'undefined') { - Reflect.getOwnMetadata = function (metadataKey, target, targetKey) { - return ((target[metadataContainerKey] || emptyMetadata)[targetKey] || emptyMetadata)[metadataKey]; - }; - } - - if (typeof theGlobal.Reflect.defineMetadata === 'undefined') { - Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) { - var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {}; - var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); - targetContainer[metadataKey] = metadataValue; - }; - } - - if (typeof theGlobal.Reflect.metadata === 'undefined') { - Reflect.metadata = function (metadataKey, metadataValue) { - return function (target, targetKey) { - Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); - }; - }; - } - var metadata = { resource: 'aurelia:resource', paramTypes: 'design:paramtypes', diff --git a/dist/aurelia-metadata.d.ts b/dist/aurelia-metadata.d.ts index 7117f8f..ff625b2 100644 --- a/dist/aurelia-metadata.d.ts +++ b/dist/aurelia-metadata.d.ts @@ -1,5 +1,4 @@ declare module 'aurelia-metadata' { - import 'core-js'; import { PLATFORM } from 'aurelia-pal'; /** diff --git a/dist/aurelia-metadata.js b/dist/aurelia-metadata.js index b94f502..0fefb72 100644 --- a/dist/aurelia-metadata.js +++ b/dist/aurelia-metadata.js @@ -1,36 +1,5 @@ -import 'core-js'; import {PLATFORM} from 'aurelia-pal'; -const theGlobal = PLATFORM.global; -const emptyMetadata = Object.freeze({}); -const metadataContainerKey = '__metadata__'; - -if (typeof theGlobal.Reflect === 'undefined') { - theGlobal.Reflect = {}; -} - -if (typeof theGlobal.Reflect.getOwnMetadata === 'undefined') { - Reflect.getOwnMetadata = function(metadataKey, target, targetKey) { - return ((target[metadataContainerKey] || emptyMetadata)[targetKey] || emptyMetadata)[metadataKey]; - }; -} - -if (typeof theGlobal.Reflect.defineMetadata === 'undefined') { - Reflect.defineMetadata = function(metadataKey, metadataValue, target, targetKey) { - let metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : (target[metadataContainerKey] = {}); - let targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); - targetContainer[metadataKey] = metadataValue; - }; -} - -if (typeof theGlobal.Reflect.metadata === 'undefined') { - Reflect.metadata = function(metadataKey, metadataValue) { - return function(target, targetKey) { - Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); - }; - }; -} - /** * Helpers for working with metadata on functions. */ diff --git a/dist/commonjs/aurelia-metadata.d.ts b/dist/commonjs/aurelia-metadata.d.ts index 7117f8f..ff625b2 100644 --- a/dist/commonjs/aurelia-metadata.d.ts +++ b/dist/commonjs/aurelia-metadata.d.ts @@ -1,5 +1,4 @@ declare module 'aurelia-metadata' { - import 'core-js'; import { PLATFORM } from 'aurelia-pal'; /** diff --git a/dist/commonjs/aurelia-metadata.js b/dist/commonjs/aurelia-metadata.js index 4b9f790..b26ceab 100644 --- a/dist/commonjs/aurelia-metadata.js +++ b/dist/commonjs/aurelia-metadata.js @@ -11,40 +11,8 @@ exports.protocol = protocol; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } -require('core-js'); - var _aureliaPal = require('aurelia-pal'); -var theGlobal = _aureliaPal.PLATFORM.global; -var emptyMetadata = Object.freeze({}); -var metadataContainerKey = '__metadata__'; - -if (typeof theGlobal.Reflect === 'undefined') { - theGlobal.Reflect = {}; -} - -if (typeof theGlobal.Reflect.getOwnMetadata === 'undefined') { - Reflect.getOwnMetadata = function (metadataKey, target, targetKey) { - return ((target[metadataContainerKey] || emptyMetadata)[targetKey] || emptyMetadata)[metadataKey]; - }; -} - -if (typeof theGlobal.Reflect.defineMetadata === 'undefined') { - Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) { - var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {}; - var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); - targetContainer[metadataKey] = metadataValue; - }; -} - -if (typeof theGlobal.Reflect.metadata === 'undefined') { - Reflect.metadata = function (metadataKey, metadataValue) { - return function (target, targetKey) { - Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); - }; - }; -} - var metadata = { resource: 'aurelia:resource', paramTypes: 'design:paramtypes', diff --git a/dist/es6/aurelia-metadata.d.ts b/dist/es6/aurelia-metadata.d.ts index 7117f8f..ff625b2 100644 --- a/dist/es6/aurelia-metadata.d.ts +++ b/dist/es6/aurelia-metadata.d.ts @@ -1,5 +1,4 @@ declare module 'aurelia-metadata' { - import 'core-js'; import { PLATFORM } from 'aurelia-pal'; /** diff --git a/dist/es6/aurelia-metadata.js b/dist/es6/aurelia-metadata.js index b94f502..0fefb72 100644 --- a/dist/es6/aurelia-metadata.js +++ b/dist/es6/aurelia-metadata.js @@ -1,36 +1,5 @@ -import 'core-js'; import {PLATFORM} from 'aurelia-pal'; -const theGlobal = PLATFORM.global; -const emptyMetadata = Object.freeze({}); -const metadataContainerKey = '__metadata__'; - -if (typeof theGlobal.Reflect === 'undefined') { - theGlobal.Reflect = {}; -} - -if (typeof theGlobal.Reflect.getOwnMetadata === 'undefined') { - Reflect.getOwnMetadata = function(metadataKey, target, targetKey) { - return ((target[metadataContainerKey] || emptyMetadata)[targetKey] || emptyMetadata)[metadataKey]; - }; -} - -if (typeof theGlobal.Reflect.defineMetadata === 'undefined') { - Reflect.defineMetadata = function(metadataKey, metadataValue, target, targetKey) { - let metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : (target[metadataContainerKey] = {}); - let targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); - targetContainer[metadataKey] = metadataValue; - }; -} - -if (typeof theGlobal.Reflect.metadata === 'undefined') { - Reflect.metadata = function(metadataKey, metadataValue) { - return function(target, targetKey) { - Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); - }; - }; -} - /** * Helpers for working with metadata on functions. */ diff --git a/dist/system/aurelia-metadata.d.ts b/dist/system/aurelia-metadata.d.ts index 7117f8f..ff625b2 100644 --- a/dist/system/aurelia-metadata.d.ts +++ b/dist/system/aurelia-metadata.d.ts @@ -1,5 +1,4 @@ declare module 'aurelia-metadata' { - import 'core-js'; import { PLATFORM } from 'aurelia-pal'; /** diff --git a/dist/system/aurelia-metadata.js b/dist/system/aurelia-metadata.js index 983170c..2127dbc 100644 --- a/dist/system/aurelia-metadata.js +++ b/dist/system/aurelia-metadata.js @@ -1,7 +1,7 @@ -System.register(['core-js', 'aurelia-pal'], function (_export) { +System.register(['aurelia-pal'], function (_export) { 'use strict'; - var PLATFORM, theGlobal, emptyMetadata, metadataContainerKey, metadata, originStorage, unknownOrigin, Origin; + var PLATFORM, metadata, originStorage, unknownOrigin, Origin; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; @@ -178,40 +178,10 @@ System.register(['core-js', 'aurelia-pal'], function (_export) { } return { - setters: [function (_coreJs) {}, function (_aureliaPal) { + setters: [function (_aureliaPal) { PLATFORM = _aureliaPal.PLATFORM; }], execute: function () { - theGlobal = PLATFORM.global; - emptyMetadata = Object.freeze({}); - metadataContainerKey = '__metadata__'; - - if (typeof theGlobal.Reflect === 'undefined') { - theGlobal.Reflect = {}; - } - - if (typeof theGlobal.Reflect.getOwnMetadata === 'undefined') { - Reflect.getOwnMetadata = function (metadataKey, target, targetKey) { - return ((target[metadataContainerKey] || emptyMetadata)[targetKey] || emptyMetadata)[metadataKey]; - }; - } - - if (typeof theGlobal.Reflect.defineMetadata === 'undefined') { - Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) { - var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {}; - var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); - targetContainer[metadataKey] = metadataValue; - }; - } - - if (typeof theGlobal.Reflect.metadata === 'undefined') { - Reflect.metadata = function (metadataKey, metadataValue) { - return function (target, targetKey) { - Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey); - }; - }; - } - metadata = { resource: 'aurelia:resource', paramTypes: 'design:paramtypes', diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 57ea94d..3004072 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,16 @@ +### 1.0.0-beta.1.1.5 (2016-03-01) + + +#### Bug Fixes + +* **all:** remove core-js dependency ([3a300a87](https://github.com/aurelia/metadata/commit/3a300a87126ccf1ab2656c3a09a983a72316d9c9)) + + +#### Features + +* **all:** remove duplicate code and use new polyfills ([ec2b65ee](https://github.com/aurelia/metadata/commit/ec2b65ee17db5e24b050fca3ea1e088f8ca7aff7)) + + ### 1.0.0-beta.1.1.4 (2016-02-08) diff --git a/package.json b/package.json index fcc3b35..a5cd253 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-metadata", - "version": "1.0.0-beta.1.1.4", + "version": "1.0.0-beta.1.1.5", "description": "Utilities for reading and writing the metadata of JavaScript functions.", "keywords": [ "aurelia",