@putout/operator-filesystem 2.9.2 → 2.11.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/lib/filesystem.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const {join} = require('node:path');
4
4
  const tryCatch = require('try-catch');
5
- const {types} = require('putout');
5
+ const {types} = require('@putout/babel');
6
6
 
7
7
  const {
8
8
  setLiteralValue,
@@ -104,6 +104,9 @@ module.exports.removeFile = (filePath) => {
104
104
  };
105
105
 
106
106
  module.exports.moveFile = (filePath, dirPath) => {
107
+ if (filePath === dirPath)
108
+ return;
109
+
107
110
  const dirname = getFilename(dirPath);
108
111
  const filename = getFilename(filePath);
109
112
  const dirPathFiles = getProperty(dirPath, 'files');
@@ -259,3 +262,6 @@ function writeFileContent(filePath, content) {
259
262
 
260
263
  module.exports.init = maybeFS.init;
261
264
  module.exports.deinit = maybeFS.deinit;
265
+
266
+ module.exports.pause = maybeFS.pause;
267
+ module.exports.start = maybeFS.start;
package/lib/maybe-fs.js CHANGED
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const fullstore = require('fullstore');
4
+ const driverStore = fullstore();
5
+
3
6
  const {assign} = Object;
4
7
  const noop = () => {};
5
8
  const returns = (a) => () => a;
@@ -39,10 +42,23 @@ module.exports.writeFileContent = (name) => {
39
42
  maybeFS.writeFileContent(name);
40
43
  };
41
44
 
42
- module.exports.init = (fsDriver) => {
45
+ module.exports.init = init;
46
+
47
+ function init(fsDriver) {
43
48
  assign(maybeFS, fsDriver);
49
+ }
50
+
51
+ module.exports.pause = () => {
52
+ driverStore(maybeFS);
53
+ deinit();
44
54
  };
45
55
 
46
- module.exports.deinit = () => {
47
- assign(maybeFS, defaultFS);
56
+ module.exports.start = () => {
57
+ init(driverStore());
48
58
  };
59
+
60
+ module.exports.deinit = deinit;
61
+
62
+ function deinit() {
63
+ assign(maybeFS, defaultFS);
64
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/operator-filesystem",
3
- "version": "2.9.2",
3
+ "version": "2.11.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout operator adds ability to filesystem referenced variables that was not defined",
@@ -24,7 +24,9 @@
24
24
  "report": "madrun report"
25
25
  },
26
26
  "dependencies": {
27
+ "@putout/babel": "^1.5.5",
27
28
  "@putout/operate": "^11.0.0",
29
+ "fullstore": "^3.0.0",
28
30
  "try-catch": "^3.0.1"
29
31
  },
30
32
  "keywords": [