diff --git a/src/main.ts b/src/main.ts index 95f6082..c79402b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,3 @@ -import { useCollectionsStore } from '@/stores/collectionsStore' -import { useEntitiesStore } from '@/stores/entitiesStore' -import { useProvidersStore } from '@/stores/providersStore' -import { useServicesStore } from '@/stores/servicesStore' - /** * Chrono Manager Module Boot Script * @@ -14,5 +9,10 @@ console.log('[Chrono Manager] Booting Chrono Manager module...') console.log('[Chrono Manager] Chrono Manager module booted successfully') -// Export store for external use if needed -export { useCollectionsStore, useEntitiesStore, 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' \ No newline at end of file diff --git a/src/services/transceive.ts b/src/services/transceive.ts index 430775e..98d3f67 100644 --- a/src/services/transceive.ts +++ b/src/services/transceive.ts @@ -3,7 +3,7 @@ * Provides a centralized way to make API calls with envelope wrapping/unwrapping */ -import { createFetchWrapper } from '@KTXC/utils/helpers/fetch-wrapper-core'; +import { createFetchWrapper } from '@KTXC'; import type { ApiRequest, ApiResponse } from '../types/common'; const fetchWrapper = createFetchWrapper(); diff --git a/vite.config.ts b/vite.config.ts index 43a7d67..7e19ca5 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'), + '@ChronoManager': 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 'chrono_manager-[hash].css' + } + return '[name]-[hash][extname]' + } + } }, }, })