@putout/processor-ignore 4.1.0 → 5.0.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.
Files changed (2) hide show
  1. package/lib/ignore.js +8 -6
  2. package/package.json +4 -2
package/lib/ignore.js CHANGED
@@ -1,9 +1,12 @@
1
+ import {
2
+ __ignore,
3
+ toJS,
4
+ fromJS,
5
+ } from '@putout/operator-json';
6
+
1
7
  const {stringify} = JSON;
2
8
  const rmLast = (a) => !a.endsWith('\n') ? a : a.slice(0, -1);
3
9
 
4
- const prefix = '__putout_processor_ignore(';
5
- const sufix = ');\n';
6
-
7
10
  const parse = (a) => {
8
11
  const fn = Function(`return ${a}`);
9
12
  return fn();
@@ -16,7 +19,7 @@ export const files = [
16
19
 
17
20
  export const branch = (rawSource) => {
18
21
  const array = convertToArray(rawSource);
19
- const source = `${prefix}${array}${sufix}`;
22
+ const source = toJS(array, __ignore);
20
23
 
21
24
  return [{
22
25
  source,
@@ -26,8 +29,7 @@ export const branch = (rawSource) => {
26
29
 
27
30
  export const merge = (rawSource, list) => {
28
31
  const [source] = list;
29
- const length = source.length - sufix.length;
30
- const str = source.slice(prefix.length, length);
32
+ const str = fromJS(source, __ignore);
31
33
  const array = parse(str);
32
34
 
33
35
  return array.join('\n') + '\n';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/processor-ignore",
3
- "version": "4.1.0",
3
+ "version": "5.0.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout processor adds ability to lint ignore",
@@ -23,7 +23,9 @@
23
23
  "coverage": "madrun coverage",
24
24
  "report": "madrun report"
25
25
  },
26
- "dependencies": {},
26
+ "dependencies": {
27
+ "@putout/operator-json": "^1.0.1"
28
+ },
27
29
  "keywords": [
28
30
  "putout",
29
31
  "putout-processor",