putout 26.2.1 → 26.4.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/ChangeLog CHANGED
@@ -1,7 +1,30 @@
1
+ 2022.05.18, v26.4.0
2
+
3
+ feature:
4
+ - (@putout/plugin-tape) add apply-destructuring
5
+ - (@putout/plugin-remove-useless-assign) add
6
+
7
+
8
+ 2022.05.17, v26.3.1
9
+
10
+ feature:
11
+ - (putout) add ability to override import of processors for yarn pnp
12
+
13
+
14
+ 2022.05.17, v26.3.0
15
+
16
+ feature:
17
+ - (@putout/engine-loader) add ability to pass loader
18
+ - (@putout/engine-processor) add ability to pass load
19
+ - (@putout/engine-loader) add support of load
20
+ - (putout) cli: formatter: add support of load
21
+ - (putout) worker: add ability to pass load to getProcessors
22
+
23
+
1
24
  2022.05.16, v26.2.1
2
25
 
3
26
  feature:
4
- - (putout) parse-optios: apply-module-type-rules: simplify
27
+ - (putout) parse-options: apply-module-type-rules: simplify
5
28
  - (package) @putout/processor-css v5.0.0
6
29
  - (@putout/processor-html) convert to ESM
7
30
 
package/README.md CHANGED
@@ -69,6 +69,7 @@ module.exports.replace = () => ({
69
69
  - ✅ remove unused `private fields`;
70
70
  - ✅ remove unused `expressions`;
71
71
  - ✅ remove useless `variables`;
72
+ - ✅ remove useless `Object.assign()`;
72
73
  - ✅ remove useless `map`;
73
74
  - ✅ remove useless `mapped types`;
74
75
  - ✅ remove useless `mapping modifiers`;
@@ -2,6 +2,7 @@
2
2
 
3
3
  const tryToCatch = require('try-to-catch');
4
4
  const {createAsyncLoader} = require('@putout/engine-loader');
5
+ const {simpleImport} = require('./simple-import');
5
6
 
6
7
  const {
7
8
  NO_FORMATTER,
@@ -15,7 +16,7 @@ module.exports.getFormatter = async (formatterOptional, exit) => {
15
16
  const [formatterName, formatterOptions] = maybeArray(formatterOptional);
16
17
  const loadFormatter = createAsyncLoader('formatter');
17
18
 
18
- const [error, formatter] = await tryToCatch(loadFormatter, formatterName, exit);
19
+ const [error, formatter] = await tryToCatch(loadFormatter, formatterName, simpleImport);
19
20
 
20
21
  if (formatter)
21
22
  return [formatter, formatterOptions];
package/lib/cli/index.js CHANGED
@@ -11,10 +11,7 @@ const fullstore = require('fullstore');
11
11
 
12
12
  const keyPress = require('@putout/cli-keypress');
13
13
  const {version} = require('../../package.json');
14
- const {
15
- simpleImport,
16
- simpleImportDefault,
17
- } = require('./simple-import');
14
+ const {simpleImport} = require('./simple-import');
18
15
  const {run} = require('./runner/runner.js');
19
16
 
20
17
  const {
@@ -144,7 +141,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
144
141
  plugins,
145
142
  } = args;
146
143
 
147
- const {red} = await simpleImportDefault('chalk');
144
+ const {red} = await simpleImport('chalk');
148
145
  const exit = getExit({
149
146
  red,
150
147
  raw,
@@ -215,7 +212,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
215
212
  } = config;
216
213
 
217
214
  const [currentFormat, formatterOptions] = await getFormatter(format || formatter, exit);
218
- const [error, processorRunners] = await tryToCatch(getProcessorRunners, processors);
215
+ const [error, processorRunners] = await tryToCatch(getProcessorRunners, processors, simpleImport);
219
216
 
220
217
  if (error)
221
218
  return exit(CANNOT_LOAD_PROCESSOR, error);
@@ -12,6 +12,7 @@ const {runProcessors} = require('@putout/engine-processor');
12
12
 
13
13
  const parseError = require('../parse-error.js');
14
14
  const getOptions = require('../get-options.js');
15
+ const {simpleImport} = require('../simple-import');
15
16
  const {
16
17
  INVALID_CONFIG,
17
18
  NO_PROCESSORS,
@@ -92,6 +93,7 @@ module.exports = async ({readFile, report, writeFile, exit, raw, write, log, cur
92
93
  options,
93
94
  rawSource,
94
95
  processorRunners,
96
+ load: simpleImport,
95
97
  });
96
98
 
97
99
  if (error) {
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- // How in other way to mock import using mock require in CommonJS?
4
- module.exports.simpleImportDefault = async (url) => (await import(url)).default;
5
- module.exports.simpleImport = async (url) => await import(url);
3
+ module.exports.simpleImport = async (url) => {
4
+ const result = await import(url);
5
+ return result.default || result;
6
+ };
6
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "26.2.1",
3
+ "version": "26.4.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊 Pluggable and configurable code transformer with built-in eslint and babel plugins support of js, jsx typescript, flow files, markdown, yaml and json",
@@ -143,6 +143,7 @@
143
143
  "@putout/plugin-remove-useless-array-constructor": "^1.0.0",
144
144
  "@putout/plugin-remove-useless-array-entries": "^1.0.0",
145
145
  "@putout/plugin-remove-useless-array-from": "^2.0.0",
146
+ "@putout/plugin-remove-useless-assign": "^1.0.0",
146
147
  "@putout/plugin-remove-useless-conditions": "^1.0.0",
147
148
  "@putout/plugin-remove-useless-constructor": "^1.0.0",
148
149
  "@putout/plugin-remove-useless-continue": "^1.0.0",
@@ -210,7 +211,6 @@
210
211
  ],
211
212
  "devDependencies": {
212
213
  "@babel/plugin-transform-react-jsx": "^7.14.5",
213
- "@cloudcmd/stub": "^3.0.0",
214
214
  "babel-plugin-transform-inline-consecutive-adds": "^0.5.0-alpha.9",
215
215
  "c8": "^7.5.0",
216
216
  "currify": "^4.0.0",
package/putout.json CHANGED
@@ -145,6 +145,7 @@
145
145
  "remove-unused-for-of-variables",
146
146
  "remove-unused-private-fields",
147
147
  "remove-unused-expressions",
148
+ "remove-useless-assign",
148
149
  "remove-useless-variables",
149
150
  "remove-useless-else",
150
151
  "remove-useless-map",