mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-13 10:42:16 +01:00
add support for extension vite plugin loading, add vue setup hook for extensions
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
async function collectModuleAssetsPaths(paths, modulesPath) {
|
||||
async function collectModuleAssetsPaths(modulesPath) {
|
||||
return await getExportedModulesArrayAttributes(modulesPath, 'paths');
|
||||
}
|
||||
|
||||
async function collectModulePlugins(modulesPath) {
|
||||
return await getExportedModulesArrayAttributes(modulesPath, 'plugins');
|
||||
}
|
||||
|
||||
async function getExportedModulesArrayAttributes(modulesPath, attribute) {
|
||||
const result = [];
|
||||
modulesPath = path.join(__dirname, modulesPath);
|
||||
|
||||
const moduleStatusesPath = path.join(__dirname, 'modules_statuses.json');
|
||||
@@ -37,10 +46,10 @@ async function collectModuleAssetsPaths(paths, modulesPath) {
|
||||
const moduleConfig = await import(viteConfigPath);
|
||||
|
||||
if (
|
||||
moduleConfig.paths &&
|
||||
Array.isArray(moduleConfig.paths)
|
||||
moduleConfig[attribute] &&
|
||||
Array.isArray(moduleConfig[attribute])
|
||||
) {
|
||||
paths.push(...moduleConfig.paths);
|
||||
result.push(...moduleConfig[attribute]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,7 +60,7 @@ async function collectModuleAssetsPaths(paths, modulesPath) {
|
||||
);
|
||||
}
|
||||
|
||||
return paths;
|
||||
return result;
|
||||
}
|
||||
|
||||
export default collectModuleAssetsPaths;
|
||||
export { collectModuleAssetsPaths, collectModulePlugins };
|
||||
|
||||
Reference in New Issue
Block a user