putout 26.2.0 → 26.2.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,11 @@
1
+ 2022.05.16, v26.2.1
2
+
3
+ feature:
4
+ - (putout) parse-optios: apply-module-type-rules: simplify
5
+ - (package) @putout/processor-css v5.0.0
6
+ - (@putout/processor-html) convert to ESM
7
+
8
+
1
9
  2022.05.15, v26.2.0
2
10
 
3
11
  feature:
@@ -1,25 +1,37 @@
1
1
  'use strict';
2
2
 
3
3
  const {assign} = Object;
4
- const getRuleByType = (a) => a === 'module' ? 'convert-commonjs-to-esm' : 'convert-esm-to-commonjs';
4
+ const merge = require('../merge');
5
5
 
6
6
  module.exports = ({type}, options) => {
7
- const rule = getRuleByType(type);
8
- const js = '*.js';
9
-
10
- assign(options, {
7
+ const rules = type === 'module' ? esm() : commonjs();
8
+ assign(options, merge(options, rules));
9
+ };
10
+
11
+ function commonjs() {
12
+ return {
11
13
  match: {
12
- ...options.match,
13
- [js]: {
14
- ...options.match?.[js],
15
- [rule]: 'on',
14
+ '*.js': {
15
+ 'convert-esm-to-commonjs': 'on',
16
16
  },
17
17
  '.eslintrc.json': {
18
- ...options.match?.['.eslintrc.json'],
19
18
  'eslint': 'on',
20
- 'eslint/convert-require-to-import': type === 'module' ? 'on' : 'off',
19
+ 'eslint/convert-require-to-import': 'off',
21
20
  },
22
21
  },
23
- });
24
- };
22
+ };
23
+ }
25
24
 
25
+ function esm() {
26
+ return {
27
+ match: {
28
+ '*.js': {
29
+ 'convert-commonjs-to-esm': 'on',
30
+ },
31
+ '.eslintrc.json': {
32
+ 'eslint': 'on',
33
+ 'eslint/convert-require-to-import': 'on',
34
+ },
35
+ },
36
+ };
37
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "26.2.0",
3
+ "version": "26.2.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 and babel plugins support of js, jsx typescript, flow files, markdown, yaml and json",