MCPcopy Create free account
hub / github.com/reactjs/react-rails / runFactory

Function runFactory

lib/assets/javascripts/JSXTransformer.js:12009–12056  ·  view source on GitHub ↗
(id, deps, factory)

Source from the content-addressed store, hash-verified

12007 };
12008
12009 function runFactory(id, deps, factory) {
12010 var r, e, m, result;
12011
12012 if (id) {
12013 e = loaderCache[id] = {};
12014 m = {
12015 id: id,
12016 uri: __filename,
12017 exports: e
12018 };
12019 r = makeRequire(requireFn, e, m, id);
12020 } else {
12021 //Only support one define call per file
12022 if (alreadyCalled) {
12023 throw new Error('amdefine with no module ID cannot be called more than once per file.');
12024 }
12025 alreadyCalled = true;
12026
12027 //Use the real variables from node
12028 //Use module.exports for exports, since
12029 //the exports in here is amdefine exports.
12030 e = module.exports;
12031 m = module;
12032 r = makeRequire(requireFn, e, m, module.id);
12033 }
12034
12035 //If there are dependencies, they are strings, so need
12036 //to convert them to dependency values.
12037 if (deps) {
12038 deps = deps.map(function (depName) {
12039 return r(depName);
12040 });
12041 }
12042
12043 //Call the factory with the right dependencies.
12044 if (typeof factory === 'function') {
12045 result = factory.apply(m.exports, deps);
12046 } else {
12047 result = factory;
12048 }
12049
12050 if (result !== undefined) {
12051 m.exports = result;
12052 if (id) {
12053 loaderCache[id] = m.exports;
12054 }
12055 }
12056 }
12057
12058 stringRequire = function (systemRequire, exports, module, id, relId) {
12059 //Split the ID by a ! so that

Callers 1

defineFunction · 0.85

Calls 1

rFunction · 0.50

Tested by

no test coverage detected