Skip to content

Commit

Permalink
Merge pull request #13022 from emberjs/ember-source
Browse files Browse the repository at this point in the history
provide ember-core from NPM
  • Loading branch information
rwjblue authored Oct 7, 2016
2 parents 3afdbc9 + eead311 commit 454442b
Show file tree
Hide file tree
Showing 3 changed files with 313 additions and 3 deletions.
54 changes: 53 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,58 @@
/* 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(paths, 'shims', 'vendor/ember/shims.js');
add(paths, 'jquery', 'vendor/ember/jquery/jquery.js');

add(absolutePaths, 'templateCompiler', __dirname + '/dist/ember-template-compiler.js');

module.exports = {
name: 'ember'
init: function() {
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-source`, please remove it from bower');
}
},

name: 'ember-source',
paths: paths,
absolutePaths: absolutePaths,
treeForVendor: function() {
var ember = stew.find(__dirname + '/dist', {
destDir: 'ember',
files: [
'ember-runtime.js',
'ember-template-compiler.js',
'ember-testing.js',
'ember.debug.js',
'ember.min.js',
'ember.prod.js',
'jquery/jquery.js'
]
});

var shims = stew.find(__dirname + '/vendor/ember', {
destDir: 'ember',
files: [ 'shims.js' ]
});

return stew.find([
ember,
shims
]);
}
};
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ember",
"name": "ember-source",
"license": "MIT",
"version": "2.10.0",
"keywords": [
Expand Down Expand Up @@ -61,6 +61,11 @@
"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"
},
"ember-addon": {
"after": "ember-cli-legacy-blueprints"
}
}
253 changes: 253 additions & 0 deletions vendor/ember/shims.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
(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-owner/get': {
'default': Ember.getOwner
},
'ember-owner/set': {
'default': Ember.setOwner
},
'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 });
})();

0 comments on commit 454442b

Please sign in to comment.