@logtape/logtape 0.4.1 → 0.4.2-dev.46
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/_dnt.shims.js +1 -5
- package/esm/filesink.node.js +16 -11
- package/esm/fs.js +12 -0
- package/package.json +1 -1
- package/script/_dnt.shims.js +2 -7
- package/script/filesink.node.js +16 -11
- package/script/fs.js +8 -0
- package/types/_dnt.shims.d.ts +1 -9
- package/types/_dnt.shims.d.ts.map +1 -1
- package/types/_dnt.test_shims.d.ts.map +1 -1
- package/types/filesink.node.d.ts +1 -1
- package/types/filesink.node.d.ts.map +1 -1
- package/types/fs.d.ts +3 -0
- package/types/fs.d.ts.map +1 -0
- package/types/sink.d.ts +1 -4
- package/types/sink.d.ts.map +1 -1
package/esm/_dnt.shims.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { WritableStream } from "node:stream/web";
|
|
3
|
-
const dntGlobals = {
|
|
4
|
-
WritableStream,
|
|
5
|
-
};
|
|
1
|
+
const dntGlobals = {};
|
|
6
2
|
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
7
3
|
function createMergeProxy(baseObj, extObj) {
|
|
8
4
|
return new Proxy(baseObj, {
|
package/esm/filesink.node.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import * as dntShim from "./_dnt.shims.js";
|
|
2
|
-
|
|
2
|
+
// @ts-ignore: a trick to avoid module resolution error on non-Node.js environ
|
|
3
|
+
import fsMod from "./fs.js";
|
|
3
4
|
import { webDriver } from "./filesink.web.js";
|
|
4
5
|
import { getFileSink as getBaseFileSink, getRotatingFileSink as getBaseRotatingFileSink, } from "./sink.js";
|
|
6
|
+
// @ts-ignore: a trick to avoid module resolution error on non-Node.js environ
|
|
7
|
+
const fs = fsMod;
|
|
5
8
|
/**
|
|
6
9
|
* A Node.js-specific file sink driver.
|
|
7
10
|
*/
|
|
8
|
-
export const nodeDriver =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
export const nodeDriver = fs == null
|
|
12
|
+
? webDriver
|
|
13
|
+
: {
|
|
14
|
+
openSync(path) {
|
|
15
|
+
return fs.openSync(path, "a");
|
|
16
|
+
},
|
|
17
|
+
writeSync: fs.writeSync,
|
|
18
|
+
flushSync: fs.fsyncSync,
|
|
19
|
+
closeSync: fs.closeSync,
|
|
20
|
+
statSync: fs.statSync,
|
|
21
|
+
renameSync: fs.renameSync,
|
|
22
|
+
};
|
|
18
23
|
/**
|
|
19
24
|
* Get a file sink.
|
|
20
25
|
*
|
package/esm/fs.js
ADDED
package/package.json
CHANGED
package/script/_dnt.shims.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dntGlobalThis =
|
|
4
|
-
const
|
|
5
|
-
var web_2 = require("node:stream/web");
|
|
6
|
-
Object.defineProperty(exports, "WritableStream", { enumerable: true, get: function () { return web_2.WritableStream; } });
|
|
7
|
-
const dntGlobals = {
|
|
8
|
-
WritableStream: web_1.WritableStream,
|
|
9
|
-
};
|
|
3
|
+
exports.dntGlobalThis = void 0;
|
|
4
|
+
const dntGlobals = {};
|
|
10
5
|
exports.dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
11
6
|
function createMergeProxy(baseObj, extObj) {
|
|
12
7
|
return new Proxy(baseObj, {
|
package/script/filesink.node.js
CHANGED
|
@@ -28,22 +28,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.getRotatingFileSink = exports.getFileSink = exports.nodeDriver = void 0;
|
|
30
30
|
const dntShim = __importStar(require("./_dnt.shims.js"));
|
|
31
|
-
|
|
31
|
+
// @ts-ignore: a trick to avoid module resolution error on non-Node.js environ
|
|
32
|
+
const fs_js_1 = __importDefault(require("./fs.js"));
|
|
32
33
|
const filesink_web_js_1 = require("./filesink.web.js");
|
|
33
34
|
const sink_js_1 = require("./sink.js");
|
|
35
|
+
// @ts-ignore: a trick to avoid module resolution error on non-Node.js environ
|
|
36
|
+
const fs = fs_js_1.default;
|
|
34
37
|
/**
|
|
35
38
|
* A Node.js-specific file sink driver.
|
|
36
39
|
*/
|
|
37
|
-
exports.nodeDriver =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
exports.nodeDriver = fs == null
|
|
41
|
+
? filesink_web_js_1.webDriver
|
|
42
|
+
: {
|
|
43
|
+
openSync(path) {
|
|
44
|
+
return fs.openSync(path, "a");
|
|
45
|
+
},
|
|
46
|
+
writeSync: fs.writeSync,
|
|
47
|
+
flushSync: fs.fsyncSync,
|
|
48
|
+
closeSync: fs.closeSync,
|
|
49
|
+
statSync: fs.statSync,
|
|
50
|
+
renameSync: fs.renameSync,
|
|
51
|
+
};
|
|
47
52
|
/**
|
|
48
53
|
* Get a file sink.
|
|
49
54
|
*
|
package/script/fs.js
ADDED
package/types/_dnt.shims.d.ts
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { WritableStream } from "node:stream/web";
|
|
3
|
-
export { WritableStream } from "node:stream/web";
|
|
4
|
-
export declare const dntGlobalThis: Omit<typeof globalThis, "WritableStream"> & {
|
|
5
|
-
WritableStream: {
|
|
6
|
-
new <W = any>(underlyingSink?: import("stream/web").UnderlyingSink<W> | undefined, strategy?: import("stream/web").QueuingStrategy<W> | undefined): WritableStream<W>;
|
|
7
|
-
prototype: WritableStream<any>;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
1
|
+
export declare const dntGlobalThis: Omit<typeof globalThis, never>;
|
|
10
2
|
//# sourceMappingURL=_dnt.shims.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.test_shims.d.ts","sourceRoot":"","sources":["../src/_dnt.test_shims.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_dnt.test_shims.d.ts","sourceRoot":"","sources":["../src/_dnt.test_shims.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,eAAO,MAAM,aAAa;;CAA2C,CAAC"}
|
package/types/filesink.node.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type FileSinkOptions, type RotatingFileSinkDriver, type RotatingFileSin
|
|
|
3
3
|
/**
|
|
4
4
|
* A Node.js-specific file sink driver.
|
|
5
5
|
*/
|
|
6
|
-
export declare const nodeDriver: RotatingFileSinkDriver<number>;
|
|
6
|
+
export declare const nodeDriver: RotatingFileSinkDriver<number | void>;
|
|
7
7
|
/**
|
|
8
8
|
* Get a file sink.
|
|
9
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesink.node.d.ts","sourceRoot":"","sources":["../src/filesink.node.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"filesink.node.d.ts","sourceRoot":"","sources":["../src/filesink.node.ts"],"names":[],"mappings":";AAKA,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,IAAI,EACV,MAAM,WAAW,CAAC;AAKnB;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,sBAAsB,CAAC,MAAM,GAAG,IAAI,CAW1D,CAAC;AAEJ;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAoB,GAC5B,IAAI,GAAG,UAAU,CAKnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,uBAA4B,GACpC,IAAI,GAAG,UAAU,CAKnB"}
|
package/types/fs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.js"],"names":[],"mappings":""}
|
package/types/sink.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
import * as dntShim from "./_dnt.shims.js";
|
|
5
2
|
import { type FilterLike } from "./filter.js";
|
|
6
3
|
import { type ConsoleFormatter, type TextFormatter } from "./formatter.js";
|
|
7
4
|
import type { LogRecord } from "./record.js";
|
|
@@ -69,7 +66,7 @@ export interface StreamSinkOptions {
|
|
|
69
66
|
* @param options The options for the sink.
|
|
70
67
|
* @returns A sink that writes to the stream.
|
|
71
68
|
*/
|
|
72
|
-
export declare function getStreamSink(stream:
|
|
69
|
+
export declare function getStreamSink(stream: WritableStream, options?: StreamSinkOptions): Sink & AsyncDisposable;
|
|
73
70
|
/**
|
|
74
71
|
* Options for the {@link getConsoleSink} function.
|
|
75
72
|
*/
|
package/types/sink.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sink.d.ts","sourceRoot":"","sources":["../src/sink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sink.d.ts","sourceRoot":"","sources":["../src/sink.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,UAAU,E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