@dhis2/prop-types
Advanced tools
Comparing version 1.6.3 to 1.6.4
import fs from 'fs' | ||
import path from 'path' | ||
import dhis2PropTypes from '../index.js' | ||
import originalPropTypes from 'prop-types' | ||
import dhis2PropTypes, * as namedDhis2PropTypes from '../index.js' | ||
@@ -11,2 +12,3 @@ const customPropTypesPath = path.join(__dirname, '../propTypes') | ||
if (file === '..') return false | ||
if (file === 'index.js') return false | ||
@@ -20,3 +22,3 @@ const filePath = path.join(customPropTypesPath, file) | ||
describe('index', () => { | ||
describe('default export', () => { | ||
it('should export a prop type for each custom prop type file', () => { | ||
@@ -41,4 +43,2 @@ const actual = Object.keys(dhis2PropTypes) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
const originalPropTypes = require('prop-types') | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
@@ -49,1 +49,29 @@ expect(dhis2PropTypes[propType]).toBe(originalPropTypes[propType]) | ||
}) | ||
describe('named exports', () => { | ||
it('should export a prop type for each custom prop type file', () => { | ||
const actual = Object.keys(namedDhis2PropTypes) | ||
const expected = expect.arrayContaining(customPropTypeFilenames) | ||
expect(actual).toEqual(expected) | ||
}) | ||
it('should reexport the named export in each custom prop type file', () => { | ||
customPropTypeFilenames.forEach(filename => { | ||
const fullPath = path.join(customPropTypesPath, `${filename}.js`) | ||
const exportedModule = require(fullPath) | ||
// The filename is equal to the name of the named export | ||
const exportedPropType = exportedModule[filename] | ||
expect(exportedPropType).toBe(namedDhis2PropTypes[filename]) | ||
}) | ||
}) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
expect(namedDhis2PropTypes[propType]).toBe( | ||
originalPropTypes[propType] | ||
) | ||
}) | ||
}) | ||
}) |
@@ -6,18 +6,35 @@ "use strict"; | ||
}); | ||
var _exportNames = {}; | ||
exports.default = void 0; | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _propTypes = _interopRequireWildcard(require("prop-types")); | ||
var _arrayWithLength = require("./propTypes/arrayWithLength.js"); | ||
Object.keys(_propTypes).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _propTypes[key]; | ||
} | ||
}); | ||
}); | ||
var _conditional = require("./propTypes/conditional"); | ||
var customPropTypes = _interopRequireWildcard(require("./propTypes")); | ||
var _instanceOfComponent = require("./propTypes/instanceOfComponent.js"); | ||
Object.keys(customPropTypes).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return customPropTypes[key]; | ||
} | ||
}); | ||
}); | ||
var _mutuallyExclusive = require("./propTypes/mutuallyExclusive.js"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
var _requiredIf = require("./propTypes/requiredIf.js"); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -29,11 +46,6 @@ | ||
const dhis2PropTypes = _objectSpread({}, _propTypes.default, { | ||
arrayWithLength: _arrayWithLength.arrayWithLength, | ||
conditional: _conditional.conditional, | ||
instanceOfComponent: _instanceOfComponent.instanceOfComponent, | ||
mutuallyExclusive: _mutuallyExclusive.mutuallyExclusive, | ||
requiredIf: _requiredIf.requiredIf | ||
}); | ||
// Export all prop-types as a default export as well | ||
const allPropTypes = _objectSpread({}, _propTypes.default, {}, customPropTypes); | ||
var _default = dhis2PropTypes; | ||
var _default = allPropTypes; | ||
exports.default = _default; |
import fs from 'fs' | ||
import path from 'path' | ||
import dhis2PropTypes from '../index.js' | ||
import originalPropTypes from 'prop-types' | ||
import dhis2PropTypes, * as namedDhis2PropTypes from '../index.js' | ||
@@ -11,2 +12,3 @@ const customPropTypesPath = path.join(__dirname, '../propTypes') | ||
if (file === '..') return false | ||
if (file === 'index.js') return false | ||
@@ -20,3 +22,3 @@ const filePath = path.join(customPropTypesPath, file) | ||
describe('index', () => { | ||
describe('default export', () => { | ||
it('should export a prop type for each custom prop type file', () => { | ||
@@ -41,4 +43,2 @@ const actual = Object.keys(dhis2PropTypes) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
const originalPropTypes = require('prop-types') | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
@@ -49,1 +49,29 @@ expect(dhis2PropTypes[propType]).toBe(originalPropTypes[propType]) | ||
}) | ||
describe('named exports', () => { | ||
it('should export a prop type for each custom prop type file', () => { | ||
const actual = Object.keys(namedDhis2PropTypes) | ||
const expected = expect.arrayContaining(customPropTypeFilenames) | ||
expect(actual).toEqual(expected) | ||
}) | ||
it('should reexport the named export in each custom prop type file', () => { | ||
customPropTypeFilenames.forEach(filename => { | ||
const fullPath = path.join(customPropTypesPath, `${filename}.js`) | ||
const exportedModule = require(fullPath) | ||
// The filename is equal to the name of the named export | ||
const exportedPropType = exportedModule[filename] | ||
expect(exportedPropType).toBe(namedDhis2PropTypes[filename]) | ||
}) | ||
}) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
expect(namedDhis2PropTypes[propType]).toBe( | ||
originalPropTypes[propType] | ||
) | ||
}) | ||
}) | ||
}) |
import propTypes from 'prop-types'; | ||
import { arrayWithLength } from './propTypes/arrayWithLength.js'; | ||
import { conditional } from './propTypes/conditional'; | ||
import { instanceOfComponent } from './propTypes/instanceOfComponent.js'; | ||
import { mutuallyExclusive } from './propTypes/mutuallyExclusive.js'; | ||
import { requiredIf } from './propTypes/requiredIf.js'; | ||
const dhis2PropTypes = { ...propTypes, | ||
arrayWithLength, | ||
conditional, | ||
instanceOfComponent, | ||
mutuallyExclusive, | ||
requiredIf | ||
import * as customPropTypes from './propTypes'; // Export all prop-types as named exports | ||
export * from './propTypes'; | ||
export * from 'prop-types'; // Export all prop-types as a default export as well | ||
const allPropTypes = { ...propTypes, | ||
...customPropTypes | ||
}; | ||
export default dhis2PropTypes; | ||
export default allPropTypes; |
@@ -0,1 +1,8 @@ | ||
## [1.6.4](https://github.com/dhis2/prop-types/compare/v1.6.3...v1.6.4) (2020-04-02) | ||
### Bug Fixes | ||
* export named exports as well ([4030de5](https://github.com/dhis2/prop-types/commit/4030de5d75845e354ba7d4f04288d6880c0551bd)) | ||
## [1.6.3](https://github.com/dhis2/prop-types/compare/v1.6.2...v1.6.3) (2020-04-02) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@dhis2/prop-types", | ||
"version": "1.6.3", | ||
"version": "1.6.4", | ||
"main": "./build/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./build/es/index.js", |
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
82404
29
1600
7