| 56 | // so plugins can `require` them without needing their own version |
| 57 | // https://github.com/vercel/hyper/issues/619 |
| 58 | function patchModuleLoad() { |
| 59 | // eslint-disable-next-line @typescript-eslint/no-var-requires |
| 60 | const Module = require('module'); |
| 61 | const originalLoad = Module._load; |
| 62 | Module._load = function _load(modulePath: string) { |
| 63 | // PLEASE NOTE: Code changes here, also need to be changed in |
| 64 | // lib/utils/plugins.js |
| 65 | switch (modulePath) { |
| 66 | case 'react': |
| 67 | // DEPRECATED |
| 68 | return React; |
| 69 | case 'react-dom': |
| 70 | // DEPRECATED |
| 71 | return ReactDom; |
| 72 | case 'hyper/component': |
| 73 | // DEPRECATED |
| 74 | return React.PureComponent; |
| 75 | // These return Object, since they work differently on the backend, than on the frontend. |
| 76 | // Still needs to be here, to prevent errors, while loading plugins. |
| 77 | case 'hyper/Notification': |
| 78 | case 'hyper/notify': |
| 79 | case 'hyper/decorate': |
| 80 | return Object; |
| 81 | default: |
| 82 | // eslint-disable-next-line prefer-rest-params |
| 83 | return originalLoad.apply(this, arguments); |
| 84 | } |
| 85 | }; |
| 86 | } |
| 87 | |
| 88 | function checkDeprecatedExtendKeymaps() { |
| 89 | modules.forEach((plugin) => { |