diff --git a/src/main.ts b/src/main.ts index 3fa5e7b..848c011 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,3 @@ -import { useNodesStore } from '@/stores/nodesStore' -import { useProvidersStore } from '@/stores/providersStore' -import { useServicesStore } from '@/stores/servicesStore' - /** * File Manager Module Boot Script * @@ -13,5 +9,10 @@ console.log('[FileManager] Booting File Manager module...') console.log('[FileManager] File Manager module booted successfully') -// Export stores for external use if needed -export { useNodesStore, useProvidersStore, useServicesStore } +// CSS will be injected by build process +//export const css = ['__CSS_FILENAME_PLACEHOLDER__'] + +// Export services, stores and models for external use +export * from '@/services' +export * from '@/stores' +export * from '@/models' diff --git a/src/services/api.ts b/src/services/api.ts index fcf60f0..6fcaf19 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -3,7 +3,7 @@ * Central service for making API calls to the file manager backend */ -import { createFetchWrapper } from '@KTXC/utils/helpers/fetch-wrapper-core'; +import { createFetchWrapper } from '@KTXC'; const fetchWrapper = createFetchWrapper(); diff --git a/src/stores/index.ts b/src/stores/index.ts new file mode 100644 index 0000000..373c9ad --- /dev/null +++ b/src/stores/index.ts @@ -0,0 +1,3 @@ +export { useProvidersStore } from './providersStore'; +export { useServicesStore } from './servicesStore'; +export { useNodesStore, ROOT_ID } from './nodesStore'; \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 43a7d67..bac306c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,16 +1,38 @@ import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' import path from 'path' // https://vite.dev/config/ export default defineConfig({ + plugins: [ + vue(), + { + name: 'inject-css-filename', + enforce: 'post', + generateBundle(_options, bundle) { + const cssFile = Object.keys(bundle).find(name => name.endsWith('.css')) + if (!cssFile) return + + for (const fileName of Object.keys(bundle)) { + const chunk = bundle[fileName] + if (chunk.type === 'chunk' && chunk.code.includes('__CSS_FILENAME_PLACEHOLDER__')) { + chunk.code = chunk.code.replace(/__CSS_FILENAME_PLACEHOLDER__/g, `static/${cssFile}`) + console.log(`Injected CSS filename "static/${cssFile}" into ${fileName}`) + } + } + } + } + ], resolve: { alias: { '@': path.resolve(__dirname, './src'), - '@KTXC': path.resolve(__dirname, '../../core/src') + '@KTXC': path.resolve(__dirname, '../../core/src'), + '@FilesManager': path.resolve(__dirname, './src') }, }, build: { outDir: 'static', + emptyOutDir: true, sourcemap: true, lib: { entry: path.resolve(__dirname, 'src/main.ts'), @@ -19,12 +41,23 @@ export default defineConfig({ }, rollupOptions: { external: [ - 'pinia', 'vue', 'vue-router', - // Externalize shared utilities from core to avoid duplication - /^@KTXC\/utils\//, + 'pinia', + '@KTXC', ], + output: { + paths: (id) => { + if (id === '@KTXC') return '/js/ktxc.mjs' + return id + }, + assetFileNames: (assetInfo) => { + if (assetInfo.name?.endsWith('.css')) { + return 'file_manager-[hash].css' + } + return '[name]-[hash][extname]' + } + } }, }, })