@living-architecture/riviere-cli 0.7.15 → 0.7.17

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/bin.js CHANGED
@@ -25312,6 +25312,13 @@ var extraction_config_schema_default = {
25312
25312
  ui: {
25313
25313
  $ref: "#/$defs/componentRule",
25314
25314
  description: "Detection rule for UI components"
25315
+ },
25316
+ customTypes: {
25317
+ type: "object",
25318
+ description: "User-defined component types with their detection rules",
25319
+ additionalProperties: {
25320
+ $ref: "#/$defs/detectionRule"
25321
+ }
25315
25322
  }
25316
25323
  },
25317
25324
  if: {
@@ -27349,24 +27356,35 @@ function extractFromFile(project, filePath, config2, configDir) {
27349
27356
  return extractFromModule(sourceFile, filePath, matchingModule);
27350
27357
  }
27351
27358
  function extractFromModule(sourceFile, filePath, module) {
27352
- return COMPONENT_TYPES.flatMap((componentType) => extractComponentType(sourceFile, filePath, module, componentType));
27359
+ const builtInComponents = COMPONENT_TYPES.flatMap((componentType) => extractComponentType(sourceFile, filePath, module, componentType));
27360
+ const customComponents = extractCustomTypes(sourceFile, filePath, module);
27361
+ return [...builtInComponents, ...customComponents];
27353
27362
  }
27354
- function extractComponentType(sourceFile, filePath, module, componentType) {
27355
- const rule = module[componentType];
27356
- if (!isDetectionRule(rule)) {
27363
+ function extractCustomTypes(sourceFile, filePath, module) {
27364
+ if (module.customTypes === void 0) {
27357
27365
  return [];
27358
27366
  }
27367
+ return Object.entries(module.customTypes).flatMap(([typeName, rule]) => extractWithRule(sourceFile, filePath, module.name, typeName, rule));
27368
+ }
27369
+ function extractWithRule(sourceFile, filePath, domain2, componentType, rule) {
27359
27370
  if (rule.find === "classes") {
27360
- return extractClasses(sourceFile, filePath, module.name, componentType, rule);
27371
+ return extractClasses(sourceFile, filePath, domain2, componentType, rule);
27361
27372
  }
27362
27373
  if (rule.find === "methods") {
27363
- return extractMethods(sourceFile, filePath, module.name, componentType, rule);
27374
+ return extractMethods(sourceFile, filePath, domain2, componentType, rule);
27364
27375
  }
27365
27376
  if (rule.find === "functions") {
27366
- return extractFunctions(sourceFile, filePath, module.name, componentType, rule);
27377
+ return extractFunctions(sourceFile, filePath, domain2, componentType, rule);
27367
27378
  }
27368
27379
  return [];
27369
27380
  }
27381
+ function extractComponentType(sourceFile, filePath, module, componentType) {
27382
+ const rule = module[componentType];
27383
+ if (!isDetectionRule(rule)) {
27384
+ return [];
27385
+ }
27386
+ return extractWithRule(sourceFile, filePath, module.name, componentType, rule);
27387
+ }
27370
27388
  function extractClasses(sourceFile, filePath, domain2, componentType, rule) {
27371
27389
  return sourceFile.getClasses().filter((c) => evaluatePredicate(c, rule.where)).flatMap((c) => createClassComponent(c, filePath, domain2, componentType));
27372
27390
  }
package/dist/index.js CHANGED
@@ -25329,6 +25329,13 @@ var extraction_config_schema_default = {
25329
25329
  ui: {
25330
25330
  $ref: "#/$defs/componentRule",
25331
25331
  description: "Detection rule for UI components"
25332
+ },
25333
+ customTypes: {
25334
+ type: "object",
25335
+ description: "User-defined component types with their detection rules",
25336
+ additionalProperties: {
25337
+ $ref: "#/$defs/detectionRule"
25338
+ }
25332
25339
  }
25333
25340
  },
25334
25341
  if: {
@@ -27366,24 +27373,35 @@ function extractFromFile(project, filePath, config2, configDir) {
27366
27373
  return extractFromModule(sourceFile, filePath, matchingModule);
27367
27374
  }
27368
27375
  function extractFromModule(sourceFile, filePath, module) {
27369
- return COMPONENT_TYPES.flatMap((componentType) => extractComponentType(sourceFile, filePath, module, componentType));
27376
+ const builtInComponents = COMPONENT_TYPES.flatMap((componentType) => extractComponentType(sourceFile, filePath, module, componentType));
27377
+ const customComponents = extractCustomTypes(sourceFile, filePath, module);
27378
+ return [...builtInComponents, ...customComponents];
27370
27379
  }
27371
- function extractComponentType(sourceFile, filePath, module, componentType) {
27372
- const rule = module[componentType];
27373
- if (!isDetectionRule(rule)) {
27380
+ function extractCustomTypes(sourceFile, filePath, module) {
27381
+ if (module.customTypes === void 0) {
27374
27382
  return [];
27375
27383
  }
27384
+ return Object.entries(module.customTypes).flatMap(([typeName, rule]) => extractWithRule(sourceFile, filePath, module.name, typeName, rule));
27385
+ }
27386
+ function extractWithRule(sourceFile, filePath, domain2, componentType, rule) {
27376
27387
  if (rule.find === "classes") {
27377
- return extractClasses(sourceFile, filePath, module.name, componentType, rule);
27388
+ return extractClasses(sourceFile, filePath, domain2, componentType, rule);
27378
27389
  }
27379
27390
  if (rule.find === "methods") {
27380
- return extractMethods(sourceFile, filePath, module.name, componentType, rule);
27391
+ return extractMethods(sourceFile, filePath, domain2, componentType, rule);
27381
27392
  }
27382
27393
  if (rule.find === "functions") {
27383
- return extractFunctions(sourceFile, filePath, module.name, componentType, rule);
27394
+ return extractFunctions(sourceFile, filePath, domain2, componentType, rule);
27384
27395
  }
27385
27396
  return [];
27386
27397
  }
27398
+ function extractComponentType(sourceFile, filePath, module, componentType) {
27399
+ const rule = module[componentType];
27400
+ if (!isDetectionRule(rule)) {
27401
+ return [];
27402
+ }
27403
+ return extractWithRule(sourceFile, filePath, module.name, componentType, rule);
27404
+ }
27387
27405
  function extractClasses(sourceFile, filePath, domain2, componentType, rule) {
27388
27406
  return sourceFile.getClasses().filter((c) => evaluatePredicate(c, rule.where)).flatMap((c) => createClassComponent(c, filePath, domain2, componentType));
27389
27407
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@living-architecture/riviere-cli",
3
- "version": "0.7.15",
3
+ "version": "0.7.17",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,9 +33,9 @@
33
33
  "ts-morph": "^24.0.0",
34
34
  "yaml": "^2.7.0",
35
35
  "@living-architecture/riviere-builder": "0.5.20",
36
+ "@living-architecture/riviere-extract-ts": "0.1.20",
36
37
  "@living-architecture/riviere-query": "0.4.20",
37
38
  "@living-architecture/riviere-schema": "0.4.20",
38
- "@living-architecture/riviere-extract-config": "0.1.21",
39
- "@living-architecture/riviere-extract-ts": "0.1.18"
39
+ "@living-architecture/riviere-extract-config": "0.2.0"
40
40
  }
41
41
  }