kmore-types
Advanced tools
Comparing version 0.18.0 to 0.19.0
@@ -6,2 +6,14 @@ # Change Log | ||
# [0.19.0](https://github.com/waitingsong/kmore/compare/v0.18.0...v0.19.0) (2020-06-16) | ||
### Performance Improvements | ||
* **kmore-types:** update walkNode() ([ab8a0eb](https://github.com/waitingsong/kmore/commit/ab8a0eba1ad2c3713a5f8f0218cc83af209ac155)) | ||
* **kmore-types:** update walkNodeWithPosition() ([600b9e8](https://github.com/waitingsong/kmore/commit/600b9e8ce25a1c0c7e5a73b5112fa2cdafa9b0f2)) | ||
# [0.18.0](https://github.com/waitingsong/kmore/compare/v0.17.1...v0.18.0) (2020-06-15) | ||
@@ -8,0 +20,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @version 0.17.1 | ||
* @version 0.18.0 | ||
* @author waiting | ||
@@ -602,7 +602,3 @@ * @license MIT | ||
if (isCallExpression(node)) { | ||
const expression = node.expression; | ||
if (expression) { | ||
return node; | ||
} | ||
return; // stop walk | ||
return node; // stop walk | ||
} | ||
@@ -627,10 +623,6 @@ } | ||
if (isCallExpression(node)) { | ||
const expression = node.expression; | ||
/* istanbul ignore else */ | ||
if (expression) { | ||
/* istanbul ignore else */ | ||
if (isCallerNameMatched(expression.getText(), options.matchFuncNameSet)) { | ||
ret.add(node); | ||
return; | ||
} // void else | ||
if (isCallerNameMatched(node.expression.getText(), options.matchFuncNameSet)) { | ||
ret.add(node); | ||
return; | ||
} // void else | ||
@@ -748,2 +740,3 @@ } // void else continue walk | ||
/* eslint-disable @typescript-eslint/prefer-optional-chain */ | ||
/** | ||
@@ -844,2 +837,3 @@ * Generate KTables from generics type T | ||
} | ||
// genTbListFromType<TbListModel>() | ||
const node = walkNodeWithPosition({ | ||
@@ -846,0 +840,0 @@ sourceFile, |
@@ -8,2 +8,2 @@ import { RetrieveInfoFromTypeOpts, CallerInfo, GenTbListFromTypeOpts, TTables, KTablesBase, LocalTypeItem } from './model'; | ||
export declare function snakeToCamel(string: string): string; | ||
export declare function retrieveLocalTypeItemFromType(options: RetrieveInfoFromTypeOpts): LocalTypeItem | void; | ||
export declare function retrieveLocalTypeItemFromType(options: RetrieveInfoFromTypeOpts): LocalTypeItem | undefined; |
@@ -0,1 +1,3 @@ | ||
/* eslint-disable @typescript-eslint/prefer-optional-chain */ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { cacheMap as cacheMapTop, initGenTbListFromTypeOpts, globalCallerFuncNameSet, } from './config'; | ||
@@ -99,2 +101,3 @@ import { genInfoFromNode, matchSourceFileWithFilePath, walkNodeWithPosition, } from './ts-util'; | ||
} | ||
// genTbListFromType<TbListModel>() | ||
const node = walkNodeWithPosition({ | ||
@@ -101,0 +104,0 @@ sourceFile, |
import { JsonType, Spread } from '@waiting/shared-types'; | ||
import { CallExpression, JSDocTagInfo, SourceFile, TypeChecker } from 'typescript'; | ||
import type { CallExpression, JSDocTagInfo, SourceFile, TypeChecker } from 'typescript'; | ||
/** | ||
* Database's tables definition (extends TTables) | ||
* @example ```ts | ||
* interface Db extends TTables { | ||
* tb_user: User | ||
* tb_user_detail: UserDeatil | ||
* } | ||
* ``` | ||
*/ | ||
export declare type TTables = Record<TableName, TableModel>; | ||
/** | ||
* Table's (partial) fields definition | ||
* @example ```ts | ||
* interface User { | ||
* uid: number | ||
* name: string | ||
* } | ||
* ``` | ||
*/ | ||
export declare type TableModel = Record<FieldName, any>; | ||
export interface Options extends GenTbListFromTypeOpts { | ||
@@ -47,3 +67,2 @@ /** Exported table vaiable name prefix. Default is "tbs_", result will be "tbs_m_n" */ | ||
export declare type CallerFuncName = string; | ||
export declare type TTables = object; | ||
/** | ||
@@ -174,2 +193,3 @@ * Database Tables Tag Map generated by generics type passing to genTbListFromGenerics<T>() | ||
export declare type TableName = string; | ||
export declare type FieldName = string; | ||
export declare type FilePath = string; | ||
@@ -176,0 +196,0 @@ export declare type FileName = string; |
@@ -17,5 +17,5 @@ import type { CallExpression, SourceFile, TypeChecker } from 'typescript'; | ||
/** Retrieve node with specified position from caller */ | ||
export declare function walkNodeWithPosition(options: WalkNodeWithPositionOps): CallExpression | void; | ||
export declare function walkNodeWithPosition(options: WalkNodeWithPositionOps): CallExpression | undefined; | ||
/** Retrieve node with specified matchFuncName */ | ||
export declare function walkNode(options: WalkNodeOps): Set<CallExpression>; | ||
export {}; |
@@ -183,7 +183,3 @@ /* eslint-disable import/no-extraneous-dependencies */ | ||
if (isCallExpression(node)) { | ||
const expression = node.expression; | ||
if (expression) { | ||
return node; | ||
} | ||
return; // stop walk | ||
return node; // stop walk | ||
} | ||
@@ -208,10 +204,6 @@ } | ||
if (isCallExpression(node)) { | ||
const expression = node.expression; | ||
/* istanbul ignore else */ | ||
if (expression) { | ||
/* istanbul ignore else */ | ||
if (isCallerNameMatched(expression.getText(), options.matchFuncNameSet)) { | ||
ret.add(node); | ||
return; | ||
} // void else | ||
if (isCallerNameMatched(node.expression.getText(), options.matchFuncNameSet)) { | ||
ret.add(node); | ||
return; | ||
} // void else | ||
@@ -218,0 +210,0 @@ } // void else continue walk |
{ | ||
"name": "kmore-types", | ||
"author": "waiting", | ||
"version": "0.18.0", | ||
"version": "0.19.0", | ||
"description": "Retrieve types info from ts file", | ||
@@ -87,3 +87,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "836a3108ed61288a81f5e3660fc11452ad3cad06" | ||
"gitHead": "6264a50ab2900cb3b03fc1e3376fb49fcc990428" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149534
2190