@dhis2/prop-types
Advanced tools
Comparing version 1.6.4 to 2.0.0
import fs from 'fs' | ||
import path from 'path' | ||
import originalPropTypes from 'prop-types' | ||
import dhis2PropTypes, * as namedDhis2PropTypes from '../index.js' | ||
@@ -39,8 +38,2 @@ | ||
}) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
expect(dhis2PropTypes[propType]).toBe(originalPropTypes[propType]) | ||
}) | ||
}) | ||
}) | ||
@@ -66,10 +59,2 @@ | ||
}) | ||
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,15 @@ "use strict"; | ||
}); | ||
var _exportNames = {}; | ||
var _exportNames = { | ||
PropTypes: true | ||
}; | ||
Object.defineProperty(exports, "PropTypes", { | ||
enumerable: true, | ||
get: function get() { | ||
return _propTypes.default; | ||
} | ||
}); | ||
exports.default = void 0; | ||
var _propTypes = _interopRequireWildcard(require("prop-types")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
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 customPropTypes = _interopRequireWildcard(require("./propTypes")); | ||
@@ -40,12 +37,21 @@ | ||
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; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
/* | ||
* Export our own prop-types as named exports, this allows this import style: | ||
* import { arrayWithLength } from '@dhis2/prop-types' | ||
*/ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
/* | ||
* Reexport the prop-types lib under a namespace, as is our convention. The | ||
* name is Pascalcased, this allows for this import style: | ||
* import { PropTypes } from '@dhis2/prop-types' | ||
*/ | ||
// Export all prop-types as a default export as well | ||
const allPropTypes = _objectSpread({}, _propTypes.default, {}, customPropTypes); | ||
var _default = allPropTypes; | ||
/* | ||
* Export custom prop-types as the default export. This only contains our | ||
* own prop-types. Import style is (naming is up to the user of course): | ||
* import dhis2PropTypes from '@dhis2/prop-types' | ||
*/ | ||
var _default = customPropTypes; | ||
exports.default = _default; |
import fs from 'fs' | ||
import path from 'path' | ||
import originalPropTypes from 'prop-types' | ||
import dhis2PropTypes, * as namedDhis2PropTypes from '../index.js' | ||
@@ -39,8 +38,2 @@ | ||
}) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
expect(dhis2PropTypes[propType]).toBe(originalPropTypes[propType]) | ||
}) | ||
}) | ||
}) | ||
@@ -66,10 +59,2 @@ | ||
}) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
expect(namedDhis2PropTypes[propType]).toBe( | ||
originalPropTypes[propType] | ||
) | ||
}) | ||
}) | ||
}) |
@@ -1,10 +0,22 @@ | ||
import propTypes from 'prop-types'; | ||
import * as customPropTypes from './propTypes'; // Export all prop-types as named exports | ||
import PropTypes from 'prop-types'; | ||
import * as customPropTypes from './propTypes'; | ||
/* | ||
* Export our own prop-types as named exports, this allows this import style: | ||
* import { arrayWithLength } from '@dhis2/prop-types' | ||
*/ | ||
export * from './propTypes'; | ||
export * from 'prop-types'; // Export all prop-types as a default export as well | ||
/* | ||
* Reexport the prop-types lib under a namespace, as is our convention. The | ||
* name is Pascalcased, this allows for this import style: | ||
* import { PropTypes } from '@dhis2/prop-types' | ||
*/ | ||
const allPropTypes = { ...propTypes, | ||
...customPropTypes | ||
}; | ||
export default allPropTypes; | ||
export { PropTypes }; | ||
/* | ||
* Export custom prop-types as the default export. This only contains our | ||
* own prop-types. Import style is (naming is up to the user of course): | ||
* import dhis2PropTypes from '@dhis2/prop-types' | ||
*/ | ||
export default customPropTypes; |
@@ -0,1 +1,13 @@ | ||
# [2.0.0](https://github.com/dhis2/prop-types/compare/v1.6.4...v2.0.0) (2020-04-28) | ||
### Features | ||
* update the export style ([decd522](https://github.com/dhis2/prop-types/commit/decd5227cdc3f7ccce1571ded890f636bd984332)) | ||
### BREAKING CHANGES | ||
* this changes the re-export style for the prop-types lib. Instead of mixing our custom and the upstream prop-types, now the upstream lib is namespaced under the 'PropTypes' named export. | ||
## [1.6.4](https://github.com/dhis2/prop-types/compare/v1.6.3...v1.6.4) (2020-04-02) | ||
@@ -2,0 +14,0 @@ |
{ | ||
"name": "@dhis2/prop-types", | ||
"version": "1.6.4", | ||
"version": "2.0.0", | ||
"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
81332
1591