@putout/babel 3.1.1 → 3.2.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [NPMIMGURL]: https://img.shields.io/npm/v/@putout/babel.svg?style=flat&longCache=true
4
4
  [NPMURL]: https://npmjs.org/package/@putout/babel "npm"
5
5
 
6
- **CommonJS** pre-builts of Babel 8: if you want to migrate to [v8](https://github.com/babel/babel/releases/tag/v8.0.0-alpha.16), but cannot support **ESM** right now.
6
+ **CommonJS** pre-builts of Babel 8: if you want to migrate to [v8](https://github.com/babel/babel/releases/tag/v8.0.0-alpha.17), but cannot support **ESM** right now.
7
7
 
8
8
  Usage
9
9
 
package/bundle/index.js CHANGED
@@ -140,9 +140,9 @@ var require_picocolors = __commonJS({
140
140
  }
141
141
  });
142
142
 
143
- // node_modules/@babel/code-frame/node_modules/js-tokens/index.js
143
+ // node_modules/js-tokens/index.js
144
144
  var require_js_tokens = __commonJS({
145
- "node_modules/@babel/code-frame/node_modules/js-tokens/index.js"(exports2, module2) {
145
+ "node_modules/js-tokens/index.js"(exports2, module2) {
146
146
  var Identifier2;
147
147
  var JSXIdentifier2;
148
148
  var JSXPunctuator;
@@ -1294,11 +1294,12 @@ var require_browser = __commonJS({
1294
1294
  var require_has_flag = __commonJS({
1295
1295
  "node_modules/has-flag/index.js"(exports2, module2) {
1296
1296
  "use strict";
1297
- module2.exports = (flag, argv = process.argv) => {
1297
+ module2.exports = (flag, argv) => {
1298
+ argv = argv || process.argv;
1298
1299
  const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
1299
- const position = argv.indexOf(prefix2 + flag);
1300
- const terminatorPosition = argv.indexOf("--");
1301
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
1300
+ const pos = argv.indexOf(prefix2 + flag);
1301
+ const terminatorPos = argv.indexOf("--");
1302
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
1302
1303
  };
1303
1304
  }
1304
1305
  });
@@ -1308,23 +1309,16 @@ var require_supports_color = __commonJS({
1308
1309
  "node_modules/supports-color/index.js"(exports2, module2) {
1309
1310
  "use strict";
1310
1311
  var os = require("os");
1311
- var tty = require("tty");
1312
1312
  var hasFlag = require_has_flag();
1313
- var { env } = process;
1313
+ var env = process.env;
1314
1314
  var forceColor;
1315
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
1316
- forceColor = 0;
1315
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
1316
+ forceColor = false;
1317
1317
  } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
1318
- forceColor = 1;
1318
+ forceColor = true;
1319
1319
  }
1320
1320
  if ("FORCE_COLOR" in env) {
1321
- if (env.FORCE_COLOR === "true") {
1322
- forceColor = 1;
1323
- } else if (env.FORCE_COLOR === "false") {
1324
- forceColor = 0;
1325
- } else {
1326
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
1327
- }
1321
+ forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
1328
1322
  }
1329
1323
  function translateLevel(level) {
1330
1324
  if (level === 0) {
@@ -1337,8 +1331,8 @@ var require_supports_color = __commonJS({
1337
1331
  has16m: level >= 3
1338
1332
  };
1339
1333
  }
1340
- function supportsColor(haveStream, streamIsTTY) {
1341
- if (forceColor === 0) {
1334
+ function supportsColor(stream) {
1335
+ if (forceColor === false) {
1342
1336
  return 0;
1343
1337
  }
1344
1338
  if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
@@ -1347,22 +1341,19 @@ var require_supports_color = __commonJS({
1347
1341
  if (hasFlag("color=256")) {
1348
1342
  return 2;
1349
1343
  }
1350
- if (haveStream && !streamIsTTY && forceColor === void 0) {
1344
+ if (stream && !stream.isTTY && forceColor !== true) {
1351
1345
  return 0;
1352
1346
  }
1353
- const min = forceColor || 0;
1354
- if (env.TERM === "dumb") {
1355
- return min;
1356
- }
1347
+ const min = forceColor ? 1 : 0;
1357
1348
  if (process.platform === "win32") {
1358
1349
  const osRelease = os.release().split(".");
1359
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1350
+ if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1360
1351
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
1361
1352
  }
1362
1353
  return 1;
1363
1354
  }
1364
1355
  if ("CI" in env) {
1365
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
1356
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
1366
1357
  return 1;
1367
1358
  }
1368
1359
  return min;
@@ -1391,16 +1382,19 @@ var require_supports_color = __commonJS({
1391
1382
  if ("COLORTERM" in env) {
1392
1383
  return 1;
1393
1384
  }
1385
+ if (env.TERM === "dumb") {
1386
+ return min;
1387
+ }
1394
1388
  return min;
1395
1389
  }
1396
1390
  function getSupportLevel(stream) {
1397
- const level = supportsColor(stream, stream && stream.isTTY);
1391
+ const level = supportsColor(stream);
1398
1392
  return translateLevel(level);
1399
1393
  }
1400
1394
  module2.exports = {
1401
1395
  supportsColor: getSupportLevel,
1402
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
1403
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
1396
+ stdout: getSupportLevel(process.stdout),
1397
+ stderr: getSupportLevel(process.stderr)
1404
1398
  };
1405
1399
  }
1406
1400
  });
@@ -11770,7 +11764,7 @@ defineType("TSLiteralType", {
11770
11764
  aliases: ["TSType"],
11771
11765
  visitor: ["expression", "typeArguments"],
11772
11766
  fields: {
11773
- expression: validateType("TSEntityName"),
11767
+ expression: validateType("Expression"),
11774
11768
  typeArguments: validateOptionalType("TSTypeParameterInstantiation")
11775
11769
  }
11776
11770
  });
@@ -11778,7 +11772,7 @@ defineType("TSLiteralType", {
11778
11772
  aliases: ["TSType"],
11779
11773
  visitor: ["expression", "typeArguments"],
11780
11774
  fields: {
11781
- expression: validateType("TSEntityName"),
11775
+ expression: validateType("Expression"),
11782
11776
  typeArguments: validateOptionalType("TSTypeParameterInstantiation")
11783
11777
  }
11784
11778
  });
@@ -16664,7 +16658,7 @@ function _objectWithoutPropertiesLoose(r, e) {
16664
16658
  if (null == r) return {};
16665
16659
  var t = {};
16666
16660
  for (var n2 in r) if ({}.hasOwnProperty.call(r, n2)) {
16667
- if (e.includes(n2)) continue;
16661
+ if (-1 !== e.indexOf(n2)) continue;
16668
16662
  t[n2] = r[n2];
16669
16663
  }
16670
16664
  return t;
@@ -23740,14 +23734,7 @@ var LValParser = class extends NodeUtils {
23740
23734
  for (let i = 0; i <= end; i++) {
23741
23735
  const elt = exprList[i];
23742
23736
  if (!elt) continue;
23743
- if (elt.type === "SpreadElement") {
23744
- elt.type = "RestElement";
23745
- const arg = elt.argument;
23746
- this.checkToRestConversion(arg, true);
23747
- this.toAssignable(arg, isLHS);
23748
- } else {
23749
- this.toAssignable(elt, isLHS);
23750
- }
23737
+ this.toAssignableListItem(exprList, i, isLHS);
23751
23738
  if (elt.type === "RestElement") {
23752
23739
  if (i < end) {
23753
23740
  this.raise(Errors.RestTrailingComma, elt);
@@ -23757,6 +23744,17 @@ var LValParser = class extends NodeUtils {
23757
23744
  }
23758
23745
  }
23759
23746
  }
23747
+ toAssignableListItem(exprList, index2, isLHS) {
23748
+ const node = exprList[index2];
23749
+ if (node.type === "SpreadElement") {
23750
+ node.type = "RestElement";
23751
+ const arg = node.argument;
23752
+ this.checkToRestConversion(arg, true);
23753
+ this.toAssignable(arg, isLHS);
23754
+ } else {
23755
+ this.toAssignable(node, isLHS);
23756
+ }
23757
+ }
23760
23758
  isAssignable(node, isBinding3) {
23761
23759
  switch (node.type) {
23762
23760
  case "Identifier":
@@ -23850,13 +23848,15 @@ var LValParser = class extends NodeUtils {
23850
23848
  }
23851
23849
  } else {
23852
23850
  const decorators = [];
23853
- if (this.match(26) && this.hasPlugin("decorators")) {
23854
- this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
23855
- }
23856
- while (this.match(26)) {
23857
- decorators.push(this.parseDecorator());
23851
+ if (flags & 2) {
23852
+ if (this.match(26) && this.hasPlugin("decorators")) {
23853
+ this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
23854
+ }
23855
+ while (this.match(26)) {
23856
+ decorators.push(this.parseDecorator());
23857
+ }
23858
23858
  }
23859
- elts.push(this.parseAssignableListItem(flags, decorators));
23859
+ elts.push(this.parseBindingElement(flags, decorators));
23860
23860
  }
23861
23861
  }
23862
23862
  return elts;
@@ -23886,7 +23886,7 @@ var LValParser = class extends NodeUtils {
23886
23886
  prop.method = false;
23887
23887
  return this.parseObjPropValue(prop, startLoc, false, false, true, false);
23888
23888
  }
23889
- parseAssignableListItem(flags, decorators) {
23889
+ parseBindingElement(flags, decorators) {
23890
23890
  const left = this.parseMaybeDefault();
23891
23891
  if (flags & 2) {
23892
23892
  this.parseFunctionParamType(left);
@@ -24092,6 +24092,9 @@ var TSErrors = ParseErrorEnum`typescript`({
24092
24092
  IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
24093
24093
  IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
24094
24094
  InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
24095
+ InvalidHeritageClauseType: ({
24096
+ token
24097
+ }) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`,
24095
24098
  InvalidModifierOnTypeMember: ({
24096
24099
  modifier
24097
24100
  }) => `'${modifier}' modifier cannot appear on a type member.`,
@@ -24173,6 +24176,22 @@ function tsIsAccessModifier(modifier) {
24173
24176
  function tsIsVarianceAnnotations(modifier) {
24174
24177
  return modifier === "in" || modifier === "out";
24175
24178
  }
24179
+ function tsIsEntityName(node) {
24180
+ var _a;
24181
+ if ((_a = node.extra) == null ? void 0 : _a.parenthesized) {
24182
+ return false;
24183
+ }
24184
+ switch (node.type) {
24185
+ case "Identifier":
24186
+ return true;
24187
+ case "MemberExpression":
24188
+ return !node.computed && tsIsEntityName(node.object);
24189
+ case "TSInstantiationExpression":
24190
+ return tsIsEntityName(node.expression);
24191
+ default:
24192
+ return false;
24193
+ }
24194
+ }
24176
24195
  var typescript = (superClass) => class TypeScriptParserMixin extends superClass {
24177
24196
  constructor() {
24178
24197
  super(...arguments);
@@ -25171,13 +25190,24 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
25171
25190
  tsParseHeritageClause(token) {
25172
25191
  const originalStartLoc = this.state.startLoc;
25173
25192
  const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
25174
- const node = this.startNode();
25175
25193
  {
25176
- node.expression = this.tsParseEntityName(1);
25177
- if (this.match(47)) {
25178
- node.typeArguments = this.tsParseTypeArguments();
25194
+ const expression2 = super.parseExprSubscripts();
25195
+ if (!tsIsEntityName(expression2)) {
25196
+ this.raise(TSErrors.InvalidHeritageClauseType, expression2.loc.start, {
25197
+ token
25198
+ });
25199
+ }
25200
+ const nodeType = token === "extends" ? "TSInterfaceHeritage" : "TSClassImplements";
25201
+ if (expression2.type === "TSInstantiationExpression") {
25202
+ expression2.type = nodeType;
25203
+ return expression2;
25204
+ }
25205
+ const node = this.startNodeAtNode(expression2);
25206
+ node.expression = expression2;
25207
+ if (this.match(47) || this.match(51)) {
25208
+ node.typeArguments = this.tsParseTypeArgumentsInExpression();
25179
25209
  }
25180
- return this.finishNode(node, token === "extends" ? "TSInterfaceHeritage" : "TSClassImplements");
25210
+ return this.finishNode(node, nodeType);
25181
25211
  }
25182
25212
  });
25183
25213
  if (!delimitedList.length) {
@@ -25555,7 +25585,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
25555
25585
  if (this.tsIsDeclarationStart()) return false;
25556
25586
  return super.isExportDefaultSpecifier();
25557
25587
  }
25558
- parseAssignableListItem(flags, decorators) {
25588
+ parseBindingElement(flags, decorators) {
25559
25589
  const startLoc = this.state.startLoc;
25560
25590
  const modified = {};
25561
25591
  this.tsParseModifiers({
@@ -25984,18 +26014,15 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
25984
26014
  return super.shouldParseExportDeclaration();
25985
26015
  }
25986
26016
  parseConditional(expr, startLoc, refExpressionErrors) {
25987
- if (!this.state.maybeInArrowParameters || !this.match(17)) {
25988
- return super.parseConditional(expr, startLoc, refExpressionErrors);
25989
- }
25990
- const result = this.tryParse(() => super.parseConditional(expr, startLoc));
25991
- if (!result.node) {
25992
- if (result.error) {
25993
- super.setOptionalParametersError(refExpressionErrors, result.error);
26017
+ if (!this.match(17)) return expr;
26018
+ if (this.state.maybeInArrowParameters) {
26019
+ const nextCh = this.lookaheadCharCode();
26020
+ if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) {
26021
+ this.setOptionalParametersError(refExpressionErrors);
26022
+ return expr;
25994
26023
  }
25995
- return expr;
25996
26024
  }
25997
- if (result.error) this.state = result.failState;
25998
- return result.node;
26025
+ return super.parseConditional(expr, startLoc, refExpressionErrors);
25999
26026
  }
26000
26027
  parseParenItem(node, startLoc) {
26001
26028
  const newNode = super.parseParenItem(node, startLoc);
@@ -26322,7 +26349,6 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
26322
26349
  case "TSParameterProperty":
26323
26350
  return "parameter";
26324
26351
  case "TSNonNullExpression":
26325
- case "TSInstantiationExpression":
26326
26352
  return "expression";
26327
26353
  case "TSAsExpression":
26328
26354
  case "TSSatisfiesExpression":
@@ -26408,14 +26434,12 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
26408
26434
  }
26409
26435
  return type;
26410
26436
  }
26411
- toAssignableList(exprList, trailingCommaLoc, isLHS) {
26412
- for (let i = 0; i < exprList.length; i++) {
26413
- const expr = exprList[i];
26414
- if ((expr == null ? void 0 : expr.type) === "TSTypeCastExpression") {
26415
- exprList[i] = this.typeCastToParameter(expr);
26416
- }
26437
+ toAssignableListItem(exprList, index2, isLHS) {
26438
+ const node = exprList[index2];
26439
+ if (node.type === "TSTypeCastExpression") {
26440
+ exprList[index2] = this.typeCastToParameter(node);
26417
26441
  }
26418
- super.toAssignableList(exprList, trailingCommaLoc, isLHS);
26442
+ super.toAssignableListItem(exprList, index2, isLHS);
26419
26443
  }
26420
26444
  typeCastToParameter(node) {
26421
26445
  node.expression.typeAnnotation = node.typeAnnotation;
@@ -26984,18 +27008,18 @@ var mixinPlugins = {
26984
27008
  };
26985
27009
  var mixinPluginNames = Object.keys(mixinPlugins);
26986
27010
  var ExpressionParser = class extends LValParser {
26987
- checkProto(prop, isRecord, protoRef, refExpressionErrors) {
27011
+ checkProto(prop, isRecord, sawProto, refExpressionErrors) {
26988
27012
  if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) {
26989
- return;
27013
+ return sawProto;
26990
27014
  }
26991
27015
  const key = prop.key;
26992
27016
  const name = key.type === "Identifier" ? key.name : key.value;
26993
27017
  if (name === "__proto__") {
26994
27018
  if (isRecord) {
26995
27019
  this.raise(Errors.RecordNoProto, key);
26996
- return;
27020
+ return true;
26997
27021
  }
26998
- if (protoRef.used) {
27022
+ if (sawProto) {
26999
27023
  if (refExpressionErrors) {
27000
27024
  if (refExpressionErrors.doubleProtoLoc === null) {
27001
27025
  refExpressionErrors.doubleProtoLoc = key.loc.start;
@@ -27004,8 +27028,9 @@ var ExpressionParser = class extends LValParser {
27004
27028
  this.raise(Errors.DuplicateProto, key);
27005
27029
  }
27006
27030
  }
27007
- protoRef.used = true;
27031
+ return true;
27008
27032
  }
27033
+ return sawProto;
27009
27034
  }
27010
27035
  shouldExitDescending(expr, potentialArrowAt) {
27011
27036
  return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt;
@@ -27051,9 +27076,8 @@ var ExpressionParser = class extends LValParser {
27051
27076
  parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) {
27052
27077
  return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
27053
27078
  }
27054
- setOptionalParametersError(refExpressionErrors, resultError) {
27055
- var _a;
27056
- refExpressionErrors.optionalParametersLoc = (_a = resultError == null ? void 0 : resultError.loc) != null ? _a : this.state.startLoc;
27079
+ setOptionalParametersError(refExpressionErrors) {
27080
+ refExpressionErrors.optionalParametersLoc = this.state.startLoc;
27057
27081
  }
27058
27082
  parseMaybeAssign(refExpressionErrors, afterLeftParse) {
27059
27083
  const startLoc = this.state.startLoc;
@@ -28016,7 +28040,7 @@ var ExpressionParser = class extends LValParser {
28016
28040
  }
28017
28041
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
28018
28042
  this.state.inFSharpPipelineDirectBody = false;
28019
- const propHash = /* @__PURE__ */ Object.create(null);
28043
+ let sawProto = false;
28020
28044
  let first = true;
28021
28045
  const node = this.startNode();
28022
28046
  node.properties = [];
@@ -28036,7 +28060,7 @@ var ExpressionParser = class extends LValParser {
28036
28060
  prop = this.parseBindingProperty();
28037
28061
  } else {
28038
28062
  prop = this.parsePropertyDefinition(refExpressionErrors);
28039
- this.checkProto(prop, isRecord, propHash, refExpressionErrors);
28063
+ sawProto = this.checkProto(prop, isRecord, sawProto, refExpressionErrors);
28040
28064
  }
28041
28065
  if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
28042
28066
  this.raise(Errors.InvalidRecordProperty, prop);
@@ -28912,14 +28936,8 @@ var StatementParser = class extends ExpressionParser {
28912
28936
  let result;
28913
28937
  if (startType === 83) {
28914
28938
  result = this.parseImport(node);
28915
- if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
28916
- this.sawUnambiguousESM = true;
28917
- }
28918
28939
  } else {
28919
28940
  result = this.parseExport(node, decorators);
28920
- if (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportDefaultDeclaration") {
28921
- this.sawUnambiguousESM = true;
28922
- }
28923
28941
  }
28924
28942
  this.assertModuleNodeAllowed(result);
28925
28943
  return result;
@@ -29831,6 +29849,7 @@ var StatementParser = class extends ExpressionParser {
29831
29849
  throw this.raise(Errors.UnsupportedDecoratorExport, node);
29832
29850
  }
29833
29851
  this.parseExportFrom(node, true);
29852
+ this.sawUnambiguousESM = true;
29834
29853
  return this.finishNode(node, "ExportAllDeclaration");
29835
29854
  }
29836
29855
  const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
@@ -29858,6 +29877,7 @@ var StatementParser = class extends ExpressionParser {
29858
29877
  } else if (decorators) {
29859
29878
  throw this.raise(Errors.UnsupportedDecoratorExport, node);
29860
29879
  }
29880
+ this.sawUnambiguousESM = true;
29861
29881
  return this.finishNode(node2, "ExportNamedDeclaration");
29862
29882
  }
29863
29883
  if (this.eat(65)) {
@@ -29870,6 +29890,7 @@ var StatementParser = class extends ExpressionParser {
29870
29890
  throw this.raise(Errors.UnsupportedDecoratorExport, node);
29871
29891
  }
29872
29892
  this.checkExport(node2, true, true);
29893
+ this.sawUnambiguousESM = true;
29873
29894
  return this.finishNode(node2, "ExportDefaultDeclaration");
29874
29895
  }
29875
29896
  this.unexpected(null, 5);
@@ -29907,6 +29928,9 @@ var StatementParser = class extends ExpressionParser {
29907
29928
  const isTypeExport = node2.exportKind === "type";
29908
29929
  node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport));
29909
29930
  node2.source = null;
29931
+ {
29932
+ node2.attributes = [];
29933
+ }
29910
29934
  node2.declaration = null;
29911
29935
  return true;
29912
29936
  }
@@ -29916,6 +29940,9 @@ var StatementParser = class extends ExpressionParser {
29916
29940
  if (this.shouldParseExportDeclaration()) {
29917
29941
  node.specifiers = [];
29918
29942
  node.source = null;
29943
+ {
29944
+ node.attributes = [];
29945
+ }
29919
29946
  node.declaration = this.parseExportDeclaration(node);
29920
29947
  return true;
29921
29948
  }
@@ -30274,6 +30301,7 @@ var StatementParser = class extends ExpressionParser {
30274
30301
  this.checkImportReflection(node);
30275
30302
  this.checkJSONModuleImport(node);
30276
30303
  this.semicolon();
30304
+ this.sawUnambiguousESM = true;
30277
30305
  return this.finishNode(node, "ImportDeclaration");
30278
30306
  }
30279
30307
  parseImportSource() {
@@ -30890,7 +30918,7 @@ function _objectWithoutPropertiesLoose2(r, e) {
30890
30918
  if (null == r) return {};
30891
30919
  var t = {};
30892
30920
  for (var n2 in r) if ({}.hasOwnProperty.call(r, n2)) {
30893
- if (e.includes(n2)) continue;
30921
+ if (-1 !== e.indexOf(n2)) continue;
30894
30922
  t[n2] = r[n2];
30895
30923
  }
30896
30924
  return t;
@@ -35834,7 +35862,7 @@ function tsPrintClassMemberModifiers(node) {
35834
35862
  this.word("static");
35835
35863
  this.space();
35836
35864
  }
35837
- printModifiersList(this, node, [!isPrivateField && node.override && "override", !isPrivateField && node.abstract && "abstract", (isPublicField || isPrivateField) && node.readonly && "readonly"]);
35865
+ printModifiersList(this, node, [!isPrivateField && node.abstract && "abstract", !isPrivateField && node.override && "override", (isPublicField || isPrivateField) && node.readonly && "readonly"]);
35838
35866
  }
35839
35867
  function printBraced(printer, node, cb) {
35840
35868
  printer.token("{");
@@ -37257,7 +37285,7 @@ function verify$1(visitor) {
37257
37285
  }
37258
37286
  if (shouldIgnoreKey(nodeType)) continue;
37259
37287
  if (!TYPES2.includes(nodeType)) {
37260
- throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"8.0.0-alpha.16"}`);
37288
+ throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"8.0.0-alpha.17"}`);
37261
37289
  }
37262
37290
  const visitors2 = visitor[nodeType];
37263
37291
  if (typeof visitors2 === "object") {
@@ -39696,6 +39724,7 @@ function evaluateCached(path, state) {
39696
39724
  }
39697
39725
  }
39698
39726
  function _evaluate(path, state) {
39727
+ var _a;
39699
39728
  if (!state.confident) return;
39700
39729
  if (path.isSequenceExpression()) {
39701
39730
  const exprs = path.get("expressions");
@@ -39761,6 +39790,22 @@ function _evaluate(path, state) {
39761
39790
  deopt(binding.path, state);
39762
39791
  return;
39763
39792
  }
39793
+ const bindingPathScope = binding.path.scope;
39794
+ if (binding.kind === "var" && bindingPathScope !== binding.scope) {
39795
+ let hasUnsafeBlock = !bindingPathScope.path.parentPath.isBlockStatement();
39796
+ for (let scope2 = bindingPathScope.parent; scope2; scope2 = scope2.parent) {
39797
+ if (scope2 === path.scope) {
39798
+ if (hasUnsafeBlock) {
39799
+ deopt(binding.path, state);
39800
+ return;
39801
+ }
39802
+ break;
39803
+ }
39804
+ if ((_a = scope2.path.parentPath) == null ? void 0 : _a.isBlockStatement()) {
39805
+ hasUnsafeBlock = true;
39806
+ }
39807
+ }
39808
+ }
39764
39809
  if (binding.hasValue) {
39765
39810
  return binding.value;
39766
39811
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/babel",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Babel 8 in CommonJS",
@@ -44,12 +44,12 @@
44
44
  "commonjs"
45
45
  ],
46
46
  "devDependencies": {
47
- "@babel/code-frame": "^8.0.0-alpha.16",
48
- "@babel/generator": "^8.0.0-alpha.16",
49
- "@babel/parser": "^8.0.0-alpha.16",
50
- "@babel/template": "^8.0.0-alpha.16",
51
- "@babel/traverse": "^8.0.0-alpha.16",
52
- "@babel/types": "^8.0.0-alpha.16",
47
+ "@babel/code-frame": "^8.0.0-alpha.17",
48
+ "@babel/generator": "^8.0.0-alpha.17",
49
+ "@babel/parser": "^8.0.0-alpha.17",
50
+ "@babel/template": "^8.0.0-alpha.17",
51
+ "@babel/traverse": "^8.0.0-alpha.17",
52
+ "@babel/types": "^8.0.0-alpha.17",
53
53
  "@swc/core": "^1.3.101",
54
54
  "@types/node": "^22.10.1",
55
55
  "acorn-stage3": "^4.0.0",