fumapress 0.6.2 → 0.7.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/dist/components/blog.js +1 -1
- package/dist/components/image.js +1 -1
- package/dist/lib/cn.js +1 -1
- package/dist/lib/shared.js +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/vitefu.js +21 -5
- package/dist/node_modules/.pnpm/http-cache-semantics@4.2.0/node_modules/http-cache-semantics/index.js +3 -3
- package/dist/plugins/image/cloudflare.client.js +1 -1
- package/dist/plugins/image/self-hosted.client.js +1 -1
- package/dist/plugins/image/self-hosted.utils.js +2 -2
- package/dist/plugins/image/vercel.client.js +1 -1
- package/dist/plugins/llms.txt.js +9 -6
- package/dist/router/fs.js +2 -2
- package/package.json +17 -17
package/dist/components/blog.js
CHANGED
package/dist/components/image.js
CHANGED
package/dist/lib/cn.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn } from "cnfast";
|
|
2
2
|
export { cn };
|
package/dist/lib/shared.js
CHANGED
|
@@ -9,7 +9,7 @@ import { loader } from "fumadocs-core/source";
|
|
|
9
9
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
10
|
import { dynamicLoader } from "fumadocs-core/source/dynamic";
|
|
11
11
|
//#region src/lib/shared.tsx
|
|
12
|
-
var import_deepmerge = /* @__PURE__ */ __toESM(require_deepmerge());
|
|
12
|
+
var import_deepmerge = /* @__PURE__ */ __toESM(require_deepmerge(), 1);
|
|
13
13
|
const appContext = new AsyncLocalStorage({ name: "fumapress:core" });
|
|
14
14
|
function getPressContext() {
|
|
15
15
|
const store = appContext.getStore();
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -105,4 +105,4 @@ interface RouteConfig {
|
|
|
105
105
|
autoI18n?: boolean;
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
|
-
export { Adapter, AppContextData, Awaitable, PressLoaderOptions, RouteConfig, RouteFns, ServerPlugin, ServerPluginOption };
|
|
108
|
+
export { Adapter, AppContextData, Awaitable, BaseRouteFns, CreatePagesResult, PressLoaderOptions, RouteConfig, RouteFns, ServerPlugin, ServerPluginOption };
|
package/dist/lib/vitefu.js
CHANGED
|
@@ -25,12 +25,13 @@ async function crawlFrameworkPkgs(options) {
|
|
|
25
25
|
throw new Error(`Unable to read ${pkgJsonPath}`, { cause: e });
|
|
26
26
|
});
|
|
27
27
|
const optimizeDepsIncludeByPkgJsonPath = /* @__PURE__ */ new Map();
|
|
28
|
+
const optimizeDepsSubpathsByPkgJsonPath = /* @__PURE__ */ new Map();
|
|
28
29
|
let optimizeDepsInclude = [];
|
|
29
30
|
let optimizeDepsExclude = [];
|
|
30
31
|
let ssrNoExternal = [];
|
|
31
32
|
let ssrExternal = [];
|
|
32
33
|
await crawl(pkgJsonPath, pkgJson);
|
|
33
|
-
optimizeDepsInclude = [...optimizeDepsIncludeByPkgJsonPath.
|
|
34
|
+
optimizeDepsInclude = [...optimizeDepsIncludeByPkgJsonPath.entries()].flatMap(([depPkgJsonPath, chain]) => (optimizeDepsSubpathsByPkgJsonPath.get(depPkgJsonPath) ?? ["."]).map((subpath) => subpath === "." ? chain : chain + subpath.slice(1)));
|
|
34
35
|
if (options.viteUserConfig) {
|
|
35
36
|
const userOptimizeDepsExclude = options.viteUserConfig.optimizeDeps?.exclude;
|
|
36
37
|
if (userOptimizeDepsExclude) optimizeDepsInclude = optimizeDepsInclude.filter((dep) => !isDepExcluded(dep, userOptimizeDepsExclude));
|
|
@@ -78,15 +79,16 @@ async function crawlFrameworkPkgs(options) {
|
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
if (!hasFrameworkAncestor) return;
|
|
81
|
-
if (await pkgNeedsOptimization(depPkgJson, depPkgJsonPath)) addOptimizedDep(depPkgJsonPath, depChain);
|
|
82
|
+
if (await pkgNeedsOptimization(depPkgJson, depPkgJsonPath)) addOptimizedDep(depPkgJsonPath, depChain, depPkgJson);
|
|
82
83
|
else await crawl(depPkgJsonPath, depPkgJson, depChain, false, true);
|
|
83
84
|
if (!options.isBuild && parentIsFrameworkPkg) pushUnique(ssrExternal, dep);
|
|
84
85
|
}));
|
|
85
86
|
}
|
|
86
|
-
function addOptimizedDep(depPkgJsonPath, depChain) {
|
|
87
|
+
function addOptimizedDep(depPkgJsonPath, depChain, depPkgJson) {
|
|
87
88
|
const includePath = depChain.join(" > ");
|
|
88
89
|
const current = optimizeDepsIncludeByPkgJsonPath.get(depPkgJsonPath);
|
|
89
90
|
if (!current || compareDepChains(includePath, current) < 0) optimizeDepsIncludeByPkgJsonPath.set(depPkgJsonPath, includePath);
|
|
91
|
+
if (!optimizeDepsSubpathsByPkgJsonPath.has(depPkgJsonPath)) optimizeDepsSubpathsByPkgJsonPath.set(depPkgJsonPath, getExportsSubpaths(depPkgJson.exports));
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
async function findClosestPkgJsonPath(dir, predicate) {
|
|
@@ -102,7 +104,8 @@ async function findClosestPkgJsonPath(dir, predicate) {
|
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
async function pkgNeedsOptimization(pkgJson, pkgJsonPath) {
|
|
105
|
-
if (pkgJson.module || pkgJson.
|
|
107
|
+
if (pkgJson.module || pkgJson.type === "module") return false;
|
|
108
|
+
if (pkgJson.exports) return !exportsHasEsmEntry(pkgJson.exports);
|
|
106
109
|
if (pkgJson.main) {
|
|
107
110
|
const entryExt = path.extname(pkgJson.main);
|
|
108
111
|
return !entryExt || entryExt === ".js" || entryExt === ".cjs";
|
|
@@ -114,6 +117,19 @@ async function pkgNeedsOptimization(pkgJson, pkgJsonPath) {
|
|
|
114
117
|
return false;
|
|
115
118
|
}
|
|
116
119
|
}
|
|
120
|
+
function exportsHasEsmEntry(exportsField) {
|
|
121
|
+
if (typeof exportsField === "string") return exportsField.endsWith(".mjs");
|
|
122
|
+
if (Array.isArray(exportsField)) return exportsField.some(exportsHasEsmEntry);
|
|
123
|
+
if (exportsField && typeof exportsField === "object") return Object.entries(exportsField).some(([key, value]) => key === "import" || key === "module" || exportsHasEsmEntry(value));
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
function getExportsSubpaths(exportsField) {
|
|
127
|
+
if (!exportsField || typeof exportsField !== "object" || Array.isArray(exportsField)) return ["."];
|
|
128
|
+
const subpathKeys = Object.keys(exportsField).filter((key) => key.startsWith("."));
|
|
129
|
+
if (subpathKeys.length === 0) return ["."];
|
|
130
|
+
const subpaths = subpathKeys.filter((key) => key === "." || /^\.\/[^*.]+$/.test(key));
|
|
131
|
+
return subpaths.length > 0 ? subpaths : ["."];
|
|
132
|
+
}
|
|
117
133
|
async function findDepPkgJsonPath(dep, parent, usePnpWorkspaceLocators) {
|
|
118
134
|
if (pnp) {
|
|
119
135
|
if (usePnpWorkspaceLocators) try {
|
|
@@ -176,4 +192,4 @@ function isDepExternaled(dep, ssrExternal) {
|
|
|
176
192
|
return ssrExternal.some((external) => dep === external);
|
|
177
193
|
}
|
|
178
194
|
//#endregion
|
|
179
|
-
export { crawlFrameworkPkgs };
|
|
195
|
+
export { crawlFrameworkPkgs, findClosestPkgJsonPath, pkgNeedsOptimization };
|
|
@@ -16,7 +16,7 @@ var require_http_cache_semantics = /* @__PURE__ */ __commonJSMin(((exports, modu
|
|
|
16
16
|
* Set of default cacheable status codes per RFC 7231 section 6.1.
|
|
17
17
|
* @type {Set<number>}
|
|
18
18
|
*/
|
|
19
|
-
const statusCodeCacheableByDefault = new Set([
|
|
19
|
+
const statusCodeCacheableByDefault = /* @__PURE__ */ new Set([
|
|
20
20
|
200,
|
|
21
21
|
203,
|
|
22
22
|
204,
|
|
@@ -35,7 +35,7 @@ var require_http_cache_semantics = /* @__PURE__ */ __commonJSMin(((exports, modu
|
|
|
35
35
|
* Note: This implementation does not understand partial responses (206).
|
|
36
36
|
* @type {Set<number>}
|
|
37
37
|
*/
|
|
38
|
-
const understoodStatuses = new Set([
|
|
38
|
+
const understoodStatuses = /* @__PURE__ */ new Set([
|
|
39
39
|
200,
|
|
40
40
|
203,
|
|
41
41
|
204,
|
|
@@ -55,7 +55,7 @@ var require_http_cache_semantics = /* @__PURE__ */ __commonJSMin(((exports, modu
|
|
|
55
55
|
* Set of HTTP error status codes.
|
|
56
56
|
* @type {Set<number>}
|
|
57
57
|
*/
|
|
58
|
-
const errorStatusCodes = new Set([
|
|
58
|
+
const errorStatusCodes = /* @__PURE__ */ new Set([
|
|
59
59
|
500,
|
|
60
60
|
502,
|
|
61
61
|
503,
|
|
@@ -3,7 +3,7 @@ import { isFullPathname } from "../../lib/pathname.js";
|
|
|
3
3
|
import { require_http_cache_semantics } from "../../node_modules/.pnpm/http-cache-semantics@4.2.0/node_modules/http-cache-semantics/index.js";
|
|
4
4
|
//#region src/plugins/image/self-hosted.utils.ts
|
|
5
5
|
var import_http_cache_semantics = /* @__PURE__ */ __toESM(require_http_cache_semantics(), 1);
|
|
6
|
-
const SAFE_IMAGE_CONTENT_TYPES = new Set([
|
|
6
|
+
const SAFE_IMAGE_CONTENT_TYPES = /* @__PURE__ */ new Set([
|
|
7
7
|
"image/jpeg",
|
|
8
8
|
"image/png",
|
|
9
9
|
"image/gif",
|
|
@@ -267,4 +267,4 @@ function matchRemotePattern(pattern, url) {
|
|
|
267
267
|
return true;
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
|
-
export { ImageOptimizationCache, createImageOptimizer, resolveImageConfig, validateImageSrc };
|
|
270
|
+
export { ImageOptimizationCache, createImageOptimizer, getOptimizeCacheKey, parseImageParams, readResponseBodyWithLimit, resolveImageConfig, validateImageSrc };
|
package/dist/plugins/llms.txt.js
CHANGED
|
@@ -27,16 +27,19 @@ function llmsPlugin(options = {}) {
|
|
|
27
27
|
pathname: joinPathname(lang ?? "", basePath, ...segments)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
function initRenderers(data) {
|
|
31
|
+
data.renderers ??= [];
|
|
32
|
+
data.renderers.push(function(res) {
|
|
33
|
+
res.markdownUrl ??= slugsToMarkdownPath(this.page.slugs, this.page.locale).pathname;
|
|
34
|
+
return res;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
30
37
|
return {
|
|
31
38
|
name: "core:llms.txt",
|
|
32
39
|
init() {
|
|
33
40
|
if (this.mode === "dynamic") basePath = "/_llms.txt";
|
|
34
|
-
this.data["core:docs-layout"] ??= {};
|
|
35
|
-
this.data["core:
|
|
36
|
-
this.data["core:docs-layout"].renderers.push(function(res) {
|
|
37
|
-
res.markdownUrl ??= slugsToMarkdownPath(this.page.slugs, this.page.locale).pathname;
|
|
38
|
-
return res;
|
|
39
|
-
});
|
|
41
|
+
initRenderers(this.data["core:docs-layout"] ??= {});
|
|
42
|
+
initRenderers(this.data["core:notebook-layout"] ??= {});
|
|
40
43
|
},
|
|
41
44
|
createMiddlewares({ app }) {
|
|
42
45
|
if (this.mode === "static") return;
|
package/dist/router/fs.js
CHANGED
|
@@ -10,8 +10,8 @@ const Methods = [
|
|
|
10
10
|
"OPTIONS"
|
|
11
11
|
];
|
|
12
12
|
const ValidMethods = new Set(Methods);
|
|
13
|
-
const IGNORED_PATH_PARTS = new Set(["_components", "_hooks"]);
|
|
14
|
-
const SPECIAL_BASENAME = new Set([
|
|
13
|
+
const IGNORED_PATH_PARTS = /* @__PURE__ */ new Set(["_components", "_hooks"]);
|
|
14
|
+
const SPECIAL_BASENAME = /* @__PURE__ */ new Set([
|
|
15
15
|
"_layout",
|
|
16
16
|
"index",
|
|
17
17
|
"_root"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumapress",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "An opinionated docs framework powered by Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -58,36 +58,36 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@fuma-translate/react": "^1.0.2",
|
|
60
60
|
"@orama/orama": "^3.1.18",
|
|
61
|
-
"@takumi-rs/image-response": "^1.8.
|
|
61
|
+
"@takumi-rs/image-response": "^1.8.7",
|
|
62
62
|
"class-variance-authority": "^0.7.1",
|
|
63
|
+
"cnfast": "^0.0.8",
|
|
63
64
|
"flexsearch": "^0.8.212",
|
|
64
|
-
"lucide-react": "^1.
|
|
65
|
-
"
|
|
66
|
-
"vite": "^8.0.16",
|
|
65
|
+
"lucide-react": "^1.23.0",
|
|
66
|
+
"vite": "^8.1.3",
|
|
67
67
|
"xml-js": "^1.6.11",
|
|
68
68
|
"zod": "^4.4.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@fastify/deepmerge": "^3.2.1",
|
|
72
|
-
"@fumadocs/asyncapi": "
|
|
73
|
-
"@tailwindcss/oxide": "^4.3.
|
|
72
|
+
"@fumadocs/asyncapi": "0.1.0",
|
|
73
|
+
"@tailwindcss/oxide": "^4.3.2",
|
|
74
74
|
"@types/http-cache-semantics": "^4.2.0",
|
|
75
75
|
"@types/mdx": "^2.0.14",
|
|
76
|
-
"@types/node": "^
|
|
76
|
+
"@types/node": "^26.1.0",
|
|
77
77
|
"@types/react": "^19.2.17",
|
|
78
78
|
"@types/react-dom": "^19.2.3",
|
|
79
|
-
"fumadocs-core": "^16.
|
|
80
|
-
"fumadocs-mdx": "^15.0
|
|
81
|
-
"fumadocs-openapi": "^11.0
|
|
82
|
-
"fumadocs-ui": "
|
|
83
|
-
"hono": "^4.12.
|
|
79
|
+
"fumadocs-core": "^16.11.0",
|
|
80
|
+
"fumadocs-mdx": "^15.1.0",
|
|
81
|
+
"fumadocs-openapi": "^11.1.0",
|
|
82
|
+
"fumadocs-ui": "npm:@fumadocs/base-ui@^16.11.0",
|
|
83
|
+
"hono": "^4.12.28",
|
|
84
84
|
"http-cache-semantics": "^4.2.0",
|
|
85
85
|
"react": "^19.2.7",
|
|
86
86
|
"react-dom": "^19.2.7",
|
|
87
|
-
"sharp": "^0.35.
|
|
88
|
-
"tsdown": "0.22.
|
|
87
|
+
"sharp": "^0.35.3",
|
|
88
|
+
"tsdown": "0.22.3",
|
|
89
89
|
"typescript": "^6.0.3",
|
|
90
|
-
"waku": "1.0.0-beta.
|
|
90
|
+
"waku": "1.0.0-beta.6"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@fumadocs/asyncapi": "0.x.x",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"react": "^19.2.0",
|
|
102
102
|
"react-dom": "^19.2.0",
|
|
103
103
|
"sharp": "^0.34.0",
|
|
104
|
-
"waku": "1.0.0-beta.
|
|
104
|
+
"waku": "1.0.0-beta.6"
|
|
105
105
|
},
|
|
106
106
|
"peerDependenciesMeta": {
|
|
107
107
|
"@fumadocs/asyncapi": {
|