memfs 3.4.0 → 3.4.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.md +7 -0
- package/lib/node.d.ts +5 -1
- package/lib/node.js +21 -2
- package/lib/volume.js +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.4.1](https://github.com/streamich/memfs/compare/v3.4.0...v3.4.1) (2021-12-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* recursively sync children steps to fix rename ([43e8222](https://github.com/streamich/memfs/commit/43e82223046362c5e0176c112675c5636baac389))
|
|
7
|
+
|
|
1
8
|
# [3.4.0](https://github.com/streamich/memfs/compare/v3.3.0...v3.4.0) (2021-11-24)
|
|
2
9
|
|
|
3
10
|
|
package/lib/node.d.ts
CHANGED
|
@@ -64,10 +64,13 @@ export declare class Link extends EventEmitter {
|
|
|
64
64
|
children: {
|
|
65
65
|
[child: string]: Link | undefined;
|
|
66
66
|
};
|
|
67
|
-
|
|
67
|
+
private _steps;
|
|
68
68
|
node: Node;
|
|
69
69
|
ino: number;
|
|
70
70
|
length: number;
|
|
71
|
+
name: string;
|
|
72
|
+
get steps(): string[];
|
|
73
|
+
set steps(val: string[]);
|
|
71
74
|
constructor(vol: Volume, parent: Link, name: string);
|
|
72
75
|
setNode(node: Node): void;
|
|
73
76
|
getNode(): Node;
|
|
@@ -91,6 +94,7 @@ export declare class Link extends EventEmitter {
|
|
|
91
94
|
ino: number;
|
|
92
95
|
children: string[];
|
|
93
96
|
};
|
|
97
|
+
syncSteps(): void;
|
|
94
98
|
}
|
|
95
99
|
/**
|
|
96
100
|
* Represents an open file (file descriptor) that points to a `Link` (Hard-link) and a `Node`.
|
package/lib/node.js
CHANGED
|
@@ -223,16 +223,32 @@ var Link = /** @class */ (function (_super) {
|
|
|
223
223
|
var _this = _super.call(this) || this;
|
|
224
224
|
_this.children = {};
|
|
225
225
|
// Path to this node as Array: ['usr', 'bin', 'node'].
|
|
226
|
-
_this.
|
|
226
|
+
_this._steps = [];
|
|
227
227
|
// "i-node" number of the node.
|
|
228
228
|
_this.ino = 0;
|
|
229
229
|
// Number of children.
|
|
230
230
|
_this.length = 0;
|
|
231
231
|
_this.vol = vol;
|
|
232
232
|
_this.parent = parent;
|
|
233
|
-
_this.
|
|
233
|
+
_this.name = name;
|
|
234
|
+
_this.syncSteps();
|
|
234
235
|
return _this;
|
|
235
236
|
}
|
|
237
|
+
Object.defineProperty(Link.prototype, "steps", {
|
|
238
|
+
get: function () {
|
|
239
|
+
return this._steps;
|
|
240
|
+
},
|
|
241
|
+
// Recursively sync children steps, e.g. in case of dir rename
|
|
242
|
+
set: function (val) {
|
|
243
|
+
this._steps = val;
|
|
244
|
+
for (var _i = 0, _a = Object.values(this.children); _i < _a.length; _i++) {
|
|
245
|
+
var child = _a[_i];
|
|
246
|
+
child === null || child === void 0 ? void 0 : child.syncSteps();
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
enumerable: false,
|
|
250
|
+
configurable: true
|
|
251
|
+
});
|
|
236
252
|
Link.prototype.setNode = function (node) {
|
|
237
253
|
this.node = node;
|
|
238
254
|
this.ino = node.ino;
|
|
@@ -313,6 +329,9 @@ var Link = /** @class */ (function (_super) {
|
|
|
313
329
|
children: Object.keys(this.children),
|
|
314
330
|
};
|
|
315
331
|
};
|
|
332
|
+
Link.prototype.syncSteps = function () {
|
|
333
|
+
this.steps = this.parent ? this.parent.steps.concat([this.name]) : [this.name];
|
|
334
|
+
};
|
|
316
335
|
return Link;
|
|
317
336
|
}(events_1.EventEmitter));
|
|
318
337
|
exports.Link = Link;
|
package/lib/volume.js
CHANGED
|
@@ -1329,6 +1329,7 @@ var Volume = /** @class */ (function () {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
// Rename should overwrite the new path, if that exists.
|
|
1331
1331
|
var name = newPathSteps[newPathSteps.length - 1];
|
|
1332
|
+
link.name = name;
|
|
1332
1333
|
link.steps = __spreadArray(__spreadArray([], newPathDirLink.steps, true), [name], false);
|
|
1333
1334
|
newPathDirLink.setChild(link.getName(), link);
|
|
1334
1335
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memfs",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "In-memory file-system with Node's fs API.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"@types/node": "10.17.60",
|
|
31
31
|
"cpy-cli": "3.1.1",
|
|
32
32
|
"husky": "7.0.4",
|
|
33
|
-
"jest": "27.
|
|
34
|
-
"prettier": "2.
|
|
35
|
-
"pretty-quick": "3.1.
|
|
33
|
+
"jest": "27.4.5",
|
|
34
|
+
"prettier": "2.5.1",
|
|
35
|
+
"pretty-quick": "3.1.3",
|
|
36
36
|
"rimraf": "3.0.2",
|
|
37
|
-
"ts-jest": "27.
|
|
37
|
+
"ts-jest": "27.1.2",
|
|
38
38
|
"ts-node": "10.4.0",
|
|
39
39
|
"tslint": "5.20.1",
|
|
40
40
|
"tslint-config-common": "1.6.0",
|
|
41
|
-
"typescript": "4.5.
|
|
41
|
+
"typescript": "4.5.4",
|
|
42
42
|
"semantic-release": "18.0.1",
|
|
43
43
|
"@semantic-release/changelog": "6.0.1",
|
|
44
44
|
"@semantic-release/git": "10.0.1",
|