@qualcomm-ui/mdx-vite 2.10.1 → 2.11.0
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/dist/cli.js +274 -23
- package/dist/cli.js.map +3 -3
- package/dist/docs-plugin/internal/config-schema.d.ts +40 -0
- package/dist/docs-plugin/internal/config-schema.d.ts.map +1 -1
- package/dist/docs-plugin/types.d.ts +61 -3
- package/dist/docs-plugin/types.d.ts.map +1 -1
- package/dist/index.js +100 -45
- package/dist/index.js.map +3 -3
- package/dist/open-web-ui-knowledge/common.d.ts +25 -0
- package/dist/open-web-ui-knowledge/common.d.ts.map +1 -1
- package/dist/open-web-ui-knowledge/generate-knowledge.d.ts.map +1 -1
- package/dist/open-web-ui-knowledge/load-config-from-env.d.ts +29 -0
- package/dist/open-web-ui-knowledge/load-config-from-env.d.ts.map +1 -1
- package/dist/open-web-ui-knowledge/types.d.ts +34 -0
- package/dist/open-web-ui-knowledge/types.d.ts.map +1 -1
- package/dist/open-web-ui-knowledge/upload-knowledge.d.ts.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,38 @@ export declare const configSchema: z.ZodObject<{
|
|
|
8
8
|
headings: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"h1">, z.ZodLiteral<"h2">, z.ZodLiteral<"h3">, z.ZodLiteral<"h4">, z.ZodLiteral<"h5">, z.ZodLiteral<"h6">]>>>;
|
|
9
9
|
hotUpdateIgnore: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
10
10
|
knowledge: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
environments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
+
exports: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
18
|
+
extraFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
19
|
+
contents: z.ZodString;
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
processAsMdx: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
title: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>>>;
|
|
24
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
25
|
+
pageTitlePrefix: z.ZodOptional<z.ZodString>;
|
|
26
|
+
staticPath: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
extraFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
+
contents: z.ZodString;
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
processAsMdx: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
title: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>>>;
|
|
34
|
+
frontmatterFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
37
|
+
name: z.ZodOptional<z.ZodString>;
|
|
38
|
+
outputMode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"per-page">, z.ZodLiteral<"aggregated">]>>;
|
|
39
|
+
outputPath: z.ZodString;
|
|
40
|
+
pageIdPrefix: z.ZodOptional<z.ZodString>;
|
|
41
|
+
pageTitlePrefix: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>>>;
|
|
11
43
|
global: z.ZodOptional<z.ZodObject<{
|
|
12
44
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
13
45
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -31,12 +63,20 @@ export declare const configSchema: z.ZodObject<{
|
|
|
31
63
|
processAsMdx: z.ZodOptional<z.ZodBoolean>;
|
|
32
64
|
title: z.ZodOptional<z.ZodString>;
|
|
33
65
|
}, z.core.$strip>>>;
|
|
66
|
+
frontmatterFields: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodAny]>>;
|
|
34
67
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
35
68
|
name: z.ZodOptional<z.ZodString>;
|
|
36
69
|
outputMode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"per-page">, z.ZodLiteral<"aggregated">]>>;
|
|
37
70
|
outputPath: z.ZodOptional<z.ZodString>;
|
|
71
|
+
pageIdPrefix: z.ZodOptional<z.ZodString>;
|
|
38
72
|
pageTitlePrefix: z.ZodOptional<z.ZodString>;
|
|
39
73
|
}, z.core.$strip>>;
|
|
74
|
+
integrations: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
openWebUi: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
76
|
+
envFile: z.ZodOptional<z.ZodString>;
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
}, z.core.$strip>>>;
|
|
79
|
+
}, z.core.$strip>>;
|
|
40
80
|
}, z.core.$strip>>;
|
|
41
81
|
navConfig: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodType<RouteMeta, unknown, z.core.$ZodTypeInternals<RouteMeta, unknown>>, z.ZodObject<{}, z.core.$strip>]>>>;
|
|
42
82
|
pageDirectory: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/internal/config-schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAC,MAAM,KAAK,CAAA;AAErD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/internal/config-schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAC,MAAM,KAAK,CAAA;AAErD,OAAO,KAAK,EAWV,SAAS,EACV,MAAM,UAAU,CAAA;AAIjB,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,EAAE,CAItC,CAAA;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,SAAS,CAmB7C,CAAA;AA0EJ,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BvB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PageFrontmatter, TocHeading } from "@qualcomm-ui/mdx-common";
|
|
1
|
+
import type { KnowledgePageData, PageFrontmatter, TocHeading } from "@qualcomm-ui/mdx-common";
|
|
2
2
|
import type { QuiPropTypes } from "@qualcomm-ui/typedoc-common";
|
|
3
3
|
export type RoutingStrategy = "vite-generouted" | ((filePath: string) => string[]);
|
|
4
4
|
/**
|
|
@@ -120,13 +120,19 @@ export interface KnowledgeIntegrationConfig {
|
|
|
120
120
|
*/
|
|
121
121
|
exclude?: string[];
|
|
122
122
|
/**
|
|
123
|
-
* Configuration for per-page
|
|
123
|
+
* Configuration for per-page Markdown exports served from the public directory.
|
|
124
124
|
*/
|
|
125
125
|
exports?: KnowledgeExportsConfig;
|
|
126
126
|
/**
|
|
127
127
|
* Extra files to include in knowledge output beyond the generated page content.
|
|
128
128
|
*/
|
|
129
129
|
extraFiles?: KnowledgeExtraFile[];
|
|
130
|
+
/**
|
|
131
|
+
* List of frontmatter fields to include in the generated Markdown output. These
|
|
132
|
+
* will be copied from each page's frontmatter, if present. Supply as a function
|
|
133
|
+
* and return the modified frontmatter object, which will be included instead.
|
|
134
|
+
*/
|
|
135
|
+
frontmatterFields?: string[] | ((frontmatter: Record<string, string>, page: KnowledgePageData) => Record<string, string | undefined>);
|
|
130
136
|
/**
|
|
131
137
|
* Metadata key-value pairs to include in per-page output.
|
|
132
138
|
*/
|
|
@@ -143,6 +149,10 @@ export interface KnowledgeIntegrationConfig {
|
|
|
143
149
|
* Output path for generated knowledge files.
|
|
144
150
|
*/
|
|
145
151
|
outputPath?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Prefix to prepend to each page ID.
|
|
154
|
+
*/
|
|
155
|
+
pageIdPrefix?: string;
|
|
146
156
|
/**
|
|
147
157
|
* Prefix to prepend to each page title.
|
|
148
158
|
*/
|
|
@@ -206,11 +216,59 @@ export interface KnowledgeExportsConfig {
|
|
|
206
216
|
*/
|
|
207
217
|
staticPath?: string;
|
|
208
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Environment-specific knowledge generation configuration. Extends the base
|
|
221
|
+
* integration config with a required output path.
|
|
222
|
+
*/
|
|
223
|
+
export interface KnowledgeEnvironment extends KnowledgeIntegrationConfig {
|
|
224
|
+
/**
|
|
225
|
+
* Unique identifier for this environment.
|
|
226
|
+
*/
|
|
227
|
+
id: string;
|
|
228
|
+
/**
|
|
229
|
+
* Output directory for this environment's generated knowledge files.
|
|
230
|
+
*/
|
|
231
|
+
outputPath: string;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* OpenWebUI integration configuration. References a generation environment
|
|
235
|
+
* and specifies how to load credentials.
|
|
236
|
+
*/
|
|
237
|
+
export interface OpenWebUiIntegration {
|
|
238
|
+
/**
|
|
239
|
+
* Path to env file containing `OPEN_WEB_UI_*` variables. Defaults to
|
|
240
|
+
* `.env.{id}` by convention.
|
|
241
|
+
*/
|
|
242
|
+
envFile?: string;
|
|
243
|
+
/**
|
|
244
|
+
* Environment identifier. Must match an `id` in `knowledge.environments`.
|
|
245
|
+
*/
|
|
246
|
+
id: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Container for platform-specific integration configurations.
|
|
250
|
+
*/
|
|
251
|
+
export interface KnowledgeIntegrations {
|
|
252
|
+
/**
|
|
253
|
+
* OpenWebUI integration configurations.
|
|
254
|
+
*/
|
|
255
|
+
openWebUi?: OpenWebUiIntegration[];
|
|
256
|
+
}
|
|
209
257
|
export interface KnowledgeConfig {
|
|
210
258
|
/**
|
|
211
|
-
*
|
|
259
|
+
* Generation environments. Each environment can override global settings and
|
|
260
|
+
* specifies its own output path.
|
|
261
|
+
*/
|
|
262
|
+
environments?: KnowledgeEnvironment[];
|
|
263
|
+
/**
|
|
264
|
+
* Shared configuration inherited by all environments.
|
|
212
265
|
*/
|
|
213
266
|
global?: KnowledgeIntegrationConfig;
|
|
267
|
+
/**
|
|
268
|
+
* Platform-specific integration configurations for uploading generated
|
|
269
|
+
* knowledge to external services.
|
|
270
|
+
*/
|
|
271
|
+
integrations?: KnowledgeIntegrations;
|
|
214
272
|
}
|
|
215
273
|
export interface SearchIndexerOptions {
|
|
216
274
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,UAAU,EACX,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAE7D,MAAM,MAAM,eAAe,GACvB,iBAAiB,GACjB,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GACjC,KAAK,GACL,WAAW,GACX,oBAAoB,CAAA;AAExB;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,EAAE,CAAC,EAAE,KAAK,CAAA;IAEV;;OAE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,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAE3C;;OAEG;IACH,mBAAmB,CAAC,EAAE,qBAAqB,CAAA;CAC5C;AAED,MAAM,WAAW,aACf,SAAQ,IAAI,CACV,oBAAoB,EACpB,QAAQ,GAAG,eAAe,GAAG,cAAc,CAC5C;IACD;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,eAAe,CAAA;IAE3B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,mBAAmB,CAAC,EAAE,qBAAqB,CAAA;CAC5C"}
|
package/dist/index.js
CHANGED
|
@@ -3485,7 +3485,7 @@ var require_extra_typings = __commonJS({
|
|
|
3485
3485
|
});
|
|
3486
3486
|
|
|
3487
3487
|
// src/angular-demo-plugin/angular-demo-plugin.ts
|
|
3488
|
-
import
|
|
3488
|
+
import chalk5 from "chalk";
|
|
3489
3489
|
import { watch } from "chokidar";
|
|
3490
3490
|
import { glob as glob2 } from "glob";
|
|
3491
3491
|
import { existsSync } from "node:fs";
|
|
@@ -3501,7 +3501,7 @@ import {
|
|
|
3501
3501
|
import { dedent as dedent2 } from "@qualcomm-ui/utils/dedent";
|
|
3502
3502
|
|
|
3503
3503
|
// src/docs-plugin/docs-plugin.ts
|
|
3504
|
-
import
|
|
3504
|
+
import chalk4 from "chalk";
|
|
3505
3505
|
import chokidar from "chokidar";
|
|
3506
3506
|
import { glob } from "glob";
|
|
3507
3507
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -3526,6 +3526,7 @@ var {
|
|
|
3526
3526
|
} = import_index.default;
|
|
3527
3527
|
|
|
3528
3528
|
// src/open-web-ui-knowledge/generate-knowledge.ts
|
|
3529
|
+
import chalk3 from "chalk";
|
|
3529
3530
|
import { minimatch } from "minimatch";
|
|
3530
3531
|
import {
|
|
3531
3532
|
access,
|
|
@@ -3609,15 +3610,41 @@ var knowledgeIntegrationSchema = implement().with(
|
|
|
3609
3610
|
exclude: z2.array(z2.string()).optional(),
|
|
3610
3611
|
exports: knowledgeExportsSchema.optional(),
|
|
3611
3612
|
extraFiles: z2.array(knowledgeExtraFileSchema).optional(),
|
|
3613
|
+
frontmatterFields: z2.union([z2.array(z2.string()), z2.any()]).optional(),
|
|
3612
3614
|
metadata: z2.record(z2.string(), z2.string()).optional(),
|
|
3613
3615
|
name: z2.string().optional(),
|
|
3614
3616
|
outputMode: z2.union([z2.literal("per-page"), z2.literal("aggregated")]).optional(),
|
|
3615
3617
|
outputPath: z2.string().optional(),
|
|
3618
|
+
pageIdPrefix: z2.string().optional(),
|
|
3616
3619
|
pageTitlePrefix: z2.string().optional()
|
|
3617
3620
|
}
|
|
3618
3621
|
);
|
|
3622
|
+
var knowledgeEnvironmentSchema = implement().with({
|
|
3623
|
+
baseUrl: z2.string().optional(),
|
|
3624
|
+
description: z2.string().optional(),
|
|
3625
|
+
exclude: z2.array(z2.string()).optional(),
|
|
3626
|
+
exports: knowledgeExportsSchema.optional(),
|
|
3627
|
+
extraFiles: z2.array(knowledgeExtraFileSchema).optional(),
|
|
3628
|
+
frontmatterFields: z2.array(z2.string()).optional(),
|
|
3629
|
+
id: z2.string(),
|
|
3630
|
+
metadata: z2.record(z2.string(), z2.string()).optional(),
|
|
3631
|
+
name: z2.string().optional(),
|
|
3632
|
+
outputMode: z2.union([z2.literal("per-page"), z2.literal("aggregated")]).optional(),
|
|
3633
|
+
outputPath: z2.string(),
|
|
3634
|
+
pageIdPrefix: z2.string().optional(),
|
|
3635
|
+
pageTitlePrefix: z2.string().optional()
|
|
3636
|
+
});
|
|
3637
|
+
var openWebUiIntegrationSchema = implement().with({
|
|
3638
|
+
envFile: z2.string().optional(),
|
|
3639
|
+
id: z2.string()
|
|
3640
|
+
});
|
|
3641
|
+
var knowledgeIntegrationsSchema = implement().with({
|
|
3642
|
+
openWebUi: z2.array(openWebUiIntegrationSchema).optional()
|
|
3643
|
+
});
|
|
3619
3644
|
var knowledgeConfigSchema = implement().with({
|
|
3620
|
-
|
|
3645
|
+
environments: z2.array(knowledgeEnvironmentSchema).optional(),
|
|
3646
|
+
global: knowledgeIntegrationSchema.optional(),
|
|
3647
|
+
integrations: knowledgeIntegrationsSchema.optional()
|
|
3621
3648
|
});
|
|
3622
3649
|
var configSchema = implement().with({
|
|
3623
3650
|
appDirectory: z2.string().optional(),
|
|
@@ -5449,7 +5476,6 @@ var KnowledgeGenerator = class {
|
|
|
5449
5476
|
processedPages,
|
|
5450
5477
|
extractedMetadata
|
|
5451
5478
|
);
|
|
5452
|
-
await this.generateExtraFiles(extractedMetadata);
|
|
5453
5479
|
}
|
|
5454
5480
|
return pages;
|
|
5455
5481
|
}
|
|
@@ -5503,6 +5529,7 @@ var KnowledgeGenerator = class {
|
|
|
5503
5529
|
const mdxFiles = entries.filter(
|
|
5504
5530
|
(f) => f.name.endsWith(".mdx") && !shouldExclude(join2(dirPath, f.name))
|
|
5505
5531
|
) ?? [];
|
|
5532
|
+
const pageIdPrefix = this.config.pageIdPrefix ?? "";
|
|
5506
5533
|
for (const mdxFile of mdxFiles) {
|
|
5507
5534
|
const demosFolder = entries.find((f) => f.name === "demos");
|
|
5508
5535
|
const demosFolderPath = demosFolder ? join2(dirPath, demosFolder.name) : void 0;
|
|
@@ -5514,7 +5541,7 @@ var KnowledgeGenerator = class {
|
|
|
5514
5541
|
components.push({
|
|
5515
5542
|
demosFolder: demosFolderPath,
|
|
5516
5543
|
filePath: dirPath,
|
|
5517
|
-
id: segments.join("-").trim()
|
|
5544
|
+
id: `${pageIdPrefix ? `${pageIdPrefix}-` : ""}${segments.join("-").trim()}`,
|
|
5518
5545
|
mdxFile: join2(dirPath, mdxFile.name),
|
|
5519
5546
|
name: segments.at(-1),
|
|
5520
5547
|
pathname: url,
|
|
@@ -6049,9 +6076,10 @@ ${propsToDefinitionList(outputs)}`);
|
|
|
6049
6076
|
console.log(`File size: ${outputSizeKb} KB`);
|
|
6050
6077
|
}
|
|
6051
6078
|
async generateExtraFiles(metadata) {
|
|
6079
|
+
const start = performance.now();
|
|
6052
6080
|
const extraFiles = this.config.extraFiles ?? [];
|
|
6053
6081
|
if (extraFiles.length === 0) {
|
|
6054
|
-
return;
|
|
6082
|
+
return { count: 0, duration: 0, totalSize: 0 };
|
|
6055
6083
|
}
|
|
6056
6084
|
let totalSize = 0;
|
|
6057
6085
|
await Promise.all(
|
|
@@ -6082,11 +6110,14 @@ ${propsToDefinitionList(outputs)}`);
|
|
|
6082
6110
|
totalSize += stats.size / 1024;
|
|
6083
6111
|
})
|
|
6084
6112
|
);
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6113
|
+
return {
|
|
6114
|
+
count: extraFiles.length,
|
|
6115
|
+
duration: performance.now() - start,
|
|
6116
|
+
totalSize
|
|
6117
|
+
};
|
|
6088
6118
|
}
|
|
6089
6119
|
async generatePerPageExports(pages, processedPages, metadata) {
|
|
6120
|
+
const start = performance.now();
|
|
6090
6121
|
await mkdir(dirname(this.config.outputPath), { recursive: true }).catch(
|
|
6091
6122
|
() => {
|
|
6092
6123
|
}
|
|
@@ -6097,15 +6128,37 @@ ${propsToDefinitionList(outputs)}`);
|
|
|
6097
6128
|
processedPages.map(async (processedPage, index) => {
|
|
6098
6129
|
const page = pages[index];
|
|
6099
6130
|
const lines = [];
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6131
|
+
const frontmatterEntries = [];
|
|
6132
|
+
if (page.url) {
|
|
6133
|
+
frontmatterEntries.push(["url", page.url]);
|
|
6134
|
+
}
|
|
6135
|
+
for (const [key, value] of metadata) {
|
|
6136
|
+
frontmatterEntries.push([key, value]);
|
|
6137
|
+
}
|
|
6138
|
+
if (this.config.frontmatterFields) {
|
|
6139
|
+
if (typeof this.config.frontmatterFields === "function") {
|
|
6140
|
+
const transformed = this.config.frontmatterFields(
|
|
6141
|
+
processedPage.frontmatter,
|
|
6142
|
+
page
|
|
6143
|
+
);
|
|
6144
|
+
for (const [key, value] of Object.entries(transformed)) {
|
|
6145
|
+
if (value !== void 0) {
|
|
6146
|
+
frontmatterEntries.push([key, String(value)]);
|
|
6147
|
+
}
|
|
6108
6148
|
}
|
|
6149
|
+
} else {
|
|
6150
|
+
for (const field of this.config.frontmatterFields) {
|
|
6151
|
+
const value = processedPage.frontmatter[field];
|
|
6152
|
+
if (value !== void 0) {
|
|
6153
|
+
frontmatterEntries.push([field, String(value)]);
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
}
|
|
6157
|
+
}
|
|
6158
|
+
if (frontmatterEntries.length > 0) {
|
|
6159
|
+
lines.push("---");
|
|
6160
|
+
for (const [key, value] of frontmatterEntries) {
|
|
6161
|
+
lines.push(`${key}: ${value}`);
|
|
6109
6162
|
}
|
|
6110
6163
|
lines.push("---");
|
|
6111
6164
|
lines.push("");
|
|
@@ -6171,8 +6224,10 @@ ${propsToDefinitionList(outputs)}`);
|
|
|
6171
6224
|
totalSize += stats.size / 1024;
|
|
6172
6225
|
})
|
|
6173
6226
|
);
|
|
6174
|
-
|
|
6175
|
-
console.log(
|
|
6227
|
+
const extraFilesResult = await this.generateExtraFiles(metadata);
|
|
6228
|
+
console.log(
|
|
6229
|
+
`Generated ${count + extraFilesResult.count} files(s) in ${chalk3.magenta.bold(`${Math.round(performance.now() - start + extraFilesResult.duration)}ms`)} at ${chalk3.blue.bold(this.config.outputPath)} - ${(totalSize + extraFilesResult.totalSize).toFixed(1)} KB`
|
|
6230
|
+
);
|
|
6176
6231
|
}
|
|
6177
6232
|
};
|
|
6178
6233
|
async function generate(config2) {
|
|
@@ -6272,7 +6327,7 @@ var PluginState = class {
|
|
|
6272
6327
|
const compiledMdxFiles = this.indexer.buildIndex(files, shouldLog);
|
|
6273
6328
|
if (isDev && shouldLog) {
|
|
6274
6329
|
console.debug(
|
|
6275
|
-
`${
|
|
6330
|
+
`${chalk4.magenta.bold(`@qualcomm-ui/mdx-vite/docs-plugin:`)} Compiled search index in: ${chalk4.blueBright.bold(prettyMilliseconds(Date.now() - startTime))}${state.indexer.cachedFileCount ? chalk4.greenBright.bold(` (${state.indexer.cachedFileCount}/${state.indexer.mdxFileCount} files cached)`) : ""}`
|
|
6276
6331
|
);
|
|
6277
6332
|
}
|
|
6278
6333
|
return compiledMdxFiles;
|
|
@@ -6351,7 +6406,7 @@ var PluginState = class {
|
|
|
6351
6406
|
});
|
|
6352
6407
|
this.exports.pages = pageIds;
|
|
6353
6408
|
console.debug(
|
|
6354
|
-
`${
|
|
6409
|
+
`${chalk4.magenta.bold(`@qualcomm-ui/mdx-vite/docs-plugin:`)} Generated Markdown exports in: ${chalk4.blueBright.bold(prettyMilliseconds(Date.now() - startTime))}`
|
|
6355
6410
|
);
|
|
6356
6411
|
}
|
|
6357
6412
|
debouncedGenerateExports(publicDir) {
|
|
@@ -7622,15 +7677,15 @@ function angularDemoPlugin({
|
|
|
7622
7677
|
langs: ["angular-ts", "angular-html", "css"],
|
|
7623
7678
|
themes: [theme.dark, theme.light]
|
|
7624
7679
|
});
|
|
7625
|
-
logDev(`${
|
|
7680
|
+
logDev(`${chalk5.blue.bold(LOG_PREFIX)} Shiki highlighter initialized`);
|
|
7626
7681
|
} catch (error) {
|
|
7627
7682
|
console.warn(
|
|
7628
|
-
`${
|
|
7683
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Failed to initialize highlighter:`,
|
|
7629
7684
|
error
|
|
7630
7685
|
);
|
|
7631
7686
|
}
|
|
7632
7687
|
}
|
|
7633
|
-
logDev(`${
|
|
7688
|
+
logDev(`${chalk5.blue.bold(LOG_PREFIX)} Initializing Angular demo scanner`);
|
|
7634
7689
|
await collectAngularDemos();
|
|
7635
7690
|
if (process.env.NODE_ENV === "development") {
|
|
7636
7691
|
if (!hasWatcherInitialized) {
|
|
@@ -7638,7 +7693,7 @@ function angularDemoPlugin({
|
|
|
7638
7693
|
await setupAngularWatcher();
|
|
7639
7694
|
} else {
|
|
7640
7695
|
logDev(
|
|
7641
|
-
`${
|
|
7696
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Watcher already initialized by another instance`
|
|
7642
7697
|
);
|
|
7643
7698
|
}
|
|
7644
7699
|
}
|
|
@@ -7695,7 +7750,7 @@ function angularDemoPlugin({
|
|
|
7695
7750
|
return [];
|
|
7696
7751
|
}
|
|
7697
7752
|
logDev(
|
|
7698
|
-
`${
|
|
7753
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Processing Angular demo change: ${chalk5.cyan(file)}`
|
|
7699
7754
|
);
|
|
7700
7755
|
const code = await readFile3(file, "utf-8");
|
|
7701
7756
|
const demoInfo = await parseAngularDemo(file, code);
|
|
@@ -7749,14 +7804,14 @@ function angularDemoPlugin({
|
|
|
7749
7804
|
},
|
|
7750
7805
|
writeBundle() {
|
|
7751
7806
|
console.log(
|
|
7752
|
-
`${
|
|
7807
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Successfully integrated ${chalk5.green(demoRegistry.size)} component demos`
|
|
7753
7808
|
);
|
|
7754
7809
|
}
|
|
7755
7810
|
};
|
|
7756
7811
|
async function collectAngularDemos() {
|
|
7757
7812
|
if (demoRegistry.size) {
|
|
7758
7813
|
logDev(
|
|
7759
|
-
`${
|
|
7814
|
+
`${chalk5.magenta.bold(LOG_PREFIX)} Using cached ${chalk5.cyanBright.bold(demoRegistry.size)} demos`
|
|
7760
7815
|
);
|
|
7761
7816
|
return;
|
|
7762
7817
|
}
|
|
@@ -7775,7 +7830,7 @@ function angularDemoPlugin({
|
|
|
7775
7830
|
for (const [demoId, demo] of demoRegistry.entries()) {
|
|
7776
7831
|
if (demo.sourceCode.find((entry) => entry.filePath === file)) {
|
|
7777
7832
|
logDev(
|
|
7778
|
-
`${
|
|
7833
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Reloading demo ${chalk5.cyan(demoId)} due to imported file change: ${chalk5.yellow(file)}`
|
|
7779
7834
|
);
|
|
7780
7835
|
const code = await readFile3(demo.filePath, "utf-8");
|
|
7781
7836
|
const updatedDemo = await parseAngularDemo(demo.filePath, code);
|
|
@@ -7843,7 +7898,7 @@ function angularDemoPlugin({
|
|
|
7843
7898
|
};
|
|
7844
7899
|
} catch (error) {
|
|
7845
7900
|
console.warn(
|
|
7846
|
-
`${
|
|
7901
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Failed to highlight code with ${language} language:`,
|
|
7847
7902
|
error
|
|
7848
7903
|
);
|
|
7849
7904
|
return { full: code };
|
|
@@ -7886,7 +7941,7 @@ function angularDemoPlugin({
|
|
|
7886
7941
|
return relativeImports;
|
|
7887
7942
|
} catch (error) {
|
|
7888
7943
|
logDev(
|
|
7889
|
-
`${
|
|
7944
|
+
`${chalk5.blue.bold(LOG_PREFIX)} ${chalk5.yellowBright("Failed to extract imports from")} ${chalk5.cyan(filePath)}:`,
|
|
7890
7945
|
error
|
|
7891
7946
|
);
|
|
7892
7947
|
return [];
|
|
@@ -7933,7 +7988,7 @@ function angularDemoPlugin({
|
|
|
7933
7988
|
});
|
|
7934
7989
|
} catch (error) {
|
|
7935
7990
|
logDev(
|
|
7936
|
-
`${
|
|
7991
|
+
`${chalk5.blue.bold(LOG_PREFIX)} ${chalk5.redBright("Failed to strip imports from")} ${chalk5.cyan(fileName)}:`,
|
|
7937
7992
|
error
|
|
7938
7993
|
);
|
|
7939
7994
|
return [];
|
|
@@ -8015,7 +8070,7 @@ function angularDemoPlugin({
|
|
|
8015
8070
|
};
|
|
8016
8071
|
} catch (error) {
|
|
8017
8072
|
console.error(
|
|
8018
|
-
`${
|
|
8073
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Failed to parse Angular demo ${filePath}:`,
|
|
8019
8074
|
error
|
|
8020
8075
|
);
|
|
8021
8076
|
return null;
|
|
@@ -8143,7 +8198,7 @@ function angularDemoPlugin({
|
|
|
8143
8198
|
});
|
|
8144
8199
|
} catch (error) {
|
|
8145
8200
|
console.log(
|
|
8146
|
-
`${
|
|
8201
|
+
`${chalk5.blue.bold(LOG_PREFIX)} ${chalk5.redBright("Failed to read template file:")} ${chalk5.cyan(templatePath)}`,
|
|
8147
8202
|
error
|
|
8148
8203
|
);
|
|
8149
8204
|
return null;
|
|
@@ -8164,7 +8219,7 @@ function angularDemoPlugin({
|
|
|
8164
8219
|
entries.push(entry);
|
|
8165
8220
|
} catch (error) {
|
|
8166
8221
|
logDev(
|
|
8167
|
-
`${
|
|
8222
|
+
`${chalk5.blue.bold(LOG_PREFIX)} ${chalk5.yellowBright("Failed to process relative import:")} ${chalk5.cyan(resolvedPath)}`
|
|
8168
8223
|
);
|
|
8169
8224
|
}
|
|
8170
8225
|
}
|
|
@@ -8323,7 +8378,7 @@ export function getAngularDemoInfo(demoId) {
|
|
|
8323
8378
|
});
|
|
8324
8379
|
watcher.on("ready", () => {
|
|
8325
8380
|
logDev(
|
|
8326
|
-
`${
|
|
8381
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Registered ${chalk5.green(demoRegistry.size)} demo files. Watching for file changes...`
|
|
8327
8382
|
);
|
|
8328
8383
|
});
|
|
8329
8384
|
watcher.on("add", async (filePath) => {
|
|
@@ -8334,7 +8389,7 @@ export function getAngularDemoInfo(demoId) {
|
|
|
8334
8389
|
}
|
|
8335
8390
|
if (isAngularDemoFile(filePath)) {
|
|
8336
8391
|
logDev(
|
|
8337
|
-
`${
|
|
8392
|
+
`${chalk5.blue.bold(LOG_PREFIX)} New Angular demo: ${chalk5.green(filePath)}`
|
|
8338
8393
|
);
|
|
8339
8394
|
await handleAngularDemoUpdate(filePath);
|
|
8340
8395
|
triggerRegistryUpdate();
|
|
@@ -8349,7 +8404,7 @@ export function getAngularDemoInfo(demoId) {
|
|
|
8349
8404
|
const [demoId] = demoEntry;
|
|
8350
8405
|
demoRegistry.delete(demoId);
|
|
8351
8406
|
logDev(
|
|
8352
|
-
`${
|
|
8407
|
+
`${chalk5.blue.bold(LOG_PREFIX)} Removed demo: ${chalk5.red(demoId)}`
|
|
8353
8408
|
);
|
|
8354
8409
|
triggerRegistryUpdate();
|
|
8355
8410
|
}
|
|
@@ -8498,7 +8553,7 @@ var NODE_BUILTINS = [
|
|
|
8498
8553
|
];
|
|
8499
8554
|
|
|
8500
8555
|
// src/react-demo-plugin/demo-plugin-utils.ts
|
|
8501
|
-
import
|
|
8556
|
+
import chalk6 from "chalk";
|
|
8502
8557
|
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
|
|
8503
8558
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
8504
8559
|
import { dirname as dirname3, join as join5, relative as relative4, resolve as resolve4, sep } from "node:path";
|
|
@@ -8521,7 +8576,7 @@ async function extractFileImports(filePath) {
|
|
|
8521
8576
|
return extractImports(content, filePath);
|
|
8522
8577
|
} catch (error) {
|
|
8523
8578
|
console.log(
|
|
8524
|
-
`${
|
|
8579
|
+
`${chalk6.magenta.bold(LOG_PREFIX2)} ${chalk6.yellowBright("Failed to parse")} ${chalk6.blueBright.bold(filePath)}:`,
|
|
8525
8580
|
error
|
|
8526
8581
|
);
|
|
8527
8582
|
return null;
|
|
@@ -8795,7 +8850,7 @@ function isDemoFile(filePath) {
|
|
|
8795
8850
|
}
|
|
8796
8851
|
|
|
8797
8852
|
// src/react-demo-plugin/react-demo-plugin.ts
|
|
8798
|
-
import
|
|
8853
|
+
import chalk7 from "chalk";
|
|
8799
8854
|
import { glob as glob3 } from "glob";
|
|
8800
8855
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
8801
8856
|
import { basename as basename3, resolve as resolve5 } from "node:path";
|
|
@@ -8842,11 +8897,11 @@ function reactDemoPlugin({
|
|
|
8842
8897
|
themes: [theme.dark, theme.light]
|
|
8843
8898
|
});
|
|
8844
8899
|
console.log(
|
|
8845
|
-
`${
|
|
8900
|
+
`${chalk7.magenta.bold(LOG_PREFIX2)} Shiki highlighter initialized`
|
|
8846
8901
|
);
|
|
8847
8902
|
} catch (error) {
|
|
8848
8903
|
console.warn(
|
|
8849
|
-
`${
|
|
8904
|
+
`${chalk7.magenta.bold(LOG_PREFIX2)} Failed to initialize highlighter:`,
|
|
8850
8905
|
error
|
|
8851
8906
|
);
|
|
8852
8907
|
} finally {
|
|
@@ -8901,7 +8956,7 @@ function reactDemoPlugin({
|
|
|
8901
8956
|
},
|
|
8902
8957
|
writeBundle() {
|
|
8903
8958
|
console.log(
|
|
8904
|
-
`${
|
|
8959
|
+
`${chalk7.blue.bold(LOG_PREFIX2)} Successfully integrated ${chalk7.green(demoRegistry2.size)} component demos`
|
|
8905
8960
|
);
|
|
8906
8961
|
}
|
|
8907
8962
|
};
|
|
@@ -8989,7 +9044,7 @@ function reactDemoPlugin({
|
|
|
8989
9044
|
};
|
|
8990
9045
|
} catch (error) {
|
|
8991
9046
|
console.warn(
|
|
8992
|
-
`${
|
|
9047
|
+
`${chalk7.magenta.bold(LOG_PREFIX2)} Failed to highlight code:`,
|
|
8993
9048
|
error
|
|
8994
9049
|
);
|
|
8995
9050
|
return { full: code };
|