@living-architecture/riviere-extract-ts 0.2.9 → 0.2.10
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/README.md +3 -1
- package/dist/features/extraction/domain/component-extraction/extractor.js +2 -2
- package/dist/features/extraction/domain/config-resolution/resolve-config.js +2 -0
- package/dist/features/extraction/domain/value-extraction/enrich-components.js +1 -1
- package/dist/test-fixtures.d.ts +3 -3
- package/dist/test-fixtures.d.ts.map +1 -1
- package/dist/test-fixtures.js +8 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,7 +23,9 @@ import type { ExtractionConfig } from '@living-architecture/riviere-extract-conf
|
|
|
23
23
|
const config: ExtractionConfig = {
|
|
24
24
|
modules: [
|
|
25
25
|
{
|
|
26
|
-
|
|
26
|
+
name: 'users',
|
|
27
|
+
path: '.',
|
|
28
|
+
glob: 'src/**/*.ts',
|
|
27
29
|
api: {
|
|
28
30
|
find: 'methods',
|
|
29
31
|
where: { hasDecorator: { name: 'Get' } },
|
|
@@ -131,9 +131,9 @@ function createFunctionComponent(func, filePath, domain, componentType) {
|
|
|
131
131
|
function findMatchingModule(filePath, modules, globMatcher, configDir) {
|
|
132
132
|
const normalized = filePath.replaceAll(/\\+/g, '/');
|
|
133
133
|
if (configDir === undefined) {
|
|
134
|
-
return modules.find((m) => globMatcher(normalized, m.path));
|
|
134
|
+
return modules.find((m) => globMatcher(normalized, posix.join(m.path, m.glob)));
|
|
135
135
|
}
|
|
136
136
|
const normalizedConfigDir = configDir.replaceAll(/\\+/g, '/');
|
|
137
137
|
const pathToMatch = posix.relative(normalizedConfigDir, normalized);
|
|
138
|
-
return modules.find((m) => globMatcher(pathToMatch, m.path));
|
|
138
|
+
return modules.find((m) => globMatcher(pathToMatch, posix.join(m.path, m.glob)));
|
|
139
139
|
}
|
|
@@ -13,6 +13,7 @@ function resolveModule(moduleConfig, loader) {
|
|
|
13
13
|
return {
|
|
14
14
|
name: moduleConfig.name,
|
|
15
15
|
path: moduleConfig.path,
|
|
16
|
+
glob: moduleConfig.glob,
|
|
16
17
|
api: requireRule(moduleConfig.api, 'api', moduleConfig.name),
|
|
17
18
|
useCase: requireRule(moduleConfig.useCase, 'useCase', moduleConfig.name),
|
|
18
19
|
domainOp: requireRule(moduleConfig.domainOp, 'domainOp', moduleConfig.name),
|
|
@@ -32,6 +33,7 @@ function resolveModuleWithExtends(moduleConfig, extendsSource, loader) {
|
|
|
32
33
|
return {
|
|
33
34
|
name: moduleConfig.name,
|
|
34
35
|
path: moduleConfig.path,
|
|
36
|
+
glob: moduleConfig.glob,
|
|
35
37
|
api: moduleConfig.api ?? baseModule.api,
|
|
36
38
|
useCase: moduleConfig.useCase ?? baseModule.useCase,
|
|
37
39
|
domainOp: moduleConfig.domainOp ?? baseModule.domainOp,
|
|
@@ -6,7 +6,7 @@ import { applyTransforms } from '../../../../platform/domain/string-transforms/t
|
|
|
6
6
|
function findMatchingModule(filePath, modules, globMatcher, configDir) {
|
|
7
7
|
const normalized = filePath.replaceAll(/\\+/g, '/');
|
|
8
8
|
const pathToMatch = posix.relative(configDir.replaceAll(/\\+/g, '/'), normalized);
|
|
9
|
-
return modules.find((m) => globMatcher(pathToMatch, m.path));
|
|
9
|
+
return modules.find((m) => globMatcher(pathToMatch, posix.join(m.path, m.glob)));
|
|
10
10
|
}
|
|
11
11
|
function getBuiltInRule(module, componentType) {
|
|
12
12
|
const ruleMap = {
|
package/dist/test-fixtures.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ResolvedExtractionConfig, DetectionRule, CustomTypes, ComponentType } from '@living-architecture/riviere-extract-config';
|
|
2
2
|
export declare function createResolvedConfig(): ResolvedExtractionConfig;
|
|
3
|
-
export declare function createConfigWithCustomTypes(moduleName: string, modulePath: string, customTypes: CustomTypes): ResolvedExtractionConfig;
|
|
4
|
-
export declare function createConfigWithRule(moduleName: string, modulePath: string, componentType: ComponentType, rule: DetectionRule): ResolvedExtractionConfig;
|
|
5
|
-
export declare function createOrdersUseCaseConfig(modulePath?: string): ResolvedExtractionConfig;
|
|
3
|
+
export declare function createConfigWithCustomTypes(moduleName: string, modulePath: string, customTypes: CustomTypes, moduleGlob?: string): ResolvedExtractionConfig;
|
|
4
|
+
export declare function createConfigWithRule(moduleName: string, modulePath: string, componentType: ComponentType, rule: DetectionRule, moduleGlob?: string): ResolvedExtractionConfig;
|
|
5
|
+
export declare function createOrdersUseCaseConfig(modulePath?: string, moduleGlob?: string): ResolvedExtractionConfig;
|
|
6
6
|
//# sourceMappingURL=test-fixtures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-fixtures.d.ts","sourceRoot":"","sources":["../src/test-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EAExB,aAAa,EACb,WAAW,EACX,aAAa,EACd,MAAM,6CAA6C,CAAA;
|
|
1
|
+
{"version":3,"file":"test-fixtures.d.ts","sourceRoot":"","sources":["../src/test-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EAExB,aAAa,EACb,WAAW,EACX,aAAa,EACd,MAAM,6CAA6C,CAAA;AAoBpD,wBAAgB,oBAAoB,IAAI,wBAAwB,CAE/D;AAED,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,WAAW,EACxB,UAAU,SAAO,GAChB,wBAAwB,CAW1B;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,aAAa,EACnB,UAAU,SAAO,GAChB,wBAAwB,CAW1B;AAED,wBAAgB,yBAAyB,CACvC,UAAU,SAAW,EACrB,UAAU,SAAO,GAChB,wBAAwB,CAW1B"}
|
package/dist/test-fixtures.js
CHANGED
|
@@ -2,7 +2,8 @@ const NOT_USED = { notUsed: true };
|
|
|
2
2
|
function createMinimalModule(overrides = {}) {
|
|
3
3
|
return {
|
|
4
4
|
name: 'test',
|
|
5
|
-
path: '
|
|
5
|
+
path: '.',
|
|
6
|
+
glob: 'src/**',
|
|
6
7
|
api: NOT_USED,
|
|
7
8
|
useCase: NOT_USED,
|
|
8
9
|
domainOp: NOT_USED,
|
|
@@ -16,31 +17,33 @@ function createMinimalModule(overrides = {}) {
|
|
|
16
17
|
export function createResolvedConfig() {
|
|
17
18
|
return { modules: [createMinimalModule()] };
|
|
18
19
|
}
|
|
19
|
-
export function createConfigWithCustomTypes(moduleName, modulePath, customTypes) {
|
|
20
|
+
export function createConfigWithCustomTypes(moduleName, modulePath, customTypes, moduleGlob = '**') {
|
|
20
21
|
return {
|
|
21
22
|
modules: [
|
|
22
23
|
createMinimalModule({
|
|
23
24
|
name: moduleName,
|
|
24
25
|
path: modulePath,
|
|
26
|
+
glob: moduleGlob,
|
|
25
27
|
customTypes,
|
|
26
28
|
}),
|
|
27
29
|
],
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
|
-
export function createConfigWithRule(moduleName, modulePath, componentType, rule) {
|
|
32
|
+
export function createConfigWithRule(moduleName, modulePath, componentType, rule, moduleGlob = '**') {
|
|
31
33
|
return {
|
|
32
34
|
modules: [
|
|
33
35
|
createMinimalModule({
|
|
34
36
|
name: moduleName,
|
|
35
37
|
path: modulePath,
|
|
38
|
+
glob: moduleGlob,
|
|
36
39
|
[componentType]: rule,
|
|
37
40
|
}),
|
|
38
41
|
],
|
|
39
42
|
};
|
|
40
43
|
}
|
|
41
|
-
export function createOrdersUseCaseConfig(modulePath = 'orders
|
|
44
|
+
export function createOrdersUseCaseConfig(modulePath = 'orders', moduleGlob = '**') {
|
|
42
45
|
return createConfigWithRule('orders', modulePath, 'useCase', {
|
|
43
46
|
find: 'classes',
|
|
44
47
|
where: { hasDecorator: { name: 'UseCase' } },
|
|
45
|
-
});
|
|
48
|
+
}, moduleGlob);
|
|
46
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@living-architecture/riviere-extract-ts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"minimatch": "^10.0.1",
|
|
26
26
|
"ts-morph": "^24.0.0",
|
|
27
|
-
"@living-architecture/riviere-
|
|
28
|
-
"@living-architecture/riviere-
|
|
27
|
+
"@living-architecture/riviere-schema": "0.5.5",
|
|
28
|
+
"@living-architecture/riviere-extract-config": "0.4.5"
|
|
29
29
|
}
|
|
30
30
|
}
|