@putout/bundle 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bundle/plugin-putout.js +57 -26
- package/bundle/putout.js +7416 -4758
- package/package.json +5 -5
package/README.md
CHANGED
package/bundle/plugin-putout.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import require$$0$1 from '@putout/bundle';
|
|
2
2
|
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
3
18
|
var addArgs_1;
|
|
4
19
|
var hasRequiredAddArgs;
|
|
5
20
|
|
|
@@ -492,8 +507,8 @@ function requireConvertBabelTypes () {
|
|
|
492
507
|
const {replaceWith} = operator;
|
|
493
508
|
|
|
494
509
|
const astRequire = template.ast(`
|
|
495
|
-
|
|
496
|
-
|
|
510
|
+
require('putout').types
|
|
511
|
+
`);
|
|
497
512
|
|
|
498
513
|
convertBabelTypes.report = () => {
|
|
499
514
|
return `"putout.types" should be used instead of "@babel/types"`;
|
|
@@ -831,8 +846,16 @@ function requireConvertNumberToNumeric () {
|
|
|
831
846
|
convertNumberToNumeric.report = () => `Use 'isNumericLiteral()' instead of 'isNumberLiteral()'`;
|
|
832
847
|
|
|
833
848
|
convertNumberToNumeric.fix = (path) => {
|
|
834
|
-
path.scope.
|
|
835
|
-
path.
|
|
849
|
+
const bindings = path.scope.getAllBindings();
|
|
850
|
+
const {name} = path.node.callee;
|
|
851
|
+
|
|
852
|
+
if (!bindings.isNumericLiteral)
|
|
853
|
+
path.scope.rename('isNumberLiteral', 'isNumericLiteral');
|
|
854
|
+
|
|
855
|
+
if (!bindings.NumericLiteral)
|
|
856
|
+
path.scope.rename('NumberLiteral', 'NumericLiteral');
|
|
857
|
+
|
|
858
|
+
path.node.callee.name = name.replace('Number', 'Numeric');
|
|
836
859
|
};
|
|
837
860
|
|
|
838
861
|
convertNumberToNumeric.traverse = ({push}) => ({
|
|
@@ -1002,8 +1025,8 @@ function requireConvertReplaceWith () {
|
|
|
1002
1025
|
|
|
1003
1026
|
if (!bindings.replaceWithMultiple && !bindings.insertAfter && !isInserted()) {
|
|
1004
1027
|
const replaceWithAST = template.ast.fresh(`
|
|
1005
|
-
|
|
1006
|
-
|
|
1028
|
+
const {replaceWith} = require('putout').operator;
|
|
1029
|
+
`);
|
|
1007
1030
|
|
|
1008
1031
|
const {types} = bindings;
|
|
1009
1032
|
const pathToInsertAfter = types ? types.path.parentPath : strictModePath;
|
|
@@ -1093,8 +1116,8 @@ function requireConvertReplaceWithMultiple () {
|
|
|
1093
1116
|
};
|
|
1094
1117
|
|
|
1095
1118
|
const replaceWithAST = template.ast(`
|
|
1096
|
-
|
|
1097
|
-
|
|
1119
|
+
const {replaceWithMultiple} = require('putout').operate;
|
|
1120
|
+
`);
|
|
1098
1121
|
|
|
1099
1122
|
convertReplaceWithMultiple.fix = ({path, calleePath, property, object, program}) => {
|
|
1100
1123
|
const strictModePath = program.get('body.0');
|
|
@@ -2821,16 +2844,16 @@ function requireMoveRequireOnTopLevel () {
|
|
|
2821
2844
|
} = require$$0$1;
|
|
2822
2845
|
|
|
2823
2846
|
const TEST = `
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2847
|
+
const test = require('@putout/test')(__dirname, {
|
|
2848
|
+
__a: __b
|
|
2849
|
+
});
|
|
2850
|
+
`;
|
|
2828
2851
|
|
|
2829
2852
|
const TRANSFORM = `
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2853
|
+
t.transform(__c, {
|
|
2854
|
+
__a: __b
|
|
2855
|
+
});
|
|
2856
|
+
`;
|
|
2834
2857
|
|
|
2835
2858
|
const {
|
|
2836
2859
|
Identifier,
|
|
@@ -2852,10 +2875,10 @@ function requireMoveRequireOnTopLevel () {
|
|
|
2852
2875
|
const value = __a.value || __a.name;
|
|
2853
2876
|
|
|
2854
2877
|
return `
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2878
|
+
const test = require('@putout/test')(__dirname, {
|
|
2879
|
+
'${value}': ${name},
|
|
2880
|
+
});
|
|
2881
|
+
`;
|
|
2859
2882
|
},
|
|
2860
2883
|
[TRANSFORM]: (vars, path) => {
|
|
2861
2884
|
const name = declareRequire(vars, path);
|
|
@@ -2863,10 +2886,10 @@ function requireMoveRequireOnTopLevel () {
|
|
|
2863
2886
|
const value = __a.value || __a.name;
|
|
2864
2887
|
|
|
2865
2888
|
return `
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2889
|
+
t.transform(__c, {
|
|
2890
|
+
'${value}': ${name},
|
|
2891
|
+
});
|
|
2892
|
+
`;
|
|
2870
2893
|
},
|
|
2871
2894
|
});
|
|
2872
2895
|
|
|
@@ -3190,11 +3213,13 @@ function normalize (path) {
|
|
|
3190
3213
|
return path;
|
|
3191
3214
|
}
|
|
3192
3215
|
|
|
3216
|
+
var lib = {};
|
|
3217
|
+
|
|
3193
3218
|
const getRule = (a) => ({
|
|
3194
3219
|
[a]: createCommonjsRequire("/node_modules/@putout/plugin-putout/lib")(`./${a}`),
|
|
3195
3220
|
});
|
|
3196
3221
|
|
|
3197
|
-
var rules = {
|
|
3222
|
+
var rules = lib.rules = {
|
|
3198
3223
|
...getRule('apply-processors-destructuring'),
|
|
3199
3224
|
...getRule('apply-async-formatter'),
|
|
3200
3225
|
...getRule('apply-create-test'),
|
|
@@ -3230,4 +3255,10 @@ var rules = {
|
|
|
3230
3255
|
...getRule('includer'),
|
|
3231
3256
|
};
|
|
3232
3257
|
|
|
3233
|
-
|
|
3258
|
+
var pluginPutout = /*#__PURE__*/_mergeNamespaces({
|
|
3259
|
+
__proto__: null,
|
|
3260
|
+
rules: rules,
|
|
3261
|
+
'default': lib
|
|
3262
|
+
}, [lib]);
|
|
3263
|
+
|
|
3264
|
+
export { pluginPutout as default };
|