mirror of https://github.com/vector-im/riot-web
Step 2: Remove the decorator
parent
997d6d40bf
commit
15b84bd9a6
|
@ -13,7 +13,6 @@ module.exports = {
|
|||
"@babel/preset-react",
|
||||
],
|
||||
"plugins": [
|
||||
["@babel/plugin-proposal-decorators", {legacy: true}],
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
|
|
|
@ -125,7 +125,6 @@
|
|||
"@babel/eslint-plugin": "^7.12.10",
|
||||
"@babel/parser": "^7.12.11",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||
"@babel/plugin-proposal-decorators": "^7.12.12",
|
||||
"@babel/plugin-proposal-export-default-from": "^7.12.1",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.12.7",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
Copyright 2019 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import * as sdk from '../index';
|
||||
|
||||
/**
|
||||
* Replaces a component with a skinned version if a skinned version exists.
|
||||
* This decorator should only be applied to components which can be skinned. For
|
||||
* the react-sdk this means all components should be decorated with this.
|
||||
*
|
||||
* The decoration works by assuming the skin has been loaded prior to the
|
||||
* decorator being called. If that's not the case, the developer will find
|
||||
* out quickly through various amounts of errors and explosions.
|
||||
*
|
||||
* For a bit more detail on how this works, see docs/skinning.md
|
||||
* @param {string} name The dot-path name of the component being replaced.
|
||||
* @param {React.Component} origComponent The component that can be replaced
|
||||
* with a skinned version. If no skinned version is available, this component
|
||||
* will be used. Note that this is automatically provided to the function and
|
||||
* thus is optional for purposes of types.
|
||||
* @returns {ClassDecorator} The decorator.
|
||||
*/
|
||||
export function replaceableComponent(name: string, origComponent?: React.Component): ClassDecorator {
|
||||
// Decorators return a function to override the class (origComponent). This
|
||||
// ultimately assumes that `getComponent()` won't throw an error and instead
|
||||
// return a falsey value like `null` when the skin doesn't have a component.
|
||||
return () => sdk.getComponent(name) || origComponent;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": false,
|
||||
"emitDecoratorMetadata": false,
|
||||
"resolveJsonModule": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": false,
|
||||
"emitDecoratorMetadata": false,
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "commonjs",
|
||||
|
|
27
yarn.lock
27
yarn.lock
|
@ -132,7 +132,7 @@
|
|||
browserslist "^4.17.5"
|
||||
semver "^6.3.0"
|
||||
|
||||
"@babel/helper-create-class-features-plugin@^7.16.10", "@babel/helper-create-class-features-plugin@^7.16.7", "@babel/helper-create-class-features-plugin@^7.17.1":
|
||||
"@babel/helper-create-class-features-plugin@^7.16.10", "@babel/helper-create-class-features-plugin@^7.16.7":
|
||||
version "7.17.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.17.1.tgz#9699f14a88833a7e055ce57dcd3ffdcd25186b21"
|
||||
integrity sha512-JBdSr/LtyYIno/pNnJ75lBcqc3Z1XXujzPanHqjvvrhOA+DTceTFuJi8XjmWTZh4r3fsdfqaCMN0iZemdkxZHQ==
|
||||
|
@ -370,17 +370,6 @@
|
|||
"@babel/helper-plugin-utils" "^7.16.7"
|
||||
"@babel/plugin-syntax-class-static-block" "^7.14.5"
|
||||
|
||||
"@babel/plugin-proposal-decorators@^7.12.12":
|
||||
version "7.17.2"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.17.2.tgz#c36372ddfe0360cac1ee331a238310bddca11493"
|
||||
integrity sha512-WH8Z95CwTq/W8rFbMqb9p3hicpt4RX4f0K659ax2VHxgOyT6qQmUaEVEjIh4WR9Eh9NymkVn5vwsrE68fAQNUw==
|
||||
dependencies:
|
||||
"@babel/helper-create-class-features-plugin" "^7.17.1"
|
||||
"@babel/helper-plugin-utils" "^7.16.7"
|
||||
"@babel/helper-replace-supers" "^7.16.7"
|
||||
"@babel/plugin-syntax-decorators" "^7.17.0"
|
||||
charcodes "^0.2.0"
|
||||
|
||||
"@babel/plugin-proposal-dynamic-import@^7.16.7":
|
||||
version "7.16.7"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.7.tgz#c19c897eaa46b27634a00fee9fb7d829158704b2"
|
||||
|
@ -519,13 +508,6 @@
|
|||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.14.5"
|
||||
|
||||
"@babel/plugin-syntax-decorators@^7.17.0":
|
||||
version "7.17.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.17.0.tgz#a2be3b2c9fe7d78bd4994e790896bc411e2f166d"
|
||||
integrity sha512-qWe85yCXsvDEluNP0OyeQjH63DlhAR3W7K9BxxU1MvbDb48tgBG+Ao6IJJ6smPDrrVzSQZrbF6donpkFBMcs3A==
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.16.7"
|
||||
|
||||
"@babel/plugin-syntax-dynamic-import@^7.8.3":
|
||||
version "7.8.3"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3"
|
||||
|
@ -2850,11 +2832,6 @@ character-reference-invalid@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz#083329cda0eae272ab3dbbf37e9a382c13af1560"
|
||||
integrity sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==
|
||||
|
||||
charcodes@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/charcodes/-/charcodes-0.2.0.tgz#5208d327e6cc05f99eb80ffc814707572d1f14e4"
|
||||
integrity sha512-Y4kiDb+AM4Ecy58YkuZrrSRJBDQdQ2L+NyS1vHHFtNtUjgutcZfx3yp1dAONI/oPaPmyGfCLx5CxL+zauIMyKQ==
|
||||
|
||||
cheerio-select@^1.5.0:
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/cheerio-select/-/cheerio-select-1.5.0.tgz#faf3daeb31b17c5e1a9dabcee288aaf8aafa5823"
|
||||
|
@ -6295,7 +6272,7 @@ matrix-events-sdk@^0.0.1-beta.7:
|
|||
bs58 "^4.0.1"
|
||||
content-type "^1.0.4"
|
||||
loglevel "^1.7.1"
|
||||
matrix-events-sdk "^0.0.1-beta.7"
|
||||
matrix-events-sdk "^0.0.1-beta.6"
|
||||
p-retry "^4.5.0"
|
||||
qs "^6.9.6"
|
||||
request "^2.88.2"
|
||||
|
|
Loading…
Reference in New Issue