@breadstone-infrastructure/vite 0.0.137 → 0.0.138
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/2/plugins/LiveReloadPlugin.d.ts.map +1 -0
- package/2/plugins/LiveReloadPlugin.js.map +1 -0
- package/2/plugins/LocalizatorPlugin.d.ts.map +1 -0
- package/2/plugins/LocalizatorPlugin.js.map +1 -0
- package/2/plugins/StaticContentPlugin.d.ts.map +1 -0
- package/2/plugins/StaticContentPlugin.js.map +1 -0
- package/2/plugins/env-export/const/Vercel.d.ts +104 -0
- package/2/plugins/env-export/const/Vercel.d.ts.map +1 -0
- package/2/plugins/env-export/const/Vercel.js +100 -0
- package/2/plugins/env-export/const/Vercel.js.map +1 -0
- package/2/plugins/env-export/envExport.d.ts +4 -0
- package/2/plugins/env-export/envExport.d.ts.map +1 -0
- package/2/plugins/env-export/envExport.js +28 -0
- package/2/plugins/env-export/envExport.js.map +1 -0
- package/2/plugins/env-export/envExportPlugin.d.ts +17 -0
- package/2/plugins/env-export/envExportPlugin.d.ts.map +1 -0
- package/2/plugins/env-export/envExportPlugin.js +32 -0
- package/2/plugins/env-export/envExportPlugin.js.map +1 -0
- package/2/plugins/env-export/interfaces/IEnvExportPluginOptions.d.ts +22 -0
- package/2/plugins/env-export/interfaces/IEnvExportPluginOptions.d.ts.map +1 -0
- package/2/plugins/env-export/interfaces/IEnvExportPluginOptions.js +3 -0
- package/2/plugins/env-export/interfaces/IEnvExportPluginOptions.js.map +1 -0
- package/2/plugins/env-export/types/EnvExportPreset.d.ts +7 -0
- package/2/plugins/env-export/types/EnvExportPreset.d.ts.map +1 -0
- package/2/plugins/env-export/types/EnvExportPreset.js +2 -0
- package/2/plugins/env-export/types/EnvExportPreset.js.map +1 -0
- package/2/plugins/env-export/types/EnvExportPresetFactory.d.ts +3 -0
- package/2/plugins/env-export/types/EnvExportPresetFactory.d.ts.map +1 -0
- package/2/plugins/env-export/types/EnvExportPresetFactory.js +3 -0
- package/2/plugins/env-export/types/EnvExportPresetFactory.js.map +1 -0
- package/2/plugins/env-export/types/EnvExportPresetLike.d.ts +9 -0
- package/2/plugins/env-export/types/EnvExportPresetLike.d.ts.map +1 -0
- package/2/plugins/env-export/types/EnvExportPresetLike.js +3 -0
- package/2/plugins/env-export/types/EnvExportPresetLike.js.map +1 -0
- package/2/plugins/env-export/types/EnvExportRecord.d.ts +7 -0
- package/2/plugins/env-export/types/EnvExportRecord.d.ts.map +1 -0
- package/2/plugins/env-export/types/EnvExportRecord.js +2 -0
- package/2/plugins/env-export/types/EnvExportRecord.js.map +1 -0
- package/2/plugins/live-reload/LiveReloadPlugin.d.ts +11 -0
- package/2/plugins/live-reload/LiveReloadPlugin.d.ts.map +1 -0
- package/2/plugins/live-reload/LiveReloadPlugin.js +62 -0
- package/2/plugins/live-reload/LiveReloadPlugin.js.map +1 -0
- package/2/plugins/live-reload/interfaces/ILiveReloadPluginOptions.d.ts +25 -0
- package/2/plugins/live-reload/interfaces/ILiveReloadPluginOptions.d.ts.map +1 -0
- package/2/plugins/live-reload/interfaces/ILiveReloadPluginOptions.js +2 -0
- package/2/plugins/live-reload/interfaces/ILiveReloadPluginOptions.js.map +1 -0
- package/2/plugins/localizator/LocalizatorPlugin.d.ts +16 -0
- package/2/plugins/localizator/LocalizatorPlugin.d.ts.map +1 -0
- package/2/plugins/localizator/LocalizatorPlugin.js +95 -0
- package/2/plugins/localizator/LocalizatorPlugin.js.map +1 -0
- package/2/plugins/localizator/interfaces/ILocalizatorPluginOptions.d.ts +11 -0
- package/2/plugins/localizator/interfaces/ILocalizatorPluginOptions.d.ts.map +1 -0
- package/2/plugins/localizator/interfaces/ILocalizatorPluginOptions.js +2 -0
- package/2/plugins/localizator/interfaces/ILocalizatorPluginOptions.js.map +1 -0
- package/2/plugins/static-content/StaticContentPlugin.d.ts +16 -0
- package/2/plugins/static-content/StaticContentPlugin.d.ts.map +1 -0
- package/2/plugins/static-content/StaticContentPlugin.js +229 -0
- package/2/plugins/static-content/StaticContentPlugin.js.map +1 -0
- package/2/plugins/static-content/interfaces/IStaticContentPluginOptions.d.ts +23 -0
- package/2/plugins/static-content/interfaces/IStaticContentPluginOptions.d.ts.map +1 -0
- package/2/plugins/static-content/interfaces/IStaticContentPluginOptions.js +2 -0
- package/2/plugins/static-content/interfaces/IStaticContentPluginOptions.js.map +1 -0
- package/CHANGELOG.md +37 -0
- package/Index.d.ts +16 -14
- package/Index.d.ts.map +1 -1
- package/Index.js +11 -10
- package/Index.js.map +1 -1
- package/package.json +8 -5
- package/virtual/env-export.d.ts +5 -0
- package/Plugins/BuildInfoPlugin.d.ts +0 -27
- package/Plugins/BuildInfoPlugin.d.ts.map +0 -1
- package/Plugins/BuildInfoPlugin.js +0 -73
- package/Plugins/BuildInfoPlugin.js.map +0 -1
- package/Plugins/LiveReloadPlugin.d.ts.map +0 -1
- package/Plugins/LiveReloadPlugin.js.map +0 -1
- package/Plugins/LocalizatorPlugin.d.ts.map +0 -1
- package/Plugins/LocalizatorPlugin.js.map +0 -1
- package/Plugins/StaticContentPlugin.d.ts.map +0 -1
- package/Plugins/StaticContentPlugin.js.map +0 -1
- package/virtual__build-info.d.ts +0 -12
- /package/{Plugins → 2/plugins}/LiveReloadPlugin.d.ts +0 -0
- /package/{Plugins → 2/plugins}/LiveReloadPlugin.js +0 -0
- /package/{Plugins → 2/plugins}/LocalizatorPlugin.d.ts +0 -0
- /package/{Plugins → 2/plugins}/LocalizatorPlugin.js +0 -0
- /package/{Plugins → 2/plugins}/StaticContentPlugin.d.ts +0 -0
- /package/{Plugins → 2/plugins}/StaticContentPlugin.js +0 -0
- /package/{virtual__localizator.d.ts → virtual/localizator.d.ts} +0 -0
- /package/{virtual__static-content.d.ts → virtual/static-content.d.ts} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// #region Imports
|
|
2
|
+
import { blue, Path, yellow, FileSystem } from '@breadstone-infrastructure/utilities';
|
|
3
|
+
import { createLogger } from 'vite';
|
|
4
|
+
import { ResourceMode, ResourceReader, ResourceTransformer } from '@breadstone-tools/localizator-core';
|
|
5
|
+
// #endregion
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export const VIRTUAL_MODULE_KEY = 'virtual:localizator.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Vite plugin to scan and transform resource files (e.g., `.resx`) into TypeScript components.
|
|
12
|
+
* To debug/view the generated components, navigate to `http://localhost:8080/@id/virtual:localizator.ts`.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @param options - Plugin configuration
|
|
16
|
+
* @returns Vite-compatible plugin
|
|
17
|
+
*/
|
|
18
|
+
export function localizatorPlugin(options) {
|
|
19
|
+
const logger = createLogger(undefined, { console: console });
|
|
20
|
+
const fileSystem = new FileSystem();
|
|
21
|
+
const reader = new ResourceReader(console, fileSystem);
|
|
22
|
+
const transformer = new ResourceTransformer(console);
|
|
23
|
+
return {
|
|
24
|
+
name: 'vite-plugin-localizator',
|
|
25
|
+
handleHotUpdate(ctx) {
|
|
26
|
+
if (ctx.file.endsWith('.resx')) {
|
|
27
|
+
const module = ctx.server.moduleGraph.getModuleById(VIRTUAL_MODULE_KEY);
|
|
28
|
+
logger.warn(`${yellow('[vite-plugin-localizator]:')} Virtual module: ${module?.id ?? 'not found'}`);
|
|
29
|
+
if (module) {
|
|
30
|
+
ctx.server.moduleGraph.invalidateModule(module);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
logger.warn(`${yellow('[vite-plugin-localizator]:')} Virtual module not found`);
|
|
34
|
+
}
|
|
35
|
+
ctx.server.ws.send({
|
|
36
|
+
type: 'full-reload',
|
|
37
|
+
path: '*'
|
|
38
|
+
});
|
|
39
|
+
logger.info(`${blue('[vite-plugin-localizator]:')} File updated: ${ctx.file}`);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
configureServer(server) {
|
|
43
|
+
server.watcher.on('change', (path) => {
|
|
44
|
+
console.log(`[vite-plugin-localizator]: File changed: ${path}`);
|
|
45
|
+
});
|
|
46
|
+
const paths = Array.isArray(options.paths)
|
|
47
|
+
? options.paths
|
|
48
|
+
: [options.paths];
|
|
49
|
+
for (const globPattern of paths) {
|
|
50
|
+
const resolvedFiles = Path.glob(globPattern);
|
|
51
|
+
for (const file of resolvedFiles) {
|
|
52
|
+
server.watcher.add(file);
|
|
53
|
+
logger.info(`[vite-plugin-localizator]: Watching: ${file}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
resolveId(source) {
|
|
58
|
+
return source === VIRTUAL_MODULE_KEY
|
|
59
|
+
? source
|
|
60
|
+
: null;
|
|
61
|
+
},
|
|
62
|
+
load(id) {
|
|
63
|
+
if (id !== VIRTUAL_MODULE_KEY) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const resxFiles = Path.glob(options.paths)
|
|
67
|
+
.filter((file) => file.endsWith('.resx'));
|
|
68
|
+
const contents = resxFiles.map((file) => {
|
|
69
|
+
logger.info(`[vite-plugin-localizator]: Found resource file: ${file}`);
|
|
70
|
+
const resource = reader.scanFile(file, ResourceMode.Resx);
|
|
71
|
+
if (!resource) {
|
|
72
|
+
logger.warn(`[vite-plugin-localizator]: Resource file not found or invalid: ${file}`);
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
logger.info(`[vite-plugin-localizator]: Scanned resource: ${resource.name} (${resource.locale})`);
|
|
76
|
+
const models = transformer.transform(resource);
|
|
77
|
+
const resourceInfo = transformer.serialize(models, {
|
|
78
|
+
locale: resource.locale,
|
|
79
|
+
name: '',
|
|
80
|
+
path: '',
|
|
81
|
+
target: 'ts'
|
|
82
|
+
});
|
|
83
|
+
return resourceInfo;
|
|
84
|
+
}).filter((x) => x !== null);
|
|
85
|
+
return `
|
|
86
|
+
${contents.map((x) => x.toString()).join('\n\n')}
|
|
87
|
+
|
|
88
|
+
export const translations = {
|
|
89
|
+
${contents.map((c) => `'${c.locale}': _${c.locale}`).join(',\n')},
|
|
90
|
+
};
|
|
91
|
+
`;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=LocalizatorPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalizatorPlugin.js","sourceRoot":"","sources":["../../../../src/2/plugins/localizator/LocalizatorPlugin.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,YAAY,EAAoD,MAAM,MAAM,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGvG,aAAa;AAEb;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAkC;IAChE,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAErD,OAAO;QACH,IAAI,EAAE,yBAAyB;QAC/B,eAAe,CAAC,GAAe;YAC3B,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBACxE,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,4BAA4B,CAAC,oBAAoB,MAAM,EAAE,EA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B,OAAO;cACL,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;;;kBAG1C,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;;aAEnE,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILocalizatorPluginOptions.d.ts","sourceRoot":"","sources":["../../../../../src/2/plugins/localizator/interfaces/ILocalizatorPluginOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,yBAAyB;IAEtC;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B,OAAO,CAAC,EAAE,OAAO,CAAC;CAErB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILocalizatorPluginOptions.js","sourceRoot":"","sources":["../../../../../src/2/plugins/localizator/interfaces/ILocalizatorPluginOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Plugin } from 'vite';
|
|
2
|
+
import type { IStaticContentPluginOptions } from './interfaces/IStaticContentPluginOptions.js';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare const VIRTUAL_MODULE_KEY = "virtual:static-content.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Vite plugin to process Markdown files and expose a component registry, including subfolders.
|
|
9
|
+
* To debug/view the generated components, navigate to `http://localhost:8080/@id/virtual:static-content.ts`.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
* @param options - Plugin options.
|
|
13
|
+
* @returns Vite plugin.
|
|
14
|
+
*/
|
|
15
|
+
export declare function staticContentPlugin(options: IStaticContentPluginOptions): Plugin;
|
|
16
|
+
//# sourceMappingURL=StaticContentPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticContentPlugin.d.ts","sourceRoot":"","sources":["../../../../src/2/plugins/static-content/StaticContentPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgC,KAAK,MAAM,EAAoC,MAAM,MAAM,CAAC;AAEnG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAI/F;;GAEG;AACH,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CA2HhF"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// #region Imports
|
|
2
|
+
import { Path, File, red } from '@breadstone-infrastructure/utilities';
|
|
3
|
+
import { createLogger } from 'vite';
|
|
4
|
+
import matter from 'gray-matter';
|
|
5
|
+
// #endregion
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export const VIRTUAL_MODULE_KEY = 'virtual:static-content.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Vite plugin to process Markdown files and expose a component registry, including subfolders.
|
|
12
|
+
* To debug/view the generated components, navigate to `http://localhost:8080/@id/virtual:static-content.ts`.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @param options - Plugin options.
|
|
16
|
+
* @returns Vite plugin.
|
|
17
|
+
*/
|
|
18
|
+
export function staticContentPlugin(options) {
|
|
19
|
+
const logger = createLogger();
|
|
20
|
+
return {
|
|
21
|
+
name: 'vite-plugin-static-content',
|
|
22
|
+
handleHotUpdate(ctx) {
|
|
23
|
+
if (ctx.file.endsWith('.md')) {
|
|
24
|
+
const module = ctx.server.moduleGraph.getModuleById(VIRTUAL_MODULE_KEY);
|
|
25
|
+
logger.warn(`[vite-plugin-static-content]: Virtual module: ${module?.id ?? 'not found'}`);
|
|
26
|
+
if (module) {
|
|
27
|
+
ctx.server.moduleGraph.invalidateModule(module);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
logger.warn('[vite-plugin-static-content]: Virtual module not found');
|
|
31
|
+
}
|
|
32
|
+
ctx.server.ws.send({
|
|
33
|
+
type: 'full-reload',
|
|
34
|
+
path: '*'
|
|
35
|
+
});
|
|
36
|
+
logger.info(`[vite-plugin-static-content]: File updated: ${ctx.file}`);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
configureServer(server) {
|
|
40
|
+
server.watcher.on('change', (path) => {
|
|
41
|
+
if (options.verbose) {
|
|
42
|
+
console.log('[vite-plugin-static-content] Changed:', path);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const paths = Array.isArray(options.paths) ? options.paths : [options.paths];
|
|
46
|
+
for (const globPattern of paths) {
|
|
47
|
+
const resolvedFiles = Path.glob(globPattern);
|
|
48
|
+
for (const file of resolvedFiles) {
|
|
49
|
+
server.watcher.add(file);
|
|
50
|
+
logger.info(`[vite-plugin-static-content]: Watching: ${file}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
resolveId(source) {
|
|
55
|
+
return source === VIRTUAL_MODULE_KEY
|
|
56
|
+
? source
|
|
57
|
+
: null;
|
|
58
|
+
},
|
|
59
|
+
load(id) {
|
|
60
|
+
if (id === VIRTUAL_MODULE_KEY) {
|
|
61
|
+
const mdFiles = Path.glob(options.paths)
|
|
62
|
+
.filter((file) => file.endsWith('.md'));
|
|
63
|
+
const sharedImports = `
|
|
64
|
+
import { html, LitElement } from 'lit';
|
|
65
|
+
import { customElement } from 'lit/decorators.js';
|
|
66
|
+
import { dateFormat, animate, Animate } from '@breadstone/mosaik-elements-foundation';
|
|
67
|
+
import { BlogBaseElement } from './src/Views/Blog/Abstracts/BlogBase';
|
|
68
|
+
import { Memoize } from './src/Decorators/MemoizeDecorator';
|
|
69
|
+
`.trim();
|
|
70
|
+
let componentsRegistry = 'const components = new Map();';
|
|
71
|
+
const components = mdFiles.map((x, i) => {
|
|
72
|
+
const cwd = options.cwd ?? process.cwd();
|
|
73
|
+
const relativeFilePath = Path.relative(cwd, x);
|
|
74
|
+
const componentName = generateComponentName(relativeFilePath, logger, options);
|
|
75
|
+
const content = File.readAllText(relativeFilePath, 'utf-8');
|
|
76
|
+
const meta = tryGetContentMeta(content, logger, options);
|
|
77
|
+
const contentWithoutMeta = removeMetadata(content);
|
|
78
|
+
const routePath = options.pathTransform
|
|
79
|
+
? options.pathTransform(relativeFilePath)
|
|
80
|
+
: relativeFilePath.replace(/\\/g, '/').replace(/\.md$/, '');
|
|
81
|
+
if (options.verbose) {
|
|
82
|
+
logger.info(`[vite-plugin-static-content]: File transformed: ${relativeFilePath} -> ${routePath}`, {
|
|
83
|
+
timestamp: true,
|
|
84
|
+
clear: true
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const displayName = generateDisplayName(Path.getFileName(relativeFilePath));
|
|
88
|
+
const breadcrumbParts = routePath.split('/');
|
|
89
|
+
const componentCode = `
|
|
90
|
+
class MarkdownComponent${i} extends BlogBaseElement {
|
|
91
|
+
@Memoize()
|
|
92
|
+
protected get description(): ISampleDescription<AnchorElement> {
|
|
93
|
+
return {
|
|
94
|
+
title: '${displayName}',
|
|
95
|
+
breadcrumb: [${breadcrumbParts.map((part, idx) => `{
|
|
96
|
+
label: '${generateDisplayName(part)}',
|
|
97
|
+
href: '/${breadcrumbParts.slice(0, idx + 1).join('/')}'
|
|
98
|
+
}`).join(',\n')}],
|
|
99
|
+
estimatedReadTime: ${estimateReadTime(contentWithoutMeta)},
|
|
100
|
+
meta: components.get('${componentName}')?.meta,
|
|
101
|
+
content: \`${escapeStringForTemplate(contentWithoutMeta)}\`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
customElements.define('${componentName}', MarkdownComponent${i});
|
|
107
|
+
`;
|
|
108
|
+
componentsRegistry += `
|
|
109
|
+
components.set('${componentName}', {
|
|
110
|
+
name: 'MarkdownComponent${i}',
|
|
111
|
+
displayName: '${typeof meta.title === 'string' ? escapeStringForTemplate(meta.title) : displayName}',
|
|
112
|
+
path: '${typeof meta.path === 'string' ? meta.path : `/${routePath}`}',
|
|
113
|
+
selector: '${componentName}',
|
|
114
|
+
meta: ${JSON.stringify(meta)}
|
|
115
|
+
});
|
|
116
|
+
`;
|
|
117
|
+
return componentCode;
|
|
118
|
+
}).join('\n');
|
|
119
|
+
return `
|
|
120
|
+
${sharedImports}
|
|
121
|
+
${componentsRegistry}
|
|
122
|
+
${components}
|
|
123
|
+
export default components;
|
|
124
|
+
`.trim();
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Generates a valid Lit component name, applying an optional prefix.
|
|
132
|
+
*
|
|
133
|
+
* @private
|
|
134
|
+
* @param fileName - The file name of the Markdown file
|
|
135
|
+
* @returns A valid component selector name.
|
|
136
|
+
*/
|
|
137
|
+
function generateComponentName(fileName, logger, options) {
|
|
138
|
+
// if (options.verbose) {
|
|
139
|
+
// logger.info(`[vite-plugin-static-content]: Generating component name for file: ${fileName}`);
|
|
140
|
+
// }
|
|
141
|
+
const baseName = fileName
|
|
142
|
+
.replace(/-md$/, '-doc') // Replace `.md` with `-doc`
|
|
143
|
+
.replace(/^(\.\.\/)+/, '') // Remove relative path indicators
|
|
144
|
+
.replace(/[^a-zA-Z0-9]/g, '-') // Replace unsupported characters with dashes
|
|
145
|
+
.toLowerCase();
|
|
146
|
+
// if (options.verbose) {
|
|
147
|
+
// logger.info(`[vite-plugin-static-content]: Generated component name: ${prefix}${baseName}`);
|
|
148
|
+
// }
|
|
149
|
+
return `${options.prefix ?? ''}${baseName}`;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Escapes special characters in a string to make it TypeScript string-safe.
|
|
153
|
+
*
|
|
154
|
+
* @private
|
|
155
|
+
* @param content - The string content to escape.
|
|
156
|
+
* @returns The escaped string.
|
|
157
|
+
*/
|
|
158
|
+
function escapeStringForTemplate(content) {
|
|
159
|
+
return content
|
|
160
|
+
.replace(/\\/g, '\\\\')
|
|
161
|
+
.replace(/`/g, '\\`')
|
|
162
|
+
.replace(/\${/g, '\\${')
|
|
163
|
+
.replace(/'/g, "\\'")
|
|
164
|
+
.replace(/"/g, '\\"');
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Converts a file or folder name to a user-friendly display name.
|
|
168
|
+
*
|
|
169
|
+
* @private
|
|
170
|
+
* @param segment - The file or folder name to convert.
|
|
171
|
+
* @returns A user-friendly display name.
|
|
172
|
+
*/
|
|
173
|
+
function generateDisplayName(segment) {
|
|
174
|
+
return segment
|
|
175
|
+
.replace(/-/g, ' ') // Replace dashes with spaces
|
|
176
|
+
.replace(/_/g, ' ') // Replace underscores with spaces
|
|
177
|
+
.replace(/\.[^/.]+$/, '') // Remove file extensions
|
|
178
|
+
.replace(/\b\w/g, (char) => char.toUpperCase()); // Capitalize the first letter of each word
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @private
|
|
182
|
+
*/
|
|
183
|
+
function tryGetContentMeta(content, logger, options) {
|
|
184
|
+
try {
|
|
185
|
+
const parsed = matter(content);
|
|
186
|
+
// if (options.verbose) {
|
|
187
|
+
// logger.info(`[vite-plugin-static-content]: Parsed content meta: ${JSON.stringify(parsed.data)}`);
|
|
188
|
+
// }
|
|
189
|
+
return parsed.data;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
logger.error(`[vite-plugin-static-content]: ${red(`Failed to parse content meta: ${String(error)}`)}`);
|
|
193
|
+
return {};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
function removeMetadata(content) {
|
|
200
|
+
const matterMatch = (/---\n([\s\S]*?)\n---/).exec(content);
|
|
201
|
+
if (matterMatch) {
|
|
202
|
+
return content.replace(matterMatch[0], '').trim();
|
|
203
|
+
}
|
|
204
|
+
return content.trim();
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Calculates estimated reading time for a given Markdown text.
|
|
208
|
+
*
|
|
209
|
+
* @private
|
|
210
|
+
* @param markdown - The Markdown content.
|
|
211
|
+
* @param wordsPerMinute - The average reading speed in words per minute (default: 200).
|
|
212
|
+
* @returns Estimated reading time in minutes.
|
|
213
|
+
*/
|
|
214
|
+
function estimateReadTime(markdown, wordsPerMinute = 100) {
|
|
215
|
+
if (!markdown) {
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
218
|
+
// Strip out code blocks, front matter, and HTML tags
|
|
219
|
+
const textOnly = markdown
|
|
220
|
+
// .replace(/`{3}[\s\S]*?`{3}/g, '') // Remove code blocks
|
|
221
|
+
// .replace(/`[^`]*`/g, '') // Remove inline code
|
|
222
|
+
// .replace(/<[^>]+>/g, '') // Remove HTML tags
|
|
223
|
+
.replace(/---[\s\S]*?---/g, '') // Remove front matter
|
|
224
|
+
.replace(/\s+/g, ' ') // Normalize whitespace
|
|
225
|
+
.trim();
|
|
226
|
+
const wordCount = textOnly.split(' ').filter((word) => word.length > 0).length;
|
|
227
|
+
return Math.max(1, Math.ceil(wordCount / wordsPerMinute));
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=StaticContentPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticContentPlugin.js","sourceRoot":"","sources":["../../../../src/2/plugins/static-content/StaticContentPlugin.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAiE,YAAY,EAAE,MAAM,MAAM,CAAC;AACnG,OAAO,MAAM,MAAM,aAAa,C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AAED;;;;;;;GAOG;AACH,SAAS,gBAAgB,CAAC,QAAgB,EAAE,iBAAyB,GAAG;IACpE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,CAAC,CAAC;IACb,CAAC;IAED,qDAAqD;IACrD,MAAM,QAAQ,GAAG,QAAQ;QACrB,2DAA2D;QAC3D,2DAA2D;QAC3D,yDAAyD;SACxD,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAI,sBAAsB;SACxD,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAc,uBAAuB;SACzD,IAAI,EAAE,CAAC;IAEZ,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;IAE/E,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
export interface IStaticContentPluginOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The current working directory.
|
|
7
|
+
*/
|
|
8
|
+
cwd?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Directory containing markdown files.
|
|
11
|
+
*/
|
|
12
|
+
paths: string | Array<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Optional prefix for component selectors.
|
|
15
|
+
*/
|
|
16
|
+
prefix?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional function to transform paths to URLs.
|
|
19
|
+
*/
|
|
20
|
+
pathTransform?: (path: string) => string;
|
|
21
|
+
verbose?: boolean;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=IStaticContentPluginOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStaticContentPluginOptions.d.ts","sourceRoot":"","sources":["../../../../../src/2/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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStaticContentPluginOptions.js","sourceRoot":"","sources":["../../../../../src/2/plugins/static-content/interfaces/IStaticContentPluginOptions.ts"],"names":[],"mappings":""}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## 0.0.137 (2025-09-05)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **build:** add support for custom environment variables in build info ([e5554f85af](https://github.com/RueDeRennes/mosaik/commit/e5554f85af))
|
|
6
|
+
- **build:** add environment variable sanitization to build summary ([b2f1e0830e](https://github.com/RueDeRennes/mosaik/commit/b2f1e0830e))
|
|
7
|
+
|
|
8
|
+
## 0.0.136 (2025-09-04)
|
|
9
|
+
|
|
10
|
+
### 🚀 Features
|
|
11
|
+
|
|
12
|
+
- add comprehensive coding standards for backend, frontend, and testing ([3987d97056](https://github.com/RueDeRennes/mosaik/commit/3987d97056))
|
|
13
|
+
- integrate build info into AppElement and update template to display build metadata ([afff580948](https://github.com/RueDeRennes/mosaik/commit/afff580948))
|
|
14
|
+
|
|
15
|
+
### 🩹 Fixes
|
|
16
|
+
|
|
17
|
+
- standardize padding-top property in Banner styles and templates ([377e883410](https://github.com/RueDeRennes/mosaik/commit/377e883410))
|
|
18
|
+
|
|
19
|
+
## 0.0.135 (2025-09-03)
|
|
20
|
+
|
|
21
|
+
### 🚀 Features
|
|
22
|
+
|
|
23
|
+
- add build info plugin for Vite to collect and expose build metadata ([888ea8b254](https://github.com/RueDeRennes/mosaik/commit/888ea8b254))
|
|
24
|
+
|
|
25
|
+
### 🩹 Fixes
|
|
26
|
+
|
|
27
|
+
- enhance build info logging format and update release version to 0.0.135 ([61b1c86643](https://github.com/RueDeRennes/mosaik/commit/61b1c86643))
|
|
28
|
+
- add missing newline at end of package.json ([cf3b9a3f21](https://github.com/RueDeRennes/mosaik/commit/cf3b9a3f21))
|
|
29
|
+
|
|
30
|
+
## 0.0.134 (2025-09-01)
|
|
31
|
+
|
|
32
|
+
### 🚀 Features
|
|
33
|
+
|
|
34
|
+
- Add ThemeService for managing theme application and properties ([a3cb9be861](https://github.com/RueDeRennes/mosaik/commit/a3cb9be861))
|
|
35
|
+
- Add new Map and Thumbnail components with Cosmopolitan, Joy, and Retro themes ([5142fee885](https://github.com/RueDeRennes/mosaik/commit/5142fee885))
|
|
36
|
+
- add serve scripts for app and API in package.json ([1ad4faa834](https://github.com/RueDeRennes/mosaik/commit/1ad4faa834))
|
|
37
|
+
|
|
1
38
|
## 0.0.132 (2025-08-24)
|
|
2
39
|
|
|
3
40
|
This was a version bump only for vite-plugins to align it with other projects, there were no code changes.
|
package/Index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
|
|
1
|
+
export { VIRTUAL_MODULE_KEY as STATIC_CONTENT_VIRTUAL_MODULE_KEY } from './2/plugins/static-content/StaticContentPlugin.js';
|
|
2
|
+
export type { IStaticContentPluginOptions } from './2/plugins/static-content/interfaces/IStaticContentPluginOptions.js';
|
|
3
|
+
export { staticContentPlugin } from './2/plugins/static-content/StaticContentPlugin.js';
|
|
4
|
+
export type { ILiveReloadPluginOptions } from './2/plugins/live-reload/interfaces/ILiveReloadPluginOptions.js';
|
|
5
|
+
export { liveReloadPlugin } from './2/plugins/live-reload/LiveReloadPlugin.js';
|
|
6
|
+
export { VIRTUAL_MODULE_KEY as LOCALIZATOR_VIRTUAL_MODULE_KEY } from './2/plugins/localizator/LocalizatorPlugin.js';
|
|
7
|
+
export type { ILocalizatorPluginOptions } from './2/plugins/localizator/interfaces/ILocalizatorPluginOptions.js';
|
|
8
|
+
export { localizatorPlugin } from './2/plugins/localizator/LocalizatorPlugin.js';
|
|
9
|
+
export { run as envExportRun } from './2/plugins/env-export/envExport.js';
|
|
10
|
+
export { VIRTUAL_MODULE_KEY as ENV_EXPORT_VIRTUAL_MODULE_KEY, envExportPlugin } from './2/plugins/env-export/envExportPlugin.js';
|
|
11
|
+
export type { IEnvExportPluginOptions } from './2/plugins/env-export/interfaces/IEnvExportPluginOptions.js';
|
|
12
|
+
export { VercelPresetKeys } from './2/plugins/env-export/const/Vercel.js';
|
|
13
|
+
export type { EnvExportPreset } from './2/plugins/env-export/types/EnvExportPreset.js';
|
|
14
|
+
import './virtual/localizator.d.ts';
|
|
15
|
+
import './virtual/static-content.d.ts';
|
|
16
|
+
import './virtual/env-export.d.ts';
|
|
15
17
|
//# 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,YAAY,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,iCAAiC,EAAE,MAAM,mDAAmD,CAAC;AAC5H,YAAY,EAAE,2BAA2B,EAAE,MAAM,sEAAsE,CAAC;AACxH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAExF,YAAY,EAAE,wBAAwB,EAAE,MAAM,gEAAgE,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E,OAAO,EAAE,kBAAkB,IAAI,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AACpH,YAAY,EAAE,yBAAyB,EAAE,MAAM,iEAAiE,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,IAAI,6BAA6B,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AACjI,YAAY,EAAE,uBAAuB,EAAE,MAAM,8DAA8D,CAAC;AAC5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,YAAY,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAEvF,OAAO,4BAA4B,CAAC;AACpC,OAAO,+BAA+B,CAAC;AACvC,OAAO,2BAA2B,CAAC"}
|
package/Index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export { VIRTUAL_MODULE_KEY as STATIC_CONTENT_VIRTUAL_MODULE_KEY } from './2/plugins/static-content/StaticContentPlugin.js';
|
|
2
|
+
export { staticContentPlugin } from './2/plugins/static-content/StaticContentPlugin.js';
|
|
3
|
+
export { liveReloadPlugin } from './2/plugins/live-reload/LiveReloadPlugin.js';
|
|
4
|
+
export { VIRTUAL_MODULE_KEY as LOCALIZATOR_VIRTUAL_MODULE_KEY } from './2/plugins/localizator/LocalizatorPlugin.js';
|
|
5
|
+
export { localizatorPlugin } from './2/plugins/localizator/LocalizatorPlugin.js';
|
|
6
|
+
export { run as envExportRun } from './2/plugins/env-export/envExport.js';
|
|
7
|
+
export { VIRTUAL_MODULE_KEY as ENV_EXPORT_VIRTUAL_MODULE_KEY, envExportPlugin } from './2/plugins/env-export/envExportPlugin.js';
|
|
8
|
+
export { VercelPresetKeys } from './2/plugins/env-export/const/Vercel.js';
|
|
9
|
+
import './virtual/localizator.d.ts';
|
|
10
|
+
import './virtual/static-content.d.ts';
|
|
11
|
+
import './virtual/env-export.d.ts';
|
|
11
12
|
//# sourceMappingURL=Index.js.map
|
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":"AAAA,OAAO,EAAE,kBAAkB,IAAI,iCAAiC,EAAE,MAAM,mDAAmD,CAAC;AAE5H,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAGxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E,OAAO,EAAE,kBAAkB,IAAI,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAEpH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF,OAAO,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,IAAI,6BAA6B,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAEjI,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAG1E,OAAO,4BAA4B,CAAC;AACpC,OAAO,+BAA+B,CAAC;AACvC,OAAO,2BAA2B,CAAC"}
|
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.138",
|
|
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.138",
|
|
16
|
+
"@breadstone-tools/localizator-core": "^0.0.138",
|
|
17
17
|
"gray-matter": "^4.0.3"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
@@ -25,10 +25,13 @@
|
|
|
25
25
|
"types": "./Index.d.ts"
|
|
26
26
|
},
|
|
27
27
|
"./virtual/localizator": {
|
|
28
|
-
"types": "./
|
|
28
|
+
"types": "./virtual/localizator.d.ts"
|
|
29
29
|
},
|
|
30
30
|
"./virtual/static-content": {
|
|
31
|
-
"types": "./
|
|
31
|
+
"types": "./virtual/static-content.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./virtual/env-export": {
|
|
34
|
+
"types": "./virtual/env-export.d.ts"
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export declare const VIRTUAL_MODULE_KEY = "virtual:build-info.ts";
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export interface IBuildInfoPluginOptions {
|
|
10
|
-
/**
|
|
11
|
-
* The name of the application.
|
|
12
|
-
*/
|
|
13
|
-
app: string;
|
|
14
|
-
/**
|
|
15
|
-
* Custom environment (keys) variables to include in the build info.
|
|
16
|
-
*/
|
|
17
|
-
extended?: Array<string>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Build information plugin for Vite/Vercel.
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
* @param options - Plugin options.
|
|
24
|
-
* @returns Vite plugin.
|
|
25
|
-
*/
|
|
26
|
-
export declare function buildInfoPlugin(options: IBuildInfoPluginOptions): Plugin;
|
|
27
|
-
//# sourceMappingURL=BuildInfoPlugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildInfoPlugin.d.ts","sourceRoot":"","sources":["../../src/Plugins/BuildInfoPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAMnC;;GAEG;AACH,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IAEpC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAE5B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAkBxE"}
|