@nuasite/llm-enhancements 0.0.57 → 0.0.59
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/types/build-processor.d.ts +2 -2
- package/dist/types/build-processor.d.ts.map +1 -1
- package/dist/types/dev-middleware.d.ts +2 -1
- package/dist/types/dev-middleware.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/llm-endpoint.d.ts +1 -0
- package/dist/types/llm-endpoint.d.ts.map +1 -1
- package/dist/types/llms-txt-endpoint.d.ts +19 -0
- package/dist/types/llms-txt-endpoint.d.ts.map +1 -0
- package/dist/types/markdown-generator.d.ts +2 -0
- package/dist/types/markdown-generator.d.ts.map +1 -1
- package/dist/types/paths.d.ts +6 -0
- package/dist/types/paths.d.ts.map +1 -1
- package/dist/types/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +19 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/build-processor.ts +2 -0
- package/src/dev-middleware.ts +7 -4
- package/src/index.ts +1 -1
- package/src/markdown-generator.ts +5 -1
package/dist/types/types.d.ts
CHANGED
|
@@ -7,12 +7,30 @@ export interface PageMarkdownOptions {
|
|
|
7
7
|
includeFrontmatter?: boolean;
|
|
8
8
|
/** Enable /.well-known/llm.md endpoint (default: true) */
|
|
9
9
|
llmEndpoint?: boolean | LlmEndpointOptions;
|
|
10
|
+
/** Enable /llms.txt endpoint (default: true) */
|
|
11
|
+
llmsTxt?: boolean | LlmsTxtOptions;
|
|
10
12
|
}
|
|
11
13
|
export interface LlmEndpointOptions {
|
|
12
14
|
/** Site name override */
|
|
13
15
|
siteName?: string;
|
|
14
16
|
/** Site description override */
|
|
15
17
|
description?: string;
|
|
18
|
+
/** Base URL override (defaults to Astro's site config) */
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
/** Additional content to append */
|
|
21
|
+
additionalContent?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface LlmsTxtOptions {
|
|
24
|
+
/** Site name override */
|
|
25
|
+
siteName?: string;
|
|
26
|
+
/** Site description override */
|
|
27
|
+
description?: string;
|
|
28
|
+
/** Base URL override (defaults to Astro's site config) */
|
|
29
|
+
baseUrl?: string;
|
|
30
|
+
/** Whether crawling is allowed (default: true) */
|
|
31
|
+
allowCrawling?: boolean;
|
|
32
|
+
/** Custom instructions for LLMs */
|
|
33
|
+
instructions?: string;
|
|
16
34
|
/** Additional content to append */
|
|
17
35
|
additionalContent?: string;
|
|
18
36
|
}
|
|
@@ -29,6 +47,7 @@ export interface ResolvedOptions {
|
|
|
29
47
|
includeStaticPages: boolean;
|
|
30
48
|
includeFrontmatter: boolean;
|
|
31
49
|
llmEndpoint: false | LlmEndpointOptions;
|
|
50
|
+
llmsTxt: false | LlmsTxtOptions;
|
|
32
51
|
}
|
|
33
52
|
export declare function resolveOptions(options?: PageMarkdownOptions): ResolvedOptions;
|
|
34
53
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IACnC,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,+DAA+D;IAC/D,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,0DAA0D;IAC1D,WAAW,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IACnC,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,OAAO,CAAA;IA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,GAAG,eAAe,CAUjF"}
|
package/package.json
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
"README.md",
|
|
8
8
|
"package.json"
|
|
9
9
|
],
|
|
10
|
-
"homepage": "https://github.com/nuasite/nuasite/blob/main/packages/
|
|
10
|
+
"homepage": "https://github.com/nuasite/nuasite/blob/main/packages/llm-enhancements/README.md",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "git+https://github.com/nuasite/nuasite.git",
|
|
14
|
-
"directory": "packages/
|
|
14
|
+
"directory": "packages/llm-enhancements"
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
|
-
"version": "0.0.
|
|
17
|
+
"version": "0.0.59",
|
|
18
18
|
"module": "src/index.ts",
|
|
19
19
|
"types": "src/index.ts",
|
|
20
20
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"typescript": "^5",
|
|
30
30
|
"vite": "^6",
|
|
31
|
-
"@nuasite/cms-marker": "0.0.
|
|
31
|
+
"@nuasite/cms-marker": "0.0.59"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
34
34
|
"@nuasite/cms-marker": {
|
package/src/build-processor.ts
CHANGED
|
@@ -54,6 +54,7 @@ export async function processBuildOutput(
|
|
|
54
54
|
url: pagePath,
|
|
55
55
|
type: 'collection',
|
|
56
56
|
sourcePath: content.file,
|
|
57
|
+
baseUrl,
|
|
57
58
|
}, options.includeFrontmatter)
|
|
58
59
|
|
|
59
60
|
await writeMarkdownFile(mdPath, markdown)
|
|
@@ -80,6 +81,7 @@ export async function processBuildOutput(
|
|
|
80
81
|
const markdown = generateMarkdown(output, {
|
|
81
82
|
url: pagePath,
|
|
82
83
|
type: 'static',
|
|
84
|
+
baseUrl,
|
|
83
85
|
}, options.includeFrontmatter)
|
|
84
86
|
|
|
85
87
|
await writeMarkdownFile(mdPath, markdown)
|
package/src/dev-middleware.ts
CHANGED
|
@@ -17,6 +17,7 @@ async function generateMarkdownForPath(
|
|
|
17
17
|
pagePath: string,
|
|
18
18
|
host: string,
|
|
19
19
|
options: ResolvedOptions,
|
|
20
|
+
baseUrl: string,
|
|
20
21
|
): Promise<string | null> {
|
|
21
22
|
// Try collection page first
|
|
22
23
|
const content = await getCollectionContent(pagePath, options.contentDir)
|
|
@@ -26,6 +27,7 @@ async function generateMarkdownForPath(
|
|
|
26
27
|
url: pagePath,
|
|
27
28
|
type: 'collection',
|
|
28
29
|
sourcePath: content.file,
|
|
30
|
+
baseUrl,
|
|
29
31
|
}, options.includeFrontmatter)
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -50,6 +52,7 @@ async function generateMarkdownForPath(
|
|
|
50
52
|
return generateMarkdown(output, {
|
|
51
53
|
url: pagePath,
|
|
52
54
|
type: 'static',
|
|
55
|
+
baseUrl,
|
|
53
56
|
}, options.includeFrontmatter)
|
|
54
57
|
}
|
|
55
58
|
|
|
@@ -137,7 +140,7 @@ export function createDevMiddleware(server: ViteDevServer, options: ResolvedOpti
|
|
|
137
140
|
res.end(content)
|
|
138
141
|
return
|
|
139
142
|
} catch (error) {
|
|
140
|
-
console.error('[
|
|
143
|
+
console.error('[llm-enhancements] Error generating llms.txt:', error)
|
|
141
144
|
}
|
|
142
145
|
|
|
143
146
|
return next()
|
|
@@ -164,7 +167,7 @@ export function createDevMiddleware(server: ViteDevServer, options: ResolvedOpti
|
|
|
164
167
|
res.end(markdown)
|
|
165
168
|
return
|
|
166
169
|
} catch (error) {
|
|
167
|
-
console.error('[
|
|
170
|
+
console.error('[llm-enhancements] Error generating llm.md:', error)
|
|
168
171
|
}
|
|
169
172
|
|
|
170
173
|
return next()
|
|
@@ -183,7 +186,7 @@ export function createDevMiddleware(server: ViteDevServer, options: ResolvedOpti
|
|
|
183
186
|
|
|
184
187
|
try {
|
|
185
188
|
const host = req.headers.host || 'localhost:4321'
|
|
186
|
-
const markdown = await generateMarkdownForPath(pagePath, host, options)
|
|
189
|
+
const markdown = await generateMarkdownForPath(pagePath, host, options, baseUrl)
|
|
187
190
|
|
|
188
191
|
if (markdown) {
|
|
189
192
|
res.setHeader('Content-Type', 'text/markdown; charset=utf-8')
|
|
@@ -192,7 +195,7 @@ export function createDevMiddleware(server: ViteDevServer, options: ResolvedOpti
|
|
|
192
195
|
return
|
|
193
196
|
}
|
|
194
197
|
} catch (error) {
|
|
195
|
-
console.error('[
|
|
198
|
+
console.error('[llm-enhancements] Error generating markdown:', error)
|
|
196
199
|
}
|
|
197
200
|
|
|
198
201
|
return next()
|
package/src/index.ts
CHANGED
|
@@ -62,6 +62,8 @@ export interface GenerateOptions {
|
|
|
62
62
|
type: 'collection' | 'static'
|
|
63
63
|
/** Path to source file (for collections) */
|
|
64
64
|
sourcePath?: string
|
|
65
|
+
/** Base URL for absolute URL generation (e.g., https://example.com) */
|
|
66
|
+
baseUrl?: string
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
/**
|
|
@@ -77,9 +79,11 @@ export function generateMarkdown(
|
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
// Build frontmatter with metadata
|
|
82
|
+
// Use absolute URL if baseUrl is provided, otherwise use relative path
|
|
83
|
+
const absoluteUrl = options.baseUrl ? `${options.baseUrl}${options.url}` : options.url
|
|
80
84
|
const frontmatter: Record<string, unknown> = {
|
|
81
85
|
...output.frontmatter,
|
|
82
|
-
url:
|
|
86
|
+
url: absoluteUrl,
|
|
83
87
|
type: options.type,
|
|
84
88
|
generatedAt: new Date().toISOString(),
|
|
85
89
|
}
|