From ecabfadafbf2b86b2af9526b84976a41ddae044e Mon Sep 17 00:00:00 2001 From: jlenon7 Date: Wed, 15 Jan 2025 15:05:05 -0300 Subject: [PATCH] feat(build): compile ssr entrypoint --- package-lock.json | 12 ++++++------ package.json | 4 ++-- src/commands/BuildCommand.ts | 25 +++++++++++++++++++++++++ src/commands/ServeCommand.ts | 2 +- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 388158c..fee4881 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/core", - "version": "5.11.0", + "version": "5.12.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/core", - "version": "5.11.0", + "version": "5.12.0", "license": "MIT", "dependencies": { "pretty-repl": "^3.1.2", @@ -17,7 +17,7 @@ "@athenna/common": "^5.5.0", "@athenna/config": "^5.1.0", "@athenna/cron": "^5.4.0", - "@athenna/http": "^5.15.0", + "@athenna/http": "^5.22.0", "@athenna/ioc": "^5.0.0", "@athenna/logger": "^5.1.0", "@athenna/test": "^5.2.0", @@ -129,9 +129,9 @@ } }, "node_modules/@athenna/http": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/@athenna/http/-/http-5.15.0.tgz", - "integrity": "sha512-CC4OprXRjtTbaGQGqH0IGqIv/f8DrILZWuWCqrbny/fPSc8hc9jnn1VFqguwzw7Lv9h4Go2rycP/0MSqsmWaxQ==", + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/@athenna/http/-/http-5.22.0.tgz", + "integrity": "sha512-R1su2u+d9GZJoWwjVqgd8MWccQfFo7ur0kpfpzA9bu7bn9q+bbGC+ox+mRcHs4yi06TAlzKdC+9cvhG48h2XZw==", "dev": true, "engines": { "node": ">=20.0.0" diff --git a/package.json b/package.json index 05cd9ed..386bde3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "5.11.0", + "version": "5.12.0", "description": "One foundation for multiple applications.", "license": "MIT", "author": "João Lenon ", @@ -85,7 +85,7 @@ "@athenna/common": "^5.5.0", "@athenna/config": "^5.1.0", "@athenna/cron": "^5.4.0", - "@athenna/http": "^5.15.0", + "@athenna/http": "^5.22.0", "@athenna/ioc": "^5.0.0", "@athenna/logger": "^5.1.0", "@athenna/test": "^5.2.0", diff --git a/src/commands/BuildCommand.ts b/src/commands/BuildCommand.ts index 51ff0f4..0991468 100644 --- a/src/commands/BuildCommand.ts +++ b/src/commands/BuildCommand.ts @@ -72,6 +72,31 @@ export class BuildCommand extends BaseCommand { return vite.build(config) } ) + + if (Config.exists('http.vite.ssrEntrypoint')) { + tasks.addPromise( + `Compiling SSR entrypoint using ${Color.yellow.bold('vite')}`, + async () => { + const config = await this.getViteConfig(vite) + + if (!config.build) { + config.build = {} + } + + if (!config.build.rollupOptions) { + config.build.rollupOptions = {} + } + + config.build.ssr = true + config.build.outDir = Config.get('http.vite.ssrBuildDirectory') + config.build.rollupOptions.input = Config.get( + 'http.vite.ssrEntrypoint' + ) + + return vite.build(config) + } + ) + } } if (include.length) { diff --git a/src/commands/ServeCommand.ts b/src/commands/ServeCommand.ts index a318a41..de4eae6 100644 --- a/src/commands/ServeCommand.ts +++ b/src/commands/ServeCommand.ts @@ -46,7 +46,7 @@ export class ServeCommand extends BaseCommand { '.vscode', '.fleet', 'public', - '*.edge', + 'src/resources/**/*', 'vite.config.{js,ts,mjs}', 'node_modules/**/node_modules' ],