@putout/processor-filesystem 7.2.0 → 8.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.
package/README.md CHANGED
@@ -27,7 +27,8 @@ npm i @putout/processor-filesystem -D
27
27
  import {create} from '@putout/process-filesystem/create'
28
28
 
29
29
  const {branch, merge} = create({
30
- cli: false,
30
+ cli: true,
31
+ maybeSimple: true,
31
32
  });
32
33
  ```
33
34
 
package/lib/create.js CHANGED
@@ -1,5 +1,5 @@
1
- import * as filesystemCLI from '@putout/cli-filesystem';
2
- import * as filesystem from '@putout/operator-filesystem';
1
+ import * as _filesystemCLI from '@putout/cli-filesystem';
2
+ import {inject, eject} from '@putout/operator-filesystem/maybe';
3
3
  import {
4
4
  fromJS,
5
5
  toJS,
@@ -8,9 +8,17 @@ import {
8
8
  import {isFilesystem} from './is-filesystem.js';
9
9
  import {maybeFromSimple} from './from-simple.js';
10
10
 
11
- export const create = ({cli = true} = {}) => {
11
+ export const create = (overrides = {}) => {
12
+ const {
13
+ cli = false,
14
+ maybeSimple = true,
15
+ filesystemCLI,
16
+ } = overrides;
17
+
12
18
  const branch = createBranch({
13
19
  cli,
20
+ maybeSimple,
21
+ filesystemCLI,
14
22
  });
15
23
 
16
24
  const merge = createMerge({
@@ -23,8 +31,19 @@ export const create = ({cli = true} = {}) => {
23
31
  };
24
32
  };
25
33
 
26
- const createBranch = ({cli}) => (rawSource) => {
27
- cli && filesystem.init(filesystemCLI);
34
+ const createBranch = (overrides) => (rawSource) => {
35
+ const {
36
+ cli,
37
+ maybeSimple,
38
+ filesystemCLI = _filesystemCLI,
39
+ } = overrides;
40
+
41
+ cli && inject(filesystemCLI);
42
+
43
+ if (!maybeSimple)
44
+ return [{
45
+ source: toJS(rawSource, __filesystem),
46
+ }];
28
47
 
29
48
  const source = toJS(maybeFromSimple(rawSource), __filesystem);
30
49
 
@@ -34,7 +53,7 @@ const createBranch = ({cli}) => (rawSource) => {
34
53
  };
35
54
 
36
55
  const createMerge = ({cli}) => (rawSource, list) => {
37
- cli && filesystem.deinit();
56
+ cli && eject();
38
57
 
39
58
  const [source] = list.filter(isFilesystem);
40
59
 
package/lib/filesystem.js CHANGED
@@ -1,4 +1,4 @@
1
- import {create} from './create.js';
1
+ import {create} from '#create';
2
2
 
3
3
  export const files = [
4
4
  '.filesystem.json',
@@ -6,4 +6,5 @@ export const files = [
6
6
 
7
7
  export const {branch, merge} = create({
8
8
  cli: true,
9
+ maybeSimple: true,
9
10
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/processor-filesystem",
3
- "version": "7.2.0",
3
+ "version": "8.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 filesystem",
@@ -10,6 +10,9 @@
10
10
  ".": "./lib/filesystem.js",
11
11
  "./create": "./lib/create.js"
12
12
  },
13
+ "imports": {
14
+ "#create": "./lib/create.js"
15
+ },
13
16
  "release": false,
14
17
  "tag": false,
15
18
  "changelog": false,
@@ -56,7 +59,7 @@
56
59
  },
57
60
  "dependencies": {
58
61
  "@putout/cli-filesystem": "^3.0.0",
59
- "@putout/operator-filesystem": "^10.0.0",
62
+ "@putout/operator-filesystem": "^11.0.0",
60
63
  "@putout/operator-json": "^3.0.0"
61
64
  }
62
65
  }