New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@travetto/transformer

Package Overview
Dependencies
Maintainers
1
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/transformer - npm Package Compare versions

Comparing version 3.4.2 to 3.4.3

2

package.json
{
"name": "@travetto/transformer",
"version": "3.4.2",
"version": "3.4.3",
"description": "Functionality for AST transformations, with transformer registration, and general utils",

@@ -5,0 +5,0 @@ "keywords": [

@@ -298,3 +298,3 @@ import ts from 'typescript';

generateUniqueIdentifier(node: ts.Node, type: AnyType): string {
let unique: string | undefined;
let unique: string[] = [];
let name = type.name && !type.name.startsWith('_') ? type.name : '';

@@ -312,3 +312,2 @@ if (!name && hasEscapedName(node)) {

if (fileName === this.source.fileName) { // if in same file suffix with location
const route: string[] = [];
let child = node;

@@ -318,3 +317,3 @@ while (child && !ts.isSourceFile(child)) {

if (child.name) {
route.push(child.name.getText());
unique.push(child.name.getText());
}

@@ -324,7 +323,5 @@ }

}
if (!route.length) { // Only filename
route.push(ts.getLineAndCharacterOfPosition(tgt.getSourceFile(), tgt.getStart()).line.toString());
if (!unique.length) { // a top level type
unique.push(ts.getLineAndCharacterOfPosition(tgt.getSourceFile(), tgt.getStart()).line.toString());
}
route.unshift(fileName);
unique = SystemUtil.naiveHashString(route.join(':'), 12);
} else {

@@ -334,8 +331,11 @@ // Otherwise treat it as external and add nothing to it

} catch {
// Determine type unique ident
const imp = this.#resolver.getFileImportName(this.source.fileName);
unique = SystemUtil.naiveHashString(`${imp}${type.name ?? 'unknown'}`, 12);
unique = [type.name ?? 'unknown']; // Type is only unique piece
}
// Otherwise read name with uuid
return unique ? `${name}__${unique}` : name;
if (unique.length) { // Make unique to file
unique.unshift(this.#resolver.getFileImportName(this.source.fileName));
return `${name}__${SystemUtil.naiveHashString(unique.join(':'), 12)}`;
} else {
return name;
}
}

@@ -342,0 +342,0 @@

@@ -1,19 +0,4 @@

import crypto from 'crypto';
export class SystemUtil {
/**
* Generate a random UUID
* @param len The length of the uuid to generate
*/
static uuid(len: number = 32): string {
const bytes = crypto.randomBytes(Math.ceil(len / 2));
// eslint-disable-next-line no-bitwise
bytes[6] = (bytes[6] & 0x0f) | 0x40;
// eslint-disable-next-line no-bitwise
bytes[8] = (bytes[8] & 0x3f) | 0x80;
return bytes.toString('hex').substring(0, len);
}
/**
* Naive hashing

@@ -20,0 +5,0 @@ */

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