@lupinum/ginko-content 0.1.3 → 0.1.4
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/compatibility.json +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +6 -22
- package/dist/runtime/server/agent-markdown.js +1 -1
- package/dist/runtime/server/agent-site.js +0 -1
- package/dist/runtime/server/middleware/agent-link-headers.js +2 -3
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
package/compatibility.json
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,8 +3,6 @@ import { defu } from 'defu';
|
|
|
3
3
|
import fs, { existsSync } from 'fs';
|
|
4
4
|
import { join, relative, resolve, isAbsolute } from 'pathe';
|
|
5
5
|
import jiti from 'jiti';
|
|
6
|
-
import { createRequire } from 'node:module';
|
|
7
|
-
import { pathToFileURL } from 'node:url';
|
|
8
6
|
import { genSafeVariableName, genImport } from 'knitwork';
|
|
9
7
|
import { hash } from 'ohash';
|
|
10
8
|
import 'unstorage/drivers/fs';
|
|
@@ -25,13 +23,14 @@ import { resolveCollectionI18n, prefixPathWithLocale } from '../dist/features/lo
|
|
|
25
23
|
import { resolveContentSitemapSource, GINKO_SITEMAP_SOURCE_NAME } from '../dist/runtime/utils/sitemap-source';
|
|
26
24
|
import { normalizeRouteMounts, normalizeContentPath } from '../dist/core/content/path';
|
|
27
25
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
26
|
+
import { pathToFileURL } from 'node:url';
|
|
28
27
|
import { withTrailingSlash } from 'ufo';
|
|
29
28
|
import { normalizeContentConfigCollectionNames } from '../dist/types/config';
|
|
30
29
|
export { agentMetadataFields, defineAgentAppPage, defineAgentMarkdownPolicy, defineAgentMetadataFields, defineAgentSection, defineCollection, defineContentConfig, reference } from '../dist/types/config';
|
|
31
30
|
import { collectTopLevelReferenceFieldsByTarget } from '../dist/core/references/schema';
|
|
32
31
|
|
|
33
32
|
const name = "@lupinum/ginko-content";
|
|
34
|
-
const version = "0.1.
|
|
33
|
+
const version = "0.1.4";
|
|
35
34
|
|
|
36
35
|
const CONFIG_FILES = [
|
|
37
36
|
"content.config.ts",
|
|
@@ -53,8 +52,6 @@ async function loadContentConfig(nuxt) {
|
|
|
53
52
|
return loaded?.default || loaded || {};
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
const require$1 = createRequire(import.meta.url);
|
|
57
|
-
const jitiImportSpecifier = pathToFileURL(require$1.resolve("jiti")).href;
|
|
58
55
|
const createVirtualContentTemplates = (contentContext, nuxt, contentConfigPath, addTemplateImpl) => {
|
|
59
56
|
const transformersTemplate = addTemplateImpl({
|
|
60
57
|
filename: "content/virtual-transformers.mjs",
|
|
@@ -77,10 +74,8 @@ const createVirtualContentTemplates = (contentContext, nuxt, contentConfigPath,
|
|
|
77
74
|
filename: "content/virtual-config.mjs",
|
|
78
75
|
write: true,
|
|
79
76
|
getContents: () => contentConfigPath ? [
|
|
80
|
-
`import
|
|
81
|
-
|
|
82
|
-
`const config = await importer.import(${JSON.stringify(contentConfigPath)})`,
|
|
83
|
-
"export default config?.default || config || {}"
|
|
77
|
+
`import config from ${JSON.stringify(contentConfigPath)}`,
|
|
78
|
+
"export default config || {}"
|
|
84
79
|
].join("\n") : "export default {}"
|
|
85
80
|
}).dst;
|
|
86
81
|
const virtualProvidersTemplate = addTemplateImpl({
|
|
@@ -1314,11 +1309,6 @@ const collectRawMarkdownRoutesFromGeneratedFrontmatter = (markdown) => {
|
|
|
1314
1309
|
return Array.from(links);
|
|
1315
1310
|
};
|
|
1316
1311
|
const publicOutputPath = (publicDir, route) => join(publicDir, normalizeStaticRoutePath(route).replace(/^\//, ""));
|
|
1317
|
-
const rawMarkdownIndexRouteForRawRoute = (route) => {
|
|
1318
|
-
if (!route.startsWith("/raw/") || !route.endsWith(".md")) return null;
|
|
1319
|
-
const pageRoute = route.replace(/^\/raw/, "").replace(/\.md$/, "");
|
|
1320
|
-
return pageRoute === "/index" ? "/index.md" : `${pageRoute}/index.md`;
|
|
1321
|
-
};
|
|
1322
1312
|
|
|
1323
1313
|
const hookNuxtBoundary$2 = (nuxt, name, callback) => {
|
|
1324
1314
|
const hook = nuxt.hook;
|
|
@@ -1391,12 +1381,6 @@ const registerStaticOutputGeneration = ({
|
|
|
1391
1381
|
const outputPath = publicOutputPath(publicDir, route);
|
|
1392
1382
|
mkdirSync(dirname(outputPath), { recursive: true });
|
|
1393
1383
|
writeFileSync(outputPath, body, "utf8");
|
|
1394
|
-
const indexRoute = rawMarkdownIndexRouteForRawRoute(route);
|
|
1395
|
-
if (indexRoute) {
|
|
1396
|
-
const indexPath = publicOutputPath(publicDir, indexRoute);
|
|
1397
|
-
mkdirSync(dirname(indexPath), { recursive: true });
|
|
1398
|
-
writeFileSync(indexPath, body, "utf8");
|
|
1399
|
-
}
|
|
1400
1384
|
}
|
|
1401
1385
|
}
|
|
1402
1386
|
});
|
|
@@ -1499,8 +1483,7 @@ const registerContentNitroConfig = ({
|
|
|
1499
1483
|
for (const route of routes) {
|
|
1500
1484
|
const normalized = route === "/" ? "/" : `/${route.replace(/^\/+|\/+$/g, "")}`;
|
|
1501
1485
|
nitroConfig.prerender.routes.push(
|
|
1502
|
-
normalized === "/" ? "/raw/index.md" : `/raw${normalized}.md
|
|
1503
|
-
normalized === "/" ? "/index.md" : `${normalized}/index.md`
|
|
1486
|
+
normalized === "/" ? "/raw/index.md" : `/raw${normalized}.md`
|
|
1504
1487
|
);
|
|
1505
1488
|
}
|
|
1506
1489
|
}
|
|
@@ -1806,6 +1789,7 @@ const module$1 = defineNuxtModule({
|
|
|
1806
1789
|
const resolveRuntimeModule = (path) => resolve("./runtime", path);
|
|
1807
1790
|
const runtimeInlineDependencies = ["comark", "@comark/vue"];
|
|
1808
1791
|
validateRemovedMarkdownOptions(options);
|
|
1792
|
+
nuxt.options.experimental.payloadExtraction ??= false;
|
|
1809
1793
|
nuxt.options.build.transpile ||= [];
|
|
1810
1794
|
for (const dependency of runtimeInlineDependencies) {
|
|
1811
1795
|
if (!nuxt.options.build.transpile.includes(dependency)) {
|
|
@@ -24,7 +24,7 @@ const routeMarkdownPathForHref = (href, locale, currentPath = "/") => {
|
|
|
24
24
|
if (isExternalHref(withoutHash)) return href;
|
|
25
25
|
if (withoutHash.endsWith(".md")) return href;
|
|
26
26
|
const target = withoutHash.startsWith("/") ? prefixLocalizedHref(withoutHash, locale) : new URL(withoutHash, `https://agent.local${normalizeAgentRoutePath(currentPath)}`).pathname;
|
|
27
|
-
return `${
|
|
27
|
+
return `${agentRawPathForRoute(target)}${hash}`;
|
|
28
28
|
};
|
|
29
29
|
export const getMarkdownProp = (node, name) => {
|
|
30
30
|
const props = isRecord(node.props) ? node.props : {};
|
|
@@ -263,7 +263,6 @@ export const collectAgentMarkdownPrerenderRoutes = async (event) => {
|
|
|
263
263
|
const pages = await buildAgentPageIndex(event, locale);
|
|
264
264
|
for (const page of pages) {
|
|
265
265
|
routes.add(page.rawPath);
|
|
266
|
-
routes.add(page.markdownPath);
|
|
267
266
|
}
|
|
268
267
|
const prefix = locale === defaultLocale() ? "" : `/${locale}`;
|
|
269
268
|
routes.add(prefix ? `${prefix}/llms.txt` : "/llms.txt");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineEventHandler, getRequestURL, setHeader } from "h3";
|
|
2
2
|
import { getAgentLocales, localeFromAgentPath, resolveMarkdownForPublicRoute } from "../agent-site.js";
|
|
3
|
-
import {
|
|
3
|
+
import { agentRawPathForRoute, normalizeAgentRoutePath } from "../../agent-paths.js";
|
|
4
4
|
import { appendResponseHeader } from "../agent-http.js";
|
|
5
5
|
import { contentConfig } from "../storage-access.js";
|
|
6
6
|
const shouldAdvertise = (pathname) => !pathname.startsWith("/_") && !pathname.startsWith("/api/") && !pathname.endsWith(".css") && !pathname.endsWith(".js") && !pathname.endsWith(".png") && !pathname.endsWith(".jpg") && !pathname.endsWith(".jpeg") && !pathname.endsWith(".webp") && !pathname.endsWith(".svg") && !pathname.endsWith(".ico");
|
|
@@ -26,8 +26,7 @@ export default defineEventHandler(async (event) => {
|
|
|
26
26
|
const page = canAdvertisePageAlternate(pathname) ? await resolveMarkdownForPublicRoute(event, pathname, locale) : null;
|
|
27
27
|
const pagePath = normalizeAgentRoutePath(pathname);
|
|
28
28
|
const pageLinks = page ? [
|
|
29
|
-
`<${agentRawPathForRoute(pagePath)}>; rel="alternate"; type="text/markdown"
|
|
30
|
-
`<${agentMarkdownPathForRoute(pagePath)}>; rel="alternate"; type="text/markdown"`
|
|
29
|
+
`<${agentRawPathForRoute(pagePath)}>; rel="alternate"; type="text/markdown"`
|
|
31
30
|
] : [];
|
|
32
31
|
appendResponseHeader(
|
|
33
32
|
event,
|
package/dist/web-types.json
CHANGED