putout 32.6.0 → 32.7.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,13 @@
1
+ 2023.10.28, v32.7.0
2
+
3
+ feature:
4
+ - ca284d35c package: @putout/plugin-logical-expressions v5.0.0
5
+ - ad44b4283 @putout/plugin-logical-expressions: drop support of 🐊 < 32
6
+ - ecd39020e putout: printer: add ability to handle endOfFile in markdown listings without ESLint
7
+ - 7587c2c4c package: @putout/plugin-regexp v8.0.0
8
+ - a4110ac0c @putout/plugin-regexp: drop support of 🐊 < 32
9
+ - 798576371 package: @putout/printer v6.0.0
10
+
1
11
  2023.10.28, v32.6.0
2
12
 
3
13
  fix:
@@ -0,0 +1,25 @@
1
+ const {assign} = Object;
2
+ const {isArray} = Array;
3
+ const maybeArray = (a) => isArray(a) ? a : [a];
4
+
5
+ const DefaultMarkdown = {
6
+ format: {
7
+ endOfFile: '',
8
+ },
9
+ };
10
+
11
+ export const configurePrinter = (name, printerOptions) => {
12
+ const [printer = 'putout', options = {}] = maybeArray(printerOptions);
13
+
14
+ if (printer !== 'putout')
15
+ return printerOptions;
16
+
17
+ if (name.endsWith('.md{json}'))
18
+ assign(options, DefaultMarkdown);
19
+ else if (name.endsWith('.md{js}'))
20
+ assign(options, DefaultMarkdown);
21
+ else if (name.endsWith('.md{ts}'))
22
+ assign(options, DefaultMarkdown);
23
+
24
+ return [printer, options];
25
+ };
@@ -17,6 +17,7 @@ const getMatchedOptions = (name, options) => {
17
17
  };
18
18
 
19
19
  module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async ({name, source, startLine, options}) => {
20
+ const {configurePrinter} = await import('./printer/printer.mjs');
20
21
  const isTS = /\.tsx?$/.test(name) || /{tsx?}$/.test(name);
21
22
  const matchedOptions = getMatchedOptions(name, options);
22
23
 
@@ -25,8 +26,8 @@ module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async ({na
25
26
  fixCount,
26
27
  isTS,
27
28
  isFlow,
28
- printer,
29
29
  ...matchedOptions,
30
+ printer: configurePrinter(name, printer),
30
31
  });
31
32
 
32
33
  if (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "32.6.0",
3
+ "version": "32.7.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, Babel and support of js, jsx, typescript, flow, markdown, yaml and json",
@@ -105,7 +105,7 @@
105
105
  "@putout/plugin-for-of": "^3.0.0",
106
106
  "@putout/plugin-github": "^9.0.0",
107
107
  "@putout/plugin-gitignore": "^3.0.0",
108
- "@putout/plugin-logical-expressions": "^4.0.0",
108
+ "@putout/plugin-logical-expressions": "^5.0.0",
109
109
  "@putout/plugin-madrun": "^17.0.0",
110
110
  "@putout/plugin-math": "^2.0.0",
111
111
  "@putout/plugin-maybe": "^1.0.0",