Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-flow-strip-types

Package Overview
Dependencies
Maintainers
6
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-flow-strip-types - npm Package Compare versions

Comparing version 7.8.3 to 7.9.0

36

lib/index.js

@@ -16,6 +16,10 @@ "use strict";

var _default = (0, _helperPluginUtils.declare)(api => {
var _default = (0, _helperPluginUtils.declare)((api, opts) => {
api.assertVersion(7);
const FLOW_DIRECTIVE = /(@flow(\s+(strict(-local)?|weak))?|@noflow)/;
let skipStrip = false;
const {
requireDirective = false,
allowDeclareFields = false
} = opts;
return {

@@ -30,4 +34,3 @@ name: "transform-flow-strip-types",

}
},
opts
}
}) {

@@ -50,3 +53,3 @@ skipStrip = false;

if (!directiveFound && opts.requireDirective) {
if (!directiveFound && requireDirective) {
skipStrip = true;

@@ -81,9 +84,2 @@ }

ClassProperty(path) {
if (skipStrip) return;
path.node.variance = null;
path.node.typeAnnotation = null;
if (!path.node.value) path.remove();
},
ClassPrivateProperty(path) {

@@ -99,4 +95,18 @@ if (skipStrip) return;

if (child.isClassProperty()) {
child.node.typeAnnotation = null;
if (!child.node.value) child.remove();
const {
node
} = child;
if (!allowDeclareFields && node.declare) {
throw child.buildCodeFrameError(`The 'declare' modifier is only allowed when the ` + `'allowDeclareFields' option of ` + `@babel/plugin-transform-flow-strip-types or ` + `@babel/preset-flow is enabled.`);
}
if (node.declare) {
child.remove();
} else if (!allowDeclareFields && !node.value && !node.decorators) {
child.remove();
} else {
node.variance = null;
node.typeAnnotation = null;
}
}

@@ -103,0 +113,0 @@ });

{
"name": "@babel/plugin-transform-flow-strip-types",
"version": "7.8.3",
"version": "7.9.0",
"description": "Strip flow type annotations from your output code.",

@@ -22,6 +22,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-strip-types",

"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/core": "^7.9.0",
"@babel/helper-plugin-test-runner": "^7.8.3"
},
"gitHead": "a7620bd266ae1345975767bbc7abf09034437017"
"gitHead": "8d5e422be27251cfaadf8dd2536b31b4a5024b02"
}
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