@putout/babel 4.1.1 → 4.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 +1 -1
- package/bundle/index.js +139 -68
- package/package.json +8 -8
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-beta.
|
|
6
|
+
**CommonJS** pre-builts of Babel 8: if you want to migrate to [v8](https://github.com/babel/babel/releases/tag/v8.0.0-beta.2), but cannot support **ESM** right now.
|
|
7
7
|
|
|
8
8
|
Usage
|
|
9
9
|
|
package/bundle/index.js
CHANGED
|
@@ -1483,16 +1483,14 @@ typeof window !== 'undefined'
|
|
|
1483
1483
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
1484
1484
|
typeof navigator !== 'undefined'
|
|
1485
1485
|
&& navigator.userAgent
|
|
1486
|
-
&& (m = navigator
|
|
1487
|
-
.userAgent
|
|
1486
|
+
&& (m = navigator.userAgent
|
|
1488
1487
|
.toLowerCase()
|
|
1489
1488
|
.match(/firefox\/(\d+)/))
|
|
1490
1489
|
&& parseInt(m[1], 10) >= 31
|
|
1491
1490
|
|| // Double check webkit in userAgent just in case we are in a worker
|
|
1492
1491
|
typeof navigator !== 'undefined'
|
|
1493
1492
|
&& navigator.userAgent
|
|
1494
|
-
&& navigator
|
|
1495
|
-
.userAgent
|
|
1493
|
+
&& navigator.userAgent
|
|
1496
1494
|
.toLowerCase()
|
|
1497
1495
|
.match(/applewebkit\/(\d+)/);
|
|
1498
1496
|
}
|
|
@@ -7962,7 +7960,6 @@ function isLVal(node, opts) {
|
|
|
7962
7960
|
case 'MemberExpression':
|
|
7963
7961
|
case 'ArrayPattern':
|
|
7964
7962
|
case 'ObjectPattern':
|
|
7965
|
-
case 'OptionalMemberExpression':
|
|
7966
7963
|
case 'TSAsExpression':
|
|
7967
7964
|
case 'TSSatisfiesExpression':
|
|
7968
7965
|
case 'TSTypeAssertion':
|
|
@@ -9409,7 +9406,7 @@ defineType$4('ArrayExpression', {
|
|
|
9409
9406
|
defineType$4('AssignmentExpression', {
|
|
9410
9407
|
fields: {
|
|
9411
9408
|
operator: {
|
|
9412
|
-
validate: Object.assign(function() {
|
|
9409
|
+
validate: Object.assign((function() {
|
|
9413
9410
|
const identifier4 = assertOneOf(...ASSIGNMENT_OPERATORS);
|
|
9414
9411
|
const pattern = assertOneOf('=');
|
|
9415
9412
|
|
|
@@ -9417,7 +9414,7 @@ defineType$4('AssignmentExpression', {
|
|
|
9417
9414
|
const validator = is('Pattern', node.left) ? pattern : identifier4;
|
|
9418
9415
|
validator(node, key, val);
|
|
9419
9416
|
};
|
|
9420
|
-
}(), {
|
|
9417
|
+
})(), {
|
|
9421
9418
|
oneOf: ASSIGNMENT_OPERATORS,
|
|
9422
9419
|
}),
|
|
9423
9420
|
},
|
|
@@ -9447,7 +9444,7 @@ defineType$4('BinaryExpression', {
|
|
|
9447
9444
|
validate: assertOneOf(...BINARY_OPERATORS),
|
|
9448
9445
|
},
|
|
9449
9446
|
left: {
|
|
9450
|
-
validate: function() {
|
|
9447
|
+
validate: (function() {
|
|
9451
9448
|
const expression2 = assertNodeType('Expression');
|
|
9452
9449
|
const inOp = assertNodeType('Expression', 'PrivateName');
|
|
9453
9450
|
const validator = Object.assign(function(node, key, val) {
|
|
@@ -9458,7 +9455,7 @@ defineType$4('BinaryExpression', {
|
|
|
9458
9455
|
});
|
|
9459
9456
|
|
|
9460
9457
|
return validator;
|
|
9461
|
-
}(),
|
|
9458
|
+
})(),
|
|
9462
9459
|
},
|
|
9463
9460
|
right: {
|
|
9464
9461
|
validate: assertNodeType('Expression'),
|
|
@@ -9768,7 +9765,7 @@ defineType$4('FunctionDeclaration', {
|
|
|
9768
9765
|
'Pureish',
|
|
9769
9766
|
'Declaration',
|
|
9770
9767
|
],
|
|
9771
|
-
validate: function() {
|
|
9768
|
+
validate: (function() {
|
|
9772
9769
|
const identifier4 = assertNodeType('Identifier');
|
|
9773
9770
|
|
|
9774
9771
|
return function(parent, key, node) {
|
|
@@ -9776,7 +9773,7 @@ defineType$4('FunctionDeclaration', {
|
|
|
9776
9773
|
identifier4(node, 'id', node.id);
|
|
9777
9774
|
}
|
|
9778
9775
|
};
|
|
9779
|
-
}(),
|
|
9776
|
+
})(),
|
|
9780
9777
|
});
|
|
9781
9778
|
defineType$4('FunctionExpression', {
|
|
9782
9779
|
inherits: 'FunctionDeclaration',
|
|
@@ -9991,7 +9988,7 @@ defineType$4('RegExpLiteral', {
|
|
|
9991
9988
|
},
|
|
9992
9989
|
flags: {
|
|
9993
9990
|
validate: chain(assertValueType('string'), Object.assign(function(node, key, val) {
|
|
9994
|
-
const invalid = /[^
|
|
9991
|
+
const invalid = /[^dgimsuvy]/.exec(val);
|
|
9995
9992
|
|
|
9996
9993
|
if (invalid) {
|
|
9997
9994
|
throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`);
|
|
@@ -10041,7 +10038,7 @@ defineType$4('MemberExpression', {
|
|
|
10041
10038
|
validate: assertNodeType('Expression', 'Super'),
|
|
10042
10039
|
},
|
|
10043
10040
|
property: {
|
|
10044
|
-
validate: function() {
|
|
10041
|
+
validate: (function() {
|
|
10045
10042
|
const normal = assertNodeType('Identifier', 'PrivateName');
|
|
10046
10043
|
const computed = assertNodeType('Expression');
|
|
10047
10044
|
const validator = function(node, key, val) {
|
|
@@ -10055,7 +10052,7 @@ defineType$4('MemberExpression', {
|
|
|
10055
10052
|
'PrivateName',
|
|
10056
10053
|
];
|
|
10057
10054
|
return validator;
|
|
10058
|
-
}(),
|
|
10055
|
+
})(),
|
|
10059
10056
|
},
|
|
10060
10057
|
computed: {
|
|
10061
10058
|
default: false,
|
|
@@ -10128,7 +10125,7 @@ defineType$4('ObjectMethod', {
|
|
|
10128
10125
|
default: false,
|
|
10129
10126
|
},
|
|
10130
10127
|
key: {
|
|
10131
|
-
validate: function() {
|
|
10128
|
+
validate: (function() {
|
|
10132
10129
|
const normal = assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral');
|
|
10133
10130
|
const computed = assertNodeType('Expression');
|
|
10134
10131
|
const validator = function(node, key, val) {
|
|
@@ -10144,7 +10141,7 @@ defineType$4('ObjectMethod', {
|
|
|
10144
10141
|
'BigIntLiteral',
|
|
10145
10142
|
];
|
|
10146
10143
|
return validator;
|
|
10147
|
-
}(),
|
|
10144
|
+
})(),
|
|
10148
10145
|
},
|
|
10149
10146
|
decorators: {
|
|
10150
10147
|
validate: arrayOfType('Decorator'),
|
|
@@ -10177,7 +10174,7 @@ defineType$4('ObjectProperty', {
|
|
|
10177
10174
|
default: false,
|
|
10178
10175
|
},
|
|
10179
10176
|
key: {
|
|
10180
|
-
validate: function() {
|
|
10177
|
+
validate: (function() {
|
|
10181
10178
|
const normal = assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'PrivateName');
|
|
10182
10179
|
const computed = assertNodeType('Expression');
|
|
10183
10180
|
const validator = Object.assign(function(node, key, val) {
|
|
@@ -10195,7 +10192,7 @@ defineType$4('ObjectProperty', {
|
|
|
10195
10192
|
});
|
|
10196
10193
|
|
|
10197
10194
|
return validator;
|
|
10198
|
-
}(),
|
|
10195
|
+
})(),
|
|
10199
10196
|
},
|
|
10200
10197
|
value: {
|
|
10201
10198
|
validate: assertNodeType('Expression', 'PatternLike'),
|
|
@@ -10232,7 +10229,7 @@ defineType$4('ObjectProperty', {
|
|
|
10232
10229
|
'Property',
|
|
10233
10230
|
'ObjectMember',
|
|
10234
10231
|
],
|
|
10235
|
-
validate: function() {
|
|
10232
|
+
validate: (function() {
|
|
10236
10233
|
const pattern = assertNodeType('Identifier', 'Pattern', 'TSAsExpression', 'TSSatisfiesExpression', 'TSNonNullExpression', 'TSTypeAssertion');
|
|
10237
10234
|
const expression2 = assertNodeType('Expression');
|
|
10238
10235
|
|
|
@@ -10240,7 +10237,7 @@ defineType$4('ObjectProperty', {
|
|
|
10240
10237
|
const validator = is('ObjectPattern', parent) ? pattern : expression2;
|
|
10241
10238
|
validator(node, 'value', node.value);
|
|
10242
10239
|
};
|
|
10243
|
-
}(),
|
|
10240
|
+
})(),
|
|
10244
10241
|
});
|
|
10245
10242
|
defineType$4('RestElement', {
|
|
10246
10243
|
visitor: ['argument', 'typeAnnotation'],
|
|
@@ -10679,7 +10676,7 @@ defineType$4('ClassDeclaration', {
|
|
|
10679
10676
|
optional: true,
|
|
10680
10677
|
},
|
|
10681
10678
|
},
|
|
10682
|
-
validate: function() {
|
|
10679
|
+
validate: (function() {
|
|
10683
10680
|
const identifier4 = assertNodeType('Identifier');
|
|
10684
10681
|
|
|
10685
10682
|
return function(parent, key, node) {
|
|
@@ -10687,7 +10684,7 @@ defineType$4('ClassDeclaration', {
|
|
|
10687
10684
|
identifier4(node, 'id', node.id);
|
|
10688
10685
|
}
|
|
10689
10686
|
};
|
|
10690
|
-
}(),
|
|
10687
|
+
})(),
|
|
10691
10688
|
});
|
|
10692
10689
|
var importAttributes = {
|
|
10693
10690
|
attributes: {
|
|
@@ -10770,7 +10767,7 @@ defineType$4('ExportNamedDeclaration', {
|
|
|
10770
10767
|
}, importAttributes, {
|
|
10771
10768
|
specifiers: {
|
|
10772
10769
|
default: [],
|
|
10773
|
-
validate: arrayOf(function() {
|
|
10770
|
+
validate: arrayOf((function() {
|
|
10774
10771
|
const sourced = assertNodeType('ExportSpecifier', 'ExportDefaultSpecifier', 'ExportNamespaceSpecifier');
|
|
10775
10772
|
const sourceless = assertNodeType('ExportSpecifier');
|
|
10776
10773
|
|
|
@@ -10784,7 +10781,7 @@ defineType$4('ExportNamedDeclaration', {
|
|
|
10784
10781
|
'ExportNamespaceSpecifier',
|
|
10785
10782
|
],
|
|
10786
10783
|
});
|
|
10787
|
-
}()),
|
|
10784
|
+
})()),
|
|
10788
10785
|
},
|
|
10789
10786
|
source: {
|
|
10790
10787
|
validate: assertNodeType('StringLiteral'),
|
|
@@ -10831,7 +10828,7 @@ defineType$4('ForOfStatement', {
|
|
|
10831
10828
|
],
|
|
10832
10829
|
fields: {
|
|
10833
10830
|
left: {
|
|
10834
|
-
validate: function() {
|
|
10831
|
+
validate: (function() {
|
|
10835
10832
|
const declaration = assertNodeType('VariableDeclaration');
|
|
10836
10833
|
const lval = assertNodeType('Identifier', 'MemberExpression', 'ArrayPattern', 'ObjectPattern', 'TSAsExpression', 'TSSatisfiesExpression', 'TSTypeAssertion', 'TSNonNullExpression');
|
|
10837
10834
|
|
|
@@ -10854,7 +10851,7 @@ defineType$4('ForOfStatement', {
|
|
|
10854
10851
|
'TSNonNullExpression',
|
|
10855
10852
|
],
|
|
10856
10853
|
});
|
|
10857
|
-
}(),
|
|
10854
|
+
})(),
|
|
10858
10855
|
},
|
|
10859
10856
|
right: {
|
|
10860
10857
|
validate: assertNodeType('Expression'),
|
|
@@ -11007,7 +11004,7 @@ var classMethodOrPropertyCommon = () => ({
|
|
|
11007
11004
|
optional: true,
|
|
11008
11005
|
},
|
|
11009
11006
|
key: {
|
|
11010
|
-
validate: chain(function() {
|
|
11007
|
+
validate: chain((function() {
|
|
11011
11008
|
const normal = assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral');
|
|
11012
11009
|
const computed = assertNodeType('Expression');
|
|
11013
11010
|
|
|
@@ -11015,7 +11012,7 @@ var classMethodOrPropertyCommon = () => ({
|
|
|
11015
11012
|
const validator = node.computed ? computed : normal;
|
|
11016
11013
|
validator(node, key, val);
|
|
11017
11014
|
};
|
|
11018
|
-
}(), assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'Expression')),
|
|
11015
|
+
})(), assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'Expression')),
|
|
11019
11016
|
},
|
|
11020
11017
|
});
|
|
11021
11018
|
|
|
@@ -11241,13 +11238,13 @@ defineType$4('OptionalMemberExpression', {
|
|
|
11241
11238
|
'optional',
|
|
11242
11239
|
],
|
|
11243
11240
|
visitor: ['object', 'property'],
|
|
11244
|
-
aliases: ['Expression'
|
|
11241
|
+
aliases: ['Expression'],
|
|
11245
11242
|
fields: {
|
|
11246
11243
|
object: {
|
|
11247
11244
|
validate: assertNodeType('Expression'),
|
|
11248
11245
|
},
|
|
11249
11246
|
property: {
|
|
11250
|
-
validate: function() {
|
|
11247
|
+
validate: (function() {
|
|
11251
11248
|
const normal = assertNodeType('Identifier');
|
|
11252
11249
|
const computed = assertNodeType('Expression');
|
|
11253
11250
|
const validator = Object.assign(function(node, key, val) {
|
|
@@ -11258,7 +11255,7 @@ defineType$4('OptionalMemberExpression', {
|
|
|
11258
11255
|
});
|
|
11259
11256
|
|
|
11260
11257
|
return validator;
|
|
11261
|
-
}(),
|
|
11258
|
+
})(),
|
|
11262
11259
|
},
|
|
11263
11260
|
computed: {
|
|
11264
11261
|
default: false,
|
|
@@ -11360,7 +11357,7 @@ defineType$4('ClassAccessorProperty', {
|
|
|
11360
11357
|
aliases: ['Property', 'Accessor'],
|
|
11361
11358
|
fields: Object.assign({}, classMethodOrPropertyCommon(), {
|
|
11362
11359
|
key: {
|
|
11363
|
-
validate: chain(function() {
|
|
11360
|
+
validate: chain((function() {
|
|
11364
11361
|
const normal = assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'PrivateName');
|
|
11365
11362
|
const computed = assertNodeType('Expression');
|
|
11366
11363
|
|
|
@@ -11368,7 +11365,7 @@ defineType$4('ClassAccessorProperty', {
|
|
|
11368
11365
|
const validator = node.computed ? computed : normal;
|
|
11369
11366
|
validator(node, key, val);
|
|
11370
11367
|
};
|
|
11371
|
-
}(), assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'Expression', 'PrivateName')),
|
|
11368
|
+
})(), assertNodeType('Identifier', 'StringLiteral', 'NumericLiteral', 'BigIntLiteral', 'Expression', 'PrivateName')),
|
|
11372
11369
|
},
|
|
11373
11370
|
value: {
|
|
11374
11371
|
validate: assertNodeType('Expression'),
|
|
@@ -12774,6 +12771,7 @@ defineType('TSTypeOperator', {
|
|
|
12774
12771
|
fields: {
|
|
12775
12772
|
operator: {
|
|
12776
12773
|
validate: assertOneOf('keyof', 'readonly', 'unique'),
|
|
12774
|
+
default: void 0,
|
|
12777
12775
|
},
|
|
12778
12776
|
typeAnnotation: validateType('TSType'),
|
|
12779
12777
|
},
|
|
@@ -12830,7 +12828,7 @@ defineType('TSLiteralType', {
|
|
|
12830
12828
|
visitor: ['literal'],
|
|
12831
12829
|
fields: {
|
|
12832
12830
|
literal: {
|
|
12833
|
-
validate: function() {
|
|
12831
|
+
validate: (function() {
|
|
12834
12832
|
const unaryExpression3 = assertNodeType('NumericLiteral', 'BigIntLiteral');
|
|
12835
12833
|
const unaryOperator = assertOneOf('-');
|
|
12836
12834
|
const literal = assertNodeType('NumericLiteral', 'StringLiteral', 'BooleanLiteral', 'BigIntLiteral', 'TemplateLiteral');
|
|
@@ -12853,7 +12851,7 @@ defineType('TSLiteralType', {
|
|
|
12853
12851
|
'UnaryExpression',
|
|
12854
12852
|
];
|
|
12855
12853
|
return validator;
|
|
12856
|
-
}(),
|
|
12854
|
+
})(),
|
|
12857
12855
|
},
|
|
12858
12856
|
},
|
|
12859
12857
|
});
|
|
@@ -19137,8 +19135,7 @@ function getNameFromLiteralId(id) {
|
|
|
19137
19135
|
}
|
|
19138
19136
|
|
|
19139
19137
|
if (isTemplateLiteral(id)) {
|
|
19140
|
-
return id
|
|
19141
|
-
.quasis
|
|
19138
|
+
return id.quasis
|
|
19142
19139
|
.map((quasi) => quasi.value.raw)
|
|
19143
19140
|
.join('');
|
|
19144
19141
|
}
|
|
@@ -20337,7 +20334,6 @@ var estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
20337
20334
|
this.castNodeTo(node, 'ImportExpression');
|
|
20338
20335
|
node.source = node.arguments[0];
|
|
20339
20336
|
node.options = node.arguments[1] ?? null;
|
|
20340
|
-
node.attributes = node.arguments[1] ?? null;
|
|
20341
20337
|
delete node.arguments;
|
|
20342
20338
|
delete node.callee;
|
|
20343
20339
|
} else if (node.type === 'OptionalCallExpression') {
|
|
@@ -22548,7 +22544,8 @@ var flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
22548
22544
|
if (this.flowPragma === void 0) {
|
|
22549
22545
|
const matches = FLOW_PRAGMA_REGEX.exec(comment.value);
|
|
22550
22546
|
|
|
22551
|
-
if (!matches);
|
|
22547
|
+
if (!matches);
|
|
22548
|
+
else if (matches[1] === 'flow') {
|
|
22552
22549
|
this.flowPragma = 'flow';
|
|
22553
22550
|
} else if (matches[1] === 'noflow') {
|
|
22554
22551
|
this.flowPragma = 'noflow';
|
|
@@ -30128,6 +30125,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
30128
30125
|
node.properties = [
|
|
30129
30126
|
this.finishObjectProperty(withProperty),
|
|
30130
30127
|
];
|
|
30128
|
+
this.eat(12);
|
|
30131
30129
|
this.expect(8);
|
|
30132
30130
|
return this.finishNode(node, 'ObjectExpression');
|
|
30133
30131
|
}
|
|
@@ -31839,6 +31837,7 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
31839
31837
|
const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startLoc);
|
|
31840
31838
|
|
|
31841
31839
|
if (asyncArrowFn) {
|
|
31840
|
+
state.stop = true;
|
|
31842
31841
|
return asyncArrowFn;
|
|
31843
31842
|
}
|
|
31844
31843
|
}
|
|
@@ -33189,6 +33188,11 @@ var typescript = (superClass) => class TypeScriptParserMixin extends superClass
|
|
|
33189
33188
|
node.extends ?? (node.extends = []);
|
|
33190
33189
|
return;
|
|
33191
33190
|
|
|
33191
|
+
case 'TSMappedType':
|
|
33192
|
+
node.optional ?? (node.optional = false);
|
|
33193
|
+
node.readonly ?? (node.readonly = void 0);
|
|
33194
|
+
return;
|
|
33195
|
+
|
|
33192
33196
|
case 'TSModuleDeclaration':
|
|
33193
33197
|
node.declare ?? (node.declare = false);
|
|
33194
33198
|
node.global ?? (node.global = node.kind === 'global');
|
|
@@ -39076,8 +39080,7 @@ function populatePlaceholders(metadata, replacements) {
|
|
|
39076
39080
|
});
|
|
39077
39081
|
}
|
|
39078
39082
|
|
|
39079
|
-
metadata
|
|
39080
|
-
.placeholders
|
|
39083
|
+
metadata.placeholders
|
|
39081
39084
|
.slice()
|
|
39082
39085
|
.reverse()
|
|
39083
39086
|
.forEach((placeholder2) => {
|
|
@@ -39349,8 +39352,7 @@ function extendedTrace(fn) {
|
|
|
39349
39352
|
throw new Error();
|
|
39350
39353
|
} catch(error) {
|
|
39351
39354
|
if (error.stack) {
|
|
39352
|
-
rootStack = error
|
|
39353
|
-
.stack
|
|
39355
|
+
rootStack = error.stack
|
|
39354
39356
|
.split('\n')
|
|
39355
39357
|
.slice(3)
|
|
39356
39358
|
.join('\n');
|
|
@@ -41973,10 +41975,6 @@ function NewExpression2(node, parent) {
|
|
|
41973
41975
|
|
|
41974
41976
|
this.print(node.typeArguments);
|
|
41975
41977
|
|
|
41976
|
-
if (node.optional) {
|
|
41977
|
-
this.token('?.');
|
|
41978
|
-
}
|
|
41979
|
-
|
|
41980
41978
|
if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ')')) {
|
|
41981
41979
|
return;
|
|
41982
41980
|
}
|
|
@@ -46560,7 +46558,7 @@ function normalizeOptions(code2, opts, ast) {
|
|
|
46560
46558
|
}
|
|
46561
46559
|
|
|
46562
46560
|
if (!Array.isArray(ast.tokens)) {
|
|
46563
|
-
throw new Error('`experimental_preserveFormat` requires the AST to have
|
|
46561
|
+
throw new Error('`experimental_preserveFormat` requires the AST to have attached the token of the input code. Make sure to enable the `tokens: true` parser option.');
|
|
46564
46562
|
}
|
|
46565
46563
|
}
|
|
46566
46564
|
|
|
@@ -46634,8 +46632,78 @@ function generate(ast, opts = {}, code2) {
|
|
|
46634
46632
|
|
|
46635
46633
|
// node_modules/@babel/traverse/lib/index.js
|
|
46636
46634
|
var import_debug = __toESM(require_src(), 1);
|
|
46637
|
-
|
|
46638
|
-
|
|
46635
|
+
|
|
46636
|
+
// node_modules/@babel/helper-globals/data/builtin-lower.json
|
|
46637
|
+
var builtin_lower_default = [
|
|
46638
|
+
'decodeURI',
|
|
46639
|
+
'decodeURIComponent',
|
|
46640
|
+
'encodeURI',
|
|
46641
|
+
'encodeURIComponent',
|
|
46642
|
+
'escape',
|
|
46643
|
+
'eval',
|
|
46644
|
+
'globalThis',
|
|
46645
|
+
'isFinite',
|
|
46646
|
+
'isNaN',
|
|
46647
|
+
'parseFloat',
|
|
46648
|
+
'parseInt',
|
|
46649
|
+
'undefined',
|
|
46650
|
+
'unescape',
|
|
46651
|
+
];
|
|
46652
|
+
|
|
46653
|
+
// node_modules/@babel/helper-globals/data/builtin-upper.json
|
|
46654
|
+
var builtin_upper_default = [
|
|
46655
|
+
'AggregateError',
|
|
46656
|
+
'Array',
|
|
46657
|
+
'ArrayBuffer',
|
|
46658
|
+
'Atomics',
|
|
46659
|
+
'BigInt',
|
|
46660
|
+
'BigInt64Array',
|
|
46661
|
+
'BigUint64Array',
|
|
46662
|
+
'Boolean',
|
|
46663
|
+
'DataView',
|
|
46664
|
+
'Date',
|
|
46665
|
+
'Error',
|
|
46666
|
+
'EvalError',
|
|
46667
|
+
'FinalizationRegistry',
|
|
46668
|
+
'Float16Array',
|
|
46669
|
+
'Float32Array',
|
|
46670
|
+
'Float64Array',
|
|
46671
|
+
'Function',
|
|
46672
|
+
'Infinity',
|
|
46673
|
+
'Int16Array',
|
|
46674
|
+
'Int32Array',
|
|
46675
|
+
'Int8Array',
|
|
46676
|
+
'Intl',
|
|
46677
|
+
'Iterator',
|
|
46678
|
+
'JSON',
|
|
46679
|
+
'Map',
|
|
46680
|
+
'Math',
|
|
46681
|
+
'NaN',
|
|
46682
|
+
'Number',
|
|
46683
|
+
'Object',
|
|
46684
|
+
'Promise',
|
|
46685
|
+
'Proxy',
|
|
46686
|
+
'RangeError',
|
|
46687
|
+
'ReferenceError',
|
|
46688
|
+
'Reflect',
|
|
46689
|
+
'RegExp',
|
|
46690
|
+
'Set',
|
|
46691
|
+
'SharedArrayBuffer',
|
|
46692
|
+
'String',
|
|
46693
|
+
'Symbol',
|
|
46694
|
+
'SyntaxError',
|
|
46695
|
+
'TypeError',
|
|
46696
|
+
'Uint16Array',
|
|
46697
|
+
'Uint32Array',
|
|
46698
|
+
'Uint8Array',
|
|
46699
|
+
'Uint8ClampedArray',
|
|
46700
|
+
'URIError',
|
|
46701
|
+
'WeakMap',
|
|
46702
|
+
'WeakRef',
|
|
46703
|
+
'WeakSet',
|
|
46704
|
+
];
|
|
46705
|
+
|
|
46706
|
+
// node_modules/@babel/traverse/lib/index.js
|
|
46639
46707
|
var ReferencedIdentifier = [
|
|
46640
46708
|
'Identifier',
|
|
46641
46709
|
'JSXIdentifier',
|
|
@@ -46993,7 +47061,7 @@ function verify$1(visitor) {
|
|
|
46993
47061
|
continue;
|
|
46994
47062
|
|
|
46995
47063
|
if (!TYPES2.includes(nodeType)) {
|
|
46996
|
-
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-beta.
|
|
47064
|
+
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-beta.2'}`);
|
|
46997
47065
|
}
|
|
46998
47066
|
|
|
46999
47067
|
const visitors2 = visitor[nodeType];
|
|
@@ -47446,9 +47514,6 @@ var cache = /* @__PURE__ */Object.freeze({
|
|
|
47446
47514
|
},
|
|
47447
47515
|
});
|
|
47448
47516
|
|
|
47449
|
-
var globalsBuiltinLower = require('@babel/helper-globals/data/builtin-lower.json');
|
|
47450
|
-
var globalsBuiltinUpper = require('@babel/helper-globals/data/builtin-upper.json');
|
|
47451
|
-
|
|
47452
47517
|
var {
|
|
47453
47518
|
assignmentExpression: assignmentExpression$3,
|
|
47454
47519
|
callExpression: callExpression$3,
|
|
@@ -47737,8 +47802,7 @@ var collectorVisitor = {
|
|
|
47737
47802
|
},
|
|
47738
47803
|
},
|
|
47739
47804
|
LabeledStatement(path) {
|
|
47740
|
-
path
|
|
47741
|
-
.scope
|
|
47805
|
+
path.scope
|
|
47742
47806
|
.getBlockParent()
|
|
47743
47807
|
.registerDeclaration(path);
|
|
47744
47808
|
},
|
|
@@ -48491,7 +48555,8 @@ collectorVisitor]));
|
|
|
48491
48555
|
const binding = scope2.getOwnBinding(name);
|
|
48492
48556
|
|
|
48493
48557
|
if (binding) {
|
|
48494
|
-
if (previousPath?.isPattern() && binding.kind !== 'param' && binding.kind !== 'local');
|
|
48558
|
+
if (previousPath?.isPattern() && binding.kind !== 'param' && binding.kind !== 'local');
|
|
48559
|
+
else {
|
|
48495
48560
|
return binding;
|
|
48496
48561
|
}
|
|
48497
48562
|
} else if (!binding && name === 'arguments' && scope2.path.isFunction() && !scope2.path.isArrowFunctionExpression()) {
|
|
@@ -48643,7 +48708,7 @@ collectorVisitor]));
|
|
|
48643
48708
|
}
|
|
48644
48709
|
};
|
|
48645
48710
|
|
|
48646
|
-
__publicField(_Scope, 'globals', [...
|
|
48711
|
+
__publicField(_Scope, 'globals', [...builtin_lower_default, ...builtin_upper_default]);
|
|
48647
48712
|
__publicField(_Scope, 'contextVariables', [
|
|
48648
48713
|
'arguments',
|
|
48649
48714
|
'undefined',
|
|
@@ -48857,6 +48922,7 @@ function infererReference(node) {
|
|
|
48857
48922
|
} else if (node.name === 'NaN' || node.name === 'Infinity') {
|
|
48858
48923
|
return numberTypeAnnotation$1();
|
|
48859
48924
|
} else if (node.name === 'arguments');
|
|
48925
|
+
|
|
48860
48926
|
}
|
|
48861
48927
|
|
|
48862
48928
|
function getTypeAnnotationBindingConstantViolations(binding, path, name) {
|
|
@@ -49238,6 +49304,7 @@ function resolveCall(callee) {
|
|
|
49238
49304
|
return callee.node.returnType;
|
|
49239
49305
|
} else
|
|
49240
49306
|
;
|
|
49307
|
+
|
|
49241
49308
|
}
|
|
49242
49309
|
}
|
|
49243
49310
|
}
|
|
@@ -49589,8 +49656,9 @@ function insertBefore(nodes_) {
|
|
|
49589
49656
|
} else if (this.isStatementOrBlock()) {
|
|
49590
49657
|
const node = this.node;
|
|
49591
49658
|
const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
|
|
49592
|
-
this.replaceWith(blockStatement$2(shouldInsertCurrentNode ? [node] : []));
|
|
49593
|
-
|
|
49659
|
+
const [blockPath] = this.replaceWith(blockStatement$2(shouldInsertCurrentNode ? [node] : []));
|
|
49660
|
+
|
|
49661
|
+
return blockPath.unshiftContainer('body', nodes2);
|
|
49594
49662
|
} else {
|
|
49595
49663
|
throw new Error('We don\'t know what to do with this node type. We were previously a Statement but we can\'t fit in here?');
|
|
49596
49664
|
}
|
|
@@ -49708,8 +49776,9 @@ function insertAfter(nodes_) {
|
|
|
49708
49776
|
} else if (this.isStatementOrBlock()) {
|
|
49709
49777
|
const node = this.node;
|
|
49710
49778
|
const shouldInsertCurrentNode = node && (!this.isExpressionStatement() || node.expression != null);
|
|
49711
|
-
this.replaceWith(blockStatement$2(shouldInsertCurrentNode ? [node] : []));
|
|
49712
|
-
|
|
49779
|
+
const [blockPath] = this.replaceWith(blockStatement$2(shouldInsertCurrentNode ? [node] : []));
|
|
49780
|
+
|
|
49781
|
+
return blockPath.pushContainer('body', nodes2);
|
|
49713
49782
|
} else {
|
|
49714
49783
|
throw new Error('We don\'t know what to do with this node type. We were previously a Statement but we can\'t fit in here?');
|
|
49715
49784
|
}
|
|
@@ -49768,16 +49837,18 @@ function _verifyNodeList(nodes2) {
|
|
|
49768
49837
|
|
|
49769
49838
|
function unshiftContainer(listKey, nodes2) {
|
|
49770
49839
|
_assertUnremoved.call(this);
|
|
49771
|
-
|
|
49840
|
+
const verifiedNodes = _verifyNodeList.call(this, nodes2);
|
|
49841
|
+
const container = this.node[listKey];
|
|
49842
|
+
|
|
49772
49843
|
const path = NodePath_Final.get({
|
|
49773
49844
|
parentPath: this,
|
|
49774
49845
|
parent: this.node,
|
|
49775
|
-
container
|
|
49846
|
+
container,
|
|
49776
49847
|
listKey,
|
|
49777
49848
|
key: 0,
|
|
49778
49849
|
}).setContext(this.context);
|
|
49779
49850
|
|
|
49780
|
-
return _containerInsertBefore.call(path,
|
|
49851
|
+
return _containerInsertBefore.call(path, verifiedNodes);
|
|
49781
49852
|
}
|
|
49782
49853
|
|
|
49783
49854
|
function pushContainer(listKey, nodes2) {
|
|
@@ -49829,9 +49900,9 @@ var {
|
|
|
49829
49900
|
|
|
49830
49901
|
function replaceWithMultiple(nodes2) {
|
|
49831
49902
|
resync.call(this);
|
|
49832
|
-
|
|
49833
|
-
inheritLeadingComments2(
|
|
49834
|
-
inheritTrailingComments2(
|
|
49903
|
+
const verifiedNodes = _verifyNodeList.call(this, nodes2);
|
|
49904
|
+
inheritLeadingComments2(verifiedNodes[0], this.node);
|
|
49905
|
+
inheritTrailingComments2(verifiedNodes[verifiedNodes.length - 1], this.node);
|
|
49835
49906
|
getCachedPaths(this)?.delete(this.node);
|
|
49836
49907
|
this.node =
|
|
49837
49908
|
this.container[this.key] = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/babel",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.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",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"commonjs"
|
|
47
47
|
],
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@babel/code-frame": "8.0.0-beta.
|
|
50
|
-
"@babel/generator": "8.0.0-beta.
|
|
51
|
-
"@babel/parser": "8.0.0-beta.
|
|
52
|
-
"@babel/template": "8.0.0-beta.
|
|
53
|
-
"@babel/traverse": "8.0.0-beta.
|
|
54
|
-
"@babel/types": "8.0.0-beta.
|
|
49
|
+
"@babel/code-frame": "8.0.0-beta.2",
|
|
50
|
+
"@babel/generator": "8.0.0-beta.2",
|
|
51
|
+
"@babel/parser": "8.0.0-beta.2",
|
|
52
|
+
"@babel/template": "8.0.0-beta.2",
|
|
53
|
+
"@babel/traverse": "8.0.0-beta.2",
|
|
54
|
+
"@babel/types": "8.0.0-beta.2",
|
|
55
55
|
"@swc/core": "^1.3.101",
|
|
56
56
|
"@types/node": "^24.0.10",
|
|
57
57
|
"acorn-stage3": "^4.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"check-dts": "^0.9.0",
|
|
60
60
|
"eslint": "^9.4.0",
|
|
61
61
|
"eslint-plugin-n": "^17.9.0",
|
|
62
|
-
"eslint-plugin-putout": "^
|
|
62
|
+
"eslint-plugin-putout": "^28.0.5",
|
|
63
63
|
"globals": "^16.2.0",
|
|
64
64
|
"madrun": "^11.0.2",
|
|
65
65
|
"nodemon": "^3.0.1",
|