@putout/bundle 5.0.2 → 5.0.4
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.js +182 -362
- package/bundle/putout.min.js +2 -2
- package/bundle/putout.slim.js +182 -362
- package/package.json +2 -2
package/bundle/putout.js
CHANGED
|
@@ -182,7 +182,7 @@ function noop$8() {}
|
|
|
182
182
|
|
|
183
183
|
var on = noop$8;
|
|
184
184
|
var addListener = noop$8;
|
|
185
|
-
var once$
|
|
185
|
+
var once$9 = noop$8;
|
|
186
186
|
var off = noop$8;
|
|
187
187
|
var removeListener = noop$8;
|
|
188
188
|
var removeAllListeners = noop$8;
|
|
@@ -241,7 +241,7 @@ var browser$1$1 = {
|
|
|
241
241
|
versions: versions,
|
|
242
242
|
on: on,
|
|
243
243
|
addListener: addListener,
|
|
244
|
-
once: once$
|
|
244
|
+
once: once$9,
|
|
245
245
|
off: off,
|
|
246
246
|
removeListener: removeListener,
|
|
247
247
|
removeAllListeners: removeAllListeners,
|
|
@@ -273,7 +273,7 @@ var _polyfillNode_process = /*#__PURE__*/Object.freeze({
|
|
|
273
273
|
nextTick: nextTick,
|
|
274
274
|
off: off,
|
|
275
275
|
on: on,
|
|
276
|
-
once: once$
|
|
276
|
+
once: once$9,
|
|
277
277
|
platform: platform,
|
|
278
278
|
release: release,
|
|
279
279
|
removeAllListeners: removeAllListeners,
|
|
@@ -56462,9 +56462,9 @@ expressionStatementExports.default;
|
|
|
56462
56462
|
|
|
56463
56463
|
var variableDeclaration$2 = {};
|
|
56464
56464
|
|
|
56465
|
-
var maybeSpaceAfterKeyword$
|
|
56465
|
+
var maybeSpaceAfterKeyword$4 = {};
|
|
56466
56466
|
|
|
56467
|
-
maybeSpaceAfterKeyword$
|
|
56467
|
+
maybeSpaceAfterKeyword$4.maybeSpaceAfterKeyword = (path, {write}) => {
|
|
56468
56468
|
const {declarations} = path.node;
|
|
56469
56469
|
|
|
56470
56470
|
if (!declarations.length)
|
|
@@ -56488,7 +56488,7 @@ const {
|
|
|
56488
56488
|
} = is$4;
|
|
56489
56489
|
|
|
56490
56490
|
const {hasPrevNewline: hasPrevNewline$3} = mark;
|
|
56491
|
-
const {maybeSpaceAfterKeyword: maybeSpaceAfterKeyword$
|
|
56491
|
+
const {maybeSpaceAfterKeyword: maybeSpaceAfterKeyword$3} = maybeSpaceAfterKeyword$4;
|
|
56492
56492
|
|
|
56493
56493
|
const {isConcatenation} = concatenate$1;
|
|
56494
56494
|
const {parseLeadingComments: parseLeadingComments$2} = comment;
|
|
@@ -56514,7 +56514,7 @@ variableDeclaration$2.VariableDeclaration = {
|
|
|
56514
56514
|
maybe.indent(isInsideBlock$3(path));
|
|
56515
56515
|
|
|
56516
56516
|
write(path.node.kind);
|
|
56517
|
-
maybeSpaceAfterKeyword$
|
|
56517
|
+
maybeSpaceAfterKeyword$3(path, {
|
|
56518
56518
|
write,
|
|
56519
56519
|
});
|
|
56520
56520
|
|
|
@@ -57168,16 +57168,16 @@ function isTry({parentPath}) {
|
|
|
57168
57168
|
|
|
57169
57169
|
var returnStatement$2 = {};
|
|
57170
57170
|
|
|
57171
|
-
var maybeSpaceAfterKeyword$
|
|
57171
|
+
var maybeSpaceAfterKeyword$2 = {};
|
|
57172
57172
|
|
|
57173
|
-
maybeSpaceAfterKeyword$
|
|
57173
|
+
maybeSpaceAfterKeyword$2.maybeSpaceAfterKeyword = (path, {print}, semantics) => {
|
|
57174
57174
|
const {roundBraces} = semantics;
|
|
57175
|
-
const {
|
|
57175
|
+
const {node} = path;
|
|
57176
57176
|
|
|
57177
|
-
if (!
|
|
57177
|
+
if (!node)
|
|
57178
57178
|
return;
|
|
57179
57179
|
|
|
57180
|
-
const {type} =
|
|
57180
|
+
const {type} = node;
|
|
57181
57181
|
|
|
57182
57182
|
if (type === 'SequenceExpression' && roundBraces.sequence)
|
|
57183
57183
|
return print.space();
|
|
@@ -57188,7 +57188,7 @@ maybeSpaceAfterKeyword$1.maybeSpaceAfterKeyword = (path, {print}, semantics) =>
|
|
|
57188
57188
|
if (type === 'ArrayExpression' || type === 'ObjectExpression')
|
|
57189
57189
|
return print.space();
|
|
57190
57190
|
|
|
57191
|
-
if (type === 'UnaryExpression' &&
|
|
57191
|
+
if (type === 'UnaryExpression' && node.operator === '!')
|
|
57192
57192
|
return print.space();
|
|
57193
57193
|
|
|
57194
57194
|
if (type === 'ArrowFunctionExpression' && roundBraces.arrow)
|
|
@@ -57207,7 +57207,7 @@ const {
|
|
|
57207
57207
|
} = is$4;
|
|
57208
57208
|
|
|
57209
57209
|
const {hasPrevNewline: hasPrevNewline$1} = mark;
|
|
57210
|
-
const {maybeSpaceAfterKeyword} = maybeSpaceAfterKeyword$
|
|
57210
|
+
const {maybeSpaceAfterKeyword: maybeSpaceAfterKeyword$1} = maybeSpaceAfterKeyword$2;
|
|
57211
57211
|
|
|
57212
57212
|
const {isJSXElement: isJSXElement$4} = types$A;
|
|
57213
57213
|
const isBodyLength = ({parentPath}) => parentPath.node?.body?.length > 2;
|
|
@@ -57226,7 +57226,10 @@ returnStatement$2.ReturnStatement = {
|
|
|
57226
57226
|
|
|
57227
57227
|
maybe.indent(!isInsideLabel$4(path));
|
|
57228
57228
|
print('return');
|
|
57229
|
-
|
|
57229
|
+
|
|
57230
|
+
const arg = path.get('argument');
|
|
57231
|
+
|
|
57232
|
+
maybeSpaceAfterKeyword$1(arg, printer, semantics);
|
|
57230
57233
|
|
|
57231
57234
|
if (isJSXWithComment(path)) {
|
|
57232
57235
|
print('(');
|
|
@@ -57837,6 +57840,8 @@ const {
|
|
|
57837
57840
|
|
|
57838
57841
|
const {parseLeadingComments: parseLeadingComments$1} = comment;
|
|
57839
57842
|
|
|
57843
|
+
const {maybeSpaceAfterKeyword} = maybeSpaceAfterKeyword$2;
|
|
57844
|
+
|
|
57840
57845
|
switchStatement$1.SwitchStatement = {
|
|
57841
57846
|
print(path, printer, semantics) {
|
|
57842
57847
|
const {
|
|
@@ -57865,7 +57870,8 @@ switchStatement$1.SwitchStatement = {
|
|
|
57865
57870
|
parseLeadingComments$1(switchCase, printer, semantics);
|
|
57866
57871
|
|
|
57867
57872
|
if (exists$1(test)) {
|
|
57868
|
-
write('case
|
|
57873
|
+
write('case');
|
|
57874
|
+
maybeSpaceAfterKeyword(test, printer, semantics);
|
|
57869
57875
|
traverse(test);
|
|
57870
57876
|
} else {
|
|
57871
57877
|
write('default');
|
|
@@ -59955,7 +59961,7 @@ const constant = (a) => () => a;
|
|
|
59955
59961
|
const {keys: keys$4} = Object;
|
|
59956
59962
|
|
|
59957
59963
|
var rendy$1 = (template, values, modifiers) => {
|
|
59958
|
-
check$
|
|
59964
|
+
check$e(template, values);
|
|
59959
59965
|
|
|
59960
59966
|
let result = template;
|
|
59961
59967
|
|
|
@@ -59975,7 +59981,7 @@ var rendy$1 = (template, values, modifiers) => {
|
|
|
59975
59981
|
return result;
|
|
59976
59982
|
};
|
|
59977
59983
|
|
|
59978
|
-
function check$
|
|
59984
|
+
function check$e(template, values) {
|
|
59979
59985
|
if (!isString$c(template))
|
|
59980
59986
|
throw Error('template should be a string!');
|
|
59981
59987
|
|
|
@@ -60128,7 +60134,7 @@ function snakeCase(str) {
|
|
|
60128
60134
|
.join('_');
|
|
60129
60135
|
}
|
|
60130
60136
|
|
|
60131
|
-
const process
|
|
60137
|
+
const process = require$$0$3;
|
|
60132
60138
|
const toSnakeCase = justSnakeCase;
|
|
60133
60139
|
const {codeFrameColumns: codeFrameColumns$2} = bundle$1;
|
|
60134
60140
|
const {TYPES: TYPES$3} = types$19;
|
|
@@ -60185,7 +60191,7 @@ debug$8.createLog = ({newline = '\n', store = createStore$1()} = {}) => ({type,
|
|
|
60185
60191
|
}
|
|
60186
60192
|
|
|
60187
60193
|
if (LOG_TERM)
|
|
60188
|
-
process
|
|
60194
|
+
process.stdout.write(value);
|
|
60189
60195
|
};
|
|
60190
60196
|
|
|
60191
60197
|
function createStore$1() {
|
|
@@ -60779,7 +60785,7 @@ const {maybeVisitor} = maybe;
|
|
|
60779
60785
|
const visitors$1 = visitors$2;
|
|
60780
60786
|
|
|
60781
60787
|
printer.print = (ast, overrides = {}) => {
|
|
60782
|
-
check$
|
|
60788
|
+
check$d(ast);
|
|
60783
60789
|
|
|
60784
60790
|
const options = maybeJSON(ast, overrides);
|
|
60785
60791
|
const tokens = tokenize$1(ast, options);
|
|
@@ -60790,7 +60796,7 @@ printer.print = (ast, overrides = {}) => {
|
|
|
60790
60796
|
printer.visitors = visitors$1;
|
|
60791
60797
|
printer.maybeVisitor = maybeVisitor;
|
|
60792
60798
|
|
|
60793
|
-
function check$
|
|
60799
|
+
function check$d(ast) {
|
|
60794
60800
|
if (typeof ast !== 'object')
|
|
60795
60801
|
throw Error('☝️Looks like ast not an object');
|
|
60796
60802
|
}
|
|
@@ -60800,7 +60806,7 @@ var babel$2 = {};
|
|
|
60800
60806
|
const isString$a = (a) => typeof a === 'string';
|
|
60801
60807
|
|
|
60802
60808
|
var alignSpaces = (str) => {
|
|
60803
|
-
check$
|
|
60809
|
+
check$c(str);
|
|
60804
60810
|
|
|
60805
60811
|
const array = str.split('\n');
|
|
60806
60812
|
const n = array.length - 1;
|
|
@@ -60844,7 +60850,7 @@ function getSpaces(s) {
|
|
|
60844
60850
|
return spaces;
|
|
60845
60851
|
}
|
|
60846
60852
|
|
|
60847
|
-
function check$
|
|
60853
|
+
function check$c(str) {
|
|
60848
60854
|
if (!isString$a(str))
|
|
60849
60855
|
throw Error('str should be a string!');
|
|
60850
60856
|
}
|
|
@@ -110551,7 +110557,7 @@ function commonjsRequire(path) {
|
|
|
110551
110557
|
|
|
110552
110558
|
var acorn$1 = {};
|
|
110553
110559
|
|
|
110554
|
-
var once$
|
|
110560
|
+
var once$8 = {exports: {}};
|
|
110555
110561
|
|
|
110556
110562
|
// Returns a wrapper function that returns a wrapped callback
|
|
110557
110563
|
// The wrapper function should do some stuff, and return a
|
|
@@ -110588,13 +110594,13 @@ function wrappy$1 (fn, cb) {
|
|
|
110588
110594
|
}
|
|
110589
110595
|
|
|
110590
110596
|
var wrappy = wrappy_1;
|
|
110591
|
-
once$
|
|
110592
|
-
once$
|
|
110597
|
+
once$8.exports = wrappy(once$7);
|
|
110598
|
+
once$8.exports.strict = wrappy(onceStrict);
|
|
110593
110599
|
|
|
110594
|
-
once$
|
|
110600
|
+
once$7.proto = once$7(function () {
|
|
110595
110601
|
Object.defineProperty(Function.prototype, 'once', {
|
|
110596
110602
|
value: function () {
|
|
110597
|
-
return once$
|
|
110603
|
+
return once$7(this)
|
|
110598
110604
|
},
|
|
110599
110605
|
configurable: true
|
|
110600
110606
|
});
|
|
@@ -110607,7 +110613,7 @@ once$8.proto = once$8(function () {
|
|
|
110607
110613
|
});
|
|
110608
110614
|
});
|
|
110609
110615
|
|
|
110610
|
-
function once$
|
|
110616
|
+
function once$7 (fn) {
|
|
110611
110617
|
var f = function () {
|
|
110612
110618
|
if (f.called) return f.value
|
|
110613
110619
|
f.called = true;
|
|
@@ -110630,7 +110636,7 @@ function onceStrict (fn) {
|
|
|
110630
110636
|
return f
|
|
110631
110637
|
}
|
|
110632
110638
|
|
|
110633
|
-
var onceExports = once$
|
|
110639
|
+
var onceExports = once$8.exports;
|
|
110634
110640
|
|
|
110635
110641
|
const noop$3 = () => {};
|
|
110636
110642
|
|
|
@@ -110639,7 +110645,7 @@ var empty = /*#__PURE__*/Object.freeze({
|
|
|
110639
110645
|
default: noop$3
|
|
110640
110646
|
});
|
|
110641
110647
|
|
|
110642
|
-
var require$$1$
|
|
110648
|
+
var require$$1$2 = /*@__PURE__*/getAugmentedNamespace(empty);
|
|
110643
110649
|
|
|
110644
110650
|
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
|
110645
110651
|
|
|
@@ -110682,21 +110688,21 @@ function requireAcornStage3 () {
|
|
|
110682
110688
|
|
|
110683
110689
|
acornStage3 = function(Parser) {
|
|
110684
110690
|
return Parser.extend(
|
|
110685
|
-
require$$1$
|
|
110686
|
-
require$$1$
|
|
110691
|
+
require$$1$2,
|
|
110692
|
+
require$$1$2,
|
|
110687
110693
|
require$$2
|
|
110688
110694
|
)
|
|
110689
110695
|
};
|
|
110690
110696
|
return acornStage3;
|
|
110691
110697
|
}
|
|
110692
110698
|
|
|
110693
|
-
const once$
|
|
110699
|
+
const once$6 = onceExports;
|
|
110694
110700
|
|
|
110695
|
-
const initAcorn = once$
|
|
110696
|
-
const {Parser} = require$$1$
|
|
110701
|
+
const initAcorn = once$6(() => {
|
|
110702
|
+
const {Parser} = require$$1$2;
|
|
110697
110703
|
|
|
110698
110704
|
const stage3 = requireAcornStage3();
|
|
110699
|
-
const typescript = require$$1$
|
|
110705
|
+
const typescript = require$$1$2.default;
|
|
110700
110706
|
|
|
110701
110707
|
return Parser.extend(typescript(), stage3);
|
|
110702
110708
|
});
|
|
@@ -110752,14 +110758,14 @@ var options$1 = {
|
|
|
110752
110758
|
allowImportExportEverywhere: true,
|
|
110753
110759
|
};
|
|
110754
110760
|
|
|
110755
|
-
const once$
|
|
110761
|
+
const once$5 = onceExports;
|
|
110756
110762
|
|
|
110757
110763
|
const plugins = plugins$1;
|
|
110758
110764
|
const options = options$1;
|
|
110759
110765
|
const {assign: assign$5} = Object;
|
|
110760
110766
|
const getFlow = (a) => !a.indexOf('// @flow');
|
|
110761
110767
|
const clean = (a) => a.filter(Boolean);
|
|
110762
|
-
const initBabel = once$
|
|
110768
|
+
const initBabel = once$5(() => bundle$1);
|
|
110763
110769
|
|
|
110764
110770
|
babel$1.parse = function babelParse(source, overrides) {
|
|
110765
110771
|
const {
|
|
@@ -110812,8 +110818,8 @@ function getBabelLangExts({isTS, isFlow, isJSX}) {
|
|
|
110812
110818
|
|
|
110813
110819
|
var espree$1 = {};
|
|
110814
110820
|
|
|
110815
|
-
const once$
|
|
110816
|
-
const initEspree = once$
|
|
110821
|
+
const once$4 = onceExports;
|
|
110822
|
+
const initEspree = once$4(() => require$$1$2);
|
|
110817
110823
|
|
|
110818
110824
|
espree$1.parse = function espreeParse(source) {
|
|
110819
110825
|
const {parse} = initEspree();
|
|
@@ -110833,8 +110839,8 @@ espree$1.parse = function espreeParse(source) {
|
|
|
110833
110839
|
|
|
110834
110840
|
var esprima$1 = {};
|
|
110835
110841
|
|
|
110836
|
-
const once$
|
|
110837
|
-
const initEsprima = once$
|
|
110842
|
+
const once$3 = onceExports;
|
|
110843
|
+
const initEsprima = once$3(() => require$$1$2);
|
|
110838
110844
|
|
|
110839
110845
|
esprima$1.parse = function esprimaParse(source) {
|
|
110840
110846
|
const {parse} = initEsprima();
|
|
@@ -110850,8 +110856,8 @@ esprima$1.parse = function esprimaParse(source) {
|
|
|
110850
110856
|
|
|
110851
110857
|
var tenko$1 = {};
|
|
110852
110858
|
|
|
110853
|
-
const once$
|
|
110854
|
-
const initTenko = once$
|
|
110859
|
+
const once$2 = onceExports;
|
|
110860
|
+
const initTenko = once$2(() => require$$1$2);
|
|
110855
110861
|
|
|
110856
110862
|
tenko$1.parse = (source) => {
|
|
110857
110863
|
const {Tenko} = initTenko();
|
|
@@ -110867,8 +110873,8 @@ tenko$1.parse = (source) => {
|
|
|
110867
110873
|
|
|
110868
110874
|
var hermes$1 = {};
|
|
110869
110875
|
|
|
110870
|
-
const once$
|
|
110871
|
-
const initHermes = once$
|
|
110876
|
+
const once$1 = onceExports;
|
|
110877
|
+
const initHermes = once$1(() => require$$1$2);
|
|
110872
110878
|
|
|
110873
110879
|
hermes$1.parse = function hermesParse(source) {
|
|
110874
110880
|
const parser = initHermes();
|
|
@@ -111016,7 +111022,7 @@ const {assign: assign$4} = Object;
|
|
|
111016
111022
|
const isString$8 = (a) => typeof a === 'string';
|
|
111017
111023
|
|
|
111018
111024
|
var parse$5 = (source, options) => {
|
|
111019
|
-
check$
|
|
111025
|
+
check$b(source);
|
|
111020
111026
|
|
|
111021
111027
|
const {
|
|
111022
111028
|
parser,
|
|
@@ -111054,7 +111060,7 @@ const getParser = ({parser = 'babel', isTS, isJSX, printer}) => ({
|
|
|
111054
111060
|
},
|
|
111055
111061
|
});
|
|
111056
111062
|
|
|
111057
|
-
function check$
|
|
111063
|
+
function check$b(source) {
|
|
111058
111064
|
if (!isString$8(source))
|
|
111059
111065
|
throw Error(`☝️ Looks like type of 'source' is not 'string', but '${typeof source}'`);
|
|
111060
111066
|
}
|
|
@@ -111179,12 +111185,12 @@ var nanoMemoize = /*#__PURE__*/Object.freeze({
|
|
|
111179
111185
|
nanomemoize: $cf838c15c8b009ba$export$22f15dd4e5be7e52
|
|
111180
111186
|
});
|
|
111181
111187
|
|
|
111182
|
-
var require$$
|
|
111188
|
+
var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(nanoMemoize);
|
|
111183
111189
|
|
|
111184
111190
|
(function (module) {
|
|
111185
111191
|
|
|
111186
111192
|
const {types, template} = bundle$1;
|
|
111187
|
-
const {nanomemoize} = require$$
|
|
111193
|
+
const {nanomemoize} = require$$1$1;
|
|
111188
111194
|
const plugins = plugins$1;
|
|
111189
111195
|
const options = options$1;
|
|
111190
111196
|
|
|
@@ -111305,10 +111311,6 @@ shebang.cutShebang = (source) => {
|
|
|
111305
111311
|
|
|
111306
111312
|
var defaultOptions$5 = {};
|
|
111307
111313
|
|
|
111308
|
-
var lib$1 = {};
|
|
111309
|
-
|
|
111310
|
-
var asyncLoader = {};
|
|
111311
|
-
|
|
111312
111314
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
111313
111315
|
//
|
|
111314
111316
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -111424,7 +111426,7 @@ function isAbsolute(path) {
|
|
|
111424
111426
|
}
|
|
111425
111427
|
|
|
111426
111428
|
// posix version
|
|
111427
|
-
function join$
|
|
111429
|
+
function join$3() {
|
|
111428
111430
|
var paths = Array.prototype.slice.call(arguments, 0);
|
|
111429
111431
|
return normalize(filter$1(paths, function(p, index) {
|
|
111430
111432
|
if (typeof p !== 'string') {
|
|
@@ -111499,7 +111501,7 @@ function dirname$2(path) {
|
|
|
111499
111501
|
return root + dir;
|
|
111500
111502
|
}
|
|
111501
111503
|
|
|
111502
|
-
function basename$
|
|
111504
|
+
function basename$2(path, ext) {
|
|
111503
111505
|
var f = splitPath(path)[2];
|
|
111504
111506
|
// TODO: make this comparison case-insensitive on windows?
|
|
111505
111507
|
if (ext && f.substr(-1 * ext.length) === ext) {
|
|
@@ -111514,12 +111516,12 @@ function extname(path) {
|
|
|
111514
111516
|
}
|
|
111515
111517
|
var _polyfillNode_path = {
|
|
111516
111518
|
extname: extname,
|
|
111517
|
-
basename: basename$
|
|
111519
|
+
basename: basename$2,
|
|
111518
111520
|
dirname: dirname$2,
|
|
111519
111521
|
sep: sep,
|
|
111520
111522
|
delimiter: delimiter,
|
|
111521
111523
|
relative: relative$1,
|
|
111522
|
-
join: join$
|
|
111524
|
+
join: join$3,
|
|
111523
111525
|
isAbsolute: isAbsolute,
|
|
111524
111526
|
normalize: normalize,
|
|
111525
111527
|
resolve: resolve
|
|
@@ -111544,23 +111546,23 @@ var substr = 'ab'.substr(-1) === 'b' ?
|
|
|
111544
111546
|
|
|
111545
111547
|
var _polyfillNode_path$1 = /*#__PURE__*/Object.freeze({
|
|
111546
111548
|
__proto__: null,
|
|
111547
|
-
basename: basename$
|
|
111549
|
+
basename: basename$2,
|
|
111548
111550
|
default: _polyfillNode_path,
|
|
111549
111551
|
delimiter: delimiter,
|
|
111550
111552
|
dirname: dirname$2,
|
|
111551
111553
|
extname: extname,
|
|
111552
111554
|
isAbsolute: isAbsolute,
|
|
111553
|
-
join: join$
|
|
111555
|
+
join: join$3,
|
|
111554
111556
|
normalize: normalize,
|
|
111555
111557
|
relative: relative$1,
|
|
111556
111558
|
resolve: resolve,
|
|
111557
111559
|
sep: sep
|
|
111558
111560
|
});
|
|
111559
111561
|
|
|
111560
|
-
var
|
|
111562
|
+
var module$1 = {};
|
|
111561
111563
|
|
|
111562
|
-
var tryToCatch
|
|
111563
|
-
check$
|
|
111564
|
+
var tryToCatch = async (fn, ...args) => {
|
|
111565
|
+
check$a(fn);
|
|
111564
111566
|
|
|
111565
111567
|
try {
|
|
111566
111568
|
return [null, await fn(...args)];
|
|
@@ -111569,70 +111571,72 @@ var tryToCatch$1 = async (fn, ...args) => {
|
|
|
111569
111571
|
}
|
|
111570
111572
|
};
|
|
111571
111573
|
|
|
111572
|
-
function check$
|
|
111574
|
+
function check$a(fn) {
|
|
111573
111575
|
if (typeof fn !== 'function')
|
|
111574
111576
|
throw Error('fn should be a function!');
|
|
111575
111577
|
}
|
|
111576
111578
|
|
|
111577
|
-
var
|
|
111579
|
+
var tryToCatch$1 = tryToCatch.default;
|
|
111578
111580
|
|
|
111579
111581
|
// How in other way to mock import using mock require in CommonJS?
|
|
111580
|
-
simpleImport
|
|
111582
|
+
const simpleImport = async (url) => {
|
|
111581
111583
|
const result = await import(url);
|
|
111582
111584
|
return result.default || result;
|
|
111583
111585
|
};
|
|
111584
111586
|
|
|
111585
|
-
const
|
|
111586
|
-
const {join: join$3} = require$$0$2;
|
|
111587
|
-
const once$1 = onceExports;
|
|
111588
|
-
const {nanomemoize} = require$$3;
|
|
111589
|
-
const tryToCatch = tryToCatch$1;
|
|
111590
|
-
const {simpleImport} = simpleImport$1;
|
|
111587
|
+
const {createRequire: createRequire$1} = module$1;
|
|
111591
111588
|
|
|
111589
|
+
const require$1 = createRequire$1(import.meta.url);
|
|
111592
111590
|
const {assign: assign$3} = Object;
|
|
111593
111591
|
const stub$2 = () => () => {};
|
|
111594
111592
|
|
|
111595
|
-
|
|
111596
|
-
|
|
111597
|
-
|
|
111593
|
+
const createAsyncLoader = (type, overrides = {}) => {
|
|
111594
|
+
const {
|
|
111595
|
+
simpleImport: simpleImport$1 = simpleImport,
|
|
111596
|
+
} = overrides;
|
|
111598
111597
|
|
|
111599
|
-
|
|
111600
|
-
|
|
111598
|
+
return async (name) => {
|
|
111599
|
+
if (name === 'none')
|
|
111600
|
+
return stub$2();
|
|
111601
111601
|
|
|
111602
|
-
|
|
111603
|
-
|
|
111604
|
-
|
|
111605
|
-
|
|
111606
|
-
|
|
111607
|
-
|
|
111608
|
-
|
|
111609
|
-
|
|
111610
|
-
|
|
111611
|
-
|
|
111612
|
-
|
|
111613
|
-
|
|
111614
|
-
|
|
111615
|
-
|
|
111616
|
-
|
|
111617
|
-
|
|
111618
|
-
|
|
111619
|
-
|
|
111620
|
-
|
|
111602
|
+
if (name.startsWith('import:')) {
|
|
111603
|
+
const shortName = name.replace('import:', '');
|
|
111604
|
+
|
|
111605
|
+
return await cleverLoad([
|
|
111606
|
+
require$1.resolve(shortName),
|
|
111607
|
+
], simpleImport$1);
|
|
111608
|
+
}
|
|
111609
|
+
|
|
111610
|
+
const namesBase = [
|
|
111611
|
+
`@putout/${type}-${name}`,
|
|
111612
|
+
`putout-${type}-${name}`,
|
|
111613
|
+
];
|
|
111614
|
+
|
|
111615
|
+
const namesFromPluginsDirs = namesBase.flatMap(buildPluginsDirs);
|
|
111616
|
+
|
|
111617
|
+
const names = Array.from(new Set([
|
|
111618
|
+
...namesBase,
|
|
111619
|
+
...namesFromPluginsDirs,
|
|
111620
|
+
]));
|
|
111621
|
+
|
|
111622
|
+
return await cleverLoad(names, simpleImport$1);
|
|
111623
|
+
};
|
|
111624
|
+
};
|
|
111621
111625
|
|
|
111622
|
-
async function cleverLoad(names, load
|
|
111626
|
+
async function cleverLoad(names, load) {
|
|
111623
111627
|
let e;
|
|
111624
111628
|
let reporter;
|
|
111625
111629
|
|
|
111626
111630
|
for (const name of names) {
|
|
111627
|
-
[e, reporter] = await tryToCatch(load, name);
|
|
111631
|
+
[e, reporter] = await tryToCatch$1(load, name);
|
|
111628
111632
|
|
|
111629
111633
|
if (!e)
|
|
111630
111634
|
return reporter;
|
|
111631
111635
|
|
|
111632
111636
|
if (e.code === 'ERR_UNSUPPORTED_DIR_IMPORT') {
|
|
111633
|
-
const fullName = require.resolve(name);
|
|
111637
|
+
const fullName = require$1.resolve(name);
|
|
111634
111638
|
|
|
111635
|
-
[e, reporter] = await tryToCatch(load, fullName);
|
|
111639
|
+
[e, reporter] = await tryToCatch$1(load, fullName);
|
|
111636
111640
|
|
|
111637
111641
|
if (!e)
|
|
111638
111642
|
return reporter;
|
|
@@ -111655,7 +111659,7 @@ async function cleverLoad(names, load = simpleImport) {
|
|
|
111655
111659
|
throw e;
|
|
111656
111660
|
}
|
|
111657
111661
|
|
|
111658
|
-
const getPutoutLoadDir =
|
|
111662
|
+
const getPutoutLoadDir = () => browser$1$1.env.PUTOUT_LOAD_DIR;
|
|
111659
111663
|
|
|
111660
111664
|
function buildPluginsDirs(name) {
|
|
111661
111665
|
const dir = getPutoutLoadDir();
|
|
@@ -111671,15 +111675,11 @@ function buildPluginsDirs(name) {
|
|
|
111671
111675
|
];
|
|
111672
111676
|
}
|
|
111673
111677
|
|
|
111674
|
-
var validateRulesRelations$2 = {};
|
|
111675
|
-
|
|
111676
|
-
var parsePluginNames$2 = {};
|
|
111677
|
-
|
|
111678
111678
|
const isStr$4 = (a) => typeof a === 'string';
|
|
111679
111679
|
const {isArray: isArray$c} = Array;
|
|
111680
111680
|
const {entries: entries$9} = Object;
|
|
111681
111681
|
|
|
111682
|
-
parsePluginNames
|
|
111682
|
+
const parsePluginNames = (plugins) => {
|
|
111683
111683
|
const result = [];
|
|
111684
111684
|
|
|
111685
111685
|
for (const plugin of plugins) {
|
|
@@ -111700,8 +111700,6 @@ parsePluginNames$2.parsePluginNames = (plugins) => {
|
|
|
111700
111700
|
return result;
|
|
111701
111701
|
};
|
|
111702
111702
|
|
|
111703
|
-
var parseRules$2 = {};
|
|
111704
|
-
|
|
111705
111703
|
const {isArray: isArray$b} = Array;
|
|
111706
111704
|
const isBool$2 = (a) => typeof a === 'boolean';
|
|
111707
111705
|
const isStr$3 = (a) => typeof a === 'string';
|
|
@@ -111726,12 +111724,12 @@ const parseState = (rule, value) => {
|
|
|
111726
111724
|
return value;
|
|
111727
111725
|
};
|
|
111728
111726
|
|
|
111729
|
-
parseRules
|
|
111727
|
+
const parseRules = (rules) => {
|
|
111730
111728
|
const result = [];
|
|
111731
111729
|
const plugin = null;
|
|
111732
111730
|
const msg = '';
|
|
111733
111731
|
|
|
111734
|
-
check$
|
|
111732
|
+
check$9(rules);
|
|
111735
111733
|
|
|
111736
111734
|
for (const [rule, value] of entries$8(rules)) {
|
|
111737
111735
|
if (isStr$3(value)) {
|
|
@@ -111820,7 +111818,7 @@ function validateState(rule, value) {
|
|
|
111820
111818
|
|
|
111821
111819
|
const cut = (a) => a.split('/')[0];
|
|
111822
111820
|
|
|
111823
|
-
|
|
111821
|
+
const enableNestedRules = (rules) => {
|
|
111824
111822
|
const newRules = {};
|
|
111825
111823
|
|
|
111826
111824
|
for (const [rule, value] of entries$8(rules)) {
|
|
@@ -111833,16 +111831,14 @@ parseRules$2.enableNestedRules = (rules) => {
|
|
|
111833
111831
|
return newRules;
|
|
111834
111832
|
};
|
|
111835
111833
|
|
|
111836
|
-
function check$
|
|
111834
|
+
function check$9(rules) {
|
|
111837
111835
|
if (isArray$b(rules))
|
|
111838
111836
|
throw Error(`☝️Looks like type of 'rules' passed to @putout/engine-loader is 'array', expected: 'object'.`);
|
|
111839
111837
|
}
|
|
111840
111838
|
|
|
111841
|
-
var mergeRules$2 = {};
|
|
111842
|
-
|
|
111843
111839
|
const defaultOptions$3 = () => Object.create(null);
|
|
111844
111840
|
|
|
111845
|
-
mergeRules
|
|
111841
|
+
const mergeRules = ([rule, plugin], rules) => {
|
|
111846
111842
|
for (const currentRule of rules) {
|
|
111847
111843
|
if (currentRule.rule !== rule)
|
|
111848
111844
|
continue;
|
|
@@ -111865,8 +111861,6 @@ mergeRules$2.mergeRules = ([rule, plugin], rules) => {
|
|
|
111865
111861
|
};
|
|
111866
111862
|
};
|
|
111867
111863
|
|
|
111868
|
-
var validateRules$2 = {};
|
|
111869
|
-
|
|
111870
111864
|
const parseSlashes = (rule) => {
|
|
111871
111865
|
if (rule.includes('/'))
|
|
111872
111866
|
return rule
|
|
@@ -111882,7 +111876,7 @@ const parsePluginName = (a) => {
|
|
|
111882
111876
|
.replace('@putout/plugin-', '');
|
|
111883
111877
|
};
|
|
111884
111878
|
|
|
111885
|
-
validateRules
|
|
111879
|
+
const validateRules = ({items, rules}) => {
|
|
111886
111880
|
const ruleItems = Object.keys(rules);
|
|
111887
111881
|
|
|
111888
111882
|
for (const rule of ruleItems) {
|
|
@@ -111909,9 +111903,7 @@ validateRules$2.validateRules = ({items, rules}) => {
|
|
|
111909
111903
|
}
|
|
111910
111904
|
};
|
|
111911
111905
|
|
|
111912
|
-
|
|
111913
|
-
|
|
111914
|
-
isEnabled$4.isEnabled = (name, rules) => {
|
|
111906
|
+
const isEnabled = (name, rules) => {
|
|
111915
111907
|
for (const {rule, state} of rules) {
|
|
111916
111908
|
if (rule === name)
|
|
111917
111909
|
return state;
|
|
@@ -111930,9 +111922,7 @@ isEnabled$4.isEnabled = (name, rules) => {
|
|
|
111930
111922
|
return true;
|
|
111931
111923
|
};
|
|
111932
111924
|
|
|
111933
|
-
|
|
111934
|
-
|
|
111935
|
-
getLoadedRules$2.getLoadedRules = (rules) => {
|
|
111925
|
+
const getLoadedRules = (rules) => {
|
|
111936
111926
|
const loadedRules = [];
|
|
111937
111927
|
|
|
111938
111928
|
for (const item of rules) {
|
|
@@ -111947,43 +111937,23 @@ getLoadedRules$2.getLoadedRules = (rules) => {
|
|
|
111947
111937
|
return loadedRules;
|
|
111948
111938
|
};
|
|
111949
111939
|
|
|
111950
|
-
const {parseRules: parseRules$1} = parseRules$2;
|
|
111951
|
-
const {mergeRules: mergeRules$1} = mergeRules$2;
|
|
111952
|
-
const {validateRules: validateRules$1} = validateRules$2;
|
|
111953
|
-
const {isEnabled: isEnabled$3} = isEnabled$4;
|
|
111954
|
-
const {getLoadedRules: getLoadedRules$1} = getLoadedRules$2;
|
|
111955
|
-
|
|
111956
|
-
var rules = {
|
|
111957
|
-
parseRules: parseRules$1,
|
|
111958
|
-
mergeRules: mergeRules$1,
|
|
111959
|
-
validateRules: validateRules$1,
|
|
111960
|
-
isEnabled: isEnabled$3,
|
|
111961
|
-
getLoadedRules: getLoadedRules$1,
|
|
111962
|
-
};
|
|
111963
|
-
|
|
111964
|
-
var check$c = {};
|
|
111965
|
-
|
|
111966
111940
|
const isString$7 = (a) => typeof a === 'string';
|
|
111967
111941
|
|
|
111968
|
-
check$
|
|
111942
|
+
const check$8 = (options) => {
|
|
111969
111943
|
if (!options || typeof options !== 'object')
|
|
111970
111944
|
throw Error('options should be an object!');
|
|
111971
111945
|
};
|
|
111972
111946
|
|
|
111973
|
-
|
|
111947
|
+
const checkRule = (rule) => {
|
|
111974
111948
|
if (!isString$7(rule))
|
|
111975
111949
|
throw Error(`☝️ Looks like plugin name type is not 'string', but: '${typeof rule}'`);
|
|
111976
111950
|
};
|
|
111977
111951
|
|
|
111978
|
-
const
|
|
111979
|
-
|
|
111980
|
-
const {check: check$b} = check$c;
|
|
111981
|
-
|
|
111982
|
-
validateRulesRelations$2.validateRulesRelations = (options) => {
|
|
111983
|
-
check$b(options);
|
|
111952
|
+
const validateRulesRelations$1 = (options) => {
|
|
111953
|
+
check$8(options);
|
|
111984
111954
|
|
|
111985
111955
|
const {pluginNames = [], rules = {}} = options;
|
|
111986
|
-
const items = parsePluginNames
|
|
111956
|
+
const items = parsePluginNames(pluginNames);
|
|
111987
111957
|
|
|
111988
111958
|
validateRules({
|
|
111989
111959
|
rules,
|
|
@@ -111991,16 +111961,7 @@ validateRulesRelations$2.validateRulesRelations = (options) => {
|
|
|
111991
111961
|
});
|
|
111992
111962
|
};
|
|
111993
111963
|
|
|
111994
|
-
|
|
111995
|
-
|
|
111996
|
-
var prepareRules$2 = {};
|
|
111997
|
-
|
|
111998
|
-
const {parsePluginNames} = parsePluginNames$2;
|
|
111999
|
-
const {enableNestedRules} = parseRules$2;
|
|
112000
|
-
|
|
112001
|
-
const {parseRules, getLoadedRules} = rules;
|
|
112002
|
-
|
|
112003
|
-
prepareRules$2.prepareRules = ({rules, pluginNames}) => {
|
|
111964
|
+
const prepareRules = ({rules, pluginNames}) => {
|
|
112004
111965
|
const enabledRules = enableNestedRules(rules);
|
|
112005
111966
|
const cookedEnabledRules = parseRules(enabledRules);
|
|
112006
111967
|
const loadedRules = getLoadedRules(cookedEnabledRules);
|
|
@@ -112025,7 +111986,7 @@ const supportedKeys = [
|
|
|
112025
111986
|
'scan',
|
|
112026
111987
|
];
|
|
112027
111988
|
|
|
112028
|
-
var validatePlugin
|
|
111989
|
+
var validatePlugin = ({plugin, rule}) => {
|
|
112029
111990
|
const keys = Object.keys(plugin);
|
|
112030
111991
|
|
|
112031
111992
|
for (const key of supportedKeys) {
|
|
@@ -112036,10 +111997,6 @@ var validatePlugin$2 = ({plugin, rule}) => {
|
|
|
112036
111997
|
throw Error(`☝️ Cannot determine type of plugin '${rule}'. Here is list of supported plugins: https://git.io/JqcMn`);
|
|
112037
111998
|
};
|
|
112038
111999
|
|
|
112039
|
-
var filterEnabledPlugins$2 = {};
|
|
112040
|
-
|
|
112041
|
-
const {isEnabled: isEnabled$2, mergeRules} = rules;
|
|
112042
|
-
|
|
112043
112000
|
const {isArray: isArray$a} = Array;
|
|
112044
112001
|
const maybeTuple = (a) => isArray$a(a) ? a : ['on', a];
|
|
112045
112002
|
|
|
@@ -112048,11 +112005,11 @@ const maybeTuple = (a) => isArray$a(a) ? a : ['on', a];
|
|
|
112048
112005
|
// but we can't because of a way multi-rule plugins
|
|
112049
112006
|
// works. We can't determine count and names of all
|
|
112050
112007
|
// rules of a plugin before load.
|
|
112051
|
-
filterEnabledPlugins
|
|
112008
|
+
const filterEnabledPlugins = ({plugins, cookedRules}) => {
|
|
112052
112009
|
const result = [];
|
|
112053
112010
|
|
|
112054
112011
|
for (const [name, plugin] of plugins) {
|
|
112055
|
-
if (!isEnabled
|
|
112012
|
+
if (!isEnabled(name, cookedRules))
|
|
112056
112013
|
continue;
|
|
112057
112014
|
|
|
112058
112015
|
const [status, currentPlugin] = maybeTuple(plugin);
|
|
@@ -112081,39 +112038,27 @@ function isExactRuleEnabled(name, status, rules) {
|
|
|
112081
112038
|
return false;
|
|
112082
112039
|
}
|
|
112083
112040
|
|
|
112084
|
-
const
|
|
112085
|
-
|
|
112086
|
-
const {isEnabled: isEnabled$1} = rules;
|
|
112087
|
-
|
|
112088
|
-
const {prepareRules: prepareRules$1} = prepareRules$2;
|
|
112089
|
-
|
|
112090
|
-
const validatePlugin$1 = validatePlugin$2;
|
|
112091
|
-
const {filterEnabledPlugins: filterEnabledPlugins$1} = filterEnabledPlugins$2;
|
|
112092
|
-
|
|
112093
|
-
const {createAsyncLoader: createAsyncLoader$2} = asyncLoader;
|
|
112094
|
-
const {check: check$a, checkRule: checkRule$1} = check$c;
|
|
112041
|
+
const loadPluginAsync = createAsyncLoader('plugin');
|
|
112095
112042
|
|
|
112096
|
-
const
|
|
112097
|
-
|
|
112098
|
-
loadPluginsAsync$1.loadPluginsAsync = async (options) => {
|
|
112099
|
-
check$a(options);
|
|
112043
|
+
const loadPluginsAsync = async (options) => {
|
|
112044
|
+
check$8(options);
|
|
112100
112045
|
|
|
112101
112046
|
const {pluginNames = [], rules = {}} = options;
|
|
112102
112047
|
const {
|
|
112103
112048
|
items,
|
|
112104
112049
|
loadedRules,
|
|
112105
112050
|
cookedRules,
|
|
112106
|
-
} = prepareRules
|
|
112051
|
+
} = prepareRules({
|
|
112107
112052
|
rules,
|
|
112108
112053
|
pluginNames,
|
|
112109
112054
|
});
|
|
112110
112055
|
|
|
112111
|
-
const plugins = await loadPlugins$
|
|
112056
|
+
const plugins = await loadPlugins$1({
|
|
112112
112057
|
items,
|
|
112113
112058
|
loadedRules,
|
|
112114
112059
|
});
|
|
112115
112060
|
|
|
112116
|
-
return filterEnabledPlugins
|
|
112061
|
+
return filterEnabledPlugins({
|
|
112117
112062
|
plugins,
|
|
112118
112063
|
cookedRules,
|
|
112119
112064
|
});
|
|
@@ -112121,15 +112066,15 @@ loadPluginsAsync$1.loadPluginsAsync = async (options) => {
|
|
|
112121
112066
|
|
|
112122
112067
|
const splitRule$1 = (rule) => [rule, 'putout'];
|
|
112123
112068
|
|
|
112124
|
-
async function loadPlugins$
|
|
112069
|
+
async function loadPlugins$1({items, loadedRules}) {
|
|
112125
112070
|
const promises = [];
|
|
112126
112071
|
const enabledRules = [];
|
|
112127
112072
|
|
|
112128
112073
|
for (const [rule, itemPlugin] of items) {
|
|
112129
|
-
if (!isEnabled
|
|
112074
|
+
if (!isEnabled(rule, loadedRules))
|
|
112130
112075
|
continue;
|
|
112131
112076
|
|
|
112132
|
-
checkRule
|
|
112077
|
+
checkRule(rule);
|
|
112133
112078
|
|
|
112134
112079
|
const [name] = splitRule$1(rule);
|
|
112135
112080
|
const plugin = itemPlugin || loadPluginAsync(name);
|
|
@@ -112144,7 +112089,7 @@ async function loadPlugins$3({items, loadedRules}) {
|
|
|
112144
112089
|
for (const [i, rule] of enabledRules.entries()) {
|
|
112145
112090
|
const plugin = resolvedPlugins[i];
|
|
112146
112091
|
|
|
112147
|
-
validatePlugin
|
|
112092
|
+
validatePlugin({
|
|
112148
112093
|
plugin,
|
|
112149
112094
|
rule,
|
|
112150
112095
|
});
|
|
@@ -112183,134 +112128,11 @@ function parseRuleName(rule) {
|
|
|
112183
112128
|
return rule;
|
|
112184
112129
|
}
|
|
112185
112130
|
|
|
112186
|
-
|
|
112187
|
-
|
|
112188
|
-
var load$1 = {};
|
|
112189
|
-
|
|
112190
|
-
var _polyfillNode_module = {};
|
|
112191
|
-
|
|
112192
|
-
var _polyfillNode_module$1 = /*#__PURE__*/Object.freeze({
|
|
112193
|
-
__proto__: null,
|
|
112194
|
-
default: _polyfillNode_module
|
|
112195
|
-
});
|
|
112196
|
-
|
|
112197
|
-
var require$$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_module$1);
|
|
112198
|
-
|
|
112199
|
-
var hasRequiredLoad;
|
|
112200
|
-
|
|
112201
|
-
function requireLoad () {
|
|
112202
|
-
if (hasRequiredLoad) return load$1;
|
|
112203
|
-
hasRequiredLoad = 1;
|
|
112204
|
-
|
|
112205
|
-
const process = require$$0$3;
|
|
112206
|
-
const {createRequire} = require$$1;
|
|
112207
|
-
const {join} = require$$0$2;
|
|
112208
|
-
const tryCatch = tryCatch$7;
|
|
112209
|
-
const once = onceExports;
|
|
112210
|
-
const {assign} = Object;
|
|
112211
|
-
|
|
112212
|
-
const bigFirst = (a) => `${a[0].toUpperCase()}${a.slice(1)}`;
|
|
112213
|
-
|
|
112214
|
-
const load = (type) => ({name, namespace}) => {
|
|
112215
|
-
const [pluginPath, customRequire] = getPath(namespace, type, name);
|
|
112216
|
-
|
|
112217
|
-
if (!pluginPath)
|
|
112218
|
-
throw Error(`${bigFirst(type)} "${namespace}-${type}-${name}" could not be found!`);
|
|
112219
|
-
|
|
112220
|
-
const [error, result] = tryCatch(customRequire, pluginPath);
|
|
112221
|
-
|
|
112222
|
-
/* c8 ignore start */
|
|
112223
|
-
if (error?.code === 'ERR_REQUIRE_ESM')
|
|
112224
|
-
assign(error, {
|
|
112225
|
-
message: `☝️ Looks like '${name}' is ESM, use 'await putoutAsync()' instead`,
|
|
112226
|
-
name,
|
|
112227
|
-
});
|
|
112228
|
-
|
|
112229
|
-
/* c8 ignore end */
|
|
112230
|
-
if (error)
|
|
112231
|
-
throw error;
|
|
112232
|
-
|
|
112233
|
-
return result;
|
|
112234
|
-
};
|
|
112235
|
-
|
|
112236
|
-
load$1.loadPlugin = load('plugin');
|
|
112237
|
-
load$1.loadProcessor = load('processor');
|
|
112238
|
-
|
|
112239
|
-
function getPath(namespace, type, name) {
|
|
112240
|
-
if (name.startsWith('import:'))
|
|
112241
|
-
return getModulePath(name.replace('import:', ''));
|
|
112242
|
-
|
|
112243
|
-
let [path, customRequire] = getModulePath(`@${namespace}/${type}-${name}`);
|
|
112244
|
-
|
|
112245
|
-
if (!path)
|
|
112246
|
-
[path, customRequire] = getModulePath(`${namespace}-${type}-${name}`);
|
|
112247
|
-
|
|
112248
|
-
if (!path)
|
|
112249
|
-
[path, customRequire] = getModulePath(name);
|
|
112250
|
-
|
|
112251
|
-
return [path, customRequire];
|
|
112252
|
-
}
|
|
112253
|
-
|
|
112254
|
-
const {
|
|
112255
|
-
PUTOUT_YARN_PNP = 'putout',
|
|
112256
|
-
} = {};
|
|
112257
|
-
|
|
112258
|
-
const createCustomRequire = once(() => createRequire(require.resolve(PUTOUT_YARN_PNP)));
|
|
112259
|
-
const createPutoutRequire = once(() => createRequire(require.resolve('putout')));
|
|
112260
|
-
|
|
112261
|
-
// That's all for Yarn P'n'P
|
|
112262
|
-
//
|
|
112263
|
-
// We need to create a couple version of require for plugins, formatters and processors:
|
|
112264
|
-
// - declared in 🐊Putout package.json;
|
|
112265
|
-
// - declared in module that want to extend 🐊Putout;
|
|
112266
|
-
//
|
|
112267
|
-
// https://yarnpkg.com/advanced/rulebook#modules-shouldnt-hardcode-node_modules-paths-to-access-other-modules
|
|
112268
|
-
function getModulePath(name, {again = false} = {}) {
|
|
112269
|
-
let path;
|
|
112270
|
-
|
|
112271
|
-
const customRequire = createCustomRequire();
|
|
112272
|
-
const putoutRequire = createPutoutRequire();
|
|
112273
|
-
|
|
112274
|
-
[, path] = tryCatch(putoutRequire.resolve, name);
|
|
112275
|
-
|
|
112276
|
-
if (path)
|
|
112277
|
-
return [path, putoutRequire];
|
|
112278
|
-
|
|
112279
|
-
[, path] = tryCatch(customRequire.resolve, name);
|
|
112280
|
-
|
|
112281
|
-
if (!path && !again)
|
|
112282
|
-
return getModulePath(buildPluginsDir(name), {
|
|
112283
|
-
again: true,
|
|
112284
|
-
});
|
|
112285
|
-
|
|
112286
|
-
return [path, customRequire];
|
|
112287
|
-
}
|
|
112288
|
-
|
|
112289
|
-
const getPutoutLoadDir = once(() => process.env.PUTOUT_LOAD_DIR);
|
|
112290
|
-
|
|
112291
|
-
function buildPluginsDir(name) {
|
|
112292
|
-
const dir = getPutoutLoadDir();
|
|
112293
|
-
|
|
112294
|
-
if (!dir)
|
|
112295
|
-
return name;
|
|
112296
|
-
|
|
112297
|
-
return join(dir, name);
|
|
112298
|
-
}
|
|
112299
|
-
return load$1;
|
|
112300
|
-
}
|
|
112301
|
-
|
|
112302
|
-
const validatePlugin = validatePlugin$2;
|
|
112303
|
-
const {prepareRules} = prepareRules$2;
|
|
112304
|
-
|
|
112305
|
-
const {isEnabled} = rules;
|
|
112306
|
-
|
|
112307
|
-
const {filterEnabledPlugins} = filterEnabledPlugins$2;
|
|
112308
|
-
const {check: check$9, checkRule} = check$c;
|
|
112309
|
-
|
|
112131
|
+
const {createRequire} = module$1;
|
|
112310
112132
|
const {isArray: isArray$9} = Array;
|
|
112311
112133
|
|
|
112312
|
-
loadPlugins
|
|
112313
|
-
check$
|
|
112134
|
+
const loadPlugins = (options) => {
|
|
112135
|
+
check$8(options);
|
|
112314
112136
|
|
|
112315
112137
|
const {pluginNames = [], rules = {}} = options;
|
|
112316
112138
|
const {
|
|
@@ -112322,7 +112144,7 @@ loadPlugins$2.loadPlugins = (options) => {
|
|
|
112322
112144
|
pluginNames,
|
|
112323
112145
|
});
|
|
112324
112146
|
|
|
112325
|
-
const plugins =
|
|
112147
|
+
const plugins = loadAllPlugins({
|
|
112326
112148
|
items,
|
|
112327
112149
|
loadedRules,
|
|
112328
112150
|
});
|
|
@@ -112341,7 +112163,7 @@ const parseRule = (rule) => rule
|
|
|
112341
112163
|
|
|
112342
112164
|
const maybeFromTuple = (a) => isArray$9(a) ? a[1] : a;
|
|
112343
112165
|
|
|
112344
|
-
function
|
|
112166
|
+
function loadAllPlugins({items, loadedRules}) {
|
|
112345
112167
|
const plugins = [];
|
|
112346
112168
|
|
|
112347
112169
|
for (const [rule, itemPlugin] of items) {
|
|
@@ -112352,7 +112174,7 @@ function loadPlugins$1({items, loadedRules}) {
|
|
|
112352
112174
|
const parsedRule = parseRule(rule);
|
|
112353
112175
|
|
|
112354
112176
|
const [name, namespace] = splitRule(rule);
|
|
112355
|
-
const plugin = maybeFromTuple(itemPlugin) ||
|
|
112177
|
+
const plugin = maybeFromTuple(itemPlugin) || loadOnePlugin({
|
|
112356
112178
|
name,
|
|
112357
112179
|
namespace,
|
|
112358
112180
|
});
|
|
@@ -112388,8 +112210,9 @@ function extendRules(rule, plugin) {
|
|
|
112388
112210
|
|
|
112389
112211
|
// add support of esm.sh
|
|
112390
112212
|
// https://github.com/esm-dev/esm.sh/issues/1045
|
|
112391
|
-
function
|
|
112392
|
-
const
|
|
112213
|
+
function loadOnePlugin({name, namespace}) {
|
|
112214
|
+
const require = createRequire(import.meta.url);
|
|
112215
|
+
const {loadPlugin} = require('../load/load.js');
|
|
112393
112216
|
|
|
112394
112217
|
return loadPlugin({
|
|
112395
112218
|
name,
|
|
@@ -112397,15 +112220,13 @@ function loadPlugin({name, namespace}) {
|
|
|
112397
112220
|
});
|
|
112398
112221
|
}
|
|
112399
112222
|
|
|
112400
|
-
var loadProcessorsAsync$1 = {};
|
|
112401
|
-
|
|
112402
112223
|
const isStr$2 = (a) => typeof a === 'string';
|
|
112403
112224
|
const {isArray: isArray$8} = Array;
|
|
112404
112225
|
|
|
112405
112226
|
const isOn = (a) => a === 'on';
|
|
112406
112227
|
const isOff = (a) => a === 'off';
|
|
112407
112228
|
|
|
112408
|
-
var parseProcessorNames
|
|
112229
|
+
var parseProcessorNames = (plugins) => {
|
|
112409
112230
|
const result = [];
|
|
112410
112231
|
|
|
112411
112232
|
for (const plugin of plugins) {
|
|
@@ -112433,18 +112254,15 @@ var parseProcessorNames$1 = (plugins) => {
|
|
|
112433
112254
|
return result;
|
|
112434
112255
|
};
|
|
112435
112256
|
|
|
112436
|
-
const
|
|
112437
|
-
|
|
112438
|
-
const parseProcessorNames = parseProcessorNames$1;
|
|
112439
|
-
|
|
112440
|
-
const {check: check$8} = check$c;
|
|
112441
|
-
|
|
112442
|
-
loadProcessorsAsync$1.loadProcessorsAsync = async (options, load) => {
|
|
112257
|
+
const loadProcessorsAsync = async (options, simpleImport) => {
|
|
112443
112258
|
check$8(options);
|
|
112444
112259
|
|
|
112445
112260
|
const {processors = []} = options;
|
|
112446
112261
|
const parsedProcessors = parseProcessorNames(processors);
|
|
112447
|
-
|
|
112262
|
+
|
|
112263
|
+
const loadProcessor = createAsyncLoader('processor', {
|
|
112264
|
+
simpleImport,
|
|
112265
|
+
});
|
|
112448
112266
|
|
|
112449
112267
|
const list = [];
|
|
112450
112268
|
|
|
@@ -112454,24 +112272,22 @@ loadProcessorsAsync$1.loadProcessorsAsync = async (options, load) => {
|
|
|
112454
112272
|
continue;
|
|
112455
112273
|
}
|
|
112456
112274
|
|
|
112457
|
-
list.push(loadProcessor(name
|
|
112275
|
+
list.push(loadProcessor(name));
|
|
112458
112276
|
}
|
|
112459
112277
|
|
|
112460
112278
|
return await Promise.all(list);
|
|
112461
112279
|
};
|
|
112462
112280
|
|
|
112463
|
-
|
|
112464
|
-
|
|
112465
|
-
|
|
112466
|
-
|
|
112467
|
-
|
|
112468
|
-
|
|
112281
|
+
var lib$1 = /*#__PURE__*/Object.freeze({
|
|
112282
|
+
__proto__: null,
|
|
112283
|
+
createAsyncLoader: createAsyncLoader,
|
|
112284
|
+
loadPlugins: loadPlugins,
|
|
112285
|
+
loadPluginsAsync: loadPluginsAsync,
|
|
112286
|
+
loadProcessorsAsync: loadProcessorsAsync,
|
|
112287
|
+
validateRulesRelations: validateRulesRelations$1
|
|
112288
|
+
});
|
|
112469
112289
|
|
|
112470
|
-
|
|
112471
|
-
lib$1.loadPluginsAsync = loadPluginsAsync;
|
|
112472
|
-
lib$1.loadProcessorsAsync = loadProcessorsAsync;
|
|
112473
|
-
lib$1.createAsyncLoader = createAsyncLoader;
|
|
112474
|
-
lib$1.validateRulesRelations = validateRulesRelations$1;
|
|
112290
|
+
var require$$1 = /*@__PURE__*/getAugmentedNamespace(lib$1);
|
|
112475
112291
|
|
|
112476
112292
|
var lib = {};
|
|
112477
112293
|
|
|
@@ -112745,20 +112561,22 @@ var browser = /*#__PURE__*/Object.freeze({
|
|
|
112745
112561
|
namespaces: namespaces
|
|
112746
112562
|
});
|
|
112747
112563
|
|
|
112748
|
-
var require$$0$
|
|
112564
|
+
var require$$0$2 = /*@__PURE__*/getAugmentedNamespace(browser);
|
|
112749
112565
|
|
|
112750
|
-
const {createDebug: createDebug$8} = require$$0$
|
|
112566
|
+
const {createDebug: createDebug$8} = require$$0$2;
|
|
112751
112567
|
|
|
112752
112568
|
debug$6.createDebug = (namespace) => {
|
|
112753
|
-
const log = createDebug$8(namespace
|
|
112569
|
+
const log = createDebug$8(namespace, {
|
|
112570
|
+
useColors: true,
|
|
112571
|
+
});
|
|
112754
112572
|
|
|
112755
112573
|
return new Proxy(log, {
|
|
112756
112574
|
apply(target, thisArg, args) {
|
|
112757
|
-
|
|
112575
|
+
globalThis.__putout_debug?.(namespace, ...args);
|
|
112758
112576
|
return target(...args);
|
|
112759
112577
|
},
|
|
112760
112578
|
get(target, prop) {
|
|
112761
|
-
if (
|
|
112579
|
+
if (globalThis.__putout_debug?.[prop])
|
|
112762
112580
|
return true;
|
|
112763
112581
|
|
|
112764
112582
|
return target[prop];
|
|
@@ -113830,7 +113648,7 @@ var log$5 = {exports: {}};
|
|
|
113830
113648
|
|
|
113831
113649
|
var debug$4 = {};
|
|
113832
113650
|
|
|
113833
|
-
const {createDebug: createDebug$6} = require$$0$
|
|
113651
|
+
const {createDebug: createDebug$6} = require$$0$2;
|
|
113834
113652
|
|
|
113835
113653
|
debug$4.createDebug = (namespace) => {
|
|
113836
113654
|
const log = createDebug$6(namespace);
|
|
@@ -114959,9 +114777,9 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
|
|
|
114959
114777
|
default: EventEmitter$1
|
|
114960
114778
|
});
|
|
114961
114779
|
|
|
114962
|
-
var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
|
|
114780
|
+
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
|
|
114963
114781
|
|
|
114964
|
-
const {EventEmitter} = require$$0;
|
|
114782
|
+
const {EventEmitter} = require$$0$1;
|
|
114965
114783
|
|
|
114966
114784
|
progress.createProgress = () => {
|
|
114967
114785
|
let pluginsCount = 0;
|
|
@@ -115714,6 +115532,8 @@ var scanner = {};
|
|
|
115714
115532
|
|
|
115715
115533
|
var filesystem = {};
|
|
115716
115534
|
|
|
115535
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_path$1);
|
|
115536
|
+
|
|
115717
115537
|
var maybeFs = {};
|
|
115718
115538
|
|
|
115719
115539
|
const fullstore$1 = fullstore$3;
|
|
@@ -115817,7 +115637,7 @@ const {
|
|
|
115817
115637
|
join: join$2,
|
|
115818
115638
|
basename: basename$1,
|
|
115819
115639
|
dirname: dirname$1,
|
|
115820
|
-
} = require$$0
|
|
115640
|
+
} = require$$0;
|
|
115821
115641
|
|
|
115822
115642
|
const {types: types$8} = bundle$1;
|
|
115823
115643
|
const tryCatch$1 = tryCatch$7;
|
|
@@ -116258,7 +116078,7 @@ filesystem.start = maybeFS.start;
|
|
|
116258
116078
|
|
|
116259
116079
|
var convertSimpleFilesystemToFilesystem = {};
|
|
116260
116080
|
|
|
116261
|
-
const {basename, dirname} = require$$0
|
|
116081
|
+
const {basename, dirname} = require$$0;
|
|
116262
116082
|
const {types: types$7} = bundle$1;
|
|
116263
116083
|
const {
|
|
116264
116084
|
createDirectory,
|
|
@@ -116823,7 +116643,7 @@ function splitPlugins(plugins, {progress}) {
|
|
|
116823
116643
|
};
|
|
116824
116644
|
}
|
|
116825
116645
|
|
|
116826
|
-
const loader =
|
|
116646
|
+
const loader = require$$1;
|
|
116827
116647
|
const runner = lib;
|
|
116828
116648
|
const {createProgress} = progress;
|
|
116829
116649
|
|
|
@@ -116877,7 +116697,7 @@ const cutBrackets = (a) => a.replace(/\s\(\d:\d+\)/, '');
|
|
|
116877
116697
|
|
|
116878
116698
|
const tryCatch = tryCatch$7;
|
|
116879
116699
|
|
|
116880
|
-
const {validateRulesRelations} =
|
|
116700
|
+
const {validateRulesRelations} = require$$1;
|
|
116881
116701
|
const {defaultOptions: defaultOptions$1} = defaultOptions$5;
|
|
116882
116702
|
const {cutShebang: cutShebang$1} = shebang;
|
|
116883
116703
|
const parseError$1 = parseError$2;
|
|
@@ -124659,8 +124479,8 @@ keyword.isTSKeyword = (name) => {
|
|
|
124659
124479
|
|
|
124660
124480
|
var matchFiles = {};
|
|
124661
124481
|
|
|
124662
|
-
const {relative} = require$$0
|
|
124663
|
-
const ignore$1 = require$$1$
|
|
124482
|
+
const {relative} = require$$0;
|
|
124483
|
+
const ignore$1 = require$$1$2;
|
|
124664
124484
|
|
|
124665
124485
|
const isNegative = (a) => !a.indexOf('!');
|
|
124666
124486
|
const positive = (a) => a.replace(/^!/, '');
|
|
@@ -124690,7 +124510,7 @@ function mergeIgnores(ignores) {
|
|
|
124690
124510
|
|
|
124691
124511
|
ignores$2.default;
|
|
124692
124512
|
|
|
124693
|
-
const path = require$$0
|
|
124513
|
+
const path = require$$0;
|
|
124694
124514
|
|
|
124695
124515
|
const {parse: parse$2, print: print$1} = parser$5;
|
|
124696
124516
|
const {transform: transform$1} = transform$5;
|
|
@@ -124827,7 +124647,7 @@ const createScan = ({files, exclude, defaultFilename}) => (mainPath, {push, prog
|
|
|
124827
124647
|
};
|
|
124828
124648
|
|
|
124829
124649
|
function magicParse(name, content) {
|
|
124830
|
-
if (
|
|
124650
|
+
if (name.endsWith('.json')) {
|
|
124831
124651
|
const js = toJS(content);
|
|
124832
124652
|
const ast = parse$2(js);
|
|
124833
124653
|
|
|
@@ -124846,7 +124666,7 @@ function magicParse(name, content) {
|
|
|
124846
124666
|
}
|
|
124847
124667
|
|
|
124848
124668
|
function magicPrint(name, ast) {
|
|
124849
|
-
if (
|
|
124669
|
+
if (name.endsWith('.json')) {
|
|
124850
124670
|
const js = print$1(ast);
|
|
124851
124671
|
|
|
124852
124672
|
return fromJS(js);
|
|
@@ -124906,7 +124726,7 @@ function parseOptions(inputFilename, rawOptions) {
|
|
|
124906
124726
|
|
|
124907
124727
|
var renameFiles = {};
|
|
124908
124728
|
|
|
124909
|
-
const {join} = require$$0
|
|
124729
|
+
const {join} = require$$0;
|
|
124910
124730
|
|
|
124911
124731
|
const {
|
|
124912
124732
|
getParentDirectory,
|