File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ import checker from "vite-plugin-checker";
5
5
import fs from "fs" ;
6
6
import { join , resolve } from "path" ;
7
7
8
- function findInstalledPlugins ( namespace ) {
9
- const modulesDir = join ( __dirname , "node_modules" , namespace ) ;
8
+ function findInstalledPlugins ( ) {
9
+ const modulesDir = join ( __dirname , "node_modules" , "@mwdb-web" ) ;
10
+ const packageDirPattern = / ^ p l u g i n - [ a - z A - Z 0 - 9 \- _ ] + $ / g;
11
+
10
12
if ( ! fs . existsSync ( modulesDir ) ) return [ ] ;
11
- return fs . readdirSync ( modulesDir ) ;
13
+ return fs . readdirSync ( modulesDir ) . filter ( dir => dir . match ( packageDirPattern ) ) ;
12
14
}
13
15
14
16
function pluginLoader ( ) {
@@ -34,7 +36,7 @@ function pluginLoader() {
34
36
} ,
35
37
load ( id ) {
36
38
if ( id === resolvedVirtualModuleId ) {
37
- const plugins = findInstalledPlugins ( "@mwdb-web" ) ;
39
+ const plugins = findInstalledPlugins ( ) ;
38
40
const exports = plugins
39
41
. map (
40
42
( pluginName , index ) =>
You can’t perform that action at this time.
0 commit comments