Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kmore-types

Package Overview
Dependencies
Maintainers
1
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kmore-types - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [0.7.0](https://github.com/waitingsong/kmore-types/compare/v0.6.0...v0.7.0) (2019-09-06)
### Bug Fixes
* break within matchSourceFileWithFilePath() ([4f8b4be](https://github.com/waitingsong/kmore-types/commit/4f8b4be))
## [0.6.0](https://github.com/waitingsong/kmore-types/compare/v0.5.0...v0.6.0) (2019-08-15)

@@ -7,0 +14,0 @@

41

dist/index.cjs.js

@@ -5,3 +5,3 @@ /**

*
* @version 0.6.0
* @version 0.7.0
* @author waiting

@@ -321,6 +321,6 @@ * @license MIT

*
* @param id <path>:<line>:<col>:typeid-<typeid>
* @param id <path>:<line>:<col>:typeid-<typeName>
*/
function pickInfoFromCallerTypeId(id) {
const matched = id.match(/^(.+):(\d+):(\d+):typeid-(\d+)$/u);
const matched = id.match(/^(.+):(\d+):(\d+):typeid-([\d\w]+)$/u);
if (matched && matched.length === 5) {

@@ -331,3 +331,3 @@ const ret = {

column: +matched[3],
typeId: +matched[4],
typeId: matched[4],
};

@@ -425,2 +425,3 @@ return ret;

ret.sourceFile = sourceFile;
break;
}

@@ -639,17 +640,21 @@ }

if (gType && gType.symbol) {
// might be type alias name so we use typdid
// const genericsArgName: GenericsArgName = typeName.text
// @ts-ignore
const typeid = typeof gType.id === 'number' ? gType.id : Math.random();
const localTypeId = `${caller.path}:typeid-${typeid}`;
if (retMap.has(localTypeId)) {
return retMap;
const sym = gType.getSymbol();
if (sym) {
const inputTypeName = sym.getName();
// might be type alias name so we use typdid
// const genericsArgName: GenericsArgName = typeName.text
// @ts-ignore
// const typeid: number = typeof gType.id === 'number' ? gType.id : Math.random()
const localTypeId = `${caller.path}:typeid-${inputTypeName}`;
if (retMap.has(localTypeId)) {
return retMap;
}
else if (cacheMap.localTypeMap.has(localTypeId)) {
retMap.set(localTypeId, new Map()); // empty map, pick from resolved data later.
}
else {
const tagMap = genTbListTagMapFromSymbol(gType.symbol);
tagMap.size && retMap.set(localTypeId, tagMap);
}
}
else if (cacheMap.localTypeMap.has(localTypeId)) {
retMap.set(localTypeId, new Map()); // empty map
}
else {
const tagMap = genTbListTagMapFromSymbol(gType.symbol);
tagMap.size && retMap.set(localTypeId, tagMap);
}
}

@@ -656,0 +661,0 @@ }

@@ -94,17 +94,21 @@ import { buildTbListParam, isTsFile, getCallerStack } from './util';

if (gType && gType.symbol) {
// might be type alias name so we use typdid
// const genericsArgName: GenericsArgName = typeName.text
// @ts-ignore
const typeid = typeof gType.id === 'number' ? gType.id : Math.random();
const localTypeId = `${caller.path}:typeid-${typeid}`;
if (retMap.has(localTypeId)) {
return retMap;
const sym = gType.getSymbol();
if (sym) {
const inputTypeName = sym.getName();
// might be type alias name so we use typdid
// const genericsArgName: GenericsArgName = typeName.text
// @ts-ignore
// const typeid: number = typeof gType.id === 'number' ? gType.id : Math.random()
const localTypeId = `${caller.path}:typeid-${inputTypeName}`;
if (retMap.has(localTypeId)) {
return retMap;
}
else if (cacheMap.localTypeMap.has(localTypeId)) {
retMap.set(localTypeId, new Map()); // empty map, pick from resolved data later.
}
else {
const tagMap = genTbListTagMapFromSymbol(gType.symbol);
tagMap.size && retMap.set(localTypeId, tagMap);
}
}
else if (cacheMap.localTypeMap.has(localTypeId)) {
retMap.set(localTypeId, new Map()); // empty map
}
else {
const tagMap = genTbListTagMapFromSymbol(gType.symbol);
tagMap.size && retMap.set(localTypeId, tagMap);
}
}

@@ -111,0 +115,0 @@ }

@@ -48,7 +48,7 @@ import * as ts from 'typescript';

export declare type CallerIdToLocalTypeIdMap = Map<CallerId, LocalTypeId>;
/** Format <caller.path>:typeid-<typeid> */
/** Format <caller.path>:typeid-<inputGenericsTypeName> */
export declare type LocalTypeId = string;
/** Format <caller.path>:<line>:<column> */
export declare type CallerId = string;
/** Format <caller.path>:<line>:<column>:typeid-<typeid> */
/** Format <caller.path>:<line>:<column>:typeid-<inputGenericsTypeName> */
export declare type CallerTypeId = string;

@@ -67,3 +67,4 @@ export declare type CallerTbListMap<T extends TTableListModel> = Map<CallerTypeId, DbTables<T>>;

export interface CallerTypeIdInfo extends CallerInfo {
typeId: number;
/** GenericsTypeName as param */
typeId: string;
}

@@ -70,0 +71,0 @@ /**

@@ -5,3 +5,3 @@ import * as ts from 'typescript';

*
* @param id <path>:<line>:<col>:typeid-<typeid>
* @param id <path>:<line>:<col>:typeid-<typeName>
*/

@@ -8,0 +8,0 @@ export declare function pickInfoFromCallerTypeId(id: CallerTypeId): CallerTypeIdInfo;

@@ -7,6 +7,6 @@ // eslint-disable-next-line import/no-extraneous-dependencies

*
* @param id <path>:<line>:<col>:typeid-<typeid>
* @param id <path>:<line>:<col>:typeid-<typeName>
*/
export function pickInfoFromCallerTypeId(id) {
const matched = id.match(/^(.+):(\d+):(\d+):typeid-(\d+)$/u);
const matched = id.match(/^(.+):(\d+):(\d+):typeid-([\d\w]+)$/u);
if (matched && matched.length === 5) {

@@ -17,3 +17,3 @@ const ret = {

column: +matched[3],
typeId: +matched[4],
typeId: matched[4],
};

@@ -111,2 +111,3 @@ return ret;

ret.sourceFile = sourceFile;
break;
}

@@ -113,0 +114,0 @@ }

{
"name": "kmore-types",
"author": "waiting",
"version": "0.6.0",
"version": "0.7.0",
"description": "Retrieve types info from ts file",

@@ -59,3 +59,3 @@ "keywords": [

"@types/mocha": "*",
"@types/node": "^12.0.2",
"@types/node": "*",
"@types/power-assert": "*",

@@ -69,3 +69,3 @@ "@types/rewire": "*",

"cross-env": "^5.2.0",
"eslint": "^6.1.0",
"eslint": "^6.2.0",
"espower-typescript": "^9.0.2",

@@ -78,3 +78,3 @@ "intelli-espower-loader": "^1.0.1",

"rewire": "^4.0.0",
"rimraf": "^2.6.2",
"rimraf": "^3.0.0",
"rollup-plugin-commonjs": "^10.0.0",

@@ -86,3 +86,3 @@ "rollup-plugin-node-resolve": "^5.0.1",

"typescript": "^3.5.0",
"yargs": "^13.0.0"
"yargs": "^14.0.0"
},

@@ -104,2 +104,3 @@ "peerDependencies": {

"lint": "eslint --fix {src,test}/**/*.ts",
"postpublish": "git push origin --follow-tags",
"prepublishOnly": "npm run clean && npm run build",

@@ -106,0 +107,0 @@ "release": "standard-version -r",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc