@logtape/logtape 0.5.2-dev.81 → 0.5.3

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/esm/formatter.js CHANGED
@@ -1,4 +1,4 @@
1
- import util from "node:util";
1
+ import util from "./nodeUtil.js";
2
2
  /**
3
3
  * The severity level abbreviations.
4
4
  */
@@ -31,7 +31,7 @@ const inspect =
31
31
  ? globalThis.Deno.inspect.bind(globalThis.Deno)
32
32
  // @ts-ignore: Node.js global
33
33
  // dnt-shim-ignore
34
- : "inspect" in util && typeof util.inspect === "function"
34
+ : util != null && "inspect" in util && typeof util.inspect === "function"
35
35
  // @ts-ignore: Node.js global
36
36
  // dnt-shim-ignore
37
37
  ? util.inspect.bind(util)
package/esm/fs.cjs CHANGED
@@ -7,7 +7,7 @@ if (
7
7
  "Bun" in globalThis
8
8
  ) {
9
9
  try {
10
- fs = require("node" + ":fs");
10
+ fs = require(["node", "fs"].join(":"));
11
11
  } catch (_) {
12
12
  fs = null;
13
13
  }
@@ -0,0 +1,16 @@
1
+ let util = null;
2
+ if (
3
+ "process" in globalThis && "versions" in globalThis.process &&
4
+ "node" in globalThis.process.versions &&
5
+ typeof globalThis.caches === "undefined" &&
6
+ typeof globalThis.addEventListener !== "function" ||
7
+ "Bun" in globalThis
8
+ ) {
9
+ try {
10
+ util = require(["node", "util"].join(":"));
11
+ } catch (_) {
12
+ util = null;
13
+ }
14
+ }
15
+
16
+ module.exports = util;
@@ -0,0 +1,2 @@
1
+ import util from "./nodeUtil.cjs";
2
+ export default util;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logtape/logtape",
3
- "version": "0.5.2-dev.81+88f228ae",
3
+ "version": "0.5.3",
4
4
  "description": "Simple logging library with zero dependencies for Deno/Node.js/Bun/browsers",
5
5
  "keywords": [
6
6
  "logging",
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ansiColorFormatter = void 0;
7
7
  exports.defaultTextFormatter = defaultTextFormatter;
8
8
  exports.defaultConsoleFormatter = defaultConsoleFormatter;
9
- const node_util_1 = __importDefault(require("node:util"));
9
+ const nodeUtil_js_1 = __importDefault(require("./nodeUtil.js"));
10
10
  /**
11
11
  * The severity level abbreviations.
12
12
  */
@@ -39,10 +39,10 @@ const inspect =
39
39
  ? globalThis.Deno.inspect.bind(globalThis.Deno)
40
40
  // @ts-ignore: Node.js global
41
41
  // dnt-shim-ignore
42
- : "inspect" in node_util_1.default && typeof node_util_1.default.inspect === "function"
42
+ : nodeUtil_js_1.default != null && "inspect" in nodeUtil_js_1.default && typeof nodeUtil_js_1.default.inspect === "function"
43
43
  // @ts-ignore: Node.js global
44
44
  // dnt-shim-ignore
45
- ? node_util_1.default.inspect.bind(node_util_1.default)
45
+ ? nodeUtil_js_1.default.inspect.bind(nodeUtil_js_1.default)
46
46
  : (v) => JSON.stringify(v);
47
47
  /**
48
48
  * The default text formatter. This formatter formats log records as follows:
package/script/fs.js CHANGED
@@ -7,7 +7,7 @@ if (
7
7
  "Bun" in globalThis
8
8
  ) {
9
9
  try {
10
- fs = require("node" + ":fs");
10
+ fs = require(["node", "fs"].join(":"));
11
11
  } catch (_) {
12
12
  fs = null;
13
13
  }
@@ -0,0 +1,16 @@
1
+ let util = null;
2
+ if (
3
+ "process" in globalThis && "versions" in globalThis.process &&
4
+ "node" in globalThis.process.versions &&
5
+ typeof globalThis.caches === "undefined" &&
6
+ typeof globalThis.addEventListener !== "function" ||
7
+ "Bun" in globalThis
8
+ ) {
9
+ try {
10
+ util = require(["node", "util"].join(":"));
11
+ } catch (_) {
12
+ util = null;
13
+ }
14
+ }
15
+
16
+ module.exports = util;
@@ -0,0 +1,3 @@
1
+ import util from "node:util";
2
+ export default util;
3
+ //# sourceMappingURL=nodeUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodeUtil.d.ts","sourceRoot":"","sources":["../src/nodeUtil.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,eAAe,IAAI,CAAC"}