putout 29.10.1 → 29.11.1

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,35 @@
1
+ 2023.06.03, v29.11.1
2
+
3
+ feature:
4
+ - b66a2572f package: @putout/plugin-convert-apply-to-spread v4.0.0
5
+ - 05bae2435 @putout/plugin-convert-apply-to-spread: drop support of node < 16
6
+ - 4047516f3 @putout/plugin-convert-assert-to-with
7
+
8
+ 2023.06.03, v29.11.0
9
+
10
+ feature:
11
+ - dea4b68d1 putout: exit-codes: --staged: add CANNOT_LINT_STAGED
12
+ - 31c597a47 @putout/engine-parser: babel plugins: add back support of assert in ImportDeclartations
13
+ - a2e019aab @putout/plugin-minify: mangle-names: get back old behaviour since it is more optimal
14
+ - fd7535350 @putout/plugin-minify: mangle-names: use index of scope instead of global counter
15
+ - 885caad0f @putout/engine-parser: add support of import attributes (https://babeljs.io/blog/2023/05/26/7.22.0#import-attributes-15536-15620)
16
+ - 8b3492fb8 @putout/engine-parser: babel: plugins: remove enabled by default
17
+ - 825f6919a @putout/plugin-new: remove-useless: add TypeError
18
+ - be9c83b11 @putout/plugin-minify: expand-bindings: keep only Identifiers
19
+ - 3b3f6f9c4 @putout/plugin-minify: expand-variables: add
20
+ - 550493d90 @putout/plugin-minify: convert-strict-equal-to-equal: add
21
+ - 9150cce3e @putout/plugin-types: use @putout/printer
22
+ - d29eb0bd7 @putout/plugin-types: convert-typeof-to-is-type: improve support of node var binding
23
+ - 47af1a29a @putout/plugin-minify: shorten-names: improve support of freeze, defineProperty
24
+ - cc6f5f577 @putout/engine-runner: store: uplist: check node
25
+ - 806d1a483 @putout/plugin-minify: shorten-name
26
+ - 41dccd651 @putout/plugin-minify: shorten-names: improve support
27
+ - 72990c057 @putout/plugin-minify: merge-variables: add
28
+ - 0195c179d @putout/plugin-minify: convert-const-to-var: add
29
+ - 9edb1d2c8 @putout/plugin-minify: shorten: add ability to check printed
30
+ - ada9b57a2 @putout/plugin-minify: shorten-names: declared
31
+ - b1ff89935 @putout/plugin-minify: shorten names: add
32
+
1
33
  2023.05.30, v29.10.1
2
34
 
3
35
  feature:
@@ -15,5 +15,6 @@ module.exports = {
15
15
  RULLER_NO_FILES: 11,
16
16
  INVALID_CONFIG: 12,
17
17
  UNHANDLED: 13,
18
+ CANNOT_LINT_STAGED: 14,
18
19
  };
19
20
 
@@ -12,3 +12,4 @@ export const RULLER_WITH_FIX = 10;
12
12
  export const RULLER_NO_FILES = 11;
13
13
  export const INVALID_CONFIG = 12;
14
14
  export const UNHANDLED = 13;
15
+ export const CANNOT_LINT_STAGED = 14;
package/lib/cli/index.js CHANGED
@@ -39,6 +39,7 @@ const {
39
39
  RULLER_WITH_FIX,
40
40
  RULLER_NO_FILES,
41
41
  INVALID_CONFIG,
42
+ CANNOT_LINT_STAGED,
42
43
  } = require('./exit-codes');
43
44
 
44
45
  const getFormatter = memo(require('./formatter').getFormatter);
@@ -230,7 +231,10 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
230
231
  if (staged) {
231
232
  const {get} = require('./staged');
232
233
  const {findUp} = await simpleImport('find-up');
233
- const names = await get({findUp});
234
+ const [error, names] = await tryToCatch(get, {findUp});
235
+
236
+ if (error)
237
+ return exit(CANNOT_LINT_STAGED, `--staged: ${error.message}`);
234
238
 
235
239
  stagedNames.push(...names);
236
240
  }
package/lib/cli/staged.js CHANGED
@@ -28,6 +28,9 @@ const findGit = once(async ({findUp}) => {
28
28
  type,
29
29
  });
30
30
 
31
+ if (!gitDir)
32
+ throw Error('not git repository');
33
+
31
34
  const dir = gitDir.replace(/\.git$/, '');
32
35
 
33
36
  return dir;
@@ -40,10 +43,6 @@ const joinDir = (a) => (b) => join(a, b);
40
43
 
41
44
  module.exports.get = async function get({findUp}) {
42
45
  const dir = await findGit({findUp});
43
-
44
- if (!dir)
45
- return [];
46
-
47
46
  const status = await git.statusMatrix({
48
47
  fs,
49
48
  dir,
@@ -72,10 +71,6 @@ async function getStatus(dir, filepath) {
72
71
 
73
72
  module.exports.set = async function set({findUp}) {
74
73
  const dir = await findGit({findUp});
75
-
76
- if (!dir)
77
- return;
78
-
79
74
  const names = namesStore();
80
75
  const statusPromises = [];
81
76
 
@@ -3,13 +3,14 @@
3
3
  const {normalize} = require('path');
4
4
  const picomatch = require('picomatch');
5
5
 
6
+ let isMatch = Boolean;
6
7
  let patterns = [];
7
- let isMatch;
8
8
 
9
9
  const rmDuplicates = (a) => Array.from(new Set(a));
10
10
 
11
11
  module.exports.add = (array) => {
12
12
  patterns = rmDuplicates(patterns.concat(array));
13
+
13
14
  isMatch = picomatch(patterns, {
14
15
  dot: true,
15
16
  matchBase: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "29.10.1",
3
+ "version": "29.11.1",
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, Babel and support of js, jsx, typescript, flow, markdown, yaml and json",
@@ -78,7 +78,7 @@
78
78
  "@putout/plugin-apply-template-literals": "^2.0.0",
79
79
  "@putout/plugin-browserlist": "^1.0.0",
80
80
  "@putout/plugin-conditions": "^1.0.0",
81
- "@putout/plugin-convert-apply-to-spread": "^3.0.0",
81
+ "@putout/plugin-convert-apply-to-spread": "^4.0.0",
82
82
  "@putout/plugin-convert-arguments-to-rest": "^2.0.0",
83
83
  "@putout/plugin-convert-array-copy-to-slice": "^2.0.0",
84
84
  "@putout/plugin-convert-assignment-to-arrow-function": "^1.0.0",