@breadstone-infrastructure/vite 0.0.31 → 0.0.33
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/Plugins/LiveReload.d.ts.map +1 -1
- package/Plugins/LiveReload.js +13 -1
- package/Plugins/LiveReload.js.map +1 -1
- package/Plugins/StaticContent.d.ts +2 -2
- package/Plugins/StaticContent.d.ts.map +1 -1
- package/Plugins/StaticContent.js +103 -51
- package/Plugins/StaticContent.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveReload.d.ts","sourceRoot":"","sources":["../../src/Plugins/LiveReload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAMlD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IAErC;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,wBAAwB,KAAG,
|
|
1
|
+
{"version":3,"file":"LiveReload.d.ts","sourceRoot":"","sources":["../../src/Plugins/LiveReload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAMlD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IAErC;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,wBAAwB,KAAG,MA+CnE,CAAC"}
|
package/Plugins/LiveReload.js
CHANGED
|
@@ -8,6 +8,18 @@ export const liveReloadPlugin = (options) => ({
|
|
|
8
8
|
name: 'vite-plugin-live-reload',
|
|
9
9
|
configureServer({ ws, config: { root: viteRoot, logger } }) {
|
|
10
10
|
const root = options.root ?? viteRoot;
|
|
11
|
+
if (!options.root) {
|
|
12
|
+
logger.info(`[vite-plugin-live-reload] No root specified, using Vite's root: ${viteRoot}`, {
|
|
13
|
+
clear: true,
|
|
14
|
+
timestamp: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
logger.info(`[vite-plugin-live-reload] Using root: ${root}`, {
|
|
19
|
+
clear: true,
|
|
20
|
+
timestamp: true
|
|
21
|
+
});
|
|
22
|
+
}
|
|
11
23
|
const logChanges = options.log ?? true;
|
|
12
24
|
const reload = (filePath) => {
|
|
13
25
|
ws.send({
|
|
@@ -15,7 +27,7 @@ export const liveReloadPlugin = (options) => ({
|
|
|
15
27
|
path: options.alwaysReload ? '*' : filePath
|
|
16
28
|
});
|
|
17
29
|
if (logChanges) {
|
|
18
|
-
logger.info(`Page reload ${getShortName(filePath, root)}`, {
|
|
30
|
+
logger.info(`[vite-plugin-live-reload] Page reload ${getShortName(filePath, root)}`, {
|
|
19
31
|
clear: true,
|
|
20
32
|
timestamp: true
|
|
21
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveReload.js","sourceRoot":"","sources":["../../src/Plugins/LiveReload.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAGlB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAiCzE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAiC,EAAU,EAAE,CAAC,CAAC;IAC5E,IAA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;aAC9C,CAAC,CAAC;YAEH,IAAI,UAAU,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC,yCAAyC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;oBACjF,KAAK,EAAE,IAAI;oBACX,SAAS,EAAE,IAAI;iBAClB,CAAC,CAAC;YACP,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC;YAClC,IAAI,EAAE,IAAI;YACV,qBAAqB,EAAE,IAAI;YAC3B,MAAM,EAAE,OAAO,CAAC,KAAK;SACxB,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAE9B,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;CACJ,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,YAAY,CAAC,IAAY,EAAE,IAAY;IAC5C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAChF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Plugin } from 'vite';
|
|
2
|
-
export declare const VIRTUAL_MODULE_KEY = "virtual:static-content";
|
|
2
|
+
export declare const VIRTUAL_MODULE_KEY = "virtual:static-content.ts";
|
|
3
3
|
export interface IStaticContentPluginOptions {
|
|
4
4
|
/**
|
|
5
5
|
* The current working directory.
|
|
@@ -22,7 +22,7 @@ export interface IStaticContentPluginOptions {
|
|
|
22
22
|
/**
|
|
23
23
|
* Vite plugin to process Markdown files and expose a component registry, including subfolders.
|
|
24
24
|
*
|
|
25
|
-
* To debug/view the generated components, navigate to `http://localhost:8080/@id/virtual:static-content`.
|
|
25
|
+
* To debug/view the generated components, navigate to `http://localhost:8080/@id/virtual:static-content.ts`.
|
|
26
26
|
*/
|
|
27
27
|
export declare function staticContentPlugin(options: IStaticContentPluginOptions): Plugin;
|
|
28
28
|
//# sourceMappingURL=StaticContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticContent.d.ts","sourceRoot":"","sources":["../../src/Plugins/StaticContent.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"StaticContent.d.ts","sourceRoot":"","sources":["../../src/Plugins/StaticContent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgC,KAAK,MAAM,EAAoC,MAAM,MAAM,CAAC;AAKnG,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D,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;CACrB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CA4HhF"}
|
package/Plugins/StaticContent.js
CHANGED
|
@@ -1,22 +1,47 @@
|
|
|
1
1
|
// #region Imports
|
|
2
|
-
import { Path, File } from '@breadstone-infrastructure/utilities';
|
|
2
|
+
import { Path, File, red } from '@breadstone-infrastructure/utilities';
|
|
3
3
|
import { createLogger } from 'vite';
|
|
4
4
|
import matter from 'gray-matter';
|
|
5
5
|
// #endregion
|
|
6
|
-
export const VIRTUAL_MODULE_KEY = 'virtual:static-content';
|
|
6
|
+
export const VIRTUAL_MODULE_KEY = 'virtual:static-content.ts';
|
|
7
7
|
/**
|
|
8
8
|
* Vite plugin to process Markdown files and expose a component registry, including subfolders.
|
|
9
9
|
*
|
|
10
|
-
* To debug/view the generated components, navigate to `http://localhost:8080/@id/virtual:static-content`.
|
|
10
|
+
* To debug/view the generated components, navigate to `http://localhost:8080/@id/virtual:static-content.ts`.
|
|
11
11
|
*/
|
|
12
12
|
export function staticContentPlugin(options) {
|
|
13
13
|
const logger = createLogger();
|
|
14
14
|
return {
|
|
15
|
-
name: 'vite-plugin-
|
|
16
|
-
handleHotUpdate(
|
|
17
|
-
if (file.endsWith('.md')) {
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
name: 'vite-plugin-static-content',
|
|
16
|
+
handleHotUpdate(ctx) {
|
|
17
|
+
if (ctx.file.endsWith('.md')) {
|
|
18
|
+
logger.info(`[vite-plugin-static-content]: Markdown updated: ${ctx.file}`);
|
|
19
|
+
const module = ctx.server.moduleGraph.getModuleById(VIRTUAL_MODULE_KEY);
|
|
20
|
+
logger.warn(`[vite-plugin-static-content]: Virtual module: ${module?.id ?? 'not found'}`);
|
|
21
|
+
if (module) {
|
|
22
|
+
ctx.server.moduleGraph.invalidateModule(module);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
logger.warn('[vite-plugin-static-content]: Virtual module not found');
|
|
26
|
+
}
|
|
27
|
+
ctx.server.ws.send({
|
|
28
|
+
type: 'full-reload',
|
|
29
|
+
path: '*'
|
|
30
|
+
});
|
|
31
|
+
logger.info(`[vite-plugin-static-content]: File updated: ${ctx.file}`);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
configureServer(server) {
|
|
35
|
+
server.watcher.on('change', (path) => {
|
|
36
|
+
console.log('[vite-plugin-static-content] Changed:', path);
|
|
37
|
+
});
|
|
38
|
+
const paths = Array.isArray(options.paths) ? options.paths : [options.paths];
|
|
39
|
+
for (const globPattern of paths) {
|
|
40
|
+
const resolvedFiles = Path.glob(globPattern);
|
|
41
|
+
for (const file of resolvedFiles) {
|
|
42
|
+
server.watcher.add(file);
|
|
43
|
+
logger.info(`[vite-plugin-static-content]: Watching: ${file}`);
|
|
44
|
+
}
|
|
20
45
|
}
|
|
21
46
|
},
|
|
22
47
|
resolveId(source) {
|
|
@@ -30,9 +55,12 @@ export function staticContentPlugin(options) {
|
|
|
30
55
|
const mdFiles = Path.glob(options.paths)
|
|
31
56
|
.filter((file) => file.endsWith('.md'));
|
|
32
57
|
const sharedImports = `
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
import { html, LitElement } from 'lit';
|
|
59
|
+
import { customElement } from 'lit/decorators.js';
|
|
60
|
+
import { dateFormat, animate, Animate } from '@breadstone/mosaik-elements-foundation';
|
|
61
|
+
import { BlogBaseElement } from './src/Views/Blog/Abstracts/BlogBase';
|
|
62
|
+
import { Memoize } from './src/Decorators/MemoizeDecorator';
|
|
63
|
+
`.trim();
|
|
36
64
|
let componentsRegistry = 'const components = new Map();';
|
|
37
65
|
const components = mdFiles.map((x, i) => {
|
|
38
66
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -40,37 +68,32 @@ export function staticContentPlugin(options) {
|
|
|
40
68
|
const componentName = generateComponentName(relativeFilePath, options.prefix ?? '', logger, options);
|
|
41
69
|
const content = File.readAllText(relativeFilePath, 'utf-8');
|
|
42
70
|
const meta = tryGetContentMeta(content, logger, options);
|
|
71
|
+
const contentWithoutMeta = removeMetadata(content);
|
|
43
72
|
const routePath = options.pathTransform
|
|
44
73
|
? options.pathTransform(relativeFilePath)
|
|
45
74
|
: relativeFilePath.replace(/\\/g, '/').replace(/\.md$/, '');
|
|
75
|
+
if (options.verbose) {
|
|
76
|
+
logger.info(`[vite-plugin-static-content]: File transformed: ${relativeFilePath} -> ${routePath}`, {
|
|
77
|
+
timestamp: true,
|
|
78
|
+
clear: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
46
81
|
const displayName = generateDisplayName(Path.getFileName(relativeFilePath));
|
|
47
82
|
const breadcrumbParts = routePath.split('/');
|
|
48
|
-
const breadcrumbHtml = breadcrumbParts.map((part, idx) => {
|
|
49
|
-
const href = `/${breadcrumbParts.slice(0, idx + 1).join('/')}`;
|
|
50
|
-
const label = generateDisplayName(part);
|
|
51
|
-
return `<mosaik-breadcrumb-item ${idx === breadcrumbParts.length - 1 ? 'isActive' : ''}>
|
|
52
|
-
<mosaik-button href="${href}" label="${label}"></mosaik-button>
|
|
53
|
-
</mosaik-breadcrumb-item>`;
|
|
54
|
-
})
|
|
55
|
-
.join('');
|
|
56
83
|
const componentCode = `
|
|
57
|
-
class MarkdownComponent${i} extends
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<app-markdown text="${escapeStringForTemplate(content)}" breaks="true"></app-markdown>
|
|
71
|
-
</mosaik-page-content>
|
|
72
|
-
</mosaik-page>
|
|
73
|
-
\`;
|
|
84
|
+
class MarkdownComponent${i} extends BlogBaseElement {
|
|
85
|
+
@Memoize()
|
|
86
|
+
protected get description(): ISampleDescription<AnchorElement> {
|
|
87
|
+
return {
|
|
88
|
+
title: '${displayName}',
|
|
89
|
+
breadcrumb: [${breadcrumbParts.map((part, idx) => `{
|
|
90
|
+
label: '${generateDisplayName(part)}',
|
|
91
|
+
href: '/${breadcrumbParts.slice(0, idx + 1).join('/')}'
|
|
92
|
+
}`).join(',\n')}],
|
|
93
|
+
estimatedReadTime: ${estimateReadTime(contentWithoutMeta)},
|
|
94
|
+
meta: components.get('${componentName}')?.meta,
|
|
95
|
+
content: \`${escapeStringForTemplate(contentWithoutMeta)}\`,
|
|
96
|
+
};
|
|
74
97
|
}
|
|
75
98
|
}
|
|
76
99
|
|
|
@@ -80,19 +103,19 @@ export function staticContentPlugin(options) {
|
|
|
80
103
|
components.set('${componentName}', {
|
|
81
104
|
name: 'MarkdownComponent${i}',
|
|
82
105
|
displayName: '${typeof meta.title === 'string' ? meta.title : displayName}',
|
|
83
|
-
path: '${typeof meta.
|
|
84
|
-
selector: '${componentName}'
|
|
106
|
+
path: '${typeof meta.path === 'string' ? meta.path : `/${routePath}`}',
|
|
107
|
+
selector: '${componentName}',
|
|
108
|
+
meta: ${JSON.stringify(meta)}
|
|
85
109
|
});
|
|
86
110
|
`;
|
|
87
111
|
return componentCode;
|
|
88
|
-
})
|
|
89
|
-
.join('\n');
|
|
112
|
+
}).join('\n');
|
|
90
113
|
return `
|
|
91
114
|
${sharedImports}
|
|
92
115
|
${componentsRegistry}
|
|
93
116
|
${components}
|
|
94
117
|
export default components;
|
|
95
|
-
|
|
118
|
+
`.trim();
|
|
96
119
|
}
|
|
97
120
|
return null;
|
|
98
121
|
}
|
|
@@ -106,17 +129,17 @@ export function staticContentPlugin(options) {
|
|
|
106
129
|
* @returns A valid component selector name.
|
|
107
130
|
*/
|
|
108
131
|
function generateComponentName(fileName, prefix, logger, options) {
|
|
109
|
-
if (options.verbose) {
|
|
110
|
-
|
|
111
|
-
}
|
|
132
|
+
// if (options.verbose) {
|
|
133
|
+
// logger.info(`[vite-plugin-static-content]: Generating component name for file: ${fileName}`);
|
|
134
|
+
// }
|
|
112
135
|
const baseName = fileName
|
|
113
136
|
.replace(/-md$/, '-doc') // Replace `.md` with `-doc`
|
|
114
137
|
.replace(/^(\.\.\/)+/, '') // Remove relative path indicators
|
|
115
138
|
.replace(/[^a-zA-Z0-9]/g, '-') // Replace unsupported characters with dashes
|
|
116
139
|
.toLowerCase();
|
|
117
|
-
if (options.verbose) {
|
|
118
|
-
|
|
119
|
-
}
|
|
140
|
+
// if (options.verbose) {
|
|
141
|
+
// logger.info(`[vite-plugin-static-content]: Generated component name: ${prefix}${baseName}`);
|
|
142
|
+
// }
|
|
120
143
|
return `${prefix}${baseName}`;
|
|
121
144
|
}
|
|
122
145
|
/**
|
|
@@ -147,14 +170,43 @@ function generateDisplayName(segment) {
|
|
|
147
170
|
function tryGetContentMeta(content, logger, options) {
|
|
148
171
|
try {
|
|
149
172
|
const parsed = matter(content);
|
|
150
|
-
if (options.verbose) {
|
|
151
|
-
|
|
152
|
-
}
|
|
173
|
+
// if (options.verbose) {
|
|
174
|
+
// logger.info(`[vite-plugin-static-content]: Parsed content meta: ${JSON.stringify(parsed.data)}`);
|
|
175
|
+
// }
|
|
153
176
|
return parsed.data;
|
|
154
177
|
}
|
|
155
178
|
catch (error) {
|
|
156
|
-
logger.error(`Failed to parse content meta: ${String(error)}`);
|
|
179
|
+
logger.error(`[vite-plugin-static-content]: ${red(`Failed to parse content meta: ${String(error)}`)}`);
|
|
157
180
|
return {};
|
|
158
181
|
}
|
|
159
182
|
}
|
|
183
|
+
function removeMetadata(content) {
|
|
184
|
+
const matterMatch = (/---\n([\s\S]*?)\n---/).exec(content);
|
|
185
|
+
if (matterMatch) {
|
|
186
|
+
return content.replace(matterMatch[0], '').trim();
|
|
187
|
+
}
|
|
188
|
+
return content.trim();
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Calculates estimated reading time for a given Markdown text.
|
|
192
|
+
*
|
|
193
|
+
* @param markdown - The Markdown content.
|
|
194
|
+
* @param wordsPerMinute - The average reading speed in words per minute (default: 200).
|
|
195
|
+
* @returns Estimated reading time in minutes.
|
|
196
|
+
*/
|
|
197
|
+
function estimateReadTime(markdown, wordsPerMinute = 100) {
|
|
198
|
+
if (!markdown) {
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
// Strip out code blocks, front matter, and HTML tags
|
|
202
|
+
const textOnly = markdown
|
|
203
|
+
// .replace(/`{3}[\s\S]*?`{3}/g, '') // Remove code blocks
|
|
204
|
+
// .replace(/`[^`]*`/g, '') // Remove inline code
|
|
205
|
+
// .replace(/<[^>]+>/g, '') // Remove HTML tags
|
|
206
|
+
.replace(/---[\s\S]*?---/g, '') // Remove front matter
|
|
207
|
+
.replace(/\s+/g, ' ') // Normalize whitespace
|
|
208
|
+
.trim();
|
|
209
|
+
const wordCount = textOnly.split(' ').filter((word) => word.length > 0).length;
|
|
210
|
+
return Math.max(1, Math.ceil(wordCount / wordsPerMinute));
|
|
211
|
+
}
|
|
160
212
|
//# sourceMappingURL=StaticContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticContent.js","sourceRoot":"","sources":["../../src/Plugins/StaticContent.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"StaticContent.js","sourceRoot":"","sources":["../../src/Plugins/StaticContent.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,CAAC;AAEjC,aAAa;AAEb,MAAM,CAAC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AA2B9D;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAoC;IACpE,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,OAAO;QACH,IAAI,EAAE,4BAA4B;QAClC,eAAe,CAAC,GAAe;YAC3B,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,mDAAmD,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;gBAE3E,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;gBACxE,MAAM,CAAC,IAA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/E,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC;AAC9D,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.33",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
|
|
7
7
|
"repository": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"module": "./Index.js",
|
|
13
13
|
"types": "./Index.d.ts",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@breadstone-infrastructure/utilities": "^0.0.
|
|
15
|
+
"@breadstone-infrastructure/utilities": "^0.0.33",
|
|
16
16
|
"gray-matter": "^4.0.3"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|