From 3d104c99337576331bc15ce24b344702dfa2ddc7 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 27 Feb 2016 16:01:39 -0800 Subject: [PATCH 01/11] provide ember-source from NPM * obviate the need to `bower install ember.js` * provide an api for addons to retrieve paths to ember.debug.js, ember.prod.js and ember-template-compiler.js --- index.js | 38 +++++++++++++++++++++++++++++++++++++- package.json | 6 ++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index d7dc31032b5..52b9d71eaef 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,42 @@ /* jshint node: true */ 'use strict'; +var stew = require('broccoli-stew'); + +var paths = {}; +var absolutePaths = {}; + +function add(paths, name, path) { + Object.defineProperty(paths, name, { + configurable: false, + get: function() { return path; } + }); +} + +add(paths, 'prod', 'vendor/ember/ember.prod.js'); +add(paths, 'debug', 'vendor/ember/ember.debug.js'); + +add(absolutePaths, 'templateCompiler', __dirname + '/dist/ember-template-compiler.js'); module.exports = { - name: 'ember' + name: 'ember-source', + paths: paths, + absolutePaths: absolutePaths, + treeForVendor: function() { + return stew.find(__dirname + '/dist', { + destDir: 'ember', + files: [ + 'ember-runtime.js', + 'ember-runtime.map', + 'ember-template-compiler.js', + 'ember-template-compiler.map', + 'ember-testing.js', + 'ember.debug.cjs.js', + 'ember.debug.cjs.map', + 'ember.debug.js', + 'ember.min.js', + 'ember.prod.js', + // 'shims/shims.js' + ] + }); + } }; diff --git a/package.json b/package.json index 4190cdd32aa..308a1f963ac 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ember", + "name": "ember-source", "license": "MIT", "version": "2.10.0", "keywords": [ @@ -61,6 +61,8 @@ "ember-cli-path-utils": "^1.0.0", "ember-cli-string-utils": "^1.0.0", "ember-cli-test-info": "^1.0.0", - "ember-cli-valid-component-name": "^1.0.0" + "ember-cli-valid-component-name": "^1.0.0", + "simple-dom": "^0.3.0", + "broccoli-stew": "^1.2.0" } } From 8757bfc1bb0ef6709149157143feb5370cfe4605 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 27 Feb 2016 16:19:39 -0800 Subject: [PATCH 02/11] ember provides its own shims --- index.js | 16 ++- vendor/ember/shims.js | 247 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 260 insertions(+), 3 deletions(-) create mode 100644 vendor/ember/shims.js diff --git a/index.js b/index.js index 52b9d71eaef..413021e08b1 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,7 @@ function add(paths, name, path) { add(paths, 'prod', 'vendor/ember/ember.prod.js'); add(paths, 'debug', 'vendor/ember/ember.debug.js'); +add(paths, 'shims', 'vendor/ember/shims.js'); add(absolutePaths, 'templateCompiler', __dirname + '/dist/ember-template-compiler.js'); @@ -22,7 +23,7 @@ module.exports = { paths: paths, absolutePaths: absolutePaths, treeForVendor: function() { - return stew.find(__dirname + '/dist', { + var ember = stew.find(__dirname + '/dist', { destDir: 'ember', files: [ 'ember-runtime.js', @@ -34,9 +35,18 @@ module.exports = { 'ember.debug.cjs.map', 'ember.debug.js', 'ember.min.js', - 'ember.prod.js', - // 'shims/shims.js' + 'ember.prod.js' ] }); + + var shims = stew.find(__dirname + '/vendor/ember', { + destDir: 'ember', + files: [ 'shims.js' ] + }); + + return stew.find([ + ember, + shims + ]); } }; diff --git a/vendor/ember/shims.js b/vendor/ember/shims.js new file mode 100644 index 00000000000..6e79b90ca47 --- /dev/null +++ b/vendor/ember/shims.js @@ -0,0 +1,247 @@ +(function() { +/* globals define, Ember, jQuery */ + + function processEmberShims() { + var shims = { + 'ember': { + 'default': Ember + }, + 'ember-application': { + 'default': Ember.Application + }, + 'ember-array': { + 'default': Ember.Array + }, + 'ember-array/mutable': { + 'default': Ember.MutableArray + }, + 'ember-array/utils': { + 'A': Ember.A, + 'isEmberArray': Ember.isArray, + 'wrap': Ember.makeArray + }, + 'ember-component': { + 'default': Ember.Component + }, + 'ember-components/checkbox': { + 'default': Ember.Checkbox + }, + 'ember-components/text-area': { + 'default': Ember.TextArea + }, + 'ember-components/text-field': { + 'default': Ember.TextField + }, + 'ember-controller': { + 'default': Ember.Controller + }, + 'ember-controller/inject': { + 'default': Ember.inject.controller + }, + 'ember-controller/proxy': { + 'default': Ember.ArrayProxy + }, + 'ember-controllers/sortable': { + 'default': Ember.SortableMixin + }, + 'ember-debug': { + 'log': Ember.debug, + 'inspect': Ember.inspect, + 'run': Ember.runInDebug, + 'warn': Ember.warn + }, + 'ember-debug/container-debug-adapter': { + 'default': Ember.ContainerDebugAdapter + }, + 'ember-debug/data-adapter': { + 'default': Ember.DataAdapter + }, + 'ember-deprecations': { + 'deprecate': Ember.deprecate, + 'deprecateFunc': Ember.deprecateFunc + }, + 'ember-enumerable': { + 'default': Ember.Enumerable + }, + 'ember-evented': { + 'default': Ember.Evented + }, + 'ember-evented/on': { + 'default': Ember.on + }, + 'ember-globals-resolver': { + 'default': Ember.DefaultResolver + }, + 'ember-helper': { + 'default': Ember.Helper, + 'helper': Ember.Helper && Ember.Helper.helper + }, + 'ember-instrumentation': { + 'instrument': Ember.Instrumentation.instrument, + 'reset': Ember.Instrumentation.reset, + 'subscribe': Ember.Instrumentation.subscribe, + 'unsubscribe': Ember.Instrumentation.unsubscribe + }, + 'ember-locations/hash': { + 'default': Ember.HashLocation + }, + 'ember-locations/history': { + 'default': Ember.HistoryLocation + }, + 'ember-locations/none': { + 'default': Ember.NoneLocation + }, + 'ember-map': { + 'default': Ember.Map, + 'withDefault': Ember.MapWithDefault + }, + 'ember-metal/destroy': { + 'default': Ember.destroy + }, + 'ember-metal/events': { + 'addListener': Ember.addListener, + 'removeListener': Ember.removeListener, + 'send': Ember.sendEvent + }, + 'ember-metal/get': { + 'default': Ember.get + }, + 'ember-metal/mixin': { + 'default': Ember.Mixin + }, + 'ember-metal/observer': { + 'default': Ember.observer, + 'addObserver': Ember.addObserver, + 'removeObserver': Ember.removeObserver + }, + 'ember-metal/on-load': { + 'default': Ember.onLoad, + 'run': Ember.runLoadHooks + }, + 'ember-metal/set': { + 'default': Ember.set, + 'setProperties': Ember.setProperties, + 'trySet': Ember.trySet + }, + 'ember-metal/utils': { + 'aliasMethod': Ember.aliasMethod, + 'assert': Ember.assert, + 'cacheFor': Ember.cacheFor, + 'copy': Ember.copy + }, + 'ember-object': { + 'default': Ember.Object + }, + 'ember-platform': { + 'assign': Ember.merge, + 'create': Ember.create, + 'defineProperty': Ember.platform.defineProperty, + 'hasAccessors': Ember.platform.hasPropertyAccessors, + 'keys': Ember.keys + }, + 'ember-route': { + 'default': Ember.Route + }, + 'ember-router': { + 'default': Ember.Router + }, + 'ember-runloop': { + 'default': Ember.run, + 'begin': Ember.run.begin, + 'bind': Ember.run.bind, + 'cancel': Ember.run.cancel, + 'debounce': Ember.run.debounce, + 'end': Ember.run.end, + 'join': Ember.run.join, + 'later': Ember.run.later, + 'next': Ember.run.next, + 'once': Ember.run.once, + 'schedule': Ember.run.schedule, + 'scheduleOnce': Ember.run.scheduleOnce, + 'throttle': Ember.run.throttle + }, + 'ember-service': { + 'default': Ember.Service + }, + 'ember-service/inject': { + 'default': Ember.inject.service + }, + 'ember-set/ordered': { + 'default': Ember.OrderedSet + }, + 'ember-string': { + 'camelize': Ember.String.camelize, + 'capitalize': Ember.String.capitalize, + 'classify': Ember.String.classify, + 'dasherize': Ember.String.dasherize, + 'decamelize': Ember.String.decamelize, + 'fmt': Ember.String.fmt, + 'htmlSafe': Ember.String.htmlSafe, + 'loc': Ember.String.loc, + 'underscore': Ember.String.underscore, + 'w': Ember.String.w + }, + 'ember-utils': { + 'isBlank': Ember.isBlank, + 'isEmpty': Ember.isEmpty, + 'isNone': Ember.isNone, + 'isPresent': Ember.isPresent, + 'tryInvoke': Ember.tryInvoke, + 'typeOf': Ember.typeOf + } + }; + + // populate `ember/computed` named exports + shims['ember-computed'] = { + 'default': Ember.computed + }; + var computedMacros = [ + "empty","notEmpty", "none", "not", "bool", "match", "equal", "gt", "gte", + "lt", "lte", "alias", "oneWay", "reads", "readOnly", "deprecatingAlias", + "and", "or", "collect", "sum", "min", "max", "map", "sort", "setDiff", + "mapBy", "filter", "filterBy", "uniq", "union", "intersect" + ]; + + for (var i = 0, l = computedMacros.length; i < l; i++) { + var key = computedMacros[i]; + shims['ember-computed'][key] = Ember.computed[key]; + } + + for (var moduleName in shims) { + generateModule(moduleName, shims[moduleName]); + } + } + + function processTestShims() { + if (Ember.Test) { + var testShims = { + 'ember-test': { + 'default': Ember.Test + }, + 'ember-test/adapter': { + 'default': Ember.Test.Adapter + }, + 'ember-test/qunit-adapter': { + 'default': Ember.Test.QUnitAdapter + } + }; + + for (var moduleName in testShims) { + generateModule(moduleName, testShims[moduleName]); + } + } + } + + function generateModule(name, values) { + define(name, [], function() { + 'use strict'; + + return values; + }); + } + + processEmberShims(); + processTestShims(); + generateModule('jquery', { 'default': self.jQuery }); + generateModule('rsvp', { 'default': Ember.RSVP }); +})(); From 47467a5848514e61d380cbefac5077c180f18125 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sat, 27 Feb 2016 16:30:39 -0800 Subject: [PATCH 03/11] throw if ember is also provided as a bowerDep --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index 413021e08b1..27430a272fa 100644 --- a/index.js +++ b/index.js @@ -19,6 +19,12 @@ add(paths, 'shims', 'vendor/ember/shims.js'); add(absolutePaths, 'templateCompiler', __dirname + '/dist/ember-template-compiler.js'); module.exports = { + init: function() { + if ('ember' in this.project.bowerDependencies()) { + throw new TypeError('Ember.js is now provided by node_module `ember-source`, please remove it from bower'); + } + }, + name: 'ember-source', paths: paths, absolutePaths: absolutePaths, From c30bad535e2014a41fead7c9d60bf7864148cee1 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Tue, 15 Mar 2016 15:19:18 -0700 Subject: [PATCH 04/11] change name from ember-source -> ember-core --- index.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 27430a272fa..1618c0791a1 100644 --- a/index.js +++ b/index.js @@ -21,11 +21,11 @@ add(absolutePaths, 'templateCompiler', __dirname + '/dist/ember-template-compile module.exports = { init: function() { if ('ember' in this.project.bowerDependencies()) { - throw new TypeError('Ember.js is now provided by node_module `ember-source`, please remove it from bower'); + throw new TypeError('Ember.js is now provided by node_module `ember-core`, please remove it from bower'); } }, - name: 'ember-source', + name: 'ember-core', paths: paths, absolutePaths: absolutePaths, treeForVendor: function() { diff --git a/package.json b/package.json index 308a1f963ac..7ff095680b2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ember-source", + "name": "ember-core", "license": "MIT", "version": "2.10.0", "keywords": [ From bf3487086648b7d811806cfbd01c6b2836901251 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sun, 22 May 2016 14:00:17 -0700 Subject: [PATCH 05/11] provide jQuery for now --- index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 1618c0791a1..9fd77b78d45 100644 --- a/index.js +++ b/index.js @@ -15,6 +15,7 @@ function add(paths, name, path) { add(paths, 'prod', 'vendor/ember/ember.prod.js'); add(paths, 'debug', 'vendor/ember/ember.debug.js'); add(paths, 'shims', 'vendor/ember/shims.js'); +add(paths, 'jquery', 'vendor/ember/jquery/jquery.js'); add(absolutePaths, 'templateCompiler', __dirname + '/dist/ember-template-compiler.js'); @@ -33,15 +34,12 @@ module.exports = { destDir: 'ember', files: [ 'ember-runtime.js', - 'ember-runtime.map', 'ember-template-compiler.js', - 'ember-template-compiler.map', 'ember-testing.js', - 'ember.debug.cjs.js', - 'ember.debug.cjs.map', 'ember.debug.js', 'ember.min.js', - 'ember.prod.js' + 'ember.prod.js', + 'jquery/jquery.js' ] }); From 75876e5a1c20c9b20e0feca9038d71d3baeb0e48 Mon Sep 17 00:00:00 2001 From: cibernox Date: Tue, 7 Jun 2016 00:11:44 +0100 Subject: [PATCH 06/11] Add getOwner/setOwner shims --- vendor/ember/shims.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vendor/ember/shims.js b/vendor/ember/shims.js index 6e79b90ca47..95106c50b56 100644 --- a/vendor/ember/shims.js +++ b/vendor/ember/shims.js @@ -132,6 +132,12 @@ 'ember-object': { 'default': Ember.Object }, + 'ember-owner/get': { + 'default': Ember.getOwner + }, + 'ember-owner/set': { + 'default': Ember.setOwner + }, 'ember-platform': { 'assign': Ember.merge, 'create': Ember.create, From df4d6e95f3008f13af10259365e4919dbebaf73f Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sun, 25 Sep 2016 13:27:32 -0700 Subject: [PATCH 07/11] fix core-object deprecation, as per: https://github.com/emberjs/ember.js/pull/13022#issuecomment-249444445 --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 9fd77b78d45..21b8e5774ae 100644 --- a/index.js +++ b/index.js @@ -21,6 +21,7 @@ add(absolutePaths, 'templateCompiler', __dirname + '/dist/ember-template-compile module.exports = { init: function() { + this._super.init && this._super.init.apply(this, arguments); if ('ember' in this.project.bowerDependencies()) { throw new TypeError('Ember.js is now provided by node_module `ember-core`, please remove it from bower'); } From 29680aa6a94da74819af5e222bcda0991314feaf Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Sun, 25 Sep 2016 13:41:48 -0700 Subject: [PATCH 08/11] move throw to warn for now. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 21b8e5774ae..9c69ae242c5 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,8 @@ module.exports = { init: function() { this._super.init && this._super.init.apply(this, arguments); if ('ember' in this.project.bowerDependencies()) { - throw new TypeError('Ember.js is now provided by node_module `ember-core`, please remove it from bower'); + // TODO: move this to a throw soon. + this.ui.writeWarnLine('Ember.js is now provided by node_module `ember-core`, please remove it from bower'); } }, From 3854b35691af86f7394d77fa15ac156964477301 Mon Sep 17 00:00:00 2001 From: Ricardo Mendes Date: Fri, 30 Sep 2016 20:42:18 +0100 Subject: [PATCH 09/11] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ff095680b2..308a1f963ac 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ember-core", + "name": "ember-source", "license": "MIT", "version": "2.10.0", "keywords": [ From aec0fec55e86b842c61df42d8e6050877428e7df Mon Sep 17 00:00:00 2001 From: Ricardo Mendes Date: Fri, 7 Oct 2016 09:39:28 +0100 Subject: [PATCH 10/11] Update package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 308a1f963ac..0531ff0f117 100644 --- a/package.json +++ b/package.json @@ -64,5 +64,8 @@ "ember-cli-valid-component-name": "^1.0.0", "simple-dom": "^0.3.0", "broccoli-stew": "^1.2.0" + }, + "ember-addon": { + "after": "ember-cli-legacy-blueprints" } } From 4b1cbe94534b47a27777b4a596a0fe9774d0f4b1 Mon Sep 17 00:00:00 2001 From: Ricardo Mendes Date: Fri, 7 Oct 2016 14:47:42 +0100 Subject: [PATCH 11/11] Update index.js --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 9c69ae242c5..e80f93ab8a8 100644 --- a/index.js +++ b/index.js @@ -24,11 +24,11 @@ module.exports = { this._super.init && this._super.init.apply(this, arguments); if ('ember' in this.project.bowerDependencies()) { // TODO: move this to a throw soon. - this.ui.writeWarnLine('Ember.js is now provided by node_module `ember-core`, please remove it from bower'); + this.ui.writeWarnLine('Ember.js is now provided by node_module `ember-source`, please remove it from bower'); } }, - name: 'ember-core', + name: 'ember-source', paths: paths, absolutePaths: absolutePaths, treeForVendor: function() {