@kosdev-code/kos-ui-cli 2.1.38 → 3.0.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.
@@ -1,29 +1,694 @@
1
- // generators/project/splash.mjs
2
- import { actionFactory } from "../../utils/action-factory.mjs";
3
- import { execute } from "../../utils/exec.mjs";
4
- import { required } from "../../utils/validators.mjs";
1
+ // ../kos-codegen-core/src/lib/codegen-filesystem.ts
2
+ import * as fs from "fs";
3
+ import * as path from "path";
4
+ var TrackingFileSystem = class {
5
+ inner;
6
+ _writtenPaths = [];
7
+ constructor(inner) {
8
+ this.inner = inner;
9
+ }
10
+ get root() {
11
+ return this.inner.root;
12
+ }
13
+ get writtenPaths() {
14
+ return [...this._writtenPaths];
15
+ }
16
+ read(filePath) {
17
+ return this.inner.read(filePath);
18
+ }
19
+ write(filePath, content) {
20
+ this.inner.write(filePath, content);
21
+ this._writtenPaths.push(
22
+ path.isAbsolute(filePath) ? filePath : path.join(this.inner.root, filePath)
23
+ );
24
+ }
25
+ exists(filePath) {
26
+ return this.inner.exists(filePath);
27
+ }
28
+ delete(filePath) {
29
+ this.inner.delete(filePath);
30
+ }
31
+ listFiles(dirPath) {
32
+ return this.inner.listFiles(dirPath);
33
+ }
34
+ };
35
+ var DirectFileSystem = class {
36
+ root;
37
+ constructor(workspaceRoot) {
38
+ this.root = path.resolve(workspaceRoot);
39
+ }
40
+ read(filePath) {
41
+ const abs = this.resolve(filePath);
42
+ try {
43
+ return fs.readFileSync(abs, "utf-8");
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+ write(filePath, content) {
49
+ const abs = this.resolve(filePath);
50
+ fs.mkdirSync(path.dirname(abs), { recursive: true });
51
+ fs.writeFileSync(abs, content, "utf-8");
52
+ }
53
+ exists(filePath) {
54
+ return fs.existsSync(this.resolve(filePath));
55
+ }
56
+ delete(filePath) {
57
+ const abs = this.resolve(filePath);
58
+ try {
59
+ fs.unlinkSync(abs);
60
+ } catch {
61
+ }
62
+ }
63
+ listFiles(dirPath) {
64
+ const abs = this.resolve(dirPath);
65
+ if (!fs.existsSync(abs)) {
66
+ return [];
67
+ }
68
+ return this.walkDir(abs).map((file) => path.relative(this.root, file));
69
+ }
70
+ resolve(filePath) {
71
+ if (path.isAbsolute(filePath)) {
72
+ return filePath;
73
+ }
74
+ return path.join(this.root, filePath);
75
+ }
76
+ walkDir(dir) {
77
+ const results = [];
78
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
79
+ for (const entry of entries) {
80
+ const full = path.join(dir, entry.name);
81
+ if (entry.isDirectory()) {
82
+ results.push(...this.walkDir(full));
83
+ } else {
84
+ results.push(full);
85
+ }
86
+ }
87
+ return results;
88
+ }
89
+ };
5
90
 
6
- export const metadata = {
7
- key: "project:splash",
8
- name: "KOS Splash Screen Project",
9
- invalidateCache: true,
10
- namedArguments: { name: "name" },
91
+ // ../kos-codegen-core/src/lib/generate-files.ts
92
+ import * as fs2 from "fs";
93
+ import * as path2 from "path";
94
+ import * as ejs from "ejs";
95
+
96
+ // ../kos-codegen-core/src/lib/logger.ts
97
+ var noopLogger = {
98
+ debug: () => {
99
+ },
100
+ info: () => {
101
+ },
102
+ warn: () => {
103
+ },
104
+ error: () => {
105
+ }
11
106
  };
12
- export default async function (plop) {
13
- plop.setActionType("createSplashProject", async function (answers) {
14
- const command = `npx nx generate @kosdev-code/kos-nx-plugin:kos-splash-project \
15
- --name=${answers.name} \
16
- --no-interactive`;
107
+ var activeLogger = noopLogger;
108
+ function getCodegenLogger() {
109
+ return activeLogger;
110
+ }
111
+
112
+ // ../kos-codegen-core/src/lib/generate-files.ts
113
+ function generateFilesFromTemplates(codegenFs, srcFolder, destFolder, substitutions) {
114
+ const logger = getCodegenLogger();
115
+ const templateFiles = walkTemplateDir(srcFolder);
116
+ for (const templateFile of templateFiles) {
117
+ const relPath = path2.relative(srcFolder, templateFile);
118
+ let destRelPath = interpolateFilename(relPath, substitutions);
119
+ if (destRelPath.endsWith(".template")) {
120
+ destRelPath = destRelPath.slice(0, -".template".length);
121
+ }
122
+ const destPath = path2.join(destFolder, destRelPath);
123
+ const rawContent = fs2.readFileSync(templateFile, "utf-8");
124
+ const rendered = ejs.render(rawContent, substitutions, {
125
+ filename: templateFile
126
+ // for EJS error messages and includes
127
+ });
128
+ logger.debug(`Generating ${destPath}`);
129
+ codegenFs.write(destPath, rendered);
130
+ }
131
+ }
132
+ function interpolateFilename(filePath, substitutions) {
133
+ return filePath.replace(/__([^_]+)__/g, (match, key) => {
134
+ if (key in substitutions) {
135
+ return String(substitutions[key]);
136
+ }
137
+ return match;
138
+ });
139
+ }
140
+ function walkTemplateDir(dir) {
141
+ const results = [];
142
+ const entries = fs2.readdirSync(dir, { withFileTypes: true });
143
+ for (const entry of entries) {
144
+ const full = path2.join(dir, entry.name);
145
+ if (entry.isDirectory()) {
146
+ results.push(...walkTemplateDir(full));
147
+ } else {
148
+ results.push(full);
149
+ }
150
+ }
151
+ return results;
152
+ }
17
153
 
154
+ // ../kos-codegen-core/src/lib/project-discovery.ts
155
+ import fg from "fast-glob";
156
+
157
+ // ../kos-codegen-core/src/lib/format-files.ts
158
+ import * as fs3 from "fs";
159
+ import * as path3 from "path";
160
+ import prettier from "prettier";
161
+ var FORMATTABLE_EXTENSIONS = /* @__PURE__ */ new Set([
162
+ ".ts",
163
+ ".tsx",
164
+ ".js",
165
+ ".jsx",
166
+ ".json",
167
+ ".css",
168
+ ".scss",
169
+ ".md",
170
+ ".yaml",
171
+ ".yml",
172
+ ".html"
173
+ ]);
174
+ async function formatFiles(workspaceRoot, filePaths) {
175
+ const logger = getCodegenLogger();
176
+ for (const filePath of filePaths) {
177
+ const ext = path3.extname(filePath);
178
+ if (!FORMATTABLE_EXTENSIONS.has(ext)) {
179
+ continue;
180
+ }
18
181
  try {
19
- await execute(command);
20
- } catch (error) {
21
- throw new Error(error);
182
+ const content = fs3.readFileSync(filePath, "utf-8");
183
+ const options = await prettier.resolveConfig(filePath, {
184
+ editorconfig: true
185
+ });
186
+ const formatted = await prettier.format(content, {
187
+ ...options,
188
+ filepath: filePath
189
+ });
190
+ fs3.writeFileSync(filePath, formatted, "utf-8");
191
+ logger.debug(`Formatted ${path3.relative(workspaceRoot, filePath)}`);
192
+ } catch (err) {
193
+ logger.warn(`Failed to format ${filePath}: ${err}`);
194
+ }
195
+ }
196
+ }
197
+
198
+ // ../kos-codegen-core/src/lib/name-utils.ts
199
+ function dashCase(input) {
200
+ return input.replace(/\s+/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
201
+ }
202
+ function camelCase(input) {
203
+ if (input.length === 0)
204
+ return "";
205
+ const words = input.split(/-|\s+/);
206
+ if (words.length > 0 && words[0].length > 0) {
207
+ words[0] = words[0].charAt(0).toLowerCase() + words[0].slice(1);
208
+ }
209
+ for (let i = 1; i < words.length; i++) {
210
+ words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1);
211
+ }
212
+ return words.join("");
213
+ }
214
+ function pascalCase(input) {
215
+ if (input.length === 0)
216
+ return "";
217
+ const cc = camelCase(input);
218
+ return cc[0].toUpperCase() + cc.slice(1);
219
+ }
220
+ function properCase(input) {
221
+ const words = input.toLowerCase().replaceAll("-", " ").split(" ").filter(Boolean);
222
+ for (let i = 0; i < words.length; i++) {
223
+ words[i] = words[i][0].toUpperCase() + words[i].slice(1);
224
+ }
225
+ return words.join("");
226
+ }
227
+ function constantCase(input) {
228
+ if (input.length === 0)
229
+ return "";
230
+ return input.toUpperCase().split(/[\s-]+/).filter(Boolean).join("_");
231
+ }
232
+
233
+ // ../kos-codegen-core/src/lib/normalize-values.ts
234
+ var normalizeValue = (optionsName, value) => ({
235
+ [`${camelCase(optionsName)}CamelCase`]: camelCase(value),
236
+ [`${camelCase(optionsName)}ConstantCase`]: constantCase(value),
237
+ [`${camelCase(optionsName)}DashCase`]: dashCase(value),
238
+ [`${camelCase(optionsName)}PascalCase`]: pascalCase(value),
239
+ [`${camelCase(optionsName)}ProperCase`]: properCase(value),
240
+ [`${camelCase(optionsName)}LowerCase`]: value.toLowerCase(),
241
+ [`${optionsName}`]: value
242
+ });
243
+ var normalizeAllValues = (options) => {
244
+ let normalizedValues = {};
245
+ for (const key in options) {
246
+ if (Object.prototype.hasOwnProperty.call(options, key)) {
247
+ const element = options[key];
248
+ const newOptions = typeof element !== "string" || element === "" ? { [key]: element } : normalizeValue(key, element);
249
+ normalizedValues = {
250
+ ...normalizedValues,
251
+ ...newOptions
252
+ };
253
+ }
254
+ }
255
+ return normalizedValues;
256
+ };
257
+
258
+ // ../kos-codegen-core/src/lib/template-resolver.ts
259
+ import * as path4 from "path";
260
+ import * as fs4 from "fs";
261
+ function findPackageRoot() {
262
+ if (process.env.KOS_TEMPLATE_BASE_DIR) {
263
+ return process.env.KOS_TEMPLATE_BASE_DIR;
264
+ }
265
+ let dir = __dirname;
266
+ while (dir !== path4.dirname(dir)) {
267
+ const pkgPath = path4.join(dir, "package.json");
268
+ if (fs4.existsSync(pkgPath)) {
269
+ try {
270
+ const pkg = JSON.parse(fs4.readFileSync(pkgPath, "utf-8"));
271
+ if (pkg.name === "@kosdev-code/kos-codegen-core") {
272
+ return dir;
273
+ }
274
+ } catch {
275
+ }
276
+ }
277
+ dir = path4.dirname(dir);
278
+ }
279
+ return path4.resolve(__dirname, "..", "..");
280
+ }
281
+ function getTemplateDir(generatorName) {
282
+ return path4.join(findPackageRoot(), "templates", generatorName);
283
+ }
284
+
285
+ // ../kos-codegen-core/src/lib/generators/generate-splash-project.ts
286
+ import * as path5 from "path";
287
+ function generateSplashProject(codegenFs, templateDir, options) {
288
+ const normalized = normalizeAllValues(options);
289
+ const projectRoot = `splash/${normalized.nameDashCase}`;
290
+ const toolsRoot = path5.join("tools", "scripts");
291
+ generateFilesFromTemplates(
292
+ codegenFs,
293
+ path5.join(templateDir, "project"),
294
+ projectRoot,
295
+ normalized
296
+ );
297
+ generateFilesFromTemplates(
298
+ codegenFs,
299
+ path5.join(templateDir, "tools"),
300
+ toolsRoot,
301
+ normalized
302
+ );
303
+ }
304
+
305
+ // ../kos-codegen-core/src/lib/generators/update-model-index.ts
306
+ import * as ts from "typescript";
307
+
308
+ // ../kos-codegen-core/src/lib/generators/component/types.ts
309
+ var PLUGIN_TYPES = {
310
+ CUI: "cui",
311
+ UTILITY: "utility",
312
+ TROUBLE_ACTION: "troubleAction",
313
+ SETUP: "setup",
314
+ SETTING: "setting",
315
+ NAV: "nav",
316
+ CONTROL_POUR: "controlPour",
317
+ CUSTOM: "custom"
318
+ };
319
+ var CONTRIBUTION_TYPE_MAP = {
320
+ [PLUGIN_TYPES.SETUP]: "setup",
321
+ [PLUGIN_TYPES.CUI]: "cui",
322
+ [PLUGIN_TYPES.UTILITY]: "utility",
323
+ [PLUGIN_TYPES.SETTING]: "setting",
324
+ [PLUGIN_TYPES.NAV]: "nav",
325
+ [PLUGIN_TYPES.TROUBLE_ACTION]: "trouble-action",
326
+ [PLUGIN_TYPES.CONTROL_POUR]: "control-pour",
327
+ [PLUGIN_TYPES.CUSTOM]: "custom"
328
+ };
329
+ var LOCALIZED_PLUGIN_TYPES = /* @__PURE__ */ new Set([
330
+ PLUGIN_TYPES.CUI,
331
+ PLUGIN_TYPES.UTILITY,
332
+ PLUGIN_TYPES.SETUP,
333
+ PLUGIN_TYPES.SETTING,
334
+ PLUGIN_TYPES.NAV,
335
+ PLUGIN_TYPES.CONTROL_POUR,
336
+ PLUGIN_TYPES.TROUBLE_ACTION,
337
+ PLUGIN_TYPES.CUSTOM
338
+ ]);
339
+
340
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/base.ts
341
+ var BasePluginHandler = class {
342
+ getContributionKey() {
343
+ return this.contributionKey;
344
+ }
345
+ requiresLocalization() {
346
+ return this.requiresI18n;
347
+ }
348
+ getTemplatePath() {
349
+ return this.contributionKey;
350
+ }
351
+ /**
352
+ * Helper to create experience configuration
353
+ */
354
+ createExperience(options, experienceId) {
355
+ const compPath = this.getComponentPath(options);
356
+ return {
357
+ id: experienceId,
358
+ component: options.namePascalCase,
359
+ location: `./src/${compPath}`
360
+ };
361
+ }
362
+ /**
363
+ * Helper to get component path
364
+ */
365
+ getComponentPath(options) {
366
+ return `${options.appDirectory}/${this.contributionKey}/${options.nameDashCase}/${options.nameDashCase}.tsx`;
367
+ }
368
+ /**
369
+ * Helper to create config prefix
370
+ */
371
+ getConfigPrefix(options) {
372
+ return `${options.appProject}.${options.nameCamelCase}`;
373
+ }
374
+ };
375
+
376
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/control-pour-handler.ts
377
+ var ControlPourPluginHandler = class extends BasePluginHandler {
378
+ pluginType = PLUGIN_TYPES.CONTROL_POUR;
379
+ contributionKey = "control-pour";
380
+ requiresI18n = true;
381
+ createConfiguration(options) {
382
+ const configPrefix = this.getConfigPrefix(options);
383
+ const experienceId = `${configPrefix}.controlPour.experience`;
384
+ const contribution = {
385
+ id: `${configPrefix}.controlPour`,
386
+ title: `${configPrefix}.controlPour.title`,
387
+ namespace: options.appProject,
388
+ experienceId
389
+ };
390
+ const experience = this.createExperience(options, experienceId);
391
+ return {
392
+ contributions: {
393
+ controlPour: [contribution]
394
+ },
395
+ experiences: {
396
+ [experienceId]: experience
397
+ }
398
+ };
399
+ }
400
+ };
401
+
402
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/cui-handler.ts
403
+ var CuiPluginHandler = class extends BasePluginHandler {
404
+ pluginType = PLUGIN_TYPES.CUI;
405
+ contributionKey = "cui";
406
+ requiresI18n = true;
407
+ createConfiguration(options) {
408
+ const configPrefix = this.getConfigPrefix(options);
409
+ const experienceId = `${configPrefix}.cui.experience`;
410
+ const contribution = {
411
+ id: configPrefix,
412
+ title: `${configPrefix}.cui.title`,
413
+ namespace: options.appProject,
414
+ experienceId
415
+ };
416
+ const experience = this.createExperience(options, experienceId);
417
+ return {
418
+ contributions: {
419
+ cui: [contribution]
420
+ },
421
+ experiences: {
422
+ [experienceId]: experience
423
+ }
424
+ };
425
+ }
426
+ };
427
+
428
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/custom-handler.ts
429
+ var CustomPluginHandler = class extends BasePluginHandler {
430
+ pluginType = PLUGIN_TYPES.CUSTOM;
431
+ contributionKey = "custom";
432
+ requiresI18n = true;
433
+ createConfiguration(options) {
434
+ const configPrefix = this.getConfigPrefix(options);
435
+ const experienceId = `${configPrefix}.${options.contributionKey || "custom"}.experience`;
436
+ const userContributionKey = options.contributionKey || "custom";
437
+ const contribution = {
438
+ id: configPrefix,
439
+ title: `${configPrefix}.${userContributionKey}.title`,
440
+ namespace: options.appProject,
441
+ experienceId
442
+ // TODO: Add additional fields as required by the plugin-explorer specification
443
+ // Refer to the plugin-explorer documentation for your specific contribution type
444
+ };
445
+ const experience = this.createExperience(options, experienceId);
446
+ return {
447
+ contributions: {
448
+ [userContributionKey]: [contribution]
449
+ },
450
+ experiences: {
451
+ [experienceId]: experience
452
+ }
453
+ };
454
+ }
455
+ getTemplatePath() {
456
+ return this.contributionKey || "custom";
457
+ }
458
+ getComponentPath(options) {
459
+ const pathKey = options.contributionKey || "custom";
460
+ return `${options.appDirectory}/${pathKey}/${options.nameDashCase}/${options.nameDashCase}.tsx`;
461
+ }
462
+ };
463
+
464
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/default-handler.ts
465
+ var DefaultComponentHandler = class extends BasePluginHandler {
466
+ pluginType = "component";
467
+ contributionKey = "components";
468
+ requiresI18n = false;
469
+ createConfiguration(options) {
470
+ const compPath = this.getComponentPath(options);
471
+ const viewConfig = {
472
+ id: `${options.appProject}.${options.nameCamelCase}`,
473
+ title: "ddk.ncui.config.title",
474
+ namespace: options.appProject,
475
+ component: options.namePascalCase,
476
+ location: `./src/${compPath}`
477
+ };
478
+ return {
479
+ contributions: {},
480
+ experiences: {},
481
+ views: {
482
+ [this.getTabViewKey()]: [viewConfig]
483
+ }
484
+ };
485
+ }
486
+ getTabViewKey() {
487
+ return "ddk.ncui.settings.tabView";
488
+ }
489
+ getTemplatePath() {
490
+ return "files";
491
+ }
492
+ };
493
+
494
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/nav-handler.ts
495
+ var NavPluginHandler = class extends BasePluginHandler {
496
+ pluginType = PLUGIN_TYPES.NAV;
497
+ contributionKey = "nav";
498
+ requiresI18n = true;
499
+ createConfiguration(options) {
500
+ const configPrefix = this.getConfigPrefix(options);
501
+ const experienceId = `${configPrefix}.nav.experience`;
502
+ const contribution = {
503
+ id: `${configPrefix}.nav`,
504
+ title: `${configPrefix}.nav.title`,
505
+ namespace: options.appProject,
506
+ navDescriptor: options.nameLowerCase,
507
+ experienceId
508
+ };
509
+ const experience = this.createExperience(options, experienceId);
510
+ return {
511
+ contributions: {
512
+ navViews: [contribution]
513
+ },
514
+ experiences: {
515
+ [experienceId]: experience
516
+ }
517
+ };
518
+ }
519
+ };
520
+
521
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/setting-handler.ts
522
+ var SettingPluginHandler = class extends BasePluginHandler {
523
+ pluginType = PLUGIN_TYPES.SETTING;
524
+ contributionKey = "setting";
525
+ requiresI18n = true;
526
+ createConfiguration(options) {
527
+ const configPrefix = this.getConfigPrefix(options);
528
+ const experienceId = `${configPrefix}.settings.experience`;
529
+ const contribution = {
530
+ id: `${configPrefix}.setting`,
531
+ title: `${configPrefix}.setting.title`,
532
+ namespace: options.appProject,
533
+ settingsGroup: options.group || "general",
534
+ experienceId
535
+ };
536
+ const experience = this.createExperience(options, experienceId);
537
+ return {
538
+ contributions: {
539
+ settings: [contribution]
540
+ },
541
+ experiences: {
542
+ [experienceId]: experience
543
+ }
544
+ };
545
+ }
546
+ };
547
+
548
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/setup-handler.ts
549
+ var SetupPluginHandler = class extends BasePluginHandler {
550
+ pluginType = PLUGIN_TYPES.SETUP;
551
+ contributionKey = "setup";
552
+ requiresI18n = true;
553
+ createConfiguration(options) {
554
+ const configPrefix = this.getConfigPrefix(options);
555
+ const experienceId = `${configPrefix}.setup.experience`;
556
+ const contribution = {
557
+ id: `${configPrefix}.setup`,
558
+ title: `${configPrefix}.setup.title`,
559
+ namespace: options.appProject,
560
+ setupDescriptor: options.nameCamelCase,
561
+ experienceId
562
+ };
563
+ const experience = this.createExperience(options, experienceId);
564
+ return {
565
+ contributions: {
566
+ setupStep: [contribution]
567
+ },
568
+ experiences: {
569
+ [experienceId]: experience
570
+ }
571
+ };
572
+ }
573
+ };
574
+
575
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/trouble-action-handler.ts
576
+ var TroubleActionPluginHandler = class extends BasePluginHandler {
577
+ pluginType = PLUGIN_TYPES.TROUBLE_ACTION;
578
+ contributionKey = "trouble-action";
579
+ requiresI18n = true;
580
+ createConfiguration(options) {
581
+ const configPrefix = this.getConfigPrefix(options);
582
+ const experienceId = `${configPrefix}.troubleAction.experience`;
583
+ const contribution = {
584
+ id: `${configPrefix}.troubleAction`,
585
+ title: `${configPrefix}.troubleAction.title`,
586
+ namespace: options.appProject,
587
+ troubleType: options.nameCamelCase,
588
+ experienceId
589
+ };
590
+ const experience = this.createExperience(options, experienceId);
591
+ return {
592
+ contributions: {
593
+ troubleActions: [contribution]
594
+ },
595
+ experiences: {
596
+ [experienceId]: experience
597
+ }
598
+ };
599
+ }
600
+ };
601
+
602
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/utility-handler.ts
603
+ var UtilityPluginHandler = class extends BasePluginHandler {
604
+ pluginType = PLUGIN_TYPES.UTILITY;
605
+ contributionKey = "utility";
606
+ requiresI18n = true;
607
+ createConfiguration(options) {
608
+ const configPrefix = this.getConfigPrefix(options);
609
+ const experienceId = `${configPrefix}.util.experience`;
610
+ const contribution = {
611
+ id: `${configPrefix}.util`,
612
+ title: `${configPrefix}.utility.title`,
613
+ namespace: options.appProject,
614
+ utilDescriptor: options.nameCamelCase,
615
+ experienceId
616
+ };
617
+ const experience = this.createExperience(options, experienceId);
618
+ return {
619
+ contributions: {
620
+ utilities: [contribution]
621
+ },
622
+ experiences: {
623
+ [experienceId]: experience
624
+ }
625
+ };
626
+ }
627
+ };
628
+
629
+ // ../kos-codegen-core/src/lib/generators/component/plugin-handlers/factory.ts
630
+ var PluginHandlerFactory = class {
631
+ static handlers = /* @__PURE__ */ new Map([
632
+ [PLUGIN_TYPES.CUI, CuiPluginHandler],
633
+ [PLUGIN_TYPES.UTILITY, UtilityPluginHandler],
634
+ [PLUGIN_TYPES.SETTING, SettingPluginHandler],
635
+ [PLUGIN_TYPES.SETUP, SetupPluginHandler],
636
+ [PLUGIN_TYPES.NAV, NavPluginHandler],
637
+ [PLUGIN_TYPES.CONTROL_POUR, ControlPourPluginHandler],
638
+ [PLUGIN_TYPES.TROUBLE_ACTION, TroubleActionPluginHandler],
639
+ [PLUGIN_TYPES.CUSTOM, CustomPluginHandler]
640
+ ]);
641
+ static createHandler(pluginType) {
642
+ if (!pluginType) {
643
+ return new DefaultComponentHandler();
644
+ }
645
+ const HandlerClass = this.handlers.get(pluginType);
646
+ if (!HandlerClass) {
647
+ console.warn(
648
+ `No handler found for plugin type: ${pluginType}. Using default handler.`
649
+ );
650
+ return new DefaultComponentHandler();
651
+ }
652
+ return new HandlerClass();
653
+ }
654
+ static isValidPluginType(type) {
655
+ return this.handlers.has(type);
656
+ }
657
+ };
658
+
659
+ // src/lib/utils/action-factory.mjs
660
+ var actionFactory = (action, metadata2) => {
661
+ return () => {
662
+ const _actions = [{ type: action }];
663
+ if (metadata2.invalidateCache) {
664
+ _actions.push({ type: "clearCache" });
22
665
  }
666
+ return _actions;
667
+ };
668
+ };
669
+
670
+ // src/lib/utils/validators.mjs
671
+ function required(value) {
672
+ return value && value.trim() !== "" ? true : "This field is required.";
673
+ }
23
674
 
675
+ // src/lib/generators/project/splash.mjs
676
+ var metadata = {
677
+ key: "project:splash",
678
+ name: "KOS Splash Screen Project",
679
+ invalidateCache: true,
680
+ namedArguments: { name: "name" }
681
+ };
682
+ async function splash_default(plop) {
683
+ plop.setActionType("createSplashProject", async function(answers) {
684
+ const cwd = process.cwd();
685
+ const codegenFs = new TrackingFileSystem(new DirectFileSystem(cwd));
686
+ generateSplashProject(codegenFs, getTemplateDir("kos-splash-project"), {
687
+ name: answers.name
688
+ });
689
+ await formatFiles(codegenFs.root, codegenFs.writtenPaths);
24
690
  return `Splash page project ${answers.name} created.`;
25
691
  });
26
-
27
692
  plop.setGenerator("project:splash", {
28
693
  description: "Create a new KOS Splash Page Project",
29
694
  prompts: [
@@ -31,9 +696,14 @@ export default async function (plop) {
31
696
  type: "input",
32
697
  name: "name",
33
698
  message: "What is the name of the splash project?",
34
- validate: required,
35
- },
699
+ validate: required
700
+ }
36
701
  ],
37
- actions: actionFactory("createSplashProject", metadata),
702
+ actions: actionFactory("createSplashProject", metadata)
38
703
  });
39
704
  }
705
+ export {
706
+ splash_default as default,
707
+ metadata
708
+ };
709
+ //# sourceMappingURL=splash.mjs.map