UNPKG

866 BJavaScriptView Raw
1/**
2 * Copyright IBM Corp. 2016, 2018
3 *
4 * This source code is licensed under the Apache-2.0 license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import warning from 'warning';
9
10/**
11 * @param {string} name The component name.
12 * @returns {Function} A stub of removed component.
13 */
14const removedComponent = name => {
15 let didWarnAboutRemoval = false;
16 const warn = () => {
17 if (__DEV__) {
18 warning(didWarnAboutRemoval, `The \`${name}\` component has been removed.`);
19 didWarnAboutRemoval = true;
20 }
21 };
22 return class {
23 constructor() {
24 warn();
25 }
26
27 static create() {
28 warn();
29 }
30
31 static init() {
32 warn();
33 }
34
35 static components /* #__PURE_CLASS_PROPERTY__ */ = new WeakMap();
36
37 static options /* #__PURE_CLASS_PROPERTY__ */ = {};
38 };
39};
40
41export default removedComponent;