@financial-times/x-engine
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
{ | ||
"name": "@financial-times/x-engine", | ||
"version": "1.0.0-beta.1", | ||
"description": "A consolidation library to render x- components with any compatible runtime.", | ||
"version": "1.0.0-beta.2", | ||
"description": "This module is a consolidation library to render x-dash components with any compatible runtime.", | ||
"main": "src/server.js", | ||
"browser": "src/client.js", | ||
"keywords": [], | ||
"keywords": [ | ||
"x-dash" | ||
], | ||
"author": "", | ||
@@ -13,2 +15,7 @@ "license": "ISC", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Financial-Times/x-dash.git" | ||
}, | ||
"homepage": "https://github.com/Financial-Times/x-dash/tree/master/packages/x-engine", | ||
"engines": { | ||
@@ -15,0 +22,0 @@ "node": ">= 6.0.0" |
# x-engine | ||
A consolidation library to render `x-` components with any compatible runtime. | ||
This module is a consolidation library to render `x-dash` components with any compatible runtime. | ||
@@ -122,2 +122,22 @@ ## Installation | ||
#### Client-side through n-ui | ||
In order to configure n-ui to compile x-dash based `.jsx` files you will also need to add the following to `n-ui-build.config.js`. | ||
```js | ||
// n-ui-build.config.js | ||
const xEngine = require('@financial-times/x-engine/src/webpack'); | ||
module.exports = { | ||
plugins: [ | ||
xEngine() | ||
], | ||
pragma: 'h' | ||
}; | ||
``` | ||
You will also need to import `h` from `x-engine` at the top of each `.jsx` file. | ||
```javascript | ||
import {h} from '@financial-times/x-engine' | ||
``` | ||
## FAQ | ||
@@ -124,0 +144,0 @@ |
@@ -9,1 +9,2 @@ /* eslint no-undef: "off", no-unused-vars: "off" */ | ||
module.exports.Component = X_ENGINE_COMPONENT; | ||
module.exports.Fragment = X_ENGINE_FRAGMENT; |
@@ -6,2 +6,3 @@ module.exports = { | ||
component: 'Component', | ||
fragment: 'Fragment', | ||
renderModule: 'react-dom', | ||
@@ -20,4 +21,5 @@ render: 'render' | ||
component: 'Component', | ||
fragment: 'Fragment', | ||
render: 'render' | ||
} | ||
}; |
@@ -28,6 +28,9 @@ const deepGet = require('./concerns/deep-get'); | ||
// 7. if the rendering module is different to the runtime, load it | ||
// 7. if we've loaded the runtime then find its Fragment object | ||
const fragment = config.fragment ? runtime[config.fragment] : null; | ||
// 8. if the rendering module is different to the runtime, load it | ||
const renderModule = config.renderModule ? require(resolvePeer(config.renderModule)) : runtime; | ||
// 8. if we've got the render module then find its render method | ||
// 9. if we've got the render module then find its render method | ||
const render = config.render ? renderModule[config.render] : renderModule; | ||
@@ -38,1 +41,2 @@ | ||
module.exports.Component = component; | ||
module.exports.Fragment = fragment; |
@@ -44,2 +44,3 @@ const assignDeep = require('assign-deep'); | ||
'X_ENGINE_COMPONENT': config.component ? `runtime["${config.component}"]` : 'null', | ||
'X_ENGINE_FRAGMENT': config.fragment ? `runtime["${config.fragment}"]` : 'null', | ||
'X_ENGINE_RENDER_MODULE': `"${config.renderModule}"`, | ||
@@ -46,0 +47,0 @@ 'X_ENGINE_RENDER': config.render ? `render["${config.render}"]` : 'null', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
11773
155
1
159
7