@breadstone-infrastructure/vite 0.0.216 → 0.0.217
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/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/plugins/llms/interfaces/ILlmsPluginOptions.d.ts +47 -0
- package/plugins/llms/interfaces/ILlmsPluginOptions.d.ts.map +1 -0
- package/plugins/llms/interfaces/ILlmsPluginOptions.js +3 -0
- package/plugins/llms/interfaces/ILlmsPluginOptions.js.map +1 -0
- package/plugins/llms/llmsPlugin.d.ts +15 -0
- package/plugins/llms/llmsPlugin.d.ts.map +1 -0
- package/plugins/llms/llmsPlugin.js +78 -0
- package/plugins/llms/llmsPlugin.js.map +1 -0
package/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export type { IStaticContentPluginOptions } from './plugins/static-content/inter
|
|
|
3
3
|
export { staticContentPlugin } from './plugins/static-content/StaticContentPlugin.js';
|
|
4
4
|
export type { ILiveReloadPluginOptions } from './plugins/live-reload/interfaces/ILiveReloadPluginOptions.js';
|
|
5
5
|
export { liveReloadPlugin } from './plugins/live-reload/LiveReloadPlugin.js';
|
|
6
|
+
export type { ILlmsPluginOptions } from './plugins/llms/interfaces/ILlmsPluginOptions.js';
|
|
7
|
+
export { llmsPlugin } from './plugins/llms/llmsPlugin.js';
|
|
6
8
|
export { VIRTUAL_MODULE_KEY as LOCALIZATOR_VIRTUAL_MODULE_KEY } from './plugins/localizator/LocalizatorPlugin.js';
|
|
7
9
|
export type { ILocalizatorPluginOptions } from './plugins/localizator/interfaces/ILocalizatorPluginOptions.js';
|
|
8
10
|
export { localizatorPlugin } from './plugins/localizator/LocalizatorPlugin.js';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EA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AkB,IAAI,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAClH,YAAY,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,kBAAkB,IAAI,6BAA6B,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC/H,YAAY,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AAC1G,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,YAAY,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { VIRTUAL_MODULE_KEY as STATIC_CONTENT_VIRTUAL_MODULE_KEY } from './plugins/static-content/StaticContentPlugin.js';
|
|
2
2
|
export { staticContentPlugin } from './plugins/static-content/StaticContentPlugin.js';
|
|
3
3
|
export { liveReloadPlugin } from './plugins/live-reload/LiveReloadPlugin.js';
|
|
4
|
+
export { llmsPlugin } from './plugins/llms/llmsPlugin.js';
|
|
4
5
|
export { VIRTUAL_MODULE_KEY as LOCALIZATOR_VIRTUAL_MODULE_KEY } from './plugins/localizator/LocalizatorPlugin.js';
|
|
5
6
|
export { localizatorPlugin } from './plugins/localizator/LocalizatorPlugin.js';
|
|
6
7
|
export { run as envExportRun } from './plugins/env-export/envExport.js';
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,iCAAiC,EAAE,MAAM,iDAAiD,CAAC;AAE1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAGtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,iCAAiC,EAAE,MAAM,iDAAiD,CAAC;AAE1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAGtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,kBAAkB,IAAI,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAElH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,kBAAkB,IAAI,6BAA6B,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/H,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,uCAAuC;AACvC,0CAA0C;AAC1C,sCAAsC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadstone-infrastructure/vite",
|
|
3
3
|
"description": "Vite configuration and plugins",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.217",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
|
|
7
7
|
"repository": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"module": "./index.js",
|
|
13
13
|
"types": "./index.d.ts",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@breadstone-infrastructure/utilities": "^0.0.
|
|
16
|
-
"@breadstone-tools/localizator-core": "^0.0.
|
|
15
|
+
"@breadstone-infrastructure/utilities": "^0.0.217",
|
|
16
|
+
"@breadstone-tools/localizator-core": "^0.0.217",
|
|
17
17
|
"gray-matter": "^4.0.3"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the LLMS Vite plugin.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface ILlmsPluginOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Output directory for the generated `llms.txt` file.
|
|
9
|
+
*/
|
|
10
|
+
dist: string;
|
|
11
|
+
/**
|
|
12
|
+
* Directory that contains the markdown files to list.
|
|
13
|
+
*/
|
|
14
|
+
directory: string;
|
|
15
|
+
/**
|
|
16
|
+
* Header content placed at the top of `llms.txt`.
|
|
17
|
+
* This is where project description, installation instructions,
|
|
18
|
+
* architecture details, etc. should be defined.
|
|
19
|
+
*/
|
|
20
|
+
header?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional header text before the file list.
|
|
23
|
+
* Example: "## Component Documentation Files"
|
|
24
|
+
*/
|
|
25
|
+
fileListHeader?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Footer content placed at the end of `llms.txt`.
|
|
28
|
+
* Example: "If a capability is not described, it does not exist."
|
|
29
|
+
*/
|
|
30
|
+
footer?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to format file entries as markdown links.
|
|
33
|
+
* If true: `- [file.md](llms/file.md)`
|
|
34
|
+
* If false: `- file.md`
|
|
35
|
+
*
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
useMarkdownLinks?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Prefix for markdown links.
|
|
41
|
+
* Only used when `useMarkdownLinks` is true.
|
|
42
|
+
*
|
|
43
|
+
* @default 'llms'
|
|
44
|
+
*/
|
|
45
|
+
linkPrefix?: string;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ILlmsPluginOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILlmsPluginOptions.d.ts","sourceRoot":"","sources":["../../../../src/plugins/llms/interfaces/ILlmsPluginOptions.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAE/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILlmsPluginOptions.js","sourceRoot":"","sources":["../../../../src/plugins/llms/interfaces/ILlmsPluginOptions.ts"],"names":[],"mappings":"AAAA,2CAA2C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Plugin } from 'vite';
|
|
2
|
+
import type { ILlmsPluginOptions } from './interfaces/ILlmsPluginOptions.js';
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin that generates a `llms.txt` file based on markdown files
|
|
5
|
+
* contained in a given directory.
|
|
6
|
+
*
|
|
7
|
+
* The plugin scans the specified directory for markdown files and generates
|
|
8
|
+
* a consolidated llms.txt file with configurable header, footer, and file list format.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @param options - Plugin configuration
|
|
12
|
+
* @returns Vite-compatible plugin
|
|
13
|
+
*/
|
|
14
|
+
export declare const llmsPlugin: (options: ILlmsPluginOptions) => Plugin;
|
|
15
|
+
//# sourceMappingURL=llmsPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmsPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/llms/llmsPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAGjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAI7E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,kBAAkB,KAAG,MA0ExD,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// plugins/llmsPlugin.ts
|
|
2
|
+
// #region Imports
|
|
3
|
+
import { createLogger } from 'vite';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { readdir, stat, writeFile } from 'node:fs/promises';
|
|
6
|
+
// #endregion
|
|
7
|
+
/**
|
|
8
|
+
* Vite plugin that generates a `llms.txt` file based on markdown files
|
|
9
|
+
* contained in a given directory.
|
|
10
|
+
*
|
|
11
|
+
* The plugin scans the specified directory for markdown files and generates
|
|
12
|
+
* a consolidated llms.txt file with configurable header, footer, and file list format.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @param options - Plugin configuration
|
|
16
|
+
* @returns Vite-compatible plugin
|
|
17
|
+
*/
|
|
18
|
+
export const llmsPlugin = (options) => {
|
|
19
|
+
const logger = createLogger(undefined, { console: console });
|
|
20
|
+
return {
|
|
21
|
+
name: 'vite-plugin-llms',
|
|
22
|
+
apply: 'build',
|
|
23
|
+
async closeBundle() {
|
|
24
|
+
const llmsDirectory = path.resolve(options.directory);
|
|
25
|
+
const distDirectory = path.resolve(options.dist);
|
|
26
|
+
// Ensure directory exists
|
|
27
|
+
try {
|
|
28
|
+
const directoryStat = await stat(llmsDirectory);
|
|
29
|
+
if (!directoryStat.isDirectory()) {
|
|
30
|
+
logger.warn(`[vite-plugin-llms]: Path is not a directory: ${llmsDirectory}`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Directory does not exist → nothing to do
|
|
36
|
+
logger.warn(`[vite-plugin-llms]: Directory does not exist: ${llmsDirectory}`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// Read markdown files
|
|
40
|
+
const files = await readdir(llmsDirectory);
|
|
41
|
+
const markdownFiles = files
|
|
42
|
+
.filter((file) => file.endsWith('.md'))
|
|
43
|
+
.sort();
|
|
44
|
+
// Build llms.txt content
|
|
45
|
+
const lines = [];
|
|
46
|
+
// Add header content
|
|
47
|
+
if (options.header) {
|
|
48
|
+
lines.push(options.header.trim());
|
|
49
|
+
lines.push('');
|
|
50
|
+
}
|
|
51
|
+
// Add file list header
|
|
52
|
+
if (options.fileListHeader) {
|
|
53
|
+
lines.push(options.fileListHeader.trim());
|
|
54
|
+
lines.push('');
|
|
55
|
+
}
|
|
56
|
+
// Add file list
|
|
57
|
+
const linkPrefix = options.linkPrefix ?? 'llms';
|
|
58
|
+
for (const file of markdownFiles) {
|
|
59
|
+
if (options.useMarkdownLinks) {
|
|
60
|
+
lines.push(`- [${file}](${linkPrefix}/${file})`);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
lines.push(`- ${file}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Add footer content
|
|
67
|
+
if (options.footer) {
|
|
68
|
+
lines.push('');
|
|
69
|
+
lines.push(options.footer.trim());
|
|
70
|
+
}
|
|
71
|
+
const output = lines.join('\n');
|
|
72
|
+
// Write llms.txt
|
|
73
|
+
logger.info(`[vite-plugin-llms]: Writing llms.txt with ${markdownFiles.length} files`);
|
|
74
|
+
await writeFile(path.join(distDirectory, 'llms.txt'), output, 'utf-8');
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=llmsPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmsPlugin.js","sourceRoot":"","sources":["../../../src/plugins/llms/llmsPlugin.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,kBAAkB;AAElB,OAAO,EAAE,YAAY,EAAe,MAAM,MAAM,CAAC;AACjD,OAAO,IAAI,MAA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