@ordojs/core
Version:
Core compiler and runtime for OrdoJS framework
55 lines • 1.3 kB
JavaScript
/**
* @fileoverview OrdoJS File System Router - Route definitions and file system routing
*/
/**
* File system router for automatic route generation
*/
export class FileSystemRouter {
options;
routes = [];
constructor(options = {}) {
this.options = {
baseDir: './src/routes',
extensions: ['.ordo', '.ts', '.js'],
dynamicImports: true,
namingConvention: 'kebab-case',
...options
};
}
/**
* Scan file system for routes
*/
scanRoutes() {
// This would implement file system scanning
// For now, return empty array
return [];
}
/**
* Generate routes from component ASTs
*/
generateRoutes(components) {
return components.map(component => ({
path: `/${component.component.name.toLowerCase()}`,
componentName: component.component.name
}));
}
/**
* Get all routes
*/
getRoutes() {
return this.routes;
}
/**
* Add a route
*/
addRoute(route) {
this.routes.push(route);
}
/**
* Find route by path
*/
findRoute(path) {
return this.routes.find(route => route.path === path);
}
}
//# sourceMappingURL=fs-router.js.map