fumapress 0.6.3 → 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/types.d.ts +1 -1
- package/dist/lib/vitefu.js +21 -5
- 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 +1 -1
- package/dist/plugins/image/vercel.client.js +1 -1
- package/package.json +12 -12
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/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 };
|
|
@@ -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/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",
|
|
@@ -60,31 +60,31 @@
|
|
|
60
60
|
"@orama/orama": "^3.1.18",
|
|
61
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.1.0",
|
|
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": "0.0
|
|
72
|
+
"@fumadocs/asyncapi": "0.1.0",
|
|
73
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": "^26.0
|
|
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.
|
|
87
|
+
"sharp": "^0.35.3",
|
|
88
88
|
"tsdown": "0.22.3",
|
|
89
89
|
"typescript": "^6.0.3",
|
|
90
90
|
"waku": "1.0.0-beta.6"
|