Merge pull request 'refactor: module federation' (#32) from refactor/module-federation into main
Reviewed-on: #32
This commit was merged in pull request #32.
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
"vue": "/vendor/vue.mjs",
|
"vue": "/vendor/vue.mjs",
|
||||||
"vue-router": "/vendor/vue-router.mjs",
|
"vue-router": "/vendor/vue-router.mjs",
|
||||||
"pinia": "/vendor/pinia.mjs",
|
"pinia": "/vendor/pinia.mjs",
|
||||||
"@KTXC/utils/helpers/fetch-wrapper-core": "/js/shared-utils.js"
|
"@KTXC": "/js/ktxc.mjs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
28
core/src/shared/index.ts
Normal file
28
core/src/shared/index.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* KTXC Host SDK
|
||||||
|
*
|
||||||
|
* This is the single public contract between the host application and modules.
|
||||||
|
* Modules must import from '@KTXC' (this file), never from '@KTXC/...' sub-paths.
|
||||||
|
* At runtime, '@KTXC' resolves to '/js/ktxc.mjs' via the import map.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Stores
|
||||||
|
export { useModuleStore } from '../stores/moduleStore'
|
||||||
|
export { useTenantStore } from '../stores/tenantStore'
|
||||||
|
export { useUserStore } from '../stores/userStore'
|
||||||
|
export { useIntegrationStore } from '../stores/integrationStore'
|
||||||
|
export { useLayoutStore } from '../stores/layoutStore'
|
||||||
|
|
||||||
|
// Composables
|
||||||
|
export { useUser } from '../composables/useUser'
|
||||||
|
export { useClipboard } from '../composables/useClipboard'
|
||||||
|
|
||||||
|
// Services
|
||||||
|
export { userService } from '../services/user/userService'
|
||||||
|
|
||||||
|
// Utilities
|
||||||
|
export { fetchWrapper } from '../utils/helpers/fetch-wrapper'
|
||||||
|
export { createFetchWrapper } from '../utils/helpers/fetch-wrapper-core'
|
||||||
|
|
||||||
|
// Types
|
||||||
|
export type { ModuleIntegrations } from '../types/moduleTypes'
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* Shared utilities entry point for external modules
|
|
||||||
* This file is built separately and exposed via import map
|
|
||||||
*/
|
|
||||||
|
|
||||||
export {
|
|
||||||
createFetchWrapper,
|
|
||||||
type FetchWrapperOptions,
|
|
||||||
type RequestCallOptions,
|
|
||||||
} from './fetch-wrapper-core';
|
|
||||||
@@ -72,15 +72,16 @@ export default defineConfig(({ mode }) => ({
|
|||||||
input: {
|
input: {
|
||||||
public: path.resolve(__dirname, 'core/src/public.html'),
|
public: path.resolve(__dirname, 'core/src/public.html'),
|
||||||
private: path.resolve(__dirname, 'core/src/private.html'),
|
private: path.resolve(__dirname, 'core/src/private.html'),
|
||||||
'shared-utils': path.resolve(__dirname, 'core/src/utils/helpers/shared.ts'),
|
'ktxc': path.resolve(__dirname, 'core/src/shared/index.ts'),
|
||||||
},
|
},
|
||||||
|
preserveEntrySignatures: 'exports-only',
|
||||||
output: {
|
output: {
|
||||||
// Preserve export names for shared-utils (used via import map by modules)
|
// Preserve export names for ktxc (used via import map by modules)
|
||||||
minifyInternalExports: false,
|
minifyInternalExports: false,
|
||||||
entryFileNames: (chunkInfo) => {
|
entryFileNames: (chunkInfo) => {
|
||||||
// Keep shared-utils without hash for stable import map reference
|
// Keep ktxc without hash for stable import map references
|
||||||
if (chunkInfo.name === 'shared-utils') {
|
if (chunkInfo.name === 'ktxc') {
|
||||||
return `js/[name].js`;
|
return `js/ktxc.mjs`;
|
||||||
}
|
}
|
||||||
return `js/[name]-[hash].js`;
|
return `js/[name]-[hash].js`;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user