@breadstone-infrastructure/vite 0.0.221 → 0.0.223
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/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.223",
|
|
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.223",
|
|
16
|
+
"@breadstone-tools/localizator-core": "^0.0.223",
|
|
17
17
|
"gray-matter": "^4.0.3"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llmsPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/llms/llmsPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"llmsPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/llms/llmsPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAI7E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,kBAAkB,KAAG,MA2DxD,CAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
// plugins/llmsPlugin.ts
|
|
2
1
|
// #region Imports
|
|
2
|
+
import { Directory, File, Path } from '@breadstone-infrastructure/utilities';
|
|
3
3
|
import { createLogger } from 'vite';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { readdir, stat, writeFile } from 'node:fs/promises';
|
|
6
4
|
// #endregion
|
|
7
5
|
/**
|
|
8
6
|
* Vite plugin that generates a `llms.txt` file based on markdown files
|
|
@@ -21,24 +19,14 @@ export const llmsPlugin = (options) => {
|
|
|
21
19
|
name: 'vite-plugin-llms',
|
|
22
20
|
apply: 'build',
|
|
23
21
|
async closeBundle() {
|
|
24
|
-
const llmsDirectory =
|
|
25
|
-
const distDirectory =
|
|
26
|
-
|
|
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
|
|
22
|
+
const llmsDirectory = Path.resolve(options.directory);
|
|
23
|
+
const distDirectory = Path.resolve(options.dist);
|
|
24
|
+
if (Directory.exists(llmsDirectory)) {
|
|
36
25
|
logger.warn(`[vite-plugin-llms]: Directory does not exist: ${llmsDirectory}`);
|
|
37
26
|
return;
|
|
38
27
|
}
|
|
39
|
-
//
|
|
40
|
-
const
|
|
41
|
-
const markdownFiles = files
|
|
28
|
+
// Get all markdown files in the directory
|
|
29
|
+
const markdownFiles = Array.from(Directory.walk(llmsDirectory))
|
|
42
30
|
.filter((file) => file.endsWith('.md'))
|
|
43
31
|
.sort();
|
|
44
32
|
// Build llms.txt content
|
|
@@ -71,7 +59,7 @@ export const llmsPlugin = (options) => {
|
|
|
71
59
|
const output = lines.join('\n');
|
|
72
60
|
// Write llms.txt
|
|
73
61
|
logger.info(`[vite-plugin-llms]: Writing llms.txt with ${markdownFiles.length} files`);
|
|
74
|
-
|
|
62
|
+
File.writeAllText(Path.combine(distDirectory, 'llms.txt'), output);
|
|
75
63
|
}
|
|
76
64
|
};
|
|
77
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llmsPlugin.js","sourceRoot":"","sources":["../../../src/plugins/llms/llmsPlugin.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"llmsPlugin.js","sourceRoot":"","sources":["../../../src/plugins/llms/llmsPlugin.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAe,MAAM,MAAM,CAAC;AAGjD,aAAa;AAEb;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAA2B,EAAU,EAAE;IAC9D,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAE7D,OAAO;QACH,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,OAAO;QACd,KAAK,CAAC,WAAW;YACb,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACtD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAEjD,IAAI,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;gBAClC,MAAM,CAAC,IAAI,CAAC,iDAAiD,aAAa,EAAE,CAAC,CAAC;gBAC9E,OAAO;YACX,CAAC;YAED,0CAA0C;YAC1C,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;iBAC1D,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;iBACtC,IAAI,EAAE,CAAC;YAEZ,yBAA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