kawapress 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kawapress",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "description": "A Vue-centric static site generator",
6
6
  "license": "MIT",
7
7
  "homepage": "https://kawapress.dev/",
@@ -84,6 +84,6 @@
84
84
  "tinyglobby": "^0.2.17",
85
85
  "vite": "^8.2.2",
86
86
  "vue": "^3.5.41",
87
- "@kawapress/preset-nagi": "^0.4.0"
87
+ "@kawapress/preset-nagi": "^0.4.1"
88
88
  }
89
89
  }
@@ -2,3 +2,11 @@ import { fileURLToPath } from 'node:url'
2
2
 
3
3
  export const entryServerPath = fileURLToPath(new URL('../../client/entries/entry-server.ts', import.meta.url))
4
4
  export const entryClientPath = fileURLToPath(new URL('../../client/entries/entry-client.ts', import.meta.url))
5
+
6
+ /**
7
+ * Output directory and file name of the built server entry. The `.mjs`
8
+ * extension keeps it an ES module whatever the `type` of the site's
9
+ * `package.json` is.
10
+ */
11
+ export const SERVER_OUT_DIR = 'dist/.server'
12
+ export const SERVER_ENTRY_FILE = 'entry-server.mjs'
@@ -9,7 +9,7 @@ import {
9
9
  createBaseViteConfig,
10
10
  createSitePageLoader,
11
11
  } from '../generator/vite/config'
12
- import { entryClientPath, entryServerPath } from '../generator/vite/entries'
12
+ import { entryClientPath, entryServerPath, SERVER_ENTRY_FILE, SERVER_OUT_DIR } from '../generator/vite/entries'
13
13
  import { createPageInputs } from '../generator/vite/page-inputs'
14
14
  import {
15
15
  createBuildArtifactEmitter,
@@ -68,8 +68,11 @@ export async function buildSite(root: string) {
68
68
  ssr: {
69
69
  consumer: 'server',
70
70
  build: {
71
- outDir: 'dist/.server',
72
- rollupOptions: { input: entryServerPath },
71
+ outDir: SERVER_OUT_DIR,
72
+ rolldownOptions: {
73
+ input: entryServerPath,
74
+ output: { entryFileNames: SERVER_ENTRY_FILE },
75
+ },
73
76
  },
74
77
  },
75
78
  },
@@ -13,6 +13,7 @@ import { NOT_FOUND_ROUTE_PATH } from '../core/not-found'
13
13
  import { findUnconsumedOutletItems, formatUnconsumedOutletWarnings } from '../core/outlet'
14
14
  import { pageChunkFileName, pageChunkHash } from '../core/page-chunk'
15
15
  import { pageTableFileName } from '../core/page-manifest'
16
+ import { SERVER_ENTRY_FILE, SERVER_OUT_DIR } from '../generator/vite/entries'
16
17
  import { collectPageAssets, collectPageChunk } from './page-assets'
17
18
  import { renderHtmlTemplate } from './template'
18
19
 
@@ -34,7 +35,8 @@ interface ServerBundle {
34
35
 
35
36
  export async function prerenderPages(root: string): Promise<void> {
36
37
  const distDir = join(root, 'dist')
37
- const serverEntry = join(distDir, '.server/entry-server.js')
38
+ const serverDir = join(root, SERVER_OUT_DIR)
39
+ const serverEntry = join(serverDir, SERVER_ENTRY_FILE)
38
40
  const { render, getOutletRegistry, pages, pageModules, site } = await import(
39
41
  pathToFileURL(serverEntry).href,
40
42
  ) as ServerBundle
@@ -83,7 +85,7 @@ export async function prerenderPages(root: string): Promise<void> {
83
85
  reportUnconsumedOutlets(getOutletRegistry(), renderedOutlets)
84
86
  consola.success(`KawaPress: prerendered ${paths.length} pages`)
85
87
 
86
- await rm(join(distDir, '.server'), { recursive: true })
88
+ await rm(serverDir, { recursive: true })
87
89
  await rm(join(distDir, '.vite'), { recursive: true })
88
90
  }
89
91