Enrichments
TYPE
@skmtc/core 0.63.4ModuleExport
Configuration object for module exports in the SKMTC pipeline.
This type defines the structure for describing how generated code modules should be exported and made available for import. It's used throughout the SKMTC system for organizing generated code, managing dependencies, and creating proper import/export relationships between generated files.
Usage in SKMTC Pipeline
This type is used by:
- Code generators to define export configurations
- File processors to organize generated modules
- Import managers to resolve module dependencies
- Build systems to understand code structure
Signature
import type { ModuleExport } from '@skmtc/core'Properties
exportName, string required
The name of the symbol being exported (function, class, type, etc.)
exportPath, string required
The file path where the export can be found
Examples
Basic module export definition
import type { ModuleExport } from '@skmtc/core/types';
const apiExport: ModuleExport = {
exportName: 'UserApiClient',
exportPath: './generated/api/UserApiClient.ts'
};
console.log(`Import ${apiExport.exportName} from '${apiExport.exportPath}'`);
// Import UserApiClient from './generated/api/UserApiClient.ts'Function export configuration
const functionExport: ModuleExport = {
exportName: 'validateUserData',
exportPath: './generated/validators/userValidation.ts'
};
// Used to generate: export { validateUserData } from './generated/validators/userValidation.ts'Type export configuration
const typeExport: ModuleExport = {
exportName: 'UserType',
exportPath: './generated/types/User.ts'
};
// Used to generate: export type { UserType } from './generated/types/User.ts'Multiple exports from same file
const userModuleExports: ModuleExport[] = [
{
exportName: 'User',
exportPath: './generated/models/User.ts'
},
{
exportName: 'UserValidator',
exportPath: './generated/models/User.ts'
},
{
exportName: 'createUser',
exportPath: './generated/models/User.ts'
}
];
// All exports reference the same file but different symbolsIntegration with build systems
class ModuleRegistry {
private exports: ModuleExport[] = [];
addExport(moduleExport: ModuleExport) {
this.exports.push(moduleExport);
}
generateIndexFile(): string {
return this.exports
.map(exp => `export { ${exp.exportName} } from '${exp.exportPath}';`)
.join('\n');
}
}
const registry = new ModuleRegistry();
registry.addExport({
exportName: 'ApiClient',
exportPath: './api/client.ts'
});