@openedx/frontend-build 14.0.9 → 14.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/package.json +11 -5
  2. package/.eslintignore +0 -5
  3. package/.eslintrc.js +0 -10
  4. package/.github/workflows/add-depr-ticket-to-depr-board.yml +0 -19
  5. package/.github/workflows/add-remove-label-on-comment.yml +0 -20
  6. package/.github/workflows/ci.yml +0 -30
  7. package/.github/workflows/commitlint.yml +0 -10
  8. package/.github/workflows/lockfileversion-check.yml +0 -13
  9. package/.github/workflows/release.yml +0 -34
  10. package/.github/workflows/self-assign-issue.yml +0 -12
  11. package/.github/workflows/sync-master-alpha.yml +0 -35
  12. package/.nvmrc +0 -1
  13. package/coverage/clover.xml +0 -6
  14. package/coverage/coverage-final.json +0 -1
  15. package/coverage/lcov-report/base.css +0 -224
  16. package/coverage/lcov-report/block-navigation.js +0 -87
  17. package/coverage/lcov-report/favicon.png +0 -0
  18. package/coverage/lcov-report/index.html +0 -101
  19. package/coverage/lcov-report/prettify.css +0 -1
  20. package/coverage/lcov-report/prettify.js +0 -2
  21. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  22. package/coverage/lcov-report/sorter.js +0 -196
  23. package/coverage/lcov.info +0 -0
  24. package/docs/0001-non-usage-of-gatsby.rst +0 -37
  25. package/docs/0002-js-environment-config.md +0 -47
  26. package/docs/0003-fedx-scripts-serve.md +0 -37
  27. package/example/.env +0 -0
  28. package/example/.env.development +0 -3
  29. package/example/.env.test +0 -2
  30. package/example/.eslintignore +0 -5
  31. package/example/.eslintrc.js +0 -3
  32. package/example/dist/1382e1cbf8d733d7301cdd212192bfea.jpg +0 -0
  33. package/example/dist/652.70be34739115e11aaeb3.js +0 -3
  34. package/example/dist/652.70be34739115e11aaeb3.js.LICENSE.txt +0 -41
  35. package/example/dist/652.70be34739115e11aaeb3.js.map +0 -1
  36. package/example/dist/app.09a2e8d2732091b5c03c.css +0 -3
  37. package/example/dist/app.09a2e8d2732091b5c03c.css.map +0 -1
  38. package/example/dist/app.09a2e8d2732091b5c03c.js +0 -2
  39. package/example/dist/app.09a2e8d2732091b5c03c.js.map +0 -1
  40. package/example/dist/babel/App.js +0 -94
  41. package/example/dist/babel/App.js.map +0 -1
  42. package/example/dist/babel/App.test.jsx +0 -11
  43. package/example/dist/babel/Image.tsx +0 -16
  44. package/example/dist/babel/__snapshots__/App.test.jsx.snap +0 -120
  45. package/example/dist/babel/apple.jpg +0 -0
  46. package/example/dist/babel/apple.svg +0 -1
  47. package/example/dist/babel/index.js +0 -13
  48. package/example/dist/babel/index.js.map +0 -1
  49. package/example/dist/babel/style.scss +0 -9
  50. package/example/dist/cb28cdb1468c915e27e5cec9af64f22f.svg +0 -1
  51. package/example/dist/index.html +0 -4
  52. package/example/dist/report.html +0 -39
  53. package/example/dist/runtime.40856db71d718a3e9d37.js +0 -2
  54. package/example/dist/runtime.40856db71d718a3e9d37.js.map +0 -1
  55. package/example/env.config.js +0 -6
  56. package/example/node_modules/.package-lock.json +0 -98
  57. package/example/node_modules/js-tokens/CHANGELOG.md +0 -151
  58. package/example/node_modules/js-tokens/LICENSE +0 -21
  59. package/example/node_modules/js-tokens/README.md +0 -240
  60. package/example/node_modules/js-tokens/index.js +0 -23
  61. package/example/node_modules/js-tokens/package.json +0 -30
  62. package/example/node_modules/loose-envify/LICENSE +0 -21
  63. package/example/node_modules/loose-envify/README.md +0 -45
  64. package/example/node_modules/loose-envify/cli.js +0 -16
  65. package/example/node_modules/loose-envify/custom.js +0 -4
  66. package/example/node_modules/loose-envify/index.js +0 -3
  67. package/example/node_modules/loose-envify/loose-envify.js +0 -36
  68. package/example/node_modules/loose-envify/package.json +0 -36
  69. package/example/node_modules/loose-envify/replace.js +0 -65
  70. package/example/node_modules/object-assign/index.js +0 -90
  71. package/example/node_modules/object-assign/license +0 -21
  72. package/example/node_modules/object-assign/package.json +0 -42
  73. package/example/node_modules/object-assign/readme.md +0 -61
  74. package/example/node_modules/prop-types/LICENSE +0 -21
  75. package/example/node_modules/prop-types/README.md +0 -302
  76. package/example/node_modules/prop-types/checkPropTypes.js +0 -103
  77. package/example/node_modules/prop-types/factory.js +0 -19
  78. package/example/node_modules/prop-types/factoryWithThrowingShims.js +0 -65
  79. package/example/node_modules/prop-types/factoryWithTypeCheckers.js +0 -610
  80. package/example/node_modules/prop-types/index.js +0 -19
  81. package/example/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -12
  82. package/example/node_modules/prop-types/lib/has.js +0 -1
  83. package/example/node_modules/prop-types/package.json +0 -60
  84. package/example/node_modules/prop-types/prop-types.js +0 -1315
  85. package/example/node_modules/prop-types/prop-types.min.js +0 -1
  86. package/example/node_modules/react/LICENSE +0 -21
  87. package/example/node_modules/react/README.md +0 -13
  88. package/example/node_modules/react/build-info.json +0 -8
  89. package/example/node_modules/react/cjs/react-jsx-dev-runtime.development.js +0 -889
  90. package/example/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  91. package/example/node_modules/react/cjs/react-jsx-runtime.development.js +0 -911
  92. package/example/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -10
  93. package/example/node_modules/react/cjs/react.development.js +0 -1912
  94. package/example/node_modules/react/cjs/react.production.min.js +0 -25
  95. package/example/node_modules/react/index.js +0 -7
  96. package/example/node_modules/react/jsx-dev-runtime.js +0 -7
  97. package/example/node_modules/react/jsx-runtime.js +0 -7
  98. package/example/node_modules/react/package.json +0 -44
  99. package/example/node_modules/react/umd/react.development.js +0 -3318
  100. package/example/node_modules/react/umd/react.production.min.js +0 -32
  101. package/example/node_modules/react/umd/react.profiling.min.js +0 -39
  102. package/example/node_modules/react-dom/LICENSE +0 -21
  103. package/example/node_modules/react-dom/README.md +0 -54
  104. package/example/node_modules/react-dom/build-info.json +0 -8
  105. package/example/node_modules/react-dom/cjs/react-dom-server.browser.development.js +0 -4043
  106. package/example/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +0 -54
  107. package/example/node_modules/react-dom/cjs/react-dom-server.node.development.js +0 -4085
  108. package/example/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +0 -55
  109. package/example/node_modules/react-dom/cjs/react-dom-test-utils.development.js +0 -1480
  110. package/example/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +0 -35
  111. package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.development.js +0 -141
  112. package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.production.min.js +0 -11
  113. package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.development.js +0 -162
  114. package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js +0 -12
  115. package/example/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js +0 -1629
  116. package/example/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js +0 -31
  117. package/example/node_modules/react-dom/cjs/react-dom.development.js +0 -25012
  118. package/example/node_modules/react-dom/cjs/react-dom.production.min.js +0 -292
  119. package/example/node_modules/react-dom/cjs/react-dom.profiling.min.js +0 -299
  120. package/example/node_modules/react-dom/index.js +0 -38
  121. package/example/node_modules/react-dom/package.json +0 -60
  122. package/example/node_modules/react-dom/profiling.js +0 -38
  123. package/example/node_modules/react-dom/server.browser.js +0 -7
  124. package/example/node_modules/react-dom/server.js +0 -3
  125. package/example/node_modules/react-dom/server.node.js +0 -7
  126. package/example/node_modules/react-dom/test-utils.js +0 -7
  127. package/example/node_modules/react-dom/umd/react-dom-server.browser.development.js +0 -4147
  128. package/example/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +0 -45
  129. package/example/node_modules/react-dom/umd/react-dom-test-utils.development.js +0 -1499
  130. package/example/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +0 -30
  131. package/example/node_modules/react-dom/umd/react-dom-unstable-fizz.browser.development.js +0 -141
  132. package/example/node_modules/react-dom/umd/react-dom-unstable-fizz.browser.production.min.js +0 -10
  133. package/example/node_modules/react-dom/umd/react-dom-unstable-native-dependencies.development.js +0 -1628
  134. package/example/node_modules/react-dom/umd/react-dom-unstable-native-dependencies.production.min.js +0 -28
  135. package/example/node_modules/react-dom/umd/react-dom.development.js +0 -25147
  136. package/example/node_modules/react-dom/umd/react-dom.production.min.js +0 -239
  137. package/example/node_modules/react-dom/umd/react-dom.profiling.min.js +0 -247
  138. package/example/node_modules/react-dom/unstable-fizz.browser.js +0 -7
  139. package/example/node_modules/react-dom/unstable-fizz.js +0 -3
  140. package/example/node_modules/react-dom/unstable-fizz.node.js +0 -7
  141. package/example/node_modules/react-dom/unstable-native-dependencies.js +0 -7
  142. package/example/node_modules/react-is/LICENSE +0 -21
  143. package/example/node_modules/react-is/README.md +0 -104
  144. package/example/node_modules/react-is/build-info.json +0 -8
  145. package/example/node_modules/react-is/cjs/react-is.development.js +0 -181
  146. package/example/node_modules/react-is/cjs/react-is.production.min.js +0 -15
  147. package/example/node_modules/react-is/index.js +0 -7
  148. package/example/node_modules/react-is/package.json +0 -27
  149. package/example/node_modules/react-is/umd/react-is.development.js +0 -181
  150. package/example/node_modules/react-is/umd/react-is.production.min.js +0 -13
  151. package/example/node_modules/react-test-renderer/LICENSE +0 -21
  152. package/example/node_modules/react-test-renderer/README.md +0 -26
  153. package/example/node_modules/react-test-renderer/build-info.json +0 -8
  154. package/example/node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js +0 -1019
  155. package/example/node_modules/react-test-renderer/cjs/react-test-renderer-shallow.production.min.js +0 -35
  156. package/example/node_modules/react-test-renderer/cjs/react-test-renderer.development.js +0 -15596
  157. package/example/node_modules/react-test-renderer/cjs/react-test-renderer.production.min.js +0 -181
  158. package/example/node_modules/react-test-renderer/index.js +0 -7
  159. package/example/node_modules/react-test-renderer/package.json +0 -41
  160. package/example/node_modules/react-test-renderer/shallow.js +0 -7
  161. package/example/node_modules/react-test-renderer/umd/react-test-renderer-shallow.development.js +0 -1176
  162. package/example/node_modules/react-test-renderer/umd/react-test-renderer-shallow.production.min.js +0 -31
  163. package/example/node_modules/react-test-renderer/umd/react-test-renderer.development.js +0 -15709
  164. package/example/node_modules/react-test-renderer/umd/react-test-renderer.production.min.js +0 -151
  165. package/example/node_modules/scheduler/LICENSE +0 -21
  166. package/example/node_modules/scheduler/README.md +0 -9
  167. package/example/node_modules/scheduler/build-info.json +0 -8
  168. package/example/node_modules/scheduler/cjs/scheduler-tracing.development.js +0 -349
  169. package/example/node_modules/scheduler/cjs/scheduler-tracing.production.min.js +0 -10
  170. package/example/node_modules/scheduler/cjs/scheduler-tracing.profiling.min.js +0 -17
  171. package/example/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +0 -857
  172. package/example/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +0 -20
  173. package/example/node_modules/scheduler/cjs/scheduler.development.js +0 -858
  174. package/example/node_modules/scheduler/cjs/scheduler.production.min.js +0 -21
  175. package/example/node_modules/scheduler/index.js +0 -7
  176. package/example/node_modules/scheduler/package.json +0 -39
  177. package/example/node_modules/scheduler/tracing-profiling.js +0 -7
  178. package/example/node_modules/scheduler/tracing.js +0 -7
  179. package/example/node_modules/scheduler/umd/scheduler-tracing.development.js +0 -80
  180. package/example/node_modules/scheduler/umd/scheduler-tracing.production.min.js +0 -80
  181. package/example/node_modules/scheduler/umd/scheduler-tracing.profiling.min.js +0 -80
  182. package/example/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +0 -857
  183. package/example/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +0 -17
  184. package/example/node_modules/scheduler/umd/scheduler.development.js +0 -152
  185. package/example/node_modules/scheduler/umd/scheduler.production.min.js +0 -146
  186. package/example/node_modules/scheduler/umd/scheduler.profiling.min.js +0 -146
  187. package/example/node_modules/scheduler/unstable_mock.js +0 -7
  188. package/example/package-lock.json +0 -110
  189. package/example/package.json +0 -24
  190. package/example/public/index.html +0 -13
  191. package/example/src/App.jsx +0 -43
  192. package/example/src/App.test.jsx +0 -11
  193. package/example/src/Image.tsx +0 -16
  194. package/example/src/__snapshots__/App.test.jsx.snap +0 -120
  195. package/example/src/apple.jpg +0 -0
  196. package/example/src/apple.svg +0 -1
  197. package/example/src/index.jsx +0 -13
  198. package/example/src/style.scss +0 -9
  199. package/example/tsconfig.json +0 -16
  200. package/openedx.yaml +0 -10
  201. package/renovate.json +0 -22
  202. package/smoke-test.sh +0 -11
@@ -1,302 +0,0 @@
1
- # prop-types [![Build Status](https://travis-ci.com/facebook/prop-types.svg?branch=main)](https://travis-ci.org/facebook/prop-types)
2
-
3
- Runtime type checking for React props and similar objects.
4
-
5
- You can use prop-types to document the intended types of properties passed to
6
- components. React (and potentially other libraries—see the `checkPropTypes()`
7
- reference below) will check props passed to your components against those
8
- definitions, and warn in development if they don’t match.
9
-
10
- ## Installation
11
-
12
- ```shell
13
- npm install --save prop-types
14
- ```
15
-
16
- ## Importing
17
-
18
- ```js
19
- import PropTypes from 'prop-types'; // ES6
20
- var PropTypes = require('prop-types'); // ES5 with npm
21
- ```
22
-
23
- ### CDN
24
-
25
- If you prefer to exclude `prop-types` from your application and use it
26
- globally via `window.PropTypes`, the `prop-types` package provides
27
- single-file distributions, which are hosted on the following CDNs:
28
-
29
- * [**unpkg**](https://unpkg.com/prop-types/)
30
- ```html
31
- <!-- development version -->
32
- <script src="https://unpkg.com/prop-types@15.6/prop-types.js"></script>
33
-
34
- <!-- production version -->
35
- <script src="https://unpkg.com/prop-types@15.6/prop-types.min.js"></script>
36
- ```
37
-
38
- * [**cdnjs**](https://cdnjs.com/libraries/prop-types)
39
- ```html
40
- <!-- development version -->
41
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.js"></script>
42
-
43
- <!-- production version -->
44
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.min.js"></script>
45
- ```
46
-
47
- To load a specific version of `prop-types` replace `15.6.0` with the version number.
48
-
49
- ## Usage
50
-
51
- PropTypes was originally exposed as part of the React core module, and is
52
- commonly used with React components.
53
- Here is an example of using PropTypes with a React component, which also
54
- documents the different validators provided:
55
-
56
- ```js
57
- import React from 'react';
58
- import PropTypes from 'prop-types';
59
-
60
- class MyComponent extends React.Component {
61
- render() {
62
- // ... do things with the props
63
- }
64
- }
65
-
66
- MyComponent.propTypes = {
67
- // You can declare that a prop is a specific JS primitive. By default, these
68
- // are all optional.
69
- optionalArray: PropTypes.array,
70
- optionalBigInt: PropTypes.bigint,
71
- optionalBool: PropTypes.bool,
72
- optionalFunc: PropTypes.func,
73
- optionalNumber: PropTypes.number,
74
- optionalObject: PropTypes.object,
75
- optionalString: PropTypes.string,
76
- optionalSymbol: PropTypes.symbol,
77
-
78
- // Anything that can be rendered: numbers, strings, elements or an array
79
- // (or fragment) containing these types.
80
- // see https://reactjs.org/docs/rendering-elements.html for more info
81
- optionalNode: PropTypes.node,
82
-
83
- // A React element (ie. <MyComponent />).
84
- optionalElement: PropTypes.element,
85
-
86
- // A React element type (eg. MyComponent).
87
- // a function, string, or "element-like" object (eg. React.Fragment, Suspense, etc.)
88
- // see https://github.com/facebook/react/blob/HEAD/packages/shared/isValidElementType.js
89
- optionalElementType: PropTypes.elementType,
90
-
91
- // You can also declare that a prop is an instance of a class. This uses
92
- // JS's instanceof operator.
93
- optionalMessage: PropTypes.instanceOf(Message),
94
-
95
- // You can ensure that your prop is limited to specific values by treating
96
- // it as an enum.
97
- optionalEnum: PropTypes.oneOf(['News', 'Photos']),
98
-
99
- // An object that could be one of many types
100
- optionalUnion: PropTypes.oneOfType([
101
- PropTypes.string,
102
- PropTypes.number,
103
- PropTypes.instanceOf(Message)
104
- ]),
105
-
106
- // An array of a certain type
107
- optionalArrayOf: PropTypes.arrayOf(PropTypes.number),
108
-
109
- // An object with property values of a certain type
110
- optionalObjectOf: PropTypes.objectOf(PropTypes.number),
111
-
112
- // You can chain any of the above with `isRequired` to make sure a warning
113
- // is shown if the prop isn't provided.
114
-
115
- // An object taking on a particular shape
116
- optionalObjectWithShape: PropTypes.shape({
117
- optionalProperty: PropTypes.string,
118
- requiredProperty: PropTypes.number.isRequired
119
- }),
120
-
121
- // An object with warnings on extra properties
122
- optionalObjectWithStrictShape: PropTypes.exact({
123
- optionalProperty: PropTypes.string,
124
- requiredProperty: PropTypes.number.isRequired
125
- }),
126
-
127
- requiredFunc: PropTypes.func.isRequired,
128
-
129
- // A value of any data type
130
- requiredAny: PropTypes.any.isRequired,
131
-
132
- // You can also specify a custom validator. It should return an Error
133
- // object if the validation fails. Don't `console.warn` or throw, as this
134
- // won't work inside `oneOfType`.
135
- customProp: function(props, propName, componentName) {
136
- if (!/matchme/.test(props[propName])) {
137
- return new Error(
138
- 'Invalid prop `' + propName + '` supplied to' +
139
- ' `' + componentName + '`. Validation failed.'
140
- );
141
- }
142
- },
143
-
144
- // You can also supply a custom validator to `arrayOf` and `objectOf`.
145
- // It should return an Error object if the validation fails. The validator
146
- // will be called for each key in the array or object. The first two
147
- // arguments of the validator are the array or object itself, and the
148
- // current item's key.
149
- customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) {
150
- if (!/matchme/.test(propValue[key])) {
151
- return new Error(
152
- 'Invalid prop `' + propFullName + '` supplied to' +
153
- ' `' + componentName + '`. Validation failed.'
154
- );
155
- }
156
- })
157
- };
158
- ```
159
-
160
- Refer to the [React documentation](https://facebook.github.io/react/docs/typechecking-with-proptypes.html) for more information.
161
-
162
- ## Migrating from React.PropTypes
163
-
164
- Check out [Migrating from React.PropTypes](https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.proptypes) for details on how to migrate to `prop-types` from `React.PropTypes`.
165
-
166
- Note that this blog posts **mentions a codemod script that performs the conversion automatically**.
167
-
168
- There are also important notes below.
169
-
170
- ## How to Depend on This Package?
171
-
172
- For apps, we recommend putting it in `dependencies` with a caret range.
173
- For example:
174
-
175
- ```js
176
- "dependencies": {
177
- "prop-types": "^15.5.7"
178
- }
179
- ```
180
-
181
- For libraries, we *also* recommend leaving it in `dependencies`:
182
-
183
- ```js
184
- "dependencies": {
185
- "prop-types": "^15.5.7"
186
- },
187
- "peerDependencies": {
188
- "react": "^15.5.0"
189
- }
190
- ```
191
-
192
- **Note:** there are known issues in versions before 15.5.7 so we recommend using it as the minimal version.
193
-
194
- Make sure that the version range uses a caret (`^`) and thus is broad enough for npm to efficiently deduplicate packages.
195
-
196
- For UMD bundles of your components, make sure you **don’t** include `PropTypes` in the build. Usually this is done by marking it as an external (the specifics depend on your bundler), just like you do with React.
197
-
198
- ## Compatibility
199
-
200
- ### React 0.14
201
-
202
- This package is compatible with **React 0.14.9**. Compared to 0.14.8 (which was released in March of 2016), there are no other changes in 0.14.9, so it should be a painless upgrade.
203
-
204
- ```shell
205
- # ATTENTION: Only run this if you still use React 0.14!
206
- npm install --save react@^0.14.9 react-dom@^0.14.9
207
- ```
208
-
209
- ### React 15+
210
-
211
- This package is compatible with **React 15.3.0** and higher.
212
-
213
- ```
214
- npm install --save react@^15.3.0 react-dom@^15.3.0
215
- ```
216
-
217
- ### What happens on other React versions?
218
-
219
- It outputs warnings with the message below even though the developer doesn’t do anything wrong. Unfortunately there is no solution for this other than updating React to either 15.3.0 or higher, or 0.14.9 if you’re using React 0.14.
220
-
221
- ## Difference from `React.PropTypes`: Don’t Call Validator Functions
222
-
223
- First of all, **which version of React are you using**? You might be seeing this message because a component library has updated to use `prop-types` package, but your version of React is incompatible with it. See the [above section](#compatibility) for more details.
224
-
225
- Are you using either React 0.14.9 or a version higher than React 15.3.0? Read on.
226
-
227
- When you migrate components to use the standalone `prop-types`, **all validator functions will start throwing an error if you call them directly**. This makes sure that nobody relies on them in production code, and it is safe to strip their implementations to optimize the bundle size.
228
-
229
- Code like this is still fine:
230
-
231
- ```js
232
- MyComponent.propTypes = {
233
- myProp: PropTypes.bool
234
- };
235
- ```
236
-
237
- However, code like this will not work with the `prop-types` package:
238
-
239
- ```js
240
- // Will not work with `prop-types` package!
241
- var errorOrNull = PropTypes.bool(42, 'myProp', 'MyComponent', 'prop');
242
- ```
243
-
244
- It will throw an error:
245
-
246
- ```
247
- Calling PropTypes validators directly is not supported by the `prop-types` package.
248
- Use PropTypes.checkPropTypes() to call them.
249
- ```
250
-
251
- (If you see **a warning** rather than an error with this message, please check the [above section about compatibility](#compatibility).)
252
-
253
- This is new behavior, and you will only encounter it when you migrate from `React.PropTypes` to the `prop-types` package. For the vast majority of components, this doesn’t matter, and if you didn’t see [this warning](https://facebook.github.io/react/warnings/dont-call-proptypes.html) in your components, your code is safe to migrate. This is not a breaking change in React because you are only opting into this change for a component by explicitly changing your imports to use `prop-types`. If you temporarily need the old behavior, you can keep using `React.PropTypes` until React 16.
254
-
255
- **If you absolutely need to trigger the validation manually**, call `PropTypes.checkPropTypes()`. Unlike the validators themselves, this function is safe to call in production, as it will be replaced by an empty function:
256
-
257
- ```js
258
- // Works with standalone PropTypes
259
- PropTypes.checkPropTypes(MyComponent.propTypes, props, 'prop', 'MyComponent');
260
- ```
261
- See below for more info.
262
-
263
- **If you DO want to use validation in production**, you can choose to use the **development version** by importing/requiring `prop-types/prop-types` instead of `prop-types`.
264
-
265
- **You might also see this error** if you’re calling a `PropTypes` validator from your own custom `PropTypes` validator. In this case, the fix is to make sure that you are passing *all* of the arguments to the inner function. There is a more in-depth explanation of how to fix it [on this page](https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes). Alternatively, you can temporarily keep using `React.PropTypes` until React 16, as it would still only warn in this case.
266
-
267
- If you use a bundler like Browserify or Webpack, don’t forget to [follow these instructions](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) to correctly bundle your application in development or production mode. Otherwise you’ll ship unnecessary code to your users.
268
-
269
- ## PropTypes.checkPropTypes
270
-
271
- React will automatically check the propTypes you set on the component, but if
272
- you are using PropTypes without React then you may want to manually call
273
- `PropTypes.checkPropTypes`, like so:
274
-
275
- ```js
276
- const myPropTypes = {
277
- name: PropTypes.string,
278
- age: PropTypes.number,
279
- // ... define your prop validations
280
- };
281
-
282
- const props = {
283
- name: 'hello', // is valid
284
- age: 'world', // not valid
285
- };
286
-
287
- // Let's say your component is called 'MyComponent'
288
-
289
- // Works with standalone PropTypes
290
- PropTypes.checkPropTypes(myPropTypes, props, 'prop', 'MyComponent');
291
- // This will warn as follows:
292
- // Warning: Failed prop type: Invalid prop `age` of type `string` supplied to
293
- // `MyComponent`, expected `number`.
294
- ```
295
-
296
- ## PropTypes.resetWarningCache()
297
-
298
- `PropTypes.checkPropTypes(...)` only `console.error`s a given message once. To reset the error warning cache in tests, call `PropTypes.resetWarningCache()`
299
-
300
- ### License
301
-
302
- prop-types is [MIT licensed](./LICENSE).
@@ -1,103 +0,0 @@
1
- /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- 'use strict';
9
-
10
- var printWarning = function() {};
11
-
12
- if (process.env.NODE_ENV !== 'production') {
13
- var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
14
- var loggedTypeFailures = {};
15
- var has = require('./lib/has');
16
-
17
- printWarning = function(text) {
18
- var message = 'Warning: ' + text;
19
- if (typeof console !== 'undefined') {
20
- console.error(message);
21
- }
22
- try {
23
- // --- Welcome to debugging React ---
24
- // This error was thrown as a convenience so that you can use this stack
25
- // to find the callsite that caused this warning to fire.
26
- throw new Error(message);
27
- } catch (x) { /**/ }
28
- };
29
- }
30
-
31
- /**
32
- * Assert that the values match with the type specs.
33
- * Error messages are memorized and will only be shown once.
34
- *
35
- * @param {object} typeSpecs Map of name to a ReactPropType
36
- * @param {object} values Runtime values that need to be type-checked
37
- * @param {string} location e.g. "prop", "context", "child context"
38
- * @param {string} componentName Name of the component for error messages.
39
- * @param {?Function} getStack Returns the component stack.
40
- * @private
41
- */
42
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
43
- if (process.env.NODE_ENV !== 'production') {
44
- for (var typeSpecName in typeSpecs) {
45
- if (has(typeSpecs, typeSpecName)) {
46
- var error;
47
- // Prop type validation may throw. In case they do, we don't want to
48
- // fail the render phase where it didn't fail before. So we log it.
49
- // After these have been cleaned up, we'll let them throw.
50
- try {
51
- // This is intentionally an invariant that gets caught. It's the same
52
- // behavior as without this statement except with a better message.
53
- if (typeof typeSpecs[typeSpecName] !== 'function') {
54
- var err = Error(
55
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
56
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
57
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
58
- );
59
- err.name = 'Invariant Violation';
60
- throw err;
61
- }
62
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
63
- } catch (ex) {
64
- error = ex;
65
- }
66
- if (error && !(error instanceof Error)) {
67
- printWarning(
68
- (componentName || 'React class') + ': type specification of ' +
69
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
70
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
71
- 'You may have forgotten to pass an argument to the type checker ' +
72
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
73
- 'shape all require an argument).'
74
- );
75
- }
76
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
77
- // Only monitor this failure once because there tends to be a lot of the
78
- // same error.
79
- loggedTypeFailures[error.message] = true;
80
-
81
- var stack = getStack ? getStack() : '';
82
-
83
- printWarning(
84
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
85
- );
86
- }
87
- }
88
- }
89
- }
90
- }
91
-
92
- /**
93
- * Resets warning cache when testing.
94
- *
95
- * @private
96
- */
97
- checkPropTypes.resetWarningCache = function() {
98
- if (process.env.NODE_ENV !== 'production') {
99
- loggedTypeFailures = {};
100
- }
101
- }
102
-
103
- module.exports = checkPropTypes;
@@ -1,19 +0,0 @@
1
- /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- 'use strict';
9
-
10
- // React 15.5 references this module, and assumes PropTypes are still callable in production.
11
- // Therefore we re-export development-only version with all the PropTypes checks here.
12
- // However if one is migrating to the `prop-types` npm library, they will go through the
13
- // `index.js` entry point, and it will branch depending on the environment.
14
- var factory = require('./factoryWithTypeCheckers');
15
- module.exports = function(isValidElement) {
16
- // It is still allowed in 15.5.
17
- var throwOnDirectAccess = false;
18
- return factory(isValidElement, throwOnDirectAccess);
19
- };
@@ -1,65 +0,0 @@
1
- /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- 'use strict';
9
-
10
- var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
11
-
12
- function emptyFunction() {}
13
- function emptyFunctionWithReset() {}
14
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
15
-
16
- module.exports = function() {
17
- function shim(props, propName, componentName, location, propFullName, secret) {
18
- if (secret === ReactPropTypesSecret) {
19
- // It is still safe when called from React.
20
- return;
21
- }
22
- var err = new Error(
23
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
24
- 'Use PropTypes.checkPropTypes() to call them. ' +
25
- 'Read more at http://fb.me/use-check-prop-types'
26
- );
27
- err.name = 'Invariant Violation';
28
- throw err;
29
- };
30
- shim.isRequired = shim;
31
- function getShim() {
32
- return shim;
33
- };
34
- // Important!
35
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
36
- var ReactPropTypes = {
37
- array: shim,
38
- bigint: shim,
39
- bool: shim,
40
- func: shim,
41
- number: shim,
42
- object: shim,
43
- string: shim,
44
- symbol: shim,
45
-
46
- any: shim,
47
- arrayOf: getShim,
48
- element: shim,
49
- elementType: shim,
50
- instanceOf: getShim,
51
- node: shim,
52
- objectOf: getShim,
53
- oneOf: getShim,
54
- oneOfType: getShim,
55
- shape: getShim,
56
- exact: getShim,
57
-
58
- checkPropTypes: emptyFunctionWithReset,
59
- resetWarningCache: emptyFunction
60
- };
61
-
62
- ReactPropTypes.PropTypes = ReactPropTypes;
63
-
64
- return ReactPropTypes;
65
- };