@breadstone-infrastructure/vite 0.0.231 → 0.0.232
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 +3 -6
- package/index.d.ts.map +1 -1
- package/index.js +2 -5
- package/index.js.map +1 -1
- package/package.json +3 -4
- package/plugins/llms/interfaces/ILlmsPluginOptions.d.ts +11 -18
- package/plugins/llms/interfaces/ILlmsPluginOptions.d.ts.map +1 -1
- package/plugins/llms/interfaces/ILlmsSection.d.ts +43 -0
- package/plugins/llms/interfaces/ILlmsSection.d.ts.map +1 -0
- package/plugins/llms/interfaces/ILlmsSection.js +2 -0
- package/plugins/llms/interfaces/ILlmsSection.js.map +1 -0
- package/plugins/llms/llmsPlugin.d.ts +2 -0
- package/plugins/llms/llmsPlugin.d.ts.map +1 -1
- package/plugins/llms/llmsPlugin.js +73 -25
- package/plugins/llms/llmsPlugin.js.map +1 -1
- package/plugins/localizator/LocalizatorPlugin.d.ts.map +1 -1
- package/plugins/localizator/LocalizatorPlugin.js +4 -3
- package/plugins/localizator/LocalizatorPlugin.js.map +1 -1
- package/plugins/static-content/StaticContentPlugin.d.ts.map +1 -1
- package/plugins/static-content/StaticContentPlugin.js +23 -9
- package/plugins/static-content/StaticContentPlugin.js.map +1 -1
- package/plugins/static-content/interfaces/IStaticContentPluginOptions.d.ts +27 -0
- package/plugins/static-content/interfaces/IStaticContentPluginOptions.d.ts.map +1 -1
package/index.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
export { VIRTUAL_MODULE_KEY as STATIC_CONTENT_VIRTUAL_MODULE_KEY } from './plugins/static-content/StaticContentPlugin.js';
|
|
2
|
-
export type { IStaticContentPluginOptions } from './plugins/static-content/interfaces/IStaticContentPluginOptions.js';
|
|
3
|
-
export { staticContentPlugin } from './plugins/static-content/StaticContentPlugin.js';
|
|
4
1
|
export type { ILiveReloadPluginOptions } from './plugins/live-reload/interfaces/ILiveReloadPluginOptions.js';
|
|
5
2
|
export { liveReloadPlugin } from './plugins/live-reload/LiveReloadPlugin.js';
|
|
6
3
|
export type { ILlmsPluginOptions } from './plugins/llms/interfaces/ILlmsPluginOptions.js';
|
|
4
|
+
export type { ILlmsSection } from './plugins/llms/interfaces/ILlmsSection.js';
|
|
7
5
|
export { llmsPlugin } from './plugins/llms/llmsPlugin.js';
|
|
8
|
-
export { VIRTUAL_MODULE_KEY as LOCALIZATOR_VIRTUAL_MODULE_KEY } from './plugins/localizator/LocalizatorPlugin.js';
|
|
9
6
|
export type { ILocalizatorPluginOptions } from './plugins/localizator/interfaces/ILocalizatorPluginOptions.js';
|
|
10
|
-
export { localizatorPlugin } from './plugins/localizator/LocalizatorPlugin.js';
|
|
7
|
+
export { VIRTUAL_MODULE_KEY as LOCALIZATOR_VIRTUAL_MODULE_KEY, localizatorPlugin } from './plugins/localizator/LocalizatorPlugin.js';
|
|
8
|
+
export { VercelPresetKeys } from './plugins/env-export/const/Vercel.js';
|
|
11
9
|
export { run as envExportRun } from './plugins/env-export/envExport.js';
|
|
12
10
|
export { VIRTUAL_MODULE_KEY as ENV_EXPORT_VIRTUAL_MODULE_KEY, envExportPlugin } from './plugins/env-export/envExportPlugin.js';
|
|
13
11
|
export type { IEnvExportPluginOptions } from './plugins/env-export/interfaces/IEnvExportPluginOptions.js';
|
|
14
|
-
export { VercelPresetKeys } from './plugins/env-export/const/Vercel.js';
|
|
15
12
|
export type { EnvExportPreset } from './plugins/env-export/types/EnvExportPreset.js';
|
|
16
13
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,MAAM,8DAA8D,CAAC;AAC7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAE7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,YAAY,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,YAAY,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AAC/G,OAAO,EAAE,kBAAkB,IAAI,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAErI,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,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,YAAY,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
export { VIRTUAL_MODULE_KEY as STATIC_CONTENT_VIRTUAL_MODULE_KEY } from './plugins/static-content/StaticContentPlugin.js';
|
|
2
|
-
export { staticContentPlugin } from './plugins/static-content/StaticContentPlugin.js';
|
|
3
1
|
export { liveReloadPlugin } from './plugins/live-reload/LiveReloadPlugin.js';
|
|
4
2
|
export { llmsPlugin } from './plugins/llms/llmsPlugin.js';
|
|
5
|
-
export { VIRTUAL_MODULE_KEY as LOCALIZATOR_VIRTUAL_MODULE_KEY } from './plugins/localizator/LocalizatorPlugin.js';
|
|
6
|
-
export {
|
|
3
|
+
export { VIRTUAL_MODULE_KEY as LOCALIZATOR_VIRTUAL_MODULE_KEY, localizatorPlugin } from './plugins/localizator/LocalizatorPlugin.js';
|
|
4
|
+
export { VercelPresetKeys } from './plugins/env-export/const/Vercel.js';
|
|
7
5
|
export { run as envExportRun } from './plugins/env-export/envExport.js';
|
|
8
6
|
export { VIRTUAL_MODULE_KEY as ENV_EXPORT_VIRTUAL_MODULE_KEY, envExportPlugin } from './plugins/env-export/envExportPlugin.js';
|
|
9
|
-
export { VercelPresetKeys } from './plugins/env-export/const/Vercel.js';
|
|
10
7
|
// import './virtual/localizator.d.ts';
|
|
11
8
|
// import './virtual/static-content.d.ts';
|
|
12
9
|
// import './virtual/env-export.d.ts';
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAI7E,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,OAAO,EAAE,kBAAkB,IAAI,8BAA8B,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAErI,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,kBAAkB,IAAI,6BAA6B,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAI/H,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.232",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
|
|
7
7
|
"repository": {
|
|
@@ -12,9 +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.
|
|
17
|
-
"gray-matter": "^4.0.3"
|
|
15
|
+
"@breadstone-infrastructure/utilities": "^0.0.232",
|
|
16
|
+
"@breadstone-tools/localizator-core": "^0.0.232"
|
|
18
17
|
},
|
|
19
18
|
"peerDependencies": {
|
|
20
19
|
"vite": "^6.0.0 || ^7.0.0"
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import type { ILlmsSection } from './ILlmsSection.js';
|
|
1
2
|
/**
|
|
2
3
|
* Options for the LLMS Vite plugin.
|
|
3
4
|
*
|
|
5
|
+
* The plugin renders the `header`, followed by each `section` in order,
|
|
6
|
+
* followed by the `footer` into a consolidated `llms.txt` file.
|
|
7
|
+
*
|
|
4
8
|
* @public
|
|
5
9
|
*/
|
|
6
10
|
export interface ILlmsPluginOptions {
|
|
@@ -8,40 +12,29 @@ export interface ILlmsPluginOptions {
|
|
|
8
12
|
* Output directory for the generated `llms.txt` file.
|
|
9
13
|
*/
|
|
10
14
|
dist: string;
|
|
11
|
-
/**
|
|
12
|
-
* Directory that contains the markdown files to list.
|
|
13
|
-
*/
|
|
14
|
-
directory: string;
|
|
15
15
|
/**
|
|
16
16
|
* Header content placed at the top of `llms.txt`.
|
|
17
17
|
* This is where project description, installation instructions,
|
|
18
18
|
* architecture details, etc. should be defined.
|
|
19
19
|
*/
|
|
20
20
|
header?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Optional header text before the file list.
|
|
23
|
-
* Example: "## Component Documentation Files"
|
|
24
|
-
*/
|
|
25
|
-
fileListHeader?: string;
|
|
26
21
|
/**
|
|
27
22
|
* Footer content placed at the end of `llms.txt`.
|
|
28
23
|
* Example: "If a capability is not described, it does not exist."
|
|
29
24
|
*/
|
|
30
25
|
footer?: string;
|
|
31
26
|
/**
|
|
32
|
-
* Whether to
|
|
33
|
-
*
|
|
34
|
-
*
|
|
27
|
+
* Whether to generate a `llms-full.txt` file that concatenates
|
|
28
|
+
* the header, all markdown file contents, and the footer into
|
|
29
|
+
* a single file.
|
|
35
30
|
*
|
|
36
31
|
* @default false
|
|
37
32
|
*/
|
|
38
|
-
|
|
33
|
+
generateFullFile?: boolean;
|
|
39
34
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @default 'llms'
|
|
35
|
+
* Ordered list of sections to render in the `llms.txt` output.
|
|
36
|
+
* Each section can contain inline text, file links, or both.
|
|
44
37
|
*/
|
|
45
|
-
|
|
38
|
+
sections: ILlmsSection[];
|
|
46
39
|
}
|
|
47
40
|
//# sourceMappingURL=ILlmsPluginOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ILlmsPluginOptions.d.ts","sourceRoot":"","sources":["../../../../src/plugins/llms/interfaces/ILlmsPluginOptions.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"ILlmsPluginOptions.d.ts","sourceRoot":"","sources":["../../../../src/plugins/llms/interfaces/ILlmsPluginOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IAE/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC5B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a single section in the generated `llms.txt` file.
|
|
3
|
+
*
|
|
4
|
+
* Each section consists of an optional inline text block (rendered directly
|
|
5
|
+
* into the output) and an optional set of file references (rendered as a
|
|
6
|
+
* list of markdown links or plain file names).
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface ILlmsSection {
|
|
11
|
+
/**
|
|
12
|
+
* Optional heading rendered above the section content.
|
|
13
|
+
*
|
|
14
|
+
* @example '## Starter Templates'
|
|
15
|
+
*/
|
|
16
|
+
header?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Inline text rendered directly into the `llms.txt` output.
|
|
19
|
+
* Use this to provide context, explanations, or instructions
|
|
20
|
+
* that should be immediately visible to AI consumers.
|
|
21
|
+
*/
|
|
22
|
+
text?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Directory that contains the markdown files to list in this section.
|
|
25
|
+
* Files are scanned recursively and sorted alphabetically.
|
|
26
|
+
*/
|
|
27
|
+
directory?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Prefix used when generating markdown links for files in this section.
|
|
30
|
+
*
|
|
31
|
+
* @default 'llms'
|
|
32
|
+
*/
|
|
33
|
+
linkPrefix?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to format file entries as markdown links.
|
|
36
|
+
* If true: `- [file.md](prefix/file.md)`
|
|
37
|
+
* If false: `- file.md`
|
|
38
|
+
*
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
useMarkdownLinks?: boolean;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ILlmsSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILlmsSection.d.ts","sourceRoot":"","sources":["../../../../src/plugins/llms/interfaces/ILlmsSection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAEzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILlmsSection.js","sourceRoot":"","sources":["../../../../src/plugins/llms/interfaces/ILlmsSection.ts"],"names":[],"mappings":""}
|
|
@@ -7,6 +7,8 @@ import type { ILlmsPluginOptions } from './interfaces/ILlmsPluginOptions.js';
|
|
|
7
7
|
* The plugin scans the specified directory for markdown files and generates
|
|
8
8
|
* a consolidated llms.txt file with configurable header, footer, and file list format.
|
|
9
9
|
*
|
|
10
|
+
* Supports multiple sections, each with its own inline text and/or file list.
|
|
11
|
+
*
|
|
10
12
|
* @public
|
|
11
13
|
* @param options - Plugin configuration
|
|
12
14
|
* @returns Vite-compatible plugin
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAK7E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,kBAAkB,KAAG,MAgExD,CAAC"}
|
|
@@ -9,6 +9,8 @@ import { createLogger } from 'vite';
|
|
|
9
9
|
* The plugin scans the specified directory for markdown files and generates
|
|
10
10
|
* a consolidated llms.txt file with configurable header, footer, and file list format.
|
|
11
11
|
*
|
|
12
|
+
* Supports multiple sections, each with its own inline text and/or file list.
|
|
13
|
+
*
|
|
12
14
|
* @public
|
|
13
15
|
* @param options - Plugin configuration
|
|
14
16
|
* @returns Vite-compatible plugin
|
|
@@ -19,17 +21,7 @@ export const llmsPlugin = (options) => {
|
|
|
19
21
|
name: 'vite-plugin-llms',
|
|
20
22
|
apply: 'build',
|
|
21
23
|
async closeBundle() {
|
|
22
|
-
const llmsDirectory = Path.resolve(options.directory);
|
|
23
24
|
const distDirectory = Path.resolve(options.dist);
|
|
24
|
-
if (!Directory.exists(llmsDirectory)) {
|
|
25
|
-
logger.warn(`[vite-plugin-llms]: Directory does not exist: ${llmsDirectory}`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
// Get all markdown files in the directory
|
|
29
|
-
const markdownFiles = Array.from(Directory.walk(llmsDirectory))
|
|
30
|
-
.filter((file) => file.endsWith('.md'))
|
|
31
|
-
.sort()
|
|
32
|
-
.map((file) => Path.relative(llmsDirectory, file).replace(/\\/g, '/'));
|
|
33
25
|
// Build llms.txt content
|
|
34
26
|
const lines = [];
|
|
35
27
|
// Add header content
|
|
@@ -37,20 +29,12 @@ export const llmsPlugin = (options) => {
|
|
|
37
29
|
lines.push(options.header.trim());
|
|
38
30
|
lines.push('');
|
|
39
31
|
}
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const linkPrefix = options.linkPrefix ?? 'llms';
|
|
47
|
-
for (const file of markdownFiles) {
|
|
48
|
-
if (options.useMarkdownLinks) {
|
|
49
|
-
lines.push(`- [${file}](${linkPrefix}/${file})`);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
lines.push(`- ${file}`);
|
|
53
|
-
}
|
|
32
|
+
// Collect all files across sections for llms-full.txt
|
|
33
|
+
const allSectionFiles = [];
|
|
34
|
+
// Render each section
|
|
35
|
+
for (const section of options.sections) {
|
|
36
|
+
const sectionFiles = renderSection(section, lines, logger);
|
|
37
|
+
allSectionFiles.push(...sectionFiles);
|
|
54
38
|
}
|
|
55
39
|
// Add footer content
|
|
56
40
|
if (options.footer) {
|
|
@@ -58,10 +42,74 @@ export const llmsPlugin = (options) => {
|
|
|
58
42
|
lines.push(options.footer.trim());
|
|
59
43
|
}
|
|
60
44
|
const output = lines.join('\n');
|
|
45
|
+
const totalFileCount = allSectionFiles.length;
|
|
61
46
|
// Write llms.txt
|
|
62
|
-
logger.info(`[vite-plugin-llms]: Writing llms.txt with ${
|
|
47
|
+
logger.info(`[vite-plugin-llms]: Writing llms.txt with ${totalFileCount} files across ${options.sections.length} section(s)`);
|
|
63
48
|
File.writeAllText(Path.combine(distDirectory, 'llms.txt'), output);
|
|
49
|
+
// Write llms-full.txt (concatenated header + all file contents + footer)
|
|
50
|
+
if (options.generateFullFile) {
|
|
51
|
+
const fullParts = [];
|
|
52
|
+
if (options.header) {
|
|
53
|
+
fullParts.push(options.header.trim());
|
|
54
|
+
}
|
|
55
|
+
for (const entry of allSectionFiles) {
|
|
56
|
+
const absolutePath = Path.combine(entry.directory, entry.file);
|
|
57
|
+
const content = File.readAllText(absolutePath);
|
|
58
|
+
fullParts.push(content.trim());
|
|
59
|
+
}
|
|
60
|
+
if (options.footer) {
|
|
61
|
+
fullParts.push(options.footer.trim());
|
|
62
|
+
}
|
|
63
|
+
const fullOutput = fullParts.join('\n\n');
|
|
64
|
+
logger.info(`[vite-plugin-llms]: Writing llms-full.txt with ${totalFileCount} files`);
|
|
65
|
+
File.writeAllText(Path.combine(distDirectory, 'llms-full.txt'), fullOutput);
|
|
66
|
+
}
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Renders a single section into the output lines array.
|
|
72
|
+
*
|
|
73
|
+
* @param section - The section definition.
|
|
74
|
+
* @param lines - The output lines array to append to.
|
|
75
|
+
* @param logger - Vite logger instance.
|
|
76
|
+
* @returns Array of resolved file entries (directory + relative path) for llms-full.txt.
|
|
77
|
+
*/
|
|
78
|
+
const renderSection = (section, lines, logger) => {
|
|
79
|
+
const collectedFiles = [];
|
|
80
|
+
// Section header
|
|
81
|
+
if (section.header) {
|
|
82
|
+
lines.push(section.header.trim());
|
|
83
|
+
lines.push('');
|
|
84
|
+
}
|
|
85
|
+
// Inline text
|
|
86
|
+
if (section.text) {
|
|
87
|
+
lines.push(section.text.trim());
|
|
88
|
+
lines.push('');
|
|
89
|
+
}
|
|
90
|
+
// File list from directory
|
|
91
|
+
if (section.directory) {
|
|
92
|
+
const resolvedDirectory = Path.resolve(section.directory);
|
|
93
|
+
if (!Directory.exists(resolvedDirectory)) {
|
|
94
|
+
logger.warn(`[vite-plugin-llms]: Section directory does not exist: ${resolvedDirectory}`);
|
|
95
|
+
return collectedFiles;
|
|
96
|
+
}
|
|
97
|
+
const markdownFiles = Array.from(Directory.walk(resolvedDirectory))
|
|
98
|
+
.filter((file) => file.endsWith('.md'))
|
|
99
|
+
.sort()
|
|
100
|
+
.map((file) => Path.relative(resolvedDirectory, file).replace(/\\/g, '/'));
|
|
101
|
+
const linkPrefix = section.linkPrefix ?? 'llms';
|
|
102
|
+
for (const file of markdownFiles) {
|
|
103
|
+
if (section.useMarkdownLinks) {
|
|
104
|
+
lines.push(`- [${file}](${linkPrefix}/${file})`);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
lines.push(`- ${file}`);
|
|
108
|
+
}
|
|
109
|
+
collectedFiles.push({ directory: resolvedDirectory, file });
|
|
110
|
+
}
|
|
111
|
+
lines.push('');
|
|
112
|
+
}
|
|
113
|
+
return collectedFiles;
|
|
114
|
+
};
|
|
67
115
|
//# sourceMappingURL=llmsPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
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,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AE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QAE/E,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,MAAM,CAAC;QAEhD,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;YAC/B,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;gBAC3B,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,UAAU,IAAI,IAAI,GAAG,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YAC5B,CAAC;YAED,cAAc,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IAED,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizatorPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/localizator/LocalizatorPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalizatorPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/localizator/LocalizatorPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiC,KAAK,MAAM,EAAsB,MAAM,MAAM,CAAC;AACtF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAI3F;;GAEG;AACH,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AAExD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CA0F5E"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// #region Imports
|
|
2
|
-
import { blue, Path, yellow
|
|
3
|
-
import { createLogger } from 'vite';
|
|
2
|
+
import { blue, FileSystem, Path, yellow } from '@breadstone-infrastructure/utilities';
|
|
4
3
|
import { ResourceMode, ResourceReader, ResourceTransformer } from '@breadstone-tools/localizator-core';
|
|
4
|
+
import { createLogger } from 'vite';
|
|
5
5
|
// #endregion
|
|
6
6
|
/**
|
|
7
7
|
* @public
|
|
@@ -82,11 +82,12 @@ export function localizatorPlugin(options) {
|
|
|
82
82
|
});
|
|
83
83
|
return resourceInfo;
|
|
84
84
|
}).filter((x) => x !== null);
|
|
85
|
+
const entries = contents.map((c) => `'${c.locale}': _${c.locale}`).join(',\n');
|
|
85
86
|
return `
|
|
86
87
|
${contents.map((x) => x.toString()).join('\n\n')}
|
|
87
88
|
|
|
88
89
|
export const translations = {
|
|
89
|
-
${
|
|
90
|
+
${entries}
|
|
90
91
|
};
|
|
91
92
|
`;
|
|
92
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizatorPlugin.js","sourceRoot":"","sources":["../../../src/plugins/localizator/LocalizatorPlugin.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"LocalizatorPlugin.js","sourceRoot":"","sources":["../../../src/plugins/localizator/LocalizatorPlugin.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,EAAE,YAAY,EAAoD,MAAM,MAAM,CAAC;AAGtF,aAAa;AAEb;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAkC;IAChE,MAAM,MAAM,GAAG,YAAY,CA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AAC;oBACZ,MAAM,CAAC,IAAI,CAAC,kEAAkE,IAAI,EAAE,CAAC,CAAC;oBACtF,OAAO,IAAI,CAAC;gBAChB,CAAC;gBAED,MAAM,CAAC,IAAI,CAAC,gDAAgD,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;gBAElG,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC/C,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE;oBAC/C,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,IAAI,EAAE,EAAE;oBACR,IAAI,EAAE,EAAE;oBACR,MAAM,EAAE,IAAI;iBACf,CAAC,CAAC;gBAEH,OAAO,YAAY,CAAC;YACxB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;YAE7B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAE/E,OAAO;cACL,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;;;kBAG1C,OAAO;;aAEZ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticContentPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/static-content/StaticContentPlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StaticContentPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/static-content/StaticContentPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgC,KAAK,MAAM,EAAoC,MAAM,MAAM,CAAC;AACnG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAI/F;;GAEG;AACH,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CA2IhF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// #region Imports
|
|
2
|
-
import {
|
|
3
|
-
import { createLogger } from 'vite';
|
|
2
|
+
import { File, Path, red } from '@breadstone-infrastructure/utilities';
|
|
4
3
|
import matter from 'gray-matter';
|
|
4
|
+
import { createLogger } from 'vite';
|
|
5
5
|
// #endregion
|
|
6
6
|
/**
|
|
7
7
|
* @public
|
|
@@ -60,13 +60,13 @@ export function staticContentPlugin(options) {
|
|
|
60
60
|
if (id === `${VIRTUAL_MODULE_KEY}.ts`) {
|
|
61
61
|
const mdFiles = Path.glob(options.paths)
|
|
62
62
|
.filter((file) => file.endsWith('.md'));
|
|
63
|
-
const
|
|
63
|
+
const baseClassName = options.baseClassName ?? 'BlogBaseElement';
|
|
64
|
+
const sharedImports = (options.sharedImports ?? `
|
|
64
65
|
import { html, LitElement } from 'lit';
|
|
65
66
|
import { customElement } from 'lit/decorators.js';
|
|
66
67
|
import { dateFormat, animate, Animate } from '@breadstone/mosaik-elements-foundation';
|
|
67
68
|
import { BlogBaseElement } from './src/Views/Blog/Abstracts/BlogBase';
|
|
68
|
-
|
|
69
|
-
`.trim();
|
|
69
|
+
`).trim();
|
|
70
70
|
let componentsRegistry = 'const components = new Map();';
|
|
71
71
|
const components = mdFiles.map((x, i) => {
|
|
72
72
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -86,11 +86,23 @@ import { Memoize } from './src/Decorators/MemoizeDecorator';
|
|
|
86
86
|
}
|
|
87
87
|
const displayName = generateDisplayName(Path.getFileName(relativeFilePath));
|
|
88
88
|
const breadcrumbParts = routePath.split('/');
|
|
89
|
+
// When composition is configured, generated components get their own render()
|
|
90
|
+
// that wraps content in a viewer shell with a slot. Otherwise they rely on the
|
|
91
|
+
// base class render() implementation (current showcase behaviour).
|
|
92
|
+
const renderMethod = options.composition
|
|
93
|
+
? `render() {
|
|
94
|
+
return html\`
|
|
95
|
+
<${options.composition.wrapper} .description=\${this.description}>
|
|
96
|
+
<${options.composition.content} .text=\${this.description.content} .breaks=\${true}></${options.composition.content}>
|
|
97
|
+
</${options.composition.wrapper}>
|
|
98
|
+
\`;
|
|
99
|
+
}`
|
|
100
|
+
: '';
|
|
89
101
|
const componentCode = `
|
|
90
|
-
class MarkdownComponent${i} extends
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
class MarkdownComponent${i} extends ${baseClassName} {
|
|
103
|
+
get description() {
|
|
104
|
+
if (this.__memoized_description !== undefined) return this.__memoized_description;
|
|
105
|
+
this.__memoized_description = {
|
|
94
106
|
title: '${displayName}',
|
|
95
107
|
breadcrumb: [${breadcrumbParts.map((part, idx) => `{
|
|
96
108
|
label: '${generateDisplayName(part)}',
|
|
@@ -100,7 +112,9 @@ import { Memoize } from './src/Decorators/MemoizeDecorator';
|
|
|
100
112
|
meta: components.get('${componentName}')?.meta,
|
|
101
113
|
content: \`${escapeStringForTemplate(contentWithoutMeta)}\`,
|
|
102
114
|
};
|
|
115
|
+
return this.__memoized_description;
|
|
103
116
|
}
|
|
117
|
+
${renderMethod}
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
customElements.define('${componentName}', MarkdownComponent${i});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticContentPlugin.js","sourceRoot":"","sources":["../../../src/plugins/static-content/StaticContentPlugin.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"StaticContentPlugin.js","sourceRoot":"","sources":["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AAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -18,6 +18,33 @@ export interface IStaticContentPluginOptions {
|
|
|
18
18
|
* Optional function to transform paths to URLs.
|
|
19
19
|
*/
|
|
20
20
|
pathTransform?: (path: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional custom shared imports block for the generated virtual module.
|
|
23
|
+
* When not provided, defaults to the built-in imports.
|
|
24
|
+
*/
|
|
25
|
+
sharedImports?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional base class name that generated components extend.
|
|
28
|
+
* Defaults to `BlogBaseElement`.
|
|
29
|
+
*/
|
|
30
|
+
baseClassName?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional composition config. When provided, generated components render
|
|
33
|
+
* using composition instead of relying on a base class `render()` method.
|
|
34
|
+
*
|
|
35
|
+
* The wrapper component receives the description as a property and provides
|
|
36
|
+
* a default slot. The content component renders the markdown text inside that slot.
|
|
37
|
+
*/
|
|
38
|
+
composition?: {
|
|
39
|
+
/**
|
|
40
|
+
* Selector of the wrapper component (e.g. `'blog-viewer'`).
|
|
41
|
+
*/
|
|
42
|
+
wrapper: string;
|
|
43
|
+
/**
|
|
44
|
+
* Selector of the content/markdown component (e.g. `'blog-markdown'`).
|
|
45
|
+
*/
|
|
46
|
+
content: string;
|
|
47
|
+
};
|
|
21
48
|
verbose?: boolean;
|
|
22
49
|
}
|
|
23
50
|
//# sourceMappingURL=IStaticContentPluginOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IStaticContentPluginOptions.d.ts","sourceRoot":"","sources":["../../../../src/plugins/static-content/interfaces/IStaticContentPluginOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAExC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAEzC,OAAO,CAAC,EAAE,OAAO,CAAC;CAErB"}
|
|
1
|
+
{"version":3,"file":"IStaticContentPluginOptions.d.ts","sourceRoot":"","sources":["../../../../src/plugins/static-content/interfaces/IStaticContentPluginOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAExC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAEzC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE;QAEV;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;IAEF,OAAO,CAAC,EAAE,OAAO,CAAC;CAErB"}
|