flow-remove-types 2.167.1 → 2.171.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Facebook, Inc. and its affiliates.
3
+ Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/flow-node CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Copyright (c) Facebook, Inc. and its affiliates.
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
package/flow-remove-types CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Copyright (c) Facebook, Inc. and its affiliates.
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
package/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @noformat
7
+ * @format
8
8
  */
9
9
 
10
10
  var parse = require('flow-parser').parse;
@@ -103,7 +103,7 @@ function resultPrinter(options, source, removedNodes) {
103
103
  var pretty = Boolean(options && options.pretty);
104
104
 
105
105
  return {
106
- toString: function() {
106
+ toString: function () {
107
107
  if (!removedNodes || removedNodes.length === 0) {
108
108
  return source;
109
109
  }
@@ -135,7 +135,7 @@ function resultPrinter(options, source, removedNodes) {
135
135
 
136
136
  return (result += source.slice(lastPos));
137
137
  },
138
- generateMap: function() {
138
+ generateMap: function () {
139
139
  return {
140
140
  version: 3,
141
141
  sources: ['source.js'],
@@ -170,7 +170,7 @@ var removeFlowVisitor = {
170
170
  ClassDeclaration: removeImplementedInterfaces,
171
171
  ClassExpression: removeImplementedInterfaces,
172
172
 
173
- Identifier: function(context, node, ast) {
173
+ Identifier: function (context, node, ast) {
174
174
  if (node.optional) {
175
175
  // Find the optional token.
176
176
  var idx = findTokenIndex(ast.tokens, startOf(node));
@@ -181,7 +181,7 @@ var removeFlowVisitor = {
181
181
  }
182
182
  },
183
183
 
184
- FunctionDeclaration: function(context, node) {
184
+ FunctionDeclaration: function (context, node) {
185
185
  if (node.params && node.params.length) {
186
186
  if (node.params[0].name === 'this') {
187
187
  return removeNode(context, node.params[0], undefined, node.params[1]);
@@ -189,7 +189,7 @@ var removeFlowVisitor = {
189
189
  }
190
190
  },
191
191
 
192
- FunctionExpression: function(context, node) {
192
+ FunctionExpression: function (context, node) {
193
193
  if (node.params && node.params.length) {
194
194
  if (node.params[0].name === 'this') {
195
195
  return removeNode(context, node.params[0], undefined, node.params[1]);
@@ -197,7 +197,7 @@ var removeFlowVisitor = {
197
197
  }
198
198
  },
199
199
 
200
- PropertyDefinition: function(context, node) {
200
+ PropertyDefinition: function (context, node) {
201
201
  if (node.declare || (context.ignoreUninitializedFields && !node.value)) {
202
202
  return removeNode(context, node);
203
203
  }
@@ -206,19 +206,19 @@ var removeFlowVisitor = {
206
206
  }
207
207
  },
208
208
 
209
- ExportNamedDeclaration: function(context, node) {
209
+ ExportNamedDeclaration: function (context, node) {
210
210
  if (node.exportKind === 'type' || node.exportKind === 'typeof') {
211
211
  return removeNode(context, node);
212
212
  }
213
213
  },
214
214
 
215
- ImportDeclaration: function(context, node) {
215
+ ImportDeclaration: function (context, node) {
216
216
  if (node.importKind === 'type' || node.importKind === 'typeof') {
217
217
  return removeNode(context, node);
218
218
  }
219
219
  },
220
220
 
221
- ImportSpecifier: function(context, node) {
221
+ ImportSpecifier: function (context, node) {
222
222
  if (node.importKind === 'type' || node.importKind === 'typeof') {
223
223
  var ast = context.ast;
224
224
 
@@ -250,7 +250,7 @@ var removeFlowVisitor = {
250
250
  }
251
251
  },
252
252
 
253
- ArrowFunctionExpression: function(context, node) {
253
+ ArrowFunctionExpression: function (context, node) {
254
254
  // Naively erasing a multi-line return type from an arrow function will
255
255
  // leave a newline between the parameter list and the arrow, which is not
256
256
  // valid JS. Detect this here and move the arrow up to the correct line.
package/jest.js CHANGED
@@ -1,14 +1,16 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
6
8
  */
7
9
 
8
10
  var flowRemoveTypes = require('./index');
9
11
 
10
12
  module.exports = {
11
- process: function(src, filename) {
13
+ process: function (src, filename) {
12
14
  return flowRemoveTypes(src).toString();
13
- }
15
+ },
14
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flow-remove-types",
3
- "version": "2.167.1",
3
+ "version": "2.171.0",
4
4
  "description": "Removes Flow type annotations from JavaScript files with speed and simplicity.",
5
5
  "author": {
6
6
  "name": "Flow Team",
@@ -44,7 +44,7 @@
44
44
  "es6"
45
45
  ],
46
46
  "dependencies": {
47
- "flow-parser": "^0.167.1",
47
+ "flow-parser": "^0.171.0",
48
48
  "pirates": "^3.0.2",
49
49
  "vlq": "^0.2.1"
50
50
  },
package/register.js CHANGED
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
6
8
  */
7
9
 
8
10
  var flowRemoveTypes = require('./index');
@@ -33,7 +35,7 @@ var revert = pirates.addHook(
33
35
  throw e;
34
36
  }
35
37
  },
36
- {exts: exts, matcher: shouldTransform}
38
+ {exts: exts, matcher: shouldTransform},
37
39
  );
38
40
 
39
41
  function shouldTransform(filename) {
@@ -42,8 +44,8 @@ function shouldTransform(filename) {
42
44
  options && 'excludes' in options
43
45
  ? regexpPattern(options.excludes)
44
46
  : options && 'exclude' in options
45
- ? regexpPattern(options.exclude)
46
- : /\/node_modules\//;
47
+ ? regexpPattern(options.exclude)
48
+ : /\/node_modules\//;
47
49
  return (
48
50
  (!includes || includes.test(filename)) &&
49
51
  !(excludes && excludes.test(filename))
@@ -71,6 +73,6 @@ function regexpPattern(pattern) {
71
73
  throw new Error(
72
74
  'flow-remove-types: ' +
73
75
  'includes and excludes must be RegExp or path strings. Got: ' +
74
- pattern
76
+ pattern,
75
77
  );
76
78
  }