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

ts-blank-space

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-blank-space - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

20

out/index.js

@@ -231,3 +231,3 @@ // Copyright 2024 Bloomberg Finance L.P.

}
visitModifiers(node.modifiers);
visitModifiers(node.modifiers, /* addSemi:*/ false);
}

@@ -284,3 +284,3 @@

function visitModifiers(modifiers ) {
function visitModifiers(modifiers , addSemi ) {
for (let i = 0; i < modifiers.length; i++) {

@@ -290,3 +290,8 @@ const modifier = modifiers[i];

if (isRemovedModifier(kind)) {
blankExact(modifier);
if (addSemi && i === 0) {
str.blankButStartWithSemi(modifier.getStart(ast), modifier.end);
addSemi = false;
} else {
blankExact(modifier);
}
continue;

@@ -334,3 +339,3 @@ } else if (kind === SK.Decorator) {

}
visitModifiers(node.modifiers);
visitModifiers(node.modifiers, /* addSemi */ node.name.kind === SK.ComputedPropertyName);
}

@@ -401,8 +406,9 @@ node.exclamationToken && blankExact(node.exclamationToken);

const nodeName = node.name;
if (node.modifiers) {
visitModifiers(node.modifiers);
visitModifiers(node.modifiers, /* addSemi */ !!nodeName && nodeName.kind === SK.ComputedPropertyName);
}
if (node.name) {
visitor(node.name);
if (nodeName) {
visitor(nodeName);
}

@@ -409,0 +415,0 @@

{
"name": "ts-blank-space",
"description": "A small, fast, pure JavaScript type-stripper that uses the official TypeScript parser.",
"version": "0.4.2",
"version": "0.4.3",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "homepage": "https://bloomberg.github.io/ts-blank-space",

@@ -142,5 +142,5 @@ <a href="https://bloomberg.github.io/ts-blank-space">

To guard against [ASI](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#automatic_semicolon_insertion) issues in the output, `ts-blank-space` will add `;` to the end of type-only statements.
To guard against [ASI](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#automatic_semicolon_insertion) issues in the output, `ts-blank-space` will add `;` to the end of type-only statements, and when removing a leading type annotation could introduce an ASI hazard.
Example input:
#### Example one - type-only statement

@@ -163,2 +163,22 @@ <!-- prettier-ignore -->

#### Example two - computed class fields/methods
<!-- prettier-ignore -->
```typescript
class C {
field = 1/* no ; */
public ["computed field not accessing above"] = 2
}
```
becomes:
<!-- prettier-ignore -->
```javascript
class C {
field = 1/* no ; */
; ["computed field not accessing above"] = 2
}
```
### Arrow function type annotations that introduce a new line

@@ -165,0 +185,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