putout 20.17.0 → 20.19.2

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/ChangeLog CHANGED
@@ -1,3 +1,37 @@
1
+ 2021.10.29, v20.19.2
2
+
3
+ fix:
4
+ - (putout) --help: plugins list -> plugins
5
+
6
+
7
+ 2021.10.29, v20.19.1
8
+
9
+ fix:
10
+ - (putout) --help: --match [file name] -> --match [pattern]
11
+
12
+
13
+ 2021.10.28, v20.19.0
14
+
15
+ fix:
16
+ - (@putout/plugin-remove-unused-variables) add support of computed key
17
+
18
+ feature:
19
+ - (package) @putout/processor-yaml v3.0.0
20
+ - (@putout/processor-yaml) drop support of putout < 20
21
+ - (@putout/processor-yaml) js-yaml -> yaml: useless quotes (nodeca/js-yaml#645)
22
+ - (eslint-plugin-putout) safe: disable remove-unused-types
23
+
24
+
25
+ 2021.10.22, v20.18.0
26
+
27
+ feature:
28
+ - (putout) loader: add support of node v16.12 (https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V16.md#16.12.0)
29
+ - (@putout/plugin-declare-undefined-variables) add support of stream
30
+ - (@putout/plugin-declare-undefined-variables) add support of module
31
+ - (eslint-plugin-putout) no-unresolved: disable for TS
32
+ - (@putout/plugin-convert-generic-to-shorthand) exclude TSUnionType
33
+
34
+
1
35
  2021.10.21, v20.17.0
2
36
 
3
37
  fix:
package/README.md CHANGED
@@ -1,11 +1,9 @@
1
- # Putout [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
1
+ # Putout [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
2
2
 
3
3
  [NPMIMGURL]: https://img.shields.io/npm/v/putout.svg?style=flat&longCache=true
4
4
  [BuildStatusIMGURL]: https://github.com/coderaiser/putout/workflows/Node%20CI/badge.svg
5
- [DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/putout
6
5
  [NPMURL]: https://npmjs.org/package/putout "npm"
7
6
  [BuildStatusURL]: https://github.com/coderaiser/putout/actions?query=workflow%3A%22Node+CI%22 "Build Status"
8
- [DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/putout "Dependency Status"
9
7
  [CoverageURL]: https://coveralls.io/github/coderaiser/putout?branch=master
10
8
  [CoverageIMGURL]: https://coveralls.io/repos/coderaiser/putout/badge.svg?branch=master&service=github
11
9
 
@@ -116,12 +114,12 @@ Options:
116
114
  --fix-count [count = 10] count of fixes rounds
117
115
  --rulesdir use additional rules from directory
118
116
  --transform [replacer] apply Replacer, for example 'var __a = __b -> const __a = __b', read about Replacer https://git.io/JqcMn
119
- --plugins [plugins list] a comma-separated list of plugins to use
117
+ --plugins [plugins] a comma-separated list of plugins to use
120
118
  --enable [rule] enable the rule and save it to '.putout.json' walking up parent directories
121
119
  --disable [rule] disable the rule and save it to '.putout.json' walking up parent directories
122
120
  --enable-all enable all found rules and save them to '.putout.json' walking up parent directories
123
121
  --disable-all disable all found rules (set baseline) and save them '.putout.json' walking up parent directories
124
- --match [file name] read .putout.json and convert 'rules' to 'match' using pattern
122
+ --match [pattern] read .putout.json and convert 'rules' to 'match' according to 'pattern'
125
123
  --flow enable flow
126
124
  --fresh generate a fresh cache
127
125
  --no-config avoid reading '.putout.json'
package/help.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "--fix-count [count = 10] ": "count of fixes rounds",
8
8
  "--rulesdir ": "use additional rules from directory",
9
9
  "--transform [replacer] ": "apply Replacer, for example 'var __a = __b -> const __a = __b', read about Replacer https://git.io/JqcMn",
10
- "--plugins [plugins list] ": "a comma-separated list of plugins to use",
10
+ "--plugins [plugins] ": "a comma-separated list of plugins to use",
11
11
  "--enable [rule] ": "enable the rule and save it to '.putout.json' walking up parent directories",
12
12
  "--disable [rule] ": "disable the rule and save it to '.putout.json' walking up parent directories",
13
13
  "--enable-all ": "enable all found rules and save them to '.putout.json' walking up parent directories",
14
14
  "--disable-all ": "disable all found rules (set baseline) and save them to '.putout.json' walking up parent directories",
15
- "--match [file name] ": "read .putout.json and convert 'rules' to 'match' using pattern",
15
+ "--match [pattern] ": "read .putout.json and convert 'rules' to 'match' according to 'pattern'",
16
16
  "--flow ": "enable flow",
17
17
  "--fresh ": "generate a fresh cache",
18
18
  "--no-config ": "avoid reading '.putout.json'",
package/lib/loader.mjs CHANGED
@@ -4,6 +4,24 @@ import parseOptions from './parse-options/index.js';
4
4
 
5
5
  const cwd = process.cwd();
6
6
 
7
+ const toLoad = (transformSource) => async (url, context, defaultLoad) => {
8
+ const {source: rawSource} = await defaultLoad(url, context);
9
+
10
+ if (!rawSource)
11
+ return {
12
+ format: 'commonjs',
13
+ };
14
+
15
+ const {source} = await transformSource(rawSource, {
16
+ url,
17
+ });
18
+
19
+ return {
20
+ source,
21
+ format: 'module',
22
+ };
23
+ };
24
+
7
25
  export const transformSource = (source, context) => {
8
26
  const {url} = context;
9
27
 
@@ -25,3 +43,5 @@ export const transformSource = (source, context) => {
25
43
  };
26
44
  };
27
45
 
46
+ export const load = toLoad(transformSource);
47
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "20.17.0",
3
+ "version": "20.19.2",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
5
  "description": "🐊 Pluggable and configurable code transformer with built-in eslint, babel plugins and jscodeshift codemods support of js, jsx typescript, flow files, markdown, yaml and json",
6
6
  "homepage": "http://github.com/coderaiser/putout",
@@ -15,7 +15,7 @@
15
15
  "./process-file": "./lib/cli/process-file.js",
16
16
  "./exit-codes": "./lib/cli/exit-codes.mjs",
17
17
  "./cli": "./lib/cli/index.js",
18
- "./loader": "./lib/loader.js",
18
+ "./loader": "./lib/loader.mjs",
19
19
  "./eslint": "./lib/cli/eslint/index.js",
20
20
  "./package.json": "./package.json"
21
21
  },
@@ -177,7 +177,7 @@
177
177
  "@putout/processor-javascript": "^3.0.0",
178
178
  "@putout/processor-json": "^3.0.0",
179
179
  "@putout/processor-markdown": "^5.0.0",
180
- "@putout/processor-yaml": "^2.0.0",
180
+ "@putout/processor-yaml": "^3.0.0",
181
181
  "@putout/traverse": "^4.0.0",
182
182
  "chalk": "^4.0.0",
183
183
  "ci-info": "^3.1.1",