kmore-types
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -5,2 +5,4 @@ # Changelog | ||
## [0.3.0](https://github.com/waitingsong/kmore-types/compare/v0.2.0...v0.3.0) (2019-08-12) | ||
## [0.2.0](https://github.com/waitingsong/kmore-types/compare/v0.1.0...v0.2.0) (2019-08-12) | ||
@@ -7,0 +9,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @version 0.2.0 | ||
* @version 0.3.0 | ||
* @author waiting | ||
@@ -35,3 +35,2 @@ * @license MIT | ||
callerFuncNames: initOptions.callerFuncNames, | ||
includePathKeyWords: [], | ||
stackDepth: 1, | ||
@@ -374,29 +373,2 @@ }; | ||
} | ||
function needWalkSourFileObject(pathKeyWords, srcPath) { | ||
if (srcPath && srcPath.includes('node_modules')) { | ||
return false; | ||
} | ||
else if (!pathKeyWords || !pathKeyWords.length) { | ||
return true; | ||
} | ||
else if (isPathKeyWordsExistsInSrcPath(pathKeyWords, srcPath)) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
function isPathKeyWordsExistsInSrcPath(pathKeyWords, srcPath) { | ||
if (typeof pathKeyWords === 'string') { | ||
return srcPath.includes(pathKeyWords); | ||
} | ||
else if (Array.isArray(pathKeyWords)) { | ||
for (const key of pathKeyWords) { | ||
if (srcPath.includes(key)) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
function matchSourceFileWithFilePath(path) { | ||
@@ -417,6 +389,2 @@ const targetPath = sharedCore.pathResolve(path).replace(/\\/gu, '/'); | ||
for (const sourceFile of program.getSourceFiles()) { | ||
// @ts-ignore | ||
if (!needWalkSourFileObject('', sourceFile.path)) { | ||
continue; | ||
} | ||
/* istanbul ignore else */ | ||
@@ -689,3 +657,2 @@ if (!sourceFile.isDeclarationFile) { | ||
exports.isContainsCallerFuncNames = isContainsCallerFuncNames; | ||
exports.isPathKeyWordsExistsInSrcPath = isPathKeyWordsExistsInSrcPath; | ||
exports.isTsFile = isTsFile; | ||
@@ -695,3 +662,2 @@ exports.loadFile = loadFile; | ||
exports.matchSourceFileWithFilePath = matchSourceFileWithFilePath; | ||
exports.needWalkSourFileObject = needWalkSourFileObject; | ||
exports.pickInfoFromCallerTypeId = pickInfoFromCallerTypeId; | ||
@@ -698,0 +664,0 @@ exports.reWriteLoadingPath = reWriteLoadingPath; |
@@ -13,3 +13,2 @@ export const initOptions = { | ||
callerFuncNames: initOptions.callerFuncNames, | ||
includePathKeyWords: [], | ||
stackDepth: 1, | ||
@@ -16,0 +15,0 @@ }; |
@@ -93,4 +93,2 @@ import * as ts from 'typescript'; | ||
callerFuncNames: CallerFuncName | CallerFuncName[]; | ||
/** Always excluding "node_module/" */ | ||
includePathKeyWords?: string | string[]; | ||
/** Default: 1 */ | ||
@@ -97,0 +95,0 @@ stackDepth?: number; |
import * as ts from 'typescript'; | ||
import { CallerTypeIdInfo, CallerTypeId, CallerTypeMap, TbListTagMap, GenTbListFromTypeOpts, MatchedSourceFile, WalkNodeWithPositionOps, WalkNodeOps } from './model'; | ||
import { CallerTypeIdInfo, CallerTypeId, CallerTypeMap, TbListTagMap, MatchedSourceFile, WalkNodeWithPositionOps, WalkNodeOps } from './model'; | ||
/** | ||
@@ -11,6 +11,4 @@ * | ||
export declare function retrieveGenericsIdentifierFromTypeArguments(node: ts.CallExpression): ts.Identifier | void; | ||
export declare function needWalkSourFileObject(pathKeyWords: GenTbListFromTypeOpts['includePathKeyWords'], srcPath: string): boolean; | ||
export declare function isPathKeyWordsExistsInSrcPath(pathKeyWords: GenTbListFromTypeOpts['includePathKeyWords'], srcPath: string): boolean; | ||
export declare function matchSourceFileWithFilePath(path: string): MatchedSourceFile; | ||
export declare function walkNodeWithPosition(options: WalkNodeWithPositionOps): ts.CallExpression | void; | ||
export declare function walkNode(options: WalkNodeOps): Set<ts.CallExpression>; |
@@ -87,29 +87,2 @@ // eslint-disable-next-line import/no-extraneous-dependencies | ||
} | ||
export function needWalkSourFileObject(pathKeyWords, srcPath) { | ||
if (srcPath && srcPath.includes('node_modules')) { | ||
return false; | ||
} | ||
else if (!pathKeyWords || !pathKeyWords.length) { | ||
return true; | ||
} | ||
else if (isPathKeyWordsExistsInSrcPath(pathKeyWords, srcPath)) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
export function isPathKeyWordsExistsInSrcPath(pathKeyWords, srcPath) { | ||
if (typeof pathKeyWords === 'string') { | ||
return srcPath.includes(pathKeyWords); | ||
} | ||
else if (Array.isArray(pathKeyWords)) { | ||
for (const key of pathKeyWords) { | ||
if (srcPath.includes(key)) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
export function matchSourceFileWithFilePath(path) { | ||
@@ -130,6 +103,2 @@ const targetPath = pathResolve(path).replace(/\\/gu, '/'); | ||
for (const sourceFile of program.getSourceFiles()) { | ||
// @ts-ignore | ||
if (!needWalkSourFileObject('', sourceFile.path)) { | ||
continue; | ||
} | ||
/* istanbul ignore else */ | ||
@@ -136,0 +105,0 @@ if (!sourceFile.isDeclarationFile) { |
{ | ||
"name": "kmore-types", | ||
"author": "waiting", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Retrieve types info from ts file", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
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
104789
1500