zova-module-a-bean 5.1.17 → 5.1.18

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.
@@ -3,7 +3,13 @@ import ts from 'typescript';
3
3
 
4
4
  export function extractGenericParamsAndImports(filePath: string, interfaceName: string) {
5
5
  const sourceText = fs.readFileSync(filePath, 'utf-8');
6
- const sourceFile = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
6
+ const sourceFile = ts.createSourceFile(
7
+ filePath,
8
+ sourceText,
9
+ ts.ScriptTarget.Latest,
10
+ true,
11
+ ts.ScriptKind.TSX,
12
+ );
7
13
 
8
14
  // 1. Find the target interface
9
15
  let targetInterface: ts.InterfaceDeclaration | undefined;
@@ -43,7 +49,9 @@ export function extractGenericParamsAndImports(filePath: string, interfaceName:
43
49
  const clause = node.importClause;
44
50
  if (!clause?.namedBindings || !ts.isNamedImports(clause.namedBindings)) return;
45
51
 
46
- const matched = clause.namedBindings.elements.map(el => el.name.text).filter(name => typeRefNames.has(name));
52
+ const matched = clause.namedBindings.elements
53
+ .map(el => el.name.text)
54
+ .filter(name => typeRefNames.has(name));
47
55
  if (matched.length === 0) return;
48
56
 
49
57
  const specifier = (node.moduleSpecifier as ts.StringLiteral).text;
@@ -36,7 +36,10 @@ export default async function (options: IMetadataCustomGenerateOptions): Promise
36
36
  return content;
37
37
  }
38
38
 
39
- function _parseControllerInfo(options: IMetadataCustomGenerateOptions, globFile: IGlobBeanFile): IControllerInfo | undefined {
39
+ function _parseControllerInfo(
40
+ options: IMetadataCustomGenerateOptions,
41
+ globFile: IGlobBeanFile,
42
+ ): IControllerInfo | undefined {
40
43
  const { className, fileContent, fileNameJSRelative, file } = globFile;
41
44
  const matches = fileNameJSRelative.match(/..\/(.+?)\/(.+?)\/controller(.jsx?)$/);
42
45
  if (!matches) return;
@@ -47,7 +50,9 @@ function _parseControllerInfo(options: IMetadataCustomGenerateOptions, globFile:
47
50
  const controllerExtJs = matches[3];
48
51
  const controllerExtTs = controllerExtJs.replace('.js', '.ts');
49
52
  // componentOptions
50
- const componentOptionsMatched = fileContent.match(/static \$componentOptions[^=]* = (\{[\s\S]*?\});/);
53
+ const componentOptionsMatched = fileContent.match(
54
+ /static \$componentOptions[^=]* = (\{[\s\S]*?\});/,
55
+ );
51
56
  const componentOptions = componentOptionsMatched ? componentOptionsMatched[1] : '';
52
57
  const hasComponentOptions = !!componentOptionsMatched;
53
58
  // props
@@ -61,7 +66,9 @@ function _parseControllerInfo(options: IMetadataCustomGenerateOptions, globFile:
61
66
  const matchGeneric = hasProps && extractGenericParamsAndImports(file, nameProps); // fileContent.match(__regProps);
62
67
  const hasGeneric = !!(matchGeneric && matchGeneric.genericParams);
63
68
  const generic = hasGeneric ? matchGeneric.genericParams : undefined;
64
- const genericKeys = hasGeneric ? matchGeneric.genericParams.split(',').map(item => item.trim().split(' ')[0]) : undefined;
69
+ const genericKeys = hasGeneric
70
+ ? matchGeneric.genericParams.split(',').map(item => item.trim().split(' ')[0])
71
+ : undefined;
65
72
  const generateImports = hasGeneric ? matchGeneric.imports : undefined;
66
73
  // schemaParams
67
74
  const nameSchemaParams = `${className}SchemaParams`;
@@ -77,10 +84,15 @@ function _parseControllerInfo(options: IMetadataCustomGenerateOptions, globFile:
77
84
  const fileRenderOthers = globbySync(`src/${type}/${name}/render.*.tsx`, {
78
85
  cwd: options.modulePath,
79
86
  });
80
- const nameRenderOthers: string[] = fileRenderOthers.map(item => /render\.(.*)\.tsx/.exec(item)![1]);
81
- const classNameRenderOthers: string[] = nameRenderOthers.map(item => `Render${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`);
87
+ const nameRenderOthers: string[] = fileRenderOthers.map(
88
+ item => /render\.(.*)\.tsx/.exec(item)![1],
89
+ );
90
+ const classNameRenderOthers: string[] = nameRenderOthers.map(
91
+ item => `Render${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`,
92
+ );
82
93
  const importRenderOthers: string[] = nameRenderOthers.map(
83
- item => `import { ${`Render${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`} } from '../../${type}/${name}/render.${item}.jsx';`,
94
+ item =>
95
+ `import { ${`Render${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`} } from '../../${type}/${name}/render.${item}.jsx';`,
84
96
  );
85
97
  // style
86
98
  const fileStyleFirst = path.join(options.modulePath, `src/${type}/${name}/style.ts`);
@@ -89,9 +101,12 @@ function _parseControllerInfo(options: IMetadataCustomGenerateOptions, globFile:
89
101
  const importStyleFirst = `import { ${classNameStyleFirst} } from '../../${type}/${name}/style.js';`;
90
102
  const fileStyleOthers = globbySync(`src/${type}/${name}/style.*.ts`, { cwd: options.modulePath });
91
103
  const nameStyleOthers: string[] = fileStyleOthers.map(item => /style\.(.*)\.ts/.exec(item)![1]);
92
- const classNameStyleOthers: string[] = nameStyleOthers.map(item => `Style${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`);
104
+ const classNameStyleOthers: string[] = nameStyleOthers.map(
105
+ item => `Style${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`,
106
+ );
93
107
  const importStyleOthers: string[] = nameStyleOthers.map(
94
- item => `import { ${`Style${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`} } from '../../${type}/${name}/style.${item}.js';`,
108
+ item =>
109
+ `import { ${`Style${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`} } from '../../${type}/${name}/style.${item}.js';`,
95
110
  );
96
111
  // ok
97
112
  return {
@@ -5,7 +5,11 @@ import type { IControllerInfo } from './types.ts';
5
5
 
6
6
  import { combineContentRenderAndStyle } from './utils.ts';
7
7
 
8
- export async function generateFileComponent(options: IMetadataCustomGenerateOptions, globFile: IGlobBeanFile, controllerInfo: IControllerInfo) {
8
+ export async function generateFileComponent(
9
+ options: IMetadataCustomGenerateOptions,
10
+ globFile: IGlobBeanFile,
11
+ controllerInfo: IControllerInfo,
12
+ ) {
9
13
  const { moduleName } = options;
10
14
  const { className } = globFile;
11
15
  const {
@@ -35,10 +39,17 @@ export async function generateFileComponent(options: IMetadataCustomGenerateOpti
35
39
  }
36
40
  const genericDeclare = hasGeneric ? `<${generic}>` : '';
37
41
  const genericArguments = hasGeneric ? `<${genericKeys?.join(', ')}>` : '';
38
- const componentOptions = hasComponentOptions ? `Controller${nameCapitalize}.$componentOptions` : '';
42
+ const componentOptions = hasComponentOptions
43
+ ? `Controller${nameCapitalize}.$componentOptions`
44
+ : '';
39
45
  // import
40
46
  const _contentImportTypeZova: string[] = [];
41
- if (hasModels) _contentImportTypeZova.push('DefineModelOptions', 'TypePropUpdateFromModel', 'TypePropValueFromModel');
47
+ if (hasModels)
48
+ _contentImportTypeZova.push(
49
+ 'DefineModelOptions',
50
+ 'TypePropUpdateFromModel',
51
+ 'TypePropValueFromModel',
52
+ );
42
53
  if (hasProps) _contentImportTypeZova.push('TypeControllerInnerProps');
43
54
  if (_contentImportTypeZova.length > 0) {
44
55
  contentImports.push(`import type { ${_contentImportTypeZova.join(', ')} } from 'zova';`);
@@ -47,12 +58,16 @@ export async function generateFileComponent(options: IMetadataCustomGenerateOpti
47
58
  if (hasModels) _contentImportTypeController.push(nameModels);
48
59
  if (hasProps) _contentImportTypeController.push(nameProps);
49
60
  if (_contentImportTypeController.length > 0) {
50
- contentImports.push(`import type { ${_contentImportTypeController.join(', ')} } from '../../component/${name}/controller${controllerExtJs}';`);
61
+ contentImports.push(
62
+ `import type { ${_contentImportTypeController.join(', ')} } from '../../component/${name}/controller${controllerExtJs}';`,
63
+ );
51
64
  }
52
65
  contentImports.push("import { defineComponent } from 'vue'");
53
66
  contentImports.push("import { prepareComponentOptions, useController } from 'zova';");
54
67
  // controller
55
- contentImports.push(`import { ${className} } from '../../component/${name}/controller${controllerExtJs}';`);
68
+ contentImports.push(
69
+ `import { ${className} } from '../../component/${name}/controller${controllerExtJs}';`,
70
+ );
56
71
  // render
57
72
  if (hasRenderFirst) {
58
73
  contentImports.push(importRenderFirst);
@@ -8,7 +8,10 @@ import path from 'node:path';
8
8
 
9
9
  import type { IControllerInfo } from './types.ts';
10
10
 
11
- export async function generateMetaPage(options: IMetadataCustomGenerateOptions, globFiles: [IGlobBeanFile, IControllerInfo][]) {
11
+ export async function generateMetaPage(
12
+ options: IMetadataCustomGenerateOptions,
13
+ globFiles: [IGlobBeanFile, IControllerInfo][],
14
+ ) {
12
15
  if (globFiles.length === 0) return '';
13
16
  const { moduleName } = options;
14
17
  const contentImports: string[] = [];
@@ -29,16 +32,27 @@ export async function generateMetaPage(options: IMetadataCustomGenerateOptions,
29
32
  if (hasSchemaParams || hasSchemaQuery) {
30
33
  contentImports.push(`import { ${namespace} } from './page/${name}.js';`);
31
34
  // rest
32
- const restIndexFileRelative = path.relative(srcDirRest, path.join(options.modulePath, `src/.metadata/page/${name}.js`));
33
- contentImportsRest.push(`import { ${namespace} as ${namespaceRest} } from '${restIndexFileRelative}';`);
35
+ const restIndexFileRelative = path.relative(
36
+ srcDirRest,
37
+ path.join(options.modulePath, `src/.metadata/page/${name}.js`),
38
+ );
39
+ contentImportsRest.push(
40
+ `import { ${namespace} as ${namespaceRest} } from '${restIndexFileRelative}';`,
41
+ );
34
42
  }
35
43
  // controller.tsx
36
44
  const { routePath, routeName } = _extractRoutePathOrName(options, globFile, controllerInfo);
37
45
  // no matter that: route.meta?.absolute
38
- const routePathFull = routePath ? `/${moduleName.replace('-', '/')}/${routePath}` : `/${moduleName.replace('-', '/')}`;
46
+ const routePathFull = routePath
47
+ ? `/${moduleName.replace('-', '/')}/${routePath}`
48
+ : `/${moduleName.replace('-', '/')}`;
39
49
  const routeNameFull = `${moduleName}:${routeName}`;
40
- contentPathRecords.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespace));
41
- contentPathRecordsRest.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespaceRest));
50
+ contentPathRecords.push(
51
+ _combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespace),
52
+ );
53
+ contentPathRecordsRest.push(
54
+ _combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespaceRest),
55
+ );
42
56
  if (!routeName) {
43
57
  // contentPathRecords.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, className));
44
58
  } else {
@@ -115,7 +129,11 @@ function _combineModuleNameControllerName(moduleName: string, className: string)
115
129
  return `NS${toUpperCaseFirstChar(combineResourceName(className, moduleName, false, false))}`;
116
130
  }
117
131
 
118
- function _extractRoutePathOrName(options: IMetadataCustomGenerateOptions, _globFile: IGlobBeanFile, controllerInfo: IControllerInfo) {
132
+ function _extractRoutePathOrName(
133
+ options: IMetadataCustomGenerateOptions,
134
+ _globFile: IGlobBeanFile,
135
+ controllerInfo: IControllerInfo,
136
+ ) {
119
137
  const cli = options.cli;
120
138
  const targetFile = path.join(options.modulePath, 'src/routes.ts');
121
139
  const content = fse.readFileSync(targetFile).toString('utf8');
@@ -130,7 +148,8 @@ function _extractRoutePathOrName(options: IMetadataCustomGenerateOptions, _globF
130
148
  return (item.node as any).properties.some(prop => {
131
149
  return (
132
150
  prop.key.name === 'component' &&
133
- (prop.value.name === controllerInfo.nameCapitalize || prop.value.name === `ZPage${controllerInfo.nameCapitalize}`)
151
+ (prop.value.name === controllerInfo.nameCapitalize ||
152
+ prop.value.name === `ZPage${controllerInfo.nameCapitalize}`)
134
153
  );
135
154
  });
136
155
  });
@@ -148,7 +167,12 @@ function _extractRoutePathOrName(options: IMetadataCustomGenerateOptions, _globF
148
167
  return { routePath, routeName };
149
168
  }
150
169
 
151
- function _combineContentPathRecord(key: string, hasSchemaParams, hasSchemaQuery: boolean, namespace: string) {
170
+ function _combineContentPathRecord(
171
+ key: string,
172
+ hasSchemaParams,
173
+ hasSchemaQuery: boolean,
174
+ namespace: string,
175
+ ) {
152
176
  return `'${key}': TypePagePathSchema<${hasSchemaParams ? `${namespace}.ParamsInput` : 'undefined'},${hasSchemaQuery ? `${namespace}.QueryInput` : 'undefined'}>;`;
153
177
  // return `'${key}': {
154
178
  // path: ${value},
@@ -7,13 +7,24 @@ export function combineContentRenderAndStyle(
7
7
  genericDeclare: string,
8
8
  genericArguments: string,
9
9
  ) {
10
- const { hasRenderFirst, classNameRenderFirst, classNameRenderOthers, hasStyleFirst, classNameStyleFirst, classNameStyleOthers } = controllerInfo;
10
+ const {
11
+ hasRenderFirst,
12
+ classNameRenderFirst,
13
+ classNameRenderOthers,
14
+ hasStyleFirst,
15
+ classNameStyleFirst,
16
+ classNameStyleOthers,
17
+ } = controllerInfo;
11
18
  const contentControllerInterfaceRecords: string[] = [];
12
19
  if (hasStyleFirst) {
13
- contentControllerInterfaceRecords.push(`export interface ${classNameStyleFirst}${genericDeclare} extends ${className}${genericArguments} {}`);
20
+ contentControllerInterfaceRecords.push(
21
+ `export interface ${classNameStyleFirst}${genericDeclare} extends ${className}${genericArguments} {}`,
22
+ );
14
23
  }
15
24
  for (const item of classNameStyleOthers) {
16
- contentControllerInterfaceRecords.push(`export interface ${item}${genericDeclare} extends ${className}${genericArguments} {}`);
25
+ contentControllerInterfaceRecords.push(
26
+ `export interface ${item}${genericDeclare} extends ${className}${genericArguments} {}`,
27
+ );
17
28
  }
18
29
  if (hasRenderFirst) {
19
30
  if (hasStyleFirst) {
@@ -21,14 +32,20 @@ export function combineContentRenderAndStyle(
21
32
  `export interface ${classNameRenderFirst}${genericDeclare} extends ${classNameStyleFirst}${genericArguments} {}`,
22
33
  );
23
34
  } else {
24
- contentControllerInterfaceRecords.push(`export interface ${classNameRenderFirst}${genericDeclare} extends ${className}${genericArguments} {}`);
35
+ contentControllerInterfaceRecords.push(
36
+ `export interface ${classNameRenderFirst}${genericDeclare} extends ${className}${genericArguments} {}`,
37
+ );
25
38
  }
26
39
  }
27
40
  for (const item of classNameRenderOthers) {
28
41
  if (hasStyleFirst) {
29
- contentControllerInterfaceRecords.push(`export interface ${item}${genericDeclare} extends ${classNameStyleFirst}${genericArguments} {}`);
42
+ contentControllerInterfaceRecords.push(
43
+ `export interface ${item}${genericDeclare} extends ${classNameStyleFirst}${genericArguments} {}`,
44
+ );
30
45
  } else {
31
- contentControllerInterfaceRecords.push(`export interface ${item}${genericDeclare} extends ${className}${genericArguments} {}`);
46
+ contentControllerInterfaceRecords.push(
47
+ `export interface ${item}${genericDeclare} extends ${className}${genericArguments} {}`,
48
+ );
32
49
  }
33
50
  }
34
51
  if (contentControllerInterfaceRecords.length === 0) return '';
@@ -1 +1 @@
1
- {"version":3,"file":"aop.d.ts","sourceRoot":"","sources":["../../src/types/aop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE1F,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAGhG,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,EAAE,IAAI,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAEnE,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,EAAE,IAAI,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;AAEzE,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,EAAE,IAAI,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAEnE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE,IAAI,SAAS,MAAM,CAAC,EAAE,MAAM,GAAG,S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CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAElG,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE,IAAI,SAAS,MAAM,CAAC,EAAE,IAAI,GAAG,SAAS,IAE9E,CACE,KAAK,EAAE,IAAI,SAAS,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EAC7F,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EACrC,SAAS,EAAE,CAAC,KAEX,OAAO,CAAC;AAEb,MAAM,WAAW,UAAU;CAAG;AAE9B,MAAM,WAAW,oBACf,SACE,mBAAmB,EACnB,kBAAkB,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,EAC9C,iBAAiB,CAAC,MAAM,UAAU,CAAC;CAAG;AAE1C,OAAO,QAAQ,oBAAoB,CAAC;IAClC,UAAiB,QAAQ;QACvB,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,MAAM,UAAU,CAAC,CAAC;KAC3D;CACF;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,YAAY;QAC3B,GAAG,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;KAC5B;IAED,UAAiB,gBAAgB;QAC/B,GAAG,EAAE,KAAK,CAAC;KACZ;CACF"}
@@ -38,7 +38,9 @@ export function extractGenericParamsAndImports(filePath, interfaceName) {
38
38
  const clause = node.importClause;
39
39
  if (!clause?.namedBindings || !ts.isNamedImports(clause.namedBindings))
40
40
  return;
41
- const matched = clause.namedBindings.elements.map(el => el.name.text).filter(name => typeRefNames.has(name));
41
+ const matched = clause.namedBindings.elements
42
+ .map(el => el.name.text)
43
+ .filter(name => typeRefNames.has(name));
42
44
  if (matched.length === 0)
43
45
  return;
44
46
  const specifier = node.moduleSpecifier.text;
@@ -57,7 +57,9 @@ function _parseControllerInfo(options, globFile) {
57
57
  const matchGeneric = hasProps && extractGenericParamsAndImports(file, nameProps); // fileContent.match(__regProps);
58
58
  const hasGeneric = !!(matchGeneric && matchGeneric.genericParams);
59
59
  const generic = hasGeneric ? matchGeneric.genericParams : undefined;
60
- const genericKeys = hasGeneric ? matchGeneric.genericParams.split(',').map(item => item.trim().split(' ')[0]) : undefined;
60
+ const genericKeys = hasGeneric
61
+ ? matchGeneric.genericParams.split(',').map(item => item.trim().split(' ')[0])
62
+ : undefined;
61
63
  const generateImports = hasGeneric ? matchGeneric.imports : undefined;
62
64
  // schemaParams
63
65
  const nameSchemaParams = `${className}SchemaParams`;
@@ -9,7 +9,9 @@ export async function generateFileComponent(options, globFile, controllerInfo) {
9
9
  }
10
10
  const genericDeclare = hasGeneric ? `<${generic}>` : '';
11
11
  const genericArguments = hasGeneric ? `<${genericKeys?.join(', ')}>` : '';
12
- const componentOptions = hasComponentOptions ? `Controller${nameCapitalize}.$componentOptions` : '';
12
+ const componentOptions = hasComponentOptions
13
+ ? `Controller${nameCapitalize}.$componentOptions`
14
+ : '';
13
15
  // import
14
16
  const _contentImportTypeZova = [];
15
17
  if (hasModels)
@@ -30,7 +30,9 @@ export async function generateMetaPage(options, globFiles) {
30
30
  // controller.tsx
31
31
  const { routePath, routeName } = _extractRoutePathOrName(options, globFile, controllerInfo);
32
32
  // no matter that: route.meta?.absolute
33
- const routePathFull = routePath ? `/${moduleName.replace('-', '/')}/${routePath}` : `/${moduleName.replace('-', '/')}`;
33
+ const routePathFull = routePath
34
+ ? `/${moduleName.replace('-', '/')}/${routePath}`
35
+ : `/${moduleName.replace('-', '/')}`;
34
36
  const routeNameFull = `${moduleName}:${routeName}`;
35
37
  contentPathRecords.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespace));
36
38
  contentPathRecordsRest.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespaceRest));
@@ -126,7 +128,8 @@ function _extractRoutePathOrName(options, _globFile, controllerInfo) {
126
128
  const astMatch = astMatches.find(item => {
127
129
  return item.node.properties.some(prop => {
128
130
  return (prop.key.name === 'component' &&
129
- (prop.value.name === controllerInfo.nameCapitalize || prop.value.name === `ZPage${controllerInfo.nameCapitalize}`));
131
+ (prop.value.name === controllerInfo.nameCapitalize ||
132
+ prop.value.name === `ZPage${controllerInfo.nameCapitalize}`));
130
133
  });
131
134
  });
132
135
  if (!astMatch) {
@@ -1,5 +1,5 @@
1
1
  export function combineContentRenderAndStyle(controllerInfo, moduleName, className, genericDeclare, genericArguments) {
2
- const { hasRenderFirst, classNameRenderFirst, classNameRenderOthers, hasStyleFirst, classNameStyleFirst, classNameStyleOthers } = controllerInfo;
2
+ const { hasRenderFirst, classNameRenderFirst, classNameRenderOthers, hasStyleFirst, classNameStyleFirst, classNameStyleOthers, } = controllerInfo;
3
3
  const contentControllerInterfaceRecords = [];
4
4
  if (hasStyleFirst) {
5
5
  contentControllerInterfaceRecords.push(`export interface ${classNameStyleFirst}${genericDeclare} extends ${className}${genericArguments} {}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-module-a-bean",
3
- "version": "5.1.17",
4
- "gitHead": "343c61ad189fe3f0fc997ee9f4c710567657e05c",
3
+ "version": "5.1.18",
4
+ "gitHead": "ed6b11bdf77a2b7efcc261676c2812c3044768f1",
5
5
  "description": "",
6
6
  "keywords": [
7
7
  "Zova Module"
package/src/types/aop.ts CHANGED
@@ -27,7 +27,12 @@ export type AopAction<T extends {}, NAME extends keyof T, RESULT = undefined> =
27
27
  ? Promise<RESULT>
28
28
  : RESULT;
29
29
 
30
- export type AopActionMethod<T extends {}> = (method: keyof T, args: any[], next: AopActionNext<any[], any>, _receiver: T) => any;
30
+ export type AopActionMethod<T extends {}> = (
31
+ method: keyof T,
32
+ args: any[],
33
+ next: AopActionNext<any[], any>,
34
+ _receiver: T,
35
+ ) => any;
31
36
 
32
37
  export type AopActionGetter<T extends {}, NAME extends keyof T, RESULT = undefined> =
33
38
  // @ts-ignore ignore
@@ -49,7 +54,10 @@ export type AopActionSetter<T extends {}, NAME extends keyof T, DATA = undefined
49
54
  export interface IAopRecord {}
50
55
 
51
56
  export interface IDecoratorAopOptions
52
- extends IOnionOptionsEnable, IOnionOptionsMatch<keyof IBeanRecord | RegExp>, IOnionOptionsDeps<keyof IAopRecord> {}
57
+ extends
58
+ IOnionOptionsEnable,
59
+ IOnionOptionsMatch<keyof IBeanRecord | RegExp>,
60
+ IOnionOptionsDeps<keyof IAopRecord> {}
53
61
 
54
62
  declare module 'zova-module-a-bean' {
55
63
  export interface SysOnion {