generate method
ServerDirectory
generate(
- covariant RevaliContext context,
- MetaServer server
)
override
Implementation
@override
ServerDirectory generate(RevaliContext context, MetaServer server) {
final serverServer = ServerServer.fromMeta(context, server)..validate();
final formatter = DartFormatter();
final emitter = DartEmitter.scoped(useNullSafetySyntax: true);
String format(Spec spec) {
return formatter.format(spec.accept(emitter).toString());
}
return ServerDirectory(
serverFile: ServerFile(
content: serverFile(serverServer, format, options: options),
parts: [
for (final route in serverServer.routes)
routeFileMaker(route, format),
reflectsFileMaker(serverServer, format),
publicFileMaker(serverServer, format),
routesFileMaker(serverServer, format),
for (final component in serverServer.lifecycleComponents)
...lifecycleComponentFilesMaker(component, format),
],
),
);
}