nuxt-llms 0.1.0 → 0.1.2
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/README.md +11 -11
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -3
- package/dist/runtime/server/routes/{llms_full.txt.get.js → llms-full.txt.get.js} +1 -1
- package/dist/runtime/server/routes/llms.txt.get.js +2 -2
- package/dist/runtime/server/utils/hooks.js +5 -1
- package/package.json +11 -11
- /package/dist/runtime/server/routes/{llms_full.txt.get.d.ts → llms-full.txt.get.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Nuxt LLMs automatically generates [`llms.txt` markdown documentation](https://ll
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
18
|
- Generates & prerenders `/llms.txt` automatically
|
|
19
|
-
- Generate & prerenders `/
|
|
19
|
+
- Generate & prerenders `/llms-full.txt` when enabled
|
|
20
20
|
- Customizable sections directly from your `nuxt.config.ts`
|
|
21
21
|
- Integrates with Nuxt modules and your application via the runtime hooks system
|
|
22
22
|
|
|
@@ -84,9 +84,9 @@ That's it! You can visit `/llms.txt` to see the generated documentation ✨
|
|
|
84
84
|
- `description`: The description of the link
|
|
85
85
|
- `href`(required): The href of the link
|
|
86
86
|
- `notes`: The notes of the documentation. Notes are a special section which always appears at the end of the documentation. Notes are useful to add any information about the application or documentation itself.
|
|
87
|
-
- `full`: The `
|
|
88
|
-
- `title`: The title of the
|
|
89
|
-
- `description`: The description of the
|
|
87
|
+
- `full`: The `llms-full.txt` configuration. Setting this option will enable the `llms-full.txt` route.
|
|
88
|
+
- `title`: The title of the llms-full documentation
|
|
89
|
+
- `description`: The description of the llms-full documentation
|
|
90
90
|
|
|
91
91
|
## Documentation Formats
|
|
92
92
|
|
|
@@ -101,11 +101,11 @@ The `/llms.txt` route generates a concise, structured documentation that follows
|
|
|
101
101
|
- Links with titles, descriptions, and URLs
|
|
102
102
|
- Optional notes section
|
|
103
103
|
|
|
104
|
-
###
|
|
104
|
+
### llms-full.txt
|
|
105
105
|
|
|
106
|
-
The `/
|
|
106
|
+
The `/llms-full.txt` route provides a more detailed, free-form documentation format. This is useful to reduce crawler traffic on your application and provide a more detailed documentation to your users and LLMs.
|
|
107
107
|
|
|
108
|
-
By default module does not generate the `
|
|
108
|
+
By default module does not generate the `llms-full.txt` route, you need to enable it by setting `full.title` and `full.description` in your `nuxt.config.ts`.
|
|
109
109
|
|
|
110
110
|
```ts
|
|
111
111
|
export default defineNuxtConfig({
|
|
@@ -135,9 +135,9 @@ This hook is called for every request to `/llms.txt`. Use this hook to modify th
|
|
|
135
135
|
- `options`: ModuleOptions - The module options that you can modify to add sections, links, etc.
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
#### `llms:generate:
|
|
138
|
+
#### `llms:generate:llms-full(event, options, contents)`
|
|
139
139
|
|
|
140
|
-
This hook is called for every request to `/
|
|
140
|
+
This hook is called for every request to `/llms-full.txt`. It allows you to add custom content sections in any format.
|
|
141
141
|
|
|
142
142
|
**Parameters:**
|
|
143
143
|
- `event`: H3Event - The current request event
|
|
@@ -169,7 +169,7 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
169
169
|
|
|
170
170
|
// Method 2: Using the helper function
|
|
171
171
|
nitroApp.hooks.hook('llms:generate:full', (event, options, contents) => {
|
|
172
|
-
// Add detailed documentation to
|
|
172
|
+
// Add detailed documentation to llms-full.txt
|
|
173
173
|
contents.push(`## API Authentication
|
|
174
174
|
|
|
175
175
|
### Bearer Token
|
|
@@ -225,7 +225,7 @@ export default defineNuxtModule({
|
|
|
225
225
|
|
|
226
226
|
### Nuxt Content
|
|
227
227
|
|
|
228
|
-
Nuxt Content ^3.2.0 comes with built-in support for LLMs documentation. You can use `nuxt-llms` with `@nuxt/content` to efficiently write content and documentation for your website and generate LLM-friendly documentation without extra effort. Content module uses `nuxt-llms` hooks and automatically adds all your contents into `llms.txt` and `
|
|
228
|
+
Nuxt Content ^3.2.0 comes with built-in support for LLMs documentation. You can use `nuxt-llms` with `@nuxt/content` to efficiently write content and documentation for your website and generate LLM-friendly documentation without extra effort. Content module uses `nuxt-llms` hooks and automatically adds all your contents into `llms.txt` and `llms-full.txt` documentation.
|
|
229
229
|
|
|
230
230
|
All you need is to install both modules and write your content files in the `content` directory.
|
|
231
231
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -30,12 +30,12 @@ const module = defineNuxtModule({
|
|
|
30
30
|
{
|
|
31
31
|
title: options.full.title,
|
|
32
32
|
description: options.full.description,
|
|
33
|
-
href: `${options.domain}/
|
|
33
|
+
href: `${options.domain}/llms-full.txt`
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
});
|
|
37
|
-
addServerHandler({ route: "/
|
|
38
|
-
addPrerenderRoutes("/
|
|
37
|
+
addServerHandler({ route: "/llms-full.txt", handler: resolve("./runtime/server/routes/llms-full.txt.get") });
|
|
38
|
+
addPrerenderRoutes("/llms-full.txt");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -7,6 +7,6 @@ export default eventHandler(async (event) => {
|
|
|
7
7
|
const llms = JSON.parse(JSON.stringify(options));
|
|
8
8
|
await useNitroApp().hooks.callHook("llms:generate:full", event, llms, contents);
|
|
9
9
|
await llmsHooks.callHook("generate:full", event, llms, contents);
|
|
10
|
-
setHeader(event, "Content-Type", "text/plain");
|
|
10
|
+
setHeader(event, "Content-Type", "text/plain; charset=utf-8");
|
|
11
11
|
return contents.join("\n\n");
|
|
12
12
|
});
|
|
@@ -19,7 +19,7 @@ export default eventHandler(async (event) => {
|
|
|
19
19
|
}
|
|
20
20
|
document.push(
|
|
21
21
|
section.links?.map((link) => {
|
|
22
|
-
return `- [${link.title}](${link.href}): ${link.description}`;
|
|
22
|
+
return link.description ? `- [${link.title}](${link.href}): ${link.description}` : `- [${link.title}](${link.href})`;
|
|
23
23
|
}).join("\n") || ""
|
|
24
24
|
);
|
|
25
25
|
}
|
|
@@ -29,6 +29,6 @@ export default eventHandler(async (event) => {
|
|
|
29
29
|
(options.notes || []).map((note) => `- ${note}`).join("\n")
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
setHeader(event, "Content-Type", "text/plain");
|
|
32
|
+
setHeader(event, "Content-Type", "text/plain; charset=utf-8");
|
|
33
33
|
return document.join("\n\n");
|
|
34
34
|
});
|
|
@@ -2,7 +2,11 @@ import { createHooks } from "hookable";
|
|
|
2
2
|
import { useNitroApp } from "#imports";
|
|
3
3
|
export const llmsHooks = createHooks();
|
|
4
4
|
llmsHooks.beforeEach(() => {
|
|
5
|
-
|
|
5
|
+
const hooks = Object.values(llmsHooks._hooks || {});
|
|
6
|
+
const hasRegisteredHook = hooks.some((hooksList) => Array.isArray(hooksList) && hooksList.length > 0);
|
|
7
|
+
if (hasRegisteredHook) {
|
|
8
|
+
console.warn("[nuxt-llms] `llmsHooks` are deprecated and will be removed in future versions. Use `useNitroApp().hooks.hook('llms:generate', (event, options) => {})` instead");
|
|
9
|
+
}
|
|
6
10
|
});
|
|
7
11
|
export function onLLMsGenerate(cb) {
|
|
8
12
|
return useNitroApp().hooks.hook("llms:generate", cb);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-llms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Generate llms.txt documentation for your Nuxt application",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
"verify": "npm run dev:prepare && npm run lint && npm run test && npm run typecheck"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@nuxt/kit": "^3.
|
|
42
|
+
"@nuxt/kit": "^3.16.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"nuxt-llms": "link:.",
|
|
46
|
-
"@nuxt/devtools": "^2.1
|
|
47
|
-
"@nuxt/eslint-config": "^1.
|
|
46
|
+
"@nuxt/devtools": "^2.3.1",
|
|
47
|
+
"@nuxt/eslint-config": "^1.2.0",
|
|
48
48
|
"@nuxt/module-builder": "^0.8.4",
|
|
49
|
-
"@nuxt/schema": "^3.
|
|
50
|
-
"@nuxt/test-utils": "^3.
|
|
49
|
+
"@nuxt/schema": "^3.16.1",
|
|
50
|
+
"@nuxt/test-utils": "^3.17.2",
|
|
51
51
|
"@types/node": "latest",
|
|
52
|
-
"changelogen": "^0.
|
|
53
|
-
"eslint": "^9.
|
|
54
|
-
"nuxt": "^3.
|
|
52
|
+
"changelogen": "^0.6.1",
|
|
53
|
+
"eslint": "^9.23.0",
|
|
54
|
+
"nuxt": "^3.16.1",
|
|
55
55
|
"typescript": "~5.6.0",
|
|
56
|
-
"vitest": "^3.0.
|
|
56
|
+
"vitest": "^3.0.9",
|
|
57
57
|
"vue-tsc": "^2.2.2"
|
|
58
58
|
},
|
|
59
|
-
"packageManager": "pnpm@10.
|
|
59
|
+
"packageManager": "pnpm@10.6.5"
|
|
60
60
|
}
|
|
File without changes
|