memfs 3.2.3 → 3.2.4
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/internal/errors.d.ts +3 -1
- package/lib/internal/errors.js +5 -4
- package/lib/setImmediate.js +2 -2
- package/lib/setTimeoutUnref.js +1 -1
- package/lib/volume.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.2.4](https://github.com/streamich/memfs/compare/v3.2.3...v3.2.4) (2021-09-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 🐛 use globalThis defensively ([eed6bbf](https://github.com/streamich/memfs/commit/eed6bbfa2fc310639974ed9e163876ff8253b321))
|
|
7
|
+
|
|
1
8
|
## [3.2.3](https://github.com/streamich/memfs/compare/v3.2.2...v3.2.3) (2021-08-31)
|
|
2
9
|
|
|
3
10
|
|
package/lib/internal/errors.d.ts
CHANGED
package/lib/internal/errors.js
CHANGED
|
@@ -42,6 +42,7 @@ function makeNodeError(Base) {
|
|
|
42
42
|
return NodeError;
|
|
43
43
|
}(Base));
|
|
44
44
|
}
|
|
45
|
+
var g = typeof globalThis !== 'undefined' ? globalThis : global;
|
|
45
46
|
var AssertionError = /** @class */ (function (_super) {
|
|
46
47
|
__extends(AssertionError, _super);
|
|
47
48
|
function AssertionError(options) {
|
|
@@ -66,7 +67,7 @@ var AssertionError = /** @class */ (function (_super) {
|
|
|
66
67
|
return _this;
|
|
67
68
|
}
|
|
68
69
|
return AssertionError;
|
|
69
|
-
}(
|
|
70
|
+
}(g.Error));
|
|
70
71
|
exports.AssertionError = AssertionError;
|
|
71
72
|
function message(key, args) {
|
|
72
73
|
assert.strictEqual(typeof key, 'string');
|
|
@@ -92,9 +93,9 @@ function E(sym, val) {
|
|
|
92
93
|
messages[sym] = typeof val === 'function' ? val : String(val);
|
|
93
94
|
}
|
|
94
95
|
exports.E = E;
|
|
95
|
-
exports.Error = makeNodeError(
|
|
96
|
-
exports.TypeError = makeNodeError(
|
|
97
|
-
exports.RangeError = makeNodeError(
|
|
96
|
+
exports.Error = makeNodeError(g.Error);
|
|
97
|
+
exports.TypeError = makeNodeError(g.TypeError);
|
|
98
|
+
exports.RangeError = makeNodeError(g.RangeError);
|
|
98
99
|
// To declare an error message, use the E(sym, val) function above. The sym
|
|
99
100
|
// must be an upper case string. The val can be either a function or a string.
|
|
100
101
|
// The return value of the function must be a string.
|
package/lib/setImmediate.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var _setImmediate;
|
|
4
4
|
if (typeof setImmediate === 'function')
|
|
5
|
-
_setImmediate = setImmediate.bind(globalThis);
|
|
5
|
+
_setImmediate = setImmediate.bind(typeof globalThis !== 'undefined' ? globalThis : global);
|
|
6
6
|
else
|
|
7
|
-
_setImmediate = setTimeout.bind(globalThis);
|
|
7
|
+
_setImmediate = setTimeout.bind(typeof globalThis !== 'undefined' ? globalThis : global);
|
|
8
8
|
exports.default = _setImmediate;
|
package/lib/setTimeoutUnref.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
* only in Node's environment it will "unref" its macro task.
|
|
6
6
|
*/
|
|
7
7
|
function setTimeoutUnref(callback, time, args) {
|
|
8
|
-
var ref = setTimeout.apply(globalThis, arguments);
|
|
8
|
+
var ref = setTimeout.apply(typeof globalThis !== 'undefined' ? globalThis : global, arguments);
|
|
9
9
|
if (ref && typeof ref === 'object' && typeof ref.unref === 'function')
|
|
10
10
|
ref.unref();
|
|
11
11
|
return ref;
|
package/lib/volume.js
CHANGED
|
@@ -1853,7 +1853,7 @@ var StatWatcher = /** @class */ (function (_super) {
|
|
|
1853
1853
|
if (persistent === void 0) { persistent = true; }
|
|
1854
1854
|
if (interval === void 0) { interval = 5007; }
|
|
1855
1855
|
this.filename = pathToFilename(path);
|
|
1856
|
-
this.setTimeout = persistent ? setTimeout.bind(globalThis) : setTimeoutUnref_1.default;
|
|
1856
|
+
this.setTimeout = persistent ? setTimeout.bind(typeof globalThis !== 'undefined' ? globalThis : global) : setTimeoutUnref_1.default;
|
|
1857
1857
|
this.interval = interval;
|
|
1858
1858
|
this.prev = this.vol.statSync(this.filename);
|
|
1859
1859
|
this.loop();
|