Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions acceptance-setup/__tests__/__snapshots__/acceptance.js.snap
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

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\\":{\\"key\\":\\"b30d0abb0a6a6b3fd055350b2a2eb5163e5c4e42\\",\\"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\\",\\"key\\":\\"63831aae2b0e2530a3d56c79c0c11b75583a3d51\\"}}"`;
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\\":{\\"key\\":\\"b30d0abb0a6a6b3fd055350b2a2eb5163e5c4e42\\",\\"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\\",\\"key\\":\\"2c7d7bb61a5c25b37551e5b5d5b3baa1c9c8c44a\\"}}"`;

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\\":\\"<oc-component href=\\\\\\"http://localhost:3000/react-app?name=SuperMario\\\\\\" data-hash=\\\\\\"63831aae2b0e2530a3d56c79c0c11b75583a3d51\\\\\\" data-name=\\\\\\"react-app\\\\\\" data-rendered=\\\\\\"true\\\\\\" data-version=\\\\\\"6.6.6\\\\\\"><div id=\\\\\\"oc-reactRoot-react-app\\\\\\" class=\\\\\\"oc-reactRoot-react-app\\\\\\" ><div class=\\\\\\"special__2pFwCnJl\\\\\\" data-reactroot=\\\\\\"\\\\\\"><h1>Hello <!-- -->SuperMario</h1><pre>function (b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},c)}</pre><p>component name: <!-- -->react-app</p><p>component version: <!-- -->6.6.6</p><p>registry baseUrl: <!-- -->http://localhost:3000/</p><p>component staticPath: <!-- -->http://localhost:3000/react-app/6.6.6/static/</p></div></div> <style>.special__2pFwCnJl{background:#db7093;color:#fff}</style> <script> window.oc = window.oc || {}; oc.cmd = oc.cmd || []; oc.cmd.push(function(oc){ oc.requireSeries([{\\\\\\"global\\\\\\":\\\\\\"PropTypes\\\\\\",\\\\\\"url\\\\\\":\\\\\\"https://unpkg.com/[email protected]/prop-types.min.js\\\\\\",\\\\\\"name\\\\\\":\\\\\\"prop-types\\\\\\"},{\\\\\\"global\\\\\\":\\\\\\"React\\\\\\",\\\\\\"url\\\\\\":\\\\\\"https://unpkg.com/[email protected]/umd/react.production.min.js\\\\\\",\\\\\\"name\\\\\\":\\\\\\"react\\\\\\"},{\\\\\\"global\\\\\\":\\\\\\"ReactDOM\\\\\\",\\\\\\"url\\\\\\":\\\\\\"https://unpkg.com/[email protected]/umd/react-dom.production.min.js\\\\\\",\\\\\\"name\\\\\\":\\\\\\"react-dom\\\\\\"}], function(){ oc.require( ['oc', 'reactComponents', 'b30d0abb0a6a6b3fd055350b2a2eb5163e5c4e42'], 'http://localhost:3000/react-app/6.6.6/static/react-component.js', function(ReactComponent){ var targetNode = document.getElementById(\\\\\\"oc-reactRoot-react-app\\\\\\"); targetNode.setAttribute(\\\\\\"id\\\\\\",\\\\\\"\\\\\\"); ReactDOM.render(React.createElement(ReactComponent, {\\\\\\"name\\\\\\":\\\\\\"SuperMario\\\\\\",\\\\\\"_staticPath\\\\\\":\\\\\\"http://localhost:3000/react-app/6.6.6/static/\\\\\\",\\\\\\"_baseUrl\\\\\\":\\\\\\"http://localhost:3000/\\\\\\",\\\\\\"_componentName\\\\\\":\\\\\\"react-app\\\\\\",\\\\\\"_componentVersion\\\\\\":\\\\\\"6.6.6\\\\\\"}),targetNode); } ); }); }); </script> <script>window.oc=window.oc||{};oc.renderedComponents=oc.renderedComponents||{};oc.renderedComponents[\\\\\\"react-app\\\\\\"]=\\\\\\"6.6.6\\\\\\";</script></oc-component>\\"}"`;
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\\":\\"<oc-component href=\\\\\\"http://localhost:3000/react-app?name=SuperMario\\\\\\" data-hash=\\\\\\"2c7d7bb61a5c25b37551e5b5d5b3baa1c9c8c44a\\\\\\" data-name=\\\\\\"react-app\\\\\\" data-rendered=\\\\\\"true\\\\\\" data-version=\\\\\\"6.6.6\\\\\\"><div id=\\\\\\"oc-reactRoot-react-app\\\\\\" class=\\\\\\"oc-reactRoot-react-app\\\\\\" ><div class=\\\\\\"special__2pFwCnJl\\\\\\" data-reactroot=\\\\\\"\\\\\\"><h1>Hello <!-- -->SuperMario</h1><pre>function (b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},c)}</pre><p>component name: <!-- -->react-app</p><p>component version: <!-- -->6.6.6</p><p>registry baseUrl: <!-- -->http://localhost:3000/</p><p>component staticPath: <!-- -->http://localhost:3000/react-app/6.6.6/static/</p></div></div> <style>.special__2pFwCnJl{background:#db7093;color:#fff}</style> <script> window.oc = window.oc || {}; oc.cmd = oc.cmd || []; oc.cmd.push(function(oc){ oc.requireSeries([{\\\\\\"global\\\\\\":\\\\\\"PropTypes\\\\\\",\\\\\\"url\\\\\\":\\\\\\"https://unpkg.com/[email protected]/prop-types.min.js\\\\\\",\\\\\\"name\\\\\\":\\\\\\"prop-types\\\\\\"},{\\\\\\"global\\\\\\":\\\\\\"React\\\\\\",\\\\\\"url\\\\\\":\\\\\\"https://unpkg.com/[email protected]/umd/react.production.min.js\\\\\\",\\\\\\"name\\\\\\":\\\\\\"react\\\\\\"},{\\\\\\"global\\\\\\":\\\\\\"ReactDOM\\\\\\",\\\\\\"url\\\\\\":\\\\\\"https://unpkg.com/[email protected]/umd/react-dom.production.min.js\\\\\\",\\\\\\"name\\\\\\":\\\\\\"react-dom\\\\\\"}], function(){ oc.require( ['oc', 'reactComponents', 'b30d0abb0a6a6b3fd055350b2a2eb5163e5c4e42'], 'http://localhost:3000/react-app/6.6.6/static/react-component.js', function(ReactComponent){ var targetNode = document.getElementById(\\\\\\"oc-reactRoot-react-app\\\\\\"); targetNode.setAttribute(\\\\\\"id\\\\\\",\\\\\\"\\\\\\"); ReactDOM.render(React.createElement(ReactComponent, {\\\\\\"name\\\\\\":\\\\\\"SuperMario\\\\\\",\\\\\\"_staticPath\\\\\\":\\\\\\"http://localhost:3000/react-app/6.6.6/static/\\\\\\",\\\\\\"_baseUrl\\\\\\":\\\\\\"http://localhost:3000/\\\\\\",\\\\\\"_componentName\\\\\\":\\\\\\"react-app\\\\\\",\\\\\\"_componentVersion\\\\\\":\\\\\\"6.6.6\\\\\\"}),targetNode); } ); }); }); </script> <script>window.oc=window.oc||{};oc.renderedComponents=oc.renderedComponents||{};oc.renderedComponents[\\\\\\"react-app\\\\\\"]=\\\\\\"6.6.6\\\\\\";</script></oc-component>\\"}"`;

exports[`server-side-side rendering 1`] = `
"<!DOCTYPE html><html><head>
<title>A page</title>
</head>
<body>
<oc-component href=\\"http://localhost:3000/react-app?name=SuperMario\\" data-hash=\\"63831aae2b0e2530a3d56c79c0c11b75583a3d51\\" data-name=\\"react-app\\" data-rendered=\\"true\\" data-version=\\"6.6.6\\"><div id=\\"oc-reactRoot-react-app\\" class=\\"oc-reactRoot-react-app\\"><div class=\\"special__2pFwCnJl\\" data-reactroot=\\"\\"><h1>Hello <!-- -->SuperMario</h1><pre>function (b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},c)}</pre><p>component name: <!-- -->react-app</p><p>component version: <!-- -->6.6.6</p><p>registry baseUrl: <!-- -->http://localhost:3000/</p><p>component staticPath: <!-- -->http://localhost:3000/react-app/6.6.6/static/</p></div></div> <style>.special__2pFwCnJl{background:#db7093;color:#fff}</style> <script> window.oc = window.oc || {}; oc.cmd = oc.cmd || []; oc.cmd.push(function(oc){ oc.requireSeries([{\\"global\\":\\"PropTypes\\",\\"url\\":\\"https://unpkg.com/[email protected]/prop-types.min.js\\",\\"name\\":\\"prop-types\\"},{\\"global\\":\\"React\\",\\"url\\":\\"https://unpkg.com/[email protected]/umd/react.production.min.js\\",\\"name\\":\\"react\\"},{\\"global\\":\\"ReactDOM\\",\\"url\\":\\"https://unpkg.com/[email protected]/umd/react-dom.production.min.js\\",\\"name\\":\\"react-dom\\"}], function(){ oc.require( ['oc', 'reactComponents', 'b30d0abb0a6a6b3fd055350b2a2eb5163e5c4e42'], 'http://localhost:3000/react-app/6.6.6/static/react-component.js', function(ReactComponent){ var targetNode = document.getElementById(\\"oc-reactRoot-react-app\\"); targetNode.setAttribute(\\"id\\",\\"\\"); ReactDOM.render(React.createElement(ReactComponent, {\\"name\\":\\"SuperMario\\",\\"_staticPath\\":\\"http://localhost:3000/react-app/6.6.6/static/\\",\\"_baseUrl\\":\\"http://localhost:3000/\\",\\"_componentName\\":\\"react-app\\",\\"_componentVersion\\":\\"6.6.6\\"}),targetNode); } ); }); }); </script> <script>window.oc=window.oc||{};oc.renderedComponents=oc.renderedComponents||{};oc.renderedComponents[\\"react-app\\"]=\\"6.6.6\\";</script></oc-component>
<oc-component href=\\"http://localhost:3000/react-app?name=SuperMario\\" data-hash=\\"2c7d7bb61a5c25b37551e5b5d5b3baa1c9c8c44a\\" data-name=\\"react-app\\" data-rendered=\\"true\\" data-version=\\"6.6.6\\"><div id=\\"oc-reactRoot-react-app\\" class=\\"oc-reactRoot-react-app\\"><div class=\\"special__2pFwCnJl\\" data-reactroot=\\"\\"><h1>Hello <!-- -->SuperMario</h1><pre>function (b,c){return window.oc.getData({name:a.props._componentName,version:a.props._componentVersion,baseUrl:a.props._baseUrl,parameters:b},c)}</pre><p>component name: <!-- -->react-app</p><p>component version: <!-- -->6.6.6</p><p>registry baseUrl: <!-- -->http://localhost:3000/</p><p>component staticPath: <!-- -->http://localhost:3000/react-app/6.6.6/static/</p></div></div> <style>.special__2pFwCnJl{background:#db7093;color:#fff}</style> <script> window.oc = window.oc || {}; oc.cmd = oc.cmd || []; oc.cmd.push(function(oc){ oc.requireSeries([{\\"global\\":\\"PropTypes\\",\\"url\\":\\"https://unpkg.com/[email protected]/prop-types.min.js\\",\\"name\\":\\"prop-types\\"},{\\"global\\":\\"React\\",\\"url\\":\\"https://unpkg.com/[email protected]/umd/react.production.min.js\\",\\"name\\":\\"react\\"},{\\"global\\":\\"ReactDOM\\",\\"url\\":\\"https://unpkg.com/[email protected]/umd/react-dom.production.min.js\\",\\"name\\":\\"react-dom\\"}], function(){ oc.require( ['oc', 'reactComponents', 'b30d0abb0a6a6b3fd055350b2a2eb5163e5c4e42'], 'http://localhost:3000/react-app/6.6.6/static/react-component.js', function(ReactComponent){ var targetNode = document.getElementById(\\"oc-reactRoot-react-app\\"); targetNode.setAttribute(\\"id\\",\\"\\"); ReactDOM.render(React.createElement(ReactComponent, {\\"name\\":\\"SuperMario\\",\\"_staticPath\\":\\"http://localhost:3000/react-app/6.6.6/static/\\",\\"_baseUrl\\":\\"http://localhost:3000/\\",\\"_componentName\\":\\"react-app\\",\\"_componentVersion\\":\\"6.6.6\\"}),targetNode); } ); }); }); </script> <script>window.oc=window.oc||{};oc.renderedComponents=oc.renderedComponents||{};oc.renderedComponents[\\"react-app\\"]=\\"6.6.6\\";</script></oc-component>
<script>window.oc = window.oc || {};
oc.conf = oc.conf || {};
oc.conf.templates = oc.conf.templates || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Object {
"hashKey": "1ac8759d9fb60e78a18439bf6aaa95b61f7a179c",
},
"template": Object {
"hashKey": "3c2143b3bbbdcd4162f68bd1acad89943ac6eefe",
"hashKey": "03345a69693aeb79bc343c12e4ce47baa27e0f05",
"src": "template.js",
"type": "oc-template-react",
},
}
`;

exports[`valid component 2`] = `"var oc=oc||{};oc.components=oc.components||{};oc.components['3c2143b3bbbdcd4162f68bd1acad89943ac6eefe']=function(model){ return \`<div id=\\"oc-reactRoot-react-component\\" class=\\"oc-reactRoot-react-component\\" >\${ model.__html ? model.__html : '' }</div> <style>null</style> <script> window.oc = window.oc || {}; oc.cmd = oc.cmd || []; oc.cmd.push(function(oc){ oc.requireSeries([{\\"global\\":\\"PropTypes\\",\\"url\\":\\"https://unpkg.com/[email protected]/prop-types.min.js\\",\\"name\\":\\"prop-types\\"},{\\"global\\":\\"React\\",\\"url\\":\\"https://unpkg.com/[email protected]/umd/react.production.min.js\\",\\"name\\":\\"react\\"},{\\"global\\":\\"ReactDOM\\",\\"url\\":\\"https://unpkg.com/[email protected]/umd/react-dom.production.min.js\\",\\"name\\":\\"react-dom\\"}], function(){ oc.require( ['oc', 'reactComponents', '1ac8759d9fb60e78a18439bf6aaa95b61f7a179c'], '\${model.reactComponent.props._staticPath}react-component.js', function(ReactComponent){ var targetNode = document.getElementById(\\"oc-reactRoot-react-component\\"); targetNode.setAttribute(\\"id\\",\\"\\"); ReactDOM.render(React.createElement(ReactComponent, \${JSON.stringify(model.reactComponent.props)}),targetNode); } ); }); }); </script> \`; }"`;
exports[`valid component 2`] = `"var oc=oc||{};oc.components=oc.components||{};oc.components['03345a69693aeb79bc343c12e4ce47baa27e0f05']=function(model){ return \`<div id=\\"oc-reactRoot-react-component\\" class=\\"oc-reactRoot-react-component\\" >\${ model.__html ? model.__html : '' }</div> <style>null</style> <script> window.oc = window.oc || {}; oc.cmd = oc.cmd || []; oc.cmd.push(function(oc){ oc.requireSeries([{\\"global\\":\\"PropTypes\\",\\"url\\":\\"https://unpkg.com/[email protected]/prop-types.min.js\\",\\"name\\":\\"prop-types\\"},{\\"global\\":\\"React\\",\\"url\\":\\"https://unpkg.com/[email protected]/umd/react.production.min.js\\",\\"name\\":\\"react\\"},{\\"global\\":\\"ReactDOM\\",\\"url\\":\\"https://unpkg.com/[email protected]/umd/react-dom.production.min.js\\",\\"name\\":\\"react-dom\\"}], function(){ oc.require( ['oc', 'reactComponents', '1ac8759d9fb60e78a18439bf6aaa95b61f7a179c'], '\${model.reactComponent.props._staticPath}react-component.js', function(ReactComponent){ var targetNode = document.getElementById(\\"oc-reactRoot-react-component\\"); targetNode.setAttribute(\\"id\\",\\"\\"); ReactDOM.render(React.createElement(ReactComponent, \${JSON.stringify(model.reactComponent.props)}),targetNode); } ); }); }); </script> \`; }"`;
2 changes: 1 addition & 1 deletion packages/oc-template-react-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"oc-view-wrapper": "1.0.2",
"oc-webpack": "2.1.3",
"prop-types": "15.6.0",
"react": "16.1.1",
"react": "16.2.0",
"webpack": "^3.5.5"
},
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ Object {
Object {
"global": "React",
"name": "react",
"url": "https://unpkg.com/react@16.1.1/umd/react.production.min.js",
"url": "https://unpkg.com/react@16.2.0/umd/react.production.min.js",
},
Object {
"global": "ReactDOM",
"name": "react-dom",
"url": "https://unpkg.com/react-dom@16.1.1/umd/react-dom.production.min.js",
"url": "https://unpkg.com/react-dom@16.2.0/umd/react-dom.production.min.js",
},
],
"type": "oc-template-react",
Expand Down
8 changes: 4 additions & 4 deletions packages/oc-template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"nice-cache": "0.0.5",
"oc-generic-template-renderer": "2.0.1",
"prop-types": "15.6.0",
"react": "16.1.1",
"react-dom": "16.1.1"
"react": "16.2.0",
"react-dom": "16.2.0"
},
"files": [
"lib",
Expand All @@ -43,11 +43,11 @@
},
"react": {
"global": "React",
"url": "https://unpkg.com/react@16.1.1/umd/react.production.min.js"
"url": "https://unpkg.com/react@16.2.0/umd/react.production.min.js"
},
"react-dom": {
"global": "ReactDOM",
"url": "https://unpkg.com/react-dom@16.1.1/umd/react-dom.production.min.js"
"url": "https://unpkg.com/react-dom@16.2.0/umd/react-dom.production.min.js"
}
}
}