@putout/bundle 3.5.0 → 3.5.1
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/bundle/putout-iife.js +1 -1
- package/bundle/putout.js +621 -496
- package/bundle/putout.min.js +1 -1
- package/package.json +3 -3
package/bundle/putout.js
CHANGED
|
@@ -29,7 +29,7 @@ function getAugmentedNamespace(n) {
|
|
|
29
29
|
return a;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
var putout$
|
|
32
|
+
var putout$2 = {exports: {}};
|
|
33
33
|
|
|
34
34
|
var global$1 = (typeof global !== "undefined" ? global :
|
|
35
35
|
typeof self !== "undefined" ? self :
|
|
@@ -2479,7 +2479,7 @@ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
|
|
|
2479
2479
|
|
|
2480
2480
|
var formatRegExp = /%[sdj%]/g;
|
|
2481
2481
|
function format(f) {
|
|
2482
|
-
if (!isString$
|
|
2482
|
+
if (!isString$9(f)) {
|
|
2483
2483
|
var objects = [];
|
|
2484
2484
|
for (var i = 0; i < arguments.length; i++) {
|
|
2485
2485
|
objects.push(inspect$1(arguments[i]));
|
|
@@ -2672,7 +2672,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
2672
2672
|
// Also filter out any prototype objects using the circular check.
|
|
2673
2673
|
!(value.constructor && value.constructor.prototype === value)) {
|
|
2674
2674
|
var ret = value.inspect(recurseTimes, ctx);
|
|
2675
|
-
if (!isString$
|
|
2675
|
+
if (!isString$9(ret)) {
|
|
2676
2676
|
ret = formatValue(ctx, ret, recurseTimes);
|
|
2677
2677
|
}
|
|
2678
2678
|
return ret;
|
|
@@ -2777,7 +2777,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
2777
2777
|
function formatPrimitive(ctx, value) {
|
|
2778
2778
|
if (isUndefined(value))
|
|
2779
2779
|
return ctx.stylize('undefined', 'undefined');
|
|
2780
|
-
if (isString$
|
|
2780
|
+
if (isString$9(value)) {
|
|
2781
2781
|
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
|
2782
2782
|
.replace(/'/g, "\\'")
|
|
2783
2783
|
.replace(/\\"/g, '"') + '\'';
|
|
@@ -2918,7 +2918,7 @@ function isNumber$3(arg) {
|
|
|
2918
2918
|
return typeof arg === 'number';
|
|
2919
2919
|
}
|
|
2920
2920
|
|
|
2921
|
-
function isString$
|
|
2921
|
+
function isString$9(arg) {
|
|
2922
2922
|
return typeof arg === 'string';
|
|
2923
2923
|
}
|
|
2924
2924
|
|
|
@@ -3125,7 +3125,7 @@ var _polyfillNode_util = {
|
|
|
3125
3125
|
isRegExp: isRegExp$1,
|
|
3126
3126
|
isUndefined: isUndefined,
|
|
3127
3127
|
isSymbol: isSymbol,
|
|
3128
|
-
isString: isString$
|
|
3128
|
+
isString: isString$9,
|
|
3129
3129
|
isNumber: isNumber$3,
|
|
3130
3130
|
isNullOrUndefined: isNullOrUndefined,
|
|
3131
3131
|
isNull: isNull$1,
|
|
@@ -3161,7 +3161,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
|
|
|
3161
3161
|
isObject: isObject$4,
|
|
3162
3162
|
isPrimitive: isPrimitive$1,
|
|
3163
3163
|
isRegExp: isRegExp$1,
|
|
3164
|
-
isString: isString$
|
|
3164
|
+
isString: isString$9,
|
|
3165
3165
|
isSymbol: isSymbol,
|
|
3166
3166
|
isUndefined: isUndefined,
|
|
3167
3167
|
log: log$5,
|
|
@@ -6632,8 +6632,8 @@ var require_globals2 = __commonJS({
|
|
|
6632
6632
|
var lib_exports2 = {};
|
|
6633
6633
|
__export(lib_exports2, {
|
|
6634
6634
|
codeFrameColumns: () => codeFrameColumns$2,
|
|
6635
|
-
generate: () => generate$
|
|
6636
|
-
parse: () => parse$
|
|
6635
|
+
generate: () => generate$5,
|
|
6636
|
+
parse: () => parse$3,
|
|
6637
6637
|
parseExpression: () => parseExpression$1,
|
|
6638
6638
|
template: () => index,
|
|
6639
6639
|
tokTypes: () => tokTypes,
|
|
@@ -7891,7 +7891,7 @@ __export(lib_exports, {
|
|
|
7891
7891
|
toSequenceExpression: () => toSequenceExpression,
|
|
7892
7892
|
toStatement: () => toStatement$1,
|
|
7893
7893
|
topicReference: () => topicReference,
|
|
7894
|
-
traverse: () => traverse$
|
|
7894
|
+
traverse: () => traverse$b,
|
|
7895
7895
|
traverseFast: () => traverseFast,
|
|
7896
7896
|
tryStatement: () => tryStatement,
|
|
7897
7897
|
tsAnyKeyword: () => tsAnyKeyword,
|
|
@@ -18200,7 +18200,7 @@ function prependToMemberExpression(member, prepend) {
|
|
|
18200
18200
|
function getOuterBindingIdentifiers(node, duplicates) {
|
|
18201
18201
|
return getBindingIdentifiers(node, duplicates, true);
|
|
18202
18202
|
}
|
|
18203
|
-
function traverse$
|
|
18203
|
+
function traverse$b(node, handlers, state) {
|
|
18204
18204
|
if (typeof handlers === "function") {
|
|
18205
18205
|
handlers = {
|
|
18206
18206
|
enter: handlers
|
|
@@ -19187,7 +19187,7 @@ var TokContext = class {
|
|
|
19187
19187
|
token;
|
|
19188
19188
|
preserveSpace;
|
|
19189
19189
|
};
|
|
19190
|
-
var types$
|
|
19190
|
+
var types$n = {
|
|
19191
19191
|
brace: new TokContext("{"),
|
|
19192
19192
|
j_oTag: new TokContext("<tag"),
|
|
19193
19193
|
j_cTag: new TokContext("</tag"),
|
|
@@ -20279,7 +20279,7 @@ var State$2 = class _State {
|
|
|
20279
20279
|
lastTokEndLoc = null;
|
|
20280
20280
|
lastTokStartLoc = null;
|
|
20281
20281
|
lastTokStart = 0;
|
|
20282
|
-
context = [types$
|
|
20282
|
+
context = [types$n.brace];
|
|
20283
20283
|
canStartJSXElement = true;
|
|
20284
20284
|
containsEsc = false;
|
|
20285
20285
|
firstInvalidTemplateEscapePos = null;
|
|
@@ -24126,7 +24126,7 @@ var flow$1 = (superClass) => class FlowParserMixin extends superClass {
|
|
|
24126
24126
|
context
|
|
24127
24127
|
} = this.state;
|
|
24128
24128
|
const currentContext = context[context.length - 1];
|
|
24129
|
-
if (currentContext === types$
|
|
24129
|
+
if (currentContext === types$n.j_oTag || currentContext === types$n.j_expr) {
|
|
24130
24130
|
context.pop();
|
|
24131
24131
|
}
|
|
24132
24132
|
}
|
|
@@ -25189,9 +25189,9 @@ var jsx$3 = (superClass) => class JSXParserMixin extends superClass {
|
|
|
25189
25189
|
switch (this.state.type) {
|
|
25190
25190
|
case 5:
|
|
25191
25191
|
node = this.startNode();
|
|
25192
|
-
this.setContext(types$
|
|
25192
|
+
this.setContext(types$n.brace);
|
|
25193
25193
|
this.next();
|
|
25194
|
-
node = this.jsxParseExpressionContainer(node, types$
|
|
25194
|
+
node = this.jsxParseExpressionContainer(node, types$n.j_oTag);
|
|
25195
25195
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
25196
25196
|
this.raise(JsxErrors.AttributeIsEmpty, {
|
|
25197
25197
|
at: node
|
|
@@ -25214,7 +25214,7 @@ var jsx$3 = (superClass) => class JSXParserMixin extends superClass {
|
|
|
25214
25214
|
jsxParseSpreadChild(node) {
|
|
25215
25215
|
this.next();
|
|
25216
25216
|
node.expression = this.parseExpression();
|
|
25217
|
-
this.setContext(types$
|
|
25217
|
+
this.setContext(types$n.j_expr);
|
|
25218
25218
|
this.state.canStartJSXElement = true;
|
|
25219
25219
|
this.expect(8);
|
|
25220
25220
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -25242,11 +25242,11 @@ var jsx$3 = (superClass) => class JSXParserMixin extends superClass {
|
|
|
25242
25242
|
jsxParseAttribute() {
|
|
25243
25243
|
const node = this.startNode();
|
|
25244
25244
|
if (this.match(5)) {
|
|
25245
|
-
this.setContext(types$
|
|
25245
|
+
this.setContext(types$n.brace);
|
|
25246
25246
|
this.next();
|
|
25247
25247
|
this.expect(21);
|
|
25248
25248
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
25249
|
-
this.setContext(types$
|
|
25249
|
+
this.setContext(types$n.j_oTag);
|
|
25250
25250
|
this.state.canStartJSXElement = true;
|
|
25251
25251
|
this.expect(8);
|
|
25252
25252
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -25305,12 +25305,12 @@ var jsx$3 = (superClass) => class JSXParserMixin extends superClass {
|
|
|
25305
25305
|
break;
|
|
25306
25306
|
case 5: {
|
|
25307
25307
|
const node2 = this.startNode();
|
|
25308
|
-
this.setContext(types$
|
|
25308
|
+
this.setContext(types$n.brace);
|
|
25309
25309
|
this.next();
|
|
25310
25310
|
if (this.match(21)) {
|
|
25311
25311
|
children.push(this.jsxParseSpreadChild(node2));
|
|
25312
25312
|
} else {
|
|
25313
|
-
children.push(this.jsxParseExpressionContainer(node2, types$
|
|
25313
|
+
children.push(this.jsxParseExpressionContainer(node2, types$n.j_expr));
|
|
25314
25314
|
}
|
|
25315
25315
|
break;
|
|
25316
25316
|
}
|
|
@@ -25381,11 +25381,11 @@ var jsx$3 = (superClass) => class JSXParserMixin extends superClass {
|
|
|
25381
25381
|
}
|
|
25382
25382
|
getTokenFromCode(code2) {
|
|
25383
25383
|
const context = this.curContext();
|
|
25384
|
-
if (context === types$
|
|
25384
|
+
if (context === types$n.j_expr) {
|
|
25385
25385
|
this.jsxReadToken();
|
|
25386
25386
|
return;
|
|
25387
25387
|
}
|
|
25388
|
-
if (context === types$
|
|
25388
|
+
if (context === types$n.j_oTag || context === types$n.j_cTag) {
|
|
25389
25389
|
if (isIdentifierStart2(code2)) {
|
|
25390
25390
|
this.jsxReadWord();
|
|
25391
25391
|
return;
|
|
@@ -25395,7 +25395,7 @@ var jsx$3 = (superClass) => class JSXParserMixin extends superClass {
|
|
|
25395
25395
|
this.finishToken(143);
|
|
25396
25396
|
return;
|
|
25397
25397
|
}
|
|
25398
|
-
if ((code2 === 34 || code2 === 39) && context === types$
|
|
25398
|
+
if ((code2 === 34 || code2 === 39) && context === types$n.j_oTag) {
|
|
25399
25399
|
this.jsxReadString(code2);
|
|
25400
25400
|
return;
|
|
25401
25401
|
}
|
|
@@ -25413,17 +25413,17 @@ var jsx$3 = (superClass) => class JSXParserMixin extends superClass {
|
|
|
25413
25413
|
type
|
|
25414
25414
|
} = this.state;
|
|
25415
25415
|
if (type === 56 && prevType === 142) {
|
|
25416
|
-
context.splice(-2, 2, types$
|
|
25416
|
+
context.splice(-2, 2, types$n.j_cTag);
|
|
25417
25417
|
this.state.canStartJSXElement = false;
|
|
25418
25418
|
} else if (type === 142) {
|
|
25419
|
-
context.push(types$
|
|
25419
|
+
context.push(types$n.j_oTag);
|
|
25420
25420
|
} else if (type === 143) {
|
|
25421
25421
|
const out = context[context.length - 1];
|
|
25422
|
-
if (out === types$
|
|
25422
|
+
if (out === types$n.j_oTag && prevType === 56 || out === types$n.j_cTag) {
|
|
25423
25423
|
context.pop();
|
|
25424
|
-
this.state.canStartJSXElement = context[context.length - 1] === types$
|
|
25424
|
+
this.state.canStartJSXElement = context[context.length - 1] === types$n.j_expr;
|
|
25425
25425
|
} else {
|
|
25426
|
-
this.setContext(types$
|
|
25426
|
+
this.setContext(types$n.j_expr);
|
|
25427
25427
|
this.state.canStartJSXElement = true;
|
|
25428
25428
|
}
|
|
25429
25429
|
} else {
|
|
@@ -27447,7 +27447,7 @@ var typescript$3 = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27447
27447
|
this.raise(TSErrors.EmptyTypeArguments, {
|
|
27448
27448
|
at: node
|
|
27449
27449
|
});
|
|
27450
|
-
} else if (!this.state.inType && this.curContext() === types$
|
|
27450
|
+
} else if (!this.state.inType && this.curContext() === types$n.brace) {
|
|
27451
27451
|
this.reScan_lt_gt();
|
|
27452
27452
|
}
|
|
27453
27453
|
this.expect(48);
|
|
@@ -28123,7 +28123,7 @@ var typescript$3 = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28123
28123
|
context
|
|
28124
28124
|
} = this.state;
|
|
28125
28125
|
const currentContext = context[context.length - 1];
|
|
28126
|
-
if (currentContext === types$
|
|
28126
|
+
if (currentContext === types$n.j_oTag || currentContext === types$n.j_expr) {
|
|
28127
28127
|
context.pop();
|
|
28128
28128
|
}
|
|
28129
28129
|
}
|
|
@@ -32802,7 +32802,7 @@ function pluginsMap(plugins) {
|
|
|
32802
32802
|
}
|
|
32803
32803
|
return pluginMap;
|
|
32804
32804
|
}
|
|
32805
|
-
function parse$
|
|
32805
|
+
function parse$3(input, options) {
|
|
32806
32806
|
if ((options == null ? void 0 : options.sourceType) === "unambiguous") {
|
|
32807
32807
|
options = Object.assign({}, options);
|
|
32808
32808
|
try {
|
|
@@ -34398,7 +34398,7 @@ function parseWithCodeFrame(code2, parserOpts, syntacticPlaceholders) {
|
|
|
34398
34398
|
plugins
|
|
34399
34399
|
});
|
|
34400
34400
|
try {
|
|
34401
|
-
return parse$
|
|
34401
|
+
return parse$3(code2, parserOpts);
|
|
34402
34402
|
} catch (err) {
|
|
34403
34403
|
const loc = err.loc;
|
|
34404
34404
|
if (loc) {
|
|
@@ -39946,7 +39946,7 @@ function normalizeOptions(code2, opts) {
|
|
|
39946
39946
|
}
|
|
39947
39947
|
return format;
|
|
39948
39948
|
}
|
|
39949
|
-
function generate$
|
|
39949
|
+
function generate$5(ast, opts, code2) {
|
|
39950
39950
|
const gen = new Generator(ast, opts, code2);
|
|
39951
39951
|
return gen.generate();
|
|
39952
39952
|
}
|
|
@@ -42343,7 +42343,7 @@ function replaceWithSourceString(replacement) {
|
|
|
42343
42343
|
let ast;
|
|
42344
42344
|
try {
|
|
42345
42345
|
replacement = `(${replacement})`;
|
|
42346
|
-
ast = parse$
|
|
42346
|
+
ast = parse$3(replacement);
|
|
42347
42347
|
} catch (err) {
|
|
42348
42348
|
const loc = err.loc;
|
|
42349
42349
|
if (loc) {
|
|
@@ -45064,7 +45064,7 @@ var NodePath$4 = class _NodePath {
|
|
|
45064
45064
|
debug$6(`${this.getPathLocation()} ${this.type}: ${message}`);
|
|
45065
45065
|
}
|
|
45066
45066
|
toString() {
|
|
45067
|
-
return generate$
|
|
45067
|
+
return generate$5(this.node).code;
|
|
45068
45068
|
}
|
|
45069
45069
|
get inList() {
|
|
45070
45070
|
return !!this.listKey;
|
|
@@ -45607,7 +45607,7 @@ function getModulePath(name) {
|
|
|
45607
45607
|
var asyncLoader = {};
|
|
45608
45608
|
|
|
45609
45609
|
var tryToCatch$1 = async (fn, ...args) => {
|
|
45610
|
-
check$
|
|
45610
|
+
check$8(fn);
|
|
45611
45611
|
|
|
45612
45612
|
try {
|
|
45613
45613
|
return [null, await fn(...args)];
|
|
@@ -45616,7 +45616,7 @@ var tryToCatch$1 = async (fn, ...args) => {
|
|
|
45616
45616
|
}
|
|
45617
45617
|
};
|
|
45618
45618
|
|
|
45619
|
-
function check$
|
|
45619
|
+
function check$8(fn) {
|
|
45620
45620
|
if (typeof fn !== 'function')
|
|
45621
45621
|
throw Error('fn should be a function!');
|
|
45622
45622
|
}
|
|
@@ -46310,17 +46310,17 @@ function isExectRuleEnabled(name, status, rules) {
|
|
|
46310
46310
|
return false;
|
|
46311
46311
|
}
|
|
46312
46312
|
|
|
46313
|
-
var check$
|
|
46313
|
+
var check$7 = {};
|
|
46314
46314
|
|
|
46315
|
-
const isString$
|
|
46315
|
+
const isString$8 = (a) => typeof a === 'string';
|
|
46316
46316
|
|
|
46317
|
-
check$
|
|
46317
|
+
check$7.check = (options) => {
|
|
46318
46318
|
if (!options || typeof options !== 'object')
|
|
46319
46319
|
throw Error('options should be an object!');
|
|
46320
46320
|
};
|
|
46321
46321
|
|
|
46322
|
-
check$
|
|
46323
|
-
if (!isString$
|
|
46322
|
+
check$7.checkRule = (rule) => {
|
|
46323
|
+
if (!isString$8(rule))
|
|
46324
46324
|
throw Error(`☝️ Looks like plugin name type is not 'string', but: '${typeof rule}'`);
|
|
46325
46325
|
};
|
|
46326
46326
|
|
|
@@ -46338,12 +46338,12 @@ const {parsePluginNames: parsePluginNames$1} = parsePluginNames$2;
|
|
|
46338
46338
|
const validatePlugin$1 = validatePlugin$2;
|
|
46339
46339
|
const {filterEnabledPlugins: filterEnabledPlugins$1} = filterEnabledPlugins$2;
|
|
46340
46340
|
|
|
46341
|
-
const {check: check$
|
|
46341
|
+
const {check: check$6, checkRule: checkRule$1} = check$7;
|
|
46342
46342
|
|
|
46343
46343
|
const loadPluginAsync = createAsyncLoader$1('plugin');
|
|
46344
46344
|
|
|
46345
46345
|
loadPluginsAsync$1.loadPluginsAsync = async (options) => {
|
|
46346
|
-
check$
|
|
46346
|
+
check$6(options);
|
|
46347
46347
|
|
|
46348
46348
|
const {pluginNames = [], rules = {}} = options;
|
|
46349
46349
|
|
|
@@ -46451,12 +46451,12 @@ const {
|
|
|
46451
46451
|
} = rules;
|
|
46452
46452
|
|
|
46453
46453
|
const {filterEnabledPlugins} = filterEnabledPlugins$2;
|
|
46454
|
-
const {check: check$
|
|
46454
|
+
const {check: check$5, checkRule} = check$7;
|
|
46455
46455
|
const {isArray: isArray$7} = Array;
|
|
46456
46456
|
|
|
46457
46457
|
lib$1.loadPluginsAsync = loadPluginsAsync;
|
|
46458
46458
|
lib$1.loadProcessorsAsync = nanomemoize(async (options, load) => {
|
|
46459
|
-
check$
|
|
46459
|
+
check$5(options);
|
|
46460
46460
|
|
|
46461
46461
|
const {processors = []} = options;
|
|
46462
46462
|
const parsedProcessors = parseProcessorNames(processors);
|
|
@@ -46479,7 +46479,7 @@ lib$1.loadProcessorsAsync = nanomemoize(async (options, load) => {
|
|
|
46479
46479
|
lib$1.createAsyncLoader = createAsyncLoader;
|
|
46480
46480
|
|
|
46481
46481
|
lib$1.loadPlugins = (options) => {
|
|
46482
|
-
check$
|
|
46482
|
+
check$5(options);
|
|
46483
46483
|
|
|
46484
46484
|
const {pluginNames = [], rules = {}} = options;
|
|
46485
46485
|
|
|
@@ -47754,7 +47754,7 @@ var main = {};
|
|
|
47754
47754
|
|
|
47755
47755
|
var fork = {exports: {}};
|
|
47756
47756
|
|
|
47757
|
-
var types$
|
|
47757
|
+
var types$m = {exports: {}};
|
|
47758
47758
|
|
|
47759
47759
|
var shared = {};
|
|
47760
47760
|
|
|
@@ -47854,12 +47854,12 @@ function requireShared () {
|
|
|
47854
47854
|
return shared;
|
|
47855
47855
|
}
|
|
47856
47856
|
|
|
47857
|
-
types$
|
|
47857
|
+
types$m.exports;
|
|
47858
47858
|
|
|
47859
47859
|
var hasRequiredTypes;
|
|
47860
47860
|
|
|
47861
47861
|
function requireTypes () {
|
|
47862
|
-
if (hasRequiredTypes) return types$
|
|
47862
|
+
if (hasRequiredTypes) return types$m.exports;
|
|
47863
47863
|
hasRequiredTypes = 1;
|
|
47864
47864
|
(function (module, exports) {
|
|
47865
47865
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -48651,8 +48651,8 @@ function requireTypes () {
|
|
|
48651
48651
|
exports.default = typesPlugin;
|
|
48652
48652
|
(0, shared_1.maybeSetModuleExports)(function () { return module; });
|
|
48653
48653
|
|
|
48654
|
-
} (types$
|
|
48655
|
-
return types$
|
|
48654
|
+
} (types$m, types$m.exports));
|
|
48655
|
+
return types$m.exports;
|
|
48656
48656
|
}
|
|
48657
48657
|
|
|
48658
48658
|
var pathVisitor = {exports: {}};
|
|
@@ -68448,9 +68448,9 @@ var fullstore$1 = (value) => {
|
|
|
68448
68448
|
};
|
|
68449
68449
|
};
|
|
68450
68450
|
|
|
68451
|
-
var types$
|
|
68451
|
+
var types$l = {};
|
|
68452
68452
|
|
|
68453
|
-
types$
|
|
68453
|
+
types$l.TYPES = {
|
|
68454
68454
|
TOKEN: 'Token',
|
|
68455
68455
|
NEWLINE: 'Newline',
|
|
68456
68456
|
LINEBREAK: 'Linebreak',
|
|
@@ -68630,7 +68630,7 @@ maybeInsideFn$1.maybeInsideFn = (insideFn, {print, indent}) => {
|
|
|
68630
68630
|
indent.dec();
|
|
68631
68631
|
};
|
|
68632
68632
|
|
|
68633
|
-
const {types: types$
|
|
68633
|
+
const {types: types$k} = bundle;
|
|
68634
68634
|
const {
|
|
68635
68635
|
hasTrailingComment: hasTrailingComment$2,
|
|
68636
68636
|
satisfy: satisfy$3,
|
|
@@ -68645,7 +68645,7 @@ const {
|
|
|
68645
68645
|
isVariableDeclarator,
|
|
68646
68646
|
isClassProperty,
|
|
68647
68647
|
isTSPropertySignature,
|
|
68648
|
-
} = types$
|
|
68648
|
+
} = types$k;
|
|
68649
68649
|
|
|
68650
68650
|
const isProperty = satisfy$3([
|
|
68651
68651
|
isObjectProperty$1,
|
|
@@ -70181,13 +70181,13 @@ var operate = {};
|
|
|
70181
70181
|
|
|
70182
70182
|
var getBinding$2 = {};
|
|
70183
70183
|
|
|
70184
|
-
const {types: types$
|
|
70184
|
+
const {types: types$j} = bundle;
|
|
70185
70185
|
const {
|
|
70186
70186
|
isIdentifier: isIdentifier$7,
|
|
70187
70187
|
isMemberExpression: isMemberExpression$1,
|
|
70188
|
-
} = types$
|
|
70188
|
+
} = types$j;
|
|
70189
70189
|
|
|
70190
|
-
const isString$
|
|
70190
|
+
const isString$7 = (a) => typeof a === 'string';
|
|
70191
70191
|
|
|
70192
70192
|
getBinding$2.getBinding = getBinding$1;
|
|
70193
70193
|
function getBinding$1(path, node) {
|
|
@@ -70198,7 +70198,7 @@ function getBinding$1(path, node) {
|
|
|
70198
70198
|
getBinding$2.getBindingPath = (path, name) => getBinding$1(path, name)?.path;
|
|
70199
70199
|
|
|
70200
70200
|
const parseName$1 = (node) => {
|
|
70201
|
-
if (isString$
|
|
70201
|
+
if (isString$7(node))
|
|
70202
70202
|
return node;
|
|
70203
70203
|
|
|
70204
70204
|
if (isIdentifier$7(node))
|
|
@@ -70212,13 +70212,13 @@ const parseName$1 = (node) => {
|
|
|
70212
70212
|
|
|
70213
70213
|
var isSimple$2 = {};
|
|
70214
70214
|
|
|
70215
|
-
const {types: types$
|
|
70215
|
+
const {types: types$i} = bundle;
|
|
70216
70216
|
const {
|
|
70217
70217
|
isOptionalMemberExpression,
|
|
70218
70218
|
isMemberExpression,
|
|
70219
70219
|
isIdentifier: isIdentifier$6,
|
|
70220
70220
|
isLiteral: isLiteral$4,
|
|
70221
|
-
} = types$
|
|
70221
|
+
} = types$i;
|
|
70222
70222
|
|
|
70223
70223
|
isSimple$2.isSimple = (a) => {
|
|
70224
70224
|
if (isLiteral$4(a))
|
|
@@ -70235,7 +70235,7 @@ isSimple$2.isSimple = (a) => {
|
|
|
70235
70235
|
|
|
70236
70236
|
var extract$5 = {};
|
|
70237
70237
|
|
|
70238
|
-
const {types: types$
|
|
70238
|
+
const {types: types$h} = bundle;
|
|
70239
70239
|
const {
|
|
70240
70240
|
isLiteral: isLiteral$3,
|
|
70241
70241
|
isIdentifier: isIdentifier$5,
|
|
@@ -70246,7 +70246,7 @@ const {
|
|
|
70246
70246
|
isJSXText: isJSXText$2,
|
|
70247
70247
|
isJSXAttribute: isJSXAttribute$1,
|
|
70248
70248
|
isTSTypeReference: isTSTypeReference$2,
|
|
70249
|
-
} = types$
|
|
70249
|
+
} = types$h;
|
|
70250
70250
|
|
|
70251
70251
|
extract$5.extract = extract$4;
|
|
70252
70252
|
|
|
@@ -70537,9 +70537,9 @@ rename$1.rename = (path, from, to) => {
|
|
|
70537
70537
|
bindingPath.scope.rename(from, to);
|
|
70538
70538
|
};
|
|
70539
70539
|
|
|
70540
|
-
var setLiteralValue$
|
|
70540
|
+
var setLiteralValue$1 = {};
|
|
70541
70541
|
|
|
70542
|
-
setLiteralValue$
|
|
70542
|
+
setLiteralValue$1.setLiteralValue = (path, newValue) => {
|
|
70543
70543
|
const node = path.node || path;
|
|
70544
70544
|
const {
|
|
70545
70545
|
raw,
|
|
@@ -70562,10 +70562,10 @@ setLiteralValue$2.setLiteralValue = (path, newValue) => {
|
|
|
70562
70562
|
|
|
70563
70563
|
var properties = {};
|
|
70564
70564
|
|
|
70565
|
-
var traverseProperties$
|
|
70565
|
+
var traverseProperties$2 = {};
|
|
70566
70566
|
|
|
70567
|
-
const {traverse: traverse$
|
|
70568
|
-
const {isObjectExpression: isObjectExpression$3} = types$
|
|
70567
|
+
const {traverse: traverse$a, types: types$g} = bundle;
|
|
70568
|
+
const {isObjectExpression: isObjectExpression$3} = types$g;
|
|
70569
70569
|
|
|
70570
70570
|
function getNode(path) {
|
|
70571
70571
|
if (!isObjectExpression$3(path))
|
|
@@ -70580,11 +70580,11 @@ function getNode(path) {
|
|
|
70580
70580
|
};
|
|
70581
70581
|
}
|
|
70582
70582
|
|
|
70583
|
-
traverseProperties$
|
|
70583
|
+
traverseProperties$2.traverseProperties = (path, name) => {
|
|
70584
70584
|
const collector = [];
|
|
70585
70585
|
const node = getNode(path);
|
|
70586
70586
|
|
|
70587
|
-
traverse$
|
|
70587
|
+
traverse$a(node, {
|
|
70588
70588
|
noScope: true,
|
|
70589
70589
|
ObjectExpression: collect(name, collector),
|
|
70590
70590
|
});
|
|
@@ -70602,9 +70602,9 @@ const collect = (name, collector) => (path) => {
|
|
|
70602
70602
|
};
|
|
70603
70603
|
|
|
70604
70604
|
const {extract: extract$2} = extract$5;
|
|
70605
|
-
const {traverseProperties: traverseProperties$
|
|
70605
|
+
const {traverseProperties: traverseProperties$1} = traverseProperties$2;
|
|
70606
70606
|
|
|
70607
|
-
properties.traverseProperties = traverseProperties$
|
|
70607
|
+
properties.traverseProperties = traverseProperties$1;
|
|
70608
70608
|
|
|
70609
70609
|
properties.getProperties = (path, names) => {
|
|
70610
70610
|
const result = {};
|
|
@@ -70638,7 +70638,7 @@ properties.getProperty = (path, name) => {
|
|
|
70638
70638
|
return null;
|
|
70639
70639
|
};
|
|
70640
70640
|
|
|
70641
|
-
const {types: types$
|
|
70641
|
+
const {types: types$f} = bundle;
|
|
70642
70642
|
|
|
70643
70643
|
const {getBinding, getBindingPath} = getBinding$2;
|
|
70644
70644
|
const {isSimple: isSimple$1} = isSimple$2;
|
|
@@ -70648,12 +70648,12 @@ const {remove: remove$1} = remove$2;
|
|
|
70648
70648
|
const {getExportDefault} = getExportDefault$1;
|
|
70649
70649
|
const {rename} = rename$1;
|
|
70650
70650
|
const {renameProperty} = renameProperty$2;
|
|
70651
|
-
const {setLiteralValue
|
|
70651
|
+
const {setLiteralValue} = setLiteralValue$1;
|
|
70652
70652
|
|
|
70653
70653
|
const {
|
|
70654
|
-
getProperty
|
|
70654
|
+
getProperty,
|
|
70655
70655
|
getProperties,
|
|
70656
|
-
traverseProperties
|
|
70656
|
+
traverseProperties,
|
|
70657
70657
|
} = properties;
|
|
70658
70658
|
|
|
70659
70659
|
const {
|
|
@@ -70666,7 +70666,7 @@ const {
|
|
|
70666
70666
|
isExpression: isExpression$1,
|
|
70667
70667
|
isStatement: isStatement$3,
|
|
70668
70668
|
BlockStatement: BlockStatement$1,
|
|
70669
|
-
} = types$
|
|
70669
|
+
} = types$f;
|
|
70670
70670
|
|
|
70671
70671
|
const {assign: assign$a} = Object;
|
|
70672
70672
|
|
|
@@ -70680,11 +70680,11 @@ operate.toExpression = toExpression;
|
|
|
70680
70680
|
operate.isSimple = isSimple$1;
|
|
70681
70681
|
operate.rename = rename;
|
|
70682
70682
|
operate.renameProperty = renameProperty;
|
|
70683
|
-
operate.setLiteralValue = setLiteralValue
|
|
70683
|
+
operate.setLiteralValue = setLiteralValue;
|
|
70684
70684
|
|
|
70685
|
-
operate.getProperty = getProperty
|
|
70685
|
+
operate.getProperty = getProperty;
|
|
70686
70686
|
operate.getProperties = getProperties;
|
|
70687
|
-
operate.traverseProperties = traverseProperties
|
|
70687
|
+
operate.traverseProperties = traverseProperties;
|
|
70688
70688
|
|
|
70689
70689
|
function toExpression(el) {
|
|
70690
70690
|
const {type} = el;
|
|
@@ -71454,12 +71454,12 @@ var tupleExpression = {};
|
|
|
71454
71454
|
|
|
71455
71455
|
var maybe = {};
|
|
71456
71456
|
|
|
71457
|
-
const isString$
|
|
71457
|
+
const isString$6 = (a) => typeof a === 'string';
|
|
71458
71458
|
const constant = (a) => () => a;
|
|
71459
71459
|
const {keys: keys$3} = Object;
|
|
71460
71460
|
|
|
71461
71461
|
var rendy$1 = (template, values, modifiers) => {
|
|
71462
|
-
check$
|
|
71462
|
+
check$4(template, values);
|
|
71463
71463
|
|
|
71464
71464
|
let result = template;
|
|
71465
71465
|
|
|
@@ -71479,8 +71479,8 @@ var rendy$1 = (template, values, modifiers) => {
|
|
|
71479
71479
|
return result;
|
|
71480
71480
|
};
|
|
71481
71481
|
|
|
71482
|
-
function check$
|
|
71483
|
-
if (!isString$
|
|
71482
|
+
function check$4(template, values) {
|
|
71483
|
+
if (!isString$6(template))
|
|
71484
71484
|
throw Error('template should be a string!');
|
|
71485
71485
|
|
|
71486
71486
|
if (typeof values !== 'object')
|
|
@@ -73360,8 +73360,8 @@ tsTypeAliasDeclaration.TSTypeAliasDeclaration = {
|
|
|
73360
73360
|
|
|
73361
73361
|
var tsMappedType = {};
|
|
73362
73362
|
|
|
73363
|
-
const {types: types$
|
|
73364
|
-
const {isTSConditionalType} = types$
|
|
73363
|
+
const {types: types$e} = bundle;
|
|
73364
|
+
const {isTSConditionalType} = types$e;
|
|
73365
73365
|
|
|
73366
73366
|
tsMappedType.TSMappedType = (path, {print, indent, maybe}) => {
|
|
73367
73367
|
const {
|
|
@@ -74418,7 +74418,7 @@ function snakeCase(str) {
|
|
|
74418
74418
|
}
|
|
74419
74419
|
|
|
74420
74420
|
const {stringify: stringify$6} = JSON;
|
|
74421
|
-
const {TYPES: TYPES$1} = types$
|
|
74421
|
+
const {TYPES: TYPES$1} = types$l;
|
|
74422
74422
|
const toSnakeCase = justSnakeCase;
|
|
74423
74423
|
|
|
74424
74424
|
const {codeFrameColumns: codeFrameColumns$1} = bundle;
|
|
@@ -74543,7 +74543,7 @@ const {round} = Math;
|
|
|
74543
74543
|
const fullstore = fullstore$1;
|
|
74544
74544
|
const isObject$3 = (a) => a && typeof a === 'object';
|
|
74545
74545
|
const babelTraverse$2 = bundle.traverse;
|
|
74546
|
-
const {TYPES} = types$
|
|
74546
|
+
const {TYPES} = types$l;
|
|
74547
74547
|
const baseVisitors = visitors;
|
|
74548
74548
|
|
|
74549
74549
|
const {
|
|
@@ -74562,7 +74562,7 @@ const {
|
|
|
74562
74562
|
|
|
74563
74563
|
const {parseOverrides} = overrides;
|
|
74564
74564
|
|
|
74565
|
-
const isString$
|
|
74565
|
+
const isString$5 = (a) => typeof a === 'string';
|
|
74566
74566
|
const {assign: assign$9, freeze} = Object;
|
|
74567
74567
|
const callWith = (fn, a) => () => fn(a);
|
|
74568
74568
|
|
|
@@ -74807,7 +74807,7 @@ const createPrint = (path, {traverse, write}) => (maybeLine) => {
|
|
|
74807
74807
|
};
|
|
74808
74808
|
|
|
74809
74809
|
const computePath = (path, maybeLine) => {
|
|
74810
|
-
if (isString$
|
|
74810
|
+
if (isString$5(maybeLine) && maybeLine.startsWith(GET)) {
|
|
74811
74811
|
return get(path, maybeLine);
|
|
74812
74812
|
}
|
|
74813
74813
|
|
|
@@ -74942,7 +74942,7 @@ printer.visitors = visitors;
|
|
|
74942
74942
|
|
|
74943
74943
|
const recast$1 = main$1;
|
|
74944
74944
|
const putoutPrinter = printer;
|
|
74945
|
-
const {generate: generate$
|
|
74945
|
+
const {generate: generate$4} = bundle;
|
|
74946
74946
|
|
|
74947
74947
|
const {stringify: stringify$5} = JSON;
|
|
74948
74948
|
const {isArray: isArray$5} = Array;
|
|
@@ -74954,7 +74954,7 @@ const btoa = (a) => Buffer.from(a, 'binary').toString('base64');
|
|
|
74954
74954
|
const addSourceMap = (sourceMapName, {code, map}) => !sourceMapName ? code : `${code}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(stringify$5(map))}\n`;
|
|
74955
74955
|
const fixStrictMode = (a) => a.replace(`\n\n\n'use strict'`, `\n\n'use strict'`);
|
|
74956
74956
|
|
|
74957
|
-
var print$
|
|
74957
|
+
var print$2 = (ast, options = {}) => {
|
|
74958
74958
|
const {sourceMapName} = options;
|
|
74959
74959
|
const [printer = 'putout', printerOptions] = maybeArray$6(options.printer);
|
|
74960
74960
|
|
|
@@ -74984,7 +74984,7 @@ var print$3 = (ast, options = {}) => {
|
|
|
74984
74984
|
};
|
|
74985
74985
|
|
|
74986
74986
|
function babelPrint(ast) {
|
|
74987
|
-
const {code} = generate$
|
|
74987
|
+
const {code} = generate$4(ast, {
|
|
74988
74988
|
indent: {
|
|
74989
74989
|
style: ' ',
|
|
74990
74990
|
},
|
|
@@ -74993,7 +74993,7 @@ function babelPrint(ast) {
|
|
|
74993
74993
|
return `${code}\n`;
|
|
74994
74994
|
}
|
|
74995
74995
|
|
|
74996
|
-
print$
|
|
74996
|
+
print$2.default;
|
|
74997
74997
|
|
|
74998
74998
|
const {
|
|
74999
74999
|
isFunctionExpression,
|
|
@@ -75149,7 +75149,7 @@ var setDirectives$1 = (path) => {
|
|
|
75149
75149
|
}
|
|
75150
75150
|
};
|
|
75151
75151
|
|
|
75152
|
-
const isString$
|
|
75152
|
+
const isString$4 = (a) => typeof a === 'string';
|
|
75153
75153
|
const isNumber$1 = (a) => typeof a === 'number';
|
|
75154
75154
|
const isNull = (a) => a === null;
|
|
75155
75155
|
const isBool$2 = (a) => typeof a === 'boolean';
|
|
@@ -75165,7 +75165,7 @@ var setLiteral$2 = (node) => {
|
|
|
75165
75165
|
return;
|
|
75166
75166
|
}
|
|
75167
75167
|
|
|
75168
|
-
if (isString$
|
|
75168
|
+
if (isString$4(value)) {
|
|
75169
75169
|
node.type = 'StringLiteral';
|
|
75170
75170
|
return;
|
|
75171
75171
|
}
|
|
@@ -75404,7 +75404,7 @@ var getAst = (node) => {
|
|
|
75404
75404
|
return ast;
|
|
75405
75405
|
};
|
|
75406
75406
|
|
|
75407
|
-
const {traverse: traverse$
|
|
75407
|
+
const {traverse: traverse$9, types: types$d} = bundle;
|
|
75408
75408
|
|
|
75409
75409
|
const traverseObjectExpression = traverseObjectExpression$1;
|
|
75410
75410
|
const setClassMethod = setClassMethod$1;
|
|
@@ -75432,12 +75432,12 @@ const getAST = getAst;
|
|
|
75432
75432
|
const {
|
|
75433
75433
|
isObjectExpression,
|
|
75434
75434
|
isExportDeclaration,
|
|
75435
|
-
} = types$
|
|
75435
|
+
} = types$d;
|
|
75436
75436
|
|
|
75437
75437
|
var estreeToBabel = (node) => {
|
|
75438
75438
|
const ast = getAST(node);
|
|
75439
75439
|
|
|
75440
|
-
traverse$
|
|
75440
|
+
traverse$9(ast, {
|
|
75441
75441
|
noScope: true,
|
|
75442
75442
|
enter(path) {
|
|
75443
75443
|
const {node} = path;
|
|
@@ -100218,11 +100218,11 @@ function customParse(source, {parser, isTS, isFlow, isJSX}) {
|
|
|
100218
100218
|
return commonjsRequire(parser).parse(source);
|
|
100219
100219
|
}
|
|
100220
100220
|
|
|
100221
|
-
const {types: types$
|
|
100221
|
+
const {types: types$c} = bundle;
|
|
100222
100222
|
const {
|
|
100223
100223
|
StringLiteral,
|
|
100224
100224
|
ExpressionStatement,
|
|
100225
|
-
} = types$
|
|
100225
|
+
} = types$c;
|
|
100226
100226
|
|
|
100227
100227
|
const {assign: assign$4} = Object;
|
|
100228
100228
|
|
|
@@ -100252,7 +100252,7 @@ const toBabel = estreeToBabel;
|
|
|
100252
100252
|
const customParser = customParser$1;
|
|
100253
100253
|
const moveOutDirectives = moveOutDirectives$1;
|
|
100254
100254
|
|
|
100255
|
-
var parse$
|
|
100255
|
+
var parse$2 = (source, options) => {
|
|
100256
100256
|
const {
|
|
100257
100257
|
parser,
|
|
100258
100258
|
printer = 'putout',
|
|
@@ -100297,21 +100297,21 @@ function getParser({parser = 'babel', isTS, isFlow, isJSX, printer}) {
|
|
|
100297
100297
|
};
|
|
100298
100298
|
}
|
|
100299
100299
|
|
|
100300
|
-
parse$
|
|
100300
|
+
parse$2.default;
|
|
100301
100301
|
|
|
100302
|
-
const {generate: generate$
|
|
100302
|
+
const {generate: generate$3} = bundle;
|
|
100303
100303
|
|
|
100304
|
-
var generate_1
|
|
100305
|
-
return generate$
|
|
100304
|
+
var generate_1 = (node, options, sourceMaps) => {
|
|
100305
|
+
return generate$3(node, {
|
|
100306
100306
|
comments: false,
|
|
100307
100307
|
recordAndTupleSyntaxType: 'hash',
|
|
100308
100308
|
...options,
|
|
100309
100309
|
}, sourceMaps);
|
|
100310
100310
|
};
|
|
100311
100311
|
|
|
100312
|
-
generate_1
|
|
100312
|
+
generate_1.default;
|
|
100313
100313
|
|
|
100314
|
-
var template$
|
|
100314
|
+
var template$9 = {exports: {}};
|
|
100315
100315
|
|
|
100316
100316
|
(function (module) {
|
|
100317
100317
|
|
|
@@ -100376,20 +100376,20 @@ var template$a = {exports: {}};
|
|
|
100376
100376
|
|
|
100377
100377
|
return result.expression || result;
|
|
100378
100378
|
};
|
|
100379
|
-
} (template$
|
|
100379
|
+
} (template$9));
|
|
100380
100380
|
|
|
100381
|
-
var templateExports$1 = template$
|
|
100381
|
+
var templateExports$1 = template$9.exports;
|
|
100382
100382
|
templateExports$1.default;
|
|
100383
100383
|
|
|
100384
|
-
const print$
|
|
100385
|
-
const parse$
|
|
100386
|
-
const generate$
|
|
100387
|
-
const template$
|
|
100384
|
+
const print$1 = print$2;
|
|
100385
|
+
const parse$1 = parse$2;
|
|
100386
|
+
const generate$2 = generate_1;
|
|
100387
|
+
const template$8 = templateExports$1;
|
|
100388
100388
|
|
|
100389
|
-
parser$6.print = print$
|
|
100390
|
-
parser$6.parse = parse$
|
|
100391
|
-
parser$6.generate = generate$
|
|
100392
|
-
parser$6.template = template$
|
|
100389
|
+
parser$6.print = print$1;
|
|
100390
|
+
parser$6.parse = parse$1;
|
|
100391
|
+
parser$6.generate = generate$2;
|
|
100392
|
+
parser$6.template = template$8;
|
|
100393
100393
|
|
|
100394
100394
|
var getPosition$2 = {};
|
|
100395
100395
|
|
|
@@ -100524,8 +100524,8 @@ function createListStore(returns = id) {
|
|
|
100524
100524
|
};
|
|
100525
100525
|
}
|
|
100526
100526
|
|
|
100527
|
-
const {traverse: traverse$
|
|
100528
|
-
const {generate: generate$
|
|
100527
|
+
const {traverse: traverse$8} = bundle;
|
|
100528
|
+
const {generate: generate$1} = parser$6;
|
|
100529
100529
|
|
|
100530
100530
|
const runFix$1 = runFix$2;
|
|
100531
100531
|
const {getPosition: getPosition$1} = getPosition$2;
|
|
@@ -100540,11 +100540,11 @@ const {
|
|
|
100540
100540
|
} = store;
|
|
100541
100541
|
|
|
100542
100542
|
const shouldSkip = (a) => !a.parent;
|
|
100543
|
-
const {merge: merge$2} = traverse$
|
|
100543
|
+
const {merge: merge$2} = traverse$8.visitors;
|
|
100544
100544
|
|
|
100545
100545
|
const {assign: assign$2} = Object;
|
|
100546
100546
|
|
|
100547
|
-
const parse
|
|
100547
|
+
const parse = (name, plugin, options) => {
|
|
100548
100548
|
const list = [];
|
|
100549
100549
|
|
|
100550
100550
|
if (plugin[name])
|
|
@@ -100586,7 +100586,7 @@ var mergeVisitors$1 = (pluginsToMerge, {fix, shebang, template}) => {
|
|
|
100586
100586
|
pathStore,
|
|
100587
100587
|
upstore,
|
|
100588
100588
|
uplist,
|
|
100589
|
-
generate: generate$
|
|
100589
|
+
generate: generate$1,
|
|
100590
100590
|
options,
|
|
100591
100591
|
});
|
|
100592
100592
|
|
|
@@ -100594,8 +100594,8 @@ var mergeVisitors$1 = (pluginsToMerge, {fix, shebang, template}) => {
|
|
|
100594
100594
|
throw Error(`☝️ Visitors cannot be empty in "${rule}"`);
|
|
100595
100595
|
|
|
100596
100596
|
assign$2(options, {
|
|
100597
|
-
include: parse
|
|
100598
|
-
exclude: parse
|
|
100597
|
+
include: parse('include', plugin, options),
|
|
100598
|
+
exclude: parse('exclude', plugin, options),
|
|
100599
100599
|
});
|
|
100600
100600
|
|
|
100601
100601
|
mergeItems.push(...template({
|
|
@@ -100666,9 +100666,9 @@ function getStore(plugin, {fix, rule, shebang, msg, options}) {
|
|
|
100666
100666
|
|
|
100667
100667
|
mergeVisitors$1.default;
|
|
100668
100668
|
|
|
100669
|
-
const {traverse: babelTraverse$1, types: types$
|
|
100669
|
+
const {traverse: babelTraverse$1, types: types$b} = bundle;
|
|
100670
100670
|
|
|
100671
|
-
const {generate
|
|
100671
|
+
const {generate} = parser$6;
|
|
100672
100672
|
const {merge: merge$1} = babelTraverse$1.visitors;
|
|
100673
100673
|
|
|
100674
100674
|
var superFind$1 = function superFind({rule, find, ast, options, template}) {
|
|
@@ -100679,13 +100679,13 @@ var superFind$1 = function superFind({rule, find, ast, options, template}) {
|
|
|
100679
100679
|
};
|
|
100680
100680
|
|
|
100681
100681
|
const returnItems = find(ast, {
|
|
100682
|
-
traverse: traverse$
|
|
100682
|
+
traverse: traverse$7({
|
|
100683
100683
|
rule,
|
|
100684
100684
|
options,
|
|
100685
100685
|
template,
|
|
100686
100686
|
}),
|
|
100687
|
-
generate
|
|
100688
|
-
types: types$
|
|
100687
|
+
generate,
|
|
100688
|
+
types: types$b,
|
|
100689
100689
|
push,
|
|
100690
100690
|
options,
|
|
100691
100691
|
});
|
|
@@ -100696,7 +100696,7 @@ var superFind$1 = function superFind({rule, find, ast, options, template}) {
|
|
|
100696
100696
|
];
|
|
100697
100697
|
};
|
|
100698
100698
|
|
|
100699
|
-
function traverse$
|
|
100699
|
+
function traverse$7({rule, options, template}) {
|
|
100700
100700
|
return (ast, visitor) => {
|
|
100701
100701
|
const templateVisitors = merge$1(template({
|
|
100702
100702
|
rule,
|
|
@@ -100792,7 +100792,7 @@ var jessy$1 = (selector, divider, value) => {
|
|
|
100792
100792
|
divider = '.';
|
|
100793
100793
|
}
|
|
100794
100794
|
|
|
100795
|
-
check$
|
|
100795
|
+
check$3(selector, value);
|
|
100796
100796
|
|
|
100797
100797
|
if (!selector)
|
|
100798
100798
|
return value;
|
|
@@ -100824,7 +100824,7 @@ var jessy$1 = (selector, divider, value) => {
|
|
|
100824
100824
|
return value;
|
|
100825
100825
|
};
|
|
100826
100826
|
|
|
100827
|
-
function check$
|
|
100827
|
+
function check$3(selector, obj) {
|
|
100828
100828
|
if (typeof selector !== 'string')
|
|
100829
100829
|
throw Error('selector should be string!');
|
|
100830
100830
|
|
|
@@ -100842,7 +100842,7 @@ var nessy$1 = (selector, value, divider, obj) => {
|
|
|
100842
100842
|
|
|
100843
100843
|
const result = obj;
|
|
100844
100844
|
|
|
100845
|
-
check$
|
|
100845
|
+
check$2(selector);
|
|
100846
100846
|
|
|
100847
100847
|
const arr = selector.split(divider);
|
|
100848
100848
|
|
|
@@ -100863,15 +100863,15 @@ var nessy$1 = (selector, value, divider, obj) => {
|
|
|
100863
100863
|
return result;
|
|
100864
100864
|
};
|
|
100865
100865
|
|
|
100866
|
-
function check$
|
|
100866
|
+
function check$2(selector) {
|
|
100867
100867
|
if (typeof selector !== 'string')
|
|
100868
100868
|
throw Error('selector should be string!');
|
|
100869
100869
|
}
|
|
100870
100870
|
|
|
100871
100871
|
var is$2 = {};
|
|
100872
100872
|
|
|
100873
|
-
const {template: template$
|
|
100874
|
-
const {types: types$
|
|
100873
|
+
const {template: template$7} = parser$6;
|
|
100874
|
+
const {types: types$a} = bundle;
|
|
100875
100875
|
const {
|
|
100876
100876
|
isBlockStatement: isBlockStatement$1,
|
|
100877
100877
|
isBooleanLiteral,
|
|
@@ -100886,7 +100886,7 @@ const {
|
|
|
100886
100886
|
isJSXIdentifier,
|
|
100887
100887
|
isJSXAttribute,
|
|
100888
100888
|
isTSTypeReference: isTSTypeReference$1,
|
|
100889
|
-
} = types$
|
|
100889
|
+
} = types$a;
|
|
100890
100890
|
|
|
100891
100891
|
const isStr$1 = (a) => typeof a === 'string';
|
|
100892
100892
|
|
|
@@ -100928,14 +100928,14 @@ is$2.isTemplate = (a) => /[(;={.\s]/.test(a) || !/^[A-Z]/.test(a);
|
|
|
100928
100928
|
|
|
100929
100929
|
is$2.is = (str, array = ALL) => {
|
|
100930
100930
|
for (const item of array) {
|
|
100931
|
-
if (check$
|
|
100931
|
+
if (check$1(str, item))
|
|
100932
100932
|
return true;
|
|
100933
100933
|
}
|
|
100934
100934
|
|
|
100935
100935
|
return false;
|
|
100936
100936
|
};
|
|
100937
100937
|
|
|
100938
|
-
function check$
|
|
100938
|
+
function check$1(str, item) {
|
|
100939
100939
|
if (isStr$1(item))
|
|
100940
100940
|
return str === item;
|
|
100941
100941
|
|
|
@@ -101152,8 +101152,8 @@ is$2.isLinkedNode = (a) => {
|
|
|
101152
101152
|
};
|
|
101153
101153
|
|
|
101154
101154
|
is$2.parseTemplate = (tmpl, {program} = {}) => {
|
|
101155
|
-
const parse = !program ? template$
|
|
101156
|
-
const node = parse(tmpl) || template$
|
|
101155
|
+
const parse = !program ? template$7.ast : template$7.program.ast;
|
|
101156
|
+
const node = parse(tmpl) || template$7.ast.fresh(tmpl);
|
|
101157
101157
|
|
|
101158
101158
|
if (tmpl === ANY_OBJECT)
|
|
101159
101159
|
return [node, __OBJECT_TYPE];
|
|
@@ -101170,8 +101170,8 @@ is$2.isInsideTypeReference = (path) => path.isIdentifier() && path.parentPath?.i
|
|
|
101170
101170
|
|
|
101171
101171
|
const jessy = jessy$1;
|
|
101172
101172
|
const nessy = nessy$1;
|
|
101173
|
-
const {traverse: traverse$
|
|
101174
|
-
const {template: template$
|
|
101173
|
+
const {traverse: traverse$6, types: types$9} = bundle;
|
|
101174
|
+
const {template: template$6} = parser$6;
|
|
101175
101175
|
|
|
101176
101176
|
const {replaceWith: replaceWith$1, extract} = operate;
|
|
101177
101177
|
|
|
@@ -101191,11 +101191,11 @@ const {
|
|
|
101191
101191
|
isLiteral: isLiteral$1,
|
|
101192
101192
|
isTemplateLiteral,
|
|
101193
101193
|
TemplateElement,
|
|
101194
|
-
} = types$
|
|
101194
|
+
} = types$9;
|
|
101195
101195
|
|
|
101196
101196
|
const {entries: entries$5} = Object;
|
|
101197
101197
|
const isNumber = (a) => typeof a === 'number';
|
|
101198
|
-
const isString$
|
|
101198
|
+
const isString$3 = (a) => typeof a === 'string';
|
|
101199
101199
|
const parseExpression = (a) => a?.expression || a;
|
|
101200
101200
|
|
|
101201
101201
|
const parseNode$1 = (a) => a.node || a;
|
|
@@ -101203,12 +101203,12 @@ const parseNode$1 = (a) => a.node || a;
|
|
|
101203
101203
|
const {stringify: stringify$3} = JSON;
|
|
101204
101204
|
|
|
101205
101205
|
vars.getTemplateValues = (node, str) => {
|
|
101206
|
-
if (!isString$
|
|
101206
|
+
if (!isString$3(str))
|
|
101207
101207
|
throw Error(`☝️ Looks like argument 'template' of 'getTemplateValues(node, template)': is not a string, but '${stringify$3(str)}'`);
|
|
101208
101208
|
|
|
101209
101209
|
node = parseNode$1(node);
|
|
101210
101210
|
|
|
101211
|
-
const templateNode = template$
|
|
101211
|
+
const templateNode = template$6.ast(str);
|
|
101212
101212
|
const waysFrom = findVarsWays$2(templateNode);
|
|
101213
101213
|
|
|
101214
101214
|
return getValues$2({
|
|
@@ -101227,7 +101227,7 @@ function findVarsWays$2(node) {
|
|
|
101227
101227
|
|
|
101228
101228
|
const vars = {};
|
|
101229
101229
|
|
|
101230
|
-
traverse$
|
|
101230
|
+
traverse$6(node, {
|
|
101231
101231
|
noScope: true,
|
|
101232
101232
|
'Identifier|BooleanLiteral|StringLiteral|TemplateElement|RegExpLiteral|JSXText|JSXAttribute|TSTypeReference'(path) {
|
|
101233
101233
|
if (isInsideTypeReference(path))
|
|
@@ -101370,14 +101370,14 @@ function parseValue(a) {
|
|
|
101370
101370
|
|
|
101371
101371
|
var logExports = log$3.exports;
|
|
101372
101372
|
|
|
101373
|
-
const {types: types$
|
|
101373
|
+
const {types: types$8} = bundle;
|
|
101374
101374
|
const {
|
|
101375
101375
|
isIdentifier: isIdentifier$1,
|
|
101376
101376
|
isLiteral,
|
|
101377
101377
|
isStringLiteral: isStringLiteral$1,
|
|
101378
101378
|
isTemplateElement: isTemplateElement$1,
|
|
101379
101379
|
isTSTypeReference,
|
|
101380
|
-
} = types$
|
|
101380
|
+
} = types$8;
|
|
101381
101381
|
|
|
101382
101382
|
const parseName = (node) => {
|
|
101383
101383
|
node = node[0] || node;
|
|
@@ -101441,13 +101441,13 @@ const {
|
|
|
101441
101441
|
isLinkedRegExp: isLinkedRegExp$1,
|
|
101442
101442
|
} = is$2;
|
|
101443
101443
|
|
|
101444
|
-
const {types: types$
|
|
101444
|
+
const {types: types$7} = bundle;
|
|
101445
101445
|
const {
|
|
101446
101446
|
isClassBody,
|
|
101447
101447
|
isBlock,
|
|
101448
101448
|
isJSXText,
|
|
101449
101449
|
isTemplateElement,
|
|
101450
|
-
} = types$
|
|
101450
|
+
} = types$7;
|
|
101451
101451
|
|
|
101452
101452
|
const isEmptyBlock = (a) => isBlock(a) && !a.body.length;
|
|
101453
101453
|
const isPrimitive = (a) => typeof a !== 'object' || a === null;
|
|
@@ -101554,7 +101554,7 @@ function compareJSXTexts(node, template) {
|
|
|
101554
101554
|
|
|
101555
101555
|
var topLevelComparators = {};
|
|
101556
101556
|
|
|
101557
|
-
const {types: types$
|
|
101557
|
+
const {types: types$6} = bundle;
|
|
101558
101558
|
const {
|
|
101559
101559
|
isEqualBody,
|
|
101560
101560
|
isEqualAnyObject,
|
|
@@ -101568,7 +101568,7 @@ const {
|
|
|
101568
101568
|
const {
|
|
101569
101569
|
isIdentifier,
|
|
101570
101570
|
isStringLiteral,
|
|
101571
|
-
} = types$
|
|
101571
|
+
} = types$6;
|
|
101572
101572
|
|
|
101573
101573
|
const comparators = [
|
|
101574
101574
|
isEqualAnyObject,
|
|
@@ -101603,8 +101603,8 @@ function isLinkedAndStringLiteral(node, templateNode) {
|
|
|
101603
101603
|
return isStringLiteral(node) && isLinkedNode(templateNode);
|
|
101604
101604
|
}
|
|
101605
101605
|
|
|
101606
|
-
const {template: template$
|
|
101607
|
-
const {types: types$
|
|
101606
|
+
const {template: template$5} = parser$6;
|
|
101607
|
+
const {types: types$5} = bundle;
|
|
101608
101608
|
|
|
101609
101609
|
const {
|
|
101610
101610
|
findVarsWays: findVarsWays$1,
|
|
@@ -101624,7 +101624,7 @@ const {
|
|
|
101624
101624
|
parseTemplate: parseTemplate$2,
|
|
101625
101625
|
} = is$2;
|
|
101626
101626
|
|
|
101627
|
-
const {isExpressionStatement: isExpressionStatement$1} = types$
|
|
101627
|
+
const {isExpressionStatement: isExpressionStatement$1} = types$5;
|
|
101628
101628
|
|
|
101629
101629
|
const {keys: keys$2} = Object;
|
|
101630
101630
|
const {isArray: isArray$1} = Array;
|
|
@@ -101647,7 +101647,7 @@ const findParent = (path, type) => {
|
|
|
101647
101647
|
|
|
101648
101648
|
function parseNode(a) {
|
|
101649
101649
|
if (isStr(a))
|
|
101650
|
-
return template$
|
|
101650
|
+
return template$5.ast(a);
|
|
101651
101651
|
|
|
101652
101652
|
if (!a.node)
|
|
101653
101653
|
return a;
|
|
@@ -101777,7 +101777,7 @@ var watermark$1 = {exports: {}};
|
|
|
101777
101777
|
const wrap = (fn) => (...a) => (...b) => fn(...a, ...b);
|
|
101778
101778
|
|
|
101779
101779
|
var wraptile$1 = (fn, ...a) => {
|
|
101780
|
-
check
|
|
101780
|
+
check(fn);
|
|
101781
101781
|
|
|
101782
101782
|
if (a.length)
|
|
101783
101783
|
return wrap(fn)(...a);
|
|
@@ -101785,7 +101785,7 @@ var wraptile$1 = (fn, ...a) => {
|
|
|
101785
101785
|
return wrap(fn);
|
|
101786
101786
|
};
|
|
101787
101787
|
|
|
101788
|
-
function check
|
|
101788
|
+
function check(fn) {
|
|
101789
101789
|
if (typeof fn !== 'function')
|
|
101790
101790
|
throw Error('fn should be a function!');
|
|
101791
101791
|
}
|
|
@@ -101826,8 +101826,8 @@ function findKey(path, parent) {
|
|
|
101826
101826
|
|
|
101827
101827
|
const wraptile = wraptile$1;
|
|
101828
101828
|
const findPath = findPath$1;
|
|
101829
|
-
const {types: types$
|
|
101830
|
-
const {isProgram: isProgram$1} = types$
|
|
101829
|
+
const {types: types$4} = bundle;
|
|
101830
|
+
const {isProgram: isProgram$1} = types$4;
|
|
101831
101831
|
const name = '__putout_runner_replace';
|
|
101832
101832
|
const hasWatermark = (watermark) => (path) => path.node?.[name]?.has(watermark);
|
|
101833
101833
|
|
|
@@ -101893,9 +101893,9 @@ function has({path, program, watermark, highWatermark}) {
|
|
|
101893
101893
|
|
|
101894
101894
|
var watermarkExports = watermark$1.exports;
|
|
101895
101895
|
|
|
101896
|
-
const {template: template$
|
|
101896
|
+
const {template: template$4, print} = parser$6;
|
|
101897
101897
|
const {remove, replaceWith} = operate;
|
|
101898
|
-
const {types: types$
|
|
101898
|
+
const {types: types$3} = bundle;
|
|
101899
101899
|
|
|
101900
101900
|
const {
|
|
101901
101901
|
compare: compare$2,
|
|
@@ -101912,7 +101912,7 @@ const {
|
|
|
101912
101912
|
isExpression,
|
|
101913
101913
|
isStatement,
|
|
101914
101914
|
isExpressionStatement,
|
|
101915
|
-
} = types$
|
|
101915
|
+
} = types$3;
|
|
101916
101916
|
|
|
101917
101917
|
const PRINT_OPTIONS = {
|
|
101918
101918
|
printer: ['putout', {
|
|
@@ -101924,7 +101924,7 @@ const PRINT_OPTIONS = {
|
|
|
101924
101924
|
}],
|
|
101925
101925
|
};
|
|
101926
101926
|
|
|
101927
|
-
const isString$
|
|
101927
|
+
const isString$2 = (a) => typeof a === 'string';
|
|
101928
101928
|
|
|
101929
101929
|
const log$1 = (from, path) => {
|
|
101930
101930
|
debug$2.enabled && debug$2(`${from} -> ${path}\n`);
|
|
@@ -101980,7 +101980,7 @@ replace$1.exports.clearWatermark = (ast) => {
|
|
|
101980
101980
|
const isFn$2 = (a) => typeof a === 'function';
|
|
101981
101981
|
|
|
101982
101982
|
const fix$2 = (from, to, path) => {
|
|
101983
|
-
const nodeFrom = template$
|
|
101983
|
+
const nodeFrom = template$4.ast(from);
|
|
101984
101984
|
const mark = watermark(from, to, path);
|
|
101985
101985
|
|
|
101986
101986
|
mark.init();
|
|
@@ -102039,7 +102039,7 @@ const getFilter = (match = stubMatch, options) => (path) => {
|
|
|
102039
102039
|
}));
|
|
102040
102040
|
|
|
102041
102041
|
for (const [from, matchProperty] of all) {
|
|
102042
|
-
const nodeFrom = template$
|
|
102042
|
+
const nodeFrom = template$4.ast(from);
|
|
102043
102043
|
|
|
102044
102044
|
if (!compare$2(path.node, nodeFrom)) {
|
|
102045
102045
|
continue;
|
|
@@ -102070,10 +102070,10 @@ function parseTo(to, values, path) {
|
|
|
102070
102070
|
if (isObj(toStr) && toStr.type)
|
|
102071
102071
|
return toStr;
|
|
102072
102072
|
|
|
102073
|
-
if (!isString$
|
|
102073
|
+
if (!isString$2(toStr))
|
|
102074
102074
|
throw Error(`☝️ Looks like you passed 'replace' value with a wrong type. Allowed: 'string', 'node' and 'path'. Received: '${typeof toStr}' with value '${toStr}'.`);
|
|
102075
102075
|
|
|
102076
|
-
return template$
|
|
102076
|
+
return template$4.ast.fresh(toStr);
|
|
102077
102077
|
}
|
|
102078
102078
|
|
|
102079
102079
|
function validateMatchProperty(match) {
|
|
@@ -102098,7 +102098,7 @@ function checkExpressionStatement(nodeFrom, nodeTo, path) {
|
|
|
102098
102098
|
if (isExpressionStatement(path) || isExpressionStatement(path.parentPath))
|
|
102099
102099
|
return;
|
|
102100
102100
|
|
|
102101
|
-
throw Error(`☝️ Looks like a try to put Statement in place of Expression, use 'match' to filter out such cases: '${print
|
|
102101
|
+
throw Error(`☝️ Looks like a try to put Statement in place of Expression, use 'match' to filter out such cases: '${print(nodeFrom, PRINT_OPTIONS)} -> ${print(nodeTo, PRINT_OPTIONS)}'. For code: '${path}'`);
|
|
102102
102102
|
}
|
|
102103
102103
|
|
|
102104
102104
|
var replaceExports = replace$1.exports;
|
|
@@ -102142,7 +102142,7 @@ record.getModuleType = (path) => {
|
|
|
102142
102142
|
return programPath[prefix].__putout_module_type;
|
|
102143
102143
|
};
|
|
102144
102144
|
|
|
102145
|
-
const {template: template$
|
|
102145
|
+
const {template: template$3} = parser$6;
|
|
102146
102146
|
const {isESM, insertAfter} = operate;
|
|
102147
102147
|
const {compare: compare$1} = compare$4;
|
|
102148
102148
|
|
|
@@ -102153,14 +102153,14 @@ const {
|
|
|
102153
102153
|
setModuleType,
|
|
102154
102154
|
} = record;
|
|
102155
102155
|
|
|
102156
|
-
const {types: types$
|
|
102156
|
+
const {types: types$2} = bundle;
|
|
102157
102157
|
const {
|
|
102158
102158
|
isImportDeclaration,
|
|
102159
102159
|
isVariableDeclaration,
|
|
102160
|
-
} = types$
|
|
102160
|
+
} = types$2;
|
|
102161
102161
|
|
|
102162
102162
|
const {keys} = Object;
|
|
102163
|
-
const isString$
|
|
102163
|
+
const isString$1 = (a) => typeof a === 'string';
|
|
102164
102164
|
|
|
102165
102165
|
const getLastVarPath = (bodyPath) => bodyPath.filter(isVariableDeclaration).pop();
|
|
102166
102166
|
const isLast = (insertionPath, bodyPath) => bodyPath.at(-1) === insertionPath;
|
|
@@ -102241,7 +102241,7 @@ const fix$1 = (declarations) => (path, {options}) => {
|
|
|
102241
102241
|
const scope = path.scope.getProgramParent();
|
|
102242
102242
|
const programPath = scope.path;
|
|
102243
102243
|
const bodyPath = programPath.get('body');
|
|
102244
|
-
const node = template$
|
|
102244
|
+
const node = template$3.ast.fresh(code);
|
|
102245
102245
|
|
|
102246
102246
|
insert(node, bodyPath);
|
|
102247
102247
|
addDeclarationForESLint(name, path);
|
|
@@ -102259,7 +102259,7 @@ function isUseStrict(path) {
|
|
|
102259
102259
|
}
|
|
102260
102260
|
|
|
102261
102261
|
const parseCode = (type, current) => {
|
|
102262
|
-
if (isString$
|
|
102262
|
+
if (isString$1(current))
|
|
102263
102263
|
return current;
|
|
102264
102264
|
|
|
102265
102265
|
return current[type];
|
|
@@ -102345,7 +102345,7 @@ function validateDeclare(declare) {
|
|
|
102345
102345
|
throw Error(`☝️ Looks like 'declare' property value is not a 'function', but '${typeof declare}' with value '${stringify$1(declare)}'.`);
|
|
102346
102346
|
}
|
|
102347
102347
|
|
|
102348
|
-
var template$
|
|
102348
|
+
var template$2 = {exports: {}};
|
|
102349
102349
|
|
|
102350
102350
|
const tryCatch = tryCatch$4;
|
|
102351
102351
|
|
|
@@ -102368,7 +102368,7 @@ const log = (rule, path) => {
|
|
|
102368
102368
|
|
|
102369
102369
|
const {stringify} = JSON;
|
|
102370
102370
|
|
|
102371
|
-
template$
|
|
102371
|
+
template$2.exports._log = log;
|
|
102372
102372
|
|
|
102373
102373
|
const exclude = ({rule, tmpl, fn, nodesExclude}) => {
|
|
102374
102374
|
if (!isFn(fn) || !nodesExclude.length)
|
|
@@ -102388,7 +102388,7 @@ const exclude = ({rule, tmpl, fn, nodesExclude}) => {
|
|
|
102388
102388
|
};
|
|
102389
102389
|
};
|
|
102390
102390
|
|
|
102391
|
-
template$
|
|
102391
|
+
template$2.exports = ({rule, visitor, options}) => {
|
|
102392
102392
|
const parsed = [];
|
|
102393
102393
|
const nodesExclude = maybeArray(options.exclude);
|
|
102394
102394
|
const nodesInclude = maybeArray(options.include);
|
|
@@ -102427,7 +102427,7 @@ template$3.exports = ({rule, visitor, options}) => {
|
|
|
102427
102427
|
return parsed;
|
|
102428
102428
|
};
|
|
102429
102429
|
|
|
102430
|
-
template$
|
|
102430
|
+
template$2.exports._log = log;
|
|
102431
102431
|
|
|
102432
102432
|
function wrapWithCheck({rule, nodesInclude, nodesExclude, fn}) {
|
|
102433
102433
|
return (path) => {
|
|
@@ -102451,9 +102451,9 @@ function wrapWithCheck({rule, nodesInclude, nodesExclude, fn}) {
|
|
|
102451
102451
|
};
|
|
102452
102452
|
}
|
|
102453
102453
|
|
|
102454
|
-
var templateExports = template$
|
|
102454
|
+
var templateExports = template$2.exports;
|
|
102455
102455
|
|
|
102456
|
-
const {traverse: traverse$
|
|
102456
|
+
const {traverse: traverse$5} = bundle;
|
|
102457
102457
|
const once = onceExports;
|
|
102458
102458
|
const debug = browserExports('putout:runner:find');
|
|
102459
102459
|
|
|
@@ -102463,7 +102463,7 @@ const superFind = superFind$1;
|
|
|
102463
102463
|
const include = include$2;
|
|
102464
102464
|
const replace = replaceExports;
|
|
102465
102465
|
const declare = declare_1;
|
|
102466
|
-
const template$
|
|
102466
|
+
const template$1 = templateExports;
|
|
102467
102467
|
|
|
102468
102468
|
const {getPath, getPosition} = getPosition$2;
|
|
102469
102469
|
|
|
@@ -102487,7 +102487,7 @@ lib.runPlugins = ({ast, shebang, fix, fixCount, plugins}) => {
|
|
|
102487
102487
|
pluginsFind,
|
|
102488
102488
|
pluginsTraverse,
|
|
102489
102489
|
merge,
|
|
102490
|
-
template: template$
|
|
102490
|
+
template: template$1,
|
|
102491
102491
|
});
|
|
102492
102492
|
|
|
102493
102493
|
if (!fix || !places.length)
|
|
@@ -102528,7 +102528,7 @@ function runWithMerge({ast, fix, shebang, template, pluginsTraverse, merge}) {
|
|
|
102528
102528
|
template,
|
|
102529
102529
|
});
|
|
102530
102530
|
|
|
102531
|
-
traverse$
|
|
102531
|
+
traverse$5(ast, visitor);
|
|
102532
102532
|
|
|
102533
102533
|
const places = [];
|
|
102534
102534
|
|
|
@@ -102696,9 +102696,9 @@ var report$1 = () => {
|
|
|
102696
102696
|
|
|
102697
102697
|
report$1.default;
|
|
102698
102698
|
|
|
102699
|
-
var traverse$
|
|
102699
|
+
var traverse$4 = {};
|
|
102700
102700
|
|
|
102701
|
-
const {types: types$
|
|
102701
|
+
const {types: types$1, traverse: babelTraverse} = bundle;
|
|
102702
102702
|
|
|
102703
102703
|
const {
|
|
102704
102704
|
compare,
|
|
@@ -102707,11 +102707,11 @@ const {
|
|
|
102707
102707
|
getTemplateValues,
|
|
102708
102708
|
} = compare$4;
|
|
102709
102709
|
|
|
102710
|
-
const {isFile, isProgram} = types$
|
|
102710
|
+
const {isFile, isProgram} = types$1;
|
|
102711
102711
|
const {merge} = babelTraverse.visitors;
|
|
102712
102712
|
const {entries: entries$1} = Object;
|
|
102713
102713
|
|
|
102714
|
-
traverse$
|
|
102714
|
+
traverse$4.traverse = traverse$3;
|
|
102715
102715
|
|
|
102716
102716
|
const isPath = (path) => Boolean(path.node);
|
|
102717
102717
|
const createTraverse = (path) => {
|
|
@@ -102731,7 +102731,7 @@ const createTraverse = (path) => {
|
|
|
102731
102731
|
|
|
102732
102732
|
const getTemplate = ([a]) => a;
|
|
102733
102733
|
|
|
102734
|
-
function traverse$
|
|
102734
|
+
function traverse$3(basePath, visitor) {
|
|
102735
102735
|
const traverse = createTraverse(basePath);
|
|
102736
102736
|
const items = [];
|
|
102737
102737
|
const parsedVisitors = entries$1(visitor);
|
|
@@ -102774,7 +102774,7 @@ const getVisit = ({fn, node, tmpl}) => (path) => {
|
|
|
102774
102774
|
fn(path, getTemplateValues(path.node, tmpl));
|
|
102775
102775
|
};
|
|
102776
102776
|
|
|
102777
|
-
traverse$
|
|
102777
|
+
traverse$4.contains = (path, items) => {
|
|
102778
102778
|
let found = false;
|
|
102779
102779
|
|
|
102780
102780
|
const visit = (path) => {
|
|
@@ -102788,7 +102788,7 @@ traverse$5.contains = (path, items) => {
|
|
|
102788
102788
|
visitors[item] = visit;
|
|
102789
102789
|
}
|
|
102790
102790
|
|
|
102791
|
-
traverse$
|
|
102791
|
+
traverse$3(path, visitors);
|
|
102792
102792
|
|
|
102793
102793
|
return found;
|
|
102794
102794
|
};
|
|
@@ -105472,7 +105472,7 @@ function astTraverse(root) {
|
|
|
105472
105472
|
visit(root, null);
|
|
105473
105473
|
}
|
|
105474
105474
|
|
|
105475
|
-
var traverse$
|
|
105475
|
+
var traverse$2 = {
|
|
105476
105476
|
/**
|
|
105477
105477
|
* Traverses an AST.
|
|
105478
105478
|
*
|
|
@@ -105696,7 +105696,7 @@ function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Co
|
|
|
105696
105696
|
|
|
105697
105697
|
var generator$2 = generator_1;
|
|
105698
105698
|
var parser$3 = parser$4;
|
|
105699
|
-
var traverse$
|
|
105699
|
+
var traverse$1 = traverse$2;
|
|
105700
105700
|
|
|
105701
105701
|
/**
|
|
105702
105702
|
* Transform result.
|
|
@@ -105770,7 +105770,7 @@ var TransformResult = function () {
|
|
|
105770
105770
|
return TransformResult;
|
|
105771
105771
|
}();
|
|
105772
105772
|
|
|
105773
|
-
var transform$
|
|
105773
|
+
var transform$1 = {
|
|
105774
105774
|
/**
|
|
105775
105775
|
* Expose `TransformResult`.
|
|
105776
105776
|
*/
|
|
@@ -105816,7 +105816,7 @@ var transform$2 = {
|
|
|
105816
105816
|
});
|
|
105817
105817
|
}
|
|
105818
105818
|
|
|
105819
|
-
traverse$
|
|
105819
|
+
traverse$1.traverse(ast, handlers);
|
|
105820
105820
|
|
|
105821
105821
|
return new TransformResult(ast);
|
|
105822
105822
|
}
|
|
@@ -105828,7 +105828,7 @@ var transform$2 = {
|
|
|
105828
105828
|
*/
|
|
105829
105829
|
|
|
105830
105830
|
var compatTransforms = transforms$1;
|
|
105831
|
-
var _transform$1 = transform$
|
|
105831
|
+
var _transform$1 = transform$1;
|
|
105832
105832
|
|
|
105833
105833
|
var compatTranspiler$1 = {
|
|
105834
105834
|
/**
|
|
@@ -107744,7 +107744,7 @@ transforms.default;
|
|
|
107744
107744
|
|
|
107745
107745
|
var clone = clone$1;
|
|
107746
107746
|
var parser$2 = parser$4;
|
|
107747
|
-
var transform
|
|
107747
|
+
var transform = transform$1;
|
|
107748
107748
|
var optimizationTransforms = transforms;
|
|
107749
107749
|
|
|
107750
107750
|
var optimizer$1 = {
|
|
@@ -107786,7 +107786,7 @@ var optimizer$1 = {
|
|
|
107786
107786
|
ast = parser$2.parse(regexp);
|
|
107787
107787
|
}
|
|
107788
107788
|
|
|
107789
|
-
var result = new transform
|
|
107789
|
+
var result = new transform.TransformResult(ast);
|
|
107790
107790
|
var prevResultString = void 0;
|
|
107791
107791
|
|
|
107792
107792
|
do {
|
|
@@ -107805,7 +107805,7 @@ var optimizer$1 = {
|
|
|
107805
107805
|
|
|
107806
107806
|
// Don't override result just yet since we
|
|
107807
107807
|
// might want to rollback the transform
|
|
107808
|
-
var newResult = transform
|
|
107808
|
+
var newResult = transform.transform(ast, transformer);
|
|
107809
107809
|
|
|
107810
107810
|
if (newResult.toString() !== result.toString()) {
|
|
107811
107811
|
if (newResult.toString().length <= result.toString().length) {
|
|
@@ -109686,8 +109686,8 @@ var compatTranspiler = compatTranspiler$1;
|
|
|
109686
109686
|
var generator = generator_1;
|
|
109687
109687
|
var optimizer = optimizer$1;
|
|
109688
109688
|
var parser = parser$4;
|
|
109689
|
-
var _transform = transform$
|
|
109690
|
-
var _traverse = traverse$
|
|
109689
|
+
var _transform = transform$1;
|
|
109690
|
+
var _traverse = traverse$2;
|
|
109691
109691
|
var fa = finiteAutomaton;
|
|
109692
109692
|
|
|
109693
109693
|
var _require = runtime,
|
|
@@ -109896,8 +109896,8 @@ var regexp = {
|
|
|
109896
109896
|
var addArgs = {};
|
|
109897
109897
|
|
|
109898
109898
|
const {compareAny} = compare$4;
|
|
109899
|
-
const {template
|
|
109900
|
-
const {types
|
|
109899
|
+
const {template} = parser$6;
|
|
109900
|
+
const {types} = bundle;
|
|
109901
109901
|
const {
|
|
109902
109902
|
ObjectPattern,
|
|
109903
109903
|
ObjectProperty,
|
|
@@ -109906,7 +109906,7 @@ const {
|
|
|
109906
109906
|
isLabeledStatement,
|
|
109907
109907
|
isObjectPattern,
|
|
109908
109908
|
isCallExpression,
|
|
109909
|
-
} = types
|
|
109909
|
+
} = types;
|
|
109910
109910
|
|
|
109911
109911
|
const {entries} = Object;
|
|
109912
109912
|
|
|
@@ -109924,11 +109924,11 @@ const report = ({name}) => `Argument '${name}' is missing`;
|
|
|
109924
109924
|
addArgs.addArgs = (args) => ({
|
|
109925
109925
|
report,
|
|
109926
109926
|
fix,
|
|
109927
|
-
traverse: traverse
|
|
109927
|
+
traverse: traverse(args),
|
|
109928
109928
|
});
|
|
109929
109929
|
|
|
109930
109930
|
const fix = ({declaration, path, pattern, params, index}) => {
|
|
109931
|
-
const declarationNode = template
|
|
109931
|
+
const declarationNode = template.ast.fresh(declaration);
|
|
109932
109932
|
|
|
109933
109933
|
if (isBlockStatement(declarationNode)) {
|
|
109934
109934
|
const prop = createProperty(declarationNode.body[0]);
|
|
@@ -109945,7 +109945,7 @@ const fix = ({declaration, path, pattern, params, index}) => {
|
|
|
109945
109945
|
];
|
|
109946
109946
|
};
|
|
109947
109947
|
|
|
109948
|
-
const traverse
|
|
109948
|
+
const traverse = (args) => ({push, options}) => {
|
|
109949
109949
|
const allArgs = {
|
|
109950
109950
|
...options.args,
|
|
109951
109951
|
...args,
|
|
@@ -110037,61 +110037,168 @@ const noop = () => {};
|
|
|
110037
110037
|
|
|
110038
110038
|
const defaultFS = {
|
|
110039
110039
|
renameFile: noop,
|
|
110040
|
+
removeFile: noop,
|
|
110041
|
+
createDirectory: noop,
|
|
110040
110042
|
};
|
|
110041
110043
|
|
|
110042
|
-
const maybeFS
|
|
110044
|
+
const maybeFS = assign$1({}, defaultFS);
|
|
110043
110045
|
|
|
110044
110046
|
maybeFs.renameFile = (oldName, newName) => {
|
|
110045
|
-
maybeFS
|
|
110047
|
+
maybeFS.renameFile(oldName, newName);
|
|
110048
|
+
};
|
|
110049
|
+
|
|
110050
|
+
maybeFs.removeFile = (name) => {
|
|
110051
|
+
maybeFS.removeFile(name);
|
|
110052
|
+
};
|
|
110053
|
+
|
|
110054
|
+
maybeFs.createDirectory = (name) => {
|
|
110055
|
+
maybeFS.createDirectory(name);
|
|
110046
110056
|
};
|
|
110047
110057
|
|
|
110048
110058
|
maybeFs.init = (fsDriver) => {
|
|
110049
|
-
assign$1(maybeFS
|
|
110059
|
+
assign$1(maybeFS, fsDriver);
|
|
110050
110060
|
};
|
|
110051
110061
|
|
|
110052
110062
|
maybeFs.deinit = () => {
|
|
110053
|
-
assign$1(maybeFS
|
|
110063
|
+
assign$1(maybeFS, defaultFS);
|
|
110054
110064
|
};
|
|
110055
110065
|
|
|
110056
|
-
|
|
110057
|
-
setLiteralValue,
|
|
110058
|
-
getProperty,
|
|
110059
|
-
traverseProperties,
|
|
110060
|
-
} = operate;
|
|
110066
|
+
var hasRequiredFilesystem;
|
|
110061
110067
|
|
|
110062
|
-
|
|
110068
|
+
function requireFilesystem () {
|
|
110069
|
+
if (hasRequiredFilesystem) return filesystem;
|
|
110070
|
+
hasRequiredFilesystem = 1;
|
|
110063
110071
|
|
|
110064
|
-
|
|
110065
|
-
|
|
110066
|
-
|
|
110067
|
-
|
|
110068
|
-
|
|
110069
|
-
|
|
110070
|
-
if (value === name || value.endsWith(`/${name}`)) {
|
|
110071
|
-
filePaths.push(filenamePath.parentPath);
|
|
110072
|
-
}
|
|
110073
|
-
}
|
|
110074
|
-
|
|
110075
|
-
return filePaths;
|
|
110076
|
-
};
|
|
110072
|
+
const {types} = requirePutout();
|
|
110073
|
+
const {
|
|
110074
|
+
setLiteralValue,
|
|
110075
|
+
getProperty,
|
|
110076
|
+
traverseProperties,
|
|
110077
|
+
} = operate;
|
|
110077
110078
|
|
|
110078
|
-
|
|
110079
|
-
|
|
110080
|
-
|
|
110081
|
-
|
|
110082
|
-
|
|
110083
|
-
|
|
110084
|
-
|
|
110085
|
-
|
|
110086
|
-
|
|
110087
|
-
|
|
110088
|
-
|
|
110089
|
-
|
|
110090
|
-
|
|
110091
|
-
|
|
110079
|
+
const maybeFS = maybeFs;
|
|
110080
|
+
|
|
110081
|
+
const {
|
|
110082
|
+
ObjectExpression,
|
|
110083
|
+
ArrayExpression,
|
|
110084
|
+
StringLiteral,
|
|
110085
|
+
ObjectProperty,
|
|
110086
|
+
isProgram,
|
|
110087
|
+
} = types;
|
|
110088
|
+
|
|
110089
|
+
const getRegExp = (wildcard) => {
|
|
110090
|
+
const escaped = wildcard
|
|
110091
|
+
.replace(/\./g, '\\.')
|
|
110092
|
+
.replace(/\*/g, '.*')
|
|
110093
|
+
.replace('?', '.?');
|
|
110094
|
+
|
|
110095
|
+
return RegExp(`${escaped}$`);
|
|
110096
|
+
};
|
|
110097
|
+
|
|
110098
|
+
filesystem.getParentDirectory = (filePath) => {
|
|
110099
|
+
const {parentPath} = filePath.parentPath.parentPath;
|
|
110100
|
+
|
|
110101
|
+
if (isProgram(parentPath))
|
|
110102
|
+
return null;
|
|
110103
|
+
|
|
110104
|
+
return parentPath;
|
|
110105
|
+
};
|
|
110106
|
+
|
|
110107
|
+
filesystem.findFile = (node, name) => {
|
|
110108
|
+
const filePaths = [];
|
|
110109
|
+
|
|
110110
|
+
for (const filenamePath of traverseProperties(node, 'filename')) {
|
|
110111
|
+
const {value} = filenamePath.node.value;
|
|
110112
|
+
|
|
110113
|
+
if (value === name || getRegExp(name).test(value)) {
|
|
110114
|
+
filePaths.push(filenamePath.parentPath);
|
|
110115
|
+
}
|
|
110116
|
+
}
|
|
110117
|
+
|
|
110118
|
+
return filePaths;
|
|
110119
|
+
};
|
|
110120
|
+
|
|
110121
|
+
function getFilenamePath(filePath) {
|
|
110122
|
+
const filenamePath = getProperty(filePath, 'filename');
|
|
110123
|
+
return filenamePath.get('value');
|
|
110124
|
+
}
|
|
110125
|
+
|
|
110126
|
+
function getFilename(filePath) {
|
|
110127
|
+
const {value} = getFilenamePath(filePath).node;
|
|
110128
|
+
return value;
|
|
110129
|
+
}
|
|
110130
|
+
|
|
110131
|
+
filesystem.getFilename = getFilename;
|
|
110132
|
+
|
|
110133
|
+
filesystem.renameFile = (filePath, name) => {
|
|
110134
|
+
const oldName = getFilename(filePath);
|
|
110135
|
+
const valuePath = getFilenamePath(filePath);
|
|
110136
|
+
const baseName = oldName
|
|
110137
|
+
.split('/')
|
|
110138
|
+
.pop();
|
|
110139
|
+
|
|
110140
|
+
const newName = oldName.replace(baseName, name);
|
|
110141
|
+
|
|
110142
|
+
setLiteralValue(valuePath, newName);
|
|
110143
|
+
maybeFS.renameFile(oldName, newName);
|
|
110144
|
+
};
|
|
110145
|
+
|
|
110146
|
+
filesystem.removeFile = (filePath) => {
|
|
110147
|
+
const filename = getFilename(filePath);
|
|
110148
|
+
|
|
110149
|
+
filePath.remove();
|
|
110150
|
+
maybeFS.removeFile(filename);
|
|
110151
|
+
};
|
|
110152
|
+
|
|
110153
|
+
filesystem.moveFile = (filePath, dirPath) => {
|
|
110154
|
+
const dirname = getFilename(dirPath);
|
|
110155
|
+
const filename = getFilename(filePath);
|
|
110156
|
+
const dirPathFiles = getProperty(dirPath, 'files');
|
|
110157
|
+
const filenamePath = getProperty(filePath, 'filename');
|
|
110158
|
+
|
|
110159
|
+
const basename = filename
|
|
110160
|
+
.split('/')
|
|
110161
|
+
.pop();
|
|
110162
|
+
|
|
110163
|
+
const newname = `${dirname}/${basename}`;
|
|
110164
|
+
|
|
110165
|
+
setLiteralValue(filenamePath.get('value'), newname);
|
|
110166
|
+
dirPathFiles.node.value.elements.push(filePath.node);
|
|
110167
|
+
filePath.remove();
|
|
110168
|
+
|
|
110169
|
+
maybeFS.renameFile(filename, newname);
|
|
110170
|
+
};
|
|
110092
110171
|
|
|
110093
|
-
|
|
110094
|
-
|
|
110172
|
+
const createType = (type) => ObjectProperty(StringLiteral('type'), StringLiteral(type));
|
|
110173
|
+
const createFiles = (files) => ObjectProperty(StringLiteral('files'), ArrayExpression(files));
|
|
110174
|
+
const createFilename = (filename) => ObjectProperty(StringLiteral('filename'), StringLiteral(filename));
|
|
110175
|
+
|
|
110176
|
+
filesystem.createDirectory = (dirPath, name) => {
|
|
110177
|
+
const dirPathFiles = getProperty(dirPath, 'files');
|
|
110178
|
+
const parentFilename = getFilename(dirPath);
|
|
110179
|
+
const filename = `${parentFilename}/${name}`;
|
|
110180
|
+
|
|
110181
|
+
const typeProperty = createType('directory');
|
|
110182
|
+
const filesProperty = createFiles([]);
|
|
110183
|
+
const filenameProperty = createFilename(filename);
|
|
110184
|
+
|
|
110185
|
+
dirPathFiles.node.value.elements.push(ObjectExpression([
|
|
110186
|
+
typeProperty,
|
|
110187
|
+
filenameProperty,
|
|
110188
|
+
filesProperty,
|
|
110189
|
+
]));
|
|
110190
|
+
|
|
110191
|
+
maybeFS.createDirectory(filename);
|
|
110192
|
+
|
|
110193
|
+
return dirPathFiles
|
|
110194
|
+
.get('value.elements')
|
|
110195
|
+
.at(-1);
|
|
110196
|
+
};
|
|
110197
|
+
|
|
110198
|
+
filesystem.init = maybeFS.init;
|
|
110199
|
+
filesystem.deinit = maybeFS.deinit;
|
|
110200
|
+
return filesystem;
|
|
110201
|
+
}
|
|
110095
110202
|
|
|
110096
110203
|
// A simple implementation of make-array
|
|
110097
110204
|
function makeArray (subject) {
|
|
@@ -110415,11 +110522,11 @@ const makeRegex = (pattern, ignoreCase) => {
|
|
|
110415
110522
|
: new RegExp(source)
|
|
110416
110523
|
};
|
|
110417
110524
|
|
|
110418
|
-
const isString
|
|
110525
|
+
const isString = subject => typeof subject === 'string';
|
|
110419
110526
|
|
|
110420
110527
|
// > A blank line matches no files, so it can serve as a separator for readability.
|
|
110421
110528
|
const checkPattern = pattern => pattern
|
|
110422
|
-
&& isString
|
|
110529
|
+
&& isString(pattern)
|
|
110423
110530
|
&& !REGEX_TEST_BLANK_LINE.test(pattern)
|
|
110424
110531
|
&& !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)
|
|
110425
110532
|
|
|
@@ -110475,7 +110582,7 @@ const throwError = (message, Ctor) => {
|
|
|
110475
110582
|
};
|
|
110476
110583
|
|
|
110477
110584
|
const checkPath = (path, originalPath, doThrow) => {
|
|
110478
|
-
if (!isString
|
|
110585
|
+
if (!isString(path)) {
|
|
110479
110586
|
return doThrow(
|
|
110480
110587
|
`path must be a string, but got \`${originalPath}\``,
|
|
110481
110588
|
TypeError
|
|
@@ -110543,7 +110650,7 @@ class Ignore {
|
|
|
110543
110650
|
this._added = false;
|
|
110544
110651
|
|
|
110545
110652
|
makeArray(
|
|
110546
|
-
isString
|
|
110653
|
+
isString(pattern)
|
|
110547
110654
|
? splitPattern(pattern)
|
|
110548
110655
|
: pattern
|
|
110549
110656
|
).forEach(this._addPattern, this);
|
|
@@ -110765,269 +110872,287 @@ var codeframe = ({source, error, highlightCode = true}) => {
|
|
|
110765
110872
|
|
|
110766
110873
|
codeframe.default;
|
|
110767
110874
|
|
|
110768
|
-
|
|
110875
|
+
var hasRequiredPutout;
|
|
110769
110876
|
|
|
110770
|
-
|
|
110771
|
-
|
|
110877
|
+
function requirePutout () {
|
|
110878
|
+
if (hasRequiredPutout) return putout$2.exports;
|
|
110879
|
+
hasRequiredPutout = 1;
|
|
110772
110880
|
|
|
110773
|
-
const {
|
|
110774
|
-
parse,
|
|
110775
|
-
print,
|
|
110776
|
-
generate,
|
|
110777
|
-
template,
|
|
110778
|
-
} = parser$6;
|
|
110881
|
+
const {traverse, types} = bundle;
|
|
110779
110882
|
|
|
110780
|
-
const
|
|
110883
|
+
const loader = lib$1;
|
|
110884
|
+
const runner = lib;
|
|
110781
110885
|
|
|
110782
|
-
const
|
|
110886
|
+
const {
|
|
110887
|
+
parse,
|
|
110888
|
+
print,
|
|
110889
|
+
generate,
|
|
110890
|
+
template,
|
|
110891
|
+
} = parser$6;
|
|
110783
110892
|
|
|
110784
|
-
const
|
|
110785
|
-
const {
|
|
110786
|
-
parser = 'babel',
|
|
110787
|
-
printer = opts.printer || 'putout',
|
|
110788
|
-
fix = true,
|
|
110789
|
-
fixCount = 2,
|
|
110790
|
-
loadPlugins = loader.loadPlugins,
|
|
110791
|
-
loadPluginsAsync = loader.loadPluginsAsync,
|
|
110792
|
-
runPlugins = runner.runPlugins,
|
|
110793
|
-
} = opts;
|
|
110794
|
-
|
|
110795
|
-
return {
|
|
110796
|
-
...opts,
|
|
110797
|
-
parser,
|
|
110798
|
-
printer,
|
|
110799
|
-
fix,
|
|
110800
|
-
fixCount,
|
|
110801
|
-
loadPlugins,
|
|
110802
|
-
loadPluginsAsync,
|
|
110803
|
-
runPlugins,
|
|
110804
|
-
};
|
|
110805
|
-
};
|
|
110893
|
+
const {cutShebang, mergeShebang} = shebang;
|
|
110806
110894
|
|
|
110807
|
-
|
|
110808
|
-
check(source);
|
|
110809
|
-
opts = defaultOpts(opts);
|
|
110810
|
-
|
|
110811
|
-
const {
|
|
110812
|
-
parser,
|
|
110813
|
-
isTS,
|
|
110814
|
-
isFlow,
|
|
110815
|
-
isJSX,
|
|
110816
|
-
sourceFileName,
|
|
110817
|
-
sourceMapName,
|
|
110818
|
-
printer,
|
|
110819
|
-
} = opts;
|
|
110820
|
-
|
|
110821
|
-
const [clearSource, shebang] = cutShebang(source);
|
|
110822
|
-
|
|
110823
|
-
const ast = parse(clearSource, {
|
|
110824
|
-
sourceFileName,
|
|
110825
|
-
parser,
|
|
110826
|
-
isTS,
|
|
110827
|
-
isFlow,
|
|
110828
|
-
isJSX,
|
|
110829
|
-
printer,
|
|
110830
|
-
});
|
|
110831
|
-
|
|
110832
|
-
const places = transform(ast, source, opts);
|
|
110833
|
-
|
|
110834
|
-
if (!opts.fix)
|
|
110835
|
-
return {
|
|
110836
|
-
code: source,
|
|
110837
|
-
places,
|
|
110838
|
-
};
|
|
110839
|
-
|
|
110840
|
-
const printed = print(ast, {
|
|
110841
|
-
sourceMapName,
|
|
110842
|
-
printer,
|
|
110843
|
-
});
|
|
110844
|
-
|
|
110845
|
-
const code = mergeShebang(shebang, printed);
|
|
110846
|
-
|
|
110847
|
-
return {
|
|
110848
|
-
code,
|
|
110849
|
-
places,
|
|
110850
|
-
};
|
|
110851
|
-
};
|
|
110895
|
+
const isString = (a) => typeof a === 'string';
|
|
110852
110896
|
|
|
110853
|
-
|
|
110854
|
-
|
|
110855
|
-
|
|
110856
|
-
|
|
110857
|
-
|
|
110858
|
-
|
|
110859
|
-
|
|
110860
|
-
|
|
110861
|
-
|
|
110862
|
-
|
|
110863
|
-
|
|
110864
|
-
|
|
110865
|
-
|
|
110866
|
-
|
|
110867
|
-
|
|
110868
|
-
|
|
110869
|
-
|
|
110870
|
-
|
|
110871
|
-
|
|
110872
|
-
|
|
110873
|
-
|
|
110874
|
-
|
|
110875
|
-
printer,
|
|
110876
|
-
});
|
|
110877
|
-
|
|
110878
|
-
const places = await transformAsync(ast, source, opts);
|
|
110879
|
-
|
|
110880
|
-
if (!opts.fix)
|
|
110881
|
-
return {
|
|
110882
|
-
code: source,
|
|
110883
|
-
places,
|
|
110884
|
-
};
|
|
110885
|
-
|
|
110886
|
-
const printed = print(ast, {
|
|
110887
|
-
sourceMapName,
|
|
110888
|
-
printer,
|
|
110889
|
-
});
|
|
110890
|
-
|
|
110891
|
-
const code = mergeShebang(shebang, printed);
|
|
110892
|
-
|
|
110893
|
-
return {
|
|
110894
|
-
code,
|
|
110895
|
-
places,
|
|
110896
|
-
};
|
|
110897
|
-
};
|
|
110897
|
+
const defaultOpts = (opts = {}) => {
|
|
110898
|
+
const {
|
|
110899
|
+
parser = 'babel',
|
|
110900
|
+
printer = opts.printer || 'putout',
|
|
110901
|
+
fix = true,
|
|
110902
|
+
fixCount = 2,
|
|
110903
|
+
loadPlugins = loader.loadPlugins,
|
|
110904
|
+
loadPluginsAsync = loader.loadPluginsAsync,
|
|
110905
|
+
runPlugins = runner.runPlugins,
|
|
110906
|
+
} = opts;
|
|
110907
|
+
|
|
110908
|
+
return {
|
|
110909
|
+
...opts,
|
|
110910
|
+
parser,
|
|
110911
|
+
printer,
|
|
110912
|
+
fix,
|
|
110913
|
+
fixCount,
|
|
110914
|
+
loadPlugins,
|
|
110915
|
+
loadPluginsAsync,
|
|
110916
|
+
runPlugins,
|
|
110917
|
+
};
|
|
110918
|
+
};
|
|
110898
110919
|
|
|
110899
|
-
putout$
|
|
110900
|
-
|
|
110901
|
-
|
|
110902
|
-
|
|
110903
|
-
|
|
110904
|
-
|
|
110905
|
-
|
|
110906
|
-
|
|
110907
|
-
|
|
110908
|
-
|
|
110909
|
-
|
|
110910
|
-
|
|
110911
|
-
};
|
|
110920
|
+
putout$2.exports = (source, opts) => {
|
|
110921
|
+
check(source);
|
|
110922
|
+
opts = defaultOpts(opts);
|
|
110923
|
+
|
|
110924
|
+
const {
|
|
110925
|
+
parser,
|
|
110926
|
+
isTS,
|
|
110927
|
+
isFlow,
|
|
110928
|
+
isJSX,
|
|
110929
|
+
sourceFileName,
|
|
110930
|
+
sourceMapName,
|
|
110931
|
+
printer,
|
|
110932
|
+
} = opts;
|
|
110933
|
+
|
|
110934
|
+
const [clearSource, shebang] = cutShebang(source);
|
|
110935
|
+
|
|
110936
|
+
const ast = parse(clearSource, {
|
|
110937
|
+
sourceFileName,
|
|
110938
|
+
parser,
|
|
110939
|
+
isTS,
|
|
110940
|
+
isFlow,
|
|
110941
|
+
isJSX,
|
|
110942
|
+
printer,
|
|
110943
|
+
});
|
|
110944
|
+
|
|
110945
|
+
const places = transform(ast, source, opts);
|
|
110946
|
+
|
|
110947
|
+
if (!opts.fix)
|
|
110948
|
+
return {
|
|
110949
|
+
code: source,
|
|
110950
|
+
places,
|
|
110951
|
+
};
|
|
110952
|
+
|
|
110953
|
+
const printed = print(ast, {
|
|
110954
|
+
sourceMapName,
|
|
110955
|
+
printer,
|
|
110956
|
+
});
|
|
110957
|
+
|
|
110958
|
+
const code = mergeShebang(shebang, printed);
|
|
110959
|
+
|
|
110960
|
+
return {
|
|
110961
|
+
code,
|
|
110962
|
+
places,
|
|
110963
|
+
};
|
|
110964
|
+
};
|
|
110912
110965
|
|
|
110913
|
-
async
|
|
110914
|
-
|
|
110915
|
-
|
|
110916
|
-
|
|
110917
|
-
|
|
110918
|
-
|
|
110919
|
-
|
|
110920
|
-
|
|
110921
|
-
|
|
110922
|
-
|
|
110923
|
-
|
|
110924
|
-
|
|
110925
|
-
|
|
110926
|
-
|
|
110927
|
-
|
|
110928
|
-
|
|
110929
|
-
|
|
110930
|
-
|
|
110931
|
-
|
|
110932
|
-
|
|
110933
|
-
|
|
110934
|
-
|
|
110935
|
-
|
|
110936
|
-
|
|
110937
|
-
|
|
110938
|
-
|
|
110939
|
-
|
|
110940
|
-
|
|
110941
|
-
|
|
110942
|
-
|
|
110943
|
-
|
|
110966
|
+
putout$2.exports.putoutAsync = async (source, opts) => {
|
|
110967
|
+
check(source);
|
|
110968
|
+
opts = defaultOpts(opts);
|
|
110969
|
+
|
|
110970
|
+
const {
|
|
110971
|
+
parser,
|
|
110972
|
+
isTS,
|
|
110973
|
+
isFlow,
|
|
110974
|
+
isJSX,
|
|
110975
|
+
sourceFileName,
|
|
110976
|
+
sourceMapName,
|
|
110977
|
+
printer,
|
|
110978
|
+
} = opts;
|
|
110979
|
+
|
|
110980
|
+
const [clearSource, shebang] = cutShebang(source);
|
|
110981
|
+
|
|
110982
|
+
const ast = parse(clearSource, {
|
|
110983
|
+
sourceFileName,
|
|
110984
|
+
parser,
|
|
110985
|
+
isTS,
|
|
110986
|
+
isFlow,
|
|
110987
|
+
isJSX,
|
|
110988
|
+
printer,
|
|
110989
|
+
});
|
|
110990
|
+
|
|
110991
|
+
const places = await transformAsync(ast, source, opts);
|
|
110992
|
+
|
|
110993
|
+
if (!opts.fix)
|
|
110994
|
+
return {
|
|
110995
|
+
code: source,
|
|
110996
|
+
places,
|
|
110997
|
+
};
|
|
110998
|
+
|
|
110999
|
+
const printed = print(ast, {
|
|
111000
|
+
sourceMapName,
|
|
111001
|
+
printer,
|
|
111002
|
+
});
|
|
111003
|
+
|
|
111004
|
+
const code = mergeShebang(shebang, printed);
|
|
111005
|
+
|
|
111006
|
+
return {
|
|
111007
|
+
code,
|
|
111008
|
+
places,
|
|
111009
|
+
};
|
|
111010
|
+
};
|
|
110944
111011
|
|
|
110945
|
-
|
|
110946
|
-
|
|
110947
|
-
|
|
110948
|
-
|
|
110949
|
-
|
|
110950
|
-
|
|
110951
|
-
|
|
110952
|
-
|
|
110953
|
-
|
|
110954
|
-
|
|
110955
|
-
|
|
110956
|
-
|
|
110957
|
-
|
|
110958
|
-
|
|
110959
|
-
|
|
110960
|
-
|
|
110961
|
-
|
|
110962
|
-
|
|
110963
|
-
|
|
110964
|
-
|
|
110965
|
-
|
|
110966
|
-
|
|
110967
|
-
|
|
110968
|
-
|
|
110969
|
-
|
|
110970
|
-
|
|
110971
|
-
|
|
110972
|
-
|
|
110973
|
-
|
|
110974
|
-
|
|
110975
|
-
|
|
110976
|
-
|
|
110977
|
-
|
|
110978
|
-
|
|
110979
|
-
|
|
110980
|
-
|
|
110981
|
-
|
|
110982
|
-
|
|
110983
|
-
|
|
110984
|
-
|
|
110985
|
-
|
|
111012
|
+
putout$2.exports.transformAsync = transformAsync;
|
|
111013
|
+
putout$2.exports.findPlaces = (ast, source, opts) => {
|
|
111014
|
+
return transform(ast, source, {
|
|
111015
|
+
...opts,
|
|
111016
|
+
fix: false,
|
|
111017
|
+
});
|
|
111018
|
+
};
|
|
111019
|
+
putout$2.exports.findPlacesAsync = async (ast, source, opts) => {
|
|
111020
|
+
return await transformAsync(ast, source, {
|
|
111021
|
+
...opts,
|
|
111022
|
+
fix: false,
|
|
111023
|
+
});
|
|
111024
|
+
};
|
|
111025
|
+
|
|
111026
|
+
async function transformAsync(ast, source, opts) {
|
|
111027
|
+
opts = defaultOpts(opts);
|
|
111028
|
+
|
|
111029
|
+
const {
|
|
111030
|
+
plugins: pluginNames,
|
|
111031
|
+
cache,
|
|
111032
|
+
rules,
|
|
111033
|
+
fix,
|
|
111034
|
+
fixCount,
|
|
111035
|
+
loadPluginsAsync,
|
|
111036
|
+
runPlugins,
|
|
111037
|
+
} = opts;
|
|
111038
|
+
|
|
111039
|
+
const [, shebang] = cutShebang(source);
|
|
111040
|
+
|
|
111041
|
+
const plugins = await loadPluginsAsync({
|
|
111042
|
+
pluginNames,
|
|
111043
|
+
cache,
|
|
111044
|
+
rules,
|
|
111045
|
+
});
|
|
111046
|
+
|
|
111047
|
+
const places = runPlugins({
|
|
111048
|
+
ast,
|
|
111049
|
+
shebang,
|
|
111050
|
+
fix,
|
|
111051
|
+
fixCount,
|
|
111052
|
+
plugins,
|
|
111053
|
+
});
|
|
111054
|
+
|
|
111055
|
+
return places;
|
|
111056
|
+
}
|
|
110986
111057
|
|
|
110987
|
-
|
|
110988
|
-
|
|
110989
|
-
|
|
110990
|
-
|
|
110991
|
-
|
|
110992
|
-
|
|
110993
|
-
|
|
111058
|
+
// why we pass 'source' to 'transform()'?
|
|
111059
|
+
// because we need to calculate position in a right way
|
|
111060
|
+
// and determine is shebang is exists
|
|
111061
|
+
//
|
|
111062
|
+
// 25 return {¬
|
|
111063
|
+
// 26 line: shebang ? line + 1 : line,¬
|
|
111064
|
+
// 27 column,¬
|
|
111065
|
+
// 28 };¬
|
|
111066
|
+
//
|
|
111067
|
+
putout$2.exports.transform = transform;
|
|
111068
|
+
function transform(ast, source, opts) {
|
|
111069
|
+
opts = defaultOpts(opts);
|
|
111070
|
+
|
|
111071
|
+
const {
|
|
111072
|
+
plugins: pluginNames,
|
|
111073
|
+
cache,
|
|
111074
|
+
rules,
|
|
111075
|
+
fix,
|
|
111076
|
+
fixCount,
|
|
111077
|
+
loadPlugins,
|
|
111078
|
+
runPlugins,
|
|
111079
|
+
} = opts;
|
|
111080
|
+
|
|
111081
|
+
const [, shebang] = cutShebang(source);
|
|
111082
|
+
|
|
111083
|
+
const plugins = loadPlugins({
|
|
111084
|
+
pluginNames,
|
|
111085
|
+
cache,
|
|
111086
|
+
rules,
|
|
111087
|
+
});
|
|
111088
|
+
|
|
111089
|
+
const places = runPlugins({
|
|
111090
|
+
ast,
|
|
111091
|
+
shebang,
|
|
111092
|
+
fix,
|
|
111093
|
+
fixCount,
|
|
111094
|
+
plugins,
|
|
111095
|
+
});
|
|
111096
|
+
|
|
111097
|
+
return places;
|
|
111098
|
+
}
|
|
110994
111099
|
|
|
110995
|
-
|
|
110996
|
-
|
|
110997
|
-
|
|
110998
|
-
|
|
110999
|
-
|
|
111000
|
-
|
|
111001
|
-
|
|
111002
|
-
|
|
111003
|
-
|
|
111100
|
+
putout$2.exports.parse = parse;
|
|
111101
|
+
putout$2.exports.print = print;
|
|
111102
|
+
putout$2.exports.traverse = traverse;
|
|
111103
|
+
putout$2.exports.types = types;
|
|
111104
|
+
putout$2.exports.template = template;
|
|
111105
|
+
putout$2.exports.generate = generate;
|
|
111106
|
+
putout$2.exports.initReport = report$1;
|
|
111107
|
+
|
|
111108
|
+
putout$2.exports.operator = {
|
|
111109
|
+
...operate,
|
|
111110
|
+
...compare$4,
|
|
111111
|
+
...traverse$4,
|
|
111112
|
+
...declare$2,
|
|
111113
|
+
...regexp,
|
|
111114
|
+
...addArgs,
|
|
111115
|
+
...requireFilesystem(),
|
|
111116
|
+
};
|
|
111004
111117
|
|
|
111005
|
-
putout$
|
|
111006
|
-
putout$
|
|
111118
|
+
putout$2.exports.ignores = ignores;
|
|
111119
|
+
putout$2.exports.codeframe = codeframe;
|
|
111007
111120
|
|
|
111008
|
-
function check(source) {
|
|
111009
|
-
|
|
111010
|
-
|
|
111121
|
+
function check(source) {
|
|
111122
|
+
if (!isString(source))
|
|
111123
|
+
throw Error(`☝️ Looks like 'source' has type '${typeof source}', expected: 'string'`);
|
|
111124
|
+
}
|
|
111125
|
+
return putout$2.exports;
|
|
111011
111126
|
}
|
|
111012
111127
|
|
|
111013
|
-
var putoutExports =
|
|
111128
|
+
var putoutExports = requirePutout();
|
|
111129
|
+
var putout$1 = /*@__PURE__*/getDefaultExportFromCjs(putoutExports);
|
|
111014
111130
|
|
|
111015
111131
|
function putout(...a) {
|
|
111016
|
-
return
|
|
111132
|
+
return putout$1(...a);
|
|
111017
111133
|
}
|
|
111018
111134
|
|
|
111019
111135
|
const {assign} = Object;
|
|
111020
111136
|
|
|
111021
111137
|
assign(putout, {
|
|
111022
|
-
parse:
|
|
111023
|
-
print:
|
|
111024
|
-
traverse:
|
|
111025
|
-
generate:
|
|
111026
|
-
template:
|
|
111027
|
-
operator,
|
|
111028
|
-
transform:
|
|
111029
|
-
findPlaces,
|
|
111030
|
-
types:
|
|
111138
|
+
parse: putoutExports.parse,
|
|
111139
|
+
print: putoutExports.print,
|
|
111140
|
+
traverse: putoutExports.traverse,
|
|
111141
|
+
generate: putoutExports.generate,
|
|
111142
|
+
template: putoutExports.template,
|
|
111143
|
+
operator: putoutExports.operator,
|
|
111144
|
+
transform: putoutExports.transform,
|
|
111145
|
+
findPlaces: putoutExports.findPlaces,
|
|
111146
|
+
types: putoutExports.types,
|
|
111031
111147
|
});
|
|
111032
111148
|
|
|
111033
|
-
|
|
111149
|
+
var findPlaces = putoutExports.findPlaces;
|
|
111150
|
+
var generate$6 = putoutExports.generate;
|
|
111151
|
+
var operator = putoutExports.operator;
|
|
111152
|
+
var parse$4 = putoutExports.parse;
|
|
111153
|
+
var print$3 = putoutExports.print;
|
|
111154
|
+
var template$a = putoutExports.template;
|
|
111155
|
+
var transform$2 = putoutExports.transform;
|
|
111156
|
+
var traverse$c = putoutExports.traverse;
|
|
111157
|
+
var types$o = putoutExports.types;
|
|
111158
|
+
export { putout as default, findPlaces, generate$6 as generate, operator, parse$4 as parse, print$3 as print, template$a as template, transform$2 as transform, traverse$c as traverse, types$o as types };
|