component-kit-builder
Advanced tools
Comparing version 1.0.10 to 1.1.0
@@ -5,2 +5,3 @@ 'use strict'; | ||
const values = require('object.values'); | ||
const hoist = require('hoist-non-react-statics'); | ||
module.exports = function (context) { | ||
@@ -33,3 +34,3 @@ const uniquePaths = context.keys().reduce((obj, key) => { | ||
complete: wrappersList.reduce( | ||
(complete, moduleName) => flow(moduleMap[moduleName], complete), | ||
(complete, moduleName) => hoist(moduleMap[moduleName](complete), complete), | ||
moduleMap.component | ||
@@ -39,5 +40,5 @@ ) | ||
wrappersList.reduce((obj, moduleName) => Object.assign({}, obj, { | ||
[`${moduleName}_wrapped`]: moduleMap[moduleName](moduleMap.component) | ||
[`${moduleName}_wrapped`]: hoist(moduleMap[moduleName](moduleMap.component), moduleMap.component) | ||
}), {}) | ||
); | ||
}; |
{ | ||
"name": "component-kit-builder", | ||
"version": "1.0.10", | ||
"version": "1.1.0", | ||
"description": "builds component kits using webpack require.context", | ||
@@ -28,2 +28,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"hoist-non-react-statics": "^1.2.0", | ||
"lodash.flow": "^3.3.0", | ||
@@ -30,0 +31,0 @@ "object.values": "^1.0.3" |
@@ -23,4 +23,4 @@ const assert = require('assert'); | ||
fs.writeFileSync(path.join(myComponentDir, 'component.js'), `module.exports = x => \`component \${x}\`;`); | ||
fs.writeFileSync(path.join(myComponentDir, 'redux.js'), `module.exports = x => y => y(\`redux \${x}\`);`); | ||
fs.writeFileSync(path.join(myComponentDir, 'relay.js'), `module.exports = x => y => y(\`relay \${x}\`);`); | ||
fs.writeFileSync(path.join(myComponentDir, 'redux.js'), `module.exports = x => y => x(\`redux \${y}\`);`); | ||
fs.writeFileSync(path.join(myComponentDir, 'relay.js'), `module.exports = x => y => x(\`relay \${y}\`);`); | ||
fs.writeFileSync(path.join(testTmp, 'build-manager.js'), dedent` | ||
@@ -84,2 +84,18 @@ const kitBuilder = require('${path.relative(testTmp, require.resolve('..'))}') | ||
}); | ||
it('should hoist static properties through composition', function () { | ||
fs.writeFileSync(path.join(myComponentDir, 'component.js'), ` | ||
module.exports = Object.assign(x => \`component \${x}\`, {componentStaticProp: true}); | ||
`); | ||
fs.writeFileSync(path.join(myComponentDir, 'redux.js'), ` | ||
module.exports = x => Object.assign(y => y(\`redux \${x}\`), {reduxStaticProp: true}); | ||
`); | ||
fs.writeFileSync(path.join(myComponentDir, 'relay.js'), ` | ||
module.exports = x => Object.assign(y => y(\`relay \${x}\`), {relayStaticProp: true}); | ||
`); | ||
buildBundle(); | ||
const bundle = require(bundlePath); | ||
assert(bundle.complete.reduxStaticProp); | ||
assert(bundle.complete.relayStaticProp); | ||
assert(bundle.complete.componentStaticProp); | ||
}) | ||
}); |
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
7927
140
3
8
+ Addedhoist-non-react-statics@1.2.0(transitive)