diff --git a/acceptance-setup/__tests__/__snapshots__/acceptance.js.snap b/acceptance-setup/__tests__/__snapshots__/acceptance.js.snap
index 85d0b5f..d8f9d09 100644
--- a/acceptance-setup/__tests__/__snapshots__/acceptance.js.snap
+++ b/acceptance-setup/__tests__/__snapshots__/acceptance.js.snap
@@ -2,7 +2,7 @@
exports[`Registry should correctly serve rendered and unrendered components 1`] = `"{\\"type\\":\\"oc-component-local\\",\\"version\\":\\"6.6.6\\",\\"requestVersion\\":\\"\\",\\"name\\":\\"react-app\\",\\"renderMode\\":\\"unrendered\\",\\"href\\":\\"http://localhost:3000/react-app?name=SuperMario\\",\\"data\\":{\\"reactComponent\\":{,\\"src\\":\\"http://localhost:3000/react-app/6.6.6/static/react-component.js\\",\\"props\\":{\\"name\\":\\"SuperMario\\",\\"_staticPath\\":\\"http://localhost:3000/react-app/6.6.6/static/\\",\\"_baseUrl\\":\\"http://localhost:3000/\\",\\"_componentName\\":\\"react-app\\",\\"_componentVersion\\":\\"6.6.6\\"}}},\\"template\\":{\\"src\\":\\"http://localhost:3000/react-app/6.6.6/static/template.js\\",\\"type\\":\\"oc-template-react\\",}}"`;
-exports[`Registry should correctly serve rendered and unrendered components 2`] = `"{\\"type\\":\\"oc-component-local\\",\\"version\\":\\"6.6.6\\",\\"requestVersion\\":\\"\\",\\"name\\":\\"react-app\\",\\"renderMode\\":\\"rendered\\",\\"href\\":\\"http://localhost:3000/react-app?name=SuperMario\\",\\"html\\":\\"Hello SuperMario
component name: react-app
component version: 6.6.6
registry baseUrl: http://localhost:3000/
component staticPath: http://localhost:3000/react-app/6.6.6/static/
\\"}"`;
+exports[`Registry should correctly serve rendered and unrendered components 2`] = `"{\\"type\\":\\"oc-component-local\\",\\"version\\":\\"6.6.6\\",\\"requestVersion\\":\\"\\",\\"name\\":\\"react-app\\",\\"renderMode\\":\\"rendered\\",\\"href\\":\\"http://localhost:3000/react-app?name=SuperMario\\",\\"html\\":\\"Hello SuperMario
component name: react-app
component version: 6.6.6
registry baseUrl: http://localhost:3000/
component staticPath: http://localhost:3000/react-app/6.6.6/static/
\\"}"`;
exports[`client-side-side rendering 1`] = `
Array [
@@ -37,7 +37,7 @@ exports[`server-side-side rendering 1`] = `
A page
- Hello SuperMario
component name: react-app
component version: 6.6.6
registry baseUrl: http://localhost:3000/
component staticPath: http://localhost:3000/react-app/6.6.6/static/
+ Hello SuperMario
component name: react-app
component version: 6.6.6
registry baseUrl: http://localhost:3000/
component staticPath: http://localhost:3000/react-app/6.6.6/static/
diff --git a/lerna.json b/lerna.json
index ed7e266..359ad61 100644
--- a/lerna.json
+++ b/lerna.json
@@ -3,7 +3,8 @@
"packages": [
"packages/*",
"acceptance-setup",
- "acceptance-components/*"
+ "acceptance-components/*",
+ "mocks/*"
],
"version": "independent",
"npmClient": "npm",
diff --git a/packages/oc-template-react-compiler/__tests__/__snapshots__/compile.js.snap b/packages/oc-template-react-compiler/__tests__/__snapshots__/compile.js.snap
index a1b3a95..4c72e0e 100644
--- a/packages/oc-template-react-compiler/__tests__/__snapshots__/compile.js.snap
+++ b/packages/oc-template-react-compiler/__tests__/__snapshots__/compile.js.snap
@@ -51,7 +51,7 @@ say(text);
},
Object {
"path": "../../../mocks/react-component/_compile-tests-package1/react-component.js",
- "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=2)})([function(a){a.exports=React},function(a){a.exports=PropTypes},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(1),i=c.n(h),j=c(0),k=c.n(j),l=function(){return k.a.createElement('div',null,'Hello')},m=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.getChildContext=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);return k.a.createElement(l,g)},b}(k.a.Component);m.childContextTypes={getData:i.a.func,getSetting:i.a.func};b['default']=m}]);; return module.default}())",
+ "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=1)})([function(a){a.exports=React},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(0),i=c.n(h),j=i.a.createContext(),k=j.Consumer,l=j.Provider,m=function(){return i.a.createElement('div',null,'Hello')},n=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.buildActions=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']),h=this.buildActions();return i.a.createElement(l,{value:h},i.a.createElement(m,g))},b}(i.a.Component),o=b['default']=n}]);; return module.default}())",
},
Object {
"path": "../../../mocks/react-component/_compile-tests-package1/server.js",
@@ -115,7 +115,7 @@ say(text);
},
Object {
"path": "../../../mocks/react-component-with-css/_compile-tests-package1/react-component.js",
- "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=3)})([function(a){a.exports=React},function(a){a.exports=PropTypes},function(a){a.exports={awesome:'awesome__2lltUggH'}},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(1),i=c.n(h),j=c(0),k=c.n(j),l=c(2),m=c.n(l),n=function(){return k.a.createElement('div',{className:m.a.awesome},'Hello')},o=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.getChildContext=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);return k.a.createElement(n,g)},b}(k.a.Component);o.childContextTypes={getData:i.a.func,getSetting:i.a.func};b['default']=o}]);; return module.default}())",
+ "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=2)})([function(a){a.exports=React},function(a){a.exports={awesome:'awesome__2lltUggH'}},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(0),i=c.n(h),j=i.a.createContext(),k=j.Consumer,l=j.Provider,m=c(1),n=c.n(m),o=function(){return i.a.createElement('div',{className:n.a.awesome},'Hello')},p=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.buildActions=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']),h=this.buildActions();return i.a.createElement(l,{value:h},i.a.createElement(o,g))},b}(i.a.Component),q=b['default']=p}]);; return module.default}())",
},
Object {
"path": "../../../mocks/react-component-with-css/_compile-tests-package1/server.js",
@@ -170,7 +170,7 @@ Array [
},
Object {
"path": "../../../mocks/react-component/_compile-tests-package2/react-component.js",
- "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=2)})([function(a){a.exports=React},function(a){a.exports=PropTypes},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(1),i=c.n(h),j=c(0),k=c.n(j),l=function(){return k.a.createElement('div',null,'Hello')},m=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.getChildContext=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);return k.a.createElement(l,g)},b}(k.a.Component);m.childContextTypes={getData:i.a.func,getSetting:i.a.func};b['default']=m}]);; return module.default}())",
+ "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=1)})([function(a){a.exports=React},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(0),i=c.n(h),j=i.a.createContext(),k=j.Consumer,l=j.Provider,m=function(){return i.a.createElement('div',null,'Hello')},n=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.buildActions=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']),h=this.buildActions();return i.a.createElement(l,{value:h},i.a.createElement(m,g))},b}(i.a.Component),o=b['default']=n}]);; return module.default}())",
},
Object {
"path": "../../../mocks/react-component/_compile-tests-package2/server.js",
@@ -221,7 +221,7 @@ Array [
},
Object {
"path": "../../../mocks/react-component-with-css/_compile-tests-package2/react-component.js",
- "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=3)})([function(a){a.exports=React},function(a){a.exports=PropTypes},function(a){a.exports={awesome:'awesome__2lltUggH'}},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(1),i=c.n(h),j=c(0),k=c.n(j),l=c(2),m=c.n(l),n=function(){return k.a.createElement('div',{className:m.a.awesome},'Hello')},o=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.getChildContext=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);return k.a.createElement(n,g)},b}(k.a.Component);o.childContextTypes={getData:i.a.func,getSetting:i.a.func};b['default']=o}]);; return module.default}())",
+ "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=2)})([function(a){a.exports=React},function(a){a.exports={awesome:'awesome__2lltUggH'}},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(0),i=c.n(h),j=i.a.createContext(),k=j.Consumer,l=j.Provider,m=c(1),n=c.n(m),o=function(){return i.a.createElement('div',{className:n.a.awesome},'Hello')},p=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.buildActions=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']),h=this.buildActions();return i.a.createElement(l,{value:h},i.a.createElement(o,g))},b}(i.a.Component),q=b['default']=p}]);; return module.default}())",
},
Object {
"path": "../../../mocks/react-component-with-css/_compile-tests-package2/server.js",
@@ -284,7 +284,7 @@ say(text);
},
Object {
"path": "../../../mocks/react-component/_compile-tests-package4/react-component.js",
- "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=2)})([function(a){a.exports=React},function(a){a.exports=PropTypes},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(1),i=c.n(h),j=c(0),k=c.n(j),l=function(){return k.a.createElement('div',null,'Hello')},m=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.getChildContext=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);return k.a.createElement(l,g)},b}(k.a.Component);m.childContextTypes={getData:i.a.func,getSetting:i.a.func};b['default']=m}]);; return module.default}())",
+ "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=1)})([function(a){a.exports=React},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(0),i=c.n(h),j=i.a.createContext(),k=j.Consumer,l=j.Provider,m=function(){return i.a.createElement('div',null,'Hello')},n=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.buildActions=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']),h=this.buildActions();return i.a.createElement(l,{value:h},i.a.createElement(m,g))},b}(i.a.Component),o=b['default']=n}]);; return module.default}())",
},
Object {
"path": "../../../mocks/react-component/_compile-tests-package4/template.js",
@@ -339,7 +339,7 @@ say(text);
},
Object {
"path": "../../../mocks/react-component-with-css/_compile-tests-package4/react-component.js",
- "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=3)})([function(a){a.exports=React},function(a){a.exports=PropTypes},function(a){a.exports={awesome:'awesome__2lltUggH'}},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(1),i=c.n(h),j=c(0),k=c.n(j),l=c(2),m=c.n(l),n=function(){return k.a.createElement('div',{className:m.a.awesome},'Hello')},o=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.getChildContext=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);return k.a.createElement(n,g)},b}(k.a.Component);o.childContextTypes={getData:i.a.func,getSetting:i.a.func};b['default']=o}]);; return module.default}())",
+ "source": "var oc=oc||{};oc.reactComponents=oc.reactComponents||{};oc.reactComponents['dummyContent']=oc.reactComponents['dummyContent']||(function(){var module = (function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{enumerable:!0,get:d})},b.r=function(a){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(a,'__esModule',{value:!0})},b.t=function(a,c){if(1&c&&(a=b(a)),8&c)return a;if(4&c&&'object'==typeof a&&a&&a.__esModule)return a;var d=Object.create(null);if(b.r(d),Object.defineProperty(d,'default',{enumerable:!0,value:a}),2&c&&'string'!=typeof a)for(var e in a)b.d(d,e,function(b){return a[b]}.bind(null,e));return d},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=2)})([function(a){a.exports=React},function(a){a.exports={awesome:'awesome__2lltUggH'}},function(a,b,c){'use strict';function d(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\\\\'t been initialised - super() hasn\\\\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.r(b);var h=c(0),i=c.n(h),j=i.a.createContext(),k=j.Consumer,l=j.Provider,m=c(1),n=c.n(m),o=function(){return i.a.createElement('div',{className:n.a.awesome},'Hello')},p=function(a){function b(){return e(this,b),f(this,a.apply(this,arguments))}return g(b,a),b.prototype.componentDidMount=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']);window.oc.events.fire('oc:componentDidMount',g)},b.prototype.buildActions=function(){var a=this;return{getData:function(b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},function(a,b){if(a)return c(a);var e=b.reactComponent.props,f=e._staticPath,g=e._baseUrl,h=e._componentName,i=e._componentVersion,j=d(e,['_staticPath','_baseUrl','_componentName','_componentVersion']);c(null,j,b.reactComponent.props)})},getSetting:function(b){var c={name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,staticPath:a.props._staticPath};return c[b]}}},b.prototype.render=function(){var a=this.props,b=a._staticPath,c=a._baseUrl,e=a._componentName,f=a._componentVersion,g=d(a,['_staticPath','_baseUrl','_componentName','_componentVersion']),h=this.buildActions();return i.a.createElement(l,{value:h},i.a.createElement(o,g))},b}(i.a.Component),q=b['default']=p}]);; return module.default}())",
},
Object {
"path": "../../../mocks/react-component-with-css/_compile-tests-package4/styles.css",
diff --git a/packages/oc-template-react-compiler/lib/reactOCProviderTemplate.js b/packages/oc-template-react-compiler/lib/reactOCProviderTemplate.js
index d449e9f..33e6ef3 100644
--- a/packages/oc-template-react-compiler/lib/reactOCProviderTemplate.js
+++ b/packages/oc-template-react-compiler/lib/reactOCProviderTemplate.js
@@ -1,6 +1,6 @@
const reactOCProviderTemplate = ({ viewPath }) => `
- import PropTypes from 'prop-types';
import React from 'react';
+ import { Provider } from 'oc-template-react-compiler/utils/ocContext';
import View from '${viewPath}';
class OCProvider extends React.Component {
@@ -9,7 +9,7 @@ const reactOCProviderTemplate = ({ viewPath }) => `
window.oc.events.fire('oc:componentDidMount', rest);
}
- getChildContext() {
+ buildActions() {
const getData = (parameters, cb) => {
return window.oc.getData({
name: this.props._componentName,
@@ -37,17 +37,16 @@ const reactOCProviderTemplate = ({ viewPath }) => `
}
render() {
- const { _staticPath, _baseUrl, _componentName, _componentVersion, ...rest } = this.props;
+ const { _staticPath, _baseUrl, _componentName, _componentVersion, ...rest } = this.props;
+ const actions = this.buildActions();
return (
-
+
+
+
);
}
}
- OCProvider.childContextTypes = {
- getData: PropTypes.func,
- getSetting: PropTypes.func
- };
export default OCProvider
`;
diff --git a/packages/oc-template-react-compiler/utils/ocContext.js b/packages/oc-template-react-compiler/utils/ocContext.js
new file mode 100644
index 0000000..a6ea6d5
--- /dev/null
+++ b/packages/oc-template-react-compiler/utils/ocContext.js
@@ -0,0 +1,6 @@
+import React from "react";
+
+const ctx = React.createContext();
+
+export const Consumer = ctx.Consumer;
+export const Provider = ctx.Provider;
diff --git a/packages/oc-template-react-compiler/utils/withDataProvider.js b/packages/oc-template-react-compiler/utils/withDataProvider.js
index b53bbae..c04262e 100644
--- a/packages/oc-template-react-compiler/utils/withDataProvider.js
+++ b/packages/oc-template-react-compiler/utils/withDataProvider.js
@@ -1,18 +1,20 @@
import React from "react";
-import PropTypes from "prop-types";
+import { Consumer } from "./ocContext";
const withDataProvider = BaseComponent => {
- const Enhanced = (props, context) => {
- const propsWithGetData = {
- ...props,
- getData: context.getData
- };
+ const Enhanced = props => {
+ return (
+
+ {context => {
+ const propsWithGetData = {
+ ...props,
+ getData: context.getData
+ };
- return ;
- };
-
- Enhanced.contextTypes = {
- getData: PropTypes.func
+ return ;
+ }}
+
+ );
};
return Enhanced;
diff --git a/packages/oc-template-react-compiler/utils/withSettingProvider.js b/packages/oc-template-react-compiler/utils/withSettingProvider.js
index b4fda43..44ba11e 100644
--- a/packages/oc-template-react-compiler/utils/withSettingProvider.js
+++ b/packages/oc-template-react-compiler/utils/withSettingProvider.js
@@ -1,18 +1,20 @@
import React from "react";
-import PropTypes from "prop-types";
+import { Consumer } from "./ocContext";
const withSettingProvider = BaseComponent => {
- const Enhanced = (props, context) => {
- const propsWithGetSetting = {
- ...props,
- getSetting: context.getSetting
- };
+ const Enhanced = props => {
+ return (
+
+ {context => {
+ const propsWithGetSetting = {
+ ...props,
+ getSetting: context.getSetting
+ };
- return ;
- };
-
- Enhanced.contextTypes = {
- getSetting: PropTypes.func
+ return ;
+ }}
+
+ );
};
return Enhanced;
diff --git a/packages/oc-template-react/lib/render.js b/packages/oc-template-react/lib/render.js
index a3abbf6..4e05b6a 100644
--- a/packages/oc-template-react/lib/render.js
+++ b/packages/oc-template-react/lib/render.js
@@ -2,7 +2,6 @@ const PropTypes = require("prop-types");
const React = require("react");
const ReactDOM = require("react-dom");
const ReactDOMServer = require("react-dom/server");
-const vm = require("vm");
const createPredicate = require("./to-be-published/get-js-from-url");
const tryGetCached = require("./to-be-published/try-get-cached");