putout 24.0.2 → 24.1.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,3 +1,14 @@
1
+ 2022.01.14, v24.1.0
2
+
3
+ feature:
4
+ - (@putout/test) get rid of simport
5
+ - (putout) get rid of simport
6
+ - (package) @putout/cli-ruler v2.0.0
7
+ - (@putout/cli-ruler) named export ruler
8
+ - (@putout/processor-markdown) rm simport
9
+ - (@putout/plugin-tape) mv remove-only, remove-skip from dependencies
10
+
11
+
1
12
  2022.01.13, v24.0.2
2
13
 
3
14
  feature:
@@ -7,7 +7,7 @@ const {
7
7
  CANNOT_LOAD_FORMATTER,
8
8
  } = require('./exit-codes');
9
9
 
10
- const simpleImport = require('./simple-import');
10
+ const {simpleImportDefault} = require('./simple-import');
11
11
 
12
12
  const stub = () => () => {};
13
13
 
@@ -48,7 +48,7 @@ async function loadFormatter(names) {
48
48
  let reporter;
49
49
 
50
50
  for (const name of names) {
51
- [e, reporter] = await tryToCatch(simpleImport, name);
51
+ [e, reporter] = await tryToCatch(simpleImportDefault, name);
52
52
 
53
53
  if (!e)
54
54
  return [null, reporter];
package/lib/cli/index.js CHANGED
@@ -11,10 +11,8 @@ const fullstore = require('fullstore');
11
11
  const tryCatch = require('try-catch');
12
12
  const tryToCatch = require('try-to-catch');
13
13
  const wraptile = require('wraptile');
14
- const {createSimport} = require('simport');
15
14
  const {version} = require('../../package.json');
16
-
17
- const simport = createSimport(__filename);
15
+ const {simpleImport} = require('./simple-import');
18
16
 
19
17
  const {env} = process;
20
18
  const isIDE = /JetBrains/.test(env.TERMINAL_EMULATOR) || env.TERM_PROGRAM === 'vscode';
@@ -198,7 +196,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
198
196
  }
199
197
 
200
198
  if (isStr(args.match)) {
201
- const {match, matchErrors} = await import('@putout/cli-match');
199
+ const {match, matchErrors} = await simpleImport('@putout/cli-match');
202
200
  const code = await match({
203
201
  pattern: args.match,
204
202
  cwd,
@@ -213,8 +211,8 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
213
211
  return exit(RULLER_WITH_FIX, Error('`--fix` cannot be used with ruler toggler (`--enable`, `--disable`)'));
214
212
 
215
213
  if (enable || disable) {
216
- const rulerProcessor = await simport('@putout/cli-ruler');
217
- rulerProcessor({enable, disable, readFile, writeFile}, []);
214
+ const {ruler} = await simpleImport('@putout/cli-ruler');
215
+ ruler({enable, disable, readFile, writeFile}, []);
218
216
  }
219
217
 
220
218
  const noConfig = !args.config;
@@ -249,7 +247,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
249
247
 
250
248
  if (staged) {
251
249
  const {get} = require('./staged');
252
- const {findUp} = await import('find-up');
250
+ const {findUp} = await simpleImport('find-up');
253
251
  const names = await get({findUp});
254
252
 
255
253
  stagedNames.push(...names);
@@ -415,13 +413,13 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
415
413
  fileCache.reconcile();
416
414
 
417
415
  if (enableAll || disableAll) {
418
- const rulerProcessor = await simport('@putout/cli-ruler');
419
- await rulerProcessor({enableAll, disableAll, readFile, writeFile}, mergedPlaces);
416
+ const {ruler} = await simpleImport('@putout/cli-ruler');
417
+ await ruler({enableAll, disableAll, readFile, writeFile}, mergedPlaces);
420
418
  }
421
419
 
422
420
  if (fix && staged) {
423
421
  const {set} = require('./staged');
424
- const {findUp} = await import('find-up');
422
+ const {findUp} = await simpleImport('find-up');
425
423
  const stagedNames = await set({findUp});
426
424
 
427
425
  if (!stagedNames.length)
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // yarn doesn't understand how simport works
4
- // https://github.com/coderaiser/putout/issues/93
5
-
6
- module.exports = async (url) => (await import(url)).default;
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);
7
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "24.0.2",
3
+ "version": "24.1.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",
@@ -49,7 +49,7 @@
49
49
  "@putout/cli-cache": "^1.0.0",
50
50
  "@putout/cli-keypress": "^1.0.0",
51
51
  "@putout/cli-match": "^1.0.0",
52
- "@putout/cli-ruler": "^1.0.0",
52
+ "@putout/cli-ruler": "^2.0.0",
53
53
  "@putout/cli-validate-args": "^1.0.0",
54
54
  "@putout/compare": "^8.0.0",
55
55
  "@putout/engine-loader": "^5.0.0",
@@ -184,7 +184,6 @@
184
184
  "nano-memoize": "^1.1.11",
185
185
  "once": "^1.4.0",
186
186
  "picomatch": "^2.2.2",
187
- "simport": "^1.2.0",
188
187
  "try-catch": "^3.0.0",
189
188
  "try-to-catch": "^3.0.0",
190
189
  "wraptile": "^3.0.0",