kawapress 0.4.1 → 0.5.0
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
|
+
"version": "0.5.0",
|
|
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.
|
|
87
|
+
"@kawapress/preset-nagi": "^0.5.0"
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -68,7 +68,7 @@ function summarizeMarkdown(md: MarkdownExit, source: string): PageSummary {
|
|
|
68
68
|
frontmatter,
|
|
69
69
|
heading === undefined ? [] : [{ level: 1, title: heading }],
|
|
70
70
|
)
|
|
71
|
-
const layout = typeof frontmatter.layout === 'string'
|
|
71
|
+
const layout = typeof frontmatter.layout === 'string' || frontmatter.layout === false
|
|
72
72
|
? frontmatter.layout
|
|
73
73
|
: undefined
|
|
74
74
|
|
|
@@ -14,8 +14,8 @@ export interface PageModule {
|
|
|
14
14
|
*/
|
|
15
15
|
export interface PageSummary {
|
|
16
16
|
title: string
|
|
17
|
-
/** `frontmatter.layout` when it is a string
|
|
18
|
-
layout?: string
|
|
17
|
+
/** `frontmatter.layout` when it is a string or `false`. */
|
|
18
|
+
layout?: string | false
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -81,6 +81,11 @@ export function createBaseViteConfig(
|
|
|
81
81
|
// `index.html` to scan, so every dependency would be discovered after the
|
|
82
82
|
// first page request and force a full reload. See useRuntimeDependencies().
|
|
83
83
|
optimizeDeps: {
|
|
84
|
+
// The browser entry reaches KawaPress through relative imports. A
|
|
85
|
+
// pre-bundled copy of `kawapress/client` would bring a second router and
|
|
86
|
+
// site injection key, and every component importing it from a site or a
|
|
87
|
+
// plugin would fail to find the app.
|
|
88
|
+
exclude: [KAWAPRESS_PACKAGE_NAME],
|
|
84
89
|
include: [
|
|
85
90
|
VUE_DEPENDENCY,
|
|
86
91
|
...runtimeDependencySpecifiers(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'vite'
|
|
2
|
-
import { readFile } from 'node:fs/promises'
|
|
2
|
+
import { readFile, realpath } from 'node:fs/promises'
|
|
3
3
|
import { findPackageJSON } from 'node:module'
|
|
4
4
|
import { dirname, join } from 'node:path'
|
|
5
5
|
import process from 'node:process'
|
|
@@ -83,7 +83,7 @@ async function resolvePluginPackages(
|
|
|
83
83
|
const searchRoots = [root]
|
|
84
84
|
const corePackagePath = findPluginPackage('kawapress', searchRoots)
|
|
85
85
|
if (corePackagePath) {
|
|
86
|
-
searchRoots.push(
|
|
86
|
+
searchRoots.push(await packageDirectory(corePackagePath))
|
|
87
87
|
}
|
|
88
88
|
let foundPackage = true
|
|
89
89
|
|
|
@@ -104,7 +104,7 @@ async function resolvePluginPackages(
|
|
|
104
104
|
packagePath,
|
|
105
105
|
exports: packageJson.exports,
|
|
106
106
|
})
|
|
107
|
-
searchRoots.push(
|
|
107
|
+
searchRoots.push(await packageDirectory(packagePath))
|
|
108
108
|
unresolved.delete(pluginName)
|
|
109
109
|
foundPackage = true
|
|
110
110
|
}
|
|
@@ -113,6 +113,15 @@ async function resolvePluginPackages(
|
|
|
113
113
|
return packages
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Directory a package really lives in. pnpm links a dependency into the site's
|
|
118
|
+
* `node_modules`, and only the real directory has the package's own
|
|
119
|
+
* dependencies next to it, such as the preset a plugin package belongs to.
|
|
120
|
+
*/
|
|
121
|
+
async function packageDirectory(packagePath: string): Promise<string> {
|
|
122
|
+
return dirname(await realpath(packagePath))
|
|
123
|
+
}
|
|
124
|
+
|
|
116
125
|
function findPluginPackage(
|
|
117
126
|
pluginName: string,
|
|
118
127
|
searchRoots: string[],
|