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

babel-plugin-spectypes

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-spectypes - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

21

dist/cjs/index.js

@@ -37,9 +37,10 @@ "use strict";

for (const decl of path.node.declarations) {
const spec = t.isIdentifier(decl.init)
? decl.init.name
: t.isCallExpression(decl.init) && t.isIdentifier(decl.init.callee)
? decl.init.callee.name
const declInit = t.isSequenceExpression(decl.init) ? decl.init.expressions[1] : decl.init;
const spec = t.isIdentifier(declInit)
? declInit.name
: t.isCallExpression(declInit) && t.isIdentifier(declInit.callee)
? declInit.callee.name
: '';
if (spec in specNames && (0, ts_is_defined_1.isDefined)(decl.init) && t.isIdentifier(decl.id)) {
const parsed = (0, parse_1.parse)(decl.init, { specNames });
if (spec in specNames && (0, ts_is_defined_1.isDefined)(declInit) && t.isIdentifier(decl.id)) {
const parsed = (0, parse_1.parse)(declInit, { specNames });
if (parsed.tag === 'success') {

@@ -57,3 +58,9 @@ const transformed = (0, transform_1.transform)(parsed.success, {

});
decl.init = (0, parser_1.parseExpression)(transformed);
const result = (0, parser_1.parseExpression)(transformed);
if (t.isSequenceExpression(decl.init)) {
decl.init.expressions[1] = result;
}
else {
decl.init = result;
}
}

@@ -60,0 +67,0 @@ else {

{
"name": "babel-plugin-spectypes",
"version": "0.0.21",
"version": "0.0.22",
"private": false,

@@ -48,3 +48,3 @@ "description": "Babel plugin that compiles spectypes validators",

"ts-is-record": "^2.0.3",
"ts-micro-dict": "^8.0.3",
"ts-micro-dict": "^8.1.5",
"ts-tiny-invariant": "^1.0.5"

@@ -51,0 +51,0 @@ },

@@ -46,10 +46,11 @@ import type babelCore from '@babel/core'

for (const decl of path.node.declarations) {
const spec = t.isIdentifier(decl.init)
? decl.init.name
: t.isCallExpression(decl.init) && t.isIdentifier(decl.init.callee)
? decl.init.callee.name
const declInit = t.isSequenceExpression(decl.init) ? decl.init.expressions[1] : decl.init
const spec = t.isIdentifier(declInit)
? declInit.name
: t.isCallExpression(declInit) && t.isIdentifier(declInit.callee)
? declInit.callee.name
: ''
if (spec in specNames && isDefined(decl.init) && t.isIdentifier(decl.id)) {
const parsed = parse(decl.init, { specNames })
if (spec in specNames && isDefined(declInit) && t.isIdentifier(decl.id)) {
const parsed = parse(declInit, { specNames })

@@ -73,3 +74,8 @@ if (parsed.tag === 'success') {

decl.init = parseExpression(transformed)
const result = parseExpression(transformed)
if (t.isSequenceExpression(decl.init)) {
decl.init.expressions[1] = result
} else {
decl.init = result
}
} else {

@@ -76,0 +82,0 @@ throw path.buildCodeFrameError(parsed.failure)

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