summaryrefslogtreecommitdiff
path: root/source/feature-manager.tsx
diff options
context:
space:
mode:
authorGravatar Federico Brigante <me@fregante.com> 2022-10-07 00:14:30 +0700
committerGravatar Federico Brigante <me@fregante.com> 2022-10-07 00:14:30 +0700
commitb681c734a35948991bda26760708ef57f85c902a (patch)
tree1102958093a98a3eb6021d447c7f69e98eaa3e47 /source/feature-manager.tsx
parent7d3d82c80ebd206b6c327aecd95ea5918be9e827 (diff)
parent34b273fb11130daf50421b3eecd707af57e4daac (diff)
downloadrefined-github-b681c734a35948991bda26760708ef57f85c902a.tar.gz
refined-github-b681c734a35948991bda26760708ef57f85c902a.tar.zst
refined-github-b681c734a35948991bda26760708ef57f85c902a.zip
Merge remote-tracking branch 'origin' into esbuild-2
Diffstat (limited to 'source/feature-manager.tsx')
-rw-r--r--source/feature-manager.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/feature-manager.tsx b/source/feature-manager.tsx
index 3cede3c3..9653c1b3 100644
--- a/source/feature-manager.tsx
+++ b/source/feature-manager.tsx
@@ -251,6 +251,10 @@ const add = async (url: string, ...loaders: FeatureLoader[]): Promise<void> => {
additionalListeners = [],
} = loader;
+ if (include?.length === 0) {
+ throw new Error(`${id}: \`include\` cannot be an empty array, it means "run nowhere"`);
+ }
+
// Register feature shortcuts
for (const [hotkey, description] of Object.entries(shortcuts)) {
shortcutMap.set(hotkey, description);
@@ -279,7 +283,7 @@ const add = async (url: string, ...loaders: FeatureLoader[]): Promise<void> => {
}
};
-const addCssFeature = async (url: string, include: BooleanFunction[] | undefined): Promise<void> => {
+const addCssFeature = async (url: string, include?: BooleanFunction[]): Promise<void> => {
const id = getFeatureID(url);
void add(id, {
include,